Commit d5b5b8c9 authored by Javier Velázquez's avatar Javier Velázquez
Browse files

Refactor process_site_network_access to remove checks for...

Refactor process_site_network_access to remove checks for site-network-access-type and access-role allowing others than multipoint and hub/spoke roles
parent 096e5cfd
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
@@ -114,23 +114,9 @@ def process_site_network_access(
    site_id : str, network_access : Dict, site_static_routing : Dict[Tuple[str, int, int], str], errors : List[Dict]
) -> None:
    endpoint_uuid = network_access['site-network-access-id']

    if 'ietf-l3vpn-svc' in network_access['site-network-access-type']:
        # replace 'ietf-l3vpn-svc:multipoint' with 'multipoint' for backward compatibility
        network_access['site-network-access-type'] = network_access['site-network-access-type'].replace('ietf-l3vpn-svc:', '')
    if network_access['site-network-access-type'] != 'multipoint':
        MSG = 'Site Network Access Type: {:s}'
        raise NotImplementedError(MSG.format(str(network_access['site-network-access-type'])))

    device_uuid  = network_access['device-reference']
    service_uuid = network_access['vpn-attachment']['vpn-id']

    access_role : str = network_access['vpn-attachment']['site-role']
    access_role = access_role.replace('ietf-l3vpn-svc:', '').replace('-role', '') # hub/spoke
    if access_role not in {'hub', 'spoke'}:
        MSG = 'Site VPN Attackment Role: {:s}'
        raise NotImplementedError(MSG.format(str(network_access['site-network-access-type'])))

    ipv4_allocation = network_access['ip-connection']['ipv4']
    if 'ietf-l3vpn-svc' in ipv4_allocation['address-allocation-type']:
        # replace 'ietf-l3vpn-svc:static-address' with 'static-address' for backward compatibility
@@ -244,10 +230,6 @@ def update_site_network_access(
    network_access : Dict, errors : List[Dict]
) -> None:

    if network_access['site-network-access-type'] != 'ietf-l3vpn-svc:multipoint':
        MSG = 'Site Network Access Type: {:s}'
        raise NotImplementedError(MSG.format(str(network_access['site-network-access-type'])))

    service_uuid = network_access['vpn-attachment']['vpn-id']

    service_input_bandwidth  = network_access['service']['svc-input-bandwidth']