mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-10-31 18:58:01 +00:00 
			
		
		
		
	- much less output if not debug - changes according to lfcli
This commit is contained in:
		| @@ -389,7 +389,7 @@ def waitUntilPortsAdminDown(resource_id=1, base_url="http://localhost:8080", por | ||||
|     return wait_until_ports_admin_down(resource_id=resource_id, base_url=base_url, port_list=port_list) | ||||
|  | ||||
|  | ||||
| def wait_until_ports_admin_down(resource_id=1, base_url="http://localhost:8080", port_list=()): | ||||
| def wait_until_ports_admin_down(resource_id=1, base_url="http://localhost:8080", debug_=False, port_list=()): | ||||
|     print("Waiting until ports appear admin-down...") | ||||
|     up_stations = port_list.copy() | ||||
|     sleep(1) | ||||
| @@ -401,7 +401,8 @@ def wait_until_ports_admin_down(resource_id=1, base_url="http://localhost:8080", | ||||
|             lf_r = LFRequest.LFRequest(base_url, uri) | ||||
|             json_response = lf_r.getAsJson(debug_=False) | ||||
|             if json_response == None: | ||||
|                 print("port %s disappeared" % port_name) | ||||
|                 if debug_: | ||||
|                     print("port %s disappeared" % port_name) | ||||
|                 continue | ||||
|             if "interface" in json_response: | ||||
|                 json_response = json_response['interface'] | ||||
| @@ -414,7 +415,7 @@ def wait_until_ports_admin_down(resource_id=1, base_url="http://localhost:8080", | ||||
| def waitUntilPortsAdminUp(resource_id=1, base_url="http://localhost:8080", port_list=()): | ||||
|     return wait_until_ports_admin_up(resource_id=resource_id, base_url=base_url, port_list=port_list) | ||||
|  | ||||
| def wait_until_ports_admin_up(resource_id=1, base_url="http://localhost:8080", port_list=()): | ||||
| def wait_until_ports_admin_up(resource_id=1, base_url="http://localhost:8080", port_list=(), debug_=False): | ||||
|     print("Waiting until  ports appear admin-up...") | ||||
|     down_stations = port_list.copy() | ||||
|     sleep(1) | ||||
| @@ -427,7 +428,8 @@ def wait_until_ports_admin_up(resource_id=1, base_url="http://localhost:8080", p | ||||
|             lf_r = LFRequest.LFRequest(base_url, uri) | ||||
|             json_response = lf_r.getAsJson(debug_=False) | ||||
|             if json_response == None: | ||||
|                 print("port %s appeared" % port_name) | ||||
|                 if debug_: | ||||
|                     print("port %s appeared" % port_name) | ||||
|                 continue | ||||
|             if "interface" in json_response: | ||||
|                 json_response = json_response['interface'] | ||||
| @@ -476,7 +478,7 @@ def waitUntilPortsAppear(base_url="http://localhost:8080", port_list=(), debug=F | ||||
|     return wait_until_ports_appear(base_url, port_list, debug=debug) | ||||
|  | ||||
| def name_to_eid(input): | ||||
|     rv = [1, 1, ""]; | ||||
|     rv = [1, 1, ""] | ||||
|     info = [] | ||||
|     if (input is None) or (input == ""): | ||||
|         raise ValueError("name_to_eid wants eid like 1.1.sta0 but given[%s]" % input) | ||||
|   | ||||
| @@ -61,7 +61,8 @@ class GenTest(LFCliBase): | ||||
|  | ||||
|     def choose_ping_command(self): | ||||
|         gen_results = self.json_get("generic/list?fields=name,last+results", debug_=self.debug) | ||||
|         print(gen_results) | ||||
|         if self.debug: | ||||
|             print(gen_results) | ||||
|         if gen_results['endpoints'] is not None: | ||||
|             for name in gen_results['endpoints']: | ||||
|                 for k, v in name.items(): | ||||
| @@ -104,13 +105,14 @@ class GenTest(LFCliBase): | ||||
|         temp_stas = [] | ||||
|         for station in self.sta_list.copy(): | ||||
|             temp_stas.append(self.local_realm.name_to_eid(station)[2]) | ||||
|         pprint.pprint(self.station_profile.station_names) | ||||
|         if self.debug: | ||||
|             pprint.pprint(self.station_profile.station_names) | ||||
|         LFUtils.wait_until_ports_admin_up(base_url=self.lfclient_url, port_list=self.station_profile.station_names) | ||||
|         if self.local_realm.wait_for_ip(temp_stas): | ||||
|             self._pass("All stations got IPs", print_pass) | ||||
|             self._pass("All stations got IPs") | ||||
|         else: | ||||
|             self._fail("Stations failed to get IPs", print_fail) | ||||
|             exit(1) | ||||
|             self._fail("Stations failed to get IPs") | ||||
|             self.exit_fail() | ||||
|         cur_time = datetime.datetime.now() | ||||
|         passes = 0 | ||||
|         expected_passes = 0 | ||||
| @@ -140,17 +142,15 @@ class GenTest(LFCliBase): | ||||
|                 if result[0]: | ||||
|                     passes += 1 | ||||
|                 else: | ||||
|                     self._fail("%s Failed to ping %s " % (result[1], self.generic_endps_profile.dest), | ||||
|                                print_fail) | ||||
|                     self._fail("%s Failed to ping %s " % (result[1], self.generic_endps_profile.dest)) | ||||
|                     break | ||||
|             # print(cur_time) | ||||
|             # print(end_time) | ||||
|             time.sleep(1) | ||||
|  | ||||
|         if passes == expected_passes: | ||||
|             self._pass("PASS: All tests passed", print_pass) | ||||
|             self._pass("PASS: All tests passed") | ||||
|  | ||||
|     def stop(self): | ||||
|         print("Stopping Test...") | ||||
|         self.generic_endps_profile.stop_cx() | ||||
|         self.station_profile.admin_down() | ||||
|  | ||||
| @@ -183,9 +183,12 @@ def main(): | ||||
|         description='''test_generic.py | ||||
| -------------------- | ||||
| Generic command example: | ||||
| python3 ./test_generic.py --upstream_port eth1  | ||||
| python3 ./test_generic.py  | ||||
|     --mgr localhost (optional) | ||||
|     --mgr_port 4122 (optional) | ||||
|     --upstream_port eth1 (optional) | ||||
|     --radio wiphy0 (required) | ||||
|     --num_stations 3  | ||||
|     --num_stations 3 (optional) | ||||
|     --security {open|wep|wpa|wpa2|wpa3} (required) | ||||
|     --ssid netgear (required) | ||||
|     --passwd admin123 (required) | ||||
| @@ -198,13 +201,13 @@ python3 ./test_generic.py --upstream_port eth1 | ||||
|  | ||||
|     Example commands:  | ||||
|     LFPING: | ||||
|     ./test_generic.py --mgr localhost --mgr_port 4122 --radio wiphy0 --num_stations 3 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --type lfping --dest 10.40.0.1 --security wpa2 | ||||
|     ./test_generic.py --mgr localhost --mgr_port 4122 --radio wiphy0 --num_stations 7 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --type lfping --dest 10.40.0.1 --security wpa2 | ||||
|     LFCURL (under construction): | ||||
|     ./test_generic.py --mgr localhost --mgr_port 4122 --radio wiphy1  --num_stations 3 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --security wpa2 --type lfcurl --dest 10.40.0.1 | ||||
|     ./test_generic.py --mgr localhost --mgr_port 4122 --radio wiphy1  --num_stations 26 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --security wpa2 --type lfcurl --dest 10.40.0.1 | ||||
|     GENERIC:  | ||||
|     ./test_generic.py --mgr localhost--mgr_port 4122 --radio wiphy1  --num_stations 3 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --security wpa2 --type generic | ||||
|     ./test_generic.py --mgr localhost--mgr_port 4122 --radio wiphy1  --num_stations 2 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --security wpa2 --type generic | ||||
|     SPEEDTEST: | ||||
|   ./test_generic.py --mgr localhost --mgr_port 4122 --radio wiphy2 --num_stations 3 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --type speedtest --speedtest_min_up 20  | ||||
|   ./test_generic.py --mgr localhost --mgr_port 4122 --radio wiphy2 --num_stations 13 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --type speedtest --speedtest_min_up 20  | ||||
|     --speedtest_min_dl 20 --speedtest_max_ping 150 --security wpa2 | ||||
|     IPERF3 (under construction): | ||||
|    ./test_generic.py --mgr localhost --mgr_port 4122 --radio wiphy1 --num_stations 3 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --security wpa2 --type iperf3  | ||||
| @@ -254,16 +257,16 @@ python3 ./test_generic.py --upstream_port eth1 | ||||
|     generic_test.build() | ||||
|     if not generic_test.passes(): | ||||
|         print(generic_test.get_fail_message()) | ||||
|         exit(1) | ||||
|         generic_test.exit_fail()         | ||||
|     generic_test.start() | ||||
|     if not generic_test.passes(): | ||||
|         print(generic_test.get_fail_message()) | ||||
|         exit(1) | ||||
|         generic_test.exit_fail() | ||||
|     generic_test.stop() | ||||
|     time.sleep(30) | ||||
|     generic_test.cleanup(station_list) | ||||
|     if generic_test.passes(): | ||||
|         print("Full test passed") | ||||
|         generic_test.exit_success() | ||||
|  | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Dipti
					Dipti