Nasty fix

This commit is contained in:
Adrian Woodley
2019-07-23 00:22:58 +08:00
parent eaf32dca13
commit 67485311e9

View File

@@ -96,55 +96,53 @@ class Worker(threading.Thread):
self.__passed.put(None)
self.__failed.put(None)
break
print('Here')
else:
new_ip = inue.replace(OLD_SUBNET, NEW_SUBNET)
rstp_dac = 0
new_ip = inue.replace(OLD_SUBNET, NEW_SUBNET)
try:
with telnetlib.Telnet(inue, PORT) as telnet:
for slot in range(1, 9):
if send_config(telnet,
INUeCommand("Slot%s_I" % slot, "ceConfigBridgeStpMode")):
rstp_dac = slot
rstp_dac = 0
if not rstp_dac:
self.__failed.put(inue)
continue
try:
with telnetlib.Telnet(inue, PORT) as telnet:
for slot in range(1, 9):
if send_config(telnet,
INUeCommand("Slot%s_I" % slot, "ceConfigBridgeStpMode")):
rstp_dac = slot
commands = [
INUeCommand("Slot%s_I" % slot, "ceConfigNmsVid", 0, VLAN),
INUeCommand("Terminal_I", "ipConfigAdEntAddress", slot + 1, new_ip),
INUeCommand("Terminal_I", "ipConfigAdEntelnetET_MASK", slot + 1, NET_MASK),
INUeCommand("Terminal_I", "ipConfigAutoroutingOspfEnable", slot + 1, 2),
INUeCommand("Terminal_I", "ipCidrRouteIfIndex", slot + 48, GATEWAY, True),
]
if not rstp_dac:
self.__failed.put(inue)
fail = False
for command in commands:
if not send_config(telnet, command):
self.__failed.put(inue)
fail = True
continue
if fail:
continue
commands = [
INUeCommand("Slot%s_I" % slot, "ceConfigNmsVid", 0, VLAN),
INUeCommand("Terminal_I", "ipConfigAdEntAddress", slot + 1, new_ip),
INUeCommand("Terminal_I", "ipConfigAdEntelnetET_MASK", slot + 1, NET_MASK),
INUeCommand("Terminal_I", "ipConfigAutoroutingOspfEnable", slot + 1, 2),
INUeCommand("Terminal_I", "ipCidrRouteIfIndex", slot + 48, GATEWAY, True),
]
commit_save(telnet)
fail = False
for command in commands:
if not send_config(telnet, command):
self.__failed.put(inue)
fail = True
continue
if fail:
except OSError:
self.__failed.put(inue)
continue
commit_save(telnet)
except OSError:
self.__failed.put(inue)
continue
try:
with telnetlib.Telnet(new_ip, PORT) as telnet:
self.__passed.put(new_ip)
except OSError:
FAILED_QUEUE.put(inue)
continue
try:
with telnetlib.Telnet(new_ip, PORT) as telnet:
self.__passed.put(new_ip)
except OSError:
FAILED_QUEUE.put(inue)
continue
def input_inues():