mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-02 19:58:03 +00:00
more debug in realm, test generic for iperf
This commit is contained in:
@@ -3241,9 +3241,9 @@ class StationProfile:
|
||||
|
||||
# these are unactivated LFRequest objects that we can modify and
|
||||
# re-use inside a loop, reducing the number of object creations
|
||||
add_sta_r = LFRequest.LFRequest(self.lfclient_url + "/cli-json/add_sta")
|
||||
set_port_r = LFRequest.LFRequest(self.lfclient_url + "/cli-json/set_port")
|
||||
wifi_extra_r = LFRequest.LFRequest(self.lfclient_url + "/cli-json/set_wifi_extra")
|
||||
add_sta_r = LFRequest.LFRequest(self.lfclient_url + "/cli-json/add_sta", debug_=debug)
|
||||
set_port_r = LFRequest.LFRequest(self.lfclient_url + "/cli-json/set_port",debug_=debug)
|
||||
wifi_extra_r = LFRequest.LFRequest(self.lfclient_url + "/cli-json/set_wifi_extra",debug_=debug)
|
||||
my_sta_names = []
|
||||
#add radio here
|
||||
if (num_stations > 0) and (len(sta_names_) < 1):
|
||||
@@ -3307,7 +3307,7 @@ class StationProfile:
|
||||
continue
|
||||
|
||||
# print("- 3264 - ## %s ## add_sta_r.jsonPost - - - - - - - - - - - - - - - - - - "%eidn)
|
||||
json_response = add_sta_r.jsonPost(debug)
|
||||
json_response = add_sta_r.jsonPost(debug=self.debug)
|
||||
finished_sta.append(eidn)
|
||||
# print("- ~3264 - %s - add_sta_r.jsonPost - - - - - - - - - - - - - - - - - - "%eidn)
|
||||
time.sleep(0.01)
|
||||
|
||||
@@ -19,7 +19,7 @@ import datetime
|
||||
import json
|
||||
|
||||
class GenTest(LFCliBase):
|
||||
def __init__(self, host, port, ssid, security, passwd, sta_list, name_prefix, upstream,
|
||||
def __init__(self, ssid, security, passwd, sta_list, client, name_prefix, upstream, host="localhost", port=8080,
|
||||
number_template="000", test_duration="5m", type="lfping", dest=None, cmd =None,
|
||||
interval=1, radio=None, speedtest_min_up=None, speedtest_min_dl=None, speedtest_max_ping=None,
|
||||
_debug_on=False,
|
||||
@@ -42,7 +42,8 @@ class GenTest(LFCliBase):
|
||||
if (speedtest_max_ping is not None):
|
||||
self.speedtest_max_ping = float(speedtest_max_ping)
|
||||
self.debug = _debug_on
|
||||
|
||||
if (client is not None):
|
||||
self.client_name = client
|
||||
self.station_profile = self.local_realm.new_station_profile()
|
||||
self.generic_endps_profile = self.local_realm.new_generic_endp_profile()
|
||||
|
||||
@@ -75,6 +76,16 @@ class GenTest(LFCliBase):
|
||||
def choose_lfcurl_command(self):
|
||||
return False, ''
|
||||
|
||||
def choose_iperf3_command(self):
|
||||
gen_results = self.json_get("generic/list?fields=name,last+results", debug_=self.debug)
|
||||
if gen_results['endpoints'] is not None:
|
||||
pprint.pprint(gen_results['endpoints'])
|
||||
#for name in gen_results['endpoints']:
|
||||
# pprint.pprint(name.items)
|
||||
#for k,v in name.items():
|
||||
exit(1)
|
||||
|
||||
|
||||
def choose_speedtest_command(self):
|
||||
gen_results = self.json_get("generic/list?fields=name,last+results", debug_=self.debug)
|
||||
if gen_results['endpoints'] is not None:
|
||||
@@ -135,9 +146,7 @@ class GenTest(LFCliBase):
|
||||
result = self.choose_iperf3_command()
|
||||
else:
|
||||
continue
|
||||
|
||||
expected_passes += 1
|
||||
# pprint.pprint(result)
|
||||
if result is not None:
|
||||
if result[0]:
|
||||
passes += 1
|
||||
@@ -174,8 +183,6 @@ class GenTest(LFCliBase):
|
||||
|
||||
|
||||
def main():
|
||||
lfjson_port = 8080
|
||||
|
||||
parser = LFCliBase.create_basic_argparse(
|
||||
prog='test_generic.py',
|
||||
formatter_class=argparse.RawTextHelpFormatter,
|
||||
@@ -212,7 +219,8 @@ python3 ./test_generic.py
|
||||
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
|
||||
''')
|
||||
|
||||
required = parser.add_argument_group('required arguments')
|
||||
required.add_argument('--security', help='WiFi Security protocol: < open | wep | wpa | wpa2 | wpa3 >', required=True)
|
||||
parser.add_argument('--type', help='type of command to run: generic, lfping, iperf3-client, iperf3-server, lfcurl', default="lfping")
|
||||
parser.add_argument('--cmd', help='specifies command to be run by generic type endp', default='')
|
||||
parser.add_argument('--dest', help='destination IP for command', default="10.40.0.1")
|
||||
@@ -221,6 +229,7 @@ python3 ./test_generic.py
|
||||
parser.add_argument('--speedtest_min_up', help='sets the minimum upload threshold for the speedtest type', default=None)
|
||||
parser.add_argument('--speedtest_min_dl', help='sets the minimum download threshold for the speedtest type', default=None)
|
||||
parser.add_argument('--speedtest_max_ping', help='sets the minimum ping threshold for the speedtest type', default=None)
|
||||
parser.add_argument('--client', help='client to the iperf3 server',default=None)
|
||||
|
||||
args = parser.parse_args()
|
||||
num_sta = 2
|
||||
@@ -251,6 +260,7 @@ python3 ./test_generic.py
|
||||
speedtest_min_up=args.speedtest_min_up,
|
||||
speedtest_min_dl=args.speedtest_min_dl,
|
||||
speedtest_max_ping=args.speedtest_max_ping,
|
||||
client=args.client,
|
||||
_debug_on=args.debug)
|
||||
|
||||
generic_test.cleanup(station_list)
|
||||
|
||||
@@ -181,8 +181,8 @@ Generic command layout:
|
||||
--radio wiphy0
|
||||
--num_stations 32
|
||||
--security {open|wep|wpa|wpa2|wpa3} \\
|
||||
--ssid netgear \\
|
||||
--password admin123 \\
|
||||
--ssid netgear
|
||||
--password admin123
|
||||
--a_min 1000
|
||||
--b_min 1000
|
||||
--debug
|
||||
|
||||
@@ -18,7 +18,7 @@ import pprint
|
||||
|
||||
|
||||
class IPv6Test(LFCliBase):
|
||||
def __init__(self, host, port, ssid, security, password, sta_list=None, num_stations=0, prefix="00000",
|
||||
def __init__(self, ssid, security, password, sta_list=None, num_stations=0, prefix="00000", host="localhost", port=8080,
|
||||
_debug_on=False, timeout=120, radio="wiphy0",
|
||||
_exit_on_error=False,
|
||||
_exit_on_fail=False,
|
||||
@@ -68,16 +68,21 @@ class IPv6Test(LFCliBase):
|
||||
name = self.local_realm.name_to_eid(sta_name)[2]
|
||||
sta_status = self.json_get("port/%s/%s/%s?fields=port,alias,ipv6+address,ap" % (shelf, resource, name),
|
||||
debug_=self.debug)
|
||||
# print(sta_status)
|
||||
if self.debug:
|
||||
print(sta_status)
|
||||
if sta_status is None or sta_status['interface'] is None or sta_status['interface']['ap'] is None:
|
||||
continue
|
||||
if len(sta_status['interface']['ap']) == 17 and sta_status['interface']['ap'][-3] == ':':
|
||||
# print("Associated", sta_name, sta_status['interface']['ap'], sta_status['interface']['ip'])
|
||||
if self.debug:
|
||||
pprint.pprint(sta_status['interface'])
|
||||
#print("Associated", sta_name, sta_status['interface']['ap'], sta_status['interface']['ip'])
|
||||
associated_map[sta_name] = 1
|
||||
if sta_status['interface']['ipv6 address'] != 'DELETED' and \
|
||||
not sta_status['interface']['ipv6 address'].startswith('fe80') \
|
||||
and sta_status['interface']['ipv6 address'] != 'AUTO':
|
||||
# print("IP", sta_name, sta_status['interface']['ap'], sta_status['interface']['ip'])
|
||||
if self.debug:
|
||||
|
||||
print("IP", sta_name, sta_status['interface']['ap'], sta_status['interface']['ip'])
|
||||
ip_map[sta_name] = 1
|
||||
if (len(sta_list) == len(ip_map)) and (len(sta_list) == len(associated_map)):
|
||||
break
|
||||
@@ -109,8 +114,6 @@ class IPv6Test(LFCliBase):
|
||||
|
||||
|
||||
def main():
|
||||
lfjson_port = 8080
|
||||
|
||||
parser = LFCliBase.create_basic_argparse(
|
||||
prog='test_ipv6_connection.py',
|
||||
# formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
@@ -137,7 +140,11 @@ python3 ./test_ipv6_connection.py --upstream_port eth1 \\
|
||||
--debug
|
||||
''')
|
||||
|
||||
parser.add_argument('--timeout', help='--timeout sets the length of time to wait until a connection is successful', default=120)
|
||||
|
||||
optional = parser.add_argument_group('optional arguments')
|
||||
required = parser.add_argument_group('required arguments')
|
||||
required.add_argument('--security', help='WiFi Security protocol: < open | wep | wpa | wpa2 | wpa3 >', required=True)
|
||||
parser.add_argument('--timeout', help='--timeout sets the length of time to wait until a connection is successful', default=30)
|
||||
|
||||
args = parser.parse_args()
|
||||
num_sta=2
|
||||
@@ -152,7 +159,8 @@ python3 ./test_ipv6_connection.py --upstream_port eth1 \\
|
||||
ssid=args.ssid,
|
||||
password=args.passwd,
|
||||
security=args.security,
|
||||
sta_list=station_list)
|
||||
sta_list=station_list,
|
||||
_debug_on=args.debug)
|
||||
ipv6_test.cleanup(station_list)
|
||||
ipv6_test.build()
|
||||
if not ipv6_test.passes():
|
||||
|
||||
Reference in New Issue
Block a user