def load_top_conf(config_path): """Loads the top level configuraions. Args: config_path (str): path to yaml configuration file. Returns: dict of 4 main top level configs """ config_hashes = {} top_confs = {"acls": {}, "dps": {}, "routers": {}, "vlans": {}} config_parser_util.dp_include(config_hashes, config_path, "loadtop", top_confs) return top_confs
def _config_parser_v2(config_file, logname): logger = config_parser_util.get_logger(logname) config_path = config_parser_util.dp_config_path(config_file) config_hashes = {} top_confs = {} for top_conf in V2_TOP_CONFS: top_confs[top_conf] = {} if not config_parser_util.dp_include( config_hashes, config_path, logname, top_confs): logger.critical('error found while loading config file: %s', config_path) return None if not top_confs['dps']: logger.critical('DPs not configured in file: %s', config_path) return None dps = _dp_parser_v2( logger, top_confs['acls'], top_confs['dps'], top_confs['meters'], top_confs['routers'], top_confs['vlans']) return (config_hashes, dps)