Commit 63b491e5 authored by Pablo Armingol's avatar Pablo Armingol
Browse files

IP-link service

parent 6883949a
Loading
Loading
Loading
Loading
+52 −42
Original line number Diff line number Diff line
@@ -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:
@@ -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)
        
@@ -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)
@@ -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')
+1 −1

File changed.

Contains only whitespace changes.

+1 −1

File changed.

Contains only whitespace changes.