script updates according to realm and lfcli

This commit is contained in:
Dipti
2020-12-10 23:12:39 -08:00
parent e8cd01461d
commit 5216050f6d
4 changed files with 28 additions and 37 deletions

View File

@@ -18,7 +18,7 @@ import pprint
class IPv4Test(LFCliBase):
def __init__(self, host, port, ssid, security, password, sta_list=None, number_template="00000", _debug_on=False,
def __init__(self, host, port, ssid, security, password, sta_list=None, number_template="00000", radio ="wiphy0",_debug_on=False,
_exit_on_error=False,
_exit_on_fail=False):
super().__init__(host, port, _debug=_debug_on, _halt_on_error=_exit_on_error, _exit_on_fail=_exit_on_fail)
@@ -29,6 +29,7 @@ class IPv4Test(LFCliBase):
self.password = password
self.sta_list = sta_list
self.timeout = 120
self.radio=radio
self.number_template = number_template
self.debug = _debug_on
self.local_realm = realm.Realm(lfclient_host=self.host, lfclient_port=self.port)
@@ -49,14 +50,14 @@ class IPv4Test(LFCliBase):
self.station_profile.set_command_flag("add_sta", "create_admin_down", 1)
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.create(radio="wiphy0", sta_names_=self.sta_list, debug=self.debug)
self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug)
self.station_profile.admin_up()
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
self._pass("Station build finished")
self.passed()
self.exit_success()
else:
self._fail("Stations not able to acquire IP. Please check network input.")
self.failed()
self.exit_fail()
def cleanup(self, sta_list):
@@ -77,7 +78,7 @@ def main():
''',
description='''\
example_wpa_connection.py
example_open_connection.py
--------------------
Generic command example:
@@ -85,12 +86,10 @@ def main():
--host localhost (optional) \\
--port 8080 (optional) \\
--num_stations 3 \\
--security {open|wep|wpa|wpa2|wpa3} \\
--radio wiphy1 (optional)
--ssid netgear-open \\
--passwd [BLANK]
--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()
@@ -103,7 +102,7 @@ def main():
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)
security="open", radio=args.radio, sta_list=station_list)
ip_test.cleanup(station_list)
ip_test.timeout = 60
ip_test.build()

View File

@@ -54,10 +54,10 @@ class IPv4Test(LFCliBase):
self.station_profile.admin_up()
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
self._pass("Station build finished")
self.passed()
self.exit_success()
else:
self._fail("Stations not able to acquire IP. Please check network input.")
self.failed()
self.exit_fail()
def cleanup(self, sta_list):
self.station_profile.cleanup(sta_list)
@@ -85,9 +85,9 @@ def main():
--host localhost (optional) \\
--port 8080 (optional) \\
--num_stations 3 \\
--security {open|wep|wpa|wpa2|wpa3} \\
--ssid netgear-wpa2 \\
--passwd admin123-wpa2 \\
--radio wiphy1
--debug
Note: multiple --radio switches may be entered up to the number of radios available:
@@ -106,7 +106,7 @@ def main():
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)
security="wiphy0", sta_list=station_list)
ip_test.cleanup(station_list)
ip_test.timeout = 60
ip_test.build()

View File

@@ -54,10 +54,10 @@ class IPv4Test(LFCliBase):
self.station_profile.admin_up()
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
self._pass("Station build finished")
self.passed()
self.exit_success()
else:
self._fail("Stations not able to acquire IP. Please check network input.")
self.failed()
self.exit_fail()
def cleanup(self, sta_list):
@@ -78,21 +78,18 @@ def main():
''',
description='''\
example_wpa_connection.py
example_wpa3_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 \\
python3 ./example_wpa3_connection.py
--host localhost (optional)
--port 8080 (optional)
--num_stations 3
--ssid netgear-wpa3
--passwd admin123-wpa3
--radio wiphy1
--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()
@@ -107,7 +104,7 @@ def main():
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)
security="wpa3", sta_list=station_list)
ip_test.cleanup(station_list)
ip_test.timeout = 60
ip_test.build()

View File

@@ -54,11 +54,11 @@ class IPv4Test(LFCliBase):
self.station_profile.admin_up()
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
self._pass("Station build finished")
self.passed()
self.exit_success()
else:
self._fail("Stations not able to acquire IP. Please check network input.")
self.failed()
self.exit_fail()
def cleanup(self, sta_list):
@@ -89,13 +89,10 @@ def main():
--host localhost (optional) \\
--port 8080 (optional) \\
--num_stations 3 \\
--security {open|wep|wpa|wpa2|wpa3} \\
--ssid netgear-wpa \\
--passwd admin123-wpa \\
--radio wiphy1
--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>
''')
parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m")
@@ -114,9 +111,7 @@ def main():
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 = IPv4Test(lfjson_host, lfjson_port, ssid="jedway-wpa-1", password="jedway-wpa-1",
#security="wpa", sta_list=station_list)
security="wpa", sta_list=station_list)
ip_test.cleanup(station_list)
ip_test.timeout = 60
ip_test.build()