Skip to content

Commit

Permalink
Merge branch 'develop' into pr-749
Browse files Browse the repository at this point in the history
  • Loading branch information
mirceaulinic committed Apr 24, 2020
2 parents c33b060 + 7b704b5 commit a4aff89
Show file tree
Hide file tree
Showing 28 changed files with 972 additions and 721 deletions.
7 changes: 7 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
napalm
Copyright 2015 Spotify AB. All rights reserved.

This project includes software developed at Spotify AB.
Mircea Ulinic, Kirk Byers, David Barroso, and many others,
who are not necessarily associated with Spotify AB,
have contributed as well.
10 changes: 10 additions & 0 deletions napalm/base/canonical_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"EO": "EOBC",
"Ethernet": "Ethernet",
"Eth": "Ethernet",
"eth": "Ethernet",
"Et": "Ethernet",
"et": "Ethernet",
"FastEthernet": "FastEthernet",
"FastEth": "FastEthernet",
"FastE": "FastEthernet",
Expand All @@ -32,6 +34,8 @@
"GigE": "GigabitEthernet",
"Gig": "GigabitEthernet",
"GE": "GigabitEthernet",
"Ge": "GigabitEthernet",
"ge": "GigabitEthernet",
"Gi": "GigabitEthernet",
"HundredGigabitEthernet": "HundredGigabitEthernet",
"HundredGigEthernet": "HundredGigabitEthernet",
Expand All @@ -40,10 +44,12 @@
"HundredGig": "HundredGigabitEthernet",
"Hu": "HundredGigabitEthernet",
"Loopback": "Loopback",
"loopback": "Loopback",
"Lo": "Loopback",
"lo": "Loopback",
"Management": "Management",
"Mgmt": "Management",
"mgmt": "Management",
"Ma": "Management",
"Management_short": "Ma",
"MFR": "MFR",
Expand All @@ -55,6 +61,8 @@
"PortChannel": "Port-channel",
"Port-channel": "Port-channel",
"Port-Channel": "Port-channel",
"port-channel": "Port-channel",
"po": "Port-channel",
"Po": "Port-channel",
"POS": "POS",
"PO": "POS",
Expand Down Expand Up @@ -82,6 +90,7 @@
"VLAN": "VLAN",
"V": "VLAN",
"Vl": "VLAN",
"Wlan-GigabitEthernet": "Wlan-GigabitEthernet",
}

reverse_mapping = {
Expand All @@ -107,4 +116,5 @@
"Virtual-Access": "Vi",
"Virtual-Template": "Vt",
"VLAN": "Vl",
"Wlan-GigabitEthernet": "Wl-Gi",
}
19 changes: 19 additions & 0 deletions napalm/ios/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
canonical_interface_name,
transform_lldp_capab,
textfsm_extractor,
split_interface,
abbreviated_interface_name,
)
from napalm.base.netmiko_helpers import netmiko_args

Expand Down Expand Up @@ -2103,6 +2105,14 @@ def get_interfaces_counters(self):
match = re.search(r"(\d+) output errors", line)
counters[interface]["tx_errors"] = int(match.group(1))
counters[interface]["tx_discards"] = -1

interface_type, interface_number = split_interface(interface)
if interface_type in [
"HundredGigabitEthernet",
"FortyGigabitEthernet",
"TenGigabitEthernet",
]:
interface = abbreviated_interface_name(interface)
for line in sh_int_sum_cmd_out.splitlines():
if interface in line:
# Line is tabular output with columns
Expand All @@ -2117,6 +2127,7 @@ def get_interfaces_counters(self):
)
match = re.search(regex, line)
if match:
interface = canonical_interface_name(interface)
counters[interface]["rx_discards"] = int(match.group("IQD"))
counters[interface]["tx_discards"] = int(match.group("OQD"))

Expand Down Expand Up @@ -2622,6 +2633,14 @@ def process_mac_fields(vlan, mac, mac_type, interface):
r"Displaying entries from active supervisor:\s+\w+\s+\[\d\]:", line
):
continue
elif re.search(r"EHWIC:.*", line):
# Skip module - process_mac_fields doesn't care.
continue
elif re.search(
r"Destination Address.*Address.*Type.*VLAN.*Destination.*Port", line
):
# If there are multiple modules, this line gets repeated for each module.
continue
else:
raise ValueError("Unexpected output from: {}".format(repr(line)))

