From e13b8eddb6db4ba6cec84604eeb79771133dcebb Mon Sep 17 00:00:00 2001
From: gifrerenom <lluis.gifre@cttc.es>
Date: Thu, 25 May 2023 17:22:35 +0000
Subject: [PATCH] Common - Tools - Descriptor Loader:

- Removed update context/topology as it is not needed
---
 src/common/tools/descriptor/Loader.py | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/common/tools/descriptor/Loader.py b/src/common/tools/descriptor/Loader.py
index 1e238510c..916a73d30 100644
--- a/src/common/tools/descriptor/Loader.py
+++ b/src/common/tools/descriptor/Loader.py
@@ -85,6 +85,7 @@ class DescriptorLoader:
         service_client : Optional[ServiceClient] = None, slice_client : Optional[SliceClient] = None
     ) -> None:
         if (descriptors is None) == (descriptors_file is None):
+            # pylint: disable=broad-exception-raised
             raise Exception('Exactly one of "descriptors" or "descriptors_file" is required')
         
         if descriptors_file is not None:
@@ -238,8 +239,13 @@ class DescriptorLoader:
         self._process_descr('service',    'add',    self.__ctx_cli.SetService,    Service,    self.__services      )
         self._process_descr('slice',      'add',    self.__ctx_cli.SetSlice,      Slice,      self.__slices        )
         self._process_descr('connection', 'add',    self.__ctx_cli.SetConnection, Connection, self.__connections   )
-        self._process_descr('context',    'update', self.__ctx_cli.SetContext,    Context,    self.__contexts      )
-        self._process_descr('topology',   'update', self.__ctx_cli.SetTopology,   Topology,   self.__topologies    )
+
+        # Update context and topology is useless:
+        # - devices and links are assigned to topologies automatically by Context component
+        # - topologies, services, and slices are assigned to contexts automatically by Context component
+        #self._process_descr('context',    'update', self.__ctx_cli.SetContext,    Context,    self.__contexts      )
+        #self._process_descr('topology',   'update', self.__ctx_cli.SetTopology,   Topology,   self.__topologies    )
+
         #self.__ctx_cli.close()
 
     def _load_normal_mode(self) -> None:
@@ -265,8 +271,12 @@ class DescriptorLoader:
         self._process_descr('service',  'update', self.__svc_cli.UpdateService,   Service,  self.__services      )
         self._process_descr('slice',    'add',    self.__slc_cli.CreateSlice,     Slice,    self.__slices_add    )
         self._process_descr('slice',    'update', self.__slc_cli.UpdateSlice,     Slice,    self.__slices        )
-        self._process_descr('context',  'update', self.__ctx_cli.SetContext,      Context,  self.__contexts      )
-        self._process_descr('topology', 'update', self.__ctx_cli.SetTopology,     Topology, self.__topologies    )
+        
+        # Update context and topology is useless:
+        # - devices and links are assigned to topologies automatically by Context component
+        # - topologies, services, and slices are assigned to contexts automatically by Context component
+        #self._process_descr('context',  'update', self.__ctx_cli.SetContext,      Context,  self.__contexts      )
+        #self._process_descr('topology', 'update', self.__ctx_cli.SetTopology,     Topology, self.__topologies    )
 
         #self.__slc_cli.close()
         #self.__svc_cli.close()
-- 
GitLab