mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 03:07:56 +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)
|
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...")
|
print("Waiting until ports appear admin-down...")
|
||||||
up_stations = port_list.copy()
|
up_stations = port_list.copy()
|
||||||
sleep(1)
|
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)
|
lf_r = LFRequest.LFRequest(base_url, uri)
|
||||||
json_response = lf_r.getAsJson(debug_=False)
|
json_response = lf_r.getAsJson(debug_=False)
|
||||||
if json_response == None:
|
if json_response == None:
|
||||||
print("port %s disappeared" % port_name)
|
if debug_:
|
||||||
|
print("port %s disappeared" % port_name)
|
||||||
continue
|
continue
|
||||||
if "interface" in json_response:
|
if "interface" in json_response:
|
||||||
json_response = json_response['interface']
|
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=()):
|
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)
|
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...")
|
print("Waiting until ports appear admin-up...")
|
||||||
down_stations = port_list.copy()
|
down_stations = port_list.copy()
|
||||||
sleep(1)
|
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)
|
lf_r = LFRequest.LFRequest(base_url, uri)
|
||||||
json_response = lf_r.getAsJson(debug_=False)
|
json_response = lf_r.getAsJson(debug_=False)
|
||||||
if json_response == None:
|
if json_response == None:
|
||||||
print("port %s appeared" % port_name)
|
if debug_:
|
||||||
|
print("port %s appeared" % port_name)
|
||||||
continue
|
continue
|
||||||
if "interface" in json_response:
|
if "interface" in json_response:
|
||||||
json_response = json_response['interface']
|
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)
|
return wait_until_ports_appear(base_url, port_list, debug=debug)
|
||||||
|
|
||||||
def name_to_eid(input):
|
def name_to_eid(input):
|
||||||
rv = [1, 1, ""];
|
rv = [1, 1, ""]
|
||||||
info = []
|
info = []
|
||||||
if (input is None) or (input == ""):
|
if (input is None) or (input == ""):
|
||||||
raise ValueError("name_to_eid wants eid like 1.1.sta0 but given[%s]" % 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):
|
def choose_ping_command(self):
|
||||||
gen_results = self.json_get("generic/list?fields=name,last+results", debug_=self.debug)
|
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:
|
if gen_results['endpoints'] is not None:
|
||||||
for name in gen_results['endpoints']:
|
for name in gen_results['endpoints']:
|
||||||
for k, v in name.items():
|
for k, v in name.items():
|
||||||
@@ -104,13 +105,14 @@ class GenTest(LFCliBase):
|
|||||||
temp_stas = []
|
temp_stas = []
|
||||||
for station in self.sta_list.copy():
|
for station in self.sta_list.copy():
|
||||||
temp_stas.append(self.local_realm.name_to_eid(station)[2])
|
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)
|
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):
|
if self.local_realm.wait_for_ip(temp_stas):
|
||||||
self._pass("All stations got IPs", print_pass)
|
self._pass("All stations got IPs")
|
||||||
else:
|
else:
|
||||||
self._fail("Stations failed to get IPs", print_fail)
|
self._fail("Stations failed to get IPs")
|
||||||
exit(1)
|
self.exit_fail()
|
||||||
cur_time = datetime.datetime.now()
|
cur_time = datetime.datetime.now()
|
||||||
passes = 0
|
passes = 0
|
||||||
expected_passes = 0
|
expected_passes = 0
|
||||||
@@ -140,17 +142,15 @@ class GenTest(LFCliBase):
|
|||||||
if result[0]:
|
if result[0]:
|
||||||
passes += 1
|
passes += 1
|
||||||
else:
|
else:
|
||||||
self._fail("%s Failed to ping %s " % (result[1], self.generic_endps_profile.dest),
|
self._fail("%s Failed to ping %s " % (result[1], self.generic_endps_profile.dest))
|
||||||
print_fail)
|
|
||||||
break
|
break
|
||||||
# print(cur_time)
|
|
||||||
# print(end_time)
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
if passes == expected_passes:
|
if passes == expected_passes:
|
||||||
self._pass("PASS: All tests passed", print_pass)
|
self._pass("PASS: All tests passed")
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
|
print("Stopping Test...")
|
||||||
self.generic_endps_profile.stop_cx()
|
self.generic_endps_profile.stop_cx()
|
||||||
self.station_profile.admin_down()
|
self.station_profile.admin_down()
|
||||||
|
|
||||||
@@ -183,9 +183,12 @@ def main():
|
|||||||
description='''test_generic.py
|
description='''test_generic.py
|
||||||
--------------------
|
--------------------
|
||||||
Generic command example:
|
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)
|
--radio wiphy0 (required)
|
||||||
--num_stations 3
|
--num_stations 3 (optional)
|
||||||
--security {open|wep|wpa|wpa2|wpa3} (required)
|
--security {open|wep|wpa|wpa2|wpa3} (required)
|
||||||
--ssid netgear (required)
|
--ssid netgear (required)
|
||||||
--passwd admin123 (required)
|
--passwd admin123 (required)
|
||||||
@@ -198,13 +201,13 @@ python3 ./test_generic.py --upstream_port eth1
|
|||||||
|
|
||||||
Example commands:
|
Example commands:
|
||||||
LFPING:
|
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):
|
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:
|
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:
|
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
|
--speedtest_min_dl 20 --speedtest_max_ping 150 --security wpa2
|
||||||
IPERF3 (under construction):
|
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
|
./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()
|
generic_test.build()
|
||||||
if not generic_test.passes():
|
if not generic_test.passes():
|
||||||
print(generic_test.get_fail_message())
|
print(generic_test.get_fail_message())
|
||||||
exit(1)
|
generic_test.exit_fail()
|
||||||
generic_test.start()
|
generic_test.start()
|
||||||
if not generic_test.passes():
|
if not generic_test.passes():
|
||||||
print(generic_test.get_fail_message())
|
print(generic_test.get_fail_message())
|
||||||
exit(1)
|
generic_test.exit_fail()
|
||||||
generic_test.stop()
|
generic_test.stop()
|
||||||
time.sleep(30)
|
time.sleep(30)
|
||||||
generic_test.cleanup(station_list)
|
generic_test.cleanup(station_list)
|
||||||
if generic_test.passes():
|
if generic_test.passes():
|
||||||
print("Full test passed")
|
generic_test.exit_success()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user