diff --git a/src/integrationUISP.py b/src/integrationUISP.py index 55fb3411..9c73e745 100644 --- a/src/integrationUISP.py +++ b/src/integrationUISP.py @@ -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() diff --git a/src/ispConfig.example.py b/src/ispConfig.example.py index cbca50ff..9da3813c 100644 --- a/src/ispConfig.example.py +++ b/src/ispConfig.example.py @@ -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']