Damn indents!

This commit is contained in:
Adrian Woodley
2019-07-23 02:17:32 +08:00
parent cd72f6cb7d
commit baf08f0001

View File

@@ -38,13 +38,11 @@ class INUeCommand():
reverse: bool = False reverse: bool = False
def __post_init__(self): def __post_init__(self):
print("Context %s" % self.context)
if self.reverse: if self.reverse:
self.position, self.value = self.value, self.position self.position, self.value = self.value, self.position
def get_context(self): def get_context(self):
"""Get the context of the command, ready to send.""" """Get the context of the command, ready to send."""
print (self.context)
return ("contextid %s\n" % self.context).encode('ascii') return ("contextid %s\n" % self.context).encode('ascii')
def get_command(self): def get_command(self):
@@ -105,7 +103,6 @@ class Worker(threading.Thread):
try: try:
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):
print("Slot: %s" % slot)
if send_config(telnet, if send_config(telnet,
INUeCommand("Slot%s_I" % slot, "ceConfigBridgeStpMode")): INUeCommand("Slot%s_I" % slot, "ceConfigBridgeStpMode")):
rstp_dac = slot rstp_dac = slot
@@ -114,26 +111,26 @@ class Worker(threading.Thread):
self.__failed.put(inue) self.__failed.put(inue)
continue continue
commands = [ commands = [
INUeCommand("Slot%s_I" % rstp_dac, "ceConfigNmsVid", 0, VLAN), INUeCommand("Slot%s_I" % rstp_dac, "ceConfigNmsVid", 0, VLAN),
INUeCommand("Terminal_I", "ipConfigAdEntAddress", rstp_dac + 1, new_ip), INUeCommand("Terminal_I", "ipConfigAdEntAddress", rstp_dac + 1, new_ip),
INUeCommand("Terminal_I", "ipConfigAdEntelnetET_MASK", rstp_dac + 1, NET_MASK), INUeCommand("Terminal_I", "ipConfigAdEntelnetET_MASK", rstp_dac + 1, NET_MASK),
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),
] ]
fail = False fail = False
for command in commands: for command in commands:
if not send_config(telnet, command): if not send_config(telnet, command):
self.__failed.put(inue) self.__failed.put(inue)
fail = True fail = True
break
if fail:
continue continue
if fail: commit_save(telnet)
continue
commit_save(telnet)
except OSError: except OSError:
self.__failed.put(inue) self.__failed.put(inue)