Scripts for generating subnets and devices.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python3
|
||||
from netaddr import IPNetwork
|
||||
#from netaddr import IPAddress
|
||||
from ipaddress import IPv4Address
|
||||
from xmlrpc.client import ServerProxy
|
||||
#import sqlite3
|
||||
import socket
|
||||
@@ -59,6 +59,9 @@ Settings = [
|
||||
'Site-Address',
|
||||
'System-Location',
|
||||
'Site-Notes',
|
||||
'IP-Address',
|
||||
'Subnet-Mask',
|
||||
'Gateway-Address',
|
||||
'Float-Voltage',
|
||||
'Battery-Capacity',
|
||||
'AC-Rectifier-Current-Limit',
|
||||
@@ -92,6 +95,11 @@ Settings = [
|
||||
['Alarm-Severity'] + \
|
||||
['Alarm-Severity:' + repr(x) for x in range(1, 59)]
|
||||
|
||||
NetworkSettings = [
|
||||
'IP-Address',
|
||||
'Subnet-Mask',
|
||||
'Gateway-Address'
|
||||
]
|
||||
|
||||
def GetStatusCode(host, path="/"):
|
||||
try:
|
||||
@@ -134,7 +142,12 @@ class Worker(threading.Thread):
|
||||
else:
|
||||
break
|
||||
|
||||
if len(Values) > 0:
|
||||
if len(Values) > 0:
|
||||
for idx, setting in enumerate(Settings):
|
||||
if setting in NetworkSettings:
|
||||
print(Values[idx])
|
||||
Values[idx] = str(IPv4Address(Values[idx]))
|
||||
|
||||
Values.insert(0, str(IP))
|
||||
self.__Results.put(Values)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user