Weird object shit happening

This commit is contained in:
Adrian Woodley
2019-07-23 01:13:19 +08:00
parent d5aef07207
commit cd72f6cb7d

View File

@@ -31,8 +31,8 @@ ARG_PARSER.add_argument('csv')
@dataclass @dataclass
class INUeCommand(): class INUeCommand():
"""Command to be sent to an INUe, including the context and possible value""" """Command to be sent to an INUe, including the context and possible value"""
context: str context: str = ""
command: str command: str = ""
position: int = 0 position: int = 0
value: int = None value: int = None
reverse: bool = False reverse: bool = False
@@ -44,7 +44,7 @@ class INUeCommand():
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 ("contextid %s\n" % self.context).encode('ascii') 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):
@@ -104,7 +104,7 @@ 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, 9): for slot in range(1, 10):
print("Slot: %s" % slot) print("Slot: %s" % slot)
if send_config(telnet, if send_config(telnet,
INUeCommand("Slot%s_I" % slot, "ceConfigBridgeStpMode")): INUeCommand("Slot%s_I" % slot, "ceConfigBridgeStpMode")):
@@ -115,11 +115,11 @@ class Worker(threading.Thread):
continue continue
commands = [ commands = [
INUeCommand("Slot%s_I" % slot, "ceConfigNmsVid", 0, VLAN), INUeCommand("Slot%s_I" % rstp_dac, "ceConfigNmsVid", 0, VLAN),
INUeCommand("Terminal_I", "ipConfigAdEntAddress", slot + 1, new_ip), INUeCommand("Terminal_I", "ipConfigAdEntAddress", rstp_dac + 1, new_ip),
INUeCommand("Terminal_I", "ipConfigAdEntelnetET_MASK", slot + 1, NET_MASK), INUeCommand("Terminal_I", "ipConfigAdEntelnetET_MASK", rstp_dac + 1, NET_MASK),
INUeCommand("Terminal_I", "ipConfigAutoroutingOspfEnable", slot + 1, 2), INUeCommand("Terminal_I", "ipConfigAutoroutingOspfEnable", rstp_dac + 1, 2),
INUeCommand("Terminal_I", "ipCidrRouteIfIndex", slot + 48, GATEWAY, True), INUeCommand("Terminal_I", "ipCidrRouteIfIndex", rstp_dac + 48, GATEWAY, True),
] ]
fail = False fail = False