cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1642
Views
2
Helpful
3
Replies

ping command using YDK XML rpc?

nithin.bk8
Level 1
Level 1

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

1 Accepted Solution

Accepted Solutions

abhirame
Cisco Employee
Cisco Employee

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)


View solution in original post

3 Replies 3

abhirame
Cisco Employee
Cisco Employee

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)


You can find several ping examples in this post:

Automating Ping requests

Thank you Santiago and Abhirame.