Commit 4fa32a07 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

NBI component - IETF L2 VPN:

- Implemented default bearer generation
- Implemented addition of VLAN-Id as service setting
parent 71ea0da4
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -127,8 +127,15 @@ def process_site_network_access(

        mapping = BEARER_MAPPINGS.get(bearer_reference)
        if mapping is None:
            msg = 'Specified Bearer({:s}) is not configured.'
            raise Exception(msg.format(str(bearer_reference)))
            if ':' not in bearer_reference:
                MSG = 'Bearer({:s}) not found; unable to auto-generated mapping'
                raise Exception(MSG.format(str(bearer_reference)))
            mapping = str(bearer_reference).split(':', maxsplit=1)
            mapping.extend([None, None, None, None, None, None, None])
            mapping = tuple(mapping)
            MSG = 'Bearer({:s}) not found; auto-generated mapping: {:s}'
            LOGGER.warning(MSG.format(str(bearer_reference), str(mapping)))

        (
            device_uuid, endpoint_uuid, router_id, route_dist, sub_if_index,
            address_ip, address_prefix, remote_router, circuit_id
@@ -172,12 +179,14 @@ def process_site_network_access(

        service_settings_key = '/settings'
        if service_mtu is None: service_mtu = DEFAULT_MTU
        update_config_rule_custom(config_rules, service_settings_key, {
        field_updates = {
            'mtu'             : (service_mtu,              True),
            #'address_families': (DEFAULT_ADDRESS_FAMILIES, True),
            #'bgp_as'          : (DEFAULT_BGP_AS,           True),
            #'bgp_route_target': (DEFAULT_BGP_ROUTE_TARGET, True),
        })
        }
        if cvlan_tag_id   is not None: field_updates['vlan_id'            ] = (cvlan_tag_id,   True)
        update_config_rule_custom(config_rules, service_settings_key, field_updates)

        #ENDPOINT_SETTINGS_KEY = '/device[{:s}]/endpoint[{:s}]/vlan[{:d}]/settings'
        #endpoint_settings_key = ENDPOINT_SETTINGS_KEY.format(device_uuid, endpoint_uuid, cvlan_tag_id)