07-24-2017 02:50 AM
Hi,
I tried to clear isis process using Yang xml RPC but facing some issues. Please do the needful.
def clear_isis(host, user, password):
try:
with manager.connect(host=host, username=user, password=password, look_for_keys=False,hostkey_verify=False,timeout=150) as m:
isis_filter = '''
<clear-isis-process xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-isis-act">
<input>
<instance>
<instance-identifier>1000</instance-identifier>
</instance>
</input>
</clear-isis-process>
'''
#cisco_isis = m.edit_config(target = 'candidate',config = isis_filter)
#m.commit()
cisco_isis = m.dispatch(isis_filter)
print cisco_isis
#m.get('subtree', isis_filter)
except Exception as exe:
print 'Exception caught in clear_isis()',exe
clear_isis('1.1.1.1', 'user', 'password')
Output:
Exception caught in clear_isis() Invalid tag name u'\n<clear-isis-process xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-isis-act">\n<input>\n<instance>\n<instance-identifier></instance-identifier>\n</instance>\n</input>\n</clear-isis-process>\n
Thank you,
Divya
07-25-2017 02:06 PM
Hi,
I believe you cannot use the ncclient manager.get() (meant for netconf ‘get’ RPC) function for this RPC. But you can use YDK’s ExecutorService. For example,
from ydk.models.cisco_ios_xr import Cisco_IOS_XR_isis_act
from ydk.providers import NetconfServiceProvider
from ydk.services import ExecutorService
provider = NetconfServiceProvider(address=<host>,username=<username>, password=<password>)
ex = ExecutorService()
clear_rpc = Cisco_IOS_XR_isis_act.ClearIsisProcessRpc()
clear_rpc.input.instance. instance_identifier = '1000'
re = ex.execute_rpc(provider, clear_rpc)
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide