Loading src/pathcomp/frontend/service/algorithms/tools/ComposeConfigRules.py +52 −42 Original line number Diff line number Diff line Loading @@ -52,6 +52,10 @@ TAPI_SETTINGS_FIELD_DEFAULTS = { 'direction' : 'UNIDIRECTIONAL', } IPLINK_SETTINGS_FIELD_DEFAULTS = { 'mtu' : 1450, } def find_custom_config_rule(config_rules : List, resource_name : str) -> Optional[Dict]: resource_value : Optional[Dict] = None for config_rule in config_rules: Loading Loading @@ -105,7 +109,7 @@ def compose_tapi_config_rules(main_service_config_rules : List, subservice_confi compose_config_rules(main_service_config_rules, subservice_config_rules, rule_name, defaults) def compose_iplink_config_rules(main_service_config_rules : List, subservice_config_rules : List) -> None: CONFIG_RULES = [SETTINGS_RULE_NAME] CONFIG_RULES: List[Tuple[str, dict]] = [(SETTINGS_RULE_NAME, IPLINK_SETTINGS_FIELD_DEFAULTS)] for rule_name, defaults in CONFIG_RULES: compose_config_rules(main_service_config_rules, subservice_config_rules, rule_name, defaults) Loading Loading @@ -318,12 +322,12 @@ def generate_neighbor_endpoint_config_rules( for config_rule in config_rules: # Only applicable, by now, to Custom Config Rules for endpoint settings if 'custom' not in config_rule: continue if 'custom' not in config_rule or 'ip_link' not in config_rule: continue if 'custom' in config_rule: match = RE_ENDPOINT_SETTINGS.match(config_rule['custom']['resource_key']) if match is None: match = RE_ENDPOINT_VLAN_SETTINGS.match(config_rule['custom']['resource_key']) if match is None: continue resource_key_values = match.groups() if resource_key_values[0:2] in device_endpoint_keys_a: resource_key_values = list(resource_key_values) Loading Loading @@ -361,6 +365,12 @@ def generate_neighbor_endpoint_config_rules( generated_config_rule['custom']['resource_key'] = resource_key_template.format(*resource_key_values) generated_config_rule['custom']['resource_value'] = json.dumps(resource_value) generated_config_rules.append(generated_config_rule) else: LOGGER.debug('[generate_neighbor_endpoint_config_rules] IP_LINK: {:s}'.format(str(config_rule))) resource_value : Dict = config_rule['ip_link'] generated_config_rule = copy.deepcopy(config_rule) generated_config_rule['ip_link'] = json.dumps(resource_value) generated_config_rules.append(generated_config_rule) LOGGER.debug('[generate_neighbor_endpoint_config_rules] generated_config_rules={:s}'.format(str(generated_config_rules))) LOGGER.debug('[generate_neighbor_endpoint_config_rules] end') Loading my_deploy.sh +1 −1 File changed.Contains only whitespace changes. Show changes src/webui/service/main/routes.py +1 −1 File changed.Contains only whitespace changes. Show changes Loading
src/pathcomp/frontend/service/algorithms/tools/ComposeConfigRules.py +52 −42 Original line number Diff line number Diff line Loading @@ -52,6 +52,10 @@ TAPI_SETTINGS_FIELD_DEFAULTS = { 'direction' : 'UNIDIRECTIONAL', } IPLINK_SETTINGS_FIELD_DEFAULTS = { 'mtu' : 1450, } def find_custom_config_rule(config_rules : List, resource_name : str) -> Optional[Dict]: resource_value : Optional[Dict] = None for config_rule in config_rules: Loading Loading @@ -105,7 +109,7 @@ def compose_tapi_config_rules(main_service_config_rules : List, subservice_confi compose_config_rules(main_service_config_rules, subservice_config_rules, rule_name, defaults) def compose_iplink_config_rules(main_service_config_rules : List, subservice_config_rules : List) -> None: CONFIG_RULES = [SETTINGS_RULE_NAME] CONFIG_RULES: List[Tuple[str, dict]] = [(SETTINGS_RULE_NAME, IPLINK_SETTINGS_FIELD_DEFAULTS)] for rule_name, defaults in CONFIG_RULES: compose_config_rules(main_service_config_rules, subservice_config_rules, rule_name, defaults) Loading Loading @@ -318,12 +322,12 @@ def generate_neighbor_endpoint_config_rules( for config_rule in config_rules: # Only applicable, by now, to Custom Config Rules for endpoint settings if 'custom' not in config_rule: continue if 'custom' not in config_rule or 'ip_link' not in config_rule: continue if 'custom' in config_rule: match = RE_ENDPOINT_SETTINGS.match(config_rule['custom']['resource_key']) if match is None: match = RE_ENDPOINT_VLAN_SETTINGS.match(config_rule['custom']['resource_key']) if match is None: continue resource_key_values = match.groups() if resource_key_values[0:2] in device_endpoint_keys_a: resource_key_values = list(resource_key_values) Loading Loading @@ -361,6 +365,12 @@ def generate_neighbor_endpoint_config_rules( generated_config_rule['custom']['resource_key'] = resource_key_template.format(*resource_key_values) generated_config_rule['custom']['resource_value'] = json.dumps(resource_value) generated_config_rules.append(generated_config_rule) else: LOGGER.debug('[generate_neighbor_endpoint_config_rules] IP_LINK: {:s}'.format(str(config_rule))) resource_value : Dict = config_rule['ip_link'] generated_config_rule = copy.deepcopy(config_rule) generated_config_rule['ip_link'] = json.dumps(resource_value) generated_config_rules.append(generated_config_rule) LOGGER.debug('[generate_neighbor_endpoint_config_rules] generated_config_rules={:s}'.format(str(generated_config_rules))) LOGGER.debug('[generate_neighbor_endpoint_config_rules] end') Loading