Skip to content

Commit 953a894

Browse files
author
Jamie Reid
committed
Adjusts parser for "show ap cdp neighbor"
Resolves #723 Adjust regex to include the ap neighbor IP as it is output on 9800 platform v17.x
1 parent 2864ef4 commit 953a894

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
--------------------------------------------------------------------------------
2+
Fix
3+
--------------------------------------------------------------------------------
4+
* IOSXE
5+
* Modified ShowApCdpNeighbor:
6+
* Updated regex pattern neighbor_info_capture to optionally capture the Neighbors IP if it exists

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ def cli(self, output=None):
12001200
neighbor_count_capture = re.compile(r"^Number\s+of\s+neighbors:\s+(?P<neighbor_count>\d+)$")
12011201
# 0221-cap22 10.8.33.106 a02-21-sd-sw1.cisco.com TenGigabitEthernet3/0/47
12021202
neighbor_info_capture = re.compile(
1203-
r"^(?P<ap_name>\S+)\s+(?P<ap_ip>\d+\.\d+\.\d+\.\d+)\s+(?P<neighbor_name>\S+)\s+(?P<neighbor_port>\S+)$")
1203+
r"^(?P<ap_name>\S+)\s+(?P<ap_ip>\d+\.\d+\.\d+\.\d+)\s+(?P<neighbor_name>\S+)\s+((?P<neighbor_ip>\S+))?\s+(?P<neighbor_port>\S+)$")
12041204
# Neighbor IP Count: 1
12051205
neighbor_ip_count_capture = re.compile(r"^Neighbor\s+IP\s+Count:\s+(?P<neighbor_ip_count>\d+)$")
12061206
# 10.8.32.1
@@ -1235,6 +1235,12 @@ def cli(self, output=None):
12351235
ap_cdp_neighbor_dict['ap_name'][ap_name]['ap_ip'] = ap_ip
12361236
ap_cdp_neighbor_dict['ap_name'][ap_name]['neighbor_name'] = neighbor_name
12371237
ap_cdp_neighbor_dict['ap_name'][ap_name]['neighbor_port'] = neighbor_port
1238+
if groups['neighbor_ip']:
1239+
neighbor_ip = groups['neighbor_ip']
1240+
if not ap_cdp_neighbor_dict['ap_name'][ap_name].get('neighbor_ip_addresses', {}):
1241+
ap_cdp_neighbor_dict['ap_name'][ap_name]['neighbor_ip_addresses'] = []
1242+
ap_cdp_neighbor_dict['ap_name'][ap_name]['neighbor_ip_addresses'].append(neighbor_ip)
1243+
12381244
# Neighbor IP Count: 1
12391245
elif neighbor_ip_count_capture.match(line):
12401246
neighbor_ip_count_match = neighbor_ip_count_capture.match(line)
@@ -3198,4 +3204,4 @@ def filter_lines(raw_output, remove_lines):
31983204
ap_image_data = {}
31993205
continue
32003206

3201-
return ap_image_dict
3207+
return ap_image_dict

0 commit comments

Comments
 (0)