sta_connect_multi_example.py: demonstrates using StaConnect to operate multiple tests on multiple ports

This commit is contained in:
Jed Reynolds
2020-06-09 14:09:12 -07:00
parent 8be8ae6112
commit bc5f2feb49

View File

@@ -20,7 +20,7 @@ import LANforge
from LANforge import LFUtils from LANforge import LFUtils
def main(): def main():
# create multiple open stations # create multiple OPEN stations
station_names = LFUtils.port_name_series(start_id=0, end_id=1) station_names = LFUtils.port_name_series(start_id=0, end_id=1)
test = StaConnect("localhost", 8080, _debugOn=False) test = StaConnect("localhost", 8080, _debugOn=False)
test.sta_mode = sta_connect.MODE_AUTO test.sta_mode = sta_connect.MODE_AUTO
@@ -31,17 +31,20 @@ def main():
test.dut_security = sta_connect.OPEN test.dut_security = sta_connect.OPEN
test.dut_ssid = "jedway-open" test.dut_ssid = "jedway-open"
test.dut_passwd = "NA" test.dut_passwd = "NA"
test.name_list = station_names test.station_names = station_names
test.run() test.run()
is_passing = test.passes() is_passing = test.passes()
if is_passing == False: if is_passing == False:
# run_results = staConnect.get_failed_result_list() # run_results = staConnect.get_failed_result_list()
fail_message = test.get_fail_message() fail_message = test.get_fail_message()
print("Some tests failed:\n" + fail_message) print("Some tests failed:\n" + fail_message)
return
else: else:
print("Tests pass") print("Tests pass")
test.remove_stations() test.remove_stations()
# Stations use WPA2
test.dut_security = sta_connect.WPA2 test.dut_security = sta_connect.WPA2
test.dut_ssid = "jedway-wpa2-x2048-5-1" test.dut_ssid = "jedway-wpa2-x2048-5-1"
test.dut_passwd = "jedway-wpa2-x2048-5-1" test.dut_passwd = "jedway-wpa2-x2048-5-1"
@@ -51,8 +54,10 @@ def main():
# run_results = staConnect.get_failed_result_list() # run_results = staConnect.get_failed_result_list()
fail_message = test.get_fail_message() fail_message = test.get_fail_message()
print("Some tests failed:\n" + fail_message) print("Some tests failed:\n" + fail_message)
return
else: else:
print("Tests pass") print("Tests pass")
test.remove_stations() test.remove_stations()
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -