02-21-2018 09:07 AM
Hello guys,
I see that while using the Cisco_IOS_XR_ping_act module for performing ping tests, the router sets the rpc output field rotate-pattern to a numerical value (0 in my case) , but the yang model/python class expects a boolean value. I am not sure whether the yang model is incorrect or the router is returning a rogue value. Can anyone please confirm.
Thanks,
Mufaddal
YDK Logs
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><ping xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ping-act">
<destination>
<destination>172.16.1.12</destination>
</destination>
</ping>
</rpc>
2018-02-21 16:42:26,305 - ydk - INFO -
2018-02-21 16:42:26,864 - ydk - INFO - =============Reply payload received from device=============
2018-02-21 16:42:26,864 - ydk - INFO - <?xml version="1.0"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
<ping-response xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ping-act">
<ipv4>
<destination>172.16.1.12</destination>
<repeat-count>5</repeat-count>
<data-size>100</data-size>
<timeout>2</timeout>
<pattern>abcd</pattern>
<rotate-pattern>0</rotate-pattern>
<replies>
<reply>
<reply-index>1</reply-index>
<result>!</result>
</reply>
<reply>
<reply-index>2</reply-index>
<result>!</result>
</reply>
<reply>
<reply-index>3</reply-index>
<result>!</result>
</reply>
<reply>
<reply-index>4</reply-index>
<result>!</result>
</reply>
<reply>
<reply-index>5</reply-index>
<result>!</result>
</reply>
</replies>
<hits>5</hits>
<total>5</total>
<success-rate>100</success-rate>
<rtt-min>1</rtt-min>
<rtt-avg>1</rtt-avg>
<rtt-max>3</rtt-max>
</ipv4>
</ping-response>
</rpc-reply>
2018-02-21 16:42:26,865 - ydk - INFO -
2018-02-21 16:42:26,865 - ydk - ERROR - Data is invalid according to the yang model. Error details: Invalid value "0" in "rotate-pattern" element. Path: '/Cisco-IOS-XR-ping-act:ping/ping-response/ipv4[destination='172.16.1.12']/rotate-pattern'
invalid according to the yang model. Error details: Invalid value "0" in "rotate-pattern" element. Path: '/Cisco-IOS-XR-ping-act:ping/ping-response/ipv4[destination='172.16.1.12']/rotate-pattern'
Additional logs
pip list | grep ydk
ydk (0.7.0)
ydk-models-cisco-ios-xr (6.2.2)
ydk-models-ietf (0.1.4)
ydk-models-openconfig (0.1.4)
ydk-models-service (0.1.0)
XRv9K box version: 6.2.3
Solved! Go to Solution.
02-21-2018 09:26 AM
You are correct. The rotate-pattern should have a boolean value. This is an open bug in XR CSCvh50220. It should be fixed soon.
02-21-2018 09:26 AM
You are correct. The rotate-pattern should have a boolean value. This is an open bug in XR CSCvh50220. It should be fixed soon.
02-21-2018 09:27 AM
Thank you for the quick response, I think the bug is currently not externally visible
02-21-2018 09:31 AM
Another related question , is there any other way to do a ping operation for a XR box ?
02-22-2018 01:32 PM
Please find below a python script which should help you with this:
First:
pip install ncclient
Use below payload:
pl='''<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101"><ping xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ping-act">
<destination>
<destination>172.16.1.12</destination>
</destination>
</ping>
</rpc> '''
Then run below script:
from ncclient.operations import RPC, RPCReply from ncclient import manager m = manager.connect( host='[addrres]', port='830', username='[username]', password='[password]', look_for_keys=False, allow_agent=False, hostkey_verify=False) class RPC(RPC): def _wrap(self, subele): return subele class REPLY_CLS(RPCReply): def parse(self): self._parsed = True return True RPC.REPLY_CLS = REPLY_CLS rpc = RPC(m._session, m._device_handler) pl=pl.replace("101",rpc._id,1) reply=rpc._request(pl) print(reply.xml)
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