Commit e13b8edd authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Common - Tools - Descriptor Loader:

- Removed update context/topology as it is not needed
parent ec29378b
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -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()