From a69b9f500b4f15f78e468cce8561af193a7eb83b Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Mon, 18 Feb 2019 08:08:24 -0500 Subject: Simplify NetconfRpcService MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I6daac25c272ab6b437c07602167a76a2d61816db Issue-ID: CCSDK-790 Signed-off-by: Alexis de Talhouët --- .../scripts/python/ccsdk_netconf/netconfclient.py | 54 +++++++--------------- 1 file changed, 17 insertions(+), 37 deletions(-) (limited to 'components/scripts/python/ccsdk_netconf') diff --git a/components/scripts/python/ccsdk_netconf/netconfclient.py b/components/scripts/python/ccsdk_netconf/netconfclient.py index 341aae738..dd7d2dc22 100644 --- a/components/scripts/python/ccsdk_netconf/netconfclient.py +++ b/components/scripts/python/ccsdk_netconf/netconfclient.py @@ -1,6 +1,7 @@ from netconf_constant import CONFIG_TARGET_RUNNING, CONFIG_TARGET_CANDIDATE, \ CONFIG_DEFAULT_OPERATION_REPLACE + class NetconfClient: def __init__(self, log, component_function, requirement_name): @@ -19,54 +20,33 @@ class NetconfClient: self.netconf_session.connect() return - def lock(self, message_id, config_target=CONFIG_TARGET_CANDIDATE, - message_timeout=30): - device_response = self.netconf_rpc_client.lock(message_id, config_target, - message_timeout) + def lock(self, config_target=CONFIG_TARGET_CANDIDATE): + device_response = self.netconf_rpc_client.lock(config_target) return device_response - def get_config(self, message_id, filter="", - config_target=CONFIG_TARGET_RUNNING, message_timeout=30): - device_response = self.netconf_rpc_client.getConfig(message_id, filter, - config_target, - message_timeout) + def get_config(self, filter="", config_target=CONFIG_TARGET_RUNNING): + device_response = self.netconf_rpc_client.getConfig(filter, config_target) return device_response - def edit_config(self, message_id, message_content, lock=False, - config_target=CONFIG_TARGET_CANDIDATE, - edit_default_peration=CONFIG_DEFAULT_OPERATION_REPLACE, - deleteConfig=False, validate=False, commit=False, discard_change=False, - unlock=False, message_timeout=30): - device_response = self.netconf_rpc_client.editConfig(message_id, - message_content, lock, + def edit_config(self, message_content, config_target=CONFIG_TARGET_CANDIDATE, + edit_default_peration=CONFIG_DEFAULT_OPERATION_REPLACE): + device_response = self.netconf_rpc_client.editConfig(message_content, config_target, - edit_default_peration, - deleteConfig, validate, - commit, discard_change, - unlock, - message_timeout) + edit_default_peration) return device_response - def commit(self, message_id, discard_change=True, - message_timeout=30): - device_response = self.netconf_rpc_client.commit(message_id, discard_change, - message_timeout) + def commit(self): + device_response = self.netconf_rpc_client.commit() return device_response - def unlock(self, message_id, config_target=CONFIG_TARGET_CANDIDATE, - message_timeout=30): - device_response = self.netconf_rpc_client.unLock(message_id, config_target, - message_timeout) + def unlock(self, config_target=CONFIG_TARGET_CANDIDATE): + device_response = self.netconf_rpc_client.unLock(config_target) return device_response - def validate(self, message_id, config_target=CONFIG_TARGET_CANDIDATE, - message_timeout=30): - device_response = self.netconf_rpc_client.validate(message_id, - config_target, - message_timeout) + def validate(self, config_target=CONFIG_TARGET_CANDIDATE): + device_response = self.netconf_rpc_client.validate(config_target) return device_response - def discard_change(self, message_id, message_timeout=30): - device_response = self.netconf_rpc_client.discardConfig(message_id, - message_timeout) + def discard_change(self): + device_response = self.netconf_rpc_client.discardConfig() return device_response -- cgit 1.2.3-korg