07-25-2017 05:34 AM
Hi,
I am working on basic action command "ping " using YDK module XMl rpc with ncclient. I am unable to get the necessary output.
I get the following error.
Invalid tag name u'\n<action xmlns:xc="urn:ietf:Params:xml:ns:netconf:base:1.0">\n <ping xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ping-act">\n <destination>\n <destination>10.0.0.1</destination>\n </destination>\n </ping>\n</action>\n '
filter='''
<action xmlns:xc="urn:ietf:Params:xml:ns:netconf:base:1.0">
<ping xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ping-act">
<destination>
<destination>10.0.0.1</destination>
</destination>
</ping>
</action>
'''
manager_connect.dispatch(filter)
Please correct me if I have missed anything.
Regards,
Nithin
Solved! Go to Solution.
07-25-2017 02:03 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_ping_act
from ydk.providers import NetconfServiceProvider
from ydk.services import ExecutorService
provider = NetconfServiceProvider(address=<host>,username=<username>, password=<password>)
ex = ExecutorService()
pingrpc = Cisco_IOS_XR_ping_act.PingRpc()
ip = Cisco_IOS_XR_ping_act.PingRpc.Input.Ipv4()
ip.destination = '127.0.0.1'
pingrpc.input.ipv4.append(ip)
re = ex.execute_rpc(provider, pingrpc)
07-25-2017 02:03 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_ping_act
from ydk.providers import NetconfServiceProvider
from ydk.services import ExecutorService
provider = NetconfServiceProvider(address=<host>,username=<username>, password=<password>)
ex = ExecutorService()
pingrpc = Cisco_IOS_XR_ping_act.PingRpc()
ip = Cisco_IOS_XR_ping_act.PingRpc.Input.Ipv4()
ip.destination = '127.0.0.1'
pingrpc.input.ipv4.append(ip)
re = ex.execute_rpc(provider, pingrpc)
08-22-2017 02:21 PM
You can find several ping examples in this post:
08-22-2017 08:20 PM
Thank you Santiago and Abhirame.
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