Skip to content

Commit

Permalink
Fixing get_bgp_neighbors and asdot notation on NX-OS (#1230)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktbyers committed May 27, 2020
1 parent 907344f commit 3e676cb
Show file tree
Hide file tree
Showing 3 changed files with 850 additions and 4 deletions.
7 changes: 3 additions & 4 deletions napalm/nxos/nxos.py
Expand Up @@ -43,6 +43,7 @@
from napalm.base.exceptions import CommandErrorException
from napalm.base.exceptions import ReplaceConfigException
from napalm.base.helpers import generate_regex_or
from napalm.base.helpers import as_number
from napalm.base.netmiko_helpers import netmiko_args
import napalm.base.constants as c

Expand Down Expand Up @@ -962,17 +963,15 @@ def get_bgp_neighbors(self):

for neighbor_dict in neighbors_list:
neighborid = napalm.base.helpers.ip(neighbor_dict["neighborid"])
remoteas = napalm.base.helpers.as_number(
neighbor_dict["neighboras"]
)
remoteas = as_number(neighbor_dict["neighboras"])
state = str(neighbor_dict["state"])

bgp_state = bgp_state_dict[state]
afid_dict = af_name_dict[int(af_dict["af-id"])]
safi_name = afid_dict[int(saf_dict["safi"])]

result_peer_dict = {
"local_as": int(vrf_dict["vrf-local-as"]),
"local_as": as_number(vrf_dict["vrf-local-as"]),
"remote_as": remoteas,
"remote_id": neighborid,
"is_enabled": bgp_state["is_enabled"],
Expand Down
@@ -0,0 +1,265 @@
{
"RED-PROD": {
"router_id": "10.2.3.6",
"peers": {
"10.1.1.169": {
"is_enabled": true,
"address_family": {
"ipv4": {
"sent_prefixes": -1,
"accepted_prefixes": -1,
"received_prefixes": 4
}
},
"uptime": -1,
"remote_as": 64862,
"description": "",
"remote_id": "10.1.1.169",
"local_as": 525489,
"is_up": true
},
"10.1.1.171": {
"is_enabled": true,
"address_family": {
"ipv4": {
"sent_prefixes": -1,
"accepted_prefixes": -1,
"received_prefixes": 4
}
},
"uptime": -1,
"remote_as": 64862,
"description": "",
"remote_id": "10.1.1.171",
"local_as": 525489,
"is_up": true
}
}
},
"BLUE": {
"router_id": "10.1.1.186",
"peers": {
"10.1.1.187": {
"is_enabled": true,
"address_family": {
"ipv4": {
"sent_prefixes": -1,
"accepted_prefixes": -1,
"received_prefixes": 0
}
},
"uptime": -1,
"remote_as": 64862,
"description": "",
"remote_id": "10.1.1.187",
"local_as": 525489,
"is_up": true
},
"10.1.1.185": {
"is_enabled": true,
"address_family": {
"ipv4": {
"sent_prefixes": -1,
"accepted_prefixes": -1,
"received_prefixes": 0
}
},
"uptime": -1,
"remote_as": 64862,
"description": "",
"remote_id": "10.1.1.185",
"local_as": 525489,
"is_up": true
}
}
},
"MGMT": {
"router_id": "10.0.0.188",
"peers": {
"10.1.1.227": {
"is_enabled": true,
"address_family": {
"ipv4": {
"sent_prefixes": -1,
"accepted_prefixes": -1,
"received_prefixes": 14
}
},
"uptime": -1,
"remote_as": 64862,
"description": "",
"remote_id": "10.1.1.227",
"local_as": 525489,
"is_up": true
},
"10.1.1.225": {
"is_enabled": true,
"address_family": {
"ipv4": {
"sent_prefixes": -1,
"accepted_prefixes": -1,
"received_prefixes": 14
}
},
"uptime": -1,
"remote_as": 64862,
"description": "",
"remote_id": "10.1.1.225",
"local_as": 525489,
"is_up": true
}
}
},
"global": {
"router_id": "10.3.1.136",
"peers": {
"10.1.1.135": {
"is_enabled": true,
"address_family": {
"l2vpn": {
"sent_prefixes": -1,
"accepted_prefixes": -1,
"received_prefixes": 7237
}
},
"uptime": -1,
"remote_as": 64861,
"description": "",
"remote_id": "10.1.1.135",
"local_as": 525489,
"is_up": true
},
"10.1.1.134": {
"is_enabled": true,
"address_family": {
"l2vpn": {
"sent_prefixes": -1,
"accepted_prefixes": -1,
"received_prefixes": 7237
}
},
"uptime": -1,
"remote_as": 64861,
"description": "",
"remote_id": "10.1.1.134",
"local_as": 525489,
"is_up": true
}
}
},
"RED-PRE-PROD": {
"router_id": "10.2.63.60",
"peers": {
"10.1.1.179": {
"is_enabled": true,
"address_family": {
"ipv4": {
"sent_prefixes": -1,
"accepted_prefixes": -1,
"received_prefixes": 13
}
},
"uptime": -1,
"remote_as": 64862,
"description": "",
"remote_id": "10.1.1.179",
"local_as": 525489,
"is_up": true
},
"10.1.1.177": {
"is_enabled": true,
"address_family": {
"ipv4": {
"sent_prefixes": -1,
"accepted_prefixes": -1,
"received_prefixes": 13
}
},
"uptime": -1,
"remote_as": 64862,
"description": "",
"remote_id": "10.1.1.177",
"local_as": 525489,
"is_up": true
}
}
},
"NON_PROD": {
"router_id": "10.1.255.188",
"peers": {
"10.1.1.161": {
"is_enabled": true,
"address_family": {
"ipv4": {
"sent_prefixes": -1,
"accepted_prefixes": -1,
"received_prefixes": 441
}
},
"uptime": -1,
"remote_as": 64862,
"description": "",
"remote_id": "10.1.1.161",
"local_as": 525489,
"is_up": true
},
"10.1.1.163": {
"is_enabled": true,
"address_family": {
"ipv4": {
"sent_prefixes": -1,
"accepted_prefixes": -1,
"received_prefixes": 441
}
},
"uptime": -1,
"remote_as": 64862,
"description": "",
"remote_id": "10.1.1.163",
"local_as": 525489,
"is_up": true
}
}
},
"PROD": {
"router_id": "10.9.2.60",
"peers": {
"10.1.1.153": {
"is_enabled": true,
"address_family": {
"ipv4": {
"sent_prefixes": -1,
"accepted_prefixes": -1,
"received_prefixes": 9
}
},
"uptime": -1,
"remote_as": 64862,
"description": "",
"remote_id": "10.1.1.153",
"local_as": 525489,
"is_up": true
},
"10.1.1.155": {
"is_enabled": true,
"address_family": {
"ipv4": {
"sent_prefixes": -1,
"accepted_prefixes": -1,
"received_prefixes": 9
}
},
"uptime": -1,
"remote_as": 64862,
"description": "",
"remote_id": "10.1.1.155",
"local_as": 525489,
"is_up": true
}
}
},
"OTV": {
"router_id": "10.3.1.228",
"peers": {}
}
}

0 comments on commit 3e676cb

Please sign in to comment.