Skip to content

Commit 80449a5

Browse files
author
AJ Cruz
committed
Port-channel show_cts iosxe fix
1 parent 308388f commit 80449a5

File tree

3 files changed

+54
-4
lines changed

3 files changed

+54
-4
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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

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/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
}

0 commit comments

Comments
 (0)