Skip to content

Adjusts parser for "show ap cdp neighbor" #948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
--------------------------------------------------------------------------------
Fix
--------------------------------------------------------------------------------
* IOSXE
* Modified ShowApCdpNeighbor:
* Updated regex pattern neighbor_info_capture to optionally capture the Neighbors IP if it exists
10 changes: 8 additions & 2 deletions src/genie/libs/parser/iosxe/show_ap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ def cli(self, output=None):
neighbor_count_capture = re.compile(r"^Number\s+of\s+neighbors:\s+(?P<neighbor_count>\d+)$")
# 0221-cap22 10.8.33.106 a02-21-sd-sw1.cisco.com TenGigabitEthernet3/0/47
neighbor_info_capture = re.compile(
r"^(?P<ap_name>\S+)\s+(?P<ap_ip>\d+\.\d+\.\d+\.\d+)\s+(?P<neighbor_name>\S+)\s+(?P<neighbor_port>\S+)$")
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+)$")
# Neighbor IP Count: 1
neighbor_ip_count_capture = re.compile(r"^Neighbor\s+IP\s+Count:\s+(?P<neighbor_ip_count>\d+)$")
# 10.8.32.1
Expand Down Expand Up @@ -1235,6 +1235,12 @@ def cli(self, output=None):
ap_cdp_neighbor_dict['ap_name'][ap_name]['ap_ip'] = ap_ip
ap_cdp_neighbor_dict['ap_name'][ap_name]['neighbor_name'] = neighbor_name
ap_cdp_neighbor_dict['ap_name'][ap_name]['neighbor_port'] = neighbor_port
if groups['neighbor_ip']:
neighbor_ip = groups['neighbor_ip']
if not ap_cdp_neighbor_dict['ap_name'][ap_name].get('neighbor_ip_addresses', {}):
ap_cdp_neighbor_dict['ap_name'][ap_name]['neighbor_ip_addresses'] = []
ap_cdp_neighbor_dict['ap_name'][ap_name]['neighbor_ip_addresses'].append(neighbor_ip)

# Neighbor IP Count: 1
elif neighbor_ip_count_capture.match(line):
neighbor_ip_count_match = neighbor_ip_count_capture.match(line)
Expand Down Expand Up @@ -3198,4 +3204,4 @@ def filter_lines(raw_output, remove_lines):
ap_image_data = {}
continue

return ap_image_dict
return ap_image_dict