mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-11-04 04:38:02 +00:00 
			
		
		
		
	sta_connect_example.py: shows example of how to get passing state and failure messages
This commit is contained in:
		@@ -3,17 +3,17 @@
 | 
				
			|||||||
# Example of how to instantiate StaConnect and run the test
 | 
					# Example of how to instantiate StaConnect and run the test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if sys.version_info[0] != 3:
 | 
					if sys.version_info[0] != 3:
 | 
				
			||||||
    print("This script requires Python 3")
 | 
					    print("This script requires Python 3")
 | 
				
			||||||
    exit(1)
 | 
					    exit(1)
 | 
				
			||||||
if 'py-json' not in sys.path:
 | 
					if 'py-json' not in sys.path:
 | 
				
			||||||
    sys.path.append('../py-json')
 | 
					    sys.path.append('../py-json')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from LANforge.LFUtils import *
 | 
					 | 
				
			||||||
# if you lack __init__.py in this directory you will not find sta_connect module
 | 
					# if you lack __init__.py in this directory you will not find sta_connect module
 | 
				
			||||||
import sta_connect
 | 
					 | 
				
			||||||
from sta_connect import StaConnect
 | 
					from sta_connect import StaConnect
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def main():
 | 
					def main():
 | 
				
			||||||
    staConnect = StaConnect("localhost", 8080)
 | 
					    staConnect = StaConnect("localhost", 8080)
 | 
				
			||||||
    staConnect.sta_mode = 0
 | 
					    staConnect.sta_mode = 0
 | 
				
			||||||
@@ -24,9 +24,15 @@ def main():
 | 
				
			|||||||
    staConnect.dut_ssid = "jedway-wpa2-x2048-5-1"
 | 
					    staConnect.dut_ssid = "jedway-wpa2-x2048-5-1"
 | 
				
			||||||
    staConnect.dut_passwd = "jedway-wpa2-x2048-5-1"
 | 
					    staConnect.dut_passwd = "jedway-wpa2-x2048-5-1"
 | 
				
			||||||
    staConnect.run()
 | 
					    staConnect.run()
 | 
				
			||||||
    run_results = staConnect.get_result_list()
 | 
					    is_passing = staConnect.passes()
 | 
				
			||||||
    for result in run_results:
 | 
					    if is_passing == False:
 | 
				
			||||||
        print("test result: "+result)
 | 
					        # run_results = staConnect.get_failed_result_list()
 | 
				
			||||||
 | 
					        fail_message = staConnect.get_fail_message()
 | 
				
			||||||
 | 
					        print("Some tests failed:\n" + fail_message)
 | 
				
			||||||
 | 
					    else:
 | 
				
			||||||
 | 
					        print("Tests pass")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
					# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user