1 from netconf_constant import CONFIG_TARGET_RUNNING, CONFIG_TARGET_CANDIDATE, \
2 CONFIG_DEFAULT_OPERATION_REPLACE
7 def __init__(self, log, component_function, requirement_name):
9 self.component_function = component_function
10 netconf_device = self.component_function.initializeNetconfConnection(
12 self.netconf_rpc_client = netconf_device.netconfRpcService
13 self.netconf_session = netconf_device.netconfSession
16 self.netconf_session.disconnect()
20 self.netconf_session.connect()
23 def lock(self, config_target=CONFIG_TARGET_CANDIDATE):
24 device_response = self.netconf_rpc_client.lock(config_target)
25 return device_response
27 def get_config(self, filter="", config_target=CONFIG_TARGET_RUNNING):
28 device_response = self.netconf_rpc_client.getConfig(filter, config_target)
29 return device_response
31 def edit_config(self, message_content, config_target=CONFIG_TARGET_CANDIDATE,
32 edit_default_peration=CONFIG_DEFAULT_OPERATION_REPLACE):
33 device_response = self.netconf_rpc_client.editConfig(message_content,
35 edit_default_peration)
36 return device_response
38 def commit(self, confirmed=False, confirm_timeout=60, persist="",
40 device_response = self.netconf_rpc_client.commit(confirmed, confirm_timeout,
42 return device_response
44 def cancel_commit(self, persist_id=""):
45 device_response = self.netconf_rpc_client.cancelCommit(persist_id)
46 return device_response
48 def unlock(self, config_target=CONFIG_TARGET_CANDIDATE):
49 device_response = self.netconf_rpc_client.unLock(config_target)
50 return device_response
52 def validate(self, config_target=CONFIG_TARGET_CANDIDATE):
53 device_response = self.netconf_rpc_client.validate(config_target)
54 return device_response
56 def discard_change(self):
57 device_response = self.netconf_rpc_client.discardConfig()
58 return device_response