Skip to content
Snippets Groups Projects
Commit 676d1371 authored by Sam Roberts's avatar Sam Roberts
Browse files

Merge branch 'develop' into feature/REPORTING-307-msr-vpn-proxy-endpoint

parents c05e6933 bfddc0f3
No related branches found
No related tags found
1 merge request!2Feature/reporting 307 msr vpn proxy endpoint
......@@ -1035,9 +1035,7 @@ def mdvpn():
return index
def _bgplu_peerings(asn, bgplu_index):
if asn not in bgplu_index:
yield False
for peering in bgplu_index[asn]:
for peering in bgplu_index.get(asn, []):
formatted_peering = {
"name": peering['description'],
"v4": peering['address'],
......@@ -1047,29 +1045,28 @@ def mdvpn():
yield formatted_peering
def _vpnrr_peerings(asn, vpnrr_index):
if asn not in vpnrr_index:
yield False
vrr_peering_group = vpnrr_index[asn]
# rearrange into index using ipv4 as key
# this will collect related entries under the same ipv4
ip_index = _make_group_index(vrr_peering_group, 'address')
for ip in ip_index:
ip_details = ip_index[ip] # a list of all info for given ipv4
hostnames = [item['hostname'] for item in ip_details]
description = ip_details[0]['description']
if asn in vpnrr_index:
  • Robert Latta @Robert.Latta ·
    Maintainer

    you can lose this conditional and the next line if you replace the ip_index assignment to ip_index = _make_group_index(vpnrr_index.get(asn, []), 'address')

  • Please register or sign in to reply
vrr_peering_group = vpnrr_index[asn]
# rearrange into index using ipv4 as key
# this will collect related entries under the same ipv4
ip_index = _make_group_index(vrr_peering_group, 'address')
for ip in ip_index:
  • Robert Latta @Robert.Latta ·
    Maintainer

    change this to for ip, ip_details in ip_index.items(): and remove the next line

  • Please register or sign in to reply
ip_details = ip_index[ip] # a list of all info for given ipv4
hostnames = [item['hostname'] for item in ip_details]
description = ip_details[0]['description']
formatted_peering = {
"description": _get_consistent_description(description),
"v4": ip,
"hostname": hostnames
}
yield formatted_peering
formatted_peering = {
"description": _get_consistent_description(description),
"v4": ip,
"hostname": hostnames
}
yield formatted_peering
def _peerings_for_nren(asn, bgplu_index, vpnrr_index):
return {
"asn": asn,
"AP": list(filter(None, _bgplu_peerings(asn, bgplu_index))),
"VRR": list(filter(None, _vpnrr_peerings(asn, vpnrr_index)))
"AP": list(_bgplu_peerings(asn, bgplu_index)),
"VRR": list(_vpnrr_peerings(asn, vpnrr_index))
}
r = common.get_current_redis()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment