Commit c9461853 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

NBI component - IETF L2VPN connector:

- Fixed checks of site location
parent a8de4509
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -93,11 +93,12 @@ class L2VPN_SiteNetworkAccesses(Resource):

            # Add mandatory fields OSM RO driver skips and fix wrong ones
            for site_network_access in site_network_accesses:
                location = 'fake-location'
                if 'location-reference' in site_network_access:
                    location = site_network_access['location-reference']
                else:
                    location = 'fake-location'
                    site_network_access['location-reference'] = location
                    site_network_access.pop('location-reference')
                #else:
                #    site_network_access['location-reference'] = location
                location_refs.add(location)

                if 'device-reference' in site_network_access:
@@ -164,10 +165,10 @@ class L2VPN_SiteNetworkAccesses(Resource):
                    'site-id': site_id,
                    'default-ce-vlan-id': 1,
                    'management': {'type': 'provider-managed'},
                    #'locations': {'location': [
                    #    {'location-id': location_ref}
                    #    for location_ref in location_refs
                    #]},
                    'locations': {'location': [
                        {'location-id': location_ref}
                        for location_ref in location_refs
                    ]},
                    'devices': {'device': [
                        {'device-id': device_ref, 'location': location_ref}
                        for device_ref, location_ref in device_refs.items()
@@ -179,7 +180,7 @@ class L2VPN_SiteNetworkAccesses(Resource):
            }}

            MSG = '[_prepare_request_payload] request_data={:s}'
            LOGGER.debug(MSG.format(str(request_data)))
            LOGGER.warning(MSG.format(str(request_data)))
            return request_data

        errors.append('Unexpected request: {:s}'.format(str(request_data)))