Skip to content

Commit f027cc5

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

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-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)
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)