networktocode/ntc-templates

Variable name inconsistency for cisco ios cdp details

Closed this issue · 1 comments

ISSUE TYPE
  • Bug Report
TEMPLATE USING
Value Required DESTINATION_HOST (\S+)
Value MANAGEMENT_IP (\d+\.\d+\.\d+\.\d+|\w+\.\w+\.\w+)
Value PLATFORM (.*)
Value REMOTE_PORT (.*)
Value LOCAL_PORT (.*)
Value SOFTWARE_VERSION (.*$)
Value CAPABILITIES (.+?)

Start
  ^Device ID: ${DESTINATION_HOST}
  ^Entry address\(es\)\s*:\s* -> ParseIP
  ^Platform\s*:\s*${PLATFORM}\s*,\s*Capabilities\s*:\s*${CAPABILITIES}\s+$$
  ^Platform\s*:\s*${PLATFORM}\s*,\s*Capabilities\s*:\s*${CAPABILITIES}$$
  ^Interface: ${LOCAL_PORT},  Port ID \(outgoing port\): ${REMOTE_PORT}
  ^Version : -> GetVersion
  # Capture time-stamp if vty line has command time-stamping turned on
  ^Load\s+for\s+
  ^Time\s+source\s+is

ParseIP
  ^.*IP address: ${MANAGEMENT_IP} -> Start
  ^Platform\s*:\s*${PLATFORM}\s*,\s*Capabilities\s*:\s*${CAPABILITIES}\s+$$ -> Start
  ^Platform\s*:\s*${PLATFORM}\s*,\s*Capabilities\s*:\s*${CAPABILITIES}$$ -> Start
  ^.* -> Start

GetVersion
  ^${SOFTWARE_VERSION} -> Record Start
SAMPLE COMMAND OUTPUT
-------------------------
Device ID: Device-A(SNXXX)
Entry address(es): 
Platform: N3K-C3064PQ-10GX,  Capabilities: Router Switch IGMP CVTA phone port 
Interface: TenGigabitEthernet1/0/2,  Port ID (outgoing port): Ethernet1/15
Holdtime : 175 sec

Version :
Cisco Nexus Operating System (NX-OS) Software, Version 6.0(2)U6(7)

advertisement version: 2
Native VLAN: 1
Duplex: full

-------------------------
SUMMARY
STEPS TO REPRODUCE

The issue is with the variable name DETINATION_HOST. In other Cisco templates, it is named DEST_HOST and I think this should be rectified for consistency. Simarly, MANAGEMENT_IP should be named MGMT_IP.

EXPECTED RESULTS
[
{
    "dest_host":"Device-A(SNXXX)",
    "mgmt_ip":"",
    "platform":"N3K-C3064PQ-10GX",
    "remote_port":"Ethernet1/15",
    "local_port":"TenGigabitEthernet1/0/2",
    "version":"Cisco Nexus Operating System (NX-OS) Software, Version 6.0(2)U6(7)",
    "capabilities":"Router Switch IGMP CVTA phone port"
  },
]
ACTUAL RESULTS
[
{
    "destination_host":"Device-A(SNXXX)",
    "management_ip":"",
    "platform":"N3K-C3064PQ-10GX",
    "remote_port":"Ethernet1/15",
    "local_port":"TenGigabitEthernet1/0/2",
    "software_version":"Cisco Nexus Operating System (NX-OS) Software, Version 6.0(2)U6(7)",
    "capabilities":"Router Switch IGMP CVTA phone port"
  },
]