From cd72f6cb7d8cc665d7d17b674424d5181327d65b Mon Sep 17 00:00:00 2001 From: Adrian Woodley Date: Tue, 23 Jul 2019 01:13:19 +0800 Subject: [PATCH] Weird object shit happening --- aviat_config.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/aviat_config.py b/aviat_config.py index 558f14a..d8dbf34 100755 --- a/aviat_config.py +++ b/aviat_config.py @@ -31,8 +31,8 @@ ARG_PARSER.add_argument('csv') @dataclass class INUeCommand(): """Command to be sent to an INUe, including the context and possible value""" - context: str - command: str + context: str = "" + command: str = "" position: int = 0 value: int = None reverse: bool = False @@ -44,7 +44,7 @@ class INUeCommand(): def get_context(self): """Get the context of the command, ready to send.""" - print ("contextid %s\n" % self.context).encode('ascii') + print (self.context) return ("contextid %s\n" % self.context).encode('ascii') def get_command(self): @@ -104,7 +104,7 @@ class Worker(threading.Thread): try: with telnetlib.Telnet(inue, PORT) as telnet: - for slot in range(1, 9): + for slot in range(1, 10): print("Slot: %s" % slot) if send_config(telnet, INUeCommand("Slot%s_I" % slot, "ceConfigBridgeStpMode")): @@ -115,11 +115,11 @@ class Worker(threading.Thread): 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), + 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