def main(): lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='test_ipv6_connection.py', # formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Create stations that attempt to authenticate, associate, and receive IPV6 addresses on the chosen SSID ''', description='''\ test_ipv6_connection.py: -------------------- Generic command example: python3 ./test_ipv6_connection.py --upstream_port eth1 \\ --radio wiphy0 \\ --num_stations 3 \\ --security {open|wep|wpa|wpa2|wpa3} \\ --ssid netgear \\ --passwd admin123 \\ --dest 10.40.0.1 \\ --test_duration 2m \\ --interval 1s \\ -- timeout 120 \\ --debug ''') parser.add_argument('--timeout', help='--timeout sets the length of time to wait until a connection is successful', default=120) args = parser.parse_args() num_sta=2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000, radio=args.radio) ipv6_test = IPv6Test(host=args.mgr, port=args.mgr_port, ssid=args.ssid, password=args.passwd, security=args.security, sta_list=station_list) ipv6_test.cleanup(station_list) ipv6_test.build() if not ipv6_test.passes(): print(ipv6_test.get_fail_message()) exit(1) ipv6_test.start(station_list, False, False) ipv6_test.stop() if not ipv6_test.passes(): print(ipv6_test.get_fail_message()) exit(1) time.sleep(10) ipv6_test.cleanup(station_list) if ipv6_test.passes(): print("Full test passed, all stations associated and got IP")
def main(): lfjson_host = "localhost" lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='example_wpa_connection.py', # formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Example code that creates a specified amount of stations on a specified SSID using WPA security. ''', description='''\ example_wpa_connection.py -------------------- Generic command example: python3 ./example_wpa_connection.py \\ --host localhost (optional) \\ --port 8080 (optional) \\ --num_stations 3 \\ --ssid netgear-wpa \\ --passwd admin123-wpa \\ --radio wiphy1 --debug ''') parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m") parser.add_argument( '--url', help='--url specifies upload/download, address, and dest', default="dl http://10.40.0.1 /dev/null") args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=10000, radio=args.radio) ip_test = IPv4Test(lfjson_host, lfjson_port, ssid=args.ssid, password=args.passwd, radio=args.radio, security="wpa", sta_list=station_list) ip_test.cleanup(station_list) ip_test.timeout = 60 ip_test.build()
def main(): lfjson_host = "localhost" lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='example_wpa3_connection.py', # formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Example code that creates a specified amount of stations on a specified SSID using WPA3 security. ''', description='''\ example_wpa_connection.py -------------------- Generic command example: python3 ./example_wpa_connection.py \\ --host localhost (optional) \\ --port 8080 (optional) \\ --num_stations 3 \\ --security {open|wep|wpa|wpa2|wpa3} \\ --ssid netgear-wpa3 \\ --passwd admin123-wpa3 \\ --debug Note: multiple --radio switches may be entered up to the number of radios available: --radio wiphy0 <stations> <ssid> <ssid password> --radio <radio 01> <number of last station> <ssid> <ssid password> ''') args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=10000, radio=args.radio) ip_test = IPv4Test(lfjson_host, lfjson_port, ssid=args.ssid, password=args.passwd, radio=args.radio, security=args.security, sta_list=station_list) ip_test.cleanup(station_list) ip_test.timeout = 60 ip_test.build()
def main(): lfjson_host = "localhost" lfjson_port = 8080 argparser = LFCliBase.create_basic_argparse( prog=__file__, formatter_class=argparse.RawTextHelpFormatter, epilog='''\ creates lots of stations across multiple radios. ''', description='''\ test_1k_clients_jedtest.py: -------------------- Generic command layout: python3 ./test_1k_clients_jedtest.py --sta_per_radio 300 --test_duration 3m --a_min 1000 --b_min 1000 --debug ''') argparser.add_argument("--sta_per_radio", type=int, help="number of stations per radio") argparser.add_argument("--test_duration", type=int, help="length of test duration") args = argparser.parse_args() kilo_test = Test1KClients(lfjson_host, lfjson_port, upstream=args.upstream_port, num_sta_=args.sta_per_radio, _debug_on=args.debug) kilo_test.pre_cleanup() kilo_test.build() if not kilo_test.passes(): kilo_test.exit_failed() kilo_test.start() if not kilo_test.passes(): kilo_test.exit_failed() kilo_test.stop() if not kilo_test.passes(): kilo_test.exit_failed() time.sleep(60) kilo_test.post_cleanup() kilo_test.exit_success()
def main(): lfjson_host = "localhost" lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='example_wpa3_connection.py', # formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Example code that creates a specified amount of stations on a specified SSID using WPA3 security. ''', description='''\ example_wpa3_connection.py -------------------- Generic command example: python3 ./example_wpa3_connection.py --host localhost (optional) --port 8080 (optional) --num_stations 3 --ssid netgear-wpa3 --passwd admin123-wpa3 --radio wiphy1 --debug ''') args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=10000, radio=args.radio) ip_test = IPv4Test(lfjson_host, lfjson_port, ssid=args.ssid, password=args.passwd, radio=args.radio, security="wpa3", sta_list=station_list) ip_test.cleanup(station_list) ip_test.timeout = 60 ip_test.build()
def main(): lfjson_host = "localhost" lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='example_security_connection.py', # formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Example flags and command line input to run the script. ''', description='''\ example_security_connection.py -------------------- This python script creates an inputted number of stations using user-inputted security. This verifies that the most basic form of security works with the LANforge device. -------------------- Generic command example: python3 ./example_security_connection.py \\ --host localhost (optional) \\ --port 8080 (optional) \\ --num_stations 6 \\ --radio wiphy2 --security {open|wep|wpa|wpa2|wpa3} \\ --ssid netgear-wpa3 \\ --passwd admin123-wpa3 \\ --debug ''') args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000, radio=args.radio) ip_test = IPv4Test(lfjson_host, lfjson_port, ssid=args.ssid, password=args.passwd, radio=args.radio, security=args.security, sta_list=station_list) ip_test.cleanup(station_list) ip_test.timeout = 60 ip_test.build()
def main(): parser = LFCliBase.create_basic_argparse( prog='example_open_connection.py', # formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Example code that creates a specified amount of stations on a specified SSID using Open security. ''', description='''\ example_open_connection.py -------------------- Generic command example: python3 ./example_open_connection.py --mgr localhost --mgr_port 8080 --num_stations 3 --radio wiphy1 --ssid netgear-open --passwd [BLANK] --debug ''') args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_sta = int(args.num_stations) station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000) ip_test = IPv4Test(host=args.mgr, port=args.mgr_port, ssid=args.ssid, password=args.passwd, security="open", radio=args.radio, sta_list=station_list) ip_test.cleanup(station_list) ip_test.timeout = 60 ip_test.build()
def main(): lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='test_ipv6_variable_time.py', # formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Create stations to test IPV6 connection and traffic on VAPs of varying security types (WEP, WPA, WPA2, WPA3, Open) ''', description='''\ test_ipv6_variable_time.py: -------------------- Generic command example: python3 ./test_ipv6_connection.py --upstream_port eth1 \\ --radio wiphy0 \\ --num_stations 3 \\ --security {open|wep|wpa|wpa2|wpa3} \\ --ssid netgear \\ --passwd admin123 \\ --dest 10.40.0.1 \\ --test_duration 2m \\ --interval 1s \\ --a_min 256000 \\ --b_min 256000 \\ --debug ''') parser.add_argument('--a_min', help='--a_min bps rate minimum for side_a', default=256000) parser.add_argument('--b_min', help='--b_min bps rate minimum for side_b', default=256000) parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m") args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000, radio=args.radio) ip_var_test = IPV6VariableTime(host=args.mgr, port=args.mgr_port, number_template="00", sta_list=station_list, name_prefix="VT", upstream=args.upstream_port, ssid=args.ssid, password=args.passwd, radio=args.radio, security=args.security, test_duration=args.test_duration, use_ht160=False, side_a_min_rate=args.a_min, side_b_min_rate=args.b_min, _debug_on=args.debug) ip_var_test.pre_cleanup() ip_var_test.build() if not ip_var_test.passes(): print(ip_var_test.get_fail_message()) exit(1) ip_var_test.start(False, False) ip_var_test.stop() if not ip_var_test.passes(): print(ip_var_test.get_fail_message()) exit(1) time.sleep(30) ip_var_test.cleanup() if ip_var_test.passes(): print("Full test passed, all connections increased rx bytes")
def main(): lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='test_ipv4_variable_time.py', # formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, description='''\ test_ipv4_variable_time.py: --------------------- Generic command layout: ./test_ipv4_variable_time.py --upstream_port eth1 --radio wiphy3 --num_stations 4 -ssid jedway-wpa2-x2048-4-1 -passwd jedway-wpa2-x2048-4-1 --security {wpa2|open|wpa|wpa3} --a_min 250000 --b_min 260000 --test_duration 2m --debug ''') parser.add_argument('--a_min', help='--a_min bps rate minimum for side_a', default=256000) parser.add_argument('--b_min', help='--b_min bps rate minimum for side_b', default=256000) parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m") args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000, radio=args.radio) ip_var_test = IPV4VariableTime(host=args.mgr, port=args.mgr_port, number_template="00", sta_list=station_list, name_prefix="VT", upstream=args.upstream_port, ssid=args.ssid, password=args.passwd, radio=args.radio, security=args.security, test_duration=args.test_duration, use_ht160=False, side_a_min_rate=args.a_min, side_b_min_rate=args.b_min, _debug_on=args.debug) ip_var_test.pre_cleanup() ip_var_test.build() if not ip_var_test.passes(): print(ip_var_test.get_fail_message()) exit(1) ip_var_test.start(False, False) ip_var_test.stop() if not ip_var_test.passes(): print(ip_var_test.get_fail_message()) exit(1) time.sleep(30) ip_var_test.cleanup() if ip_var_test.passes(): print("Full test passed, all connections increased rx bytes")
def main(): parser = LFCliBase.create_basic_argparse( prog='test_ipv6_connection.py', # formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Create stations that attempt to authenticate, associate, and receive IPV6 addresses on the chosen SSID ''', description='''\ test_ipv6_connection.py: -------------------------------------------------- Generic command example: python3 ./test_ipv6_connection.py --upstream_port eth1 --radio wiphy0 --num_stations 3 --proxy --security {open|wep|wpa|wpa2|wpa3} --ssid netgear --passwd admin123 --mode 1 --ap "00:0e:8e:78:e1:76" --test_id --timeout 120 --debug ''') required = None 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("--ap", help="Add BSSID of access point to connect to") optional.add_argument('--mode', help=LFCliBase.Help_Mode) optional.add_argument( '--timeout', help= '--timeout sets the length of time to wait until a connection is successful', default=30) args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=10000, radio=args.radio) ipv6_test = IPv6Test(host=args.mgr, port=args.mgr_port, ssid=args.ssid, password=args.passwd, security=args.security, ap=args.ap, mode=args.mode, sta_list=station_list, _debug_on=args.debug) ipv6_test.cleanup(station_list) ipv6_test.build() print('Sleeping for 30 seconds...', flush=True) time.sleep(30) if not ipv6_test.passes(): print(ipv6_test.get_fail_message()) exit(1) ipv6_test.start(station_list, False, False) ipv6_test.stop() if not ipv6_test.passes(): print(ipv6_test.get_fail_message()) exit(1) time.sleep(20) ipv6_test.cleanup(station_list) if ipv6_test.passes(): print("Full test passed, all stations associated and got IP")
def main(): lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='test_ipv4_l4_urls_per_ten', # formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Create layer-4 endpoints to connect to an ftp server and test that urls/s are meeting or exceeding the target rate ''', description='''\ test_ipv4_l4_ftp_urls_per_ten.py -------------------- Generic command example: python3 ./test_ipv4_l4_ftp_urls_per_ten.py --upstream_port eth1 \\ --radio wiphy0 \\ --num_stations 3 \\ --security {open|wep|wpa|wpa2|wpa3} \\ --ssid netgear \\ --passwd admin123 \\ --dest 10.40.0.1 \\ --test_duration 2m \\ --interval 1s \\ --requests_per_ten 600 \\ --num_tests 1 \\ --url "dl http://10.40.0.1 /dev/null" \\ --target_per_ten 600 \\ --debug ''') parser.add_argument('--requests_per_ten', help='--requests_per_ten number of request per ten minutes', default=600) parser.add_argument('--num_tests', help='--num_tests number of tests to run. Each test runs 10 minutes', default=1) parser.add_argument('--url', help='--url specifies upload/download, address, and dest', default="dl http://10.40.0.1 /dev/null") parser.add_argument('--target_per_ten', help='--target_per_ten target number of request per ten minutes. test will check for 90% of this value', default=600) args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000, radio=args.radio) ip_test = IPV4L4(args.mgr, lfjson_port, ssid=args.ssid, password=args.passwd, upstream_port=args.upstream_port,radio= args.radio, security=args.security, station_list=station_list, url=args.url, num_tests=args.num_tests, target_requests_per_ten=args.target_per_ten, requests_per_ten=args.requests_per_ten) ip_test.cleanup(station_list) ip_test.build() ip_test.start() ip_test.stop() if not ip_test.passes(): print(ip_test.get_fail_message()) exit(1) time.sleep(30) ip_test.cleanup(station_list) if ip_test.passes(): print("Full test passed, all endpoints met or exceeded 90% of the target rate")
def main(): parser = LFCliBase.create_basic_argparse( prog='test_ipv4_l4_urls_per_ten', formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Create layer-4 endpoints to connect to a url and test that urls/s are meeting or exceeding the target rate ''', description='''\ test_ipv4_l4_urls_per_ten.py: -------------------- Generic command example: python3 ./test_ipv4_l4_urls_per_ten.py --upstream_port eth1 \\ --radio wiphy0 \\ --num_stations 3 \\ --security {open|wep|wpa|wpa2|wpa3} \\ --ssid netgear \\ --passwd admin123 \\ --requests_per_ten 600 \\ --mode 1 {"auto" : "0", "a" : "1", "b" : "2", "g" : "3", "abg" : "4", "abgn" : "5", "bgn" : "6", "bg" : "7", "abgnAC" : "8", "anAC" : "9", "an" : "10", "bgnAC" : "11", "abgnAX" : "12", "bgnAX" : "13"} \\ --num_tests 1 \\ --url "dl http://10.40.0.1 /dev/null" \\ --ap "00:0e:8e:78:e1:76" --target_per_ten 600 \\ --output_format csv \\ --report_file ~/Documents/results.csv \\ --test_duration 2m \\ --debug ''') required = None 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) optional.add_argument('--num_tests', help='--num_tests number of tests to run. Each test runs 10 minutes', default=1) optional.add_argument('--url', help='--url specifies upload/download, address, and dest',default="dl http://10.40.0.1 /dev/null") optional.add_argument('--test_duration', help='duration of test',default="2m") optional.add_argument('--target_per_ten', help='--target_per_ten target number of request per ten minutes. test will check for 90 percent this value',default=600) optional.add_argument('--mode',help='Used to force mode of stations') optional.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') optional.add_argument('--output_format', help='choose csv or xlsx') #update once other forms are completed args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted if args.report_file is None: if args.output_format in ['csv','json','html','hdf','stata','pickle','pdf','parquet','png','df','xlsx']: output_form=args.output_format.lower() print("Defaulting file output placement to /home/lanforge.") rpt_file='/home/data.' + output_form else: print("Defaulting data file output type to Excel") rpt_file='/home/lanforge/data.xlsx' output_form='xlsx' else: rpt_file=args.report_file if args.output_format is None: output_form=str(args.report_file).split('.')[-1] else: output_form=args.output_format #Create directory if args.report_file is None: try: homedir = str(datetime.datetime.now().strftime("%Y-%m-%d-%H-%M")).replace(':','-')+'test_ipv4_l4_urls_per_ten' path = os.path.join('/home/lanforge/report-data/',homedir) os.mkdir(path) except: path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) print('Saving file to local directory') else: pass if args.report_file is None: if args.output_format in ['csv','json','html','hdf','stata','pickle','pdf','png','df','parquet','xlsx']: rpt_file=path+'/data.' + args.output_format output=args.output_format else: print('Defaulting data file output type to Excel') rpt_file=path+'/data.xlsx' output='xlsx' else: 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, radio=args.radio) ip_test = IPV4L4(host=args.mgr, port=args.mgr_port, ssid=args.ssid, password=args.passwd, radio=args.radio, upstream_port=args.upstream_port, security=args.security, station_list=station_list, url=args.url, mode=args.mode, ap=args.ap, _debug_on=args.debug, test_duration=args.test_duration, num_tests=args.num_tests, target_requests_per_ten=args.target_per_ten, requests_per_ten=args.requests_per_ten) ip_test.cleanup(station_list) ip_test.build() ip_test.start() try: layer4traffic=','.join([[*x.keys()][0] for x in ip_test.local_realm.json_get('layer4')['endpoint']]) except: pass ip_test.l4cxprofile.monitor(col_names=['bytes-rd', 'urls/s'], report_file=rpt_file, duration_sec=ip_test.local_realm.parse_time(args.test_duration).total_seconds(), created_cx=layer4traffic, output_format=output_form, script_name='test_ipv4_l4_urls_per_ten', arguments=args, debug=args.debug) ip_test.stop() if not ip_test.passes(): print(ip_test.get_fail_message()) exit(1) time.sleep(30) ip_test.cleanup(station_list) if ip_test.passes(): print("Full test passed, all endpoints met or exceeded 90 percent of the target rate")
def main(): lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='test_l3_WAN_LAN.py', # formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Useful Information: 1. TBD ''', description='''\ test_l3_WAN_LAN.py: -------------------- TBD ''') parser.add_argument('--a_min', help='--a_min bps rate minimum for side_a', default=256000) parser.add_argument('--b_min', help='--b_min bps rate minimum for side_b', default=256000) parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m") parser.add_argument( '--upstream_subnets', help='--upstream_subnets sets the subnets used by the upstream vrcx', default="20.20.20.0/24") parser.add_argument( '--upstream_nexthop', help= '--upstream_nexthop sets the nexthop used by the upstream vrcx, should be rdd gateway', default="20.20.20.1") parser.add_argument( '--local_subnets', help='--local_subnets sets the subnets used by the rdd vrcx', default="10.40.0.0/24") parser.add_argument( '--local_nexthop', help= '--local_nexthop sets the nexthop used by the upstream vrcx, should be upstream ip', default="10.40.3.198") parser.add_argument('--rdd_ip', help='--rdd_ip sets the ip to be used by the rdd', default="20.20.20.20") parser.add_argument( '--rdd_gateway', help='--rdd_gateway sets the gateway to be used by the rdd', default="20.20.20.1") parser.add_argument( '--rdd_netmask', help='--rdd_netmask sets the netmask to be used by the rdd', default="255.255.255.0") parser.add_argument( '--vr_name', help='--vr_name sets the name to be used by the virtual router', default="vr_test") args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=10000, radio=args.radio) ip_var_test = VRTest(args.mgr, lfjson_port, number_template="00", sta_list=station_list, name_prefix="VRT", upstream=args.upstream_port, ssid=args.ssid, password=args.passwd, radio=args.radio, security=args.security, test_duration=args.test_duration, use_ht160=False, side_a_min_rate=args.a_min, side_b_min_rate=args.b_min, _debug_on=args.debug, upstream_subnets=args.upstream_subnets, upstream_nexthop=args.upstream_nexthop, local_subnets=args.local_subnets, local_nexthop=args.local_nexthop, rdd_ip=args.rdd_ip, rdd_gateway=args.rdd_gateway, rdd_netmask=args.rdd_netmask, vr_name=args.vr_name) ip_var_test.pre_cleanup() ip_var_test.build() if not ip_var_test.passes(): print(ip_var_test.get_fail_message()) exit(1) ip_var_test.start(False, False) ip_var_test.stop() if not ip_var_test.passes(): print(ip_var_test.get_fail_message()) exit(1) time.sleep(30) ip_var_test.cleanup() if ip_var_test.passes(): print("Full test passed, all connections increased rx bytes")
def main(): lfjson_host = "localhost" lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='test_fileio.py', # formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog= '''Creates FileIO endpoints which can be NFS, CIFS or iSCSI endpoints.''', description='''\ test_fileio.py: -------------------- Generic command layout: python ./test_fileio.py --upstream_port <port> --radio <radio 0> <stations> <ssid> <ssid password> <security type: wpa2, open, wpa3> --debug Note: multiple --radio switches may be entered up to the number of radios available: --radio <radio 0> <stations> <ssid> <ssid password> --radio <radio 01> <number of last station> <ssid> <ssid password> python3 ./test_fileio.py --upstream_port eth1 --fio_type fe_nfs4 --min_read 1Mbps --min_write 1Gbps --server_mount 192.168.93.195:/tmp/test ''') parser.add_argument('--test_duration', help='sets the duration of the test', default="5m") parser.add_argument('--fs_type', help='endpoint type', default="fe_nfs4") parser.add_argument('--min_rw_size', help='minimum read/write size', default=64 * 1024) parser.add_argument('--max_rw_size', help='maximum read/write size', default=64 * 1024) parser.add_argument('--min_file_size', help='minimum file size', default=50 * 1024 * 1024) parser.add_argument('--max_file_size', help='maximum file size', default=50 * 1024 * 1024) parser.add_argument('--min_read_rate_bps', help='minimum bps read rate', default=10e9) parser.add_argument('--max_read_rate_bps', help='maximum bps read rate', default=10e9) parser.add_argument('--min_write_rate_bps', help='minimum bps write rate', default=10e9) parser.add_argument('--max_write_rate_bps', help='maximum bps write rate', default="1G") parser.add_argument( '--directory', help='--directory directory to read/write in. Absolute path suggested', default="AUTO") parser.add_argument( '--server_mount', help= '--server_mount The server to mount, ex: 192.168.100.5/exports/test1', default="10.40.0.1:/var/tmp/test") parser.add_argument('--num_macvlans', help='Number of MACVLANs to create', default=1) args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=10000, radio=args.radio) ip_test = FileIOTest(args.mgr, args.mgr_port, ssid=args.ssid, password=args.passwd, security=args.security, station_list=station_list, test_duration=args.test_duration, upstream_port=args.upstream_port, _debug_on=args.debug, fs_type=args.fs_type, min_rw_size=args.min_rw_size, max_rw_size=args.max_rw_size, min_file_size=args.min_file_size, max_file_size=args.max_file_size, min_read_rate_bps=args.min_read_rate_bps, max_read_rate_bps=args.max_read_rate_bps, min_write_rate_bps=args.min_write_rate_bps, max_write_rate_bps=args.max_write_rate_bps, directory=args.directory, server_mount=args.server_mount, num_macvlans=args.num_macvlans # want a mount options param ) ip_test.cleanup(station_list) ip_test.build() if not ip_test.passes(): print(ip_test.get_fail_message()) exit(1) ip_test.start(False, False) ip_test.stop() if not ip_test.passes(): print(ip_test.get_fail_message()) # exit(1) time.sleep(30) ip_test.cleanup(station_list) if ip_test.passes(): print( "Full test passed, all endpoints had increased bytes-rd throughout test duration" )
def main(): parser = LFCliBase.create_basic_argparse( prog='test_ipv4_variable_time.py', formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Create stations to test connection and traffic on VAPs of varying security types (WEP, WPA, WPA2, WPA3, Open) ''', description='''\ test_ipv4_variable_time.py: -------------------- Options: --upstream_port eth1 --radio wiphy0 --num_stations 32 --security {open|wep|wpa|wpa2|wpa3} \\ --mode 1 {"auto" : "0", "a" : "1", "b" : "2", "g" : "3", "abg" : "4", "abgn" : "5", "bgn" : "6", "bg" : "7", "abgnAC" : "8", "anAC" : "9", "an" : "10", "bgnAC" : "11", "abgnAX" : "12", "bgnAX" : "13", --ssid netgear --password admin123 --test_duration 2m (default) --a_min 1000 --b_min 1000 --ap "00:0e:8e:78:e1:76" --debug''') #optional = parser.add_argument_group('optional arguments') #required = parser.add_argument_group('required arguments') required = None for agroup in parser._action_groups: if agroup.title == "required arguments": required = agroup # pprint.pprint(required) if required is not None: required.add_argument('--a_min', help='bps rate minimum for endpoint A', type=int, default=256000) required.add_argument('--b_min', help='bps rate minimum for endpoint B', type=int, default=256000) required.add_argument('--test_duration', help='duration of the test', default="2m") optional = None for agroup in parser._action_groups: if agroup.title == "optional arguments": optional = agroup # pprint.pprint(optional) if optional is not None: optional.add_argument("--ap", help="Add BSSID of access point to connect to") optional.add_argument('--mode', help=LFCliBase.Help_Mode) optional.add_argument('--monitor', help='print CSV output of connection status', default=False, action='store_true') optional.add_argument('--monitor_interval_sec', help='seconds between polling endpoints', default=5) optional.add_argument('--save_to', help='save CSV monitor output to file', default=None) args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_sta = int(args.num_stations) station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=10000, radio=args.radio) ip_var_test = IPV4VariableTime(host=args.mgr, port=args.mgr_port, number_template="00", sta_list=station_list, name_prefix="VT", upstream=args.upstream_port, ssid=args.ssid, password=args.passwd, radio=args.radio, security=args.security, test_duration=args.test_duration, use_ht160=False, side_a_min_rate=args.a_min, side_b_min_rate=args.b_min, mode=args.mode, ap=args.ap, _debug_on=args.debug) ip_var_test.pre_cleanup() ip_var_test.build() if not ip_var_test.passes(): print(ip_var_test.get_fail_message()) ip_var_test.exit_fail() ip_var_test.start(False, False) ip_var_test.stop() if not ip_var_test.passes(): print(ip_var_test.get_fail_message()) ip_var_test.exit_fail() time.sleep(30) ip_var_test.cleanup() if ip_var_test.passes(): ip_var_test.exit_success()
def main(): parser = LFCliBase.create_basic_argparse( prog='example_security_connection.py', formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Example flags and command line input to run the script. ''', description='''\ example_security_connection.py -------------------- This python script creates an inputted number of stations using user-inputted security. This verifies that the most basic form of security works with the LANforge device. -------------------- Generic command example: python3 ./example_security_connection.py --mgr localhost --mgr_port 8080 --num_stations 6 --mode 1 {"auto" : "0", "a" : "1", "b" : "2", "g" : "3", "abg" : "4", "abgn" : "5", "bgn" : "6", "bg" : "7", "abgnAC" : "8", "anAC" : "9", "an" : "10", "bgnAC" : "11", "abgnAX" : "12", "bgnAX" : "13", "anAX" : "14"} --radio wiphy2 --security {open|wep|wpa|wpa2|wpa3} --ssid netgear-wpa3 --ap "00:0e:8e:78:e1:76" --passwd admin123-wpa3 --debug ''') optional = parser.add_argument_group('optional arguments') required = parser.add_argument_group('required arguments') required.add_argument( '--security', help='WiFi Security protocol: < open | wep | wpa | wpa2 | wpa3 >', required=True) optional.add_argument('--mode', help='Used to force mode of stations') optional.add_argument('--ap', help='Used to force a connection to a particular AP') args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=10000, radio=args.radio) ip_test = IPv4Test(host=args.mgr, port=args.mgr_port, ssid=args.ssid, password=args.passwd, radio=args.radio, mode=args.mode, security=args.security, sta_list=station_list, ap=args.ap) ip_test.cleanup(station_list) ip_test.timeout = 60 ip_test.build()
def main(): lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='test_ipv4_l4_urls_per_ten', formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Create layer-4 endpoints to connect to an ftp server and test that urls/s are meeting or exceeding the target rate ''', description='''\ test_ipv4_l4_ftp_urls_per_ten.py -------------------- Generic command example: python3 ./test_ipv4_l4_ftp_urls_per_ten.py --upstream_port eth1 \\ --radio wiphy0 \\ --num_stations 3 \\ --security {open|wep|wpa|wpa2|wpa3} \\ --ssid netgear \\ --passwd admin123 \\ --test_duration 2m \\ {2m | 30s | 3h | 1d ...etc} --interval 1s \\ --mode 1 {"auto" : "0", "a" : "1", "b" : "2", "g" : "3", "abg" : "4", "abgn" : "5", "bgn" : "6", "bg" : "7", "abgnAC" : "8", "anAC" : "9", "an" : "10", "bgnAC" : "11", "abgnAX" : "12", "bgnAX" : "13", --ap "00:0e:8e:78:e1:76" --requests_per_ten 600 \\ --num_tests 1 \\ --url "ul ftp://lanforge:[email protected]/example.txt /home/lanforge/example.txt" --debug ''') optional = parser.add_argument_group('optional arguments') required = parser.add_argument_group('required arguments') required.add_argument( '--security', help='WiFi Security protocol: < open | wep | wpa | wpa2 | wpa3 >', required=True) parser.add_argument( '--requests_per_ten', help='--requests_per_ten number of request per ten minutes', default=600) parser.add_argument('--test_duration', help='--test duration of a single test', default=600) parser.add_argument( '--num_tests', help='--num_tests number of tests to run. Each test runs 10 minutes', default=1) parser.add_argument( '--url', help='--url specifies upload/download, address, and dest', default="dl http://10.40.0.1 /dev/null") optional.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('--target_per_ten', help='--target_per_ten target number of request per ten minutes. test will check for 90 percent of this value', #default=600) args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=10000, radio=args.radio) ip_test = IPV4L4(host=args.mgr, port=args.mgr_port, ssid=args.ssid, password=args.passwd, upstream_port=args.upstream_port, radio=args.radio, security=args.security, station_list=station_list, url=args.url, mode=args.mode, ap=args.ap, num_tests=args.num_tests, requests_per_ten=args.requests_per_ten, test_duration=args.test_duration, _debug_on=args.debug) ip_test.cleanup(station_list) ip_test.build() ip_test.start() ip_test.stop() if not ip_test.passes(): print(ip_test.get_fail_message()) exit(1) time.sleep(30) ip_test.cleanup(station_list) if ip_test.passes(): print( "Full test passed, all endpoints met or exceeded 90 percent of the target rate" )
def main(): lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='test_ipv4_l4_ftp', # formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Create layer-4 endpoints to an ftp server and test that the bytes-wr are increasing over the duration of the test ''', description='''\ test_ipv4_l4_ftp_upload.py -------------------- Generic command example: python3 ./test_ipv4_l4_ftp_wifi.py --upstream_port eth1 \\ --radio wiphy0 \\ --num_stations 3 \\ --security {open|wep|wpa|wpa2|wpa3} \\ --ssid netgear \\ --passwd admin123 \\ --dest 10.40.0.1 \\ --test_duration 2m \\ --interval 1s \\ --url "ul ftp://10.40.0.1 /dev/null" \\ --requests_per_ten 600 \\ --debug ''') parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m") parser.add_argument( '--requests_per_ten', help='--requests_per_ten number of request per ten minutes', default=600) parser.add_argument( '--url', help='--url specifies upload/download, address, and dest', default="ul ftp://10.40.0.1 /dev/null") args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=10000, radio=args.radio) ip_test = IPV4L4(args.mgr, lfjson_port, ssid=args.ssid, password=args.passwd, security=args.security, station_list=station_list, url=args.url, test_duration=args.test_duration, requests_per_ten=args.requests_per_ten, _debug_on=args.debug, upstream_port=args.upstream_port) ip_test.cleanup(station_list) ip_test.build() if not ip_test.passes(): print(ip_test.get_fail_message()) exit(1) ip_test.start(False, False) ip_test.stop() if not ip_test.passes(): print(ip_test.get_fail_message()) exit(1) time.sleep(30) ip_test.cleanup(station_list) if ip_test.passes(): print( "Full test passed, all endpoints had increased bytes-rd throughout test duration" )
def main(): lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='test_ipv4_l4_ftp_wifi.py', # formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Create layer-4 endpoints and test that the bytes-wr from the chosen URL are increasing over the duration of the test ''', description='''\ test_ipv4_l4_ftp_wifi.py -------------------- Generic command example: python3 ./test_ipv4_l4_ftp_wifi.py --upstream_port eth1 \\ --radio wiphy0 \\ --num_stations 3 \\ --security {open|wep|wpa|wpa2|wpa3} \\ --ssid netgear \\ --passwd admin123 \\ --dest 10.40.0.1 \\ --test_duration 2m \\ --interval 1s \\ --requests_per_ten 600 \\ --dest /var/www/html/data_slug_4K.bin \\ --source /tmp/data_slug_4K.bin \\ --ftp_user lanforge \\ --ftp_passwd lanforge \\ --debug ''') parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m") parser.add_argument('--requests_per_ten', help='--requests_per_ten number of request per ten minutes', default=600) parser.add_argument('--dest', help='--dest specifies the destination for the file', default="/var/www/html/data_slug_4K.bin") parser.add_argument('--source', help='--source specifies the source of the file', default="/tmp/data_slug_4K.bin") parser.add_argument('--ftp_user', help='--ftp_user sets the username to be used for ftp', default="lanforge") parser.add_argument('--ftp_passwd', help='--ftp_user sets the password to be used for ftp', default="lanforge") args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000, radio=args.radio) ip_test = IPV4L4(host=args.mgr, port=args.mgr_port, ssid=args.ssid, password=args.passwd, security=args.security, station_list=station_list, test_duration=args.test_duration, requests_per_ten=args.requests_per_ten, _debug_on=args.debug, upstream_port=args.upstream_port, ftp_user=args.ftp_user, ftp_passwd=args.ftp_passwd, dest=args.dest, source=args.source) ip_test.cleanup(station_list) ip_test.build() if not ip_test.passes(): print(ip_test.get_fail_message()) exit(1) ip_test.start(False, False) ip_test.stop() if not ip_test.passes(): print(ip_test.get_fail_message()) exit(1) time.sleep(30) ip_test.cleanup(station_list) if ip_test.passes(): print("Full test passed, all endpoints had increased bytes-wr throughout test duration")
def main(): parser = LFCliBase.create_basic_argparse( prog='create_l3_stations.py', formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Create stations to test connection and traffic on VAPs of varying security types (WEP, WPA, WPA2, WPA3, Open) ''', description='''\ create_l3_stations.py: -------------------- Generic command layout: python3 ./create_l3_stations.py --upstream_port eth1 --radio wiphy0 --num_stations 32 --security {open|wep|wpa|wpa2|wpa3} \\ --mode 1 {"auto" : "0", "a" : "1", "b" : "2", "g" : "3", "abg" : "4", "abgn" : "5", "bgn" : "6", "bg" : "7", "abgnAC" : "8", "anAC" : "9", "an" : "10", "bgnAC" : "11", "abgnAX" : "12", "bgnAX" : "13", --ssid netgear --password admin123 --a_min 1000 --b_min 1000 --ap "00:0e:8e:78:e1:76" --number_template 0000 --debug python3 ./create_l3_stations.py --upstream_port eth1 --radio wiphy0 --station_list sta00,sta01 --security {open|wep|wpa|wpa2|wpa3} \\ --mode 1 {"auto" : "0", "a" : "1", "b" : "2", "g" : "3", "abg" : "4", "abgn" : "5", "bgn" : "6", "bg" : "7", "abgnAC" : "8", "anAC" : "9", "an" : "10", "bgnAC" : "11", "abgnAX" : "12", "bgnAX" : "13", --ssid netgear --password admin123 --a_min 1000 --b_min 1000 --ap "00:0e:8e:78:e1:76" --number_template 0000 --debug ''') required_args = None for group in parser._action_groups: if group.title == "required arguments": required_args = group break if required_args is not None: required_args.add_argument( '--a_min', help='--a_min bps rate minimum for side_a', default=256000) required_args.add_argument( '--b_min', help='--b_min bps rate minimum for side_b', default=256000) optional_args = None for group in parser._action_groups: if group.title == "optional arguments": optional_args = group break if optional_args: optional_args.add_argument( '--mode', help='Used to force mode of stations') optional_args.add_argument( '--ap', help='Used to force a connection to a particular AP') optional_args.add_argument( '--number_template', help='Start the station numbering with a particular number. Default is 0000', default=0000) optional_args.add_argument( '--station_list', help='Optional: User defined station names, can be a comma or space separated list', nargs='+', default=None) optional_args.add_argument( '--no_cleanup', help="Optional: Don't cleanup existing stations", action='store_true') args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_sta = int(args.num_stations) if not args.station_list: station_list = LFUtils.portNameSeries( prefix_="sta", start_id_=int( args.number_template), end_id_=num_sta + int( args.number_template) - 1, padding_number_=10000, radio=args.radio) else: if ',' in args.station_list[0]: station_list = args.station_list[0].split(',') elif ' ' in args.station_list[0]: station_list = args.station_list[0].split() else: station_list = args.station_list ip_var_test = CreateL3(host=args.mgr, port=args.mgr_port, number_template=str(args.number_template), sta_list=station_list, name_prefix="VT", upstream=args.upstream_port, ssid=args.ssid, password=args.passwd, radio=args.radio, security=args.security, use_ht160=False, side_a_min_rate=args.a_min, side_b_min_rate=args.b_min, mode=args.mode, ap=args.ap, _debug_on=args.debug) if not args.no_cleanup: ip_var_test.pre_cleanup() ip_var_test.build() if not ip_var_test.passes(): print(ip_var_test.get_fail_message()) ip_var_test.exit_fail() print('Creates %s stations and connections' % num_sta)
def main(): parser = LFCliBase.create_basic_argparse( prog='test_ipv4_connection.py', formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Create stations that attempt to authenticate, associate, and receive IP addresses on the chosen SSID ''', description='''\ test_ipv4_connection.py -------------------- Generic command example: ./test_ipv4_connection.py --upstream_port eth1 --radio wiphy0 --num_stations 3 --security open --ssid netgear --passwd BLANK --debug ''') args = parser.parse_args() if (args.radio is None): raise ValueError("--radio required") num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.port_name_series(prefix="sta", start_id=0, end_id=num_sta - 1, padding_number=10000, radio=args.radio) ip_test = IPv4Test(host=args.mgr, port=args.mgr_port, ssid=args.ssid, password=args.passwd, security=args.security, sta_list=station_list, radio=args.radio, _debug_on=args.debug) ip_test.cleanup(station_list) ip_test.build() if not ip_test.passes(): print(ip_test.get_fail_message()) ip_test.add_event(name="test_ipv4_connection.py", message=ip_test.get_fail_message()) ip_test.exit_fail() ip_test.start(station_list, False, False) ip_test.stop() if not ip_test.passes(): print(ip_test.get_fail_message()) ip_test.add_event(name="test_ipv4_connection.py", message=ip_test.get_fail_message()) ip_test.exit_fail() time.sleep(30) ip_test.cleanup(station_list) if ip_test.passes(): ip_test.add_event( name="test_ipv4_connection.py", message="Full test passed, all stations associated and got IP") ip_test.exit_success()
def main(): lfjson_host = "localhost" lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='test_fileio.py', # formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog= '''Creates FileIO endpoints which can be NFS, CIFS or iSCSI endpoints.''', description='''\ test_fileio.py: -------------------- Generic command layout: ./test_fileio.py --macvlan_parent <port> --num_ports <num ports> --use_macvlans --first_mvlan_ip <first ip in series> --netmask <netmask to use> --gateway <gateway ip addr> ./test_fileio.py --macvlan_parent eth2 --num_ports 3 --use_macvlans --first_mvlan_ip 192.168.92.13 --netmask 255.255.255.0 --gateway 192.168.92.1 ''') parser.add_argument('--test_duration', help='sets the duration of the test', default="5m") parser.add_argument('--fs_type', help='endpoint type', default="fe_nfs4") parser.add_argument('--min_rw_size', help='minimum read/write size', default=64 * 1024) parser.add_argument('--max_rw_size', help='maximum read/write size', default=64 * 1024) parser.add_argument('--min_file_size', help='minimum file size', default=50 * 1024 * 1024) parser.add_argument('--max_file_size', help='maximum file size', default=50 * 1024 * 1024) parser.add_argument('--min_read_rate_bps', help='minimum bps read rate', default=10e9) parser.add_argument('--max_read_rate_bps', help='maximum bps read rate', default=10e9) parser.add_argument('--min_write_rate_bps', help='minimum bps write rate', default=10e9) parser.add_argument('--max_write_rate_bps', help='maximum bps write rate', default="1G") parser.add_argument( '--directory', help='--directory directory to read/write in. Absolute path suggested', default="AUTO") parser.add_argument( '--server_mount', help= '--server_mount The server to mount, ex: 192.168.100.5/exports/test1', default="10.40.0.1:/var/tmp/test") parser.add_argument('--macvlan_parent', help='specifies parent port for macvlan creation', default=None) parser.add_argument('--first_port', help='specifies name of first port to be used', default=None) parser.add_argument('--num_ports', help='number of ports to create', default=1) parser.add_argument('--use_macvlans', help='will create macvlans', action='store_true', default=False) parser.add_argument( '--first_mvlan_ip', help='specifies first static ip address to be used or dhcp', default=None) parser.add_argument( '--netmask', help='specifies netmask to be used with static ip addresses', default=None) parser.add_argument( '--gateway', help='specifies default gateway to be used with static addressing', default=None) parser.add_argument( '--use_test_groups', help='will use test groups to start/stop instead of single endps/cxs', action='store_true', default=False) parser.add_argument('--read_only_test_group', help='specifies name to use for read only test group', default=None) parser.add_argument('--write_only_test_group', help='specifies name to use for write only test group', default=None) parser.add_argument('--mode', help='write,read,both', default='both', type=str) parser.add_argument( '--use_ports', help= 'list of comma separated ports to use with ips, \'=\' separates name and ip' '{ port_name1=ip_addr1,port_name1=ip_addr2 }', default=None) args = parser.parse_args() port_list = [] ip_list = [] if args.first_port is not None and args.use_ports is not None: if args.first_port.startswith("sta"): if (args.num_ports is not None) and (int(args.num_ports) > 0): start_num = int(args.first_port[3:]) num_ports = int(args.num_ports) port_list = LFUtils.port_name_series(prefix="sta", start_id=start_num, end_id=start_num + num_ports - 1, padding_number=10000, radio=args.radio) else: if (args.num_ports is not None) and args.macvlan_parent is not None and (int(args.num_ports) > 0) \ and args.macvlan_parent in args.first_port: start_num = int(args.first_port[args.first_port.index('#') + 1:]) num_ports = int(args.num_ports) port_list = LFUtils.port_name_series( prefix=args.macvlan_parent + "#", start_id=start_num, end_id=start_num + num_ports - 1, padding_number=100000, radio=args.radio) else: raise ValueError( "Invalid values for num_ports [%s], macvlan_parent [%s], and/or first_port [%s].\n" "first_port must contain parent port and num_ports must be greater than 0" % (args.num_ports, args.macvlan_parent, args.first_port)) else: if args.use_ports is None: num_ports = int(args.num_ports) if not args.use_macvlans: port_list = LFUtils.port_name_series(prefix="sta", start_id=0, end_id=num_ports - 1, padding_number=10000, radio=args.radio) else: port_list = LFUtils.port_name_series( prefix=args.macvlan_parent + "#", start_id=0, end_id=num_ports - 1, padding_number=100000, radio=args.radio) else: temp_list = args.use_ports.split(',') for port in temp_list: port_list.append(port.split('=')[0]) ip_list.append(port.split('=')[1]) if len(port_list) != len(ip_list): raise ValueError(temp_list, " ports must have matching ip addresses!") print(port_list) print(ip_list) if args.first_mvlan_ip is not None: if args.first_mvlan_ip.lower() == "dhcp": dhcp = True else: dhcp = False else: dhcp = True # print(port_list) # exit(1) ip_test = FileIOTest(args.mgr, args.mgr_port, ssid=args.ssid, password=args.passwd, security=args.security, port_list=port_list, ip_list=ip_list, test_duration=args.test_duration, upstream_port=args.upstream_port, _debug_on=args.debug, macvlan_parent=args.macvlan_parent, use_macvlans=args.use_macvlans, first_mvlan_ip=args.first_mvlan_ip, netmask=args.netmask, gateway=args.gateway, dhcp=dhcp, fs_type=args.fs_type, min_rw_size=args.min_rw_size, max_rw_size=args.max_rw_size, min_file_size=args.min_file_size, max_file_size=args.max_file_size, min_read_rate_bps=args.min_read_rate_bps, max_read_rate_bps=args.max_read_rate_bps, min_write_rate_bps=args.min_write_rate_bps, max_write_rate_bps=args.max_write_rate_bps, directory=args.directory, server_mount=args.server_mount, num_ports=args.num_ports, use_test_groups=args.use_test_groups, write_only_test_group=args.write_only_test_group, read_only_test_group=args.read_only_test_group, mode=args.mode # want a mount options param ) ip_test.cleanup(port_list) ip_test.build() if not ip_test.passes(): print(ip_test.get_fail_message()) ip_test.start(False, False) ip_test.stop() if not ip_test.passes(): print(ip_test.get_fail_message()) # exit(1) time.sleep(30) ip_test.cleanup(port_list) if ip_test.passes(): print( "Full test passed, all endpoints had increased bytes-rd throughout test duration" )
def main(): parser = LFCliBase.create_basic_argparse( prog='test_ipv6_variable_time.py', # formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Create stations to test IPV6 connection and traffic on VAPs of varying security types (WEP, WPA, WPA2, WPA3, Open) ''', description='''\ test_ipv6_variable_time.py: -------------------- Generic command example: ./test_ipv6_connection.py --upstream_port eth1 \\ --radio wiphy0 \\ --num_stations 3 \\ --security {open|wep|wpa|wpa2|wpa3} \\ --ssid netgear \\ --passwd admin123 \\ --upstream 10.40.0.1 \\ --test_duration 2m \\ --interval 1s \\ --a_min 256000 \\ --b_min 256000 \\ --debug ''') required_args=None for group in parser._action_groups: if group.title == "required arguments": required_args=group break; if required_args is not None: required_args.add_argument('--a_min', help='minimum bps rate for side_a', default=256000) required_args.add_argument('--b_min', help='minimum bps rate for side_b', default=256000) required_args.add_argument('--cx_type', help='tcp6 or udp6') required_args.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m") optional_args=None for group in parser._action_groups: if group.title == "optional arguments": optional_args=group break; if optional_args is not None: optional_args.add_argument('--mode', help='Used to force mode of stations') optional_args.add_argument('--ap', help='Used to force a connection to a particular AP') optional_args.add_argument("--a_max", help="Maximum side_a bps speed", default=0) optional_args.add_argument("--b_max", help="Maximum side_b bps speed", default=0) args = parser.parse_args() CX_TYPES=("tcp6", "udp6", "lf_tcp6", "lf_udp6") if (args.cx_type is None) or (args.cx_type not in CX_TYPES): print("cx_type needs to be lf_tcp6 or lf_udp6, bye") exit(1) if args.cx_type == "tcp6": args.cx_type = "lf_tcp6" if args.cx_type == "udp6": args.cx_type = "lf_udp6" num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000, radio=args.radio) ip_var_test = IPV6VariableTime(_host=args.mgr, _port=args.mgr_port, _number_template="00", _sta_list=station_list, _name_prefix="VT", _upstream=args.upstream_port, _ssid=args.ssid, _password=args.passwd, _radio=args.radio, _security=args.security, _test_duration=args.test_duration, _use_ht160=False, _side_a_min_rate=args.a_min, _side_b_min_rate=args.b_min, _side_a_max_rate=args.a_max, _side_b_max_rate=args.b_max, _cx_type=args.cx_type, _debug_on=args.debug) ip_var_test.pre_cleanup() ip_var_test.build() if not ip_var_test.passes(): print(ip_var_test.get_fail_message()) exit(1) ip_var_test.start(False, False) ip_var_test.stop() if not ip_var_test.passes(): print(ip_var_test.get_fail_message()) exit(1) time.sleep(30) ip_var_test.cleanup() if ip_var_test.passes(): print("Full test passed, all connections increased rx bytes")
def main(): lfjson_host = "localhost" lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='test_generic.py', # formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Create layer-4 endpoints and test that the bytes-rd from the chosen URL are increasing over the duration of the test ''', description='''\ test_ipv4_l4.py -------------------- Generic command layout: python ./test_ipv4_l4.py --upstream_port <port> --radio <radio 0> <stations> <ssid> <ssid password> <security type: wpa2, open, wpa3> --debug Command Line Example: python3 ./test_ipv4_l4.py --upstream_port eth1 (optional) --radio wiphy0 (required) --num_stations 3 (optional) --security {open|wep|wpa|wpa2|wpa3} (required) --ssid netgear (required) --url "dl http://10.40.0.1 /dev/null" (required) --password admin123 (required) --test_duration 2m (optional) --debug (optional) ''') parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m") parser.add_argument( '--url', help='--url specifies upload/download, address, and dest', default="dl http://10.40.0.1 /dev/null") args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=10000, radio=args.radio) ip_test = IPV4L4(host=args.mgr, port=args.mgr_port, ssid=args.ssid, radio=args.radio, password=args.passwd, security=args.security, station_list=station_list, url=args.url, test_duration=args.test_duration, upstream_port=args.upstream_port, _debug_on=args.debug) ip_test.cleanup(station_list) ip_test.build() if not ip_test.passes(): print(ip_test.get_fail_message()) ip_test.exit_fail() ip_test.start(False, False) ip_test.stop() if not ip_test.passes(): print(ip_test.get_fail_message()) ip_test.exit_fail() time.sleep(30) ip_test.cleanup(station_list) if ip_test.passes(): print( "Full test passed, all endpoints had increased bytes-rd throughout test duration" ) ip_test.exit_success()
def main(): lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='test_generic.py', formatter_class=argparse.RawTextHelpFormatter, epilog= '''Create generic endpoints and test for their ability to execute chosen commands\n''', description='''test_generic.py -------------------- Generic command example: python3 ./test_generic.py --upstream_port eth1 --radio wiphy0 (required) --num_stations 3 --security {open|wep|wpa|wpa2|wpa3} (required) --ssid netgear (required) --passwd admin123 (required) --type lfping {generic|lfping|iperf3-client | speedtest | iperf3-server |lf_curl} (required) --dest 10.40.0.1 (required - also target for iperf3) --test_duration 2m --interval 1s --debug ''') parser.add_argument( '--type', help= 'type of command to run: generic, lfping, iperf3-client, iperf3-server, lfcurl', default="lfping") parser.add_argument( '--cmd', help='specifies command to be run by generic type endp', default='') parser.add_argument('--dest', help='destination IP for command', default="10.40.0.1") parser.add_argument('--test_duration', help='duration of the test eg: 30s, 2m, 4h', default="2m") parser.add_argument('--interval', help='interval to use when running lfping (1s, 1m)', default=1) parser.add_argument( '--speedtest_min_up', help='sets the minimum upload threshold for the speedtest type', default=None) parser.add_argument( '--speedtest_min_dl', help='sets the minimum download threshold for the speedtest type', default=None) parser.add_argument( '--speedtest_max_ping', help='sets the minimum ping threshold for the speedtest type', default=None) args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(radio=args.radio, prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=100) generic_test = GenTest(args.mgr, lfjson_port, number_template="00", radio=args.radio, sta_list=station_list, name_prefix="GT", type=args.type, dest=args.dest, cmd=args.cmd, interval=1, ssid=args.ssid, upstream=args.upstream_port, password=args.passwd, security=args.security, test_duration=args.test_duration, speedtest_min_up=args.speedtest_min_up, speedtest_min_dl=args.speedtest_min_dl, speedtest_max_ping=args.speedtest_max_ping, _debug_on=args.debug) generic_test.cleanup(station_list) generic_test.build() if not generic_test.passes(): print(generic_test.get_fail_message()) exit(1) generic_test.start() if not generic_test.passes(): print(generic_test.get_fail_message()) exit(1) generic_test.stop() time.sleep(30) generic_test.cleanup(station_list) if generic_test.passes(): print("Full test passed")
def main(): parser = LFCliBase.create_basic_argparse( prog='test_generic.py', formatter_class=argparse.RawTextHelpFormatter, epilog= '''Create generic endpoints and test for their ability to execute chosen commands\n''', description='''test_generic.py -------------------- Generic command example: python3 ./test_generic.py --mgr localhost (optional) --mgr_port 4122 (optional) --upstream_port eth1 (optional) --radio wiphy0 (required) --num_stations 3 (optional) --security {open|wep|wpa|wpa2|wpa3} (required) --ssid netgear (required) --passwd admin123 (required) --type lfping {generic|lfping|iperf3-client | speedtest | lf_curl} (required) --dest 10.40.0.1 (required - also target for iperf3) --test_duration 2m --interval 1s --debug Example commands: LFPING: ./test_generic.py --mgr localhost --mgr_port 4122 --radio wiphy0 --num_stations 7 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --type lfping --dest 10.40.0.1 --security wpa2 LFCURL (under construction): ./test_generic.py --mgr localhost --mgr_port 4122 --radio wiphy1 --num_stations 26 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --security wpa2 --type lfcurl --dest 10.40.0.1 GENERIC: ./test_generic.py --mgr localhost--mgr_port 4122 --radio wiphy1 --num_stations 2 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --security wpa2 --type generic SPEEDTEST: ./test_generic.py --mgr localhost --mgr_port 4122 --radio wiphy2 --num_stations 13 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --type speedtest --speedtest_min_up 20 --speedtest_min_dl 20 --speedtest_max_ping 150 --security wpa2 IPERF3 (under construction): ./test_generic.py --mgr localhost --mgr_port 4122 --radio wiphy1 --num_stations 3 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --security wpa2 --type iperf3 ''') required = parser.add_argument_group('required arguments') required.add_argument( '--security', help='WiFi Security protocol: < open | wep | wpa | wpa2 | wpa3 >', required=True) parser.add_argument( '--type', help= 'type of command to run: generic, lfping, iperf3-client, iperf3-server, lfcurl', default="lfping") parser.add_argument( '--cmd', help='specifies command to be run by generic type endp', default='') parser.add_argument('--dest', help='destination IP for command', default="10.40.0.1") parser.add_argument('--test_duration', help='duration of the test eg: 30s, 2m, 4h', default="2m") parser.add_argument('--interval', help='interval to use when running lfping (1s, 1m)', default=1) parser.add_argument( '--speedtest_min_up', help='sets the minimum upload threshold for the speedtest type', default=None) parser.add_argument( '--speedtest_min_dl', help='sets the minimum download threshold for the speedtest type', default=None) parser.add_argument( '--speedtest_max_ping', help='sets the minimum ping threshold for the speedtest type', default=None) parser.add_argument('--client', help='client to the iperf3 server', default=None) args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(radio=args.radio, prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=100) generic_test = GenTest(host=args.mgr, port=args.mgr_port, number_template="00", radio=args.radio, sta_list=station_list, name_prefix="GT", type=args.type, dest=args.dest, cmd=args.cmd, interval=1, ssid=args.ssid, upstream=args.upstream_port, passwd=args.passwd, security=args.security, test_duration=args.test_duration, speedtest_min_up=args.speedtest_min_up, speedtest_min_dl=args.speedtest_min_dl, speedtest_max_ping=args.speedtest_max_ping, client=args.client, _debug_on=args.debug) generic_test.cleanup(station_list) generic_test.build() if not generic_test.passes(): print(generic_test.get_fail_message()) generic_test.exit_fail() generic_test.start() if not generic_test.passes(): print(generic_test.get_fail_message()) generic_test.exit_fail() generic_test.stop() time.sleep(30) generic_test.cleanup(station_list) if generic_test.passes(): generic_test.exit_success()
def main(): lfjson_host = "localhost" lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='test_ipv4_ttls.py', #formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog='''Demonstration showing wpa2-ent ttls authentication''', description='''\ test_ipv4_ttls.py: -------------------- Generic command layout: python ./test_ipv4_ttls.py --upstream_port <port> --radio <radio 0> --num_stations 3 --ssid ssid-wpa-1 --keyphrase ssid-wpa-1 --security <security type: wpa2, open, wpa3> --debug ''') parser.add_argument('--a_min', help='--a_min bps rate minimum for side_a', default=256000) parser.add_argument('--b_min', help='--b_min bps rate minimum for side_b', default=256000) parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m") parser.add_argument('--key-mgmt', help="--key-mgt: { %s }" % ", ".join(realm.wpa_ent_list()), default="WPA-EAP") parser.add_argument('--wpa_psk', help='wpa-ent pre shared key', default="[BLANK]") parser.add_argument('--eap', help='--eap eap method to use', default="TTLS") parser.add_argument('--identity', help='--identity eap identity string', default="testuser") parser.add_argument('--ttls_passwd', help='--ttls_passwd eap password string', default="testpasswd") parser.add_argument('--ttls_realm', help='--ttls_realm 802.11u home realm to use', default="localhost.localdomain") parser.add_argument('--domain', help='--domain 802.11 domain to use', default="localhost.localdomain") parser.add_argument( '--hessid', help='--hessid 802.11u HESSID (MAC addr format/peer for WDS)', default="00:00:00:00:00:01") parser.add_argument( '--ieee80211w', help='--ieee80211w <disabled(0),optional(1),required(2)', default='1') parser.add_argument('--use_hs20', help='use HotSpot 2.0', default=False) parser.add_argument('--enable_pkc', help='enable opportunistic PMKSA WPA2 key caching', default=False) args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=10000) ttls_test = TTLSTest( host=args.mgr, port=args.mgr_port, ssid=args.ssid, password=args.passwd, security=args.security, sta_list=station_list, radio=args.radio, key_mgmt=args.key_mgmt, wpa_psk=args.wpa_psk, eap=args.eap, identity=args.identity, ttls_passwd=args.ttls_passwd, ttls_realm=args.ttls_realm, domain=args.domain, hessid=args.hessid, ieee80211w=args.ieee80211w, hs20_enable=args.use_hs20, enable_pkc=args.enable_pkc, ) ttls_test.cleanup(station_list) ttls_test.build() if not ttls_test.passes(): print(ttls_test.get_fail_message()) exit(1) ttls_test.start(station_list, False, False) ttls_test.stop() if not ttls_test.passes(): print(ttls_test.get_fail_message()) exit(1) time.sleep(30) ttls_test.cleanup(station_list) if ttls_test.passes(): print("Full test passed, all stations associated and got IP")
def main(): lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='test_ipv4_variable_time.py', # formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Useful Information: 1. TBD ''', description='''\ test_ipv4_variable_time.py: -------------------- TBD Generic command layout: python ./test_ipv4_variable_time.py --upstream_port <port> --radio <radio 0> <stations> <ssid> <ssid password> <security type: wpa2, open, wpa3> --debug Note: multiple --radio switches may be entered up to the number of radios available: --radio <radio 0> <stations> <ssid> <ssid password> --radio <radio 01> <number of last station> <ssid> <ssid password> python3 ./test_ipv4_variable_time.py --upstream_port eth1 --radio wiphy0 32 candelaTech-wpa2-x2048-4-1 candelaTech-wpa2-x2048-4-1 wpa2 --radio wiphy1 64 candelaTech-wpa2-x2048-5-3 candelaTech-wpa2-x2048-5-3 wpa2 ''') parser.add_argument('--a_min', help='--a_min bps rate minimum for side_a', default=256000) parser.add_argument('--b_min', help='--b_min bps rate minimum for side_b', default=256000) parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m") args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000, radio=args.radio) ip_var_test = IPV4VariableTime(args.mgr, lfjson_port, number_template="00", sta_list=station_list, name_prefix="VT", upstream=args.upstream_port, ssid=args.ssid, password=args.passwd, radio=args.radio, security=args.security, test_duration=args.test_duration, use_ht160=False, side_a_min_rate=args.a_min, side_b_min_rate=args.b_min, _debug_on=args.debug) ip_var_test.pre_cleanup() ip_var_test.build() if not ip_var_test.passes(): print(ip_var_test.get_fail_message()) exit(1) ip_var_test.start(False, False) ip_var_test.stop() if not ip_var_test.passes(): print(ip_var_test.get_fail_message()) exit(1) time.sleep(30) ip_var_test.cleanup() if ip_var_test.passes(): print("Full test passed, all connections increased rx bytes")
def main(): lfjson_host = "localhost" lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='test_ipv4_l4_wifi.py', # formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Create layer-4 endpoints and test that the bytes-rd from the chosen URL are increasing over the duration of the test ''', description='''\ test_ipv4_l4_wifi.py: -------------------- Generic command example: python3 ./test_ipv4_l4_wifi.py --upstream_port eth1 \\ --radio wiphy0 \\ --num_stations 3 \\ --security {open|wep|wpa|wpa2|wpa3} \\ --ssid netgear \\ --passwd admin123 \\ --test_duration 2m \\ --requests_per_ten 600 \\ --direction {ul | dl} \\ --dest /dev/null (or 10.40.0.1)\\ --debug ''') parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m") parser.add_argument( '--requests_per_ten', help='--requests_per_ten number of request per ten minutes', default=600) parser.add_argument( '--direction', help='--direction <ul | dl> specifies upload or download', default="dl") parser.add_argument( '--dest', help= '--dest specifies the destination (dl) or source (ul) for the file', default="/dev/null") args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=10000, radio=args.radio) ip_test = IPV4L4(host=args.mgr, port=args.mgr_port, ssid=args.ssid, password=args.passwd, radio=args.radio, security=args.security, station_list=station_list, direction=args.direction, dest=args.dest, test_duration=args.test_duration, upstream_port=args.upstream_port, requests_per_ten=args.requests_per_ten, _debug_on=args.debug) ip_test.cleanup(station_list) ip_test.build() if not ip_test.passes(): print(ip_test.get_fail_message()) ip_test.exit_fail() ip_test.start(False, False) ip_test.stop() if not ip_test.passes(): print(ip_test.get_fail_message()) ip_test.exit_fail() time.sleep(30) ip_test.cleanup(station_list) if ip_test.passes(): ("Full test passed, all endpoints had increased bytes-rd throughout test duration" ) ip_test.exit_success()
def main(): #Params for different tests: # # # # # lfjson_host = "localhost" lfjson_port = 8080 parser = LFCliBase.create_basic_argparse( prog='test_ipv4_connection.py', #formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawTextHelpFormatter, epilog='''\ Create stations that attempt to authenticate, associate, and receive IP addresses on the chosen SSID ''', description='''\ test_ipv4_connection.py -------------------- Generic command example: python3 ./test_ipv4_connection.py --upstream_port eth1 \\ --radio wiphy0 \\ --num_stations 3 \\ --security {open|wep|wpa|wpa2|wpa3} \\ --ssid netgear \\ --passwd admin123 \\ --dest 10.40.0.1 \\ --test_duration 2m \\ --interval 1s \\ --debug ''') args = parser.parse_args() num_sta = 2 if (args.num_stations is not None) and (int(args.num_stations) > 0): num_stations_converted = int(args.num_stations) num_sta = num_stations_converted station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta - 1, padding_number_=10000) ip_test = IPv4Test(lfjson_host, lfjson_port, ssid=args.ssid, password=args.passwd, security=args.security, sta_list=station_list, radio=args.radio) ip_test.cleanup(station_list) #ip_test.timeout = 60 ip_test.build() if not ip_test.passes(): print(ip_test.get_fail_message()) exit(1) ip_test.start(station_list, False, False) ip_test.stop() if not ip_test.passes(): print(ip_test.get_fail_message()) exit(1) time.sleep(30) ip_test.cleanup(station_list) if ip_test.passes(): print("Full test passed, all stations associated and got IP")