Use airfiber backhaul capacities to limit site bandwidths

This commit is contained in:
Robert Chacón 2023-03-29 10:02:01 -06:00 committed by Herbert Wolverson
parent ec9a7e71b8
commit 52a961181e

View File

@ -99,7 +99,7 @@ def buildFullGraph():
download = int(download) download = int(download)
upload = int(upload) upload = int(upload)
siteBandwidth[name] = {"download": download, "upload": upload} siteBandwidth[name] = {"download": download, "upload": upload}
# Find AP capacities from UISP # Find AP capacities from UISP
for device in devices: for device in devices:
if device['identification']['role'] == "ap": if device['identification']['role'] == "ap":
@ -110,7 +110,27 @@ def buildFullGraph():
upload = int(device['overview']['uplinkCapacity'] / 1000000) upload = int(device['overview']['uplinkCapacity'] / 1000000)
siteBandwidth[device['identification']['name']] = { siteBandwidth[device['identification']['name']] = {
"download": download, "upload": upload} "download": download, "upload": upload}
# Find Site Capacities by AirFiber capacities
foundAirFibersBySite = {}
for device in devices:
if device['identification']['site']['type'] == 'site':
if device['identification']['role'] == "station":
if device['identification']['type'] == "airFiber":
if device['overview']['status'] == 'active':
download = int(device['overview']['downlinkCapacity']/ 1000000)
upload = int(device['overview']['uplinkCapacity']/ 1000000)
# Make sure to use half of reported bandwidth for AF60-LRs
if device['identification']['model'] == "AF60-LR":
download = int(download / 2)
upload = int(download / 2)
if device['identification']['site']['id'] in foundAirFibersBySite:
if (download > foundAirFibersBySite['download']) or (upload > foundAirFibersBySite['upload']):
foundAirFibersBySite[device['identification']['site']['id']]['download'] = download
foundAirFibersBySite[device['identification']['site']['id']]['upload'] = upload
else:
foundAirFibersBySite[device['identification']['site']['id']] = {'download': download, 'upload': upload}
print("Building Topology") print("Building Topology")
net = NetworkGraph() net = NetworkGraph()
# Add all sites and client sites # Add all sites and client sites
@ -133,6 +153,9 @@ def buildFullGraph():
# Use the CSV bandwidth values # Use the CSV bandwidth values
download = siteBandwidth[name]["download"] download = siteBandwidth[name]["download"]
upload = siteBandwidth[name]["upload"] upload = siteBandwidth[name]["upload"]
elif id in foundAirFibersBySite:
download = foundAirFibersBySite[id]['download']
upload = foundAirFibersBySite[id]['upload']
else: else:
# Add them just in case # Add them just in case
siteBandwidth[name] = { siteBandwidth[name] = {
@ -209,7 +232,8 @@ def buildFullGraph():
# Save integrationUISPbandwidths.csv # Save integrationUISPbandwidths.csv
# (the newLine fixes generating extra blank lines) # (the newLine fixes generating extra blank lines)
with open('integrationUISPbandwidths.csv', 'w', newline='') as csvfile: # Saves as .template as to not overwrite
with open('integrationUISPbandwidths.template.csv', 'w', newline='') as csvfile:
wr = csv.writer(csvfile, quoting=csv.QUOTE_ALL) wr = csv.writer(csvfile, quoting=csv.QUOTE_ALL)
wr.writerow(['ParentNode', 'Download Mbps', 'Upload Mbps']) wr.writerow(['ParentNode', 'Download Mbps', 'Upload Mbps'])
for device in siteBandwidth: for device in siteBandwidth: