diff options
author | 2019-07-18 16:59:19 -0400 | |
---|---|---|
committer | 2019-07-23 15:09:32 -0400 | |
commit | a0140dea9c608d745767574ac621ca0060a2bddc (patch) | |
tree | e09a1a3f34b4d5c2c7988385a375d8f3cac64a1d /components/scripts/python/ccsdk_netconf/netconfclient.py | |
parent | 4e7621ef49d87745df4eb05a4c7279eb2a1356ad (diff) |
Refactor Netconf script component parent.
Change-Id: Ibbec8cd5785372a89e14a86d4e6ff7f9fed4aad2
Issue-ID: CCSDK-1499
Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
Signed-off-by: Steve Siani <alphonse.steve.siani.djissitchi@ibm.com>
Diffstat (limited to 'components/scripts/python/ccsdk_netconf/netconfclient.py')
-rw-r--r-- | components/scripts/python/ccsdk_netconf/netconfclient.py | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/components/scripts/python/ccsdk_netconf/netconfclient.py b/components/scripts/python/ccsdk_netconf/netconfclient.py index e263ba8f7..a942845b9 100644 --- a/components/scripts/python/ccsdk_netconf/netconfclient.py +++ b/components/scripts/python/ccsdk_netconf/netconfclient.py @@ -1,62 +1,62 @@ from netconf_constant import CONFIG_TARGET_RUNNING, CONFIG_TARGET_CANDIDATE, \ - CONFIG_DEFAULT_OPERATION_REPLACE + CONFIG_DEFAULT_OPERATION_REPLACE +from org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor import NetconfExecutorExtensionsKt class NetconfClient: - def __init__(self, log, component_function, requirement_name): - self.log = log - self.component_function = component_function - netconf_device = self.component_function.initializeNetconfConnection( - requirement_name) - self.netconf_rpc_client = netconf_device.netconfRpcService - self.netconf_session = netconf_device.netconfSession - - def disconnect(self): - self.netconf_session.disconnect() - return - - def connect(self): - self.netconf_session.connect() - return - - def lock(self, config_target=CONFIG_TARGET_CANDIDATE): - device_response = self.netconf_rpc_client.lock(config_target) - return device_response - - 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_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) - return device_response - - def commit(self, confirmed=False, confirm_timeout=60, persist="", - persist_id=""): - device_response = self.netconf_rpc_client.commit(confirmed, confirm_timeout, - persist, persist_id) - return device_response - - def invoke_rpc(self, rpc): - device_response = self.netconf_rpc_client.invokeRpc(rpc) - return device_response - - def cancel_commit(self, persist_id=""): - device_response = self.netconf_rpc_client.cancelCommit(persist_id) - return device_response - - def unlock(self, config_target=CONFIG_TARGET_CANDIDATE): - device_response = self.netconf_rpc_client.unLock(config_target) - return device_response - - def validate(self, config_target=CONFIG_TARGET_CANDIDATE): - device_response = self.netconf_rpc_client.validate(config_target) - return device_response - - def discard_change(self): - device_response = self.netconf_rpc_client.discardConfig() - return device_response + def __init__(self, log, component_function, requirement_name): + self.log = log + self.component_function = component_function + netconf_device = NetconfExecutorExtensionsKt.netconfDevice(component_function, requirement_name) + self.netconf_rpc_client = netconf_device.netconfRpcService + self.netconf_session = netconf_device.netconfSession + + def disconnect(self): + self.netconf_session.disconnect() + return + + def connect(self): + self.netconf_session.connect() + return + + def lock(self, config_target=CONFIG_TARGET_CANDIDATE): + device_response = self.netconf_rpc_client.lock(config_target) + return device_response + + 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_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) + return device_response + + def commit(self, confirmed=False, confirm_timeout=60, persist="", + persist_id=""): + device_response = self.netconf_rpc_client.commit(confirmed, confirm_timeout, + persist, persist_id) + return device_response + + def invoke_rpc(self, rpc): + device_response = self.netconf_rpc_client.invokeRpc(rpc) + return device_response + + def cancel_commit(self, persist_id=""): + device_response = self.netconf_rpc_client.cancelCommit(persist_id) + return device_response + + def unlock(self, config_target=CONFIG_TARGET_CANDIDATE): + device_response = self.netconf_rpc_client.unLock(config_target) + return device_response + + def validate(self, config_target=CONFIG_TARGET_CANDIDATE): + device_response = self.netconf_rpc_client.validate(config_target) + return device_response + + def discard_change(self): + device_response = self.netconf_rpc_client.discardConfig() + return device_response |