mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2024-11-24 09:10:16 -06:00
Fix pertaining to https://github.com/LibreQoE/LibreQoS/issues/273
Ensure client is active before attempting to pull plan info
This commit is contained in:
parent
da42238332
commit
912099cf3d
@ -70,44 +70,45 @@ def createShaper():
|
|||||||
# devices on a shared tariff. Creating each service as a combined
|
# devices on a shared tariff. Creating each service as a combined
|
||||||
# entity including the customer, to be on the safe side.
|
# entity including the customer, to be on the safe side.
|
||||||
for customerJson in customers:
|
for customerJson in customers:
|
||||||
services = spylnxRequest("admin/customers/customer/" + customerJson["id"] + "/internet-services", headers)
|
if customerJson['status'] == 'active':
|
||||||
for serviceJson in services:
|
services = spylnxRequest("admin/customers/customer/" + customerJson["id"] + "/internet-services", headers)
|
||||||
combinedId = "c_" + str(customerJson["id"]) + "_s_" + str(serviceJson["id"])
|
for serviceJson in services:
|
||||||
tariff_id = serviceJson['tariff_id']
|
combinedId = "c_" + str(customerJson["id"]) + "_s_" + str(serviceJson["id"])
|
||||||
customer = NetworkNode(
|
tariff_id = serviceJson['tariff_id']
|
||||||
type=NodeType.client,
|
customer = NetworkNode(
|
||||||
id=combinedId,
|
type=NodeType.client,
|
||||||
displayName=customerJson["name"],
|
id=combinedId,
|
||||||
address=combineAddress(customerJson),
|
displayName=customerJson["name"],
|
||||||
download=downloadForTariffID[tariff_id],
|
address=combineAddress(customerJson),
|
||||||
upload=uploadForTariffID[tariff_id],
|
download=downloadForTariffID[tariff_id],
|
||||||
)
|
upload=uploadForTariffID[tariff_id],
|
||||||
net.addRawNode(customer)
|
)
|
||||||
|
net.addRawNode(customer)
|
||||||
|
|
||||||
ipv4 = ''
|
ipv4 = ''
|
||||||
ipv6 = ''
|
|
||||||
routerID = serviceJson['router_id']
|
|
||||||
# If not "Taking IPv4" (Router will assign IP), then use router's set IP
|
|
||||||
if serviceJson['taking_ipv4'] == 0:
|
|
||||||
ipv4 = ipForRouter[routerID]
|
|
||||||
elif serviceJson['taking_ipv4'] == 1:
|
|
||||||
ipv4 = serviceJson['ipv4']
|
|
||||||
# If not "Taking IPv6" (Router will assign IP), then use router's set IP
|
|
||||||
if serviceJson['taking_ipv6'] == 0:
|
|
||||||
ipv6 = ''
|
ipv6 = ''
|
||||||
elif serviceJson['taking_ipv6'] == 1:
|
routerID = serviceJson['router_id']
|
||||||
ipv6 = serviceJson['ipv6']
|
# If not "Taking IPv4" (Router will assign IP), then use router's set IP
|
||||||
|
if serviceJson['taking_ipv4'] == 0:
|
||||||
|
ipv4 = ipForRouter[routerID]
|
||||||
|
elif serviceJson['taking_ipv4'] == 1:
|
||||||
|
ipv4 = serviceJson['ipv4']
|
||||||
|
# If not "Taking IPv6" (Router will assign IP), then use router's set IP
|
||||||
|
if serviceJson['taking_ipv6'] == 0:
|
||||||
|
ipv6 = ''
|
||||||
|
elif serviceJson['taking_ipv6'] == 1:
|
||||||
|
ipv6 = serviceJson['ipv6']
|
||||||
|
|
||||||
device = NetworkNode(
|
device = NetworkNode(
|
||||||
id=combinedId+"_d" + str(serviceJson["id"]),
|
id=combinedId+"_d" + str(serviceJson["id"]),
|
||||||
displayName=serviceJson["description"],
|
displayName=serviceJson["description"],
|
||||||
type=NodeType.device,
|
type=NodeType.device,
|
||||||
parentId=combinedId,
|
parentId=combinedId,
|
||||||
mac=serviceJson["mac"],
|
mac=serviceJson["mac"],
|
||||||
ipv4=[ipv4],
|
ipv4=[ipv4],
|
||||||
ipv6=[ipv6]
|
ipv6=[ipv6]
|
||||||
)
|
)
|
||||||
net.addRawNode(device)
|
net.addRawNode(device)
|
||||||
|
|
||||||
net.prepareTree()
|
net.prepareTree()
|
||||||
net.plotNetworkGraph(False)
|
net.plotNetworkGraph(False)
|
||||||
|
Loading…
Reference in New Issue
Block a user