mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2024-11-21 15:57:24 -06:00
Use airfiber backhaul capacities to limit site bandwidths
This commit is contained in:
parent
ec9a7e71b8
commit
52a961181e
@ -111,6 +111,26 @@ def buildFullGraph():
|
||||
siteBandwidth[device['identification']['name']] = {
|
||||
"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")
|
||||
net = NetworkGraph()
|
||||
# Add all sites and client sites
|
||||
@ -133,6 +153,9 @@ def buildFullGraph():
|
||||
# Use the CSV bandwidth values
|
||||
download = siteBandwidth[name]["download"]
|
||||
upload = siteBandwidth[name]["upload"]
|
||||
elif id in foundAirFibersBySite:
|
||||
download = foundAirFibersBySite[id]['download']
|
||||
upload = foundAirFibersBySite[id]['upload']
|
||||
else:
|
||||
# Add them just in case
|
||||
siteBandwidth[name] = {
|
||||
@ -209,7 +232,8 @@ def buildFullGraph():
|
||||
|
||||
# Save integrationUISPbandwidths.csv
|
||||
# (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.writerow(['ParentNode', 'Download Mbps', 'Upload Mbps'])
|
||||
for device in siteBandwidth:
|
||||
|
Loading…
Reference in New Issue
Block a user