Update integrationUISP.py

This commit is contained in:
Robert Chacón 2023-06-02 11:24:20 -06:00 committed by GitHub
parent b6fd808a59
commit bd4c14f31b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,6 +14,10 @@ try:
from ispConfig import airMax_capacity from ispConfig import airMax_capacity
except: except:
airMax_capacity = 0.65 airMax_capacity = 0.65
try:
from ispConfig import ltu_capacity
except:
ltu_capacity = 0.90
def uispRequest(target): def uispRequest(target):
# Sends an HTTP request to UISP and returns the # Sends an HTTP request to UISP and returns the
@ -143,13 +147,16 @@ def findApCapacities(devices, siteBandwidth):
dlRatio = None dlRatio = None
if device['identification']['type'] == 'airMax': if device['identification']['type'] == 'airMax':
download, upload = airMaxCapacityCorrection(device, download, upload) download, upload = airMaxCapacityCorrection(device, download, upload)
if (download < 15) or (upload < 15): elif device['identification']['model'] == 'LTU-Rocket':
print("WARNING: Device '" + device['identification']['hostname'] + "' has unusually low capacity (" + str(download) + '/' + str(upload) + " Mbps). Discarding in favor of parent site rates.") download = download * ltu_capacity
safeToUse = False upload = upload * ltu_capacity
if device['identification']['model'] == 'WaveAP': if device['identification']['model'] == 'WaveAP':
if (download < 500) or (upload < 500): if (download < 500) or (upload < 500):
download = 2450 download = 2450
upload = 2450 upload = 2450
if (download < 15) or (upload < 15):
print("WARNING: Device '" + device['identification']['hostname'] + "' has unusually low capacity (" + str(download) + '/' + str(upload) + " Mbps). Discarding in favor of parent site rates.")
safeToUse = False
if safeToUse: if safeToUse:
siteBandwidth[device['identification']['name']] = { siteBandwidth[device['identification']['name']] = {
"download": download, "upload": upload} "download": download, "upload": upload}