Commit 652038ee authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Device - gNMI OpenConfig Driver:

- Corrected removal of Network Instance Interface, Protocol, and Static Route
- Corrected destroy of GnmiSessionHandler
parent 96ba5055
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -40,14 +40,16 @@ class GnmiSessionHandler:
        self._use_tls   = settings.get('use_tls', False)
        self._channel : Optional[grpc.Channel] = None
        self._stub : Optional[gNMIStub] = None
        self._yang_handler = YangHandler()
        self._yang_handler = None
        self._monit_thread = None
        self._yang_handler = YangHandler()
        self._subscriptions = Subscriptions()
        self._in_subscriptions = queue.Queue()
        self._out_samples = queue.Queue()

    def __del__(self) -> None:
        self._logger.warning('Destroying YangValidator...')
        if self._yang_handler is not None:
            self._logger.warning('yang_validator.data:')
            for path, dnode in self._yang_handler.get_data_paths().items():
                self._logger.warning('  {:s}: {:s}'.format(str(path), json.dumps(dnode.print_dict())))
+2 −3
Original line number Diff line number Diff line
@@ -37,9 +37,8 @@ class NetworkInstanceInterfaceHandler(_Handler):
        if IS_CEOS: ni_if_id = if_name

        if delete:
            #PATH_TMPL = '/network-instances/network-instance[name={:s}]/interfaces/interface[id={:s}]'
            #str_path = PATH_TMPL.format(ni_name, ni_if_id)
            str_path = None # nothing to delete
            PATH_TMPL = '/network-instances/network-instance[name={:s}]/interfaces/interface[id={:s}]'
            str_path = PATH_TMPL.format(ni_name, ni_if_id)
            str_data = json.dumps({})
            return str_path, str_data

+0 −1
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ class NetworkInstanceProtocolHandler(_Handler):
        str_path = PATH_TMPL.format(ni_name, identifier, proto_name)

        if delete:
            str_path = None # nothing to delete
            str_data = json.dumps({})
            return str_path, str_data

+3 −4
Original line number Diff line number Diff line
@@ -37,10 +37,9 @@ class NetworkInstanceStaticRouteHandler(_Handler):
            identifier = 'openconfig-policy-types:{:s}'.format(identifier)

        if delete:
            #PATH_TMPL  = '/network-instances/network-instance[name={:s}]/protocols'
            #PATH_TMPL += '/protocol[identifier={:s}][name={:s}]/static-routes/static[prefix={:s}]'
            #str_path = PATH_TMPL.format(ni_name, identifier, proto_name, prefix)
            str_path = None # nothing to delete
            PATH_TMPL  = '/network-instances/network-instance[name={:s}]/protocols'
            PATH_TMPL += '/protocol[identifier={:s}][name={:s}]/static-routes/static[prefix={:s}]'
            str_path = PATH_TMPL.format(ni_name, identifier, proto_name, prefix)
            str_data = json.dumps({})
            return str_path, str_data