Update integrationUISP.py

This commit is contained in:
Robert Chacón 2023-04-14 14:45:13 -06:00 committed by GitHub
parent 13f0df7e0c
commit 2d3ff07f9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -283,19 +283,7 @@ def findNodesBranchedOffPtMP(siteList, dataLinks, sites, rootSite):
}
return nodeOffPtMP
def buildFullGraph():
# Attempts to build a full network graph, incorporating as much of the UISP
# hierarchy as possible.
from integrationCommon import NetworkGraph, NetworkNode, NodeType
from ispConfig import uispSite, generatedPNUploadMbps, generatedPNDownloadMbps
# Load network sites
print("Loading Data from UISP")
sites = uispRequest("sites")
devices = uispRequest("devices?withInterfaces=true&authorized=true")
dataLinks = uispRequest("data-links?siteLinksOnly=true")
# If multiple Internet-connected sites, create Internet root node:
def handleMultipleInternetNodes(sites, dataLinks, uispSite):
internetConnectedSites = []
for link in dataLinks:
if link['canDelete'] == False:
@ -314,6 +302,22 @@ def buildFullGraph():
link['from']['site']['identification']['name'] = 'Internet'
# Found internet link
internetConnectedSites.append(siteID)
return(sites, dataLinks, uispSite)
def buildFullGraph():
# Attempts to build a full network graph, incorporating as much of the UISP
# hierarchy as possible.
from integrationCommon import NetworkGraph, NetworkNode, NodeType
from ispConfig import uispSite, generatedPNUploadMbps, generatedPNDownloadMbps
# Load network sites
print("Loading Data from UISP")
sites = uispRequest("sites")
devices = uispRequest("devices?withInterfaces=true&authorized=true")
dataLinks = uispRequest("data-links?siteLinksOnly=true")
# If multiple Internet-connected sites, create Internet root node:
sites, dataLinks, uispSite = handleMultipleInternetNodes(sites, dataLinks, uispSite)
# Build Site Capacities
print("Compiling Site Bandwidths")