diff --git a/src/common/tools/object_factory/Device.py b/src/common/tools/object_factory/Device.py index c88068ff7f0c36251e923d297d8c77ad7892a4c4..bc5c28740d5635df99c26ef56124c471d2c77d91 100644 --- a/src/common/tools/object_factory/Device.py +++ b/src/common/tools/object_factory/Device.py @@ -143,16 +143,6 @@ def json_device_connect_rules(address : str, port : int, settings : Dict = {}) - json_config_rule_set('_connect/settings', settings), ] -def json_endpoint_descriptor( - endpoint_uuid : str, endpoint_type : str, endpoint_name : Optional[str] = None, - sample_types : List[int] = [], location : Optional[Dict] = None -) -> Dict: - result = {'uuid': endpoint_uuid, 'type': endpoint_type} - if endpoint_name is not None: result['name'] = endpoint_name - if sample_types is not None and len(sample_types) > 0: result['sample_types'] = sample_types - if location is not None and len(location) > 0: result['location'] = location - return result - def json_device_emulated_connect_rules( endpoint_descriptors : List[Dict], address : str = DEVICE_EMU_ADDRESS, port : int = DEVICE_EMU_PORT ) -> List[Dict]: diff --git a/src/common/tools/object_factory/EndPoint.py b/src/common/tools/object_factory/EndPoint.py index a38ad0d5c59ee75742459729003d43ef01612f53..101db3110f897b90e76e2582d04f36479d1e8311 100644 --- a/src/common/tools/object_factory/EndPoint.py +++ b/src/common/tools/object_factory/EndPoint.py @@ -13,7 +13,17 @@ # limitations under the License. import copy -from typing import Dict, List, Optional, Tuple +from typing import Dict, List, Optional + +def json_endpoint_descriptor( + endpoint_uuid : str, endpoint_type : str, endpoint_name : Optional[str] = None, + sample_types : List[int] = [], location : Optional[Dict] = None +) -> Dict: + result = {'uuid': endpoint_uuid, 'type': endpoint_type} + if endpoint_name is not None: result['name'] = endpoint_name + if sample_types is not None and len(sample_types) > 0: result['sample_types'] = sample_types + if location is not None and len(location) > 0: result['location'] = location + return result def json_endpoint_id(device_id : Dict, endpoint_uuid : str, topology_id : Optional[Dict] = None): result = {'device_id': copy.deepcopy(device_id), 'endpoint_uuid': {'uuid': endpoint_uuid}} @@ -21,11 +31,11 @@ def json_endpoint_id(device_id : Dict, endpoint_uuid : str, topology_id : Option return result def json_endpoint_ids( - device_id : Dict, endpoint_descriptors : List[Tuple[str, str, List[int]]], topology_id : Optional[Dict] = None + device_id : Dict, endpoint_descriptors : List[Dict], topology_id : Optional[Dict] = None ): return [ - json_endpoint_id(device_id, endpoint_uuid, topology_id=topology_id) - for endpoint_uuid, _, _ in endpoint_descriptors + json_endpoint_id(device_id, endpoint_data['uuid'], topology_id=topology_id) + for endpoint_data in endpoint_descriptors ] def json_endpoint( @@ -42,11 +52,11 @@ def json_endpoint( return result def json_endpoints( - device_id : Dict, endpoint_descriptors : List[Tuple[str, str, List[int]]], topology_id : Optional[Dict] = None + device_id : Dict, endpoint_descriptors : List[Dict], topology_id : Optional[Dict] = None ): return [ json_endpoint( - device_id, endpoint_uuid, endpoint_type, topology_id=topology_id, - kpi_sample_types=endpoint_sample_types) - for endpoint_uuid, endpoint_type, endpoint_sample_types in endpoint_descriptors + device_id, endpoint_data['uuid'], endpoint_data['type'], topology_id=topology_id, + kpi_sample_types=endpoint_data['sample_types']) + for endpoint_data in endpoint_descriptors ] diff --git a/src/device/tests/Device_Emulated.py b/src/device/tests/Device_Emulated.py index 62a94c8a85172b1af90e2e347e0692bf5b79598e..0dffd7ad5a1d6da3bb58ca1c874a797c34ca5357 100644 --- a/src/device/tests/Device_Emulated.py +++ b/src/device/tests/Device_Emulated.py @@ -15,8 +15,8 @@ from common.proto.kpi_sample_types_pb2 import KpiSampleType from common.tools.object_factory.ConfigRule import json_config_rule_delete, json_config_rule_set from common.tools.object_factory.Device import ( - json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, json_device_id, - json_endpoint_descriptor) + json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, json_device_id) +from common.tools.object_factory.EndPoint import json_endpoint_descriptor from device.tests.CommonObjects import PACKET_PORT_SAMPLE_TYPES DEVICE_EMU_UUID = 'R1-EMU' diff --git a/src/dlt/connector/tests/Objects.py b/src/dlt/connector/tests/Objects.py index 2ff850000a2d20b0556dc6e65a21b7151db849d6..5a7f9f68235eefa93e73d66bb6a2ab3ae210ee14 100644 --- a/src/dlt/connector/tests/Objects.py +++ b/src/dlt/connector/tests/Objects.py @@ -14,7 +14,7 @@ from common.tools.object_factory.Context import json_context, json_context_id from common.tools.object_factory.Device import json_device_emulated_packet_router_disabled, json_device_id -from common.tools.object_factory.EndPoint import json_endpoints +from common.tools.object_factory.EndPoint import json_endpoint_descriptor, json_endpoints from common.tools.object_factory.Link import compose_link from common.tools.object_factory.Topology import json_topology, json_topology_id @@ -22,7 +22,10 @@ def compose_device( device_uuid, endpoint_uuids, endpoint_type='copper', endpoint_topology_id=None, endpoint_sample_types=[] ): device_id = json_device_id(device_uuid) - endpoints = [(endpoint_uuid, endpoint_type, endpoint_sample_types) for endpoint_uuid in endpoint_uuids] + endpoints = [ + json_endpoint_descriptor(endpoint_uuid, endpoint_type, endpoint_sample_types) + for endpoint_uuid in endpoint_uuids + ] endpoints = json_endpoints(device_id, endpoints, topology_id=endpoint_topology_id) device = json_device_emulated_packet_router_disabled(device_uuid, endpoints=endpoints) return device_id, endpoints, device diff --git a/src/monitoring/tests/Objects.py b/src/monitoring/tests/Objects.py index e6beb92dcb02bef34703695131a4210f78308f61..c5228981bd0c0a5c9104c286f7daa8fb38baf47b 100644 --- a/src/monitoring/tests/Objects.py +++ b/src/monitoring/tests/Objects.py @@ -14,7 +14,8 @@ from common.proto.kpi_sample_types_pb2 import KpiSampleType from common.tools.object_factory.Device import ( - json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, json_endpoint_descriptor) + json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled) +from common.tools.object_factory.EndPoint import json_endpoint_descriptor PACKET_PORT_SAMPLE_TYPES = [ KpiSampleType.KPISAMPLETYPE_PACKETS_TRANSMITTED, diff --git a/src/pathcomp/frontend/tests/Objects_A_B_C.py b/src/pathcomp/frontend/tests/Objects_A_B_C.py index 5290123b62251a58d8e0a7f273ea23c38ee2cc8a..4bd1907cd71530973424d623428d8318acdf8ea9 100644 --- a/src/pathcomp/frontend/tests/Objects_A_B_C.py +++ b/src/pathcomp/frontend/tests/Objects_A_B_C.py @@ -16,14 +16,14 @@ from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME from common.tools.object_factory.Constraint import json_constraint_sla_capacity, json_constraint_sla_latency from common.tools.object_factory.Context import json_context, json_context_id from common.tools.object_factory.Device import json_device_emulated_packet_router_disabled, json_device_id -from common.tools.object_factory.EndPoint import json_endpoints +from common.tools.object_factory.EndPoint import json_endpoint_descriptor, json_endpoints from common.tools.object_factory.Link import get_link_uuid, json_link, json_link_id from common.tools.object_factory.Service import get_service_uuid, json_service_l3nm_planned from common.tools.object_factory.Topology import json_topology, json_topology_id def compose_device(device_uuid, endpoint_uuids, topology_id=None): device_id = json_device_id(device_uuid) - endpoints = [(endpoint_uuid, 'copper', []) for endpoint_uuid in endpoint_uuids] + endpoints = [json_endpoint_descriptor(endpoint_uuid, 'copper', []) for endpoint_uuid in endpoint_uuids] endpoints = json_endpoints(device_id, endpoints, topology_id=topology_id) device = json_device_emulated_packet_router_disabled(device_uuid, endpoints=endpoints) return device_id, endpoints, device diff --git a/src/pathcomp/frontend/tests/Objects_DC_CSGW_TN.py b/src/pathcomp/frontend/tests/Objects_DC_CSGW_TN.py index 548a3268d40efbfcb48689bf56fc82fb34b6a90c..38218e987a2aadf1d3a7152fa64125f606e3f947 100644 --- a/src/pathcomp/frontend/tests/Objects_DC_CSGW_TN.py +++ b/src/pathcomp/frontend/tests/Objects_DC_CSGW_TN.py @@ -17,8 +17,8 @@ from common.tools.object_factory.Constraint import json_constraint_sla_capacity, from common.tools.object_factory.Context import json_context, json_context_id from common.tools.object_factory.Device import ( json_device_emulated_connect_rules, json_device_emulated_datacenter_disabled, - json_device_emulated_packet_router_disabled, json_device_id, json_endpoint_descriptor) -from common.tools.object_factory.EndPoint import json_endpoints + json_device_emulated_packet_router_disabled, json_device_id) +from common.tools.object_factory.EndPoint import json_endpoint_descriptor, json_endpoints from common.tools.object_factory.Link import get_link_uuid, json_link, json_link_id from common.tools.object_factory.Service import get_service_uuid, json_service_l3nm_planned from common.tools.object_factory.Topology import json_topology, json_topology_id diff --git a/src/pathcomp/frontend/tests/Objects_DC_CSGW_TN_OLS.py b/src/pathcomp/frontend/tests/Objects_DC_CSGW_TN_OLS.py index 546a03ac0581cdfee0ab6219a60e8f95daba4561..3b385412038edfcfa8a1c7c8d5a805c867c69993 100644 --- a/src/pathcomp/frontend/tests/Objects_DC_CSGW_TN_OLS.py +++ b/src/pathcomp/frontend/tests/Objects_DC_CSGW_TN_OLS.py @@ -19,8 +19,8 @@ from common.tools.object_factory.Context import json_context, json_context_id from common.tools.object_factory.Device import ( json_device_emulated_connect_rules, json_device_emulated_datacenter_disabled, json_device_emulated_packet_router_disabled, json_device_emulated_tapi_disabled, - json_device_id, json_endpoint_descriptor) -from common.tools.object_factory.EndPoint import json_endpoints + json_device_id) +from common.tools.object_factory.EndPoint import json_endpoint_descriptor, json_endpoints from common.tools.object_factory.Link import get_link_uuid, json_link, json_link_id from common.tools.object_factory.Service import get_service_uuid, json_service_l3nm_planned from common.tools.object_factory.Topology import json_topology, json_topology_id diff --git a/src/service/tests/ServiceHandler_L3NM_EMU.py b/src/service/tests/ServiceHandler_L3NM_EMU.py index 50832ffff6ccc38959454fc7a891f88400123830..2f58aabd987eb391c195fb1f170959178ba40be6 100644 --- a/src/service/tests/ServiceHandler_L3NM_EMU.py +++ b/src/service/tests/ServiceHandler_L3NM_EMU.py @@ -18,24 +18,27 @@ from common.tools.object_factory.Location import json_location, json_gps_positio from common.tools.object_factory.ConfigRule import json_config_rule_set from common.tools.object_factory.Constraint import json_constraint_custom, json_constraint_endpoint_location_gps from common.tools.object_factory.Device import ( - json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, json_device_emulated_tapi_disabled, json_device_id, json_endpoint_descriptor) -from common.tools.object_factory.EndPoint import json_endpoint, json_endpoint_id + json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, + json_device_emulated_tapi_disabled, json_device_id) +from common.tools.object_factory.EndPoint import json_endpoint, json_endpoint_descriptor, json_endpoint_id from common.tools.object_factory.Link import json_link, json_link_id from common.tools.object_factory.Service import json_service_id, json_service_l3nm_planned from .CommonObjects import CONTEXT, CONTEXT_ID, PACKET_PORT_SAMPLE_TYPES, TOPOLOGY, TOPOLOGY_ID SERVICE_HANDLER_NAME = 'l3nm_emulated' -def json_endpoint_ids(device_id : Dict, endpoint_descriptors : List[Tuple[str, str, str]]): +def json_endpoint_ids(device_id : Dict, endpoint_descriptors : List[Dict]): return [ - json_endpoint_id(device_id, ep_uuid) - for ep_uuid, _, _ in endpoint_descriptors + json_endpoint_id(device_id, ep_data['uuid']) + for ep_data in endpoint_descriptors ] -def json_endpoints(device_id : Dict, endpoint_descriptors : List[Tuple[str, str, str]]): +def json_endpoints(device_id : Dict, endpoint_descriptors : List[Dict]): return [ - json_endpoint(device_id, ep_uuid, ep_type, kpi_sample_types=PACKET_PORT_SAMPLE_TYPES, location=ep_location) - for ep_uuid, ep_type, ep_location in endpoint_descriptors + json_endpoint( + device_id, ep_data['uuid'], ep_data['type'], kpi_sample_types=PACKET_PORT_SAMPLE_TYPES, + location=ep_data.get('location')) + for ep_data in endpoint_descriptors ] diff --git a/src/service/tests/ServiceHandler_L3NM_OC.py b/src/service/tests/ServiceHandler_L3NM_OC.py index 47d061883aca4a53b4148bcfbb7e91a588b44591..2dcf089e0263d77203adfc45e5d06dbe54727347 100644 --- a/src/service/tests/ServiceHandler_L3NM_OC.py +++ b/src/service/tests/ServiceHandler_L3NM_OC.py @@ -19,28 +19,31 @@ from common.tools.object_factory.Constraint import json_constraint_custom from common.tools.object_factory.Device import ( json_device_connect_rules, json_device_emulated_packet_router_disabled, json_device_emulated_tapi_disabled, json_device_id) -from common.tools.object_factory.EndPoint import json_endpoint, json_endpoint_id +from common.tools.object_factory.EndPoint import json_endpoint, json_endpoint_descriptor, json_endpoint_id from common.tools.object_factory.Link import json_link, json_link_id from common.tools.object_factory.Service import json_service_id, json_service_l3nm_planned from .CommonObjects import CONTEXT, CONTEXT_ID, PACKET_PORT_SAMPLE_TYPES, TOPOLOGY, TOPOLOGY_ID SERVICE_HANDLER_NAME = 'l3nm_openconfig' -def json_endpoint_ids(device_id : Dict, endpoint_descriptors : List[Tuple[str, str]]): +def json_endpoint_ids(device_id : Dict, endpoint_descriptors : List[Dict]): return [ - json_endpoint_id(device_id, ep_uuid) - for ep_uuid, _ in endpoint_descriptors + json_endpoint_id(device_id, ep_data['uuid']) + for ep_data in endpoint_descriptors ] -def json_endpoints(device_id : Dict, endpoint_descriptors : List[Tuple[str, str]]): +def json_endpoints(device_id : Dict, endpoint_descriptors : List[Dict]): return [ - json_endpoint(device_id, ep_uuid, ep_type, kpi_sample_types=PACKET_PORT_SAMPLE_TYPES) - for ep_uuid, ep_type in endpoint_descriptors + json_endpoint( + device_id, ep_data['uuid'], ep_data['type'], kpi_sample_types=PACKET_PORT_SAMPLE_TYPES, + location=ep_data.get('location')) + for ep_data in endpoint_descriptors ] # ----- Devices -------------------------------------------------------------------------------------------------------- DEVICE_R1_UUID = 'R1' -DEVICE_R1_ENDPOINT_DEFS = [('EP1', 'optical'), ('EP100', 'copper')] +DEVICE_R1_ENDPOINT_DEFS = [json_endpoint_descriptor('EP1', 'optical'), + json_endpoint_descriptor('EP100', 'copper')] DEVICE_R1_ADDRESS = '10.0.0.1' DEVICE_R1_PORT = 830 DEVICE_R1_USERNAME = 'admin' @@ -60,7 +63,8 @@ DEVICE_R1_CONNECT_RULES = json_device_connect_rules(DEVICE_R1_ADDRESS, DEVICE_R1 DEVICE_R2_UUID = 'R2' -DEVICE_R2_ENDPOINT_DEFS = [('EP1', 'optical'), ('EP100', 'copper')] +DEVICE_R2_ENDPOINT_DEFS = [json_endpoint_descriptor('EP1', 'optical'), + json_endpoint_descriptor('EP100', 'copper')] DEVICE_R2_ADDRESS = '10.0.0.2' DEVICE_R2_PORT = 830 DEVICE_R2_USERNAME = 'admin' @@ -80,7 +84,8 @@ DEVICE_R2_CONNECT_RULES = json_device_connect_rules(DEVICE_R2_ADDRESS, DEVICE_R2 DEVICE_O1_UUID = 'O1' -DEVICE_O1_ENDPOINT_DEFS = [(str(uuid.uuid4()), 'optical'), (str(uuid.uuid4()), 'optical')] +DEVICE_O1_ENDPOINT_DEFS = [json_endpoint_descriptor(str(uuid.uuid4()), 'optical'), + json_endpoint_descriptor(str(uuid.uuid4()), 'optical')] DEVICE_O1_ADDRESS = '10.0.0.3' DEVICE_O1_PORT = 4900 DEVICE_O1_TIMEOUT = 120 diff --git a/src/tests/benchmark/automation/tests/Objects.py b/src/tests/benchmark/automation/tests/Objects.py index cdf90568aa9659e0671acf10851919fafafb08f6..a364abdc9d5dadec25e44e497f36db0c90e98e0b 100644 --- a/src/tests/benchmark/automation/tests/Objects.py +++ b/src/tests/benchmark/automation/tests/Objects.py @@ -17,9 +17,8 @@ from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME from common.tools.object_factory.Context import json_context, json_context_id from common.tools.object_factory.Device import ( json_device_connect_rules, json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, - json_device_emulated_tapi_disabled, json_device_id, json_device_packetrouter_disabled, json_device_tapi_disabled, - json_endpoint_descriptor) -from common.tools.object_factory.EndPoint import json_endpoint, json_endpoint_id + json_device_emulated_tapi_disabled, json_device_id, json_device_packetrouter_disabled, json_device_tapi_disabled) +from common.tools.object_factory.EndPoint import json_endpoint, json_endpoint_descriptor, json_endpoint_id from common.tools.object_factory.Link import json_link, json_link_id from common.tools.object_factory.Topology import json_topology, json_topology_id from common.proto.kpi_sample_types_pb2 import KpiSampleType diff --git a/src/tests/ecoc22/tests/Tools.py b/src/tests/ecoc22/tests/Tools.py index 26a3eda7101907f63fc51bc042bd59dee463d7d9..ea83d06bbe19c05d8f1932c03fd595ae760cc83f 100644 --- a/src/tests/ecoc22/tests/Tools.py +++ b/src/tests/ecoc22/tests/Tools.py @@ -16,16 +16,18 @@ from typing import Dict, List, Tuple from common.tools.object_factory.EndPoint import json_endpoint, json_endpoint_id from common.tools.object_factory.Link import json_link, json_link_id -def json_endpoint_ids(device_id : Dict, endpoint_descriptors : List[Tuple[str, str, List[int]]]): +def json_endpoint_ids(device_id : Dict, endpoint_descriptors : List[Dict]]): return [ - json_endpoint_id(device_id, ep_uuid, topology_id=None) - for ep_uuid, _, _ in endpoint_descriptors + json_endpoint_id(device_id, ep_data['uuid'], topology_id=None) + for ep_data in endpoint_descriptors ] -def json_endpoints(device_id : Dict, endpoint_descriptors : List[Tuple[str, str, List[int]]]): +def json_endpoints(device_id : Dict, endpoint_descriptors : List[Dict]]): return [ - json_endpoint(device_id, ep_uuid, ep_type, topology_id=None, kpi_sample_types=ep_sample_types) - for ep_uuid, ep_type, ep_sample_types in endpoint_descriptors + json_endpoint( + device_id, ep_data['uuid'], ep_data['type'], topology_id=None, + kpi_sample_types=ep_data['sample_types']) + for ep_data in endpoint_descriptors ] def get_link_uuid(a_endpoint_id : Dict, z_endpoint_id : Dict) -> str: diff --git a/src/tests/ecoc22/tests/old_code/Objects_BigNet.py b/src/tests/ecoc22/tests/old_code/Objects_BigNet.py index 0e9d20a5d8f949bc382607effd97f30d26fa2059..f52d4fa2bde90ef0cc4bf7fad01625e782d2b086 100644 --- a/src/tests/ecoc22/tests/old_code/Objects_BigNet.py +++ b/src/tests/ecoc22/tests/old_code/Objects_BigNet.py @@ -16,7 +16,8 @@ from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME from common.tools.object_factory.Context import json_context, json_context_id from common.tools.object_factory.Device import ( json_device_emulated_connect_rules, json_device_emulated_datacenter_disabled, - json_device_emulated_packet_router_disabled, json_device_id, json_endpoint_descriptor) + json_device_emulated_packet_router_disabled, json_device_id) +from common.tools.object_factory.EndPoint import json_endpoint_descriptor from common.tools.object_factory.Topology import json_topology, json_topology_id from .Tools import compose_bearer, compose_service_endpoint_id, json_endpoint_ids, link diff --git a/src/tests/ecoc22/tests/old_code/Objects_DC_CSGW_OLS.py b/src/tests/ecoc22/tests/old_code/Objects_DC_CSGW_OLS.py index f60e2e54307a1627d16811d858e933c5ee7b9143..ce16b9bf3241011f1326ae7bccb533c3201608fe 100644 --- a/src/tests/ecoc22/tests/old_code/Objects_DC_CSGW_OLS.py +++ b/src/tests/ecoc22/tests/old_code/Objects_DC_CSGW_OLS.py @@ -17,9 +17,8 @@ from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME from common.tools.object_factory.Context import json_context, json_context_id from common.tools.object_factory.Device import ( json_device_emulated_connect_rules, json_device_emulated_datacenter_disabled, - json_device_emulated_packet_router_disabled, json_device_emulated_tapi_disabled, - json_device_id, json_endpoint_descriptor) -from common.tools.object_factory.EndPoint import json_endpoints + json_device_emulated_packet_router_disabled, json_device_emulated_tapi_disabled, json_device_id) +from common.tools.object_factory.EndPoint import json_endpoint_descriptor, json_endpoints from common.tools.object_factory.Link import get_link_uuid, json_link, json_link_id from common.tools.object_factory.Service import get_service_uuid, json_service_l3nm_planned from common.tools.object_factory.Topology import json_topology, json_topology_id diff --git a/src/tests/ecoc22/tests/old_code/Objects_DC_CSGW_TN.py b/src/tests/ecoc22/tests/old_code/Objects_DC_CSGW_TN.py index 06bdf85c0a34dbda0483d69219e072ee1b4d3a3d..1de362a91665b73e36d4b3e9fd22ddfad184e50a 100644 --- a/src/tests/ecoc22/tests/old_code/Objects_DC_CSGW_TN.py +++ b/src/tests/ecoc22/tests/old_code/Objects_DC_CSGW_TN.py @@ -17,8 +17,8 @@ from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME from common.tools.object_factory.Context import json_context, json_context_id from common.tools.object_factory.Device import ( json_device_emulated_connect_rules, json_device_emulated_datacenter_disabled, - json_device_emulated_packet_router_disabled, json_device_id, json_endpoint_descriptor) -from common.tools.object_factory.EndPoint import json_endpoints + json_device_emulated_packet_router_disabled, json_device_id) +from common.tools.object_factory.EndPoint import json_endpoint_descriptor, json_endpoints from common.tools.object_factory.Link import get_link_uuid, json_link, json_link_id from common.tools.object_factory.Service import get_service_uuid, json_service_l3nm_planned from common.tools.object_factory.Topology import json_topology, json_topology_id diff --git a/src/tests/ecoc22/tests/old_code/Objects_DC_CSGW_TN_OLS.py b/src/tests/ecoc22/tests/old_code/Objects_DC_CSGW_TN_OLS.py index 6650de8c9625c3621e6083392d4552e8b149888c..2a19b7f1880f31c3e315fcd4383bc36d1fd74385 100644 --- a/src/tests/ecoc22/tests/old_code/Objects_DC_CSGW_TN_OLS.py +++ b/src/tests/ecoc22/tests/old_code/Objects_DC_CSGW_TN_OLS.py @@ -17,9 +17,8 @@ from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME from common.tools.object_factory.Context import json_context, json_context_id from common.tools.object_factory.Device import ( json_device_emulated_connect_rules, json_device_emulated_datacenter_disabled, - json_device_emulated_packet_router_disabled, json_device_emulated_tapi_disabled, - json_device_id, json_endpoint_descriptor) -from common.tools.object_factory.EndPoint import json_endpoints + json_device_emulated_packet_router_disabled, json_device_emulated_tapi_disabled, json_device_id) +from common.tools.object_factory.EndPoint import json_endpoint_descriptor, json_endpoints from common.tools.object_factory.Link import get_link_uuid, json_link, json_link_id from common.tools.object_factory.Service import get_service_uuid, json_service_l3nm_planned from common.tools.object_factory.Topology import json_topology, json_topology_id diff --git a/src/tests/oeccpsc22/tests/Objects_Domain_1.py b/src/tests/oeccpsc22/tests/Objects_Domain_1.py index 402737f7e2844c322d6a1217c17bfd73b00d83ff..19c9324d232ef927ec7ab6ce8419eb5cfa9743d4 100644 --- a/src/tests/oeccpsc22/tests/Objects_Domain_1.py +++ b/src/tests/oeccpsc22/tests/Objects_Domain_1.py @@ -15,8 +15,8 @@ from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME from common.tools.object_factory.Context import json_context, json_context_id from common.tools.object_factory.Device import ( - json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, - json_device_id, json_endpoint_descriptor) + json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, json_device_id) +from common.tools.object_factory.EndPoint import json_endpoint_descriptor from common.tools.object_factory.Link import json_link, json_link_id from common.tools.object_factory.Topology import json_topology, json_topology_id from .Tools import get_link_uuid, json_endpoint_ids diff --git a/src/tests/oeccpsc22/tests/Objects_Domain_2.py b/src/tests/oeccpsc22/tests/Objects_Domain_2.py index 1cb4676355231dfaca24ccdb15f774bc7456842b..7235290b3823eb6f99b7e8246071623381612a40 100644 --- a/src/tests/oeccpsc22/tests/Objects_Domain_2.py +++ b/src/tests/oeccpsc22/tests/Objects_Domain_2.py @@ -15,8 +15,8 @@ from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME from common.tools.object_factory.Context import json_context, json_context_id from common.tools.object_factory.Device import ( - json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, - json_device_id, json_endpoint_descriptor) + json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, json_device_id) +from common.tools.object_factory.EndPoint import json_endpoint_descriptor from common.tools.object_factory.Link import json_link, json_link_id from common.tools.object_factory.Topology import json_topology, json_topology_id from .Tools import get_link_uuid, json_endpoint_ids diff --git a/src/tests/ofc22/tests/ObjectsXr.py b/src/tests/ofc22/tests/ObjectsXr.py index b0d17313180bdab9213b1b629359ae88f06b869f..89c6cb7ce56644332af046606b6b5774afeb4e42 100644 --- a/src/tests/ofc22/tests/ObjectsXr.py +++ b/src/tests/ofc22/tests/ObjectsXr.py @@ -17,9 +17,8 @@ from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME from common.tools.object_factory.Context import json_context, json_context_id from common.tools.object_factory.Device import ( json_device_connect_rules, json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, - json_device_emulated_tapi_disabled, json_device_id, json_device_packetrouter_disabled, json_device_tapi_disabled, - json_endpoint_descriptor) -from common.tools.object_factory.EndPoint import json_endpoint, json_endpoint_id + json_device_emulated_tapi_disabled, json_device_id, json_device_packetrouter_disabled, json_device_tapi_disabled) +from common.tools.object_factory.EndPoint import json_endpoint, json_endpoint_descriptor, json_endpoint_id from common.tools.object_factory.Link import json_link, json_link_id from common.tools.object_factory.Topology import json_topology, json_topology_id from common.proto.kpi_sample_types_pb2 import KpiSampleType @@ -64,16 +63,17 @@ DEVICE_X1_PORT = 443 #USE_REAL_DEVICES = False # Uncomment to force to use emulated devices -def json_endpoint_ids(device_id : Dict, endpoint_descriptors : List[Tuple[str, str, List[int]]]): +def json_endpoint_ids(device_id : Dict, endpoint_descriptors : List[Dict]): return [ - json_endpoint_id(device_id, ep_uuid, topology_id=None) - for ep_uuid, _, _ in endpoint_descriptors + json_endpoint_id(device_id, ep_data['uuid'], topology_id=None) + for ep_data in endpoint_descriptors ] -def json_endpoints(device_id : Dict, endpoint_descriptors : List[Tuple[str, str, List[int]]]): +def json_endpoints(device_id : Dict, endpoint_descriptors : List[Dict]): return [ - json_endpoint(device_id, ep_uuid, ep_type, topology_id=None, kpi_sample_types=ep_sample_types) - for ep_uuid, ep_type, ep_sample_types in endpoint_descriptors + json_endpoint( + device_id, ep_data['uuid'], ep_data['type'], topology_id=None, kpi_sample_types=ep_data['sample_types']) + for ep_data in endpoint_descriptors ] def get_link_uuid(a_device_id : Dict, a_endpoint_id : Dict, z_device_id : Dict, z_endpoint_id : Dict) -> str: diff --git a/src/tests/p4/tests/Objects.py b/src/tests/p4/tests/Objects.py index 7f5a981bcd1ac8cdc324c057c69baaf0d7d0e8dd..fcf618308a1e56a6e9e68205bdc0566408e26b65 100644 --- a/src/tests/p4/tests/Objects.py +++ b/src/tests/p4/tests/Objects.py @@ -19,13 +19,13 @@ from common.tools.object_factory.Context import json_context, json_context_id from common.tools.object_factory.Device import ( json_device_connect_rules, json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, json_device_connect_rules, json_device_id, json_device_p4_disabled, - json_device_emulated_tapi_disabled, json_device_id, json_device_packetrouter_disabled, json_device_tapi_disabled, - json_endpoint_descriptor) + json_device_emulated_tapi_disabled, json_device_id, json_device_packetrouter_disabled, json_device_tapi_disabled) from common.tools.object_factory.Service import ( get_service_uuid, json_service_l3nm_planned,json_service_p4_planned) from common.tools.object_factory.ConfigRule import ( json_config_rule_set, json_config_rule_delete) from common.tools.object_factory.EndPoint import json_endpoint, json_endpoint_ids, json_endpoints, json_endpoint_id +from common.tools.object_factory.EndPoint import json_endpoint_descriptor from common.tools.object_factory.Link import get_link_uuid, json_link, json_link_id from common.tools.object_factory.Topology import json_topology, json_topology_id from common.proto.kpi_sample_types_pb2 import KpiSampleType diff --git a/src/tests/p4/tests/topologies/6switchObjects.py b/src/tests/p4/tests/topologies/6switchObjects.py index 5411ef465ff465c2508bf35c5afbaba078e946cc..c5e4b616cdf3cfe0757514ac78f958837591a36c 100644 --- a/src/tests/p4/tests/topologies/6switchObjects.py +++ b/src/tests/p4/tests/topologies/6switchObjects.py @@ -19,12 +19,13 @@ from common.tools.object_factory.Context import json_context, json_context_id from common.tools.object_factory.Device import ( json_device_connect_rules, json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, json_device_connect_rules, json_device_id, json_device_p4_disabled, - json_device_emulated_tapi_disabled, json_device_id, json_device_packetrouter_disabled, json_device_tapi_disabled, json_endpoint_descriptor) + json_device_emulated_tapi_disabled, json_device_id, json_device_packetrouter_disabled, json_device_tapi_disabled) from common.tools.object_factory.Service import ( get_service_uuid, json_service_l3nm_planned,json_service_p4_planned) from common.tools.object_factory.ConfigRule import ( json_config_rule_set, json_config_rule_delete) from common.tools.object_factory.EndPoint import json_endpoint, json_endpoint_ids, json_endpoints, json_endpoint_id +from common.tools.object_factory.EndPoint import json_endpoint_descriptor from common.tools.object_factory.Link import get_link_uuid, json_link, json_link_id from common.tools.object_factory.Topology import json_topology, json_topology_id from common.proto.kpi_sample_types_pb2 import KpiSampleType diff --git a/src/tests/scenario2/old_tests/tests/Objects.py b/src/tests/scenario2/old_tests/tests/Objects.py index 39faaa4f822458cb2c96ecd4c2d1ec6523efe10a..43df127495d16b8494ff74cdf7dea64e44b072e1 100644 --- a/src/tests/scenario2/old_tests/tests/Objects.py +++ b/src/tests/scenario2/old_tests/tests/Objects.py @@ -17,8 +17,8 @@ from common.Constants import DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID from common.tools.object_factory.Context import json_context, json_context_id from common.tools.object_factory.Device import ( json_device_connect_rules, json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled, - json_device_emulated_tapi_disabled, json_device_id, json_device_packetrouter_disabled, json_device_tapi_disabled, json_endpoint_descriptor) -from common.tools.object_factory.EndPoint import json_endpoint, json_endpoint_id + json_device_emulated_tapi_disabled, json_device_id, json_device_packetrouter_disabled, json_device_tapi_disabled) +from common.tools.object_factory.EndPoint import json_endpoint, json_endpoint_descriptor, json_endpoint_id from common.tools.object_factory.Link import json_link, json_link_id from common.tools.object_factory.Topology import json_topology, json_topology_id from common.proto.kpi_sample_types_pb2 import KpiSampleType @@ -63,16 +63,18 @@ except ImportError: #USE_REAL_DEVICES = False # Uncomment to force to use emulated devices -def json_endpoint_ids(device_id : Dict, endpoint_descriptors : List[Tuple[str, str, List[int]]]): +def json_endpoint_ids(device_id : Dict, endpoint_descriptors : List[Dict]]): return [ - json_endpoint_id(device_id, ep_uuid, topology_id=None) - for ep_uuid, _, _ in endpoint_descriptors + json_endpoint_id(device_id, ep_data['uuid'], topology_id=None) + for ep_data in endpoint_descriptors ] -def json_endpoints(device_id : Dict, endpoint_descriptors : List[Tuple[str, str, List[int]]]): +def json_endpoints(device_id : Dict, endpoint_descriptors : List[Dict]]): return [ - json_endpoint(device_id, ep_uuid, ep_type, topology_id=None, kpi_sample_types=ep_sample_types) - for ep_uuid, ep_type, ep_sample_types in endpoint_descriptors + json_endpoint( + device_id, ep_data['uuid'], ep_data['type'], topology_id=None, + kpi_sample_types=ep_data['sample_types']) + for ep_data in endpoint_descriptors ] def get_link_uuid(a_device_id : Dict, a_endpoint_id : Dict, z_device_id : Dict, z_endpoint_id : Dict) -> str: