Merge pull request #329 from LibreQoE/allowOverrideNetworkJSON

Offer toggle to overwrite Network.json on each integration reload. Disabled by default.
This commit is contained in:
Robert Chacón 2023-04-11 10:41:40 -06:00 committed by GitHub
commit 27c5ce59bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 3 deletions

View File

@ -3,8 +3,12 @@ checkPythonVersion()
import requests
import os
import csv
from ispConfig import uispSite, uispStrategy
from integrationCommon import isIpv4Permitted, fixSubnet
try:
from ispConfig import uispSite, uispStrategy, overwriteNetworkJSONalways
except:
from ispConfig import uispSite, uispStrategy
overwriteNetworkJSONalways = False
def uispRequest(target):
# Sends an HTTP request to UISP and returns the
@ -71,7 +75,10 @@ def buildFlatGraph():
net.prepareTree()
net.plotNetworkGraph(False)
if net.doesNetworkJsonExist():
print("network.json already exists. Leaving in-place.")
if overwriteNetworkJSONalways:
net.createNetworkJson()
else:
print("network.json already exists and overwriteNetworkJSONalways set to False. Leaving in-place.")
else:
net.createNetworkJson()
net.createShapedDevices()
@ -362,7 +369,10 @@ def buildFullGraph():
net.prepareTree()
net.plotNetworkGraph(False)
if net.doesNetworkJsonExist():
print("network.json already exists. Leaving in-place.")
if overwriteNetworkJSONalways:
net.createNetworkJson()
else:
print("network.json already exists and overwriteNetworkJSONalways set to False. Leaving in-place.")
else:
net.createNetworkJson()
net.createShapedDevices()

View File

@ -63,6 +63,9 @@ influxDBtoken = ""
# Use Customer Name or Address as Circuit Name
circuitNameUseAddress = True
# Should integrationUISP overwrite network.json on each run?
overwriteNetworkJSONalways = False
# If a device shows a WAN IP within these subnets, assume they are behind NAT / un-shapable, and ignore them
ignoreSubnets = ['192.168.0.0/16']
allowedSubnets = ['100.64.0.0/10']