diff --git a/aviat_config.py b/aviat_config.py index fc700f7..8cb205d 100755 --- a/aviat_config.py +++ b/aviat_config.py @@ -26,7 +26,10 @@ VLAN = 4095 ARG_PARSER = argparse.ArgumentParser( description='Scriptable configuration of Aviat Eclipse INUes.') -ARG_PARSER.add_argument('csv') +ARG_PARSER.add_argument('--in', action="store", dest="in_file") +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) +arguments = ARG_PARSER.parse_args() @dataclass class INUeCommand(): @@ -123,7 +126,6 @@ class Worker(threading.Thread): for command in commands: if not send_config(telnet, command): - print(command.get_command()) self.__failed.put(inue) fail = True break @@ -189,7 +191,7 @@ def passed_output(): count = WORKERS field_names = ['IP Address'] - with open('/tmp/aviat.csv', 'w', newline='') as out_file: + with open(OUTFILEPATH, 'w', newline='') as out_file: csv_writer = csv.DictWriter(out_file, fieldnames=field_names, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) @@ -225,7 +227,9 @@ FAILED_QUEUE = queue.Queue(0) # for i in range(WORKERS): # INUE_QUEUE.put(None) -INFILEPATH = sys.argv[1] +# INFILEPATH = sys.argv[1] +INFILEPATH = arguments.in_file +OUTFILEPATH = arguments.out_file input_inues()