Skip to content

Commit 266aeee

Browse files
author
Sohan Tirpude
authored
Merge pull request #815 from aj-cruz/aj_fix_show_cts_iosxe
Port-channel Fixes for iosxe ShowCtsInterface parser (iosxe/show_cts)
2 parents df9ca29 + b624452 commit 266aeee

File tree

7 files changed

+110
-33
lines changed

7 files changed

+110
-33
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--------------------------------------------------------------------------------
2+
Fix
3+
--------------------------------------------------------------------------------
4+
* IOSXE
5+
* Modified ShowCtsInterfaceSchema:
6+
* Changed global_dot1x_feature from schema to Optional (not present on port-channel interfaces)
7+
* Changed cts mode value from schema to Optional to (not present when cts status is disabled)
8+
* Modified ShowCtsInterface:
9+
* Updated regex pattern p2 to also match Port-channel interfaces
10+
* Updated regex pattern p3 to also match CTS disabled status
11+
* Added conditional to cts_dict so mode key is not generated if cts is disabled
12+
* Modified golden_output2_expected test data
13+
* Added expected output for Port-channel interfaces
14+
* Added golden_output4 test data & expected results

sdk_generator/outputs/github_parser.json

Lines changed: 29 additions & 29 deletions
Large diffs are not rendered by default.

src/genie/libs/parser/iosxe/show_cts.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,7 +2215,7 @@ class ShowCtsInterfaceSchema(MetaParser):
22152215
"""Schema for show cts interface'"""
22162216

22172217
schema = {
2218-
'global_dot1x_feature': str,
2218+
Optional('global_dot1x_feature'): str,
22192219
'interfaces': {
22202220
Any(): {
22212221
'cts': {
@@ -2282,10 +2282,10 @@ def cli(self, interface=None,output=None):
22822282
# TenGigabitEthernet1/0/6:
22832283
# Tunnel100:
22842284
# TenGigabitEthernet1/0/6.30:
2285-
p2 = re.compile(r'^Interface\s+(?P<interface>\S+\d+\/\d+\/\d+|Tunnel\d+|\S+\d+\/\d+\/\d+\.\d+):')
2285+
p2 = re.compile(r'^Interface\s+(?P<interface>\S+\d+\/\d+\/\d+|(Tunnel|Port-channel)\d+|\S+\d+\/\d+\/\d+\.\d+):')
22862286

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

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

23862387
# IFC state: OPEN
23872388
m = p4.match(line)

src/genie/libs/parser/iosxe/show_platform.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35322,6 +35322,14 @@ class ShowPlatformSoftwareDistributedIpsecTunnelInfoSchema(MetaParser):
3532235322
'asic_value': int,
3532335323
'num_of_tunnel': int,
3532435324
'platform': str
35325+
},
35326+
Optional('svti_tunnel'): {
35327+
Any(): {
35328+
'if_id': str,
35329+
'sbad_info': int,
35330+
'switch_number': int,
35331+
'asic_id': int
35332+
}
3532535333
}
3532635334
}
3532735335

@@ -35345,6 +35353,10 @@ def cli(self, output=None):
3534535353
# | 2 | 0 | 2 | C9300X |
3534635354
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+\|$')
3534735355

35356+
#| INTERFACE | IF_ID | SADB_ID | SW_NUM | ASIC |
35357+
#| Tunnel201 | 0x00000216 | 1 | 1 | 0 |
35358+
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+\|')
35359+
3534835360
for line in output.splitlines():
3534935361

3535035362
m = p1.match(line)

src/genie/libs/parser/iosxe/tests/ShowCtsInterface/cli/equal/golden_output2_expected.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,42 @@
106106
'port_auth_fail': 0
107107
},
108108
'l3_ipm': 'disabled'
109+
},
110+
'Port-channel2': {
111+
'cts': {
112+
'cts_status': 'disabled'
113+
},
114+
'l3_ipm': 'disabled'
115+
},
116+
'Port-channel20': {
117+
'cts': {
118+
'cts_status': 'disabled'
119+
},
120+
'l3_ipm': 'disabled'
121+
},
122+
'Port-channel22': {
123+
'cts': {
124+
'cts_status': 'disabled'
125+
},
126+
'l3_ipm': 'disabled'
127+
},
128+
'Port-channel47': {
129+
'cts': {
130+
'cts_status': 'disabled'
131+
},
132+
'l3_ipm': 'disabled'
133+
},
134+
'Port-channel58': {
135+
'cts': {
136+
'cts_status': 'disabled'
137+
},
138+
'l3_ipm': 'disabled'
139+
},
140+
'Port-channel69': {
141+
'cts': {
142+
'cts_status': 'disabled'
143+
},
144+
'l3_ipm': 'disabled'
109145
}
110146
}
111147
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
expected_output={
2+
'interfaces': {
3+
'Port-channel2': {
4+
'cts': {
5+
'cts_status': 'disabled'
6+
},
7+
'l3_ipm': 'disabled'
8+
}
9+
}
10+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Interface Port-channel2:
2+
CTS is disabled.
3+
4+
L3 IPM: disabled.

0 commit comments

Comments
 (0)