CiscoTestAutomation / genieparser

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

Bug (unassigned variable) in show ip route parser, version 21.10 #573

Open maercu opened 2 years ago

maercu commented 2 years ago
/lib/python3.9/site-packages/genie/libs/parser/iosxe/show_routing.py", line 454, in cli
    route_dict['active'] = active
UnboundLocalError: local variable 'active' referenced before assignment

Also reported in the pyats repo (dulicate): https://github.com/CiscoTestAutomation/pyats/issues/136

LukasMcClelland commented 2 years ago

Hello again @maercu, thank you for opening an issue in the correct repository 👍

I'll close the other issue (https://github.com/CiscoTestAutomation/pyats/issues/136) and we can track this bug here.

Same idea here, would you be interested in fixing this issue and opening a PR?

If not, that's OK. We can look after it

maercu commented 2 years ago

Hi @LukasMcClelland I just started with pyAts/genie and I'm not familiar with the code - so if you can look after it, I'd really appreciate it. BTW: From just browsing the code I think the same issue is also present in line number 555.

LukasMcClelland commented 2 years ago

I just started with pyATS/genie and I'm not familiar with the code - so if you can look after it, I'd really appreciate it

Not a problem! We'll get a team member on this issue soon. Thanks for using pyATS/genie

maercu commented 2 years ago

Looks like the issue is only present when checking all route tables with 'show ip route vrf *'.

ghost commented 2 years ago

A fix has been pushed and is in the process of being merged in. Thank you @maercu for pointing out the issue.

whatnowbrowncow commented 2 years ago

Hi all

I'm not sure that this issue has been fixed yet? I've been testing with version 21.10 today and I'm getting the same error as above when parsing specific VRFs, other VRFs work fine without issue.

I don't have the same problem on version 21.6

I'm no expert but the problem seems to be with the REGEX for p3 on lines 306 - 309 (which has changed between working and non-working version). The problem seems to occur when the routing table contains an entry with the '*' symbol denoting a default candidate, the REGEX doesn't match/capture these lines and therefore the 'active' value is not set.

I'd like to help in fixing this but I'm afraid I don't know REGEX well enough, my only suggestion would be to revert back to the old REGEX but I assume that was changed for a good reason.

Thanks

omehrabi commented 2 years ago

seems th issue is fixed could you update to latest version and check again