CiscoTestAutomation / genieparser

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

ASR9902 - Parser show l2vpn xco #708

Open Olichous opened 1 year ago

Olichous commented 1 year ago

Hi Guys,

I use this paser : show l2vpn xconnect and i have the output :

Traceback (most recent call last): File "", line 1, in File "src/genie/conf/base/device.py", line 527, in genie.conf.base.device.Device.parse File "src/genie/conf/base/device.py", line 563, in genie.conf.base.device.Device._get_parser_output File "src/genie/conf/base/device.py", line 561, in genie.conf.base.device.Device._get_parser_output File "src/genie/metaparser/_metaparser.py", line 279, in genie.metaparser._metaparser.MetaParser.parse File "/var/venv/pyats/lib64/python3.6/site-packages/genie/libs/parser/iosxr/show_xconnect.py", line 1285, in cli name_dict['status'] = str(group['status_group']) UnboundLocalError: local variable 'name_dict' referenced before assignment

It seem's that the issue it's on all show l2vpn xconnect related.

Taarini commented 1 year ago

Hi

Thanks for reporting

Can you please share device output for the above issue to debug

Olichous commented 1 year ago

Hi,

Yes it's the device output : I have to delete the output of the e-line description and interface.

show l2vpn xconnect Thu Oct 13 00:29:35.860 CEST Legend: ST = State, UP = Up, DN = Down, AD = Admin Down, UR = Unresolved, SB = Standby, SR = Standby Ready, (PP) = Partially Programmed, LU = Local Up, RU = Remote Up, CO = Connected, (SI) = Seamless Inactive

XConnect Segment 1 Segment 2
Group Name ST Description ST Description ST


XYZ XYZ UP XYZ UP EVPN XYZ UP

XYZ XYZ UP XYZ UP EVPN XYZ UP

XYZ XYZ UP XYZ UP EVPN XYZ UP

XYZ XYZ UP XYZ UP EVPN XYZ UP

RP/0/RP0/CPU0:routeur# Traceback (most recent call last): File "", line 1, in File "src/genie/conf/base/device.py", line 531, in genie.conf.base.device.Device.parse File "src/genie/conf/base/device.py", line 570, in genie.conf.base.device.Device._get_parser_output File "src/genie/conf/base/device.py", line 568, in genie.conf.base.device.Device._get_parser_output File "src/genie/metaparser/_metaparser.py", line 308, in genie.metaparser._metaparser.MetaParser.parse File "/usr/local/lib/python3.7/site-packages/genie/libs/parser/iosxr/show_xconnect.py", line 1293, in cli name_dict['status'] = str(group['status_group']) UnboundLocalError: local variable 'name_dict' referenced before assignment

Taarini commented 1 year ago

Try removing $ from the regex. It will solve your above issue. https://github.com/CiscoTestAutomation/genieparser/blob/master/src/genie/libs/parser/iosxr/show_xconnect.py#L1171

pyATS is an open source library.

Try contributing to this fix. If you need any help in creating PR. I can assist you.