LibreQoE / LibreQoS

A Quality of Experience and Smart Queue Management system for ISPs. Leverage CAKE to improve network responsiveness, enforce bandwidth plans, and reduce bufferbloat.
https://libreqos.io/
GNU General Public License v2.0
464 stars 50 forks source link

Better handling of missing/low capacity info in UISP (and other?) integration #336

Closed trendal closed 1 year ago

trendal commented 1 year ago

Currently a combination of Ubiquiti Wave products and the API in UISP version 1.5.7 does not return a valid capacity number. The integrationUISP.py script just takes the number returned at face value and winds up giving them extremely low DL/UL Limits.

Wave AP's get 2 Mbps capacity <-- unknown if that affects downstream connected stations Wave LR in PTP mode get 1000 Kbps <-- this results in the business customer on the far side of the PTP link getting 1 Mbps up/down despite LibreQoS shaping his circuit at correct speeds.

Considering that this software is getting used on real networks with potentially lots of Wave gear, I think the integration script should have a minimum threshold that if a link capacity estimation is less than maybe 50 Mbps, it just uses 50 Mbps as a default value. And then there needs to be a warning handed to the sysadmin about those links. For now, that'd have to be on the console, unless there is some mechanism to bubble that up to the web UI?

trendal commented 1 year ago

I added some test code to our instance to try this out. Not certain at all it's the best path forward but it's better than having 60 Ghz links limited to 1 Mbps

def findApCapacities(devices, siteBandwidth):
    # Searches the UISP devices for APs and adds their capacities to the siteBandwidth dictionary.
    for device in devices:
        if device['identification']['role'] == "ap":
            name = device['identification']['name']
            if not name in siteBandwidth and device['overview']['downlinkCapacity'] and device['overview']['uplinkCapacity']:
                download = int(device['overview']
                               ['downlinkCapacity'] / 1000000)
                upload = int(device['overview']['uplinkCapacity'] / 1000000)

                if download < 15:
                    print("WARNING! " + device['identification']['hostname'] + " low download capacity")
                    download = 999

                if upload < 15:
                    print("WARNING! " + device['identification']['hostname'] + " low upload capacity")
                    upload = 999

                siteBandwidth[device['identification']['name']] = {
                    "download": download, "upload": upload}

Apparently there is some other math going on somewhere else because my default 999 Mbps values show up in network.json as DL 975 UL 487. If I comment out my test code, it goes back to DL 1 UL 1

thebracket commented 1 year ago

I'm going to have to confirm it, but a very quick test here showed that UISP's estimate for capacity on our (single, test) Wave AP link is way, way, way off. To the point that I'm wondering if its in a different unit to every other device in the system!

Update: looking at the wave AP "downlinkCapacity" score, it claims a capacity of 108.43 Mbps in UISP (after the divide by 1,000,000 . I'm kinda baffled as to how it came up with that number. It's definitely not the 60ghz capacity, and it's close - but quite a bit off - the 5 ghz capacity.

rchac commented 1 year ago

@trendal Added here https://github.com/LibreQoE/LibreQoS/pull/335/commits/e5d70d4e7a0f07c406d3e551511ef46c1c7cb060