CiscoTestAutomation / genieparser

sub-component of Genie that parse the device output into structured datastructure
Apache License 2.0
252 stars 388 forks source link

IOSXR -- Improper parsing for "show route ipv4 vrf all" #81

Closed kokasha closed 4 years ago

kokasha commented 4 years ago

The parsing of the VRF name in the show route ipv4 vrf all command on IOS-XR router is not working as expected. In case the VRF name is not standard and the name have any special character like (:_) the VRF name is returned as 'default'.

Below is an Example

RP/0/RP0/CPU0:xrv_rtr1#sh route vrf L:192 Thu Feb 6 00:29:44.865 UTC

Codes: C - connected, S - static, R - RIP, B - BGP, (>) - Diversion path D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - ISIS, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, su - IS-IS summary null, * - candidate default U - per-user static route, o - ODR, L - local, G - DAGR, l - LISP A - access/subscriber, a - Application route M - mobile route, r - RPL, t - Traffic Engineering, (!) - FRR Backup path

Gateway of last resort is not set

S 10.2.2.2/32 is directly connected, 00:06:36, Null0

Parsed Output
        "default": {
            "address_family": {
                "ipv4": {
                    "routes": {
                        "10.2.2.2/32": {
                            "active": true,
                            "next_hop": {
                                "outgoing_interface": {
                                    "Null0": {
                                        "outgoing_interface": "Null0",
                                        "updated": "00:00:25"
                                    }
                                }
                            },
                            "route": "10.2.2.2/32",
                            "source_protocol": "static",
                            "source_protocol_codes": "S"
                        }
                    }
                }
            }
        },

I think that the problem is in the parsing of the VRF name since you are matching only on (\w).

If this is modified this will solve the problem.

thaixuann commented 4 years ago

Hello @kokasha , Thanks for reporting the issue. We'll take a look and let you know.

--Thai.

kokasha commented 4 years ago

Hi @thaixuann is there any update regarding this issue that i opened. Do you need any more output from my side

thaixuann commented 4 years ago

Hello @kokasha , We are fixing the issue. I will update once we release a beta package for you.

Thanks, --Thai.

xiaoxinz-cisco commented 4 years ago

Hello @kokasha

We fixed the issue and genie package v20.1.1b0 has been released with the fix. Could you please run the following command and try again to see if it works?

pip install genie.libs.parser --upgrade --pre

Please try and let's know if there is an issue.

Thanks, Irene

kokasha commented 4 years ago

@xiaoxinz-cisco Thanks so much for the feedback. I have tested it and it is working as expected

I am sorry for the late feedback :)