Skip to content

Commit

Permalink
Merge pull request #815 from aj-cruz/aj_fix_show_cts_iosxe
Browse files Browse the repository at this point in the history
 Port-channel Fixes for iosxe ShowCtsInterface parser (iosxe/show_cts)
  • Loading branch information
Sohan Tirpude authored Feb 5, 2024
2 parents df9ca29 + b624452 commit 266aeee
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--------------------------------------------------------------------------------
Fix
--------------------------------------------------------------------------------
* IOSXE
* Modified ShowCtsInterfaceSchema:
* Changed global_dot1x_feature from schema to Optional (not present on port-channel interfaces)
* Changed cts mode value from schema to Optional to (not present when cts status is disabled)
* Modified ShowCtsInterface:
* Updated regex pattern p2 to also match Port-channel interfaces
* Updated regex pattern p3 to also match CTS disabled status
* Added conditional to cts_dict so mode key is not generated if cts is disabled
* Modified golden_output2_expected test data
* Added expected output for Port-channel interfaces
* Added golden_output4 test data & expected results
58 changes: 29 additions & 29 deletions sdk_generator/outputs/github_parser.json

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions src/genie/libs/parser/iosxe/show_cts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2215,7 +2215,7 @@ class ShowCtsInterfaceSchema(MetaParser):
"""Schema for show cts interface'"""

schema = {
'global_dot1x_feature': str,
Optional('global_dot1x_feature'): str,
'interfaces': {
Any(): {
'cts': {
Expand Down Expand Up @@ -2282,10 +2282,10 @@ def cli(self, interface=None,output=None):
# TenGigabitEthernet1/0/6:
# Tunnel100:
# TenGigabitEthernet1/0/6.30:
p2 = re.compile(r'^Interface\s+(?P<interface>\S+\d+\/\d+\/\d+|Tunnel\d+|\S+\d+\/\d+\/\d+\.\d+):')
p2 = re.compile(r'^Interface\s+(?P<interface>\S+\d+\/\d+\/\d+|(Tunnel|Port-channel)\d+|\S+\d+\/\d+\/\d+\.\d+):')

# CTS_status : enabled,mode: MANUAL
p3 = re.compile(r'^CTS\s+is\s+(?P<cts_status>\S+),\s+mode:\s+(?P<mode>\S+)')
p3 = re.compile(r'^CTS\s+is\s+(?P<cts_status>\S+)(\.|,\s+mode:\s+(?P<mode>\S+))')

# IFC state: OPEN
p4 = re.compile(r'^IFC state:\s+(?P<ifc_state>\S+)')
Expand Down Expand Up @@ -2381,7 +2381,8 @@ def cli(self, interface=None,output=None):
mode = group['mode']
cts_dict = intf_dict.setdefault('cts', {})
cts_dict['cts_status'] = cts_status
cts_dict['mode'] = mode
if mode:
cts_dict['mode'] = mode

# IFC state: OPEN
m = p4.match(line)
Expand Down
12 changes: 12 additions & 0 deletions src/genie/libs/parser/iosxe/show_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -35322,6 +35322,14 @@ class ShowPlatformSoftwareDistributedIpsecTunnelInfoSchema(MetaParser):
'asic_value': int,
'num_of_tunnel': int,
'platform': str
},
Optional('svti_tunnel'): {
Any(): {
'if_id': str,
'sbad_info': int,
'switch_number': int,
'asic_id': int
}
}
}

Expand All @@ -35345,6 +35353,10 @@ def cli(self, output=None):
# | 2 | 0 | 2 | C9300X |
p2 = re.compile(r'\s+\|\s+(?P<switch_number>-?\d+)\s+\|\s+(?P<asic_value>-?\d+)\s+\|\s+(?P<num_of_tunnel>-?\d+)\s+\|\s+(?P<platform>\S+)\s+\|$')

#| INTERFACE | IF_ID | SADB_ID | SW_NUM | ASIC |
#| Tunnel201 | 0x00000216 | 1 | 1 | 0 |
p3 = re.compile(r'^\s+\|\s+(?P<tunnel_int>Tunnel\d+)\s+\|\s+(?P<if_id>\w+)\s+\|\s+(?P<sbad_info>\d+)\s+\|\s+(?P<switch_number>\d+)\s+\|\s+(?P<asic_id>\d+)\s+\|')

for line in output.splitlines():

m = p1.match(line)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,42 @@
'port_auth_fail': 0
},
'l3_ipm': 'disabled'
},
'Port-channel2': {
'cts': {
'cts_status': 'disabled'
},
'l3_ipm': 'disabled'
},
'Port-channel20': {
'cts': {
'cts_status': 'disabled'
},
'l3_ipm': 'disabled'
},
'Port-channel22': {
'cts': {
'cts_status': 'disabled'
},
'l3_ipm': 'disabled'
},
'Port-channel47': {
'cts': {
'cts_status': 'disabled'
},
'l3_ipm': 'disabled'
},
'Port-channel58': {
'cts': {
'cts_status': 'disabled'
},
'l3_ipm': 'disabled'
},
'Port-channel69': {
'cts': {
'cts_status': 'disabled'
},
'l3_ipm': 'disabled'
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
expected_output={
'interfaces': {
'Port-channel2': {
'cts': {
'cts_status': 'disabled'
},
'l3_ipm': 'disabled'
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Interface Port-channel2:
CTS is disabled.

L3 IPM: disabled.

0 comments on commit 266aeee

Please sign in to comment.