CiscoTestAutomation / genieparser

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

[IOS-XE] show ip route {prefix} #885

Closed dmychepk closed 1 week ago

dmychepk commented 2 weeks ago

if output of show ip route {prefix} contains BGP from as with dot notation. like "bgp 1.1" parser fails

SohanTirpude commented 2 weeks ago

Hello @dmychepk,

Can you please let us know what error you are seeing for this command? Also, kindly provide us the raw device output as well.

Thank you.

dmychepk commented 2 weeks ago

2024-08-30 13:04:10,721: %UNICON-INFO: +++ svs-fc-dis-r-1-1 with via 'ssh': executing command 'show ip route 0.0.0.0' +++ show ip route 0.0.0.0 Routing entry for 0.0.0.0/0, supernet Known via "bgp 100.1", distance 20, metric 0, candidate default path Tag 65637, type external Last update from 100.101.0.12 00:16:36 ago Routing Descriptor Blocks: 100.101.0.12, from 100.101.0.12, 00:16:36 ago opaque_ptr 0x7BE623EA95A8 Route metric is 0, traffic share count is 1 AS Hops 5 Route tag 65637 MPLS label: none MPLS Flags: NSF 100.101.0.8, from 100.101.0.8, 00:16:36 ago opaque_ptr 0x7BE623EA95A8 Route metric is 0, traffic share count is 1 AS Hops 5 Route tag 65637 MPLS label: none MPLS Flags: NSF

SchemaMissingKeyError: Missing keys: [['entry', '0.0.0.0/0', 'metric'], ['entry', '0.0.0.0/0', 'known_via'], ['entry', '0.0.0.0/0', 'distance']]

SohanTirpude commented 2 weeks ago

Hello @dmychepk,

Thank you for the output. With this output I was able to reproduce the issues as well as I found the solution. Now, the parsed output looks like this:

{
    "entry": {
        "0.0.0.0/0": {
            "ip": "0.0.0.0",
            "mask": "0",
            "net": "supernet",
            "known_via": "bgp 100.1",
            "distance": "20",
            "metric": "0",
            "type": "default path",
            "tag_name": "65637",
            "tag_type": "external",
            "update": {
                "from": "100.101.0.12",
                "age": "00:16:36"
            },
            "paths": {
                1: {
                    "nexthop": "100.101.0.12",
                    "from": "100.101.0.12",
                    "age": "00:16:36",
                    "prefer_non_rib_labels": False,
                    "merge_labels": False,
                    "metric": "0",
                    "share_count": "1",
                    "as_hops": "5",
                    "route_tag": "65637",
                    "mpls_label": "none",
                    "mpls_flags": "NSF"
                },
                2: {
                    "nexthop": "100.101.0.8",
                    "from": "100.101.0.8",
                    "age": "00:16:36",
                    "prefer_non_rib_labels": False,
                    "merge_labels": False,
                    "metric": "0",
                    "share_count": "1",
                    "as_hops": "5",
                    "route_tag": "65637",
                    "mpls_label": "none",
                    "mpls_flags": "NSF"
                },
                3: {
                    "nexthop": "100.101.0.4",
                    "from": "100.101.0.4",
                    "age": "00:16:36",
                    "prefer_non_rib_labels": False,
                    "merge_labels": False,
                    "metric": "0",
                    "share_count": "1",
                    "as_hops": "5",
                    "route_tag": "65637",
                    "mpls_label": "none",
                    "mpls_flags": "NSF"
                }
            }
        }
    },
    "total_prefixes": 3
}

Kindly check and confirm if everything is correct or not.

Thank you.

dmychepk commented 2 weeks ago

looks good

SohanTirpude commented 1 week ago

Hello @dmychepk,

The PR got merged and the fix will be available in the upcoming pyats 24.9 version. Kindly try and let me know if you still see this issue with pyats 24.9 version.

Meanwhile, I am closing this ticket. If you are facing any other issues, kindly open a new ticket.

Thank you.