cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1670
Views
0
Helpful
4
Replies

Ping RPC error with Cisco_IOS_XR_ping_act module

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

1 Accepted Solution

Accepted Solutions

abhirame
Cisco Employee
Cisco Employee

You are correct. The rotate-pattern should have a boolean value. This is an open bug in XR CSCvh50220. It should be fixed soon.

View solution in original post

4 Replies 4

abhirame
Cisco Employee
Cisco Employee

You are correct. The rotate-pattern should have a boolean value. This is an open bug in XR CSCvh50220. It should be fixed soon.

Thank you for the quick response, I think the bug is currently not externally visible

Another related question , is there any other way to do a ping operation for a XR box ?

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)