Commit 01019ca8 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Device component - gNMI OpenConfig Driver:

- Added yang module "openconfig-bgp-types"
- Enabled some debug log messages
parent 083c9d0f
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -95,22 +95,24 @@ class GnmiSessionHandler:
            str_resource_name = 'resource_key[#{:d}]'.format(i)
            try:
                chk_string(str_resource_name, resource_key, allow_empty=False)
                #self._logger.debug('[GnmiSessionHandler:get] resource_key = {:s}'.format(str(resource_key)))
                self._logger.debug('[GnmiSessionHandler:get] resource_key = {:s}'.format(str(resource_key)))
                str_path = get_path(resource_key)
                #self._logger.debug('[GnmiSessionHandler:get] str_path = {:s}'.format(str(str_path)))
                self._logger.debug('[GnmiSessionHandler:get] str_path = {:s}'.format(str(str_path)))
                get_request.path.append(path_from_string(str_path))
            except Exception as e: # pylint: disable=broad-except
                MSG = 'Exception parsing {:s}: {:s}'
                self._logger.exception(MSG.format(str_resource_name, str(resource_key)))
                parsing_results.append((resource_key, e)) # if validation fails, store the exception

        self._logger.debug('parsing_results={:s}'.format(str(parsing_results)))

        if len(parsing_results) > 0:
            return parsing_results

        metadata = [('username', self._username), ('password', self._password)]
        timeout = None # GNMI_SUBSCRIPTION_TIMEOUT = int(sampling_duration)
        get_reply = self._stub.Get(get_request, metadata=metadata, timeout=timeout)
        #self._logger.info('get_reply={:s}'.format(grpc_message_to_json_string(get_reply)))
        self._logger.debug('get_reply={:s}'.format(grpc_message_to_json_string(get_reply)))

        results = []
        #results[str_filter] = [i, None, False]  # (index, value, processed?)
@@ -127,7 +129,7 @@ class GnmiSessionHandler:
            #    resource_key_tuple[2] = True

            for update in notification.update:
                #self._logger.info('update={:s}'.format(grpc_message_to_json_string(update)))
                self._logger.debug('update={:s}'.format(grpc_message_to_json_string(update)))
                str_path = path_to_string(update.path)
                #resource_key_tuple = results.get(str_path)
                #if resource_key_tuple is None:
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ YANG_SEARCH_PATHS = ':'.join([

YANG_MODULES = [
    'iana-if-type',
    'openconfig-bgp-types',
    'openconfig-vlan-types',

    'openconfig-interfaces',