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.__passed.put(None)
self.__failed.put(None) self.__failed.put(None)
break 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: commands = [
with telnetlib.Telnet(inue, PORT) as telnet: INUeCommand("Slot%s_I" % slot, "ceConfigNmsVid", 0, VLAN),
for slot in range(1, 9): INUeCommand("Terminal_I", "ipConfigAdEntAddress", slot + 1, new_ip),
if send_config(telnet, INUeCommand("Terminal_I", "ipConfigAdEntelnetET_MASK", slot + 1, NET_MASK),
INUeCommand("Slot%s_I" % slot, "ceConfigBridgeStpMode")): INUeCommand("Terminal_I", "ipConfigAutoroutingOspfEnable", slot + 1, 2),
rstp_dac = slot INUeCommand("Terminal_I", "ipCidrRouteIfIndex", slot + 48, GATEWAY, True),
]
if not rstp_dac: fail = False
self.__failed.put(inue)
for command in commands:
if not send_config(telnet, command):
self.__failed.put(inue)
fail = True
continue
if fail:
continue continue
commands = [ commit_save(telnet)
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),
]
fail = False except OSError:
self.__failed.put(inue)
for command in commands:
if not send_config(telnet, command):
self.__failed.put(inue)
fail = True
continue
if fail:
continue continue
commit_save(telnet) try:
with telnetlib.Telnet(new_ip, PORT) as telnet:
except OSError: self.__passed.put(new_ip)
self.__failed.put(inue) except OSError:
continue 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(): def input_inues():