Skip to content
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

Update interface CDP neighbor discovery - interface and IPv4 address RegEx #508

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ZacharyPuls
Copy link

@ZacharyPuls ZacharyPuls commented Sep 9, 2024

SUMMARY

Update parse_cdp_intf_port and parse_cdp_ip regex - IOS-XR 7.7.21 LNT has a different "show cdp neighbors detail" output format. Namely there is a newline between the "Interface" and "Port ID" segments, and "IP address" is "IPv4 address". So devices running IOS-XR 7.7.21 would not have their CDP neighbors collected. Also replicated on non-LNT IOS-XR 7.4.1.

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

cisco.iosxr: ansible_net_neighbors
plugins/module_utils/network/iosxr/facts/legacy/base.py

ADDITIONAL INFORMATION

Output before change:

{
[...]
    "ansible_net_neighbors": {},
[...]
}

Output after change:

{
[...]
    "ansible_net_neighbors": {
            "HundredGigE0/0/0/31": [
                {
                    "host": "LABASR11",
                    "ip": "10.250.1.29",
                    "platform": "cisco ASR9K",
                    "port": "HundredGigE0/3/0/0"
                }
            ],
            "MgmtEth0/RP0/CPU0/0": [
                {
                    "host": "WICHLABSWI02.kfn.local",
                    "ip": "192.168.100.6",
                    "platform": "cisco WS-C3560V2-24TS-SD",
                    "port": "FastEthernet0/9"
                }
            ],
            "TenGigE0/0/0/22": [
                {
                    "host": "LABASR34.kfn.local",
                    "ip": "10.250.1.102",
                    "platform": "cisco ASR-920-24SZ-M",
                    "port": "TenGigabitEthernet0/0/27"
                }
            ],
            "TenGigE0/0/0/23": [
                {
                    "host": "LABASR33.kfn.local",
                    "ip": "10.250.1.97",
                    "platform": "cisco ASR-920-24SZ-M",
                    "port": "TenGigabitEthernet0/0/27"
                }
            ],
            "TenGigE0/0/0/24": [
                {
                    "host": "LABNCS51",
                    "ip": "10.250.1.38",
                    "platform": "cisco NCS-540",
                    "port": "TenGigE0/0/0/21"
                }
            ],
            "TenGigE0/0/0/25": [
                {
                    "host": "LABASR21.kfn.local",
                    "ip": "10.250.1.41",
                    "platform": "cisco ASR-903",
                    "port": "TenGigabitEthernet0/0/1"
                }
            ],
            "TenGigE0/0/0/26": [
                {
                    "host": "LABASR32.kfn.local",
                    "ip": "10.250.1.26",
                    "platform": "cisco ASR-920-24SZ-M",
                    "port": "TenGigabitEthernet0/0/27"
                }
            ],
            "TenGigE0/0/0/27": [
                {
                    "host": "LABASR31.kfn.local",
                    "ip": "10.250.1.22",
                    "platform": "cisco ASR-920-24SZ-M",
                    "port": "TenGigabitEthernet0/0/27"
                }
            ]
        },
[...]
}

IOS-XR 7.7.21 LNT CDP output:

Mon Sep  9 12:30:43.733 CDT

-------------------------
Device ID: LABASR11
SysName : LABASR11
Entry address(es): 
  IPv4 address: 10.250.1.29
Platform: cisco ASR9K,  Capabilities: Router 
Interface: HundredGigE0/0/0/31
Port ID (outgoing port): HundredGigE0/3/0/0
Holdtime : 152 sec

Version :
 7.9.2

advertisement version: 2
Duplex: full

-------------------------
Device ID: LABASR34.kfn.local
SysName : 
Entry address(es): 
  IPv4 address: 10.250.1.102
Platform: cisco ASR-920-24SZ-M,  Capabilities: Router IGMP  Interface: TenGigE0/0/0/22
Port ID (outgoing port): TenGigabitEthernet0/0/27
Holdtime : 144 sec

Version :
Cisco IOS Software [Bengaluru], ASR920 Software (PPC_LINUX_IOSD-UNIVERSALK9_NPE-M), Version 17.6.3, RELEASE SOFTWARE (fc4) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2022 by Cisco Systems, Inc.
Compiled Wed 30-Mar-22 20:29 by mcpre

advertisement version: 2

-------------------------
[rest of output omitted for brevity]

Update parse_cdp_intf_port and parse_cdp_ip regex - IOS-XR 7.7.21 LNT has a different "show cdp neighbors detail" output format. Namely there is a newline between the "Interface" and "Port ID" segments, and "IP address" is "IPv4 address".

Example output:
RP/0/RP0/CPU0:LABNCS61#show cdp neighbors detail
Mon Sep  9 12:30:43.733 CDT

-------------------------
Device ID: LABASR11
SysName : LABASR11
Entry address(es): 
  IPv4 address: 10.250.1.29
Platform: cisco ASR9K,  Capabilities: Router 
Interface: HundredGigE0/0/0/31
Port ID (outgoing port): HundredGigE0/3/0/0
Holdtime : 152 sec

Version :
 7.9.2

advertisement version: 2
Duplex: full

-------------------------
Device ID: LABASR34.kfn.local
SysName : 
Entry address(es): 
  IPv4 address: 10.250.1.102
Platform: cisco ASR-920-24SZ-M,  Capabilities: Router IGMP 
Interface: TenGigE0/0/0/22
Port ID (outgoing port): TenGigabitEthernet0/0/27
Holdtime : 144 sec

Version :
Cisco IOS Software [Bengaluru], ASR920 Software (PPC_LINUX_IOSD-UNIVERSALK9_NPE-M), Version 17.6.3, RELEASE SOFTWARE (fc4)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2022 by Cisco Systems, Inc.
Compiled Wed 30-Mar-22 20:29 by mcpre

advertisement version: 2

-------------------------
@ZacharyPuls ZacharyPuls changed the title Update base.py Update interface CDP neighbor discovery - interface and IPv4 address RegEx Sep 9, 2024
@Ruchip16 Ruchip16 self-requested a review September 11, 2024 09:38
@Ruchip16
Copy link
Contributor

@ZacharyPuls can you please add unit tests to validate this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants