Local debugging
This commit is contained in:
@@ -8,6 +8,7 @@ from dataclasses import dataclass
|
|||||||
import telnetlib
|
import telnetlib
|
||||||
import csv
|
import csv
|
||||||
import threading
|
import threading
|
||||||
|
import time
|
||||||
import argparse
|
import argparse
|
||||||
try:
|
try:
|
||||||
import queue
|
import queue
|
||||||
@@ -16,7 +17,7 @@ except ImportError:
|
|||||||
|
|
||||||
PORT = 26000
|
PORT = 26000
|
||||||
NEXT = 1
|
NEXT = 1
|
||||||
WORKERS = 5
|
WORKERS = 1
|
||||||
|
|
||||||
NET_MASK = "255.255.0.0"
|
NET_MASK = "255.255.0.0"
|
||||||
GATEWAY = "10.250.0.0.255.255.0.0.0.172.16.0.1"
|
GATEWAY = "10.250.0.0.255.255.0.0.0.172.16.0.1"
|
||||||
@@ -57,8 +58,10 @@ class INUeCommand():
|
|||||||
def get_command(self):
|
def get_command(self):
|
||||||
"""Get the command, as either a get or set, based on the value."""
|
"""Get the command, as either a get or set, based on the value."""
|
||||||
if self.value:
|
if self.value:
|
||||||
|
print ('set %s %s %s\n' % (self.command, self.position, self.value))
|
||||||
return ('set %s %s %s\n' % (self.command, self.position, self.value)).encode('ascii')
|
return ('set %s %s %s\n' % (self.command, self.position, self.value)).encode('ascii')
|
||||||
else:
|
else:
|
||||||
|
print ('get %s %s\n' % (self.command, self.position))
|
||||||
return ('get %s %s\n' % (self.command, self.position)).encode('ascii')
|
return ('get %s %s\n' % (self.command, self.position)).encode('ascii')
|
||||||
|
|
||||||
def send_config(telnet, inue_command):
|
def send_config(telnet, inue_command):
|
||||||
@@ -113,8 +116,10 @@ class Worker(threading.Thread):
|
|||||||
with telnetlib.Telnet(inue, PORT) as telnet:
|
with telnetlib.Telnet(inue, PORT) as telnet:
|
||||||
for slot in range(1, 10):
|
for slot in range(1, 10):
|
||||||
if send_config(telnet,
|
if send_config(telnet,
|
||||||
INUeCommand("Slot%s_I" % slot, "ceConfigBridgeStpMode")):
|
INUeCommand("Slot%s_I" % slot, "ceConfigBridgeStpMode")) == b'1':
|
||||||
rstp_dac = slot
|
rstp_dac = slot
|
||||||
|
break
|
||||||
|
print(rstp_dac)
|
||||||
|
|
||||||
if not rstp_dac:
|
if not rstp_dac:
|
||||||
self.__failed.put(inue)
|
self.__failed.put(inue)
|
||||||
@@ -126,10 +131,11 @@ class Worker(threading.Thread):
|
|||||||
]
|
]
|
||||||
|
|
||||||
elif CLEANUP:
|
elif CLEANUP:
|
||||||
|
print('cleanup')
|
||||||
commands = [
|
commands = [
|
||||||
INUeCommand("Slot%s_I" % rstp_dac, "ceConfigNmsVid", 0, 0),
|
INUeCommand("Slot%s_I" % rstp_dac, "ceConfigNmsVid", 0, 0),
|
||||||
INUeCommand("Terminal_I", "ipConfigAdEntAddress", rstp_dac + 1, '0.0.0.0'),
|
INUeCommand("Terminal_I", "ipConfigAdEntAddress", rstp_dac + 1, '0.0.0.0'),
|
||||||
INUeCommand("Terminal_I", "ipConfigAdEntNetMask", rstp_dac + 1, '0.0.0.0'),
|
INUeCommand("Terminal_I", "ipConfigAdEntNetMask", rstp_dac + 1, '255.255.255.255'),
|
||||||
# INUeCommand("Terminal_I", "ipConfigAutoroutingOspfEnable", rstp_dac + 1, 2),
|
# INUeCommand("Terminal_I", "ipConfigAutoroutingOspfEnable", rstp_dac + 1, 2),
|
||||||
# INUeCommand("Terminal_I", "ipCidrRouteIfIndex", rstp_dac + 48, GATEWAY, True),
|
# INUeCommand("Terminal_I", "ipCidrRouteIfIndex", rstp_dac + 48, GATEWAY, True),
|
||||||
]
|
]
|
||||||
@@ -160,6 +166,12 @@ class Worker(threading.Thread):
|
|||||||
self.__failed.put(inue)
|
self.__failed.put(inue)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if CLEANUP:
|
||||||
|
new_ip = inue
|
||||||
|
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with telnetlib.Telnet(new_ip, PORT) as telnet:
|
with telnetlib.Telnet(new_ip, PORT) as telnet:
|
||||||
self.__passed.put(new_ip)
|
self.__passed.put(new_ip)
|
||||||
|
|||||||
Reference in New Issue
Block a user