diff --git a/napalm/ios/ios.py b/napalm/ios/ios.py index 6bbdc8299..00f52d4da 100644 --- a/napalm/ios/ios.py +++ b/napalm/ios/ios.py @@ -876,11 +876,13 @@ def get_lldp_neighbors(self): lldp[intf_name] = [] for lldp_entry in entries: hostname = lldp_entry["remote_system_name"] + port = lldp_entry["remote_port"] # Match IOS behaviour of taking remote chassis ID # When lacking a system name (in show lldp neighbors) if not hostname: - hostname = lldp_entry["remote_chassis_id"] - lldp_dict = {"port": lldp_entry["remote_port"], "hostname": hostname} + hostname = napalm.base.helpers.mac(lldp_entry["remote_chassis_id"]) + port = napalm.base.helpers.mac(port) + lldp_dict = {"port": port, "hostname": hostname} lldp[intf_name].append(lldp_dict) return lldp @@ -901,6 +903,14 @@ def get_lldp_neighbors_detail(self, interface=""): if len(lldp_entries) == 0: return {} + # format chassis_id for consistency + for entry in lldp_entries: + entry["remote_chassis_id"] = napalm.base.helpers.convert( + napalm.base.helpers.mac, + entry["remote_chassis_id"], + entry["remote_chassis_id"], + ) + # Older IOS versions don't have 'Local Intf' defined in LLDP detail. # We need to get them from the non-detailed command # which is in the same sequence as the detailed output @@ -1203,6 +1213,7 @@ def get_interfaces_ip(self): m = re.match(INTERNET_ADDRESS, line) if m: ip, prefix = m.groups() + ip = napalm.base.helpers.ip(ip) ipv4.update({ip: {"prefix_length": int(prefix)}}) interfaces[interface_name] = {"ipv4": ipv4} @@ -1220,10 +1231,12 @@ def get_interfaces_ip(self): m = re.match(LINK_LOCAL_ADDRESS, line) if m: ip = m.group(1) + ip = napalm.base.helpers.ip(ip, 6) ipv6.update({ip: {"prefix_length": 10}}) m = re.match(GLOBAL_ADDRESS, line) if m: ip, prefix = m.groups() + ip = napalm.base.helpers.ip(ip, 6) ipv6.update({ip: {"prefix_length": int(prefix)}}) # Interface without ipv6 doesn't appears in show ipv6 interface @@ -2383,7 +2396,7 @@ def get_ntp_peers(self): ntp_stats = self.get_ntp_stats() return { - ntp_peer.get("remote"): {} + napalm.base.helpers.ip(ntp_peer.get("remote")): {} for ntp_peer in ntp_stats if ntp_peer.get("remote") } @@ -3251,7 +3264,10 @@ def ping( results_array = [] for i in range(probes_received): results_array.append( - {"ip_address": str(destination), "rtt": 0.0} + { + "ip_address": napalm.base.helpers.ip(str(destination)), + "rtt": 0.0, + } ) ping_dict["success"].update({"results": results_array}) @@ -3374,7 +3390,7 @@ def traceroute( current_probe += 1 # If current_element contains msec record the entry for probe elif "msec" in current_element: - ip_address = str(ip_address) + ip_address = napalm.base.helpers.ip(str(ip_address)) host_name = str(host_name) rtt = float(current_element.replace("msec", "")) results[current_hop]["probes"][current_probe][ diff --git a/test/ios/mocked_data/test_get_interfaces_ip/normal/expected_result.json b/test/ios/mocked_data/test_get_interfaces_ip/normal/expected_result.json index b1cf7ccae..4d6dbba3c 100644 --- a/test/ios/mocked_data/test_get_interfaces_ip/normal/expected_result.json +++ b/test/ios/mocked_data/test_get_interfaces_ip/normal/expected_result.json @@ -1,34 +1,40 @@ { - "Vlan20": { - "ipv4": { - "172.29.50.3": { - "prefix_length": 27 - } - }, - "ipv6": { - "FE80::C009:24FF:FEAC:0": { - "prefix_length": 10 - }, - "2002::1": { - "prefix_length": 64 - } - } - }, - "Vlan41": { - "ipv4": { - "172.29.52.34": { - "prefix_length": 27 - }, - "192.168.81.34": { - "prefix_length": 24 - } - } - }, - "Loopback0": { - "ipv6": { - "FE80::C009:24FF:FEAC:0": {"prefix_length": 10}, - "2001::1": {"prefix_length": 128}, - "2001::2": {"prefix_length": 128} - } - } + "Vlan20": { + "ipv4": { + "172.29.50.3": { + "prefix_length": 27 + } + }, + "ipv6": { + "fe80::c009:24ff:feac:0": { + "prefix_length": 10 + }, + "2002::1": { + "prefix_length": 64 + } + } + }, + "Vlan41": { + "ipv4": { + "172.29.52.34": { + "prefix_length": 27 + }, + "192.168.81.34": { + "prefix_length": 24 + } + } + }, + "Loopback0": { + "ipv6": { + "fe80::c009:24ff:feac:0": { + "prefix_length": 10 + }, + "2001::1": { + "prefix_length": 128 + }, + "2001::2": { + "prefix_length": 128 + } + } + } } diff --git a/test/ios/mocked_data/test_get_lldp_neighbors/missing_hostname/expected_result.json b/test/ios/mocked_data/test_get_lldp_neighbors/missing_hostname/expected_result.json index b82010b7c..b229b8671 100644 --- a/test/ios/mocked_data/test_get_lldp_neighbors/missing_hostname/expected_result.json +++ b/test/ios/mocked_data/test_get_lldp_neighbors/missing_hostname/expected_result.json @@ -1,14 +1,14 @@ { - "FastEthernet0/24": [ - { - "port": "Fa0/19", - "hostname": "switch1" - } - ], - "FastEthernet0/17": [ - { - "port": "480f.cf28.8a1b", - "hostname": "480f.cf28.8a1b" - } - ] + "FastEthernet0/24": [ + { + "port": "Fa0/19", + "hostname": "switch1" + } + ], + "FastEthernet0/17": [ + { + "port": "48:0F:CF:28:8A:1B", + "hostname": "48:0F:CF:28:8A:1B" + } + ] } diff --git a/test/ios/mocked_data/test_get_lldp_neighbors_detail/alternate/expected_result.json b/test/ios/mocked_data/test_get_lldp_neighbors_detail/alternate/expected_result.json index 7606d18be..cc13d84d8 100644 --- a/test/ios/mocked_data/test_get_lldp_neighbors_detail/alternate/expected_result.json +++ b/test/ios/mocked_data/test_get_lldp_neighbors_detail/alternate/expected_result.json @@ -1,24 +1,24 @@ { - "GigabitEthernet1": [ - { - "parent_interface": "", - "remote_chassis_id": "2cc2.603e.363b", - "remote_port": "Management1", - "remote_port_description": "", - "remote_system_capab": ["bridge", "router"], - "remote_system_description": "Arista Networks EOS version 4.15.2F running on an Arista Networks vEOS", - "remote_system_enable_capab": ["bridge", "router"], - "remote_system_name": "eos-spine1.ntc.com" - }, - { - "parent_interface": "", - "remote_chassis_id": "0005.8671.58c0", - "remote_port": "fxp0", - "remote_port_description": "fxp0", - "remote_system_capab": ["bridge", "router"], - "remote_system_description": "Juniper Networks, Inc. vmx internet router, kernel JUNOS 15.1F4.15, Build date: 2015-12-23 19:22:55 UTC Copyright (c) 1996-2015 Juniper Networks, Inc.", - "remote_system_enable_capab": ["bridge", "router"], - "remote_system_name": "vmx1" - } - ] + "GigabitEthernet1": [ + { + "parent_interface": "", + "remote_chassis_id": "2C:C2:60:3E:36:3B", + "remote_port": "Management1", + "remote_port_description": "", + "remote_system_capab": ["bridge", "router"], + "remote_system_description": "Arista Networks EOS version 4.15.2F running on an Arista Networks vEOS", + "remote_system_enable_capab": ["bridge", "router"], + "remote_system_name": "eos-spine1.ntc.com" + }, + { + "parent_interface": "", + "remote_chassis_id": "00:05:86:71:58:C0", + "remote_port": "fxp0", + "remote_port_description": "fxp0", + "remote_system_capab": ["bridge", "router"], + "remote_system_description": "Juniper Networks, Inc. vmx internet router, kernel JUNOS 15.1F4.15, Build date: 2015-12-23 19:22:55 UTC Copyright (c) 1996-2015 Juniper Networks, Inc.", + "remote_system_enable_capab": ["bridge", "router"], + "remote_system_name": "vmx1" + } + ] } diff --git a/test/ios/mocked_data/test_get_lldp_neighbors_detail/alternate2/expected_result.json b/test/ios/mocked_data/test_get_lldp_neighbors_detail/alternate2/expected_result.json index 26bb0f986..310c73d87 100644 --- a/test/ios/mocked_data/test_get_lldp_neighbors_detail/alternate2/expected_result.json +++ b/test/ios/mocked_data/test_get_lldp_neighbors_detail/alternate2/expected_result.json @@ -1,26 +1,26 @@ { - "FastEthernet0/24": [ - { - "parent_interface": "", - "remote_chassis_id": "a40c.c3c1.3980", - "remote_port": "Fa0/19", - "remote_port_description": "FastEthernet0/19", - "remote_system_capab": ["bridge"], - "remote_system_description": "Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 15.0(1)SE2, RELEASE SOFTWARE (fc3)", - "remote_system_enable_capab": ["bridge"], - "remote_system_name": "switch1" - } - ], - "FastEthernet0/17": [ - { - "parent_interface": "", - "remote_chassis_id": "480f.cf28.8a1b", - "remote_port": "480f.cf28.8a1b", - "remote_port_description": "", - "remote_system_capab": [], - "remote_system_description": "", - "remote_system_enable_capab": [], - "remote_system_name": "" - } - ] + "FastEthernet0/24": [ + { + "parent_interface": "", + "remote_chassis_id": "A4:0C:C3:C1:39:80", + "remote_port": "Fa0/19", + "remote_port_description": "FastEthernet0/19", + "remote_system_capab": ["bridge"], + "remote_system_description": "Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 15.0(1)SE2, RELEASE SOFTWARE (fc3)", + "remote_system_enable_capab": ["bridge"], + "remote_system_name": "switch1" + } + ], + "FastEthernet0/17": [ + { + "parent_interface": "", + "remote_chassis_id": "48:0F:CF:28:8A:1B", + "remote_port": "480f.cf28.8a1b", + "remote_port_description": "", + "remote_system_capab": [], + "remote_system_description": "", + "remote_system_enable_capab": [], + "remote_system_name": "" + } + ] } diff --git a/test/ios/mocked_data/test_get_lldp_neighbors_detail/alternate4/expected_result.json b/test/ios/mocked_data/test_get_lldp_neighbors_detail/alternate4/expected_result.json index 6093b9ef0..b2a265195 100644 --- a/test/ios/mocked_data/test_get_lldp_neighbors_detail/alternate4/expected_result.json +++ b/test/ios/mocked_data/test_get_lldp_neighbors_detail/alternate4/expected_result.json @@ -1,58 +1,58 @@ { - "GigabitEthernet1": [ - { - "parent_interface": "", - "remote_port": "Gi1", - "remote_port_description": "GigabitEthernet1", - "remote_chassis_id": "001e.bd3a.f900", - "remote_system_name": "csr9.bogus.com", - "remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", - "remote_system_capab": ["bridge", "router"], - "remote_system_enable_capab": ["router"] - }, - { - "parent_interface": "", - "remote_port": "Gi1", - "remote_port_description": "GigabitEthernet1", - "remote_chassis_id": "001e.bd60.ee00", - "remote_system_name": "csr8.bogus.com", - "remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", - "remote_system_capab": ["bridge", "router"], - "remote_system_enable_capab": ["router"] - }, - { - "parent_interface": "", - "remote_port": "Gi1", - "remote_port_description": "GigabitEthernet1", - "remote_chassis_id": "001e.e507.ed00", - "remote_system_name": "csr12.bogus.com", - "remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", - "remote_system_capab": ["bridge", "router"], - "remote_system_enable_capab": ["router"] - } - ], - "GigabitEthernet2": [ - { - "parent_interface": "", - "remote_port": "Gi2", - "remote_port_description": "GigabitEthernet2", - "remote_chassis_id": "001e.bd3a.f900", - "remote_system_name": "csr9.bogus.com", - "remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", - "remote_system_capab": ["bridge", "router"], - "remote_system_enable_capab": ["router"] - } - ], - "GigabitEthernet4": [ - { - "parent_interface": "", - "remote_port": "Gi4", - "remote_port_description": "GigabitEthernet4", - "remote_chassis_id": "001e.bd60.ee00", - "remote_system_name": "csr8.bogus.com", - "remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", - "remote_system_capab": ["bridge", "router"], - "remote_system_enable_capab": ["router"] - } - ] + "GigabitEthernet1": [ + { + "parent_interface": "", + "remote_port": "Gi1", + "remote_port_description": "GigabitEthernet1", + "remote_chassis_id": "00:1E:BD:3A:F9:00", + "remote_system_name": "csr9.bogus.com", + "remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", + "remote_system_capab": ["bridge", "router"], + "remote_system_enable_capab": ["router"] + }, + { + "parent_interface": "", + "remote_port": "Gi1", + "remote_port_description": "GigabitEthernet1", + "remote_chassis_id": "00:1E:BD:60:EE:00", + "remote_system_name": "csr8.bogus.com", + "remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", + "remote_system_capab": ["bridge", "router"], + "remote_system_enable_capab": ["router"] + }, + { + "parent_interface": "", + "remote_port": "Gi1", + "remote_port_description": "GigabitEthernet1", + "remote_chassis_id": "00:1E:E5:07:ED:00", + "remote_system_name": "csr12.bogus.com", + "remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", + "remote_system_capab": ["bridge", "router"], + "remote_system_enable_capab": ["router"] + } + ], + "GigabitEthernet2": [ + { + "parent_interface": "", + "remote_port": "Gi2", + "remote_port_description": "GigabitEthernet2", + "remote_chassis_id": "00:1E:BD:3A:F9:00", + "remote_system_name": "csr9.bogus.com", + "remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", + "remote_system_capab": ["bridge", "router"], + "remote_system_enable_capab": ["router"] + } + ], + "GigabitEthernet4": [ + { + "parent_interface": "", + "remote_port": "Gi4", + "remote_port_description": "GigabitEthernet4", + "remote_chassis_id": "00:1E:BD:60:EE:00", + "remote_system_name": "csr8.bogus.com", + "remote_system_description": "Cisco IOS Software [Denali], CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.3.1, RELEASE SOFTWARE (fc3)", + "remote_system_capab": ["bridge", "router"], + "remote_system_enable_capab": ["router"] + } + ] } diff --git a/test/ios/mocked_data/test_get_lldp_neighbors_detail/device_id_20chars/expected_result.json b/test/ios/mocked_data/test_get_lldp_neighbors_detail/device_id_20chars/expected_result.json index e3be9181a..1e4d13a9a 100644 --- a/test/ios/mocked_data/test_get_lldp_neighbors_detail/device_id_20chars/expected_result.json +++ b/test/ios/mocked_data/test_get_lldp_neighbors_detail/device_id_20chars/expected_result.json @@ -1,84 +1,84 @@ { - "GigabitEthernet1": [ - { - "parent_interface": "", - "remote_chassis_id": "0102.e2ff.fdb0", - "remote_port": "Te2/1/14", - "remote_port_description": "ABCD-U1AC04-SW1", - "remote_system_capab": ["bridge", "router"], - "remote_system_description": "Cisco IOS Software, IOS-XE Software, Catalyst 4500 L3 Switch Software (cat4500e-UNIVERSALK9-M), Version 03.06.05.E RELEASE SOFTWARE (fc2)", - "remote_system_enable_capab": ["bridge"], - "remote_system_name": "ABCD-U-DSW1.wan.acme.com" - }, - { - "parent_interface": "", - "remote_chassis_id": "0102.e2ff.fdb0", - "remote_port": "Te1/1/14", - "remote_port_description": "ABCD-U1AC04-SW1", - "remote_system_capab": ["bridge", "router"], - "remote_system_description": "Cisco IOS Software, IOS-XE Software, Catalyst 4500 L3 Switch Software (cat4500e-UNIVERSALK9-M), Version 03.06.05.E RELEASE SOFTWARE (fc2)", - "remote_system_enable_capab": ["bridge"], - "remote_system_name": "ABCD-U-DSW1.wan.acme.com" - }, - { - "parent_interface": "", - "remote_chassis_id": "hmbbkku-la", - "remote_port": "port-001", - "remote_port_description": "", - "remote_system_capab": ["station"], - "remote_system_description": "Hewlett-Packard HP ProBook 650 G1,A3112DD10303,5CG4543H13 + engineering", - "remote_system_enable_capab": ["station"], - "remote_system_name": "HMBBKKU-LA" - }, - { - "parent_interface": "", - "remote_chassis_id": "jniceel-la", - "remote_port": "port-001", - "remote_port_description": "", - "remote_system_capab": ["station"], - "remote_system_description": "HP HP ProBook 650 G2,,5CG64565JFL + engineering", - "remote_system_enable_capab": ["station"], - "remote_system_name": "JNICEEL-LA" - }, - { - "parent_interface": "", - "remote_chassis_id": "swaaaer-lta", - "remote_port": "port-001", - "remote_port_description": "", - "remote_system_capab": ["station"], - "remote_system_description": "Hewlett-Packard HP ProBook 6570b,A10112D102,5CB40117ZP + engineering", - "remote_system_enable_capab": ["station"], - "remote_system_name": "SWAAAER-LTA" - }, - { - "parent_interface": "", - "remote_chassis_id": "rberrrann-lta", - "remote_port": "port-001", - "remote_port_description": "", - "remote_system_capab": ["station"], - "remote_system_description": "Hewlett-Packard HP ProBook 650 G1,A3112DD11203,CNU444BMZ0 + engineering", - "remote_system_enable_capab": ["station"], - "remote_system_name": "RBERRRANN-LTA" - }, - { - "parent_interface": "", - "remote_chassis_id": "cr-443-2", - "remote_port": "port-001", - "remote_port_description": "Siemens, SIMATIC NET, CP 343-1, 6GK7 443-1EX50-0XE0 , HW: 7, FW: V3.0.23, Ethernet Port, X1 P1", - "remote_system_capab": ["station"], - "remote_system_description": "Siemens, SIMATIC NET, CP 443-1, 6GK7 443-1EX50-0XE0, HW: Version 7, FW: Version V3.0.23, VPH6201262", - "remote_system_enable_capab": ["station"], - "remote_system_name": "" - }, - { - "parent_interface": "", - "remote_port": "30e4.db01.2345", - "remote_port_description": "Port 1", - "remote_chassis_id": "192.168.2.44", - "remote_system_name": "Cisco IP Phone SPA504G", - "remote_system_description": "", - "remote_system_capab": ["bridge", "telephone"], - "remote_system_enable_capab": ["bridge", "telephone"] - } - ] + "GigabitEthernet1": [ + { + "parent_interface": "", + "remote_chassis_id": "01:02:E2:FF:FD:B0", + "remote_port": "Te2/1/14", + "remote_port_description": "ABCD-U1AC04-SW1", + "remote_system_capab": ["bridge", "router"], + "remote_system_description": "Cisco IOS Software, IOS-XE Software, Catalyst 4500 L3 Switch Software (cat4500e-UNIVERSALK9-M), Version 03.06.05.E RELEASE SOFTWARE (fc2)", + "remote_system_enable_capab": ["bridge"], + "remote_system_name": "ABCD-U-DSW1.wan.acme.com" + }, + { + "parent_interface": "", + "remote_chassis_id": "01:02:E2:FF:FD:B0", + "remote_port": "Te1/1/14", + "remote_port_description": "ABCD-U1AC04-SW1", + "remote_system_capab": ["bridge", "router"], + "remote_system_description": "Cisco IOS Software, IOS-XE Software, Catalyst 4500 L3 Switch Software (cat4500e-UNIVERSALK9-M), Version 03.06.05.E RELEASE SOFTWARE (fc2)", + "remote_system_enable_capab": ["bridge"], + "remote_system_name": "ABCD-U-DSW1.wan.acme.com" + }, + { + "parent_interface": "", + "remote_chassis_id": "hmbbkku-la", + "remote_port": "port-001", + "remote_port_description": "", + "remote_system_capab": ["station"], + "remote_system_description": "Hewlett-Packard HP ProBook 650 G1,A3112DD10303,5CG4543H13 + engineering", + "remote_system_enable_capab": ["station"], + "remote_system_name": "HMBBKKU-LA" + }, + { + "parent_interface": "", + "remote_chassis_id": "jniceel-la", + "remote_port": "port-001", + "remote_port_description": "", + "remote_system_capab": ["station"], + "remote_system_description": "HP HP ProBook 650 G2,,5CG64565JFL + engineering", + "remote_system_enable_capab": ["station"], + "remote_system_name": "JNICEEL-LA" + }, + { + "parent_interface": "", + "remote_chassis_id": "swaaaer-lta", + "remote_port": "port-001", + "remote_port_description": "", + "remote_system_capab": ["station"], + "remote_system_description": "Hewlett-Packard HP ProBook 6570b,A10112D102,5CB40117ZP + engineering", + "remote_system_enable_capab": ["station"], + "remote_system_name": "SWAAAER-LTA" + }, + { + "parent_interface": "", + "remote_chassis_id": "rberrrann-lta", + "remote_port": "port-001", + "remote_port_description": "", + "remote_system_capab": ["station"], + "remote_system_description": "Hewlett-Packard HP ProBook 650 G1,A3112DD11203,CNU444BMZ0 + engineering", + "remote_system_enable_capab": ["station"], + "remote_system_name": "RBERRRANN-LTA" + }, + { + "parent_interface": "", + "remote_chassis_id": "cr-443-2", + "remote_port": "port-001", + "remote_port_description": "Siemens, SIMATIC NET, CP 343-1, 6GK7 443-1EX50-0XE0 , HW: 7, FW: V3.0.23, Ethernet Port, X1 P1", + "remote_system_capab": ["station"], + "remote_system_description": "Siemens, SIMATIC NET, CP 443-1, 6GK7 443-1EX50-0XE0, HW: Version 7, FW: Version V3.0.23, VPH6201262", + "remote_system_enable_capab": ["station"], + "remote_system_name": "" + }, + { + "parent_interface": "", + "remote_port": "30e4.db01.2345", + "remote_port_description": "Port 1", + "remote_chassis_id": "192.168.2.44", + "remote_system_name": "Cisco IP Phone SPA504G", + "remote_system_description": "", + "remote_system_capab": ["bridge", "telephone"], + "remote_system_enable_capab": ["bridge", "telephone"] + } + ] } diff --git a/test/ios/mocked_data/test_get_lldp_neighbors_detail/device_id_20chars_space/expected_result.json b/test/ios/mocked_data/test_get_lldp_neighbors_detail/device_id_20chars_space/expected_result.json index a6ecb0dd8..14bea13ab 100644 --- a/test/ios/mocked_data/test_get_lldp_neighbors_detail/device_id_20chars_space/expected_result.json +++ b/test/ios/mocked_data/test_get_lldp_neighbors_detail/device_id_20chars_space/expected_result.json @@ -1,84 +1,84 @@ { - "GigabitEthernet1": [ - { - "parent_interface": "", - "remote_chassis_id": "0102.e2ff.fdb0", - "remote_port": "Te2/1/14", - "remote_port_description": "ABCD-U1AC04-SW1", - "remote_system_capab": ["bridge", "router"], - "remote_system_description": "Cisco IOS Software, IOS-XE Software, Catalyst 4500 L3 Switch Software (cat4500e-UNIVERSALK9-M), Version 03.06.05.E RELEASE SOFTWARE (fc2)", - "remote_system_enable_capab": ["bridge"], - "remote_system_name": "ABCD-U-DSW1.wan.acme.com" - }, - { - "parent_interface": "", - "remote_chassis_id": "0102.e2ff.fdb0", - "remote_port": "Te1/1/14", - "remote_port_description": "ABCD-U1AC04-SW1", - "remote_system_capab": ["bridge", "router"], - "remote_system_description": "Cisco IOS Software, IOS-XE Software, Catalyst 4500 L3 Switch Software (cat4500e-UNIVERSALK9-M), Version 03.06.05.E RELEASE SOFTWARE (fc2)", - "remote_system_enable_capab": ["bridge"], - "remote_system_name": "ABCD-U-DSW1.wan.acme.com" - }, - { - "parent_interface": "", - "remote_chassis_id": "hmbbkku-la", - "remote_port": "port-001", - "remote_port_description": "", - "remote_system_capab": ["station"], - "remote_system_description": "Hewlett-Packard HP ProBook 650 G1,A3112DD10303,5CG4543H13 + engineering", - "remote_system_enable_capab": ["station"], - "remote_system_name": "HMBBKKU-LA" - }, - { - "parent_interface": "", - "remote_chassis_id": "jniceel-la", - "remote_port": "port-001", - "remote_port_description": "", - "remote_system_capab": ["station"], - "remote_system_description": "HP HP ProBook 650 G2,,5CG64565JFL + engineering", - "remote_system_enable_capab": ["station"], - "remote_system_name": "JNICEEL-LA" - }, - { - "parent_interface": "", - "remote_chassis_id": "swaaaer-lta", - "remote_port": "port-001", - "remote_port_description": "", - "remote_system_capab": ["station"], - "remote_system_description": "Hewlett-Packard HP ProBook 6570b,A10112D102,5CB40117ZP + engineering", - "remote_system_enable_capab": ["station"], - "remote_system_name": "SWAAAER-LTA" - }, - { - "parent_interface": "", - "remote_chassis_id": "rberrrann-lta", - "remote_port": "port-001", - "remote_port_description": "", - "remote_system_capab": ["station"], - "remote_system_description": "Hewlett-Packard HP ProBook 650 G1,A3112DD11203,CNU444BMZ0 + engineering", - "remote_system_enable_capab": ["station"], - "remote_system_name": "RBERRRANN-LTA" - }, - { - "parent_interface": "", - "remote_chassis_id": "cr-443-2", - "remote_port": "port-001", - "remote_port_description": "Siemens, SIMATIC NET, CP 343-1, 6GK7 443-1EX50-0XE0 , HW: 7, FW: V3.0.23, Ethernet Port, X1 P1", - "remote_system_capab": ["station"], - "remote_system_description": "Siemens, SIMATIC NET, CP 443-1, 6GK7 443-1EX50-0XE0, HW: Version 7, FW: Version V3.0.23, VPH6201262", - "remote_system_enable_capab": ["station"], - "remote_system_name": "" - }, - { - "parent_interface": "", - "remote_port": "30e4.db01.2345", - "remote_port_description": "Port 1", - "remote_chassis_id": "192.168.2.44", - "remote_system_name": "Cisco IP Phone SPA5 4G", - "remote_system_description": "", - "remote_system_capab": ["bridge", "telephone"], - "remote_system_enable_capab": ["bridge", "telephone"] - } - ] + "GigabitEthernet1": [ + { + "parent_interface": "", + "remote_chassis_id": "01:02:E2:FF:FD:B0", + "remote_port": "Te2/1/14", + "remote_port_description": "ABCD-U1AC04-SW1", + "remote_system_capab": ["bridge", "router"], + "remote_system_description": "Cisco IOS Software, IOS-XE Software, Catalyst 4500 L3 Switch Software (cat4500e-UNIVERSALK9-M), Version 03.06.05.E RELEASE SOFTWARE (fc2)", + "remote_system_enable_capab": ["bridge"], + "remote_system_name": "ABCD-U-DSW1.wan.acme.com" + }, + { + "parent_interface": "", + "remote_chassis_id": "01:02:E2:FF:FD:B0", + "remote_port": "Te1/1/14", + "remote_port_description": "ABCD-U1AC04-SW1", + "remote_system_capab": ["bridge", "router"], + "remote_system_description": "Cisco IOS Software, IOS-XE Software, Catalyst 4500 L3 Switch Software (cat4500e-UNIVERSALK9-M), Version 03.06.05.E RELEASE SOFTWARE (fc2)", + "remote_system_enable_capab": ["bridge"], + "remote_system_name": "ABCD-U-DSW1.wan.acme.com" + }, + { + "parent_interface": "", + "remote_chassis_id": "hmbbkku-la", + "remote_port": "port-001", + "remote_port_description": "", + "remote_system_capab": ["station"], + "remote_system_description": "Hewlett-Packard HP ProBook 650 G1,A3112DD10303,5CG4543H13 + engineering", + "remote_system_enable_capab": ["station"], + "remote_system_name": "HMBBKKU-LA" + }, + { + "parent_interface": "", + "remote_chassis_id": "jniceel-la", + "remote_port": "port-001", + "remote_port_description": "", + "remote_system_capab": ["station"], + "remote_system_description": "HP HP ProBook 650 G2,,5CG64565JFL + engineering", + "remote_system_enable_capab": ["station"], + "remote_system_name": "JNICEEL-LA" + }, + { + "parent_interface": "", + "remote_chassis_id": "swaaaer-lta", + "remote_port": "port-001", + "remote_port_description": "", + "remote_system_capab": ["station"], + "remote_system_description": "Hewlett-Packard HP ProBook 6570b,A10112D102,5CB40117ZP + engineering", + "remote_system_enable_capab": ["station"], + "remote_system_name": "SWAAAER-LTA" + }, + { + "parent_interface": "", + "remote_chassis_id": "rberrrann-lta", + "remote_port": "port-001", + "remote_port_description": "", + "remote_system_capab": ["station"], + "remote_system_description": "Hewlett-Packard HP ProBook 650 G1,A3112DD11203,CNU444BMZ0 + engineering", + "remote_system_enable_capab": ["station"], + "remote_system_name": "RBERRRANN-LTA" + }, + { + "parent_interface": "", + "remote_chassis_id": "cr-443-2", + "remote_port": "port-001", + "remote_port_description": "Siemens, SIMATIC NET, CP 343-1, 6GK7 443-1EX50-0XE0 , HW: 7, FW: V3.0.23, Ethernet Port, X1 P1", + "remote_system_capab": ["station"], + "remote_system_description": "Siemens, SIMATIC NET, CP 443-1, 6GK7 443-1EX50-0XE0, HW: Version 7, FW: Version V3.0.23, VPH6201262", + "remote_system_enable_capab": ["station"], + "remote_system_name": "" + }, + { + "parent_interface": "", + "remote_port": "30e4.db01.2345", + "remote_port_description": "Port 1", + "remote_chassis_id": "192.168.2.44", + "remote_system_name": "Cisco IP Phone SPA5 4G", + "remote_system_description": "", + "remote_system_capab": ["bridge", "telephone"], + "remote_system_enable_capab": ["bridge", "telephone"] + } + ] } diff --git a/test/ios/mocked_data/test_get_lldp_neighbors_detail/missing_capability/expected_result.json b/test/ios/mocked_data/test_get_lldp_neighbors_detail/missing_capability/expected_result.json index 35a02e8b3..0d3b5a4bd 100644 --- a/test/ios/mocked_data/test_get_lldp_neighbors_detail/missing_capability/expected_result.json +++ b/test/ios/mocked_data/test_get_lldp_neighbors_detail/missing_capability/expected_result.json @@ -1,24 +1,24 @@ { - "GigabitEthernet1": [ - { - "parent_interface": "", - "remote_chassis_id": "00ae.3b11.1d00", - "remote_port": "Gi2/0", - "remote_port_description": "GigabitEthernet2/0", - "remote_system_capab": ["bridge", "router"], - "remote_system_description": "Cisco IOS Software, vios_l2 Software (vios_l2-ADVENTERPRISEK9-M), Version 15.2(4.0.55)E, TEST ENGINEERING ESTG_WEEKLY BUILD, synced to END_OF_FLO_ISP", - "remote_system_enable_capab": ["router"], - "remote_system_name": "SW2.cisco.com" - }, - { - "parent_interface": "", - "remote_chassis_id": "0050.56c0.0001", - "remote_port": "0050.56c0.0001", - "remote_port_description": "", - "remote_system_capab": [], - "remote_system_description": "", - "remote_system_enable_capab": [], - "remote_system_name": "" - } - ] + "GigabitEthernet1": [ + { + "parent_interface": "", + "remote_chassis_id": "00:AE:3B:11:1D:00", + "remote_port": "Gi2/0", + "remote_port_description": "GigabitEthernet2/0", + "remote_system_capab": ["bridge", "router"], + "remote_system_description": "Cisco IOS Software, vios_l2 Software (vios_l2-ADVENTERPRISEK9-M), Version 15.2(4.0.55)E, TEST ENGINEERING ESTG_WEEKLY BUILD, synced to END_OF_FLO_ISP", + "remote_system_enable_capab": ["router"], + "remote_system_name": "SW2.cisco.com" + }, + { + "parent_interface": "", + "remote_chassis_id": "00:50:56:C0:00:01", + "remote_port": "0050.56c0.0001", + "remote_port_description": "", + "remote_system_capab": [], + "remote_system_description": "", + "remote_system_enable_capab": [], + "remote_system_name": "" + } + ] } diff --git a/test/ios/mocked_data/test_get_lldp_neighbors_detail/normal/expected_result.json b/test/ios/mocked_data/test_get_lldp_neighbors_detail/normal/expected_result.json index 9bf0aa488..8b2d8721c 100644 --- a/test/ios/mocked_data/test_get_lldp_neighbors_detail/normal/expected_result.json +++ b/test/ios/mocked_data/test_get_lldp_neighbors_detail/normal/expected_result.json @@ -1,12 +1,14 @@ { - "FastEthernet4": [{ - "parent_interface": "", - "remote_system_capab": ["bridge"], - "remote_system_description": "ProCurve J9019A Switch 2510-24, revision Q.10.01, ROM Q.10.02 (/sw/code/build/harp(harp))", - "remote_port": "15", - "remote_chassis_id": "0018.fe1e.b020", - "remote_system_name": "twb-sf-hpsw1", - "remote_system_enable_capab": ["bridge"], - "remote_port_description": "15" - }] + "FastEthernet4": [ + { + "parent_interface": "", + "remote_system_capab": ["bridge"], + "remote_system_description": "ProCurve J9019A Switch 2510-24, revision Q.10.01, ROM Q.10.02 (/sw/code/build/harp(harp))", + "remote_port": "15", + "remote_chassis_id": "00:18:FE:1E:B0:20", + "remote_system_name": "twb-sf-hpsw1", + "remote_system_enable_capab": ["bridge"], + "remote_port_description": "15" + } + ] } diff --git a/test/ios/mocked_data/test_get_lldp_neighbors_detail/older_ios/expected_result.json b/test/ios/mocked_data/test_get_lldp_neighbors_detail/older_ios/expected_result.json index a50664efb..5e8a46ac8 100644 --- a/test/ios/mocked_data/test_get_lldp_neighbors_detail/older_ios/expected_result.json +++ b/test/ios/mocked_data/test_get_lldp_neighbors_detail/older_ios/expected_result.json @@ -1,26 +1,26 @@ { - "GigabitEthernet0/24": [ - { - "parent_interface": "", - "remote_chassis_id": "f4a7.39cd.2e40", - "remote_port": "ge-0/0/23", - "remote_port_description": "ptp to switch", - "remote_system_capab": ["bridge", "router"], - "remote_system_description": "Juniper Networks, Inc. ex3300-24p , version 12.3R12.4 Build date: 2016-01-20 05:03:06 UTC", - "remote_system_enable_capab": ["bridge", "router"], - "remote_system_name": "switch1" - } - ], - "GigabitEthernet0/1": [ - { - "parent_interface": "", - "remote_chassis_id": "a8b1.d41d.8680", - "remote_port": "Gi0/2", - "remote_port_description": "GigabitEthernet0/2", - "remote_system_capab": ["bridge"], - "remote_system_description": "Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 15.0(1)SE2, RELEASE SOFTWARE (fc3)", - "remote_system_enable_capab": ["bridge"], - "remote_system_name": "switch2" - } - ] + "GigabitEthernet0/24": [ + { + "parent_interface": "", + "remote_chassis_id": "F4:A7:39:CD:2E:40", + "remote_port": "ge-0/0/23", + "remote_port_description": "ptp to switch", + "remote_system_capab": ["bridge", "router"], + "remote_system_description": "Juniper Networks, Inc. ex3300-24p , version 12.3R12.4 Build date: 2016-01-20 05:03:06 UTC", + "remote_system_enable_capab": ["bridge", "router"], + "remote_system_name": "switch1" + } + ], + "GigabitEthernet0/1": [ + { + "parent_interface": "", + "remote_chassis_id": "A8:B1:D4:1D:86:80", + "remote_port": "Gi0/2", + "remote_port_description": "GigabitEthernet0/2", + "remote_system_capab": ["bridge"], + "remote_system_description": "Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 15.0(1)SE2, RELEASE SOFTWARE (fc3)", + "remote_system_enable_capab": ["bridge"], + "remote_system_name": "switch2" + } + ] } diff --git a/test/ios/mocked_data/test_traceroute/normal/expected_result.json b/test/ios/mocked_data/test_traceroute/normal/expected_result.json index 6a0cdbe7d..197367914 100644 --- a/test/ios/mocked_data/test_traceroute/normal/expected_result.json +++ b/test/ios/mocked_data/test_traceroute/normal/expected_result.json @@ -1 +1,175 @@ -{"success": {"1": {"probes": {"1": {"ip_address": "10.0.4.2", "rtt": 14.0, "host_name": "10.0.4.2"}, "2": {"ip_address": "10.0.4.2", "rtt": 11.0, "host_name": "10.0.4.2"}, "3": {"ip_address": "10.0.4.2", "rtt": 11.0, "host_name": "10.0.4.2"}}}, "2": {"probes": {"1": {"ip_address": "213.250.19.90", "rtt": 175.0, "host_name": "BSN-access.dynamic.siol.net"}, "2": {"ip_address": "213.250.19.90", "rtt": 157.0, "host_name": "BSN-access.dynamic.siol.net"}, "3": {"ip_address": "213.250.19.90", "rtt": 157.0, "host_name": "BSN-access.dynamic.siol.net"}}}, "3": {"probes": {"1": {"ip_address": "95.176.241.222", "rtt": 178.0, "host_name": "95.176.241.222"}, "2": {"ip_address": "95.176.241.222", "rtt": 266.0, "host_name": "95.176.241.222"}, "3": {"ip_address": "95.176.241.222", "rtt": 208.0, "host_name": "95.176.241.222"}}}, "4": {"probes": {"1": {"ip_address": "213.250.1.130", "rtt": 320.0, "host_name": "BSN-250-1-130.static.siol.net"}, "2": {"ip_address": "213.250.1.130", "rtt": 300.0, "host_name": "BSN-250-1-130.static.siol.net"}, "3": {"ip_address": "213.250.1.130", "rtt": 138.0, "host_name": "BSN-250-1-130.static.siol.net"}}}, "5": {"probes": {"1": {"ip_address": "209.85.248.115", "rtt": 122.0, "host_name": "BSN-209.85.248.115.static.siol.net"}, "2": {"ip_address": "209.85.248.217", "rtt": 157.0, "host_name": "209.85.248.217"}, "3": {"ip_address": "72.14.237.184", "rtt": 195.0, "host_name": "72.14.237.184"}}}, "6": {"probes": {"1": {"ip_address": "209.85.248.1", "rtt": 122.0, "host_name": "BSN-0.static.siol.net"}, "2": {"ip_address": "209.85.248.217", "rtt": 157.0, "host_name": "209.85.248.217"}, "3": {"ip_address": "209.85.248.217", "rtt": 195.0, "host_name": "209.85.248.217"}}}, "7": {"probes": {"1": {"ip_address": "", "rtt": 0.0, "host_name": ""}, "2": {"ip_address": "209.85.1.1", "rtt": 157.0, "host_name": "209.85.1.1"}, "3": {"ip_address": "209.85.1.1", "rtt": 195.0, "host_name": "209.85.1.1"}}}, "8": {"probes": {"1": {"ip_address": "", "rtt": 0.0, "host_name": ""}, "2": {"ip_address": "", "rtt": 0.0, "host_name": ""}, "3": {"ip_address": "", "rtt": 0.0, "host_name": ""}}}, "9": {"probes": {"1": {"ip_address": "8.8.8.8", "rtt": 213.0, "host_name": "google-public-dns-a.google.com"}, "2": {"ip_address": "8.8.8.8", "rtt": 210.0, "host_name": "google-public-dns-a.google.com"}, "3": {"ip_address": "8.8.8.8", "rtt": 197.0, "host_name": "google-public-dns-a.google.com"}}}}} +{ + "success": { + "1": { + "probes": { + "1": { + "ip_address": "10.0.4.2", + "rtt": 14, + "host_name": "10.0.4.2" + }, + "2": { + "ip_address": "10.0.4.2", + "rtt": 11, + "host_name": "10.0.4.2" + }, + "3": { + "ip_address": "10.0.4.2", + "rtt": 11, + "host_name": "10.0.4.2" + } + } + }, + "2": { + "probes": { + "1": { + "ip_address": "213.250.19.90", + "rtt": 175, + "host_name": "BSN-access.dynamic.siol.net" + }, + "2": { + "ip_address": "213.250.19.90", + "rtt": 157, + "host_name": "BSN-access.dynamic.siol.net" + }, + "3": { + "ip_address": "213.250.19.90", + "rtt": 157, + "host_name": "BSN-access.dynamic.siol.net" + } + } + }, + "3": { + "probes": { + "1": { + "ip_address": "95.176.241.222", + "rtt": 178, + "host_name": "95.176.241.222" + }, + "2": { + "ip_address": "95.176.241.222", + "rtt": 266, + "host_name": "95.176.241.222" + }, + "3": { + "ip_address": "95.176.241.222", + "rtt": 208, + "host_name": "95.176.241.222" + } + } + }, + "4": { + "probes": { + "1": { + "ip_address": "213.250.1.130", + "rtt": 320, + "host_name": "BSN-250-1-130.static.siol.net" + }, + "2": { + "ip_address": "213.250.1.130", + "rtt": 300, + "host_name": "BSN-250-1-130.static.siol.net" + }, + "3": { + "ip_address": "213.250.1.130", + "rtt": 138, + "host_name": "BSN-250-1-130.static.siol.net" + } + } + }, + "5": { + "probes": { + "1": { + "ip_address": "209.85.248.115", + "rtt": 122, + "host_name": "BSN-209.85.248.115.static.siol.net" + }, + "2": { + "ip_address": "209.85.248.217", + "rtt": 157, + "host_name": "209.85.248.217" + }, + "3": { + "ip_address": "72.14.237.184", + "rtt": 195, + "host_name": "72.14.237.184" + } + } + }, + "6": { + "probes": { + "1": { + "ip_address": "209.85.248.1", + "rtt": 122, + "host_name": "BSN-0.static.siol.net" + }, + "2": { + "ip_address": "209.85.248.217", + "rtt": 157, + "host_name": "209.85.248.217" + }, + "3": { + "ip_address": "209.85.248.217", + "rtt": 195, + "host_name": "209.85.248.217" + } + } + }, + "7": { + "probes": { + "1": { + "ip_address": "", + "rtt": 0, + "host_name": "" + }, + "2": { + "ip_address": "209.85.1.1", + "rtt": 157, + "host_name": "209.85.1.1" + }, + "3": { + "ip_address": "209.85.1.1", + "rtt": 195, + "host_name": "209.85.1.1" + } + } + }, + "8": { + "probes": { + "1": { + "ip_address": "", + "rtt": 0, + "host_name": "" + }, + "2": { + "ip_address": "", + "rtt": 0, + "host_name": "" + }, + "3": { + "ip_address": "", + "rtt": 0, + "host_name": "" + } + } + }, + "9": { + "probes": { + "1": { + "ip_address": "8.8.8.8", + "rtt": 213, + "host_name": "google-public-dns-a.google.com" + }, + "2": { + "ip_address": "8.8.8.8", + "rtt": 210, + "host_name": "google-public-dns-a.google.com" + }, + "3": { + "ip_address": "8.8.8.8", + "rtt": 197, + "host_name": "google-public-dns-a.google.com" + } + } + } + } +}