diff --git a/aviat_config.py b/aviat_config.py index d8dbf34..08bd79b 100755 --- a/aviat_config.py +++ b/aviat_config.py @@ -38,13 +38,11 @@ class INUeCommand(): reverse: bool = False def __post_init__(self): - print("Context %s" % self.context) if self.reverse: self.position, self.value = self.value, self.position def get_context(self): """Get the context of the command, ready to send.""" - print (self.context) return ("contextid %s\n" % self.context).encode('ascii') def get_command(self): @@ -105,7 +103,6 @@ class Worker(threading.Thread): try: with telnetlib.Telnet(inue, PORT) as telnet: for slot in range(1, 10): - print("Slot: %s" % slot) if send_config(telnet, INUeCommand("Slot%s_I" % slot, "ceConfigBridgeStpMode")): rstp_dac = slot @@ -114,26 +111,26 @@ class Worker(threading.Thread): self.__failed.put(inue) continue - commands = [ - INUeCommand("Slot%s_I" % rstp_dac, "ceConfigNmsVid", 0, VLAN), - INUeCommand("Terminal_I", "ipConfigAdEntAddress", rstp_dac + 1, new_ip), - INUeCommand("Terminal_I", "ipConfigAdEntelnetET_MASK", rstp_dac + 1, NET_MASK), - INUeCommand("Terminal_I", "ipConfigAutoroutingOspfEnable", rstp_dac + 1, 2), - INUeCommand("Terminal_I", "ipCidrRouteIfIndex", rstp_dac + 48, GATEWAY, True), - ] + commands = [ + INUeCommand("Slot%s_I" % rstp_dac, "ceConfigNmsVid", 0, VLAN), + INUeCommand("Terminal_I", "ipConfigAdEntAddress", rstp_dac + 1, new_ip), + INUeCommand("Terminal_I", "ipConfigAdEntelnetET_MASK", rstp_dac + 1, NET_MASK), + INUeCommand("Terminal_I", "ipConfigAutoroutingOspfEnable", rstp_dac + 1, 2), + INUeCommand("Terminal_I", "ipCidrRouteIfIndex", rstp_dac + 48, GATEWAY, True), + ] - fail = False + fail = False - for command in commands: - if not send_config(telnet, command): - self.__failed.put(inue) - fail = True + for command in commands: + if not send_config(telnet, command): + self.__failed.put(inue) + fail = True + break + + if fail: continue - if fail: - continue - - commit_save(telnet) + commit_save(telnet) except OSError: self.__failed.put(inue)