genieparser: iosxe show cts interface parser doesn't work with port channel interface on Cat 9300

Switch Model: C9300-48U OS Version: 17.3.3

Parsing of show cts interface results in this raw output:

Interface Port-channel22:
    CTS is disabled.

    L3 IPM:   disabled.

The Genie parser throws the following exception:

  File "/home/aj/projects/python/thr-cts-readiness/.venv/lib/python3.11/site-packages/genie/libs/parser/iosxe/show_cts.py", line 2539, in cli
    intf_dict['l3_ipm'] = l3_ipm
    ^^^^^^^^^
UnboundLocalError: cannot access local variable 'intf_dict' where it is not associated with a value

Looking at the code it appears the regex match to create intf_dict is: p2 = re.compile(r'^Interface\s+(?P<interface>\S+\d+\/\d+\/\d+|Tunnel\d+|\S+\d+\/\d+\/\d+\.\d+):')

It seems to me like that should match the Port-channel interface, but maybe it’s not?

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Comments: 16

Most upvoted comments

I see in the p3.match() logic where the mode key is generated. I put a conditional in there and now the GH Actions tests are passing. I’ll put together a PR