From 3b82181e93760f2f74abdb2eb926d08cf0026c30 Mon Sep 17 00:00:00 2001
From: gifrerenom <lluis.gifre@cttc.es>
Date: Thu, 19 Jan 2023 15:44:37 +0000
Subject: [PATCH] PathComp component:

- updated definition of constant DEFAULT_CONTEXT_UUID to DEFAULT_CONTEXT_NAME
- updated definition of constant DEFAULT_TOPOLOGY_UUID to DEFAULT_TOPOLOGY_NAME
- updated definition of constant INTERDOMAIN_TOPOLOGY_UUID to INTERDOMAIN_TOPOLOGY_NAME
---
 .../frontend/service/PathCompServiceServicerImpl.py  |  8 ++++----
 .../service/algorithms/tools/ComposeRequest.py       | 12 ++++++------
 src/pathcomp/frontend/tests/Objects_A_B_C.py         |  8 ++++----
 src/pathcomp/frontend/tests/Objects_DC_CSGW_TN.py    |  8 ++++----
 .../frontend/tests/Objects_DC_CSGW_TN_OLS.py         |  8 ++++----
 5 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/src/pathcomp/frontend/service/PathCompServiceServicerImpl.py b/src/pathcomp/frontend/service/PathCompServiceServicerImpl.py
index ca4132754..9f4cd7333 100644
--- a/src/pathcomp/frontend/service/PathCompServiceServicerImpl.py
+++ b/src/pathcomp/frontend/service/PathCompServiceServicerImpl.py
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 import grpc, logging, threading
-from common.Constants import DEFAULT_CONTEXT_UUID, INTERDOMAIN_TOPOLOGY_UUID
+from common.Constants import DEFAULT_CONTEXT_NAME, INTERDOMAIN_TOPOLOGY_NAME
 from common.method_wrappers.Decorator import MetricsPool, safe_and_metered_rpc_method
 from common.proto.context_pb2 import ContextId, Empty
 from common.proto.pathcomp_pb2 import PathCompReply, PathCompRequest
@@ -30,7 +30,7 @@ LOGGER = logging.getLogger(__name__)
 
 METRICS_POOL = MetricsPool('PathComp', 'RPC')
 
-ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_UUID))
+ADMIN_CONTEXT_ID = ContextId(**json_context_id(DEFAULT_CONTEXT_NAME))
 
 class PathCompServiceServicerImpl(PathCompServiceServicer):
     def __init__(self) -> None:
@@ -45,8 +45,8 @@ class PathCompServiceServicerImpl(PathCompServiceServicer):
         context_client = ContextClient()
 
         if (len(request.services) == 1) and is_inter_domain(context_client, request.services[0].service_endpoint_ids):
-            devices = get_devices_in_topology(context_client, ADMIN_CONTEXT_ID, INTERDOMAIN_TOPOLOGY_UUID)
-            links = get_links_in_topology(context_client, ADMIN_CONTEXT_ID, INTERDOMAIN_TOPOLOGY_UUID)
+            devices = get_devices_in_topology(context_client, ADMIN_CONTEXT_ID, INTERDOMAIN_TOPOLOGY_NAME)
+            links = get_links_in_topology(context_client, ADMIN_CONTEXT_ID, INTERDOMAIN_TOPOLOGY_NAME)
         else:
             # TODO: improve filtering of devices and links
             # TODO: add contexts, topologies, and membership of devices/links in topologies
diff --git a/src/pathcomp/frontend/service/algorithms/tools/ComposeRequest.py b/src/pathcomp/frontend/service/algorithms/tools/ComposeRequest.py
index 17a7e74ef..0a424bf8b 100644
--- a/src/pathcomp/frontend/service/algorithms/tools/ComposeRequest.py
+++ b/src/pathcomp/frontend/service/algorithms/tools/ComposeRequest.py
@@ -14,7 +14,7 @@
 
 import logging
 from typing import Dict
-from common.Constants import DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID
+from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME
 from common.proto.context_pb2 import Constraint, Device, EndPointId, Link, Service, ServiceId, TopologyId
 from common.tools.grpc.Tools import grpc_message_to_json_string
 from .ConstantsMappings import (
@@ -28,17 +28,17 @@ def compose_topology_id(topology_id : TopologyId) -> Dict:
     context_uuid = topology_id.context_id.context_uuid.uuid
     topology_uuid = topology_id.topology_uuid.uuid
 
-    if len(context_uuid) == 0: context_uuid = DEFAULT_CONTEXT_UUID
-    if len(topology_uuid) == 0: topology_uuid = DEFAULT_TOPOLOGY_UUID
+    if len(context_uuid) == 0: context_uuid = DEFAULT_CONTEXT_NAME
+    if len(topology_uuid) == 0: topology_uuid = DEFAULT_TOPOLOGY_NAME
 
     return {'contextId': context_uuid, 'topology_uuid': topology_uuid}
 
 def compose_service_id(service_id : ServiceId) -> Dict:
-    # force context_uuid to be always DEFAULT_CONTEXT_UUID for simplicity
+    # force context_uuid to be always DEFAULT_CONTEXT_NAME for simplicity
     # for interdomain contexts are managed in a particular way
     #context_uuid = service_id.context_id.context_uuid.uuid
-    #if len(context_uuid) == 0: context_uuid = DEFAULT_CONTEXT_UUID
-    context_uuid = DEFAULT_CONTEXT_UUID
+    #if len(context_uuid) == 0: context_uuid = DEFAULT_CONTEXT_NAME
+    context_uuid = DEFAULT_CONTEXT_NAME
 
     service_uuid = service_id.service_uuid.uuid
     return {'contextId': context_uuid, 'service_uuid': service_uuid}
diff --git a/src/pathcomp/frontend/tests/Objects_A_B_C.py b/src/pathcomp/frontend/tests/Objects_A_B_C.py
index 510ebb674..2deab06f4 100644
--- a/src/pathcomp/frontend/tests/Objects_A_B_C.py
+++ b/src/pathcomp/frontend/tests/Objects_A_B_C.py
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from common.Constants import DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID
+from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME
 from common.tools.object_factory.Constraint import json_constraint_custom
 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
@@ -41,11 +41,11 @@ def compose_service(endpoint_a, endpoint_z, constraints=[]):
     return service
 
 # ----- Context --------------------------------------------------------------------------------------------------------
-CONTEXT_ID = json_context_id(DEFAULT_CONTEXT_UUID)
-CONTEXT    = json_context(DEFAULT_CONTEXT_UUID)
+CONTEXT_ID = json_context_id(DEFAULT_CONTEXT_NAME)
+CONTEXT    = json_context(DEFAULT_CONTEXT_NAME)
 
 # ----- Domains --------------------------------------------------------------------------------------------------------
-TOPOLOGY_ADMIN_UUID = DEFAULT_TOPOLOGY_UUID
+TOPOLOGY_ADMIN_UUID = DEFAULT_TOPOLOGY_NAME
 TOPOLOGY_ADMIN_ID   = json_topology_id(TOPOLOGY_ADMIN_UUID, context_id=CONTEXT_ID)
 TOPOLOGY_ADMIN      = json_topology(TOPOLOGY_ADMIN_UUID, context_id=CONTEXT_ID)
 
diff --git a/src/pathcomp/frontend/tests/Objects_DC_CSGW_TN.py b/src/pathcomp/frontend/tests/Objects_DC_CSGW_TN.py
index 06e9bbbc7..33483267b 100644
--- a/src/pathcomp/frontend/tests/Objects_DC_CSGW_TN.py
+++ b/src/pathcomp/frontend/tests/Objects_DC_CSGW_TN.py
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from common.Constants import DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID
+from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME
 from common.tools.object_factory.Constraint import json_constraint_custom
 from common.tools.object_factory.Context import json_context, json_context_id
 from common.tools.object_factory.Device import (
@@ -58,12 +58,12 @@ def compose_service(endpoint_a, endpoint_z, constraints=[]):
     return service
 
 # ----- Context --------------------------------------------------------------------------------------------------------
-CONTEXT_ID = json_context_id(DEFAULT_CONTEXT_UUID)
-CONTEXT    = json_context(DEFAULT_CONTEXT_UUID)
+CONTEXT_ID = json_context_id(DEFAULT_CONTEXT_NAME)
+CONTEXT    = json_context(DEFAULT_CONTEXT_NAME)
 
 # ----- Domains --------------------------------------------------------------------------------------------------------
 # Overall network topology
-TOPO_ADMIN_UUID = DEFAULT_TOPOLOGY_UUID
+TOPO_ADMIN_UUID = DEFAULT_TOPOLOGY_NAME
 TOPO_ADMIN_ID   = json_topology_id(TOPO_ADMIN_UUID, context_id=CONTEXT_ID)
 TOPO_ADMIN      = json_topology(TOPO_ADMIN_UUID, context_id=CONTEXT_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 99fd83ed9..1ff3ff595 100644
--- a/src/pathcomp/frontend/tests/Objects_DC_CSGW_TN_OLS.py
+++ b/src/pathcomp/frontend/tests/Objects_DC_CSGW_TN_OLS.py
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 import uuid
-from common.Constants import DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID
+from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME
 from common.tools.object_factory.Constraint import json_constraint_custom
 from common.tools.object_factory.Context import json_context, json_context_id
 from common.tools.object_factory.Device import (
@@ -68,12 +68,12 @@ def compose_service(endpoint_a, endpoint_z, constraints=[]):
     return service
 
 # ----- Context --------------------------------------------------------------------------------------------------------
-CONTEXT_ID = json_context_id(DEFAULT_CONTEXT_UUID)
-CONTEXT    = json_context(DEFAULT_CONTEXT_UUID)
+CONTEXT_ID = json_context_id(DEFAULT_CONTEXT_NAME)
+CONTEXT    = json_context(DEFAULT_CONTEXT_NAME)
 
 # ----- Domains --------------------------------------------------------------------------------------------------------
 # Overall network topology
-TOPO_ADMIN_UUID = DEFAULT_TOPOLOGY_UUID
+TOPO_ADMIN_UUID = DEFAULT_TOPOLOGY_NAME
 TOPO_ADMIN_ID   = json_topology_id(TOPO_ADMIN_UUID, context_id=CONTEXT_ID)
 TOPO_ADMIN      = json_topology(TOPO_ADMIN_UUID, context_id=CONTEXT_ID)
 
-- 
GitLab