mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-02 19:58:03 +00:00
test_l4: Make parser more explicit
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
@@ -61,7 +61,6 @@ if sys.version_info[0] != 3:
|
|||||||
print("This script requires Python 3")
|
print("This script requires Python 3")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../")))
|
sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../")))
|
||||||
|
|
||||||
lfcli_base = importlib.import_module("py-json.LANforge.lfcli_base")
|
lfcli_base = importlib.import_module("py-json.LANforge.lfcli_base")
|
||||||
@@ -257,41 +256,29 @@ python3 ./test_l4.py
|
|||||||
--test_duration 2m \\
|
--test_duration 2m \\
|
||||||
--debug
|
--debug
|
||||||
''')
|
''')
|
||||||
required = None
|
parser.add_argument('--requests_per_ten', help='--requests_per_ten number of request per ten minutes',
|
||||||
for agroup in parser._action_groups:
|
|
||||||
if agroup.title == "required arguments":
|
|
||||||
required = agroup
|
|
||||||
# if required is not None:
|
|
||||||
|
|
||||||
optional = None
|
|
||||||
for agroup in parser._action_groups:
|
|
||||||
if agroup.title == "optional arguments":
|
|
||||||
optional = agroup
|
|
||||||
|
|
||||||
if optional is not None:
|
|
||||||
optional.add_argument('--requests_per_ten', help='--requests_per_ten number of request per ten minutes',
|
|
||||||
default=600)
|
default=600)
|
||||||
optional.add_argument('--num_tests', help='--num_tests number of tests to run. Each test runs 10 minutes',
|
parser.add_argument('--num_tests', help='--num_tests number of tests to run. Each test runs 10 minutes',
|
||||||
default=1)
|
default=1)
|
||||||
optional.add_argument('--url', help='--url specifies upload/download, address, and dest',
|
parser.add_argument('--url', help='--url specifies upload/download, address, and dest',
|
||||||
default="dl http://10.40.0.1 /dev/null")
|
default="dl http://10.40.0.1 /dev/null")
|
||||||
optional.add_argument('--test_duration', help='duration of test', default="2m")
|
parser.add_argument('--test_duration', help='duration of test', default="2m")
|
||||||
optional.add_argument('--target_per_ten',
|
parser.add_argument('--target_per_ten',
|
||||||
help='--target_per_ten target number of request per ten minutes. test will check for 90 percent this value',
|
help='--target_per_ten target number of request per ten minutes. test will check for 90 percent this value',
|
||||||
default=600)
|
default=600)
|
||||||
optional.add_argument('--mode', help='Used to force mode of stations')
|
parser.add_argument('--mode', help='Used to force mode of stations')
|
||||||
optional.add_argument('--ap', help='Used to force a connection to a particular AP')
|
parser.add_argument('--ap', help='Used to force a connection to a particular AP')
|
||||||
optional.add_argument('--report_file', help='where you want to store results')
|
parser.add_argument('--report_file', help='where you want to store results')
|
||||||
optional.add_argument('--output_format', help='choose csv or xlsx') # update once other forms are completed
|
parser.add_argument('--output_format', help='choose csv or xlsx') # update once other forms are completed
|
||||||
optional.add_argument('--ftp', help='Use ftp for the test', action='store_true')
|
parser.add_argument('--ftp', help='Use ftp for the test', action='store_true')
|
||||||
optional.add_argument('--test_type', help='Choose type of test to run {urls, bytes-rd, bytes-wr}',
|
parser.add_argument('--test_type', help='Choose type of test to run {urls, bytes-rd, bytes-wr}',
|
||||||
default='bytes-rd')
|
default='bytes-rd')
|
||||||
optional.add_argument('--ftp_user', help='--ftp_user sets the username to be used for ftp', default=None)
|
parser.add_argument('--ftp_user', help='--ftp_user sets the username to be used for ftp', default=None)
|
||||||
optional.add_argument('--ftp_passwd', help='--ftp_user sets the password to be used for ftp', default=None)
|
parser.add_argument('--ftp_passwd', help='--ftp_user sets the password to be used for ftp', default=None)
|
||||||
optional.add_argument('--dest',
|
parser.add_argument('--dest',
|
||||||
help='--dest specifies the destination for the file, should be used when downloading',
|
help='--dest specifies the destination for the file, should be used when downloading',
|
||||||
default="/dev/null")
|
default="/dev/null")
|
||||||
optional.add_argument('--source',
|
parser.add_argument('--source',
|
||||||
help='--source specifies the source of the file, should be used when uploading',
|
help='--source specifies the source of the file, should be used when uploading',
|
||||||
default="/var/www/html/data_slug_4K.bin")
|
default="/var/www/html/data_slug_4K.bin")
|
||||||
|
|
||||||
@@ -305,15 +292,11 @@ python3 ./test_l4.py
|
|||||||
if args.output_format in ['csv', 'json', 'html', 'hdf', 'stata', 'pickle', 'pdf', 'parquet', 'png', 'df',
|
if args.output_format in ['csv', 'json', 'html', 'hdf', 'stata', 'pickle', 'pdf', 'parquet', 'png', 'df',
|
||||||
'xlsx']:
|
'xlsx']:
|
||||||
output_form = args.output_format.lower()
|
output_form = args.output_format.lower()
|
||||||
print("Defaulting file output placement to /home/lanforge.")
|
|
||||||
rpt_file = '/home/data.' + output_form
|
|
||||||
else:
|
else:
|
||||||
print("Defaulting data file output type to Excel")
|
print("Defaulting data file output type to Excel")
|
||||||
rpt_file = '/home/lanforge/data.xlsx'
|
|
||||||
output_form = 'xlsx'
|
output_form = 'xlsx'
|
||||||
|
|
||||||
else:
|
else:
|
||||||
rpt_file = args.report_file
|
|
||||||
if args.output_format is None:
|
if args.output_format is None:
|
||||||
output_form = str(args.report_file).split('.')[-1]
|
output_form = str(args.report_file).split('.')[-1]
|
||||||
else:
|
else:
|
||||||
@@ -336,18 +319,11 @@ python3 ./test_l4.py
|
|||||||
if args.output_format in ['csv', 'json', 'html', 'hdf', 'stata', 'pickle', 'pdf', 'png', 'df', 'parquet',
|
if args.output_format in ['csv', 'json', 'html', 'hdf', 'stata', 'pickle', 'pdf', 'png', 'df', 'parquet',
|
||||||
'xlsx']:
|
'xlsx']:
|
||||||
rpt_file = path + '/data.' + args.output_format
|
rpt_file = path + '/data.' + args.output_format
|
||||||
output = args.output_format
|
|
||||||
else:
|
else:
|
||||||
print('Defaulting data file output type to Excel')
|
print('Defaulting data file output type to Excel')
|
||||||
rpt_file = path + '/data.xlsx'
|
rpt_file = path + '/data.xlsx'
|
||||||
output = 'xlsx'
|
|
||||||
else:
|
else:
|
||||||
rpt_file = args.report_file
|
rpt_file = args.report_file
|
||||||
if args.output_format is None:
|
|
||||||
output = str(args.report_file).split('.')[-1]
|
|
||||||
else:
|
|
||||||
output = args.output_format
|
|
||||||
|
|
||||||
station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=10000,
|
station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=10000,
|
||||||
radio=args.radio)
|
radio=args.radio)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user