Skip to content

Commit

Permalink
Fix incorrect get_interfaces_ip parsing on n9k with IPv6 addresses (#997
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Carl Montanari authored and ktbyers committed Jun 15, 2019
1 parent 2b373b3 commit c9ab088
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 62 deletions.
7 changes: 6 additions & 1 deletion napalm/nxos/nxos.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,12 @@ def get_interfaces_ip(self):
interfaces_ip[interface_name]["ipv6"] = {}
if "addr" not in interface.keys():
# Handle nexus 9000 ipv6 interface output
addrs = [addr["addr"] for addr in interface["TABLE_addr"]["ROW_addr"]]
if isinstance(interface["TABLE_addr"]["ROW_addr"], list):
addrs = [
addr["addr"] for addr in interface["TABLE_addr"]["ROW_addr"]
]
elif isinstance(interface["TABLE_addr"]["ROW_addr"], dict):
addrs = interface["TABLE_addr"]["ROW_addr"]["addr"]
interface["addr"] = addrs

if type(interface.get("addr", "")) is list:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@
"172.16.100.1": {
"prefix_length": 24
}
}
},
"Ethernet1/128": {
},
"ipv6": {
"2001:dead:beef::1": {
"200::2": {
"prefix_length": 128
},
"dead:beef::1": {
"prefix_length": 64
}
}
},
"Ethernet1/2": {
"ipv6": {
"2001:c0ff:ee::1": {
"prefix_length": 128
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,64 +1,115 @@
{
"TABLE_intf": {
"ROW_intf": {
"vrf-name-out": "default",
"intf-name": "Ethernet1/128",
"proto-state": "down",
"link-state": "down",
"admin-state": "up",
"prefix": "2001:dead:beef::1/128",
"linklocal-addr": "fe80::5054:ff:fe12:345d",
"linklocal-configured": "FALSE",
"mrouting-enabled": "disabled",
"mgroup-locally-joined": "TRUE",
"mtu": 1500,
"urpf-mode": "none",
"ipv6-lstype": "none",
"stats-last-reset": "never",
"upkt-fwd": 0,
"upkt-orig": 0,
"upkt-consumed": 0,
"ubyte-fwd": 0,
"ubyte-orig": 0,
"ubyte-consumed": 0,
"mpkt-fwd": 0,
"mpkt-orig": 0,
"mpkt-consumed": 0,
"mbyte-fwd": 0,
"mbyte-orig": 0,
"mbyte-consumed": 0,
"TABLE_addr": {
"ROW_addr": [
{
"addr": "2001:dead:beef::1/128"
},
{
"addr": "2001:c0ff:ee::1/128"
}
]
"ROW_intf": [
{
"vrf-name-out": "default",
"intf-name": "Ethernet1/1",
"proto-state": "up",
"link-state": "up",
"admin-state": "up",
"prefix": "dead:beef::/64",
"linklocal-addr": "fe80::a00:27ff:fe6c:ee14",
"linklocal-configured": "FALSE",
"mrouting-enabled": "disabled",
"mgroup-locally-joined": "TRUE",
"mtu": 1500,
"urpf-mode": "none",
"ipv6-lstype": "none",
"stats-last-reset": "never",
"upkt-fwd": 0,
"upkt-orig": 0,
"upkt-consumed": 0,
"ubyte-fwd": 0,
"ubyte-orig": 0,
"ubyte-consumed": 0,
"mpkt-fwd": 0,
"mpkt-orig": 9,
"mpkt-consumed": 0,
"mbyte-fwd": 0,
"mbyte-orig": 786,
"mbyte-consumed": 0,
"TABLE_addr": {
"ROW_addr": [
{
"addr": "dead:beef::1/64"
},
{
"addr": "200::2/128"
}
]
},
"TABLE_maddr": {
"ROW_maddr": [
{
"m-addr": "ff02::1:ff00:1"
},
{
"m-addr": "ff02::2"
},
{
"m-addr": "ff02::1"
},
{
"m-addr": "ff02::1:ff00:1"
},
{
"m-addr": "ff02::1:ff6c:ee14"
}
]
}
},
"TABLE_maddr": {
"ROW_maddr": [
{
"m-addr": "ff02::1:ff00:1"
},
{
"m-addr": "ff02::2"
},
{
"m-addr": "ff02::1"
},
{
"m-addr": "ff02::1:ff00:1"
},
{
"m-addr": "ff02::1:ff12:345d"
},
{
"m-addr": "ff02::1:ff00:1"
{
"vrf-name-out": "default",
"intf-name": "Ethernet1/2",
"proto-state": "up",
"link-state": "up",
"admin-state": "up",
"prefix": "2001:c0ff:ee::/128",
"linklocal-addr": "fe80::a00:27ff:fe6c:ee14",
"linklocal-configured": "FALSE",
"mrouting-enabled": "disabled",
"mgroup-locally-joined": "TRUE",
"mtu": 1500,
"urpf-mode": "none",
"ipv6-lstype": "none",
"stats-last-reset": "never",
"upkt-fwd": 0,
"upkt-orig": 0,
"upkt-consumed": 0,
"ubyte-fwd": 0,
"ubyte-orig": 0,
"ubyte-consumed": 0,
"mpkt-fwd": 0,
"mpkt-orig": 7,
"mpkt-consumed": 0,
"mbyte-fwd": 0,
"mbyte-orig": 614,
"mbyte-consumed": 0,
"TABLE_addr": {
"ROW_addr": {
"addr": "2001:c0ff:ee::1/128"
}
]
},
"TABLE_maddr": {
"ROW_maddr": [
{
"m-addr": "ff02::2"
},
{
"m-addr": "ff02::1"
},
{
"m-addr": "ff02::1:ff00:2"
},
{
"m-addr": "ff02::1:ff6c:ee14"
},
{
"m-addr": "ff02::1:ff00:2"
}
]
}
}
}
]
}
}

0 comments on commit c9ab088

Please sign in to comment.