Expand Down
8 changes: 6 additions & 2 deletions napalm/nxos/nxos.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,13 @@ def _parse_vlan_ports(self, vlan_s):
find = re.findall(find_regexp, vls.strip())
if find:
for i in range(int(find[0][1]), int(find[0][2]) + 1):
vlans.append(find[0][0] + str(i))
vlans.append(
napalm.base.helpers.canonical_interface_name(
find[0][0] + str(i)
)
)
else:
vlans.append(vls.strip())
vlans.append(napalm.base.helpers.canonical_interface_name(vls.strip()))
return vlans


Expand Down
2 changes: 1 addition & 1 deletion napalm/nxos_ssh/nxos_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def parse_intf_section(interface):
else:
# More standard is up, next line admin state is lines
match = re.search(re_intf_name_state, interface)
intf_name = match.group("intf_name")
intf_name = helpers.canonical_interface_name(match.group("intf_name"))
intf_state = match.group("intf_state").strip()
is_up = True if intf_state == "up" else False

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"TenGigabitEthernet0/0/0": {
"rx_unicast_packets": 0,
"rx_octets": 1748592,
"rx_broadcast_packets": 0,
"rx_multicast_packets": 0,
"rx_errors": 0,
"rx_discards": 0,
"tx_unicast_packets": 9297,
"tx_octets": 1355261,
"tx_broadcast_packets": -1,
"tx_multicast_packets": -1,
"tx_errors": 0,
"tx_discards": 0
},
"TenGigabitEthernet0/0/1": {
"rx_unicast_packets": 0,
"rx_octets": 1748592,
"rx_broadcast_packets": 0,
"rx_multicast_packets": 0,
"rx_errors": 0,
"rx_discards": 1,
"tx_unicast_packets": 9297,
"tx_octets": 1355261,
"tx_broadcast_packets": -1,
"tx_multicast_packets": -1,
"tx_errors": 0,
"tx_discards": 0
},
"FortyGigabitEthernet0/0/2": {
"rx_unicast_packets": 0,
"rx_octets": 1748592,
"rx_broadcast_packets": 0,
"rx_multicast_packets": 0,
"rx_errors": 0,
"rx_discards": 2,
"tx_unicast_packets": 9297,
"tx_octets": 1355261,
"tx_broadcast_packets": -1,
"tx_multicast_packets": -1,
"tx_errors": 0,
"tx_discards": 0
},
"HundredGigabitEthernet0/0/3": {
"rx_unicast_packets": 0,
"rx_octets": 1748592,
"rx_broadcast_packets": 0,
"rx_multicast_packets": 0,
"rx_errors": 0,
"rx_discards": 3,
"tx_unicast_packets": 9297,
"tx_octets": 1355261,
"tx_broadcast_packets": -1,
"tx_multicast_packets": -1,
"tx_errors": 0,
"tx_discards": 0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

*: interface is up
IHQ: pkts in input hold queue IQD: pkts dropped from input queue
OHQ: pkts in output hold queue OQD: pkts dropped from output queue
RXBS: rx rate (bits/sec) RXPS: rx rate (pkts/sec)
TXBS: tx rate (bits/sec) TXPS: tx rate (pkts/sec)
TRTL: throttle count

Interface IHQ IQD OHQ OQD RXBS RXPS TXBS TXPS TRTL
-----------------------------------------------------------------------------------------------------------------
* Te0/0/0 0 0 0 0 0 0 0 0 0
Te0/0/1 0 1 0 0 0 0 0 0 0
Fo0/0/2 0 2 0 0 0 0 0 0 0
Hu0/0/3 0 3 0 0 0 0 0 0 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
TenGigabitEthernet0/0/0 is up, line protocol is up
Hardware is EPA-10X10GE, address is 0000.1111.2222 (bia 0000.1111.2222)
Description: Link
MTU 1500 bytes, BW 10000000 Kbit/sec, DLY 10 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation 802.1Q Virtual LAN, Vlan ID 1., loopback not set
Keepalive not supported
Full Duplex, 10000Mbps, link type is force-up, media type is SFP-SR
output flow-control is on, input flow-control is on
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:00, output 00:00:30, output hang never
Last clearing of "show interface" counters 1w5d
Input queue: 0/375/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
30 second input rate 1 bits/sec, 0 packets/sec
30 second output rate 1 bits/sec, 0 packets/sec
0 packets input, 1748592 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 0 multicast, 0 pause input
9297 packets output, 1355261 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 unknown protocol drops
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 pause output
0 output buffer failures, 0 output buffers swapped out
TenGigabitEthernet0/0/1 is up, line protocol is up
Hardware is EPA-10X10GE, address is 0000.1111.2222 (bia 0000.1111.2222)
Description: Link
MTU 1500 bytes, BW 10000000 Kbit/sec, DLY 10 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation 802.1Q Virtual LAN, Vlan ID 1., loopback not set
Keepalive not supported
Full Duplex, 10000Mbps, link type is force-up, media type is SFP-SR
output flow-control is on, input flow-control is on
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:00, output 00:00:30, output hang never
Last clearing of "show interface" counters 1w5d
Input queue: 0/375/0/0 (size/max/drops/flushes); Total output drops: 1
Queueing strategy: fifo
Output queue: 0/40 (size/max)
30 second input rate 1 bits/sec, 0 packets/sec
30 second output rate 1 bits/sec, 0 packets/sec
0 packets input, 1748592 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 0 multicast, 0 pause input
9297 packets output, 1355261 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 unknown protocol drops
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 pause output
0 output buffer failures, 0 output buffers swapped out
FortyGigabitEthernet0/0/2 is up, line protocol is up
Hardware is EPA-10X40GE, address is 0000.1111.2222 (bia 0000.1111.2222)
Description: Link
MTU 1500 bytes, BW 40000000 Kbit/sec, DLY 10 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation 802.1Q Virtual LAN, Vlan ID 1., loopback not set
Keepalive not supported
Full Duplex, 40000Mbps, link type is force-up, media type is SFP-SR
output flow-control is on, input flow-control is on
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:00, output 00:00:30, output hang never
Last clearing of "show interface" counters 1w5d
Input queue: 0/375/0/0 (size/max/drops/flushes); Total output drops: 2
Queueing strategy: fifo
Output queue: 0/40 (size/max)
30 second input rate 1 bits/sec, 0 packets/sec
30 second output rate 1 bits/sec, 0 packets/sec
0 packets input, 1748592 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 0 multicast, 0 pause input
9297 packets output, 1355261 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 unknown protocol drops
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 pause output
0 output buffer failures, 0 output buffers swapped out
HundredGigabitEthernet0/0/3 is up, line protocol is up
Hardware is EPA-1X100GE, address is 0000.1111.2222 (bia 0000.1111.2222)
Description: Link
MTU 1500 bytes, BW 100000000 Kbit/sec, DLY 10 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation 802.1Q Virtual LAN, Vlan ID 1., loopback not set
Keepalive not supported
Full Duplex, 100000Mbps, link type is force-up, media type is SFP-SR
output flow-control is on, input flow-control is on
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:00, output 00:00:30, output hang never
Last clearing of "show interface" counters 1w5d
Input queue: 0/375/0/0 (size/max/drops/flushes); Total output drops: 3
Queueing strategy: fifo
Output queue: 0/40 (size/max)
30 second input rate 1 bits/sec, 0 packets/sec
30 second output rate 1 bits/sec, 0 packets/sec
0 packets input, 1748592 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 0 multicast, 0 pause input
9297 packets output, 1355261 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 unknown protocol drops
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 pause output
0 output buffer failures, 0 output buffers swapped out
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[{
"static": false,
"active": true,
"vlan": 2,
"mac": "11:11:22:22:33:33",
"interface": "GigabitEthernet0/0/1",
"moves": -1,
"last_move": -1.0
},
{
"static": false,
"active": true,
"vlan": 1,
"mac": "33:33:22:22:11:11",
"interface": "GigabitEthernet0/1/1",
"moves": -1,
"last_move": -1.0
}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
EHWIC: 0
Destination Address Address Type VLAN Destination Port
------------------- ------------ ---- -----------------
1111.2222.3333 Dynamic 2 GigabitEthernet0/0/1

EHWIC: 1
Destination Address Address Type VLAN Destination Port
------------------- ------------ ---- -----------------
3333.2222.1111 Dynamic 1 GigabitEthernet0/1/1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"port": "Ethernet1/1"
}
],
"mgmt0": [
"Management0": [
{
"hostname": "PERIMETER.cisco.com",
"port": "Fa1/0/9"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"remote_system_name": "n9k2.ntc.com"
}
],
"mgmt0": [
"Management0": [
{
"remote_port_description": "FastEthernet1/0/9",
"remote_port": "Fa1/0/9",
Expand Down
Loading

0 comments on commit a4aff89

Please sign in to comment.