question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

show running-config interface {interface} parser not getting acl name on IOS/IOS-XE

See original GitHub issue

The following parser commands don’t return the correct output for ‘acl’ if access-list is only configured in either ‘in’ or ‘out’ direction on interface:

"show running-config | section ^interface"
"show running-config interface {interface_name}"

See details below:

Output of parser for “show running-config | section ^interface”:

  1. If access-list is only configured in ‘in’ direction:
interface GigabitEthernet1/0/27
 ip access-group TEST in

Then parser returns an empty acl: 'GigabitEthernet1/0/27': {'acl': {}}

But the expected result is: 'GigabitEthernet1/0/27': {'acl': {'inbound': {'acl_name': 'TEST', 'direction': 'in'}}}

  1. If access-list is only configured in ‘out’ direction:
interface GigabitEthernet1/0/28
 ip access-group TEST out

Then parser returns an acl: 'GigabitEthernet1/0/28': {'acl': {'inbound': {'acl_name': 'TEST', 'direction': 'in'}, 'outbound': {'acl_name': 'TEST', 'direction': 'out'}}}

But the expected result is: 'GigabitEthernet1/0/28': {'acl': {'outbound': {'acl_name': 'TEST', 'direction': 'out'}}}

Output of parser for “show running-config interface GigabitEthernet1/0/27” {'interfaces': {'GigabitEthernet1/0/27': {'acl': {}}}}

Output of parser for “show running-config interface GigabitEthernet1/0/28”

  File "src/genie/conf/base/device.py", line 527, in genie.conf.base.device.Device.parse
  File "src/genie/conf/base/device.py", line 566, in genie.conf.base.device.Device._get_parser_output
  File "src/genie/conf/base/device.py", line 564, in genie.conf.base.device.Device._get_parser_output
  File "src/genie/metaparser/_metaparser.py", line 308, in genie.metaparser._metaparser.MetaParser.parse
  File "/scripts/venv-pycrawler/lib/python3.10/site-packages/genie/libs/parser/iosxe/show_run.py", line 1311, in cli
    intf_dict['acl'].update(inbound_dict)
UnboundLocalError: local variable 'inbound_dict' referenced before assignment

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jc-krylatskoecommented, Jul 2, 2022

Thank you, after upgrade of pyATS/genie to 22.6 I confirm that parser works fine and produces expected results for all my tests

1reaction
Taarinicommented, Jun 28, 2022

It’s been fixed and will be released in 22.6

Read more comments on GitHub >

github_iconTop Results From Across the Web

Access-list not showing on show running-config
I am a newly hired Network Engineer in our company. I don't know the history but I type "show access-list" command on one...
Read more >
Retrieve Information from Cisco router in Parsable Manner
The barrier I run into is that running show running config returns global configuration settings as well as settings for particular interfaces.
Read more >
Learn how the Cisco IOS parser command can speed up ...
When you issue a show running-config command, it queries every interface on your router and then compiles all this information into a total ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found