Loading src/device/service/DeviceServiceServicerImpl.py +3 −3 Original line number Diff line number Diff line Loading @@ -214,12 +214,12 @@ class DeviceServiceServicerImpl(DeviceServiceServicer): driver : _Driver = self.driver_instance_cache.get(device_uuid) if driver is None: errors.append('Device({:s}) has not been added to this Device instance'.format(str(device_uuid))) if len(errors) == 0: else: #if len(errors) == 0: results_setconfig = driver.SetConfig(resources_to_set) errors.extend(check_set_errors(resources_to_set, results_setconfig)) if len(errors) == 0: #if len(errors) == 0: results_deleteconfig = driver.DeleteConfig(resources_to_delete) errors.extend(check_delete_errors(resources_to_delete, results_deleteconfig)) Loading src/device/service/drivers/openconfig/OpenConfigDriver.py +10 −18 Original line number Diff line number Diff line Loading @@ -222,6 +222,14 @@ def edit_config( msg = '[{:s}] Exception {:s} {:s}: {:s}' logger.exception(msg.format(str_method, str_operation, str_resource_name, str(resource))) results[i] = e # if validation fails, store the exception if not commit_per_rule: try: netconf_handler.commit() except Exception as e: # pylint: disable=broad-except msg = '[{:s}] Exception committing: {:s}' logger.exception(msg.format(str_method, str_operation, str(resources))) results = [e for _ in resources] # if commit fails, set exception in each resource return results HISTOGRAM_BUCKETS = ( Loading Loading @@ -315,17 +323,9 @@ class OpenConfigDriver(_Driver): with self.__lock: if self.__netconf_handler.use_candidate: with self.__netconf_handler.locked(target='candidate'): commit_per_rule = bool(self.__netconf_handler.commit_per_rule) results = edit_config( self.__netconf_handler, self.__logger, resources, target='candidate', commit_per_rule=commit_per_rule) if not commit_per_rule: try: self.__netconf_handler.commit() except Exception as e: # pylint: disable=broad-except MSG = '[SetConfig] Exception commiting resources: {:s}' self.__logger.exception(MSG.format(str(resources))) results = [e for _ in resources] # if commit fails, set exception in each resource commit_per_rule=self.__netconf_handler.commit_per_rule) else: results = edit_config(self.__netconf_handler, self.__logger, resources) return results Loading @@ -337,17 +337,9 @@ class OpenConfigDriver(_Driver): with self.__lock: if self.__netconf_handler.use_candidate: with self.__netconf_handler.locked(target='candidate'): commit_per_rule = bool(self.__netconf_handler.commit_per_rule) results = edit_config( self.__netconf_handler, self.__logger, resources, target='candidate', delete=True, commit_per_rule=commit_per_rule) if not commit_per_rule: try: self.__netconf_handler.commit() except Exception as e: # pylint: disable=broad-except MSG = '[DeleteConfig] Exception commiting resources: {:s}' self.__logger.exception(MSG.format(str(resources))) results = [e for _ in resources] # if commit fails, set exception in each resource commit_per_rule=self.__netconf_handler.commit_per_rule) else: results = edit_config(self.__netconf_handler, self.__logger, resources, delete=True) return results Loading Loading
src/device/service/DeviceServiceServicerImpl.py +3 −3 Original line number Diff line number Diff line Loading @@ -214,12 +214,12 @@ class DeviceServiceServicerImpl(DeviceServiceServicer): driver : _Driver = self.driver_instance_cache.get(device_uuid) if driver is None: errors.append('Device({:s}) has not been added to this Device instance'.format(str(device_uuid))) if len(errors) == 0: else: #if len(errors) == 0: results_setconfig = driver.SetConfig(resources_to_set) errors.extend(check_set_errors(resources_to_set, results_setconfig)) if len(errors) == 0: #if len(errors) == 0: results_deleteconfig = driver.DeleteConfig(resources_to_delete) errors.extend(check_delete_errors(resources_to_delete, results_deleteconfig)) Loading
src/device/service/drivers/openconfig/OpenConfigDriver.py +10 −18 Original line number Diff line number Diff line Loading @@ -222,6 +222,14 @@ def edit_config( msg = '[{:s}] Exception {:s} {:s}: {:s}' logger.exception(msg.format(str_method, str_operation, str_resource_name, str(resource))) results[i] = e # if validation fails, store the exception if not commit_per_rule: try: netconf_handler.commit() except Exception as e: # pylint: disable=broad-except msg = '[{:s}] Exception committing: {:s}' logger.exception(msg.format(str_method, str_operation, str(resources))) results = [e for _ in resources] # if commit fails, set exception in each resource return results HISTOGRAM_BUCKETS = ( Loading Loading @@ -315,17 +323,9 @@ class OpenConfigDriver(_Driver): with self.__lock: if self.__netconf_handler.use_candidate: with self.__netconf_handler.locked(target='candidate'): commit_per_rule = bool(self.__netconf_handler.commit_per_rule) results = edit_config( self.__netconf_handler, self.__logger, resources, target='candidate', commit_per_rule=commit_per_rule) if not commit_per_rule: try: self.__netconf_handler.commit() except Exception as e: # pylint: disable=broad-except MSG = '[SetConfig] Exception commiting resources: {:s}' self.__logger.exception(MSG.format(str(resources))) results = [e for _ in resources] # if commit fails, set exception in each resource commit_per_rule=self.__netconf_handler.commit_per_rule) else: results = edit_config(self.__netconf_handler, self.__logger, resources) return results Loading @@ -337,17 +337,9 @@ class OpenConfigDriver(_Driver): with self.__lock: if self.__netconf_handler.use_candidate: with self.__netconf_handler.locked(target='candidate'): commit_per_rule = bool(self.__netconf_handler.commit_per_rule) results = edit_config( self.__netconf_handler, self.__logger, resources, target='candidate', delete=True, commit_per_rule=commit_per_rule) if not commit_per_rule: try: self.__netconf_handler.commit() except Exception as e: # pylint: disable=broad-except MSG = '[DeleteConfig] Exception commiting resources: {:s}' self.__logger.exception(MSG.format(str(resources))) results = [e for _ in resources] # if commit fails, set exception in each resource commit_per_rule=self.__netconf_handler.commit_per_rule) else: results = edit_config(self.__netconf_handler, self.__logger, resources, delete=True) return results Loading