napalm-automation / napalm-iosxr

Apache License 2.0
10 stars 23 forks source link

get_route_to doesn't work for static IPv6 routes/adresses #116

Closed manuel-domke closed 7 years ago

manuel-domke commented 7 years ago

The get_route_to command returns an XMLCLIError containing no useful error message when trying to call get_route_to with an IPv6 address.

We could find the real reason by issueing the xml request manually on the xml cli:

\<Address ErrorCode="0x4368a800" ErrorMsg="'XMLMDA' detected the 'warning' condition 'The XML request does not conform to the schema. The character data contained in the element does not conform to the XML schema for its datatype. Please check the request against the schema.': Expected data type is an IPV4 address/mask in dotted decimal notation"/>

xml-response.txt

Why doesn't napalm pass the device response ?

Unfortunately the xml request is hardcoded for IPv4 only. Maybe someone can help me re-writing the request for IPv6. I couldn't find any details on that so far.

Setup

napalm-iosxr version

python-napalm-iosxr-0.4.8-4.noarch

IOS-XR version and platform details

(Paste the complete verbatim output from show version brief between quotes below)

Fri Mar 31 12:34:16.351 CEST

Cisco IOS XR Software, Version 5.3.3[Default] Copyright (c) 2016 by Cisco Systems, Inc.

ROM: System Bootstrap, Version 2.04(20140424:063844) [ASR9K ROMMON],

rt-1.tt4 uptime is 21 hours, 38 minutes System image file is "bootflash:disk0/asr9k-os-mbi-5.3.3/0x100000/mbiasr9k-rp.vm"

cisco ASR9K Series (P4040) processor with 8388608K bytes of memory. P4040 processor at 1500MHz, Revision 3.0 ASR-9001 Chassis

2 Management Ethernet 20 GigabitEthernet 4 TenGigE 4 DWDM controller(s) 4 WANPHY controller(s) 219k bytes of non-volatile configuration memory. 2868M bytes of hard disk. 3915760k bytes of disk0: (Sector size 512 bytes).

Steps to Reproduce the Issue

call get_route_to with an IPv6 address as argument.

Error Traceback

    routes_tree = ETREE.fromstring(self.device.make_rpc_call(route_info_rpc_command))
  File "/usr/lib/python2.7/site-packages/pyIOSXR/iosxr.py", line 148, in make_rpc_call
    result = self._execute_rpc(rpc_command)
  File "/usr/lib/python2.7/site-packages/pyIOSXR/iosxr.py", line 412, in _execute_rpc
    raise XMLCLIError(error_msg, self)
pyIOSXR.exceptions.XMLCLIError: 
Original call was: <?xml version="1.0" encoding="UTF-8"?><Request MajorVersion="1" MinorVersion="0"><Get><Operational><RIB><VRFTable><VRF><Naming><VRFName>default        </VRFName></Naming><AFTable><AF><Naming><AFName>IPv4</AFName></Naming><SAFTable><SAF>        <Naming><SAFName>Unicast</SAFName></Naming><IP_RIBRouteTable><IP_RIBRoute><Naming>        <RouteTableName>default</RouteTableName></Naming><RouteTable><Route><Naming><Address>        DEAD:BEEF:210:210::53</Address></Naming></Route></RouteTable></IP_RIBRoute></IP_RIBRouteTable>        </SAF></SAFTable></AF></AFTable></VRF></VRFTable></RIB></Operational></Get></Request>
mirceaulinic commented 7 years ago

Hi @manuel-domke - thanks for reporting this.

You are correct, it is hardcoded to IPv4. It should be an easy fix, I can guide you with the implementation: inside https://github.com/napalm-automation/napalm-iosxr/blob/develop/napalm_iosxr/iosxr.py#L1225 you can check if the destination is IPv4 or IPv6; depending on this, you should adjust the XML request: https://github.com/napalm-automation/napalm-iosxr/blob/develop/napalm_iosxr/iosxr.py#L1243-L1248.

Let me know if you have any questions.

manuel-domke commented 7 years ago

Hi @mirceaulinic, thanks for the amazingly fast response.

Currently my main problem is to find the correct XML syntax to issue the request for IPv6. Just replacing IPv4 by IPv6 doesn't do the job ;-)

mirceaulinic commented 7 years ago

Interesting... this is the XML schema reference: www.cisco.com/c/en/us/td/docs/routers/asr9000/software/asr9k_r4-3/xml/schemas/XR_XML_Schemas_ASR9K_430.html -- be aware it may crash your browser.

manuel-domke commented 7 years ago

After hours of research and many tries, we still could not write the request for IPv6. I don't see any other options than giving the address to the \<Address> Tag like this: \<Address>DEAD:BEEF:210:210::53\</Address>

Unfortunately \<Address> is fixed to the IPV4Address data type in the xml schema, no matter in which naming space I entered before: \<AFName>IPv6\</AFName>.

EDIT: Finally found the IPV6_RIB element. Now implementing the request.

mirceaulinic commented 7 years ago

Closed via https://github.com/napalm-automation/napalm-iosxr/commit/eb9366b7321fb3192818284092f223d2d03a5c9a