From 96f54ae39e6b3d663900a1a3bb2fd0c6b23b0eff Mon Sep 17 00:00:00 2001
From: gifrerenom <lluis.gifre@cttc.es>
Date: Tue, 11 Jul 2023 12:04:10 +0000
Subject: [PATCH] Tests: - Corrected new definition of endpoint descriptors in
 tests and components

---
 src/common/tools/object_factory/Device.py     | 10 -------
 src/common/tools/object_factory/EndPoint.py   | 26 +++++++++++++------
 src/device/tests/Device_Emulated.py           |  4 +--
 src/dlt/connector/tests/Objects.py            |  7 +++--
 src/monitoring/tests/Objects.py               |  3 ++-
 src/pathcomp/frontend/tests/Objects_A_B_C.py  |  4 +--
 .../frontend/tests/Objects_DC_CSGW_TN.py      |  4 +--
 .../frontend/tests/Objects_DC_CSGW_TN_OLS.py  |  4 +--
 src/service/tests/ServiceHandler_L3NM_EMU.py  | 19 ++++++++------
 src/service/tests/ServiceHandler_L3NM_OC.py   | 25 +++++++++++-------
 .../benchmark/automation/tests/Objects.py     |  5 ++--
 src/tests/ecoc22/tests/Tools.py               | 14 +++++-----
 .../ecoc22/tests/old_code/Objects_BigNet.py   |  3 ++-
 .../tests/old_code/Objects_DC_CSGW_OLS.py     |  5 ++--
 .../tests/old_code/Objects_DC_CSGW_TN.py      |  4 +--
 .../tests/old_code/Objects_DC_CSGW_TN_OLS.py  |  5 ++--
 src/tests/oeccpsc22/tests/Objects_Domain_1.py |  4 +--
 src/tests/oeccpsc22/tests/Objects_Domain_2.py |  4 +--
 src/tests/ofc22/tests/ObjectsXr.py            | 18 ++++++-------
 src/tests/p4/tests/Objects.py                 |  4 +--
 .../p4/tests/topologies/6switchObjects.py     |  3 ++-
 .../scenario2/old_tests/tests/Objects.py      | 18 +++++++------
 22 files changed, 104 insertions(+), 89 deletions(-)

diff --git a/src/common/tools/object_factory/Device.py b/src/common/tools/object_factory/Device.py
index c88068ff7..bc5c28740 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 a38ad0d5c..101db3110 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 62a94c8a8..0dffd7ad5 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 2ff850000..5a7f9f682 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 e6beb92dc..c5228981b 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 5290123b6..4bd1907cd 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 548a3268d..38218e987 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 546a03ac0..3b3854120 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 50832ffff..2f58aabd9 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 47d061883..2dcf089e0 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 cdf90568a..a364abdc9 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 26a3eda71..ea83d06bb 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 0e9d20a5d..f52d4fa2b 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 f60e2e543..ce16b9bf3 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 06bdf85c0..1de362a91 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 6650de8c9..2a19b7f18 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 402737f7e..19c9324d2 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 1cb467635..7235290b3 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 b0d173131..89c6cb7ce 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 7f5a981bc..fcf618308 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 5411ef465..c5e4b616c 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 39faaa4f8..43df12749 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:
-- 
GitLab