From bd873955f13d62dce4867234fc4525eb819bac3e Mon Sep 17 00:00:00 2001
From: gifrerenom <lluis.gifre@cttc.es>
Date: Wed, 3 May 2023 08:10:34 +0000
Subject: [PATCH] PathComp component - Frontend:

- Added debug log messages in ComputeSubServices to track issues
---
 .../service/algorithms/tools/ComputeSubServices.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/pathcomp/frontend/service/algorithms/tools/ComputeSubServices.py b/src/pathcomp/frontend/service/algorithms/tools/ComputeSubServices.py
index 40cb08576..8ffdfaf3e 100644
--- a/src/pathcomp/frontend/service/algorithms/tools/ComputeSubServices.py
+++ b/src/pathcomp/frontend/service/algorithms/tools/ComputeSubServices.py
@@ -67,6 +67,7 @@ def convert_explicit_path_hops_to_connections(
     prv_res_class : Tuple[Optional[int], Optional[DeviceTypeEnum], Optional[str]] = None, None, None
 
     for path_hop in path_hops:
+        LOGGER.debug('path_hop={:s}'.format(str(path_hop)))
         device_uuid = path_hop['device']
         if prv_device_uuid == device_uuid: continue
         device_tuple = device_dict.get(device_uuid)
@@ -74,24 +75,33 @@ def convert_explicit_path_hops_to_connections(
         _,grpc_device = device_tuple
 
         res_class = get_resource_classification(grpc_device, device_dict)
-        if res_class[1] in IGNORED_DEVICE_TYPES: continue
+        LOGGER.debug('  prv_res_class={:s}'.format(str(prv_res_class)))
+        LOGGER.debug('  res_class={:s}'.format(str(res_class)))
+        if res_class[1] in IGNORED_DEVICE_TYPES:
+            LOGGER.debug('  ignored')
+            continue
 
         if prv_res_class[0] is None:
             # path ingress
+            LOGGER.debug('  path ingress')
             connection_stack.put((main_service_uuid, main_service_type, [path_hop], []))
         elif prv_res_class[0] > res_class[0]:
             # create underlying connection
+            LOGGER.debug('  create underlying connection')
             connection_uuid = str(uuid.uuid4())
             prv_service_type = connection_stack.queue[-1][1]
             service_type = get_service_type(res_class[1], prv_service_type)
             connection_stack.put((connection_uuid, service_type, [path_hop], []))
         elif prv_res_class[0] == res_class[0]:
             # same resource group kind
+            LOGGER.debug('  same resource group kind')
             if prv_res_class[1] == res_class[1] and prv_res_class[2] == res_class[2]:
                 # same device type and device controller: connection continues
+                LOGGER.debug('  connection continues')
                 connection_stack.queue[-1][2].append(path_hop)
             else:
                 # different device type or device controller: chain connections
+                LOGGER.debug('  chain connections')
                 connection = connection_stack.get()
                 connections.append(connection)
                 connection_stack.queue[-1][3].append(connection[0])
@@ -102,6 +112,7 @@ def convert_explicit_path_hops_to_connections(
                 connection_stack.put((connection_uuid, service_type, [path_hop], []))
         elif prv_res_class[0] < res_class[0]:
             # underlying connection ended
+            LOGGER.debug('  underlying connection ended')
             connection = connection_stack.get()
             connections.append(connection)
             connection_stack.queue[-1][3].append(connection[0])
@@ -113,6 +124,7 @@ def convert_explicit_path_hops_to_connections(
         prv_res_class = res_class
 
     # path egress
+    LOGGER.debug('  path egress')
     connections.append(connection_stack.get())
     LOGGER.debug('connections={:s}'.format(str(connections)))
     assert connection_stack.empty()
-- 
GitLab