Added OSPF and CLEANUP

This commit is contained in:
Adrian Woodley
2019-07-23 02:50:36 +08:00
parent 1941c31108
commit 7cab7836b2

View File

@@ -29,8 +29,14 @@ ARG_PARSER = argparse.ArgumentParser(
ARG_PARSER.add_argument('--in', action="store", dest="in_file", required=True) ARG_PARSER.add_argument('--in', action="store", dest="in_file", required=True)
ARG_PARSER.add_argument('--out', action="store", dest="out_file", default="passed.csv") ARG_PARSER.add_argument('--out', action="store", dest="out_file", default="passed.csv")
ARG_PARSER.add_argument('--area', action="store", dest="ospf_area", default=None) ARG_PARSER.add_argument('--area', action="store", dest="ospf_area", default=None)
ARG_PARSER.add_argument('--cleanup', action="store_true")
arguments = ARG_PARSER.parse_args() arguments = ARG_PARSER.parse_args()
INFILEPATH = arguments.in_file
OUTFILEPATH = arguments.out_file
OSPF_AREA = arguments.ospf_area
CLEANUP = arguments.cleanup
@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"""
@@ -114,6 +120,12 @@ class Worker(threading.Thread):
self.__failed.put(inue) self.__failed.put(inue)
continue continue
if OSPF_AREA:
commands = [
INUeCommand("Terminal_I", "ipConfigOspfAreaId", 1, OSPF_AREA)
]
else if CLEANUP:
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),
@@ -122,6 +134,15 @@ class Worker(threading.Thread):
INUeCommand("Terminal_I", "ipCidrRouteIfIndex", rstp_dac + 48, GATEWAY, True), INUeCommand("Terminal_I", "ipCidrRouteIfIndex", rstp_dac + 48, GATEWAY, True),
] ]
else:
commands = [
INUeCommand("Slot%s_I" % rstp_dac, "ceConfigNmsVid", 0, 0),
INUeCommand("Terminal_I", "ipConfigAdEntAddress", rstp_dac + 1, '0.0.0.0'),
INUeCommand("Terminal_I", "ipConfigAdEntNetMask", rstp_dac + 1, '0.0.0.0'),
# 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: for command in commands:
@@ -215,22 +236,6 @@ INUE_QUEUE = queue.Queue(0)
PASSED_QUEUE = queue.Queue(0) PASSED_QUEUE = queue.Queue(0)
FAILED_QUEUE = queue.Queue(0) FAILED_QUEUE = queue.Queue(0)
# for i in range(WORKERS):
# Worker(INUE_QUEUE, PASSED_QUEUE, FAILED_QUEUE).start()
# for INUE in sys.argv:
# if NEXT:
# NEXT=0
# else:
# INUE_QUEUE.put(INUE)
# for i in range(WORKERS):
# INUE_QUEUE.put(None)
# INFILEPATH = sys.argv[1]
INFILEPATH = arguments.in_file
OUTFILEPATH = arguments.out_file
input_inues() input_inues()
for worker in range(WORKERS): for worker in range(WORKERS):