Loading src/device/service/drivers/openconfig/OpenConfigDriver.py +5 −5 Original line number Original line Diff line number Diff line Loading @@ -196,12 +196,12 @@ def edit_config( format='xml' # pylint: disable=redefined-builtin format='xml' # pylint: disable=redefined-builtin ): ): str_method = 'DeleteConfig' if delete else 'SetConfig' str_method = 'DeleteConfig' if delete else 'SetConfig' logger.info('[{:s}] resources = {:s}'.format(str_method, str(resources))) #logger.debug('[{:s}] resources = {:s}'.format(str_method, str(resources))) results = [None for _ in resources] results = [None for _ in resources] for i,resource in enumerate(resources): for i,resource in enumerate(resources): str_resource_name = 'resources[#{:d}]'.format(i) str_resource_name = 'resources[#{:d}]'.format(i) try: try: logger.info('[{:s}] resource = {:s}'.format(str_method, str(resource))) #logger.debug('[{:s}] resource = {:s}'.format(str_method, str(resource))) chk_type(str_resource_name, resource, (list, tuple)) chk_type(str_resource_name, resource, (list, tuple)) chk_length(str_resource_name, resource, min_length=2, max_length=2) chk_length(str_resource_name, resource, min_length=2, max_length=2) resource_key,resource_value = resource resource_key,resource_value = resource Loading @@ -209,8 +209,8 @@ def edit_config( str_config_message = compose_config( str_config_message = compose_config( resource_key, resource_value, delete=delete, vendor=netconf_handler.vendor) resource_key, resource_value, delete=delete, vendor=netconf_handler.vendor) if str_config_message is None: raise UnsupportedResourceKeyException(resource_key) if str_config_message is None: raise UnsupportedResourceKeyException(resource_key) logger.info('[{:s}] str_config_message[{:d}] = {:s}'.format( #logger.debug('[{:s}] str_config_message[{:d}] = {:s}'.format( str_method, len(str_config_message), str(str_config_message))) # str_method, len(str_config_message), str(str_config_message))) netconf_handler.edit_config( netconf_handler.edit_config( config=str_config_message, target=target, default_operation=default_operation, config=str_config_message, target=target, default_operation=default_operation, test_option=test_option, error_option=error_option, format=format) test_option=test_option, error_option=error_option, format=format) Loading Loading @@ -305,7 +305,7 @@ class OpenConfigDriver(_Driver): try: try: chk_string(str_resource_name, resource_key, allow_empty=False) chk_string(str_resource_name, resource_key, allow_empty=False) str_filter = get_filter(resource_key) str_filter = get_filter(resource_key) self.__logger.info('[GetConfig] str_filter = {:s}'.format(str(str_filter))) #self.__logger.debug('[GetConfig] str_filter = {:s}'.format(str(str_filter))) if str_filter is None: str_filter = resource_key if str_filter is None: str_filter = resource_key xml_data = self.__netconf_handler.get(filter=str_filter).data_ele xml_data = self.__netconf_handler.get(filter=str_filter).data_ele if isinstance(xml_data, Exception): raise xml_data if isinstance(xml_data, Exception): raise xml_data Loading Loading
src/device/service/drivers/openconfig/OpenConfigDriver.py +5 −5 Original line number Original line Diff line number Diff line Loading @@ -196,12 +196,12 @@ def edit_config( format='xml' # pylint: disable=redefined-builtin format='xml' # pylint: disable=redefined-builtin ): ): str_method = 'DeleteConfig' if delete else 'SetConfig' str_method = 'DeleteConfig' if delete else 'SetConfig' logger.info('[{:s}] resources = {:s}'.format(str_method, str(resources))) #logger.debug('[{:s}] resources = {:s}'.format(str_method, str(resources))) results = [None for _ in resources] results = [None for _ in resources] for i,resource in enumerate(resources): for i,resource in enumerate(resources): str_resource_name = 'resources[#{:d}]'.format(i) str_resource_name = 'resources[#{:d}]'.format(i) try: try: logger.info('[{:s}] resource = {:s}'.format(str_method, str(resource))) #logger.debug('[{:s}] resource = {:s}'.format(str_method, str(resource))) chk_type(str_resource_name, resource, (list, tuple)) chk_type(str_resource_name, resource, (list, tuple)) chk_length(str_resource_name, resource, min_length=2, max_length=2) chk_length(str_resource_name, resource, min_length=2, max_length=2) resource_key,resource_value = resource resource_key,resource_value = resource Loading @@ -209,8 +209,8 @@ def edit_config( str_config_message = compose_config( str_config_message = compose_config( resource_key, resource_value, delete=delete, vendor=netconf_handler.vendor) resource_key, resource_value, delete=delete, vendor=netconf_handler.vendor) if str_config_message is None: raise UnsupportedResourceKeyException(resource_key) if str_config_message is None: raise UnsupportedResourceKeyException(resource_key) logger.info('[{:s}] str_config_message[{:d}] = {:s}'.format( #logger.debug('[{:s}] str_config_message[{:d}] = {:s}'.format( str_method, len(str_config_message), str(str_config_message))) # str_method, len(str_config_message), str(str_config_message))) netconf_handler.edit_config( netconf_handler.edit_config( config=str_config_message, target=target, default_operation=default_operation, config=str_config_message, target=target, default_operation=default_operation, test_option=test_option, error_option=error_option, format=format) test_option=test_option, error_option=error_option, format=format) Loading Loading @@ -305,7 +305,7 @@ class OpenConfigDriver(_Driver): try: try: chk_string(str_resource_name, resource_key, allow_empty=False) chk_string(str_resource_name, resource_key, allow_empty=False) str_filter = get_filter(resource_key) str_filter = get_filter(resource_key) self.__logger.info('[GetConfig] str_filter = {:s}'.format(str(str_filter))) #self.__logger.debug('[GetConfig] str_filter = {:s}'.format(str(str_filter))) if str_filter is None: str_filter = resource_key if str_filter is None: str_filter = resource_key xml_data = self.__netconf_handler.get(filter=str_filter).data_ele xml_data = self.__netconf_handler.get(filter=str_filter).data_ele if isinstance(xml_data, Exception): raise xml_data if isinstance(xml_data, Exception): raise xml_data Loading