mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 11:18:03 +00:00
test_ipv6_variable_time.py: updates:
- fixes incorrect CX type - adds check on tcp6 or udp6 type - adds max rates - adds mode, ap options
This commit is contained in:
@@ -19,27 +19,49 @@ import datetime
|
|||||||
|
|
||||||
|
|
||||||
class IPV6VariableTime(LFCliBase):
|
class IPV6VariableTime(LFCliBase):
|
||||||
def __init__(self, host, port, ssid, security, password, sta_list, name_prefix, upstream, radio,
|
def __init__(self,
|
||||||
side_a_min_rate=56, side_a_max_rate=0,
|
_host="localhost",
|
||||||
side_b_min_rate=56, side_b_max_rate=0,
|
_port=8080,
|
||||||
number_template="00000", test_duration="5m", use_ht160=False,
|
_ssid=None,
|
||||||
|
_security=None,
|
||||||
|
_password=None,
|
||||||
|
_sta_list=None,
|
||||||
|
_name_prefix="sta",
|
||||||
|
_upstream="1.1.eth1",
|
||||||
|
_radio="wiphy0",
|
||||||
|
_side_a_min_rate=256000,
|
||||||
|
_side_a_max_rate=0, # same
|
||||||
|
_side_b_min_rate=256000,
|
||||||
|
_side_b_max_rate=0, # same
|
||||||
|
_number_template="00000",
|
||||||
|
_test_duration="5m",
|
||||||
|
_use_ht160=False,
|
||||||
|
_cx_type=None,
|
||||||
_debug_on=False,
|
_debug_on=False,
|
||||||
_exit_on_error=False,
|
_exit_on_error=False,
|
||||||
_exit_on_fail=False):
|
_exit_on_fail=False):
|
||||||
super().__init__(host, port, _debug=_debug_on, _halt_on_error=_exit_on_error, _exit_on_fail=_exit_on_fail)
|
super().__init__(_host,
|
||||||
self.upstream = upstream
|
_port,
|
||||||
self.host = host
|
_local_realm=realm.Realm(lfclient_host=_host,
|
||||||
self.port = port
|
lfclient_port=_port,
|
||||||
self.ssid = ssid
|
debug_=_debug_on,
|
||||||
self.sta_list = sta_list
|
_exit_on_error=_exit_on_error,
|
||||||
self.security = security
|
_exit_on_fail=_exit_on_fail),
|
||||||
self.password = password
|
_debug=_debug_on,
|
||||||
self.radio = radio
|
_halt_on_error=_exit_on_error,
|
||||||
self.number_template = number_template
|
_exit_on_fail=_exit_on_fail)
|
||||||
|
self.upstream = _upstream
|
||||||
|
self.ssid = _ssid
|
||||||
|
self.sta_list = _sta_list
|
||||||
|
self.security = _security
|
||||||
|
self.password = _password
|
||||||
|
self.radio = _radio
|
||||||
|
self.number_template = _number_template
|
||||||
self.debug = _debug_on
|
self.debug = _debug_on
|
||||||
self.name_prefix = name_prefix
|
self.name_prefix = _name_prefix
|
||||||
self.test_duration = test_duration
|
self.test_duration = _test_duration
|
||||||
self.local_realm = realm.Realm(lfclient_host=self.host, lfclient_port=self.port)
|
self.cx_type = _cx_type
|
||||||
|
|
||||||
self.station_profile = self.local_realm.new_station_profile()
|
self.station_profile = self.local_realm.new_station_profile()
|
||||||
self.cx_profile = self.local_realm.new_l3_cx_profile()
|
self.cx_profile = self.local_realm.new_l3_cx_profile()
|
||||||
|
|
||||||
@@ -49,17 +71,17 @@ class IPV6VariableTime(LFCliBase):
|
|||||||
self.station_profile.security = self.security
|
self.station_profile.security = self.security
|
||||||
self.station_profile.number_template_ = self.number_template
|
self.station_profile.number_template_ = self.number_template
|
||||||
self.station_profile.debug = self.debug
|
self.station_profile.debug = self.debug
|
||||||
self.station_profile.use_ht160 = use_ht160
|
self.station_profile.use_ht160 = _use_ht160
|
||||||
if self.station_profile.use_ht160:
|
if self.station_profile.use_ht160:
|
||||||
self.station_profile.mode = 9
|
self.station_profile.mode = 9
|
||||||
|
|
||||||
self.cx_profile.host = self.host
|
self.cx_profile.host = _host
|
||||||
self.cx_profile.port = self.port
|
self.cx_profile.port = _port
|
||||||
self.cx_profile.name_prefix = self.name_prefix
|
self.cx_profile.name_prefix = _name_prefix
|
||||||
self.cx_profile.side_a_min_bps = side_a_min_rate
|
self.cx_profile.side_a_min_bps = _side_a_min_rate
|
||||||
self.cx_profile.side_a_max_bps = side_a_max_rate
|
self.cx_profile.side_a_max_bps = _side_a_max_rate
|
||||||
self.cx_profile.side_b_min_bps = side_b_min_rate
|
self.cx_profile.side_b_min_bps = _side_b_min_rate
|
||||||
self.cx_profile.side_b_max_bps = side_b_max_rate
|
self.cx_profile.side_b_max_bps = _side_b_max_rate
|
||||||
|
|
||||||
def __get_rx_values(self):
|
def __get_rx_values(self):
|
||||||
cx_list = self.json_get("endp?fields=name,rx+bytes", debug_=self.debug)
|
cx_list = self.json_get("endp?fields=name,rx+bytes", debug_=self.debug)
|
||||||
@@ -136,12 +158,16 @@ class IPV6VariableTime(LFCliBase):
|
|||||||
def pre_cleanup(self):
|
def pre_cleanup(self):
|
||||||
self.cx_profile.cleanup_prefix()
|
self.cx_profile.cleanup_prefix()
|
||||||
for sta in self.sta_list:
|
for sta in self.sta_list:
|
||||||
self.local_realm.rm_port(sta, check_exists=True)
|
self.local_realm.rm_port(sta, check_exists=True, debug_=self.debug)
|
||||||
|
LFUtils.wait_until_ports_disappear(base_url=self.lfclient_url,
|
||||||
|
port_list=self.sta_list,
|
||||||
|
debug=self.debug)
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
self.cx_profile.cleanup()
|
self.cx_profile.cleanup()
|
||||||
self.station_profile.cleanup()
|
self.station_profile.cleanup()
|
||||||
LFUtils.wait_until_ports_disappear(base_url=self.lfclient_url, port_list=self.station_profile.station_names,
|
LFUtils.wait_until_ports_disappear(base_url=self.lfclient_url,
|
||||||
|
port_list=self.station_profile.station_names,
|
||||||
debug=self.debug)
|
debug=self.debug)
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
@@ -153,45 +179,70 @@ class IPV6VariableTime(LFCliBase):
|
|||||||
self.station_profile.set_command_param("set_port", "report_timer", 1500)
|
self.station_profile.set_command_param("set_port", "report_timer", 1500)
|
||||||
self.station_profile.set_command_flag("set_port", "rpt_timer", 1)
|
self.station_profile.set_command_flag("set_port", "rpt_timer", 1)
|
||||||
self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug)
|
self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug)
|
||||||
self.cx_profile.create(endp_type="lf_udp", side_a=self.station_profile.station_names, side_b=self.upstream,
|
self.cx_profile.create(endp_type=self.cx_type, side_a=self.station_profile.station_names, side_b=self.upstream,
|
||||||
sleep_time=0)
|
sleep_time=0)
|
||||||
self._pass("PASS: Station build finished")
|
self._pass("PASS: Station build finished")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
lfjson_port = 8080
|
|
||||||
|
|
||||||
parser = LFCliBase.create_basic_argparse(
|
parser = LFCliBase.create_basic_argparse(
|
||||||
prog='test_ipv6_variable_time.py',
|
prog='test_ipv6_variable_time.py',
|
||||||
# formatter_class=argparse.RawDescriptionHelpFormatter,
|
# formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||||
formatter_class=argparse.RawTextHelpFormatter,
|
formatter_class=argparse.RawTextHelpFormatter,
|
||||||
epilog='''\
|
epilog='''\
|
||||||
Create stations to test IPV6 connection and traffic on VAPs of varying security types (WEP, WPA, WPA2, WPA3, Open)
|
Create stations to test IPV6 connection and traffic on VAPs of varying security types (WEP, WPA, WPA2, WPA3, Open)
|
||||||
''',
|
''',
|
||||||
|
|
||||||
description='''\
|
description='''\
|
||||||
test_ipv6_variable_time.py:
|
test_ipv6_variable_time.py:
|
||||||
--------------------
|
--------------------
|
||||||
Generic command example:
|
Generic command example:
|
||||||
python3 ./test_ipv6_connection.py --upstream_port eth1 \\
|
./test_ipv6_connection.py --upstream_port eth1 \\
|
||||||
--radio wiphy0 \\
|
--radio wiphy0 \\
|
||||||
--num_stations 3 \\
|
--num_stations 3 \\
|
||||||
--security {open|wep|wpa|wpa2|wpa3} \\
|
--security {open|wep|wpa|wpa2|wpa3} \\
|
||||||
--ssid netgear \\
|
--ssid netgear \\
|
||||||
--passwd admin123 \\
|
--passwd admin123 \\
|
||||||
--dest 10.40.0.1 \\
|
--upstream 10.40.0.1 \\
|
||||||
--test_duration 2m \\
|
--test_duration 2m \\
|
||||||
--interval 1s \\
|
--interval 1s \\
|
||||||
--a_min 256000 \\
|
--a_min 256000 \\
|
||||||
--b_min 256000 \\
|
--b_min 256000 \\
|
||||||
--debug
|
--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")
|
||||||
|
|
||||||
parser.add_argument('--a_min', help='--a_min bps rate minimum for side_a', default=256000)
|
optional_args=None
|
||||||
parser.add_argument('--b_min', help='--b_min bps rate minimum for side_b', default=256000)
|
for group in parser._action_groups:
|
||||||
parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m")
|
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()
|
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
|
num_sta = 2
|
||||||
if (args.num_stations is not None) and (int(args.num_stations) > 0):
|
if (args.num_stations is not None) and (int(args.num_stations) > 0):
|
||||||
num_stations_converted = int(args.num_stations)
|
num_stations_converted = int(args.num_stations)
|
||||||
@@ -200,16 +251,24 @@ python3 ./test_ipv6_connection.py --upstream_port eth1 \\
|
|||||||
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)
|
||||||
|
|
||||||
ip_var_test = IPV6VariableTime(host=args.mgr, port=args.mgr_port,
|
ip_var_test = IPV6VariableTime(_host=args.mgr,
|
||||||
number_template="00",
|
_port=args.mgr_port,
|
||||||
sta_list=station_list,
|
_number_template="00",
|
||||||
name_prefix="VT",
|
_sta_list=station_list,
|
||||||
upstream=args.upstream_port,
|
_name_prefix="VT",
|
||||||
ssid=args.ssid,
|
_upstream=args.upstream_port,
|
||||||
password=args.passwd,
|
_ssid=args.ssid,
|
||||||
radio=args.radio,
|
_password=args.passwd,
|
||||||
security=args.security, test_duration=args.test_duration, use_ht160=False,
|
_radio=args.radio,
|
||||||
side_a_min_rate=args.a_min, side_b_min_rate=args.b_min, _debug_on=args.debug)
|
_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.pre_cleanup()
|
||||||
ip_var_test.build()
|
ip_var_test.build()
|
||||||
|
|||||||
Reference in New Issue
Block a user