From 8be8ae6112128aefeecf5fb63af3386b1fec013c Mon Sep 17 00:00:00 2001 From: Jed Reynolds Date: Tue, 9 Jun 2020 13:52:03 -0700 Subject: [PATCH] sta_connect_multi_example - demonstrates connecting multiple stations and passing traffic --- py-scripts/sta_connect_multi_example.py | 64 +++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 py-scripts/sta_connect_multi_example.py diff --git a/py-scripts/sta_connect_multi_example.py b/py-scripts/sta_connect_multi_example.py new file mode 100755 index 00000000..7685516f --- /dev/null +++ b/py-scripts/sta_connect_multi_example.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 + + +# Example of how to instantiate StaConnect and run the test + +import sys + +if sys.version_info[0] != 3: + print("This script requires Python 3") + exit(1) +if 'py-json' not in sys.path: + sys.path.append('../py-json') + +# if you lack __init__.py in this directory you will not find sta_connect module +import sta_connect +from sta_connect import * +import realm +from realm import Realm +import LANforge +from LANforge import LFUtils + +def main(): + # create multiple open stations + station_names = LFUtils.port_name_series(start_id=0, end_id=1) + test = StaConnect("localhost", 8080, _debugOn=False) + test.sta_mode = sta_connect.MODE_AUTO + test.upstream_resource = 1 + test.upstream_port = "eth1" + test.radio = "wiphy0" + test.resource = 1 + test.dut_security = sta_connect.OPEN + test.dut_ssid = "jedway-open" + test.dut_passwd = "NA" + test.name_list = station_names + test.run() + is_passing = test.passes() + if is_passing == False: + # run_results = staConnect.get_failed_result_list() + fail_message = test.get_fail_message() + print("Some tests failed:\n" + fail_message) + else: + print("Tests pass") + test.remove_stations() + + test.dut_security = sta_connect.WPA2 + test.dut_ssid = "jedway-wpa2-x2048-5-1" + test.dut_passwd = "jedway-wpa2-x2048-5-1" + test.run() + is_passing = test.passes() + if is_passing == False: + # run_results = staConnect.get_failed_result_list() + fail_message = test.get_fail_message() + print("Some tests failed:\n" + fail_message) + else: + print("Tests pass") + test.remove_stations() + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +if __name__ == '__main__': + main() + +#