diff --git a/src/device/service/drivers/gnmi_openconfig/GnmiSessionHandler.py b/src/device/service/drivers/gnmi_openconfig/GnmiSessionHandler.py index 00409dfbdf0f1932da4cedef9c02dccbb5be5ad0..03a55f472d2d4d4cd6726795fe6000c4fb68f95b 100644 --- a/src/device/service/drivers/gnmi_openconfig/GnmiSessionHandler.py +++ b/src/device/service/drivers/gnmi_openconfig/GnmiSessionHandler.py @@ -40,7 +40,6 @@ class GnmiSessionHandler: self._use_tls = settings.get('use_tls', False) self._channel : Optional[grpc.Channel] = None self._stub : Optional[gNMIStub] = None - self._yang_handler = None self._monit_thread = None self._yang_handler = YangHandler() self._subscriptions = Subscriptions() diff --git a/src/device/service/drivers/gnmi_openconfig/handlers/Interface.py b/src/device/service/drivers/gnmi_openconfig/handlers/Interface.py index c471faf2e12842654739552707f86d6f1f478ed9..8521098a335eb98b79261b125aa24d22772c7927 100644 --- a/src/device/service/drivers/gnmi_openconfig/handlers/Interface.py +++ b/src/device/service/drivers/gnmi_openconfig/handlers/Interface.py @@ -80,14 +80,19 @@ class InterfaceHandler(_Handler): yang_ipv4_addr.create_path('config/ip', address_ip) yang_ipv4_addr.create_path('config/prefix-length', address_prefix) + LOGGER.info('YangHandler Data:') + for path, dnode in yang_handler.get_data_paths().items(): + LOGGER.debug('|-> {:s}: {:s}'.format(str(path), json.dumps(dnode.print_dict()))) + str_path = '/interfaces/interface[name={:s}]'.format(if_name) str_data = yang_if.print_mem('json') json_data = json.loads(str_data) json_data = json_data['openconfig-interfaces:interface'][0] str_data = json.dumps(json_data) - is_error = False - LOGGER.warning('Releasing...') + # List elements to release: + LOGGER.warning('Objects to release:') + #LOGGER.warning('Releasing...') while not objects_to_free.empty(): LOGGER.warning('Getting...') try: @@ -96,42 +101,23 @@ class InterfaceHandler(_Handler): LOGGER.warning('Item is None') continue - try: - type_obj = type(obj) - LOGGER.warning('Releasing[type]: {:s}'.format(str(type_obj))) - except: - LOGGER.exception('Releasing[type]: <failed>') - - try: - str_obj = str(obj) - if str_obj is not None: - LOGGER.warning('Releasing[str]: {:s}'.format(str_obj)) - except: - LOGGER.exception('Releasing[str]: <failed>') - - try: - repr_obj = repr(obj) - if repr_obj is not None: - LOGGER.warning('Releasing[repr]: {:s}'.format(str(repr_obj))) - except: - LOGGER.exception('Releasing[repr]: <failed>') - - try: - LOGGER.warning('Releasing: {:s} => {:s}'.format( - str(obj.path()), str(obj.print_mem('json')) - )) - LOGGER.warning('Freeing...') - obj.free() - LOGGER.warning('Free done') - except: - LOGGER.exception('Something went wrong...') - is_error = True - break + LOGGER.warning('Releasing[type]: {:s}'.format(str(type(obj)))) + LOGGER.warning('Releasing: {:s} => {:s}'.format( + str(obj.path()), str(obj.print_mem('json')) + )) + + #try: + # LOGGER.warning('Freeing...') + # obj.free() + # LOGGER.warning('Free done') + #except: + # LOGGER.exception('Something went wrong...') + # is_error = True + # break except queue.Empty: LOGGER.warning('No more objects...') continue - if not is_error: - LOGGER.warning('Release done') + #LOGGER.warning('Release done') return str_path, str_data def parse(