diff --git a/src/compute/tests/mock_osm/Tools.py b/src/compute/tests/mock_osm/Tools.py index 292832bf1369b0aa4398e6b5cdc133808599ff90..d64ba902192293952abd9f455907e18c998ed9f9 100644 --- a/src/compute/tests/mock_osm/Tools.py +++ b/src/compute/tests/mock_osm/Tools.py @@ -12,18 +12,23 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Dict, Optional + def compose_service_endpoint_id(endpoint_id): device_uuid = endpoint_id['device_id']['device_uuid']['uuid'] endpoint_uuid = endpoint_id['endpoint_uuid']['uuid'] return ':'.join([device_uuid, endpoint_uuid]) -def wim_mapping(site_id, ce_endpoint_id, pe_device_id, priority=None, redundant=[]): +def wim_mapping(site_id, ce_endpoint_id, pe_device_id : Optional[Dict] = None, priority=None, redundant=[]): ce_endpoint_id = ce_endpoint_id['endpoint_id'] ce_device_uuid = ce_endpoint_id['device_id']['device_uuid']['uuid'] ce_endpoint_uuid = ce_endpoint_id['endpoint_uuid']['uuid'] - pe_device_uuid = pe_device_id['device_uuid']['uuid'] service_endpoint_id = '{:s}:{:s}:{:s}'.format(site_id, ce_device_uuid, ce_endpoint_uuid) - bearer = '{:s}:{:s}'.format(ce_device_uuid, pe_device_uuid) + if pe_device_id is None: + bearer = '{:s}:{:s}'.format(ce_device_uuid, ce_endpoint_uuid) + else: + pe_device_uuid = pe_device_id['device_uuid']['uuid'] + bearer = '{:s}:{:s}'.format(ce_device_uuid, pe_device_uuid) _mapping = { 'service_endpoint_id': service_endpoint_id, 'datacenter_id': site_id, 'device_id': ce_device_uuid, 'device_interface_id': ce_endpoint_uuid, diff --git a/src/tests/ofc22/tests/Objects.py b/src/tests/ofc22/tests/Objects.py index 1a52f56369339e08e76467382a81a99c9fbb3151..e56b986bc5e800ef166b1d7ab0c43d562cfc4b67 100644 --- a/src/tests/ofc22/tests/Objects.py +++ b/src/tests/ofc22/tests/Objects.py @@ -19,15 +19,17 @@ from compute.tests.mock_osm.Tools import compose_service_endpoint_id, connection # ----- WIM Service Settings ------------------------------------------------------------------------------------------- DEV_R1_ID = json_device_id('R1-EMU') -DEV_R1_ENDPOINT_ID = compose_service_endpoint_id(json_endpoint_id(DEV_R1_ID, '13/1/2')) +DEV_R1_ENDPOINT_ID = json_endpoint_id(DEV_R1_ID, '13/1/2') +WIM_SEP_R1_ID = compose_service_endpoint_id(DEV_R1_ENDPOINT_ID) WIM_SEP_R1_SITE_ID = '1' DEV_R3_ID = json_device_id('R3-EMU') -DEV_R3_ENDPOINT_ID = compose_service_endpoint_id(json_endpoint_id(DEV_R3_ID, '13/1/2')) +DEV_R3_ENDPOINT_ID = json_endpoint_id(DEV_R3_ID, '13/1/2') +WIM_SEP_R3_ID = compose_service_endpoint_id(DEV_R3_ENDPOINT_ID) WIM_SEP_R3_SITE_ID = '2' -WIM_SEP_DC1, WIM_MAP_DC1 = wim_mapping(WIM_SEP_R1_SITE_ID, DEV_DC1GW_EPS[0], DEV_CS1GW1_ID) -WIM_SEP_DC2, WIM_MAP_DC2 = wim_mapping(WIM_SEP_R3_SITE_ID, DEV_DC2GW_EPS[0], DEV_CS2GW1_ID) +WIM_SEP_DC1, WIM_MAP_DC1 = wim_mapping(WIM_SEP_R1_SITE_ID, DEV_R1_ENDPOINT_ID) +WIM_SEP_DC2, WIM_MAP_DC2 = wim_mapping(WIM_SEP_R3_SITE_ID, DEV_R3_ENDPOINT_ID) WIM_MAPPING = [WIM_MAP_DC1, WIM_MAP_DC2] WIM_SRV_VLAN_ID = 300