genieparser icon indicating copy to clipboard operation
genieparser copied to clipboard

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

Open maercu opened this issue 4 years ago • 7 comments

/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

maercu avatar Nov 04 '21 12:11 maercu

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

LukasMcClelland avatar Nov 08 '21 15:11 LukasMcClelland

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.

maercu avatar Nov 08 '21 19:11 maercu

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

LukasMcClelland avatar Nov 08 '21 19:11 LukasMcClelland

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

maercu avatar Nov 18 '21 12:11 maercu

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

ghost avatar Nov 18 '21 15:11 ghost

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

whatnowbrowncow avatar Nov 29 '21 16:11 whatnowbrowncow

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

omehrabi avatar Feb 08 '22 19:02 omehrabi