Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing get_bgp_neighbors and asdot notation on NX-OS #1230

Merged
merged 2 commits into from
May 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions napalm/nxos/nxos.py
Original file line number Diff line number Diff line change
@@ -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

@@ -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"],
Original file line number Diff line number Diff line change
@@ -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": {}
}
}
Loading