You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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$')
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 anSchemaMissingKeyError
exception for missing keys (igmp_state).Example
igmp_state
is missingExpected 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
Fix
genie/libs/parser/iosxr/show_igmp.py
Line 115p3 = 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 dictionaryLet me know if you'd like me to raise a PR with this fix.
The text was updated successfully, but these errors were encountered: