Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IOS-XR] show igmp interface parser - IGMP State not captured #924

Open
geortich opened this issue Jan 30, 2025 · 0 comments
Open

[IOS-XR] show igmp interface parser - IGMP State not captured #924

geortich opened this issue Jan 30, 2025 · 0 comments

Comments

@geortich
Copy link

geortich commented Jan 30, 2025

Description

The genie parser for the show igmp interface command on IOS-XR (tested on NCS 540 and IOSXRV 9K) fails to capture the IGMP state, due to a discrepancy on the output. As a result, genie parse throws an SchemaMissingKeyError exception for missing keys (igmp_state).

Example

  • Raw Data
Loopback1 is up, line protocol is up
  Internet address is 10.1.3.2/32
  IGMP_AFD is enabled on interface
  Multihoming is disabled on interface [Stale : False]
  Location is 0xe
  Current IGMP version is 3
  IGMP query interval is 60 seconds
  IGMP querier timeout is 125 seconds
  IGMP max query response time is 10 seconds
  Last member query response interval is 1 seconds
  IGMP activity: 3 joins, 0 leaves
  IGMP querying router is 10.1.3.2/32 (this system)
  Time elapsed since last query sent 00:00:34
  Time elapsed since IGMP router enabled 2y23w
  Time elapsed since last report received 00:00:29
  • Parsed data - igmp_state is missing
{'vrf': {'Default': {'interfaces': {'Loopback1': {'igmp_activity': {'joins': 3,
                                                                    'leaves': 0},
                                                  'igmp_max_query_response_time': 10,
                                                  'igmp_querier_timeout': 125,
                                                  'igmp_query_interval': 60,
                                                  'igmp_version': 3,
                                                  'interface_status': 'up',
                                                  'ip_address': '10.1.3.2/32',
                                                  'last_member_query_response_interval': 1,
                                                  'line_protocol': 'up',
                                                  'oper_status': 'up',
                                                  'time_elapsed_since_last_query_sent': '00:00:34',
                                                  'time_elapsed_since_last_report_received': '00:00:29'}}}}}

Expected behaviour

igmp_state should be present in the dictionary as it's required by the schema. If it's not the parser will fail to parse the command output.

Code to reproduce the problem

from genie.libs.parser.iosxr.show_igmp import ShowIgmpInterface
from pprint import pprint

input_data = """
Loopback1 is up, line protocol is up
  Internet address is 10.1.3.2/32
  IGMP_AFD is enabled on interface
  Multihoming is disabled on interface [Stale : False]
  Location is 0xe
  Current IGMP version is 3
  IGMP query interval is 60 seconds
  IGMP querier timeout is 125 seconds
  IGMP max query response time is 10 seconds
  Last member query response interval is 1 seconds
  IGMP activity: 3 joins, 0 leaves
  IGMP querying router is 10.1.3.2/32 (this system)
  Time elapsed since last query sent 00:00:34
  Time elapsed since IGMP router enabled 2y23w
  Time elapsed since last report received 00:00:29
"""

parsed_result = ShowIgmpInterface.cli(self = None, vrf='Default', output=input_data)
pprint(parsed_result)

Fix

genie/libs/parser/iosxr/show_igmp.py Line 115
p3 = re.compile(r'^IGMP +is +(?P<igmp_state>[a-zA-Z]+) +on +interface$')

The regex is expecting the string IGMP exactly which doesn't match IGMP_AFD in the output.

This fixes the issue and the igmp_state is captured correctly.
p3 = re.compile(r'^(?:IGMP|IGMP_AFD) +is +(?P<igmp_state>[a-zA-Z]+) +on +interface$')

  • igmp_state is now present in the dictionary
{'vrf': {'Default': {'interfaces': {'Loopback1': {'igmp_activity': {'joins': 3,
                                                                    'leaves': 0},
                                                  'igmp_max_query_response_time': 10,
                                                  'igmp_querier_timeout': 125,
                                                  'igmp_query_interval': 60,
                                                  'igmp_state': 'enabled',
                                                  'igmp_version': 3,
                                                  'interface_status': 'up',
                                                  'ip_address': '10.1.3.2/32',
                                                  'last_member_query_response_interval': 1,
                                                  'line_protocol': 'up',
                                                  'oper_status': 'up',
                                                  'time_elapsed_since_last_query_sent': '00:00:34',
                                                  'time_elapsed_since_last_report_received': '00:00:29'}}}}}

Let me know if you'd like me to raise a PR with this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant