mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 19:28:00 +00:00
Merge branch 'master' of github.com:greearb/lanforge-scripts
This commit is contained in:
@@ -57,7 +57,11 @@ if (-f "$fname") {
|
||||
open(FILE, ">$fname") or die "Couldn't open file: $fname for writing: $!\n\n";
|
||||
my $foundit = 0;
|
||||
my $i;
|
||||
chomp(@lines);
|
||||
# chomp is way to simplistic if we need to weed out \r\n characters as well
|
||||
#chomp(@lines);
|
||||
for( my $i=0; $i < @lines; $i++) {
|
||||
($lines[$i]) = $lines[$i] =~ /^([^\r\n]+)\r?\n$/;
|
||||
}
|
||||
# we want to consolidate the $ip $hostname entry for MgrHostname
|
||||
my @newlines = ();
|
||||
my %more_hostnames = ();
|
||||
@@ -65,7 +69,10 @@ if (-f "$fname") {
|
||||
#my $blank = 0;
|
||||
#my $was_blank = 0;
|
||||
my $counter = 0;
|
||||
my $debug = 1;
|
||||
my $debug = 0;
|
||||
if ((exists $ENV{"DEBUG"}) && ($ENV{"DEBUG"} eq "1")) {
|
||||
$debug = 1;
|
||||
}
|
||||
my %host_map = (
|
||||
"localhost.localdomain" => "127.0.0.1",
|
||||
"localhost" => "127.0.0.1",
|
||||
@@ -79,6 +86,8 @@ if (-f "$fname") {
|
||||
"lanforge.localnet" => "192.168.1.101",
|
||||
"lanforge.localdomain" => "192.168.1.101",
|
||||
);
|
||||
my %comment_map = ();
|
||||
my %address_marker_map = ();
|
||||
my %address_map = (
|
||||
"127.0.0.1" => "localhost.localdomain localhost localhost4.localdomain4 localhost4",
|
||||
"::1" => "localhost.localdomain localhost localhost6.loaldomain6 localhost6",
|
||||
@@ -94,17 +103,27 @@ if (-f "$fname") {
|
||||
my $previp = "";
|
||||
|
||||
for my $ln (@lines) {
|
||||
next if (!(defined $ln));
|
||||
print "\nLN[$ln]\n" if ($debug);
|
||||
next if ($ln =~ /^\s*$/);
|
||||
next if ($ln =~ /^\s*#/);
|
||||
next if ($ln =~ /^###-LF-HOSTAME-NEXT-###/); # old typo
|
||||
next if ($ln =~ /^###-LF-HOSTNAME-NEXT-###/);
|
||||
|
||||
my $comment = undef;
|
||||
print "PARSING IPv4 ln[$ln]\n" if ($debug);
|
||||
if ($ln =~ /#/) {
|
||||
($comment) = $ln =~ /^[^#]+(#.*)$/;
|
||||
($ln) = $ln =~ /^([^#]+)\s*#/;
|
||||
print "line with comment becomes [$ln]\n" if ($debug);
|
||||
}
|
||||
@hunks = split(/\s+/, $ln);
|
||||
my $middleip = 0;
|
||||
my $counter2 = -1;
|
||||
my $linehasip = 0;
|
||||
my $lfhostname = 0;
|
||||
if ((defined $comment) && ($comment ne "")) {
|
||||
$comment_map{$hunks[0]} = $comment;
|
||||
}
|
||||
for my $hunk (@hunks) {
|
||||
print "\n HUNK",$counter2,"-:$hunk:- " if ($debug);
|
||||
$counter2++;
|
||||
@@ -207,6 +226,7 @@ if (-f "$fname") {
|
||||
print "NEWSTUFF $ip $address_map{$ip}\n" if ($debug);
|
||||
}
|
||||
|
||||
# this might be premature
|
||||
unshift(@newlines, "192.168.1.101 ".$address_map{"192.168.1.101"});
|
||||
unshift(@newlines, "127.0.0.1 ".$address_map{"127.0.0.1"});
|
||||
unshift(@newlines, "::1 ".$address_map{"::1"});
|
||||
@@ -215,29 +235,74 @@ if (-f "$fname") {
|
||||
delete($address_map{"127.0.0.1"});
|
||||
delete($address_map{"::1"});
|
||||
|
||||
print Dumper(\%address_map) if ($debug);
|
||||
print Dumper(\%host_map) if ($debug);
|
||||
|
||||
for my $key (sort keys %address_map){
|
||||
next if ($key eq $ip);
|
||||
if ($address_map{$key} =~ /\s*$MgrHostname\s*/) {
|
||||
print("SKIPPING $key / $address_map{$key}\n")
|
||||
if ($debug);
|
||||
next;
|
||||
}
|
||||
push(@newlines, $key." ".$address_map{$key});
|
||||
if ($debug) {
|
||||
print "# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----\n";
|
||||
print "\nAddress map\n";
|
||||
print Dumper(\%address_map);
|
||||
print "\nHost map\n";
|
||||
print Dumper(\%host_map);
|
||||
print "# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----\n";
|
||||
sleep 2;
|
||||
}
|
||||
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
||||
# we want to maintain the original line ordering as faithfully as possible
|
||||
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
||||
for my $ln (@lines) {
|
||||
$ln = "" if (!(defined $ln));
|
||||
print "OLD[$ln]\n" if ($debug);
|
||||
# if we are comments or blank lines, preserve them
|
||||
if (($ln =~ /^\s*$/) || ($ln =~ /^\s*#/)) {
|
||||
push(@newlines, $ln);
|
||||
next;
|
||||
}
|
||||
@hunks = split(/\s+/, $ln);
|
||||
|
||||
if (exists $address_map{$hunks[0]}) {
|
||||
if (exists $address_marker_map{$hunks[0]}) {
|
||||
print "already printed $hunks[0]\n" if ($debug);
|
||||
next;
|
||||
}
|
||||
my $comment = "";
|
||||
if (exists $comment_map{$hunks[0]}) {
|
||||
$comment = " $comment_map{$hunks[0]}";
|
||||
}
|
||||
push(@newlines, "$hunks[0] $address_map{$hunks[0]}$comment");
|
||||
$address_marker_map{$hunks[0]} = 1;
|
||||
next;
|
||||
}
|
||||
else {
|
||||
die("unknown IP $hunks[0]");
|
||||
}
|
||||
}
|
||||
if ($debug) {
|
||||
print "# ----- NEW ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----\n";
|
||||
for my $ln (@newlines) {
|
||||
print "$ln\n";
|
||||
}
|
||||
}
|
||||
|
||||
#for my $key (sort keys %address_map){
|
||||
# next if ($key eq $ip);
|
||||
# if ($address_map{$key} =~ /\s*$MgrHostname\s*/) {
|
||||
# print("SKIPPING $key / $address_map{$key}\n")
|
||||
# if ($debug);
|
||||
# next;
|
||||
# }
|
||||
# push(@newlines, $key." ".$address_map{$key});
|
||||
#}
|
||||
push(@newlines, "###-LF-HOSTNAME-NEXT-###");
|
||||
push(@newlines, $ip." ".$address_map{$ip});
|
||||
print Dumper(\@newlines) if ($debug);
|
||||
sleep 5 if ($debug);
|
||||
if ($debug) {
|
||||
print Dumper(\@newlines);
|
||||
sleep 5;
|
||||
}
|
||||
for my $ln (@newlines) {
|
||||
print FILE "$ln\n";
|
||||
}
|
||||
|
||||
print FILE "\n";
|
||||
close FILE;
|
||||
}
|
||||
} # ~if found file
|
||||
|
||||
my $local_crt ="";
|
||||
my $local_key ="";
|
||||
|
||||
61
check_large_files.sh
Executable file
61
check_large_files.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
set -x
|
||||
set -e
|
||||
eyedee=`id -u`
|
||||
if (( eyedee != 0 )); then
|
||||
echo "Please become root to use this script"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Find core files
|
||||
core_files=()
|
||||
cd /
|
||||
while read F; do
|
||||
core_files+=("$F")
|
||||
done < <(ls /core* /home/lanforge/core* 2>/dev/null)
|
||||
|
||||
|
||||
# Find ath10k crash residue
|
||||
ath10_files=()
|
||||
while read F; do
|
||||
ath10_files+=("$F")
|
||||
done < <(ls /home/lanforge/ath10* 2>/dev/null)
|
||||
|
||||
# Find size of /mnt/lf that is not mounted
|
||||
cd /mnt
|
||||
usage_mnt=`du -shxc .`
|
||||
|
||||
# Find size of /lib/modules
|
||||
cd /lib/modules
|
||||
usage_libmod=`du -sh *`
|
||||
|
||||
# Find how many kernels are installed
|
||||
cd /boot
|
||||
boot_kernels=(`ls init*`)
|
||||
boot_usage=`du -sh .`
|
||||
|
||||
HR="---------------------------------------"
|
||||
# #
|
||||
# report sizes here #
|
||||
# #
|
||||
if (( ${#core_files[@]} > 0 )); then
|
||||
echo "Core Files:"
|
||||
echo "$HR"
|
||||
printf '%s\n' "${core_files[@]}"
|
||||
echo "$HR"
|
||||
fi
|
||||
|
||||
echo "Usage of /mnt: $usage_mnt"
|
||||
echo "Usage of /lib/modules: $usage_libmod"
|
||||
echo "Boot usage: $boot_usage"
|
||||
|
||||
if (( ${#boot_kernels[@]} > 4 )); then
|
||||
echo "Boot ramdisks:"
|
||||
echo "$HR"
|
||||
printf '%s\n' "${boot_kernels[@]}"
|
||||
echo "$HR"
|
||||
fi
|
||||
|
||||
# delete extra things now #
|
||||
|
||||
# remove
|
||||
@@ -78,7 +78,7 @@ def main():
|
||||
parser.add_argument("-t", "--tty", type=str, help="tty serial device")
|
||||
parser.add_argument("-l", "--log", type=str, help="logfile for messages, stdout means output to console")
|
||||
parser.add_argument("--action", type=str, help="perform action",
|
||||
choices=["logread", "journalctl", "lurk", "sysupgrade", "download", "upload", "reboot", "cmd" ])
|
||||
choices=["logread", "journalctl", "lurk", "sysupgrade", "sysupgrade-n", "download", "upload", "reboot", "cmd" ])
|
||||
parser.add_argument("--value", type=str, help="set value")
|
||||
parser.add_argument("--value2", type=str, help="set value2")
|
||||
tty = None
|
||||
@@ -134,6 +134,9 @@ def main():
|
||||
egg.sendline(NL)
|
||||
try:
|
||||
i = egg.expect([prompt, "Please press Enter to activate", "login:"], timeout=3)
|
||||
if (i == 1):
|
||||
egg.setdline(NL)
|
||||
i = egg.expect([prompt, "Please press Enter to activate", "login:"], timeout=3)
|
||||
if (i == 2):
|
||||
egg.sendline(user)
|
||||
egg.expect("Password:")
|
||||
@@ -228,7 +231,7 @@ def main():
|
||||
TO=1
|
||||
wait_forever = True
|
||||
|
||||
if (args.action == "sysupgrade"):
|
||||
if ((args.action == "sysupgrade") or (args.action == "sysupgrade-n")):
|
||||
command = "scp %s /tmp/new_img.bin"%(args.value)
|
||||
logg.info("Command[%s]"%command)
|
||||
egg.sendline(command);
|
||||
@@ -239,7 +242,10 @@ def main():
|
||||
egg.expect("password:", timeout=5)
|
||||
egg.sendline("lanforge")
|
||||
egg.expect(CCPROMPT, timeout=20)
|
||||
egg.sendline("sysupgrade /tmp/new_img.bin")
|
||||
if (args.action == "sysupgrade-n"):
|
||||
egg.sendline("sysupgrade -n /tmp/new_img.bin")
|
||||
else:
|
||||
egg.sendline("sysupgrade /tmp/new_img.bin")
|
||||
egg.expect("link becomes ready", timeout=100)
|
||||
return
|
||||
|
||||
|
||||
@@ -36,13 +36,23 @@ class LFRequest:
|
||||
else:
|
||||
self.requested_url = url
|
||||
|
||||
if self.requested_url is None:
|
||||
raise Exception("Bad LFRequest of url[%s] uri[%s] -> None" % url, uri)
|
||||
|
||||
if self.requested_url.find('//'):
|
||||
protopos = self.requested_url.find("://")
|
||||
self.requested_url = self.requested_url[:protopos + 2] + self.requested_url[protopos + 2:].replace("//", "/")
|
||||
|
||||
# finding '#' prolly indicates a macvlan (eth1#0)
|
||||
# finding ' ' prolly indicates a field name that should imply %20
|
||||
if (self.requested_url.find('#') >= 1):
|
||||
self.requested_url = self.requested_url.replace('#', '%23')
|
||||
if (self.requested_url.find(' ') >= 1):
|
||||
self.requested_url = self.requested_url.replace(' ', '+')
|
||||
if self.debug:
|
||||
print("new LFRequest[%s]" % self.requested_url )
|
||||
if self.requested_url is None:
|
||||
raise Exception("Bad LFRequest of url[%s] uri[%s] -> None" % url, uri)
|
||||
|
||||
|
||||
|
||||
# request first url on stack
|
||||
def formPost(self, show_error=True, debug=False, die_on_error_=False):
|
||||
@@ -105,7 +115,7 @@ class LFRequest:
|
||||
def jsonPost(self, show_error=True, debug=False, die_on_error_=False, response_json_list_=None):
|
||||
return self.json_post(show_error=show_error, debug=debug, die_on_error_=die_on_error_, response_json_list_=response_json_list_)
|
||||
|
||||
def json_post(self, show_error=True, debug=False, die_on_error_=False, response_json_list_=None):
|
||||
def json_post(self, show_error=True, debug=False, die_on_error_=False, response_json_list_=None, method_='POST'):
|
||||
if (debug == False) and (self.debug == True):
|
||||
debug = True
|
||||
if self.die_on_error:
|
||||
@@ -113,6 +123,7 @@ class LFRequest:
|
||||
responses = []
|
||||
if ((self.post_data != None) and (self.post_data is not self.No_Data)):
|
||||
request = urllib.request.Request(url=self.requested_url,
|
||||
method=method_,
|
||||
data=json.dumps(self.post_data).encode("utf-8"),
|
||||
headers=self.default_headers)
|
||||
else:
|
||||
@@ -124,7 +135,7 @@ class LFRequest:
|
||||
resp = urllib.request.urlopen(request)
|
||||
resp_data = resp.read().decode('utf-8')
|
||||
if (debug):
|
||||
print("----- LFRequest::jsonPost:118 debug: --------------------------------------------")
|
||||
print("----- LFRequest::json_post:128 debug: --------------------------------------------")
|
||||
print("URL: %s :%d "% (self.requested_url, resp.status))
|
||||
LFUtils.debug_printer.pprint(resp.getheaders())
|
||||
print("----- resp_data -------------------------------------------------")
|
||||
@@ -136,15 +147,15 @@ class LFRequest:
|
||||
raise ValueError("reponse_json_list_ needs to be type list")
|
||||
j = json.loads(resp_data)
|
||||
if debug:
|
||||
print("----- LFRequest::jsonPost:129 debug: --------------------------------------------")
|
||||
print("----- LFRequest::json_post:140 debug: --------------------------------------------")
|
||||
LFUtils.debug_printer.pprint(j)
|
||||
print("-------------------------------------------------")
|
||||
response_json_list_.append(j)
|
||||
return responses[0]
|
||||
except urllib.error.HTTPError as error:
|
||||
if show_error or die_on_error_ or (error.code != 404):
|
||||
print("----- LFRequest::jsonPost:138 HTTPError: --------------------------------------------")
|
||||
print("<%s> HTTP %s: %s"%(request.get_full_url(), error.code, error.reason, ))
|
||||
print("----- LFRequest::json_post:147 HTTPError: --------------------------------------------")
|
||||
print("<%s> HTTP %s: %s" % (request.get_full_url(), error.code, error.reason ))
|
||||
|
||||
print("Error: ", sys.exc_info()[0])
|
||||
print("Request URL:", request.get_full_url())
|
||||
@@ -167,21 +178,35 @@ class LFRequest:
|
||||
exit(1)
|
||||
except urllib.error.URLError as uerror:
|
||||
if show_error:
|
||||
print("----- LFRequest::jsonPost:162 URLError: ---------------------------------------------")
|
||||
print("----- LFRequest::json_post:171 URLError: ---------------------------------------------")
|
||||
print("Reason: %s; URL: %s"%(uerror.reason, request.get_full_url()))
|
||||
print("------------------------------------------------------------------------")
|
||||
if (die_on_error_ == True) or (self.die_on_error == True):
|
||||
exit(1)
|
||||
return None
|
||||
|
||||
def get(self, debug=False, die_on_error_=False):
|
||||
def json_put(self, show_error=True, debug=False, die_on_error_=False, response_json_list_=None):
|
||||
return self.json_post(show_error=show_error,
|
||||
debug=debug,
|
||||
die_on_error_=die_on_error_,
|
||||
response_json_list_=response_json_list_,
|
||||
method_='PUT')
|
||||
|
||||
def json_delete(self, show_error=True, debug=False, die_on_error_=False, response_json_list_=None):
|
||||
return self.get_as_json(debug_=debug,
|
||||
die_on_error_=die_on_error_,
|
||||
method_='DELETE')
|
||||
|
||||
def get(self, debug=False, die_on_error_=False, method_='GET'):
|
||||
if self.debug == True:
|
||||
debug = True
|
||||
if self.die_on_error == True:
|
||||
die_on_error_ = True
|
||||
if debug:
|
||||
print("LFUtils.get: url: "+self.requested_url)
|
||||
myrequest = urllib.request.Request(url=self.requested_url, headers=self.default_headers)
|
||||
myrequest = urllib.request.Request(url=self.requested_url,
|
||||
headers=self.default_headers,
|
||||
method=method_)
|
||||
myresponses = []
|
||||
try:
|
||||
myresponses.append(urllib.request.urlopen(myrequest))
|
||||
@@ -223,9 +248,9 @@ class LFRequest:
|
||||
def getAsJson(self, die_on_error_=False, debug_=False):
|
||||
return self.get_as_json(die_on_error_=die_on_error_, debug_=debug_)
|
||||
|
||||
def get_as_json(self, die_on_error_=False, debug_=False):
|
||||
def get_as_json(self, die_on_error_=False, debug_=False, method_='GET'):
|
||||
responses = []
|
||||
j = self.get(debug=debug_, die_on_error_=die_on_error_)
|
||||
j = self.get(debug=debug_, die_on_error_=die_on_error_, method_=method_)
|
||||
responses.append(j)
|
||||
if len(responses) < 1:
|
||||
return None
|
||||
|
||||
@@ -281,16 +281,16 @@ def port_name_series(prefix="sta", start_id=0, end_id=1, padding_number=10000, r
|
||||
"""
|
||||
|
||||
eid = None
|
||||
if radio != None:
|
||||
if radio is not None:
|
||||
eid = name_to_eid(radio)
|
||||
|
||||
name_list = []
|
||||
for i in range((padding_number + start_id), (padding_number + end_id + 1)):
|
||||
sta_name = prefix + str(i)[1:]
|
||||
if eid != None:
|
||||
name_list.append("%i.%i.%s"%(eid[0], eid[1], sta_name))
|
||||
else:
|
||||
sta_name = "%s%s" % (prefix, str(i)[1:])
|
||||
if eid is None:
|
||||
name_list.append(sta_name)
|
||||
else:
|
||||
name_list.append("%i.%i.%s" % (eid[0], eid[1], sta_name))
|
||||
return name_list
|
||||
|
||||
|
||||
@@ -543,7 +543,7 @@ def wait_until_ports_appear(base_url="http://localhost:8080", port_list=(), debu
|
||||
found_stations.append(port_name)
|
||||
else:
|
||||
lf_r = LFRequest.LFRequest(base_url, ncshow_url)
|
||||
lf_r.addPostData({"shelf": shelf, "resource": resource_id, "port": port_name, "probe_flags": "1"})
|
||||
lf_r.addPostData({"shelf": shelf, "resource": resource_id, "port": port_name, "probe_flags": 5})
|
||||
lf_r.jsonPost()
|
||||
if (len(found_stations) < len(port_list)):
|
||||
sleep(2)
|
||||
|
||||
@@ -1,16 +1,23 @@
|
||||
#!env /usr/bin/python
|
||||
|
||||
import sys
|
||||
import signal
|
||||
import traceback
|
||||
# Extend this class to use common set of debug and request features for your script
|
||||
from pprint import pprint
|
||||
|
||||
import time
|
||||
import LANforge.LFUtils
|
||||
from LANforge.LFUtils import *
|
||||
import argparse
|
||||
from LANforge import LFRequest
|
||||
import LANforge.LFRequest
|
||||
|
||||
class LFCliBase:
|
||||
|
||||
SHOULD_RUN = 0 # indicates normal operation
|
||||
SHOULD_QUIT = 1 # indicates to quit loops, close files, send SIGQUIT to threads and return
|
||||
SHOULD_HALT = 2 # indicates to quit loops, send SIGABRT to threads and exit
|
||||
|
||||
# do not use `super(LFCLiBase,self).__init__(self, host, port, _debug)
|
||||
# that is py2 era syntax and will force self into the host variable, making you
|
||||
# very confused.
|
||||
@@ -19,7 +26,8 @@ class LFCliBase:
|
||||
_halt_on_error=False,
|
||||
_exit_on_error=False,
|
||||
_exit_on_fail=False,
|
||||
_local_realm=False):
|
||||
_local_realm=False,
|
||||
_capture_signal_list=[]):
|
||||
self.fail_pref = "FAILED: "
|
||||
self.pass_pref = "PASSED: "
|
||||
self.lfclient_host = _lfjson_host
|
||||
@@ -33,12 +41,110 @@ class LFCliBase:
|
||||
self.halt_on_error = _halt_on_error
|
||||
self.exit_on_error = _exit_on_error
|
||||
self.exit_on_fail = _exit_on_fail
|
||||
self.capture_signals = _capture_signal_list
|
||||
# toggle using preexec_cli, preexec_method; the preexec_X parameters are useful
|
||||
# when you desire the lfclient to check for existance of entities to run commands on,
|
||||
# like when developing; you might toggle this with use_preexec = _debug
|
||||
# Otherwise, preexec methods use more processing time because they add an extra CLI call
|
||||
# into the queue, and inspect it -- typically nc_show_port
|
||||
self.suppress_related_commands = None
|
||||
self.finish = self.SHOULD_RUN
|
||||
self.thread_map = {}
|
||||
|
||||
if len(_capture_signal_list) > 0:
|
||||
for zignal in _capture_signal_list:
|
||||
captured_signal(zignal, my_captured_signal)
|
||||
#
|
||||
|
||||
def _finish(self):
|
||||
"""
|
||||
call this to indicate SIGQUIT
|
||||
"""
|
||||
self.finish = self.SHOULD_QUIT
|
||||
|
||||
def _halt(self):
|
||||
"""
|
||||
call this to indicate SIGABRT
|
||||
"""
|
||||
self.finish = self.SHOULD_HALT
|
||||
|
||||
def _should_finish(self):
|
||||
"""
|
||||
check this when in a run loop if SIGQUIT has been indicated
|
||||
"""
|
||||
if self.finish == self.SHOULD_RUN:
|
||||
return False
|
||||
if self.finish == self.SHOULD_QUIT:
|
||||
return True
|
||||
if self.finish == self.SHOULD_HALT:
|
||||
return False
|
||||
|
||||
def _should_halt(self):
|
||||
"""
|
||||
check this when in a run loop if SIGABRT has been indicated
|
||||
"""
|
||||
if self.finish == self.SHOULD_RUN:
|
||||
return False
|
||||
if self.finish == self.SHOULD_QUIT:
|
||||
return False
|
||||
if self.finish == self.SHOULD_HALT:
|
||||
return True
|
||||
|
||||
def track_thread(self, name, thread):
|
||||
if self.thread_map is None:
|
||||
self.thread_map = {}
|
||||
self.thread_map[name] = thread
|
||||
|
||||
def get_thread(self, name):
|
||||
if self.thread_map is None:
|
||||
return None
|
||||
if name in self.thread_map.keys():
|
||||
return self.thread_map[name]
|
||||
return None
|
||||
|
||||
def remove_thread(self, name):
|
||||
if self.thread_map is None:
|
||||
return None
|
||||
if name not in self.thread_map.keys():
|
||||
return None
|
||||
thrud = self.thread_map[name]
|
||||
del self.thread_map[name]
|
||||
return thrud
|
||||
|
||||
def send_thread_signals(signum, fname):
|
||||
if len(self.thread_map) < 1:
|
||||
print("no threads to signal")
|
||||
return
|
||||
for (name, thread) in self.thread_map.items():
|
||||
if self.debug:
|
||||
print("sending signal %s to thread %s" % (signum, name))
|
||||
# do a thing
|
||||
|
||||
def my_captured_signal(signum, frame):
|
||||
"""
|
||||
Override me to process signals, otherwise superclass signal handler is called.
|
||||
You may use _finish() or _halt() to indicate finishing soon or halting immediately.
|
||||
|
||||
:return: True if we processed this signal
|
||||
"""
|
||||
print("my_captured_signal should be overridden")
|
||||
return False
|
||||
|
||||
def caputured_signal(signum):
|
||||
"""
|
||||
Here is your opportunity to decide what to do on things like KeyboardInterrupt or other UNIX signals
|
||||
Check that your subclass handled the signal or not. You may use _finish() or _halt() to indicate
|
||||
finishing soon or halting immediately. Use signal.signal(signal.STOP) to enable this.
|
||||
"""
|
||||
if self.debug:
|
||||
print("Captured signal %s" % signum)
|
||||
if my_captured_signal(signum):
|
||||
if self.debug:
|
||||
print("subclass processed signal")
|
||||
else:
|
||||
if self.debug:
|
||||
print("subclass ignored signal")
|
||||
|
||||
|
||||
def clear_test_results(self):
|
||||
self.test_results.clear()
|
||||
@@ -87,22 +193,55 @@ class LFCliBase:
|
||||
pprint.pprint(response_json_list_)
|
||||
except Exception as x:
|
||||
if self.debug or self.halt_on_error or self.exit_on_error:
|
||||
print("jsonPost posted to %s" % _req_url)
|
||||
print("json_post posted to %s" % _req_url)
|
||||
pprint.pprint(_data)
|
||||
print("Exception %s:" % x)
|
||||
traceback.print_exception(Exception, x, x.__traceback__, chain=True)
|
||||
if self.halt_on_error or self.exit_on_error:
|
||||
exit(1)
|
||||
return json_response
|
||||
|
||||
def json_put(self, _req_url, _data, debug_=False, response_json_list_=None):
|
||||
"""
|
||||
Send a PUT request. This is presently used for data sent to /status-msg for
|
||||
creating a new messaging session. It is not presently used for CLI scripting
|
||||
so lacks suppress_x features.
|
||||
:param _req_url: url to put
|
||||
:param _data: data to place at URL
|
||||
:param debug_: enable debug output
|
||||
:param response_json_list_: array for json results in the response object, (alternative return method)
|
||||
:return: http response object
|
||||
"""
|
||||
json_response = None
|
||||
try:
|
||||
lf_r = LFRequest.LFRequest(self.lfclient_url, _req_url, debug_=self.debug, die_on_error_=self.exit_on_error)
|
||||
lf_r.addPostData(_data)
|
||||
if debug_ or self.debug:
|
||||
LANforge.LFUtils.debug_printer.pprint(_data)
|
||||
json_response = lf_r.json_put(show_error=self.debug,
|
||||
debug=(self.debug or debug_),
|
||||
response_json_list_=response_json_list_,
|
||||
die_on_error_=self.exit_on_error)
|
||||
if debug_ and (response_json_list_ is not None):
|
||||
pprint.pprint(response_json_list_)
|
||||
except Exception as x:
|
||||
if self.debug or self.halt_on_error or self.exit_on_error:
|
||||
print("json_put submitted to %s" % _req_url)
|
||||
pprint.pprint(_data)
|
||||
print("Exception %s:" % x)
|
||||
traceback.print_exception(Exception, x, x.__traceback__, chain=True)
|
||||
if self.halt_on_error or self.exit_on_error:
|
||||
exit(1)
|
||||
return json_response
|
||||
|
||||
def json_get(self, _req_url, debug_=False):
|
||||
if self.debug or debug_:
|
||||
print("URL: "+_req_url)
|
||||
print("GET: "+_req_url)
|
||||
json_response = None
|
||||
# print("----- GET ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ")
|
||||
try:
|
||||
lf_r = LFRequest.LFRequest(self.lfclient_url, _req_url, debug_=(self.debug or debug_), die_on_error_=self.exit_on_error)
|
||||
json_response = lf_r.getAsJson(debug_=self.debug, die_on_error_=self.halt_on_error)
|
||||
json_response = lf_r.get_as_json(debug_=self.debug, die_on_error_=self.halt_on_error)
|
||||
#debug_printer.pprint(json_response)
|
||||
if (json_response is None) and (self.debug or debug_):
|
||||
print("LFCliBase.json_get: no entity/response, probabily status 404")
|
||||
@@ -117,6 +256,31 @@ class LFCliBase:
|
||||
|
||||
return json_response
|
||||
|
||||
def json_delete(self, _req_url, debug_=False):
|
||||
if self.debug or debug_:
|
||||
print("DELETE: "+_req_url)
|
||||
json_response = None
|
||||
try:
|
||||
# print("----- DELETE ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ")
|
||||
lf_r = LFRequest.LFRequest(self.lfclient_url, _req_url,
|
||||
debug_=(self.debug or debug_),
|
||||
die_on_error_=self.exit_on_error)
|
||||
json_response = lf_r.json_delete(debug=self.debug,
|
||||
die_on_error_=self.halt_on_error)
|
||||
#debug_printer.pprint(json_response)
|
||||
if (json_response is None) and (self.debug or debug_):
|
||||
print("LFCliBase.json_delete: no entity/response, probabily status 404")
|
||||
return None
|
||||
except ValueError as ve:
|
||||
if self.debug or self.halt_on_error or self.exit_on_error:
|
||||
print("json_delete asked for " + _req_url)
|
||||
print("Exception %s:" % ve)
|
||||
traceback.print_exception(ValueError, ve, ve.__traceback__, chain=True)
|
||||
if self.halt_on_error or self.exit_on_error:
|
||||
sys.exit(1)
|
||||
# print("----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ")
|
||||
return json_response
|
||||
|
||||
@staticmethod
|
||||
def response_list_to_map(json_list, key, debug_=False):
|
||||
reverse_map = {}
|
||||
@@ -172,10 +336,11 @@ class LFCliBase:
|
||||
if duration >= 300:
|
||||
print("Could not connect to LANforge GUI")
|
||||
sys.exit(1)
|
||||
|
||||
#return ALL messages in list form
|
||||
def get_result_list(self):
|
||||
return self.test_results
|
||||
|
||||
#return ALL fail messages in list form
|
||||
def get_failed_result_list(self):
|
||||
fail_list = []
|
||||
for result in self.test_results:
|
||||
@@ -183,13 +348,29 @@ class LFCliBase:
|
||||
fail_list.append(result)
|
||||
return fail_list
|
||||
|
||||
#return ALL pass messages in list form
|
||||
def get_passed_result_list(self):
|
||||
pass_list = []
|
||||
for result in self.test_results:
|
||||
if result.startswith("PASS"):
|
||||
pass_list.append(result)
|
||||
return pass_list
|
||||
|
||||
|
||||
def get_pass_message(self):
|
||||
pass_messages = self.get_passed_result_list()
|
||||
return "\n".join(pass_messages)
|
||||
|
||||
|
||||
def get_fail_message(self):
|
||||
fail_messages = self.get_failed_result_list()
|
||||
return "\n".join(fail_messages)
|
||||
return "\n".join(fail_messages)
|
||||
|
||||
|
||||
def get_all_message(self):
|
||||
return "\n".join(self.test_results)
|
||||
|
||||
#determines if overall test passes via comparing passes vs. fails
|
||||
def passes(self):
|
||||
pass_counter = 0
|
||||
fail_counter = 0
|
||||
@@ -202,7 +383,15 @@ class LFCliBase:
|
||||
return True
|
||||
return False
|
||||
|
||||
# use this inside the class to log a failure result
|
||||
#EXIT script with a fail
|
||||
def exit_fail(self,message="%d out of %d tests failed. Exiting script."):
|
||||
total_len=len(self.get_result_list())
|
||||
fail_len=len(self.get_failed_result_list())
|
||||
print(message %(fail_len,total_len))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
# use this inside the class to log a failure result and print it if wished
|
||||
def _fail(self, message, print_=False):
|
||||
self.test_results.append(self.fail_pref + message)
|
||||
if print_ or self.exit_on_fail:
|
||||
@@ -210,7 +399,15 @@ class LFCliBase:
|
||||
if self.exit_on_fail:
|
||||
sys.exit(1)
|
||||
|
||||
# use this inside the class to log a pass result
|
||||
#EXIT script with a success
|
||||
def exit_success(self,message="%d out of %d tests passed successfully. Exiting script."):
|
||||
num_total=len(self.get_result_list())
|
||||
num_passing=len(self.get_passed_result_list())
|
||||
print(message %(num_passing,num_total))
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
# use this inside the class to log a pass result and print if wished.
|
||||
def _pass(self, message, print_=False):
|
||||
self.test_results.append(self.pass_pref + message)
|
||||
if print_:
|
||||
@@ -249,7 +446,7 @@ class LFCliBase:
|
||||
parser.add_argument('--radio', help='radio EID, e.g: 1.wiphy2', default=None)
|
||||
parser.add_argument('--security', help='WiFi Security protocol: <open | wep | wpa | wpa2 | wpa3 >', default=None)
|
||||
parser.add_argument('--ssid', help='SSID for stations to associate to', default=None)
|
||||
parser.add_argument('--passwd', '--passphrase', '--password', '--pwd', help='WiFi passphrase', default=None)
|
||||
parser.add_argument('--passwd', help='WiFi passphrase', default=None)
|
||||
parser.add_argument('--num_stations', help='Number of stations to create', default=0)
|
||||
parser.add_argument('--test_id', help='Test ID (intended to use for ws events)', default="webconsole")
|
||||
parser.add_argument('--debug', help='Enable debugging', default=False, action="store_true")
|
||||
|
||||
164
py-json/realm.py
164
py-json/realm.py
@@ -370,7 +370,7 @@ class Realm(LFCliBase):
|
||||
|
||||
# Returns map of all stations with port+type == WIFI-STATION
|
||||
def station_map(self):
|
||||
response = super().json_get("/port/list?fields=_links,alias,device,port+type")
|
||||
response = super().json_get("/port/list?fields=port,_links,alias,device,port+type")
|
||||
if (response is None) or ("interfaces" not in response):
|
||||
pprint(response)
|
||||
print("station_list: incomplete response, halting")
|
||||
@@ -554,6 +554,52 @@ class Realm(LFCliBase):
|
||||
|
||||
return not wait_more
|
||||
|
||||
def get_curr_num_ips(self,num_sta_with_ips=0,station_list=None, ipv4=True, ipv6=False, debug=False):
|
||||
print("checking number of stations with ips...")
|
||||
waiting_states = ["0.0.0.0", "NA", ""]
|
||||
if (station_list is None) or (len(station_list) < 1):
|
||||
raise ValueError("check for num curr ips expects non-empty list of ports")
|
||||
for sta_eid in station_list:
|
||||
if debug:
|
||||
print("checking sta-eid: %s"%(sta_eid))
|
||||
eid = self.name_to_eid(sta_eid)
|
||||
response = super().json_get("/port/%s/%s/%s?fields=alias,ip,port+type,ipv6+address" %
|
||||
(eid[0], eid[1], eid[2]))
|
||||
if debug:
|
||||
pprint(response)
|
||||
if (response is None) or ("interface" not in response):
|
||||
print("station_list: incomplete response:")
|
||||
pprint(response)
|
||||
#wait_more = True
|
||||
break
|
||||
if ipv4:
|
||||
v = response['interface']
|
||||
if (v['ip'] in waiting_states):
|
||||
if debug:
|
||||
print("Waiting for port %s to get IPv4 Address."%(sta_eid))
|
||||
else:
|
||||
if debug:
|
||||
print("Found IP: %s on port: %s"%(v['ip'], sta_eid))
|
||||
print("Incrementing stations with IP addresses found")
|
||||
num_sta_with_ips+=1
|
||||
else:
|
||||
num_sta_with_ips+=1
|
||||
if ipv6:
|
||||
v = response['interface']
|
||||
if (v['ip'] in waiting_states):
|
||||
if debug:
|
||||
print("Waiting for port %s to get IPv6 Address."%(sta_eid))
|
||||
|
||||
else:
|
||||
if debug:
|
||||
print("Found IP: %s on port: %s"%(v['ip'], sta_eid))
|
||||
print("Incrementing stations with IP addresses found")
|
||||
num_sta_with_ips+=1
|
||||
else:
|
||||
num_sta_with_ips+=1
|
||||
return num_sta_with_ips
|
||||
|
||||
|
||||
def duration_time_to_seconds(self, time_string):
|
||||
if isinstance(time_string, str):
|
||||
pattern = re.compile("^(\d+)([dhms]$)")
|
||||
@@ -733,6 +779,9 @@ class Realm(LFCliBase):
|
||||
def new_mvlan_profile(self):
|
||||
return MACVLANProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug)
|
||||
|
||||
def new_test_group_profile(self):
|
||||
return TestGroupProfile(self.lfclient_host, self.lfclient_port, local_realm=self, debug_=self.debug)
|
||||
|
||||
class MULTICASTProfile(LFCliBase):
|
||||
def __init__(self, lfclient_host, lfclient_port, local_realm,
|
||||
report_timer_=3000, name_prefix_="Unset", number_template_="00000", debug_=False):
|
||||
@@ -2169,6 +2218,74 @@ class DUTProfile(LFCliBase):
|
||||
"text-64": notebytes.decode('ascii')
|
||||
}, self.debug)
|
||||
|
||||
class TestGroupProfile(LFCliBase):
|
||||
def __init__(self, lfclient_host, lfclient_port, local_realm, test_group_name=None, debug_=False):
|
||||
super().__init__(lfclient_host, lfclient_port, debug_, _halt_on_error=True)
|
||||
self.local_realm = local_realm
|
||||
self.group_name = test_group_name
|
||||
self.cx_list = []
|
||||
|
||||
def start_group(self):
|
||||
if self.group_name is not None:
|
||||
self.local_realm.json_post("/cli-json/start_group", {"name": self.group_name})
|
||||
else:
|
||||
raise ValueError("test_group name must be set.")
|
||||
|
||||
def quiesce_group(self):
|
||||
if self.group_name is not None:
|
||||
self.local_realm.json_post("/cli-json/quiesce_group", {"name": self.group_name})
|
||||
else:
|
||||
raise ValueError("test_group name must be set.")
|
||||
|
||||
def stop_group(self):
|
||||
if self.group_name is not None:
|
||||
self.local_realm.json_post("/cli-json/stop_group", {"name": self.group_name})
|
||||
else:
|
||||
raise ValueError("test_group name must be set.")
|
||||
|
||||
def create_group(self):
|
||||
if self.group_name is not None:
|
||||
self.local_realm.json_post("/cli-json/add_group", {"name": self.group_name})
|
||||
else:
|
||||
raise ValueError("test_group name must be set.")
|
||||
|
||||
def remove_group(self):
|
||||
if self.group_name is not None:
|
||||
self.local_realm.json_post("/cli-json/rm_group", {"name": self.group_name})
|
||||
else:
|
||||
raise ValueError("test_group name must be set.")
|
||||
|
||||
def add_cx(self, cx_name):
|
||||
self.local_realm.json_post("/cli-json/add_tgcx", {"tgname": self.test_group_name, "cxname": cx_name})
|
||||
|
||||
def rm_cx_from_list(self, cx_name):
|
||||
self.local_realm.json_post("/cli-json/add_tgcx", {"tgname": self.test_group_name, "cxname": cx_name})
|
||||
|
||||
def check_group_exists(self):
|
||||
test_groups = self.local_realm.json_get("/testgroups")
|
||||
if test_groups is not None:
|
||||
test_groups = test_groups["groups"]
|
||||
for group in test_groups:
|
||||
for k,v in group.items():
|
||||
if v['name'] == self.group_name:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def list_groups(self):
|
||||
test_groups = self.local_realm.json_get("/testgroups")
|
||||
tg_list = []
|
||||
if test_groups is not None:
|
||||
test_groups = test_groups["groups"]
|
||||
for group in test_groups:
|
||||
for k, v in group.items():
|
||||
tg_list.append(v['name'])
|
||||
return tg_list
|
||||
|
||||
def list_cxs(self):
|
||||
# TODO: List cxs in profile, use cx_list or query?
|
||||
pass
|
||||
|
||||
|
||||
class FIOEndpProfile(LFCliBase):
|
||||
"""
|
||||
@@ -2212,7 +2329,6 @@ class FIOEndpProfile(LFCliBase):
|
||||
self.created_cx = {}
|
||||
self.created_endp = []
|
||||
|
||||
|
||||
def start_cx(self):
|
||||
print("Starting CXs...")
|
||||
for cx_name in self.created_cx.keys():
|
||||
@@ -2304,12 +2420,13 @@ class FIOEndpProfile(LFCliBase):
|
||||
"payload_pattern": self.pattern,
|
||||
|
||||
}
|
||||
# Read direction is copy of write only directory
|
||||
if self.io_direction == "read":
|
||||
endp_data["prefix"] = "wo_" + name + "_fio"
|
||||
endp_data["directory"] = "/mnt/lf/wo_" + name + "_fio"
|
||||
|
||||
url = "cli-json/add_file_endp"
|
||||
self.local_realm.json_post(url, endp_data, debug_=debug_, suppress_related_commands_=suppress_related_commands_)
|
||||
self.local_realm.json_post(url, endp_data, debug_=True, suppress_related_commands_=suppress_related_commands_)
|
||||
time.sleep(sleep_time)
|
||||
|
||||
data = {
|
||||
@@ -2320,6 +2437,13 @@ class FIOEndpProfile(LFCliBase):
|
||||
self.local_realm.json_post("cli-json/set_fe_info", data, debug_=debug_,
|
||||
suppress_related_commands_=suppress_related_commands_)
|
||||
|
||||
self.local_realm.json_post("/cli-json/nc_show_endpoints", {"endpoint": "all"})
|
||||
for port_name in ports:
|
||||
if len(self.local_realm.name_to_eid(port_name)) == 3:
|
||||
shelf = self.local_realm.name_to_eid(port_name)[0]
|
||||
resource = self.local_realm.name_to_eid(port_name)[1]
|
||||
name = self.local_realm.name_to_eid(port_name)[2]
|
||||
|
||||
endp_data = {
|
||||
"alias": "CX_" + self.cx_prefix + name + "_fio",
|
||||
"test_mgr": "default_tm",
|
||||
@@ -2329,6 +2453,7 @@ class FIOEndpProfile(LFCliBase):
|
||||
cx_post_data.append(endp_data)
|
||||
self.created_cx[self.cx_prefix + name + "_fio"] = "CX_" + self.cx_prefix + name + "_fio"
|
||||
|
||||
# time.sleep(3)
|
||||
for cx_data in cx_post_data:
|
||||
url = "/cli-json/add_cx"
|
||||
self.local_realm.json_post(url, cx_data, debug_=debug_, suppress_related_commands_=suppress_related_commands_)
|
||||
@@ -2358,8 +2483,8 @@ class MACVLANProfile(LFCliBase):
|
||||
self.ip_list = []
|
||||
self.COMMANDS = ["set_port"]
|
||||
self.desired_set_port_cmd_flags = []
|
||||
self.desired_set_port_current_flags = ["if_down"]
|
||||
self.desired_set_port_interest_flags = ["current_flags", "ifdown"]
|
||||
self.desired_set_port_current_flags = [] # do not default down, "if_down"
|
||||
self.desired_set_port_interest_flags = ["current_flags"] # do not default down, "ifdown"
|
||||
self.set_port_data = {
|
||||
"shelf": 1,
|
||||
"resource": 1,
|
||||
@@ -2481,7 +2606,7 @@ class MACVLANProfile(LFCliBase):
|
||||
LFUtils.wait_until_ports_appear(base_url=self.lfclient_url, port_list=self.created_macvlans)
|
||||
print(self.created_macvlans)
|
||||
|
||||
# time.sleep(sleep_time)
|
||||
time.sleep(5)
|
||||
|
||||
for i in range(len(self.created_macvlans)):
|
||||
eid = self.local_realm.name_to_eid(self.created_macvlans[i])
|
||||
@@ -2503,7 +2628,7 @@ class MACVLANProfile(LFCliBase):
|
||||
self.local_realm.rm_port(port_eid, check_exists=True)
|
||||
time.sleep(.2)
|
||||
# And now see if they are gone
|
||||
LFUtils.wait_until_ports_disappear(base_url=self.lfclient_url, port_list=self.created_macvlans)
|
||||
|
||||
|
||||
def admin_up(self):
|
||||
for macvlan in self.created_macvlans:
|
||||
@@ -2752,6 +2877,8 @@ class StationProfile:
|
||||
number_template_="00000",
|
||||
mode=0,
|
||||
up=True,
|
||||
resource=1,
|
||||
shelf=1,
|
||||
dhcp=True,
|
||||
debug_=False,
|
||||
use_ht160=False):
|
||||
@@ -2761,6 +2888,8 @@ class StationProfile:
|
||||
self.ssid_pass = ssid_pass
|
||||
self.mode = mode
|
||||
self.up = up
|
||||
self.resource=resource
|
||||
self.shelf=shelf
|
||||
self.dhcp = dhcp
|
||||
self.security = security
|
||||
self.local_realm = local_realm
|
||||
@@ -2797,8 +2926,8 @@ class StationProfile:
|
||||
}
|
||||
self.wifi_extra_data_modified = False
|
||||
self.wifi_extra_data = {
|
||||
"shelf":1,
|
||||
"resource":1,
|
||||
"shelf": 1,
|
||||
"resource": 1,
|
||||
"port": None,
|
||||
"key_mgmt": None,
|
||||
"eap": None,
|
||||
@@ -2810,8 +2939,8 @@ class StationProfile:
|
||||
}
|
||||
|
||||
self.reset_port_extra_data = {
|
||||
"shelf":1,
|
||||
"resource":1,
|
||||
"shelf": 1,
|
||||
"resource": 1,
|
||||
"port": None,
|
||||
"test_duration": 0,
|
||||
"reset_port_enable": False,
|
||||
@@ -3020,8 +3149,6 @@ class StationProfile:
|
||||
print("ERROR: StationProfile cleanup, list is empty")
|
||||
return
|
||||
|
||||
del_count = len(desired_stations)
|
||||
|
||||
# First, request remove on the list.
|
||||
for port_eid in desired_stations:
|
||||
self.local_realm.rm_port(port_eid, check_exists=True)
|
||||
@@ -3073,16 +3200,25 @@ class StationProfile:
|
||||
self.add_sta_data["radio"] = radio_port
|
||||
|
||||
self.add_sta_data["resource"] = radio_resource
|
||||
self.add_sta_data["shelf"] = radio_shelf
|
||||
self.set_port_data["resource"] = radio_resource
|
||||
self.set_port_data["shelf"] = radio_shelf
|
||||
self.set_port_data["current_flags"] = self.add_named_flags(self.desired_set_port_current_flags,
|
||||
set_port.set_port_current_flags)
|
||||
self.set_port_data["interest"] = self.add_named_flags(self.desired_set_port_interest_flags,
|
||||
set_port.set_port_interest_flags)
|
||||
self.wifi_extra_data["resource"]=radio_resource
|
||||
self.wifi_extra_data["shelf"]=radio_shelf
|
||||
self.reset_port_extra_data["resource"]=radio_resource
|
||||
self.reset_port_extra_data["shelf"]=radio_shelf
|
||||
|
||||
# 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")
|
||||
my_sta_names = []
|
||||
#add radio here
|
||||
if num_stations > 0:
|
||||
my_sta_names = LFUtils.portNameSeries("sta", 0, num_stations - 1, int("1" + self.number_template))
|
||||
else:
|
||||
@@ -3106,6 +3242,8 @@ class StationProfile:
|
||||
self.add_sta_data["radio"] = radio_port
|
||||
self.add_sta_data["sta_name"] = name # for create station calls
|
||||
self.set_port_data["port"] = name # for set_port calls.
|
||||
self.set_port_data["shelf"] = radio_shelf
|
||||
self.set_port_data["resource"] = radio_resource
|
||||
|
||||
self.station_names.append("%s.%s.%s" % (radio_shelf, radio_resource, name))
|
||||
add_sta_r.addPostData(self.add_sta_data)
|
||||
|
||||
@@ -50,8 +50,14 @@ class IPv4Test(LFCliBase):
|
||||
self.station_profile.set_command_param("set_port", "report_timer", 1500)
|
||||
self.station_profile.set_command_flag("set_port", "rpt_timer", 1)
|
||||
self.station_profile.create(radio="wiphy0", sta_names_=self.sta_list, debug=self.debug)
|
||||
self._pass("PASS: Station build finished")
|
||||
self.station_profile.admin_up()
|
||||
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
|
||||
self._pass("Station build finished")
|
||||
self.passed()
|
||||
else:
|
||||
self._fail("Stations not able to acquire IP. Please check network input.")
|
||||
self.failed()
|
||||
|
||||
|
||||
def cleanup(self, sta_list):
|
||||
self.station_profile.cleanup(sta_list)
|
||||
|
||||
117
py-scripts/example_security_connection.py
Executable file
117
py-scripts/example_security_connection.py
Executable file
@@ -0,0 +1,117 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import os
|
||||
if sys.version_info[0] != 3:
|
||||
print("This script requires Python 3")
|
||||
exit(1)
|
||||
if 'py-json' not in sys.path:
|
||||
sys.path.append(os.path.join(os.path.abspath('..'), 'py-json'))
|
||||
import LANforge
|
||||
from LANforge.lfcli_base import LFCliBase
|
||||
from LANforge import LFUtils
|
||||
import realm
|
||||
import argparse
|
||||
import time
|
||||
import pprint
|
||||
|
||||
|
||||
class IPv4Test(LFCliBase):
|
||||
def __init__(self, host, port, ssid, security, password, sta_list=None, number_template="00000", radio = "wiphy0",_debug_on=False,
|
||||
_exit_on_error=False,
|
||||
_exit_on_fail=False):
|
||||
super().__init__(host, port, _debug=_debug_on, _halt_on_error=_exit_on_error, _exit_on_fail=_exit_on_fail)
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.ssid = ssid
|
||||
self.radio = radio
|
||||
self.security = security
|
||||
self.password = password
|
||||
self.sta_list = sta_list
|
||||
self.timeout = 120
|
||||
self.number_template = number_template
|
||||
self.debug = _debug_on
|
||||
self.local_realm = realm.Realm(lfclient_host=self.host, lfclient_port=self.port)
|
||||
self.station_profile = self.local_realm.new_station_profile()
|
||||
|
||||
self.station_profile.lfclient_url = self.lfclient_url
|
||||
self.station_profile.ssid = self.ssid
|
||||
self.station_profile.ssid_pass = self.password,
|
||||
self.station_profile.security = self.security
|
||||
self.station_profile.number_template_ = self.number_template
|
||||
self.station_profile.mode = 0
|
||||
|
||||
def build(self):
|
||||
# Build stations
|
||||
#print("We've gotten into the build stations function")
|
||||
self.station_profile.use_security(self.security, self.ssid, self.password)
|
||||
self.station_profile.set_number_template(self.number_template)
|
||||
print("Creating stations")
|
||||
self.station_profile.set_command_flag("add_sta", "create_admin_down", 1)
|
||||
self.station_profile.set_command_param("set_port", "report_timer", 1500)
|
||||
self.station_profile.set_command_flag("set_port", "rpt_timer", 1)
|
||||
self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug)
|
||||
self.station_profile.admin_up()
|
||||
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
|
||||
self._pass("Station build finished")
|
||||
self.exit_success()
|
||||
else:
|
||||
self._fail("Stations not able to acquire IP. Please check network input.")
|
||||
self.exit_fail()
|
||||
|
||||
|
||||
def cleanup(self, sta_list):
|
||||
self.station_profile.cleanup(sta_list)
|
||||
LFUtils.wait_until_ports_disappear(base_url=self.lfclient_url, port_list=sta_list,
|
||||
debug=self.debug)
|
||||
|
||||
def main():
|
||||
lfjson_host = "localhost"
|
||||
lfjson_port = 8080
|
||||
|
||||
parser = LFCliBase.create_basic_argparse(
|
||||
prog='example_security_connection.py',
|
||||
# formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
formatter_class=argparse.RawTextHelpFormatter,
|
||||
epilog='''\
|
||||
Example flags and command line input to run the script.
|
||||
''',
|
||||
|
||||
description='''\
|
||||
example_security_connection.py
|
||||
--------------------
|
||||
This python script creates an inputted number of stations using user-inputted security. This verifies that the most basic form of security works with the LANforge device.
|
||||
--------------------
|
||||
|
||||
Generic command example:
|
||||
python3 ./example_security_connection.py \\
|
||||
--host localhost (optional) \\
|
||||
--port 8080 (optional) \\
|
||||
--num_stations 6 \\
|
||||
--radio wiphy2
|
||||
--security {open|wep|wpa|wpa2|wpa3} \\
|
||||
--ssid netgear-wpa3 \\
|
||||
--passwd admin123-wpa3 \\
|
||||
--debug
|
||||
|
||||
''')
|
||||
|
||||
args = parser.parse_args()
|
||||
num_sta = 2
|
||||
if (args.num_stations is not None) and (int(args.num_stations) > 0):
|
||||
num_stations_converted = int(args.num_stations)
|
||||
num_sta = num_stations_converted
|
||||
|
||||
station_list = LFUtils.portNameSeries(prefix_="sta",
|
||||
start_id_=0,
|
||||
end_id_=num_sta-1,
|
||||
padding_number_=10000,
|
||||
radio=args.radio)
|
||||
ip_test = IPv4Test(lfjson_host, lfjson_port, ssid=args.ssid, password=args.passwd, radio=args.radio,
|
||||
security=args.security, sta_list=station_list)
|
||||
ip_test.cleanup(station_list)
|
||||
ip_test.timeout = 60
|
||||
ip_test.build()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -51,7 +51,13 @@ class IPv4Test(LFCliBase):
|
||||
self.station_profile.set_command_param("set_port", "report_timer", 1500)
|
||||
self.station_profile.set_command_flag("set_port", "rpt_timer", 1)
|
||||
self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug)
|
||||
self._pass("PASS: Station build finished")
|
||||
self.station_profile.admin_up()
|
||||
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
|
||||
self._pass("Station build finished")
|
||||
self.passed()
|
||||
else:
|
||||
self._fail("Stations not able to acquire IP. Please check network input.")
|
||||
self.failed()
|
||||
|
||||
def cleanup(self, sta_list):
|
||||
self.station_profile.cleanup(sta_list)
|
||||
|
||||
@@ -51,8 +51,14 @@ class IPv4Test(LFCliBase):
|
||||
self.station_profile.set_command_param("set_port", "report_timer", 1500)
|
||||
self.station_profile.set_command_flag("set_port", "rpt_timer", 1)
|
||||
self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug)
|
||||
self._pass("PASS: Station build finished")
|
||||
|
||||
self.station_profile.admin_up()
|
||||
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
|
||||
self._pass("Station build finished")
|
||||
self.passed()
|
||||
else:
|
||||
self._fail("Stations not able to acquire IP. Please check network input.")
|
||||
self.failed()
|
||||
|
||||
def cleanup(self, sta_list):
|
||||
self.station_profile.cleanup(sta_list)
|
||||
LFUtils.wait_until_ports_disappear(base_url=self.lfclient_url, port_list=sta_list,
|
||||
@@ -71,7 +77,7 @@ def main():
|
||||
''',
|
||||
|
||||
description='''\
|
||||
example_wpa_connection.py
|
||||
example_wpa2_connection.py
|
||||
--------------------
|
||||
|
||||
Generic command example:
|
||||
|
||||
@@ -51,7 +51,14 @@ class IPv4Test(LFCliBase):
|
||||
self.station_profile.set_command_param("set_port", "report_timer", 1500)
|
||||
self.station_profile.set_command_flag("set_port", "rpt_timer", 1)
|
||||
self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug)
|
||||
self._pass("PASS: Station build finished")
|
||||
self.station_profile.admin_up()
|
||||
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
|
||||
self._pass("Station build finished")
|
||||
self.passed()
|
||||
else:
|
||||
self._fail("Stations not able to acquire IP. Please check network input.")
|
||||
self.failed()
|
||||
|
||||
|
||||
def cleanup(self, sta_list):
|
||||
self.station_profile.cleanup(sta_list)
|
||||
|
||||
@@ -52,8 +52,14 @@ class IPv4Test(LFCliBase):
|
||||
self.station_profile.set_command_flag("set_port", "rpt_timer", 1)
|
||||
self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug)
|
||||
self.station_profile.admin_up()
|
||||
|
||||
self._pass("PASS: Station build finished")
|
||||
if self.local_realm.wait_for_ip(station_list=self.sta_list, debug=self.debug, timeout_sec=30):
|
||||
self._pass("Station build finished")
|
||||
self.passed()
|
||||
|
||||
else:
|
||||
self._fail("Stations not able to acquire IP. Please check network input.")
|
||||
self.failed()
|
||||
|
||||
|
||||
def cleanup(self, sta_list):
|
||||
self.station_profile.cleanup(sta_list)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
213
py-scripts/test_1k_clients_jedtest.py
Executable file
213
py-scripts/test_1k_clients_jedtest.py
Executable file
@@ -0,0 +1,213 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
if sys.version_info[0] != 3:
|
||||
print("This script requires Python 3")
|
||||
exit(1)
|
||||
|
||||
import os
|
||||
|
||||
if 'py-json' not in sys.path:
|
||||
sys.path.append(os.path.join(os.path.abspath('..'), 'py-json'))
|
||||
from realm import Realm
|
||||
from LANforge.lfcli_base import LFCliBase
|
||||
from LANforge import LFUtils
|
||||
import argparse
|
||||
import time
|
||||
import datetime
|
||||
import pprint
|
||||
|
||||
class Test1KClients(LFCliBase):
|
||||
def __init__(self,
|
||||
host,
|
||||
port,
|
||||
upstream,
|
||||
side_a_min_rate=0, side_a_max_rate=56000,
|
||||
side_b_min_rate=0, side_b_max_rate=56000,
|
||||
num_sta_=200,
|
||||
_debug_on=True,
|
||||
_exit_on_error=False,
|
||||
_exit_on_fail=False):
|
||||
super().__init__(host,
|
||||
port,
|
||||
_debug=_debug_on,
|
||||
_local_realm=Realm(lfclient_host=host, lfclient_port=port),
|
||||
_halt_on_error=_exit_on_error,
|
||||
_exit_on_fail=_exit_on_fail)
|
||||
self.ssid_radio_map = {
|
||||
'1.1.wiphy0' : ("wpa2", "jedway-wpa2-x2048-4-4", "jedway-wpa2-x2048-4-4"),
|
||||
'1.1.wiphy1' : ("wpa2", "jedway-wpa2-x2048-5-1", "jedway-wpa2-x2048-5-1"),
|
||||
'1.1.wiphy2' : ("wpa2", "jedway-wpa2-x2048-4-1", "jedway-wpa2-x2048-4-1"),
|
||||
|
||||
'1.2.wiphy0' : ("wpa2", "jedway-wpa2-x2048-5-3", "jedway-wpa2-x2048-5-3"),
|
||||
'1.2.wiphy1' : ("wpa2", "jedway-wpa2-x2048-4-4", "jedway-wpa2-x2048-4-4"),
|
||||
'1.2.wiphy2' : ("wpa2", "jedway-wpa2-x2048-4-1", "jedway-wpa2-x2048-4-1"),
|
||||
}
|
||||
if num_sta_ is None:
|
||||
raise ValueError("need a number of stations per radio")
|
||||
self.num_sta = int(num_sta_)
|
||||
self.station_radio_map = {
|
||||
# port_name_series(prefix=prefix_, start_id=start_id_, end_id=end_id_, padding_number=padding_number_, radio=radio)
|
||||
"1.1.wiphy0" : LFUtils.port_name_series(start_id=0, end_id=self.num_sta-1, padding_number=10000, radio="1.1.wiphy0"),
|
||||
"1.1.wiphy1" : LFUtils.port_name_series(start_id=1000, end_id=1000+self.num_sta-1, padding_number=10000, radio="1.1.wiphy1"),
|
||||
"1.1.wiphy2" : LFUtils.port_name_series(start_id=2000, end_id=2000+self.num_sta-1, padding_number=10000, radio="1.1.wiphy2"),
|
||||
|
||||
"1.2.wiphy0" : LFUtils.port_name_series(start_id=3000, end_id=3000+self.num_sta-1, padding_number=10000, radio="1.2.wiphy0"),
|
||||
"1.2.wiphy1" : LFUtils.port_name_series(start_id=4000, end_id=4000+self.num_sta-1, padding_number=10000, radio="1.2.wiphy1"),
|
||||
"1.2.wiphy2" : LFUtils.port_name_series(start_id=5000, end_id=5000+self.num_sta-1, padding_number=10000, radio="1.2.wiphy2")
|
||||
}
|
||||
self.upstream=upstream
|
||||
self.name_prefix = "1k"
|
||||
self.cx_profile = self.local_realm.new_l3_cx_profile()
|
||||
self.cx_profile.name_prefix = self.name_prefix
|
||||
self.cx_profile.side_a_min_bps = side_a_min_rate
|
||||
self.cx_profile.side_a_max_bps = side_a_max_rate
|
||||
self.cx_profile.side_b_min_bps = side_b_min_rate
|
||||
self.cx_profile.side_b_max_bps = side_b_max_rate
|
||||
|
||||
self.station_profile_map = {}
|
||||
def build(self):
|
||||
for (radio, name_series) in self.station_radio_map.items():
|
||||
print("building stations for %s"%radio)
|
||||
if (name_series is None) or len(name_series) < 1:
|
||||
print("No name series for %s"%radio)
|
||||
continue
|
||||
station_profile = self.local_realm.new_station_profile()
|
||||
station_profile.use_security(self.ssid_radio_map[radio][0],
|
||||
self.ssid_radio_map[radio][1],
|
||||
self.ssid_radio_map[radio][2])
|
||||
self.station_profile_map[radio] = station_profile
|
||||
|
||||
self._pass("defined %s station profiles" % len(self.station_radio_map))
|
||||
for (radio, station_profile) in self.station_profile_map.items():
|
||||
station_profile.create(radio=radio,
|
||||
sta_names_=self.station_radio_map[radio],
|
||||
dry_run=False,
|
||||
up_=False,
|
||||
debug=self.debug,
|
||||
suppress_related_commands_=True,
|
||||
use_radius=False,
|
||||
hs20_enable=False,
|
||||
sleep_time=.02)
|
||||
station_profile.set_command_param("set_port", "report_timer", 1500)
|
||||
station_profile.set_command_flag("set_port", "rpt_timer", 1)
|
||||
self.cx_profile.create(endp_type="lf_udp", side_a=station_profile.station_names, side_b=self.upstream, sleep_time=0)
|
||||
|
||||
self._pass("built stations on %s radios" % len(self.station_radio_map))
|
||||
|
||||
def __get_rx_values(self):
|
||||
cx_list = self.json_get("endp?fields=name,rx+bytes", debug_=self.debug)
|
||||
# print(self.cx_profile.created_cx.values())
|
||||
#print("==============\n", cx_list, "\n==============")
|
||||
cx_rx_map = {}
|
||||
for cx_name in cx_list['endpoint']:
|
||||
if cx_name != 'uri' and cx_name != 'handler':
|
||||
for item, value in cx_name.items():
|
||||
for value_name, value_rx in value.items():
|
||||
if value_name == 'rx bytes' and item in self.cx_profile.created_cx.values():
|
||||
cx_rx_map[item] = value_rx
|
||||
return cx_rx_map
|
||||
|
||||
def __compare_vals(self, old_list, new_list):
|
||||
passes = 0
|
||||
expected_passes = 0
|
||||
if len(old_list) == len(new_list):
|
||||
for item, value in old_list.items():
|
||||
expected_passes += 1
|
||||
if new_list[item] > old_list[item]:
|
||||
passes += 1
|
||||
# print(item, new_list[item], old_list[item], passes, expected_passes)
|
||||
|
||||
if passes == expected_passes:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
def start(self):
|
||||
print("Bringing stations up...")
|
||||
prev_ip_num=0
|
||||
total_num_sta=6*self.num_sta
|
||||
for (radio, station_profile) in self.station_profile_map.items():
|
||||
station_profile.admin_up()
|
||||
self.local_realm.wait_for_ip(station_list=self.station_radio_map[radio], debug=self.debug, timeout_sec=30)
|
||||
curr_ip_num = self.local_realm.get_curr_num_ips(num_sta_with_ips=prev_ip_num,station_list=self.station_radio_map[radio], debug=self.debug)
|
||||
while ((prev_ip_num < curr_ip_num) and (curr_ip_num < total_num_sta)):
|
||||
self.local_realm.wait_for_ip(station_list=self.station_radio_map[radio], debug=self.debug, timeout_sec=60)
|
||||
prev_ip_num = curr_ip_num
|
||||
curr_ip_num = self.local_realm.get_curr_num_ips(num_sta_with_ips=prev_ip_num,station_list=self.station_radio_map[radio], debug=self.debug)
|
||||
if curr_ip_num == total_num_sta:
|
||||
self._pass("stations on radio %s up" % radio)
|
||||
else:
|
||||
self._fail("FAIL: Not all stations on radio %s up" % radio)
|
||||
exit(1)
|
||||
|
||||
cur_time = datetime.datetime.now()
|
||||
# old_cx_rx_values = self.__get_rx_values() #
|
||||
end_time = self.local_realm.parse_time("3m") + cur_time
|
||||
self.cx_profile.start_cx() #
|
||||
passes = 0
|
||||
expected_passes = 0
|
||||
while cur_time < end_time:
|
||||
interval_time = cur_time + datetime.timedelta(minutes=1)
|
||||
while cur_time < interval_time:
|
||||
cur_time = datetime.datetime.now()
|
||||
time.sleep(1)
|
||||
cur_time = datetime.datetime.now()
|
||||
|
||||
if passes == expected_passes:
|
||||
self._pass("PASS: All tests passed", print_pass)
|
||||
|
||||
|
||||
def stop(self):
|
||||
pass
|
||||
|
||||
def cleanup(self):
|
||||
#self.cx_profile.cleanup_prefix()
|
||||
for (radio, name_series) in self.station_radio_map.items():
|
||||
sta_list= self.station_radio_map[radio]
|
||||
for sta in sta_list:
|
||||
self.local_realm.rm_port(sta, check_exists=True)
|
||||
|
||||
def main():
|
||||
num_sta=200
|
||||
lfjson_host = "localhost"
|
||||
lfjson_port = 8080
|
||||
|
||||
argparser = LFCliBase.create_basic_argparse(prog=__file__,
|
||||
description="creates lots of stations across multiple radios",
|
||||
formatter_class=argparse.RawTextHelpFormatter)
|
||||
argparser.add_argument("--sta_per_radio",
|
||||
type=int,
|
||||
help="number of stations per radio")
|
||||
argparser.add_argument("--test_duration",
|
||||
type=int,
|
||||
help="length of test duration")
|
||||
|
||||
args = argparser.parse_args()
|
||||
|
||||
kilo_test = Test1KClients(lfjson_host,
|
||||
lfjson_port,
|
||||
upstream=args.upstream_port,
|
||||
num_sta_=args.sta_per_radio,
|
||||
_debug_on=args.debug)
|
||||
|
||||
kilo_test.cleanup()
|
||||
kilo_test.build()
|
||||
if not kilo_test.passes():
|
||||
print("test fails")
|
||||
exit(1)
|
||||
|
||||
kilo_test.start()
|
||||
if not kilo_test.passes():
|
||||
print("test fails")
|
||||
exit(1)
|
||||
|
||||
kilo_test.stop()
|
||||
if not kilo_test.passes():
|
||||
print("test fails")
|
||||
exit(1)
|
||||
kilo_test.cleanup()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,79 +1,90 @@
|
||||
#!/bin/bash
|
||||
#Security connection examples#########################################
|
||||
echo "Beginning example_wpa_connection.py test..."
|
||||
chmod +x example_wpa2_connection.py
|
||||
./example_wpa2_connection.py --num_stations 3 --ssid jedway-r8000-36 --passwd jedway-r8000-36 --radio wiphy0
|
||||
chmod +x scenario.py
|
||||
./scenario.py --load BLANK
|
||||
chmod +x example_wep_connection.py
|
||||
./example_wep_connection.py --ssid jedway-wep-48 --passwd jedway-wep-48 --radio wiphy1
|
||||
./scenario.py --load BLANK
|
||||
chmod +x example_wpa3_connection.py
|
||||
./example_wpa3_connection.py
|
||||
./scenario.py --load BLANK
|
||||
chmod +x example_wpa_connection.py
|
||||
./example_wpa_connection.py --radio wiphy1
|
||||
./scenario.py --load BLANK
|
||||
#test generic and test fileio######################################################
|
||||
#chmod +x test_fileio.py
|
||||
#./test_fileio.py
|
||||
chmod +x test_generic.py
|
||||
#lfping
|
||||
./test_generic.py --num_stations 3 --ssid jedway-r8000-36 --passwd jedway-r8000-36 --radio wiphy0
|
||||
#lfcurl
|
||||
./test_generic.py --num_stations 3 --ssid jedway-r8000-36 --passwd jedway-r8000-36 --radio wiphy0
|
||||
#generic
|
||||
./test_generic.py --num_stations 3 --ssid jedway-r8000-36 --passwd jedway-r8000-36 --radio wiphy0
|
||||
#speedtest
|
||||
./test_generic.py --num_stations 3 --ssid jedway-r8000-36 --passwd jedway-r8000-36 --radio wiphy0
|
||||
#iperf3
|
||||
./test_generic.py --num_stations 3 --ssid jedway-r8000-36 --passwd jedway-r8000-36 --radio wiphy0
|
||||
#Ipv4 connection tests##########################################
|
||||
chmod +x test_ipv4_connection.py
|
||||
./test_ipv4_connection.py
|
||||
chmod +x test_ipv4_l4_ftp_upload.py
|
||||
./test_ipv4_l4_ftp_upload.py
|
||||
chmod +x test_ipv4_l4_ftp_urls_per_ten.py
|
||||
./test_ipv4_l4_ftp_urls_per_ten.py
|
||||
chmod +x test_ipv4_l4_ftp_wifi.py
|
||||
./test_ipv4_l4_ftp_wifi.py
|
||||
chmod +x test_ipv4_l4_urls_per_ten.py
|
||||
./test_ipv4_l4_urls_per_ten.py
|
||||
chmod +x test_ipv4_l4_wifi.py
|
||||
./test_ipv4_l4_wifi.py
|
||||
chmod +x test_ipv4_l4
|
||||
./test_ipv4_l4.py
|
||||
chmod +x test_ipv4_ps.py
|
||||
./test_ipv4_l4_ps.py
|
||||
chmod +x test_ipv4_ttls.py
|
||||
./test_ipv4_l4_ttls.py
|
||||
chmod +x test_ipv4_variable_time.py
|
||||
./test_ipv4_variable_time.py
|
||||
#Layer 3 tests################################################
|
||||
chmod +x test_l3_longevity.py
|
||||
./test_l3_longevity.py
|
||||
chmod +x test_l3_powersave_traffic
|
||||
./test_l3_powersave_traffic.py
|
||||
chmod +x test_l3_scenario_traffic.py
|
||||
./test_l3_scenario_traffic.py
|
||||
chmod +x test_l3_unicast_traffic_gen.py
|
||||
./test_l3_unicast_traffic_gen.py
|
||||
chmod +x test_l3_WAN_LAN.py
|
||||
./test_l3_WAN_LAN.py
|
||||
#WANlink######################################################
|
||||
chmod +x test_wanlink.py
|
||||
./test_wanlink.py
|
||||
#IPv6 connection tests########################################
|
||||
chmod +x test_ipv6_connection.py
|
||||
./test_ipv6_variable_connection.py
|
||||
chmod +x test_ipv6_variable_time.py
|
||||
./test_ipv6_variable_time.py
|
||||
#STA Connect examples#########################################
|
||||
chmod +x sta_connect_example.py
|
||||
./sta_connect_example.py
|
||||
chmod +x sta_connect_multi_example.py
|
||||
./sta_connect_multi_example.py
|
||||
chmod +x sta_connect.py
|
||||
./sta_connect.py
|
||||
chmod +x sta_connect2.py
|
||||
./sta_connect2.py
|
||||
#This bash script aims to automate the test process of all Candela Technologies's test_* scripts in the lanforge-scripts directory. The script can be run 2 ways and may include (via user input) the "start_num" and "stop_num" variables to select which tests should be run.
|
||||
# OPTION ONE: ./test_all_scripts.sh : this command runs all the scripts in the array "testCommands"
|
||||
# OPTION TWO: ./test_all_scripts.sh 4 5 : this command runs py-script commands (in testCommands array) that include the py-script options beginning with 4 and 5 (inclusive) in case function ret_case_num.
|
||||
#Variables
|
||||
NUM_STA=4
|
||||
SSID_USED="jedway-wpa2-x2048-5-3"
|
||||
PASSWD_USED="jedway-wpa2-x2048-5-3"
|
||||
RADIO_USED="wiphy1"
|
||||
SECURITY="wpa2"
|
||||
CURR_TEST_NAME="BLANK"
|
||||
CURR_TEST_NUM=0
|
||||
STOP_NUM=9
|
||||
START_NUM=0
|
||||
#Test array
|
||||
testCommands=("./example_wpa_connection.py --num_stations $NUM_STA --ssid jedway-r8000-36 --passwd jedway-r8000-36 --radio $RADIO_USED --security wpa"
|
||||
"./example_wpa2_connection.py --num_stations $NUM_STA --ssid $SSID_USED --passwd $SSID_USED --radio $RADIO_USED --security wpa2"
|
||||
"./example_wep_connection.py --num_stations $NUM_STA --ssid jedway-wep-48 --passwd jedway-wep-48 --radio $RADIO_USED --security wep"
|
||||
"./example_wpa3_connection.py --num_stations $NUM_STA --ssid jedway-wpa3-1 --passwd jedway-wpa3-1 --radio $RADIO_USED --security wpa3"
|
||||
"./test_ipv4_connection.py --radio wiphy2 --num_stations $NUM_STA --ssid $SSID_USED --passwd $PASSWD_USED --security $SECURITY --debug --upstream_port eth1"
|
||||
"./test_generic.py --mgr localhost --mgr_port 4122 --radio $RADIO_USED --ssid SSID_USED --passwd $PASSWD_USED --num_stations $NUM_STA --type lfping --dest 10.40.0.1 --security $SECURITY"
|
||||
"./test_generic.py --mgr localhost --mgr_port 4122 --radio $RADIO_USED --ssid $SSID_USED --passwd $PASSWD_USED --num_stations $NUM_STA --type speedtest --speedtest_min_up 20 --speedtest_min_dl 20 --speedtest_max_ping 150 --security $SECURITY"
|
||||
"./test_ipv4_l4_urls_per_ten.py --upstream_port eth1 --radio $RADIO_USED --num_stations $NUM_STA --security $SECURITY --ssid $SSID_USED --passwd $PASSWD_USED --num_tests 1 --requests_per_ten 600 --target_per_ten 600"
|
||||
"./test_ipv4_l4_wifi.py --upstream_port eth1 --radio wiphy0 --num_stations $NUM_STA --security $SECURITY --ssid jedway-wpa2-x2048-4-4 --passwd jedway-wpa2-x2048-4-4 --test_duration 3m"
|
||||
"./test_ipv4_l4.py --radio wiphy3 --num_stations 4 --security wpa2 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --url \"dl http://10.40.0.1 /dev/null\" --test_duration 2m --debug"
|
||||
)
|
||||
function ret_case_num(){
|
||||
case $1 in
|
||||
"example_wpa_connection")
|
||||
echo 1 ;;
|
||||
"example_wpa2_connection")
|
||||
echo 2 ;;
|
||||
"example_wpa3_connection")
|
||||
echo 4 ;;
|
||||
"example_wep_connection")
|
||||
echo 3 ;;
|
||||
"test_ipv4_connection")
|
||||
echo 5 ;;
|
||||
"test_generic")
|
||||
echo 6 ;;
|
||||
"test_ipv4_l4_urls_per_ten")
|
||||
echo 7 ;;
|
||||
"test_ipv4_l4_wifi")
|
||||
echo 8 ;;
|
||||
"test_ipv4_l4")
|
||||
echo 9 ;;
|
||||
esac
|
||||
}
|
||||
function blank_db() {
|
||||
echo "Loading blank scenario..." >> ~/test_all_output_file.txt
|
||||
./scenario.py --load BLANK >> ~/test_all_output_file.txt
|
||||
#check_blank.py
|
||||
}
|
||||
function echo_print(){
|
||||
echo "Beginning $CURR_TEST_NAME test..." >> ~/test_all_output_file.txt
|
||||
}
|
||||
function run_test(){
|
||||
for i in "${testCommands[@]}"; do
|
||||
CURR_TEST_NAME=${i%%.py*}
|
||||
CURR_TEST_NAME=${CURR_TEST_NAME#./*}
|
||||
CURR_TEST_NUM=$(ret_case_num $CURR_TEST_NAME)
|
||||
if [[ $CURR_TEST_NUM -gt $STOP_NUM ]] || [[ $STOP_NUM -eq $CURR_NUM && $STOP_NUM -ne 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
if [[ $CURR_TEST_NUM -gt $START_NUM ]] || [[ $CURR_TEST_NUM -eq $START_NUM ]]; then
|
||||
echo_print
|
||||
eval $i >> ~/test_all_output_file.txt
|
||||
if [ $? -ne 0 ]; then
|
||||
echo $CURR_TEST_NAME failure
|
||||
else
|
||||
echo $CURR_TEST_NAME success
|
||||
fi
|
||||
if [[ "${CURR_TEST_NAME}" = @(example_wpa_connection|example_wpa2_connection|example_wpa3_connection|example_wep_connection) ]]; then
|
||||
blank_db
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
function check_args(){
|
||||
if [ ! -z $1 ]; then
|
||||
START_NUM=$1
|
||||
fi
|
||||
if [ ! -z $2 ]; then
|
||||
STOP_NUM=$2
|
||||
fi
|
||||
}
|
||||
true > ~/test_all_output_file.txt
|
||||
check_args $1 $2
|
||||
run_test
|
||||
#test generic and fileio are for macvlans
|
||||
|
||||
@@ -18,6 +18,7 @@ import argparse
|
||||
import realm
|
||||
import time
|
||||
import datetime
|
||||
import pprint
|
||||
|
||||
|
||||
class FileIOTest(LFCliBase):
|
||||
@@ -44,7 +45,12 @@ class FileIOTest(LFCliBase):
|
||||
gateway=None,
|
||||
dhcp=True,
|
||||
use_macvlans=False,
|
||||
use_test_groups=False,
|
||||
write_only_test_group=None,
|
||||
read_only_test_group=None,
|
||||
port_list=[],
|
||||
ip_list=None,
|
||||
mode=None,
|
||||
_debug_on=False,
|
||||
_exit_on_error=False,
|
||||
_exit_on_fail=False):
|
||||
@@ -58,14 +64,39 @@ class FileIOTest(LFCliBase):
|
||||
self.password = password
|
||||
self.number_template = number_template
|
||||
self.test_duration = test_duration
|
||||
self.sta_list = []
|
||||
self.port_list = []
|
||||
self.use_macvlans = use_macvlans
|
||||
self.mode = mode
|
||||
self.ip_list = ip_list
|
||||
self.netmask = netmask
|
||||
self.gateway = gateway
|
||||
if self.use_macvlans:
|
||||
if macvlan_parent != None:
|
||||
if macvlan_parent is not None:
|
||||
self.macvlan_parent = macvlan_parent
|
||||
self.port_list = port_list
|
||||
else:
|
||||
self.sta_list = port_list
|
||||
self.port_list = port_list
|
||||
|
||||
self.use_test_groups = use_test_groups
|
||||
if self.use_test_groups:
|
||||
if self.mode == "write":
|
||||
if write_only_test_group is not None:
|
||||
self.write_only_test_group = write_only_test_group
|
||||
else:
|
||||
raise ValueError("--write_only_test_group must be used to set test group name")
|
||||
if self.mode == "read":
|
||||
if read_only_test_group is not None:
|
||||
self.read_only_test_group = read_only_test_group
|
||||
else:
|
||||
raise ValueError("--read_only_test_group must be used to set test group name")
|
||||
if self.mode == "both":
|
||||
if write_only_test_group is not None and read_only_test_group is not None:
|
||||
self.write_only_test_group = write_only_test_group
|
||||
self.read_only_test_group = read_only_test_group
|
||||
else:
|
||||
raise ValueError("--write_only_test_group and --read_only_test_group "
|
||||
"must be used to set test group names")
|
||||
|
||||
#self.min_rw_size = self.parse_size(min_rw_size)
|
||||
#self.max_rw_size = self.parse_size(max_rw_size)
|
||||
#self.min_file_size = self.parse_size(min_file_size)
|
||||
@@ -76,10 +107,10 @@ class FileIOTest(LFCliBase):
|
||||
#self.max_write_rate_bps = self.parse_size_bps(max_write_rate_bps)
|
||||
|
||||
self.local_realm = realm.Realm(lfclient_host=self.host, lfclient_port=self.port)
|
||||
self.endp_profile = self.local_realm.new_fio_endp_profile()
|
||||
self.wo_profile = self.local_realm.new_fio_endp_profile()
|
||||
self.mvlan_profile = self.local_realm.new_mvlan_profile()
|
||||
|
||||
if len(self.sta_list) > 0:
|
||||
if not self.use_macvlans and len(self.port_list) > 0:
|
||||
self.station_profile = self.local_realm.new_station_profile()
|
||||
self.station_profile.lfclient_url = self.lfclient_url
|
||||
self.station_profile.ssid = self.ssid
|
||||
@@ -88,29 +119,44 @@ class FileIOTest(LFCliBase):
|
||||
self.station_profile.number_template_ = self.number_template
|
||||
self.station_profile.mode = 0
|
||||
|
||||
self.endp_profile.fs_type = fs_type
|
||||
self.endp_profile.min_rw_size = LFUtils.parse_size(min_rw_size)
|
||||
self.endp_profile.max_rw_size = LFUtils.parse_size(max_rw_size)
|
||||
self.endp_profile.min_file_size = LFUtils.parse_size(min_file_size)
|
||||
self.endp_profile.min_file_size = LFUtils.parse_size(min_file_size)
|
||||
self.endp_profile.min_read_rate_bps = LFUtils.parse_size(min_read_rate_bps)
|
||||
self.endp_profile.max_read_rate_bps = LFUtils.parse_size(max_read_rate_bps)
|
||||
self.endp_profile.min_write_rate_bps = LFUtils.parse_size(min_write_rate_bps)
|
||||
self.endp_profile.max_write_rate_bps = LFUtils.parse_size(max_write_rate_bps)
|
||||
self.endp_profile.directory = directory
|
||||
self.endp_profile.server_mount = server_mount
|
||||
self.wo_profile.fs_type = fs_type
|
||||
self.wo_profile.min_rw_size = LFUtils.parse_size(min_rw_size)
|
||||
self.wo_profile.max_rw_size = LFUtils.parse_size(max_rw_size)
|
||||
self.wo_profile.min_file_size = LFUtils.parse_size(min_file_size)
|
||||
self.wo_profile.max_file_size = LFUtils.parse_size(max_file_size)
|
||||
self.wo_profile.min_read_rate_bps = LFUtils.parse_size(min_read_rate_bps)
|
||||
self.wo_profile.max_read_rate_bps = LFUtils.parse_size(max_read_rate_bps)
|
||||
self.wo_profile.min_write_rate_bps = LFUtils.parse_size(min_write_rate_bps)
|
||||
self.wo_profile.max_write_rate_bps = LFUtils.parse_size(max_write_rate_bps)
|
||||
self.wo_profile.directory = directory
|
||||
self.wo_profile.server_mount = server_mount
|
||||
|
||||
self.ro_profile = self.endp_profile.create_ro_profile()
|
||||
self.ro_profile = self.wo_profile.create_ro_profile()
|
||||
|
||||
self.mvlan_profile.num_macvlans = int(num_ports)
|
||||
self.mvlan_profile.desired_macvlans = self.port_list
|
||||
self.mvlan_profile.macvlan_parent = self.macvlan_parent
|
||||
self.mvlan_profile.dhcp = dhcp
|
||||
self.mvlan_profile.netmask = netmask
|
||||
self.mvlan_profile.first_ip_addr = first_mvlan_ip
|
||||
self.mvlan_profile.gateway = gateway
|
||||
if self.use_macvlans:
|
||||
self.mvlan_profile.num_macvlans = int(num_ports)
|
||||
self.mvlan_profile.desired_macvlans = self.port_list
|
||||
self.mvlan_profile.macvlan_parent = self.macvlan_parent
|
||||
self.mvlan_profile.dhcp = dhcp
|
||||
self.mvlan_profile.netmask = netmask
|
||||
self.mvlan_profile.first_ip_addr = first_mvlan_ip
|
||||
self.mvlan_profile.gateway = gateway
|
||||
|
||||
self.created_ports = []
|
||||
if self.use_test_groups:
|
||||
if self.mode is not None:
|
||||
if self.mode.lower() == "write":
|
||||
self.wo_tg_profile = self.local_realm.new_test_group_profile()
|
||||
elif self.mode.lower() == "read":
|
||||
self.ro_tg_profile = self.local_realm.new_test_group_profile()
|
||||
elif self.mode.lower() == "both":
|
||||
self.wo_tg_profile = self.local_realm.new_test_group_profile()
|
||||
self.ro_tg_profile = self.local_realm.new_test_group_profile()
|
||||
else:
|
||||
raise ValueError("Unknown mode given ", self.mode)
|
||||
else:
|
||||
raise ValueError("Mode (read,write,both) must be specified")
|
||||
|
||||
def __compare_vals(self, val_list):
|
||||
passes = 0
|
||||
expected_passes = 0
|
||||
@@ -121,18 +167,18 @@ class FileIOTest(LFCliBase):
|
||||
if item[0] == 'r':
|
||||
# print("TEST", item,
|
||||
# val_list[item]['read-bps'],
|
||||
# self.endp_profile.min_read_rate_bps,
|
||||
# val_list[item]['read-bps'] > self.endp_profile.min_read_rate_bps)
|
||||
# self.ro_profile.min_read_rate_bps,
|
||||
# val_list[item]['read-bps'] > self.ro_profile.min_read_rate_bps)
|
||||
|
||||
if val_list[item]['read-bps'] > self.endp_profile.min_read_rate_bps:
|
||||
if val_list[item]['read-bps'] > self.wo_profile.min_read_rate_bps:
|
||||
passes += 1
|
||||
else:
|
||||
# print("TEST", item,
|
||||
# val_list[item]['write-bps'],
|
||||
# self.endp_profile.min_write_rate_bps,
|
||||
# val_list[item]['write-bps'] > self.endp_profile.min_write_rate_bps)
|
||||
# self.wo_profile.min_write_rate_bps,
|
||||
# val_list[item]['write-bps'] > self.wo_profile.min_write_rate_bps)
|
||||
|
||||
if val_list[item]['write-bps'] > self.endp_profile.min_write_rate_bps:
|
||||
if val_list[item]['write-bps'] > self.wo_profile.min_write_rate_bps:
|
||||
passes += 1
|
||||
if passes == expected_passes:
|
||||
return True
|
||||
@@ -143,11 +189,20 @@ class FileIOTest(LFCliBase):
|
||||
|
||||
def __get_values(self):
|
||||
time.sleep(3)
|
||||
cx_list = self.json_get("fileio/%s,%s?fields=write-bps,read-bps" % (','.join(self.endp_profile.created_cx.keys()), ','.join(self.ro_profile.created_cx.keys())),
|
||||
debug_=self.debug)
|
||||
if self.mode == "write":
|
||||
cx_list = self.json_get("fileio/%s?fields=write-bps,read-bps" % (
|
||||
','.join(self.wo_profile.created_cx.keys())), debug_=self.debug)
|
||||
elif self.mode == "read":
|
||||
cx_list = self.json_get("fileio/%s?fields=write-bps,read-bps" % (
|
||||
','.join(self.ro_profile.created_cx.keys())), debug_=self.debug)
|
||||
else:
|
||||
cx_list = self.json_get("fileio/%s,%s?fields=write-bps,read-bps" % (
|
||||
','.join(self.wo_profile.created_cx.keys()),
|
||||
','.join(self.ro_profile.created_cx.keys())), debug_=self.debug)
|
||||
# print(cx_list)
|
||||
# print("==============\n", cx_list, "\n==============")
|
||||
cx_map = {}
|
||||
# pprint.pprint(cx_list)
|
||||
if cx_list is not None:
|
||||
cx_list = cx_list['endpoint']
|
||||
for i in cx_list:
|
||||
@@ -159,45 +214,114 @@ class FileIOTest(LFCliBase):
|
||||
|
||||
def build(self):
|
||||
# Build stations
|
||||
# print(self.min_tx_bps, self.min_rx_bps)
|
||||
# TODO: Check for upstream port as child to bridge before macvlan create
|
||||
if self.use_macvlans:
|
||||
self.mvlan_profile.create(admin_down=True, sleep_time=.5, debug=self.debug)
|
||||
print("Creating MACVLANs")
|
||||
self.mvlan_profile.create(admin_down=False, sleep_time=.5, debug=self.debug)
|
||||
self._pass("PASS: MACVLAN build finished")
|
||||
self.created_ports += self.mvlan_profile.created_macvlans
|
||||
|
||||
if len(self.sta_list) > 0:
|
||||
elif not self.use_macvlans and self.ip_list is None:
|
||||
self.station_profile.use_security(self.security, self.ssid, self.password)
|
||||
self.station_profile.set_number_template(self.number_template)
|
||||
print("Creating stations")
|
||||
self.station_profile.set_command_flag("add_sta", "create_admin_down", 1)
|
||||
self.station_profile.set_command_param("set_port", "report_timer", 1500)
|
||||
self.station_profile.set_command_flag("set_port", "rpt_timer", 1)
|
||||
self.station_profile.create(radio=self.radio, sta_names_=self.sta_list, debug=self.debug)
|
||||
self.station_profile.create(radio=self.radio, sta_names_=self.port_list, debug=self.debug)
|
||||
self._pass("PASS: Station build finished")
|
||||
self.created_ports += self.station_profile.station_names
|
||||
|
||||
if self.ip_list is not None:
|
||||
if self.gateway is not None and self.netmask is not None:
|
||||
for num_port in range(len(self.port_list)):
|
||||
shelf = self.local_realm.name_to_eid(self.port_list[num_port])[0]
|
||||
resource = self.local_realm.name_to_eid(self.port_list[num_port])[1]
|
||||
port = self.local_realm.name_to_eid(self.port_list[num_port])[2]
|
||||
req_url = "/cli-json/set_port"
|
||||
data = {
|
||||
"shelf": shelf,
|
||||
"resource": resource,
|
||||
"port": port,
|
||||
"ip_addr": self.ip_list[num_port],
|
||||
"netmask": self.netmask,
|
||||
"gateway": self.gateway
|
||||
}
|
||||
self.local_realm.json_post(req_url, data)
|
||||
self.created_ports.append("%s.%s.%s" % (shelf, resource, port))
|
||||
else:
|
||||
raise ValueError("Netmask and gateway must be specified")
|
||||
|
||||
if self.mode is not None:
|
||||
if self.mode.lower() == "write":
|
||||
print("Creating Write Only CXs")
|
||||
self.wo_profile.create(ports=self.created_ports, sleep_time=.5, debug_=self.debug,
|
||||
suppress_related_commands_=None)
|
||||
elif self.mode.lower() == "read":
|
||||
print("Creating Read Only CXs")
|
||||
self.ro_profile.create(ports=self.created_ports, sleep_time=.5, debug_=self.debug,
|
||||
suppress_related_commands_=None)
|
||||
elif self.mode.lower() == "both":
|
||||
print("Creating Write Only CXs")
|
||||
print("Creating Read Only CXs")
|
||||
self.wo_profile.create(ports=self.created_ports, sleep_time=.5, debug_=self.debug,
|
||||
suppress_related_commands_=None)
|
||||
self.ro_profile.create(ports=self.created_ports, sleep_time=.5, debug_=self.debug,
|
||||
suppress_related_commands_=None)
|
||||
|
||||
if self.use_test_groups:
|
||||
print("Creating test groups...")
|
||||
if self.mode is not None:
|
||||
if self.mode.lower() == "write":
|
||||
self.wo_tg_profile.cx_list = self.wo_profile.created_cx.values()
|
||||
self.wo_tg_profile.create_group(group_name=self.write_only_test_group)
|
||||
elif self.mode.lower() == "read":
|
||||
self.ro_tg_profile.cx_list = self.ro_profile.created_cx.values()
|
||||
self.ro_tg_profile.create_group(group_name=self.read_only_test_group)
|
||||
elif self.mode.lower() == "both":
|
||||
self.ro_tg_profile.cx_list = self.ro_profile.created_cx.values()
|
||||
self.wo_tg_profile.cx_list = self.wo_profile.created_cx.values()
|
||||
self.ro_tg_profile.create_group(group_name=self.read_only_test_group)
|
||||
self.wo_tg_profile.create_group(group_name=self.write_only_test_group)
|
||||
else:
|
||||
raise ValueError("Unknown mode given ", self.mode)
|
||||
else:
|
||||
raise ValueError("Mode (read,write,both) must be specified")
|
||||
|
||||
|
||||
|
||||
self.endp_profile.create(ports=self.created_ports, sleep_time=.5, debug_=self.debug,
|
||||
suppress_related_commands_=None)
|
||||
self.ro_profile.create(ports=self.created_ports, sleep_time=.5, debug_=self.debug,
|
||||
suppress_related_commands_=None)
|
||||
|
||||
def start(self, print_pass=False, print_fail=False):
|
||||
temp_ports = self.port_list.copy()
|
||||
temp_ports = self.created_ports.copy()
|
||||
#temp_stas.append(self.local_realm.name_to_eid(self.upstream_port)[2])
|
||||
self.station_profile.admin_up()
|
||||
self.mvlan_profile.admin_up()
|
||||
exit(1)
|
||||
if self.local_realm.wait_for_ip(temp_ports):
|
||||
if not self.use_macvlans:
|
||||
self.station_profile.admin_up()
|
||||
else:
|
||||
self.mvlan_profile.admin_up()
|
||||
if self.local_realm.wait_for_ip(temp_ports, debug=self.debug):
|
||||
self._pass("All ports got IPs", print_pass)
|
||||
else:
|
||||
self._fail("Ports failed to get IPs", print_fail)
|
||||
cur_time = datetime.datetime.now()
|
||||
# print("Got Values")
|
||||
end_time = self.local_realm.parse_time(self.test_duration) + cur_time
|
||||
self.endp_profile.start_cx()
|
||||
time.sleep(2)
|
||||
self.ro_profile.start_cx()
|
||||
if self.use_test_groups:
|
||||
if self.mode == "write":
|
||||
self.wo_tg_profile.start_group(group_name=self.write_only_test_group)
|
||||
elif self.mode == "read":
|
||||
self.ro_tg_profile.start_group(group_name=self.read_only_test_group)
|
||||
else:
|
||||
self.wo_tg_profile.start_group(group_name=self.write_only_test_group)
|
||||
time.sleep(2)
|
||||
self.ro_tg_profile.start_group(group_name=self.read_only_test_group)
|
||||
else:
|
||||
if self.mode == "write":
|
||||
self.wo_profile.start_cx()
|
||||
elif self.mode == "read":
|
||||
self.ro_profile.start_cx()
|
||||
else:
|
||||
self.wo_profile.start_cx()
|
||||
time.sleep(2)
|
||||
self.ro_profile.start_cx()
|
||||
|
||||
passes = 0
|
||||
expected_passes = 0
|
||||
print("Starting Test...")
|
||||
@@ -225,18 +349,51 @@ class FileIOTest(LFCliBase):
|
||||
self._pass("PASS: All tests passes", print_pass)
|
||||
|
||||
def stop(self):
|
||||
self.endp_profile.stop_cx()
|
||||
self.ro_profile.stop_cx()
|
||||
self.station_profile.admin_down()
|
||||
self.mvlan_profile.admin_down()
|
||||
if self.use_test_groups:
|
||||
if self.mode == "write":
|
||||
self.wo_tg_profile.stop_group(group_name=self.write_only_test_group)
|
||||
elif self.mode == "read":
|
||||
self.ro_tg_profile.stop_group(group_name=self.read_only_test_group)
|
||||
else:
|
||||
self.wo_tg_profile.stop_group(group_name=self.write_only_test_group)
|
||||
time.sleep(2)
|
||||
self.ro_tg_profile.stop_group(group_name=self.read_only_test_group)
|
||||
else:
|
||||
if self.mode == "write":
|
||||
self.wo_profile.stop_cx()
|
||||
elif self.mode == "read":
|
||||
self.ro_profile.stop_cx()
|
||||
else:
|
||||
self.wo_profile.stop_cx()
|
||||
time.sleep(2)
|
||||
self.ro_profile.stop_cx()
|
||||
|
||||
def cleanup(self, sta_list=None):
|
||||
self.endp_profile.cleanup()
|
||||
if not self.use_macvlans:
|
||||
self.station_profile.admin_down()
|
||||
else:
|
||||
self.mvlan_profile.admin_down()
|
||||
|
||||
def cleanup(self, port_list=None):
|
||||
if self.use_test_groups:
|
||||
if self.mode == "read":
|
||||
self.ro_tg_profile.remove_group(group_name=self.read_only_test_group)
|
||||
elif self.mode == "write":
|
||||
self.wo_tg_profile.remove_group(group_name=self.write_only_test_group)
|
||||
else:
|
||||
self.ro_tg_profile.remove_group(group_name=self.read_only_test_group)
|
||||
self.wo_tg_profile.remove_group(group_name=self.write_only_test_group)
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
self.wo_profile.cleanup()
|
||||
self.ro_profile.cleanup()
|
||||
if len(self.sta_list) > 0:
|
||||
self.station_profile.cleanup(sta_list)
|
||||
LFUtils.wait_until_ports_disappear(base_url=self.lfclient_url, port_list=sta_list, debug=self.debug)
|
||||
self.mvlan_profile.cleanup()
|
||||
|
||||
if not self.use_macvlans and self.ip_list is None:
|
||||
self.station_profile.cleanup(port_list)
|
||||
elif self.use_macvlans:
|
||||
self.mvlan_profile.cleanup()
|
||||
|
||||
# LFUtils.wait_until_ports_disappear(base_url=self.lfclient_url, port_list=port_list, debug=self.debug)
|
||||
|
||||
|
||||
def main():
|
||||
@@ -253,9 +410,11 @@ def main():
|
||||
test_fileio.py:
|
||||
--------------------
|
||||
Generic command layout:
|
||||
python ./test_fileio.py --upstream_port <port> --radio <radio 0> <stations> <ssid> <ssid password> <security type: wpa2, open, wpa3> --debug
|
||||
./test_fileio.py --macvlan_parent <port> --num_ports <num ports> --use_macvlans
|
||||
--first_mvlan_ip <first ip in series> --netmask <netmask to use> --gateway <gateway ip addr>
|
||||
|
||||
python3 ./test_fileio.py --upstream_port eth1 --fio_type fe_nfs4 --min_read 1Mbps --min_write 1Gbps --server_mount 192.168.93.195:/tmp/test
|
||||
./test_fileio.py --macvlan_parent eth2 --num_ports 3 --use_macvlans --first_mvlan_ip 192.168.92.13
|
||||
--netmask 255.255.255.0 --gateway 192.168.92.1
|
||||
''')
|
||||
|
||||
parser.add_argument('--test_duration', help='sets the duration of the test', default="5m")
|
||||
@@ -268,7 +427,8 @@ python3 ./test_fileio.py --upstream_port eth1 --fio_type fe_nfs4 --min_read 1Mbp
|
||||
parser.add_argument('--max_read_rate_bps', help='maximum bps read rate', default=10e9)
|
||||
parser.add_argument('--min_write_rate_bps', help='minimum bps write rate', default=10e9)
|
||||
parser.add_argument('--max_write_rate_bps', help='maximum bps write rate', default="1G")
|
||||
parser.add_argument('--directory', help='--directory directory to read/write in. Absolute path suggested', default="AUTO")
|
||||
parser.add_argument('--directory', help='--directory directory to read/write in. Absolute path suggested',
|
||||
default="AUTO")
|
||||
parser.add_argument('--server_mount', help='--server_mount The server to mount, ex: 192.168.100.5/exports/test1',
|
||||
default="10.40.0.1:/var/tmp/test")
|
||||
parser.add_argument('--macvlan_parent', help='specifies parent port for macvlan creation', default=None)
|
||||
@@ -278,13 +438,21 @@ python3 ./test_fileio.py --upstream_port eth1 --fio_type fe_nfs4 --min_read 1Mbp
|
||||
parser.add_argument('--first_mvlan_ip', help='specifies first static ip address to be used or dhcp', default=None)
|
||||
parser.add_argument('--netmask', help='specifies netmask to be used with static ip addresses', default=None)
|
||||
parser.add_argument('--gateway', help='specifies default gateway to be used with static addressing', default=None)
|
||||
parser.add_argument('--use_test_groups', help='will use test groups to start/stop instead of single endps/cxs',
|
||||
action='store_true', default=False)
|
||||
parser.add_argument('--read_only_test_group', help='specifies name to use for read only test group', default=None)
|
||||
parser.add_argument('--write_only_test_group', help='specifies name to use for write only test group', default=None)
|
||||
parser.add_argument('--mode', help='write,read,both', default='both', type=str)
|
||||
parser.add_argument('--use_ports', help='list of comma separated ports to use with ips, \'=\' separates name and ip'
|
||||
'{ port_name1=ip_addr1,port_name1=ip_addr2 }', default=None)
|
||||
args = parser.parse_args()
|
||||
|
||||
port_list = []
|
||||
if args.first_port is not None:
|
||||
ip_list = []
|
||||
if args.first_port is not None and args.use_ports is not None:
|
||||
if args.first_port.startswith("sta"):
|
||||
if (args.num_ports is not None) and (int(args.num_ports) > 0):
|
||||
start_num = int(args.first_port[4:])
|
||||
start_num = int(args.first_port[3:])
|
||||
num_ports = int(args.num_ports)
|
||||
port_list = LFUtils.port_name_series(prefix="sta", start_id=start_num, end_id=start_num+num_ports-1,
|
||||
padding_number=10000,
|
||||
@@ -302,27 +470,45 @@ python3 ./test_fileio.py --upstream_port eth1 --fio_type fe_nfs4 --min_read 1Mbp
|
||||
"first_port must contain parent port and num_ports must be greater than 0"
|
||||
% (args.num_ports, args.macvlan_parent, args.first_port))
|
||||
else:
|
||||
num_ports = int(args.num_ports)
|
||||
if not args.use_macvlans:
|
||||
port_list = LFUtils.port_name_series(prefix="sta", start_id=0, end_id=num_ports - 1,
|
||||
padding_number=10000,
|
||||
radio=args.radio)
|
||||
else:
|
||||
port_list = LFUtils.port_name_series(prefix=args.macvlan_parent + "#", start_id=0,
|
||||
if args.use_ports is None:
|
||||
num_ports = int(args.num_ports)
|
||||
if not args.use_macvlans:
|
||||
port_list = LFUtils.port_name_series(prefix="sta", start_id=0, end_id=num_ports - 1,
|
||||
padding_number=10000,
|
||||
radio=args.radio)
|
||||
else:
|
||||
port_list = LFUtils.port_name_series(prefix=args.macvlan_parent + "#", start_id=0,
|
||||
end_id=num_ports - 1, padding_number=100000,
|
||||
radio=args.radio)
|
||||
if args.first_mvlan_ip.lower() == "dhcp":
|
||||
dhcp = True
|
||||
else:
|
||||
dhcp = False
|
||||
print(port_list)
|
||||
else:
|
||||
temp_list = args.use_ports.split(',')
|
||||
for port in temp_list:
|
||||
port_list.append(port.split('=')[0])
|
||||
ip_list.append(port.split('=')[1])
|
||||
|
||||
if len(port_list) != len(ip_list):
|
||||
raise ValueError(temp_list, " ports must have matching ip addresses!")
|
||||
|
||||
print(port_list)
|
||||
print(ip_list)
|
||||
|
||||
if args.first_mvlan_ip is not None:
|
||||
if args.first_mvlan_ip.lower() == "dhcp":
|
||||
dhcp = True
|
||||
else:
|
||||
dhcp = False
|
||||
else:
|
||||
dhcp = True
|
||||
# print(port_list)
|
||||
|
||||
# exit(1)
|
||||
ip_test = FileIOTest(args.mgr,
|
||||
args.mgr_port,
|
||||
ssid=args.ssid,
|
||||
password=args.passwd,
|
||||
security=args.security,
|
||||
port_list=port_list,
|
||||
ip_list=ip_list,
|
||||
test_duration=args.test_duration,
|
||||
upstream_port=args.upstream_port,
|
||||
_debug_on=args.debug,
|
||||
@@ -344,7 +530,11 @@ python3 ./test_fileio.py --upstream_port eth1 --fio_type fe_nfs4 --min_read 1Mbp
|
||||
max_write_rate_bps=args.max_write_rate_bps,
|
||||
directory=args.directory,
|
||||
server_mount=args.server_mount,
|
||||
num_ports=args.num_ports
|
||||
num_ports=args.num_ports,
|
||||
use_test_groups=args.use_test_groups,
|
||||
write_only_test_group=args.write_only_test_group,
|
||||
read_only_test_group=args.read_only_test_group,
|
||||
mode=args.mode
|
||||
# want a mount options param
|
||||
)
|
||||
|
||||
@@ -352,7 +542,6 @@ python3 ./test_fileio.py --upstream_port eth1 --fio_type fe_nfs4 --min_read 1Mbp
|
||||
ip_test.build()
|
||||
if not ip_test.passes():
|
||||
print(ip_test.get_fail_message())
|
||||
exit(1)
|
||||
ip_test.start(False, False)
|
||||
ip_test.stop()
|
||||
if not ip_test.passes():
|
||||
|
||||
@@ -19,7 +19,7 @@ import datetime
|
||||
import json
|
||||
|
||||
class GenTest(LFCliBase):
|
||||
def __init__(self, host, port, ssid, security, password, sta_list, name_prefix, upstream,
|
||||
def __init__(self, host, port, ssid, security, passwd, sta_list, name_prefix, upstream,
|
||||
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,
|
||||
@@ -31,7 +31,7 @@ class GenTest(LFCliBase):
|
||||
self.upstream = upstream
|
||||
self.sta_list = sta_list
|
||||
self.security = security
|
||||
self.password = password
|
||||
self.passwd = passwd
|
||||
self.number_template = number_template
|
||||
self.name_prefix = name_prefix
|
||||
self.test_duration = test_duration
|
||||
@@ -48,7 +48,7 @@ class GenTest(LFCliBase):
|
||||
|
||||
self.station_profile.lfclient_url = self.lfclient_url
|
||||
self.station_profile.ssid = self.ssid
|
||||
self.station_profile.ssid_pass = self.password,
|
||||
self.station_profile.ssid_pass = self.passwd,
|
||||
self.station_profile.security = self.security
|
||||
self.station_profile.number_template_ = self.number_template
|
||||
self.station_profile.mode = 0
|
||||
@@ -84,8 +84,8 @@ class GenTest(LFCliBase):
|
||||
if last_results['download'] is None and last_results['upload'] is None and last_results['ping'] is None:
|
||||
return False, v['name']
|
||||
elif last_results['download'] >= self.speedtest_min_dl and \
|
||||
last_results['upload'] >= self.speedtest_min_up and \
|
||||
last_results['ping'] <= self.speedtest_max_ping:
|
||||
last_results['upload'] >= self.speedtest_min_up and \
|
||||
last_results['ping'] <= self.speedtest_max_ping:
|
||||
return True, v['name']
|
||||
|
||||
def choose_generic_command(self):
|
||||
@@ -155,7 +155,7 @@ class GenTest(LFCliBase):
|
||||
self.station_profile.admin_down()
|
||||
|
||||
def build(self):
|
||||
self.station_profile.use_security(self.security, self.ssid, self.password)
|
||||
self.station_profile.use_security(self.security, self.ssid, self.passwd)
|
||||
self.station_profile.set_number_template(self.number_template)
|
||||
print("Creating stations")
|
||||
self.station_profile.set_command_flag("add_sta", "create_admin_down", 1)
|
||||
@@ -194,6 +194,20 @@ python3 ./test_generic.py --upstream_port eth1
|
||||
--test_duration 2m
|
||||
--interval 1s
|
||||
--debug
|
||||
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
--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
|
||||
''')
|
||||
|
||||
parser.add_argument('--type', help='type of command to run: generic, lfping, iperf3-client, iperf3-server, lfcurl', default="lfping")
|
||||
@@ -228,7 +242,7 @@ python3 ./test_generic.py --upstream_port eth1
|
||||
interval=1,
|
||||
ssid=args.ssid,
|
||||
upstream=args.upstream_port,
|
||||
password=args.passwd,
|
||||
passwd=args.passwd,
|
||||
security=args.security,
|
||||
test_duration=args.test_duration,
|
||||
speedtest_min_up=args.speedtest_min_up,
|
||||
|
||||
@@ -126,12 +126,9 @@ Generic command example:
|
||||
./test_ipv4_connection.py --upstream_port eth1 \\
|
||||
--radio wiphy0 \\
|
||||
--num_stations 3 \\
|
||||
--security {open|wep|wpa|wpa2|wpa3} \\
|
||||
--security open {open|wep|wpa|wpa2|wpa3} \\
|
||||
--ssid netgear \\
|
||||
--passwd admin123 \\
|
||||
--dest 10.40.0.1 \\
|
||||
--test_duration 2m \\
|
||||
--interval 1s \\
|
||||
--passwd BLANK \\
|
||||
--debug
|
||||
''')
|
||||
|
||||
@@ -142,7 +139,6 @@ Generic command example:
|
||||
num_stations_converted = int(args.num_stations)
|
||||
num_sta = num_stations_converted
|
||||
|
||||
ws_event = LFCliBase("192.168.200.15", 8080)
|
||||
|
||||
station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000)
|
||||
ip_test = IPv4Test(lfjson_host, lfjson_port, ssid=args.ssid, password=args.passwd,
|
||||
@@ -152,19 +148,20 @@ Generic command example:
|
||||
ip_test.build()
|
||||
if not ip_test.passes():
|
||||
print(ip_test.get_fail_message())
|
||||
ws_event.add_event(name="test_ipv4_connection.py", message=ip_test.get_fail_message())
|
||||
ip_test.add_event(name="test_ipv4_connection.py", message=ip_test.get_fail_message())
|
||||
exit(1)
|
||||
ip_test.start(station_list, False, False)
|
||||
ip_test.stop()
|
||||
if not ip_test.passes():
|
||||
print(ip_test.get_fail_message())
|
||||
ws_event.add_event(name="test_ipv4_connection.py", message=ip_test.get_fail_message())
|
||||
ip_test.add_event(name="test_ipv4_connection.py", message=ip_test.get_fail_message())
|
||||
exit(1)
|
||||
time.sleep(30)
|
||||
ip_test.cleanup(station_list)
|
||||
if ip_test.passes():
|
||||
print("Full test passed, all stations associated and got IP")
|
||||
ws_event.add_event(name="test_ipv4_connection.py", message="Full test passed, all stations associated and got IP")
|
||||
ip_test.add_event(name="test_ipv4_connection.py", message="Full test passed, all stations associated and got IP")
|
||||
#exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -173,7 +173,7 @@ def main():
|
||||
--num_stations 3 \\
|
||||
--security {open|wep|wpa|wpa2|wpa3} \\
|
||||
--ssid netgear \\
|
||||
--url dl http://10.40.0.1 /dev/null \\
|
||||
--url "dl http://10.40.0.1 /dev/null" \\
|
||||
--password admin123 \\
|
||||
--test_duration 2m \\
|
||||
--debug
|
||||
|
||||
@@ -165,15 +165,13 @@ def main():
|
||||
test_ipv4_l4_ftp_upload.py
|
||||
--------------------
|
||||
Generic command example:
|
||||
python3 ./test_ipv4_l4_ftp_wifi.py --upstream_port eth1 \\
|
||||
./test_ipv4_l4_ftp_upload.py --upstream_port eth1 \\
|
||||
--radio wiphy0 \\
|
||||
--num_stations 3 \\
|
||||
--security {open|wep|wpa|wpa2|wpa3} \\
|
||||
--ssid netgear \\
|
||||
--passwd admin123 \\
|
||||
--dest 10.40.0.1 \\
|
||||
--test_duration 2m \\
|
||||
--interval 1s \\
|
||||
--url "ul ftp://10.40.0.1 /dev/null" \\
|
||||
--requests_per_ten 600 \\
|
||||
--debug
|
||||
|
||||
@@ -33,11 +33,11 @@ class IPV4L4(LFCliBase):
|
||||
self.security = security
|
||||
self.password = password
|
||||
self.url = url
|
||||
self.requests_per_ten = requests_per_ten
|
||||
self.requests_per_ten = int(requests_per_ten)
|
||||
self.number_template = number_template
|
||||
self.sta_list = station_list
|
||||
self.num_tests = num_tests
|
||||
self.target_requests_per_ten = target_requests_per_ten
|
||||
self.num_tests = int(num_tests)
|
||||
self.target_requests_per_ten = int(target_requests_per_ten)
|
||||
|
||||
self.local_realm = realm.Realm(lfclient_host=self.host, lfclient_port=self.port)
|
||||
self.station_profile = self.local_realm.new_station_profile()
|
||||
@@ -63,7 +63,7 @@ class IPV4L4(LFCliBase):
|
||||
if name in self.cx_profile.created_cx.keys():
|
||||
expected_passes += 1
|
||||
if info['urls/s'] * self.requests_per_ten >= self.target_requests_per_ten * .9:
|
||||
# print(name, info['urls/s'], info['urls/s'] * self.requests_per_ten, self.target_requests_per_ten * .9)
|
||||
print(name, info['urls/s'], info['urls/s'] * self.requests_per_ten, self.target_requests_per_ten * .9)
|
||||
passes += 1
|
||||
|
||||
return passes == expected_passes
|
||||
@@ -84,7 +84,7 @@ class IPV4L4(LFCliBase):
|
||||
temp_stas = self.sta_list.copy()
|
||||
# temp_stas.append(self.local_realm.name_to_eid(self.upstream_port)[2])
|
||||
cur_time = datetime.datetime.now()
|
||||
interval_time = cur_time + datetime.timedelta(minutes=10)
|
||||
interval_time = cur_time + datetime.timedelta(minutes=2)
|
||||
passes = 0
|
||||
expected_passes = 0
|
||||
self.station_profile.admin_up()
|
||||
@@ -99,6 +99,7 @@ class IPV4L4(LFCliBase):
|
||||
expected_passes += 1
|
||||
while cur_time < interval_time:
|
||||
time.sleep(1)
|
||||
print(".",end="")
|
||||
cur_time = datetime.datetime.now()
|
||||
|
||||
if self.cx_profile.check_errors(self.debug):
|
||||
@@ -110,7 +111,7 @@ class IPV4L4(LFCliBase):
|
||||
else:
|
||||
self._fail("FAIL: Errors found getting to %s " % self.url, print_fail)
|
||||
break
|
||||
interval_time = cur_time + datetime.timedelta(minutes=10)
|
||||
interval_time = cur_time + datetime.timedelta(minutes=2)
|
||||
if passes == expected_passes:
|
||||
self._pass("PASS: All tests passes", print_pass)
|
||||
|
||||
@@ -146,9 +147,6 @@ python3 ./test_ipv4_l4_urls_per_ten.py --upstream_port eth1 \\
|
||||
--security {open|wep|wpa|wpa2|wpa3} \\
|
||||
--ssid netgear \\
|
||||
--passwd admin123 \\
|
||||
--dest 10.40.0.1 \\
|
||||
--test_duration 2m \\
|
||||
--interval 1s \\
|
||||
--requests_per_ten 600 \\
|
||||
--num_tests 1 \\
|
||||
--url "dl http://10.40.0.1 /dev/null" \\
|
||||
@@ -173,7 +171,7 @@ python3 ./test_ipv4_l4_urls_per_ten.py --upstream_port eth1 \\
|
||||
station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000,
|
||||
radio=args.radio)
|
||||
|
||||
ip_test = IPV4L4(args.mgr, lfjson_port, ssid=args.ssid, password=args.passwd, upstream_port=args.upstream_port,
|
||||
ip_test = IPV4L4(args.mgr, lfjson_port, ssid=args.ssid, password=args.passwd, radio=args.radio, upstream_port=args.upstream_port,
|
||||
security=args.security, station_list=station_list, url=args.url, num_tests=args.num_tests,
|
||||
target_requests_per_ten=args.target_per_ten,
|
||||
requests_per_ten=args.requests_per_ten)
|
||||
|
||||
@@ -173,12 +173,10 @@ python3 ./test_ipv4_l4_wifi.py --upstream_port eth1 \\
|
||||
--security {open|wep|wpa|wpa2|wpa3} \\
|
||||
--ssid netgear \\
|
||||
--passwd admin123 \\
|
||||
--dest 10.40.0.1 \\
|
||||
--test_duration 2m \\
|
||||
--interval 1s \\
|
||||
--requests_per_ten 600 \\
|
||||
--direction {ul | dl} \\
|
||||
--dest /dev/null \\
|
||||
--dest /dev/null (or 10.40.0.1)\\
|
||||
--debug
|
||||
''')
|
||||
|
||||
@@ -197,7 +195,7 @@ python3 ./test_ipv4_l4_wifi.py --upstream_port eth1 \\
|
||||
station_list = LFUtils.portNameSeries(prefix_="sta", start_id_=0, end_id_=num_sta-1, padding_number_=10000,
|
||||
radio=args.radio)
|
||||
|
||||
ip_test = IPV4L4(args.mgr, lfjson_port, ssid=args.ssid, password=args.passwd,
|
||||
ip_test = IPV4L4(args.mgr, lfjson_port, ssid=args.ssid, password=args.passwd, radio=args.radio,
|
||||
security=args.security, station_list=station_list, direction=args.direction,dest=args.dest,
|
||||
test_duration=args.test_duration, upstream_port=args.upstream_port,
|
||||
requests_per_ten=args.requests_per_ten, _debug_on=args.debug)
|
||||
|
||||
@@ -66,8 +66,6 @@ class IPV4VariableTime(LFCliBase):
|
||||
|
||||
def __get_rx_values(self):
|
||||
cx_list = self.json_get("endp?fields=name,rx+bytes", debug_=self.debug)
|
||||
# print(self.cx_profile.created_cx.values())
|
||||
# print("==============\n", cx_list, "\n==============")
|
||||
cx_rx_map = {}
|
||||
for cx_name in cx_list['endpoint']:
|
||||
if cx_name != 'uri' and cx_name != 'handler':
|
||||
@@ -85,8 +83,6 @@ class IPV4VariableTime(LFCliBase):
|
||||
expected_passes += 1
|
||||
if new_list[item] > old_list[item]:
|
||||
passes += 1
|
||||
# print(item, new_list[item], old_list[item], passes, expected_passes)
|
||||
|
||||
if passes == expected_passes:
|
||||
return True
|
||||
else:
|
||||
@@ -142,10 +138,6 @@ class IPV4VariableTime(LFCliBase):
|
||||
time.sleep(1)
|
||||
|
||||
new_cx_rx_values = self.__get_rx_values()
|
||||
# print(old_cx_rx_values, new_cx_rx_values)
|
||||
# print("\n-----------------------------------")
|
||||
# print(cur_time, end_time, cur_time + datetime.timedelta(minutes=1))
|
||||
# print("-----------------------------------\n")
|
||||
expected_passes += 1
|
||||
if self.__compare_vals(old_cx_rx_values, new_cx_rx_values):
|
||||
passes += 1
|
||||
@@ -183,24 +175,22 @@ def main():
|
||||
prog='test_ipv4_variable_time.py',
|
||||
# formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
formatter_class=argparse.RawTextHelpFormatter,
|
||||
epilog='''\
|
||||
Useful Information:
|
||||
1. TBD
|
||||
''',
|
||||
|
||||
description='''\
|
||||
test_ipv4_variable_time.py:
|
||||
--------------------
|
||||
TBD
|
||||
---------------------
|
||||
|
||||
Generic command layout:
|
||||
python ./test_ipv4_variable_time.py --upstream_port <port> --radio <radio 0> <stations> <ssid> <ssid password> <security type: wpa2, open, wpa3> --debug
|
||||
|
||||
Note: multiple --radio switches may be entered up to the number of radios available:
|
||||
--radio <radio 0> <stations> <ssid> <ssid password> --radio <radio 01> <number of last station> <ssid> <ssid password>
|
||||
|
||||
python3 ./test_ipv4_variable_time.py --upstream_port eth1 --radio wiphy0 32 candelaTech-wpa2-x2048-4-1 candelaTech-wpa2-x2048-4-1 wpa2 --radio wiphy1 64 candelaTech-wpa2-x2048-5-3 candelaTech-wpa2-x2048-5-3 wpa2
|
||||
|
||||
./test_ipv4_variable_time.py
|
||||
--upstream_port eth1
|
||||
--radio wiphy3
|
||||
--num_stations 4
|
||||
-ssid jedway-wpa2-x2048-4-1
|
||||
-passwd jedway-wpa2-x2048-4-1
|
||||
--security {wpa2|open|wpa|wpa3}
|
||||
--a_min 250000
|
||||
--b_min 260000
|
||||
--test_duration 2m
|
||||
--debug
|
||||
''')
|
||||
|
||||
parser.add_argument('--a_min', help='--a_min bps rate minimum for side_a', default=256000)
|
||||
|
||||
@@ -288,7 +288,6 @@ test_ipv4_ttls.py:
|
||||
enable_pkc=args.enable_pkc,
|
||||
)
|
||||
ttls_test.cleanup(station_list)
|
||||
#ttls_test.timeout = 60
|
||||
ttls_test.build()
|
||||
if not ttls_test.passes():
|
||||
print(ttls_test.get_fail_message())
|
||||
|
||||
0
py-scripts/test_l3_scenario_throughput.py
Normal file → Executable file
0
py-scripts/test_l3_scenario_throughput.py
Normal file → Executable file
345
py-scripts/test_status_msg.py
Executable file
345
py-scripts/test_status_msg.py
Executable file
@@ -0,0 +1,345 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
if sys.version_info[0] != 3:
|
||||
print("This script requires Python 3")
|
||||
exit(1)
|
||||
|
||||
if 'py-json' not in sys.path:
|
||||
sys.path.append(os.path.join(os.path.abspath('..'), 'py-json'))
|
||||
|
||||
import argparse
|
||||
from LANforge.lfcli_base import LFCliBase
|
||||
import time
|
||||
from uuid import uuid1
|
||||
import pprint
|
||||
from pprint import pprint
|
||||
|
||||
class TestStatusMessage(LFCliBase):
|
||||
def __init__(self, host, port,
|
||||
_deep_clean=False,
|
||||
_debug_on=False,
|
||||
_exit_on_error=False,
|
||||
_exit_on_fail=False):
|
||||
super().__init__(host, port, _debug=_debug_on, _halt_on_error=_exit_on_error, _exit_on_fail=_exit_on_fail)
|
||||
self.deep_clean = _deep_clean
|
||||
self.check_connect()
|
||||
|
||||
def build(self):
|
||||
"""create a new session"""
|
||||
new_session = uuid1()
|
||||
self.status_msg_url = "/status-msg"
|
||||
self.session_url = "/status-msg/"+str(new_session)
|
||||
# print("----- ----- ----- ----- ----- PUT ----- ----- ----- ----- ----- ----- ")
|
||||
self.json_put(self.session_url, _data={})
|
||||
|
||||
# we should see list of sessions
|
||||
try:
|
||||
#print("----- ----- ----- ----- ----- GET ----- ----- ----- ----- ----- ----- ")
|
||||
session_response = self.json_get(self.status_msg_url)
|
||||
if self.debug:
|
||||
pprint(session_response)
|
||||
if "sessions" not in session_response:
|
||||
print("----- ----- ----- ----- ----- BAD ----- ----- ----- ----- ----- ----- ")
|
||||
self._fail("response lacks sessions element")
|
||||
if len(session_response["sessions"]) < 2:
|
||||
self._fail("why do we have less than two sessions?")
|
||||
for session in session_response["sessions"]:
|
||||
#print("----- ----- ----- ----- ----- SESSION ----- ----- ----- ----- ----- ----- ")
|
||||
pprint(session)
|
||||
self._pass("session created")
|
||||
except ValueError as ve:
|
||||
print("----- ----- ----- ----- ----- what??? ----- ----- ----- ----- ----- ----- ")
|
||||
self._fail(ve)
|
||||
return
|
||||
|
||||
def start(self, print_pass=False, print_fail=False):
|
||||
"""
|
||||
create a series of messages
|
||||
:return: None
|
||||
"""
|
||||
#print("----- ----- ----- ----- ----- START ----- %s ----- ----- ----- ----- ----- " % self.session_url)
|
||||
message_response = self.json_get(self.session_url)
|
||||
if self.debug:
|
||||
pprint(message_response)
|
||||
if "empty" in message_response:
|
||||
self._pass("empty response, zero messages")
|
||||
elif "messages" in message_response:
|
||||
messages_a = message_response["messages"]
|
||||
if len(messages_a) > 0:
|
||||
self._fail("we should have zero messages")
|
||||
|
||||
for msg_num in ( 1, 2, 3, 4, 5 ):
|
||||
#print("----- ----- ----- ----- ----- ----- %s ----- ----- ----- ----- ----- " % msg_num)
|
||||
#print("session url: "+self.session_url)
|
||||
self.msg_count = msg_num
|
||||
self.json_post(self.session_url, {
|
||||
"key": "test_status_message.py",
|
||||
"content-type":"application/json",
|
||||
"message":"message %s"%msg_num
|
||||
})
|
||||
message_response = self.json_get(self.session_url)
|
||||
if len(message_response["messages"]) != msg_num:
|
||||
pprint(message_response)
|
||||
self._fail("we should have %s messages"%msg_num)
|
||||
|
||||
self._pass("created and listed %s messages counted"%msg_num)
|
||||
|
||||
def stop(self):
|
||||
"""
|
||||
make sure we read those messages
|
||||
:return: None
|
||||
"""
|
||||
|
||||
message_list_response = self.json_get(self.session_url)
|
||||
if "empty" in message_list_response:
|
||||
self._fail("empty response, we expect 1 or more messages")
|
||||
msg_num = 0
|
||||
for message_o in message_list_response["messages"]:
|
||||
msg_url = message_o["_links"]
|
||||
print("Message url: "+msg_url)
|
||||
message_response = self.json_get(msg_url)
|
||||
if self.debug:
|
||||
pprint(message_response)
|
||||
for message_o in message_response["messages"]:
|
||||
msg_num += 1
|
||||
content_o = message_o
|
||||
print("id %s" % content_o["message_id"])
|
||||
print("key %s" % content_o["message"]["key"])
|
||||
print("content-type %s" % content_o["message"]["content-type"])
|
||||
print("message %s" % content_o["message"]["message"])
|
||||
|
||||
if msg_num != self.msg_count:
|
||||
self._fail("(stop) expected %s messages, saw %s" % (self.msg_count, msg_num))
|
||||
else:
|
||||
self._pass("saw correct number of messages")
|
||||
|
||||
def cleanup(self):
|
||||
"""delete messages and delete the session"""
|
||||
|
||||
message_list_response = self.json_get(self.session_url)
|
||||
if "empty" in message_list_response:
|
||||
self._fail("empty response, we expect 1 or more messages")
|
||||
last_link = ""
|
||||
msg_num = 0
|
||||
for message_o in message_list_response["messages"]:
|
||||
msg_url = message_o["_links"]
|
||||
# print("Delete Message url: "+msg_url)
|
||||
last_link = message_o["_links"]
|
||||
msg_num += 1
|
||||
|
||||
if msg_num != self.msg_count:
|
||||
self._fail("(cleanup) expected %s messages, saw %s" % (self.msg_count, msg_num))
|
||||
message_response = self.json_delete(last_link)
|
||||
if self.debug:
|
||||
pprint(message_response)
|
||||
|
||||
# check message removal
|
||||
message_list_response = self.json_get(self.session_url)
|
||||
msg_num = len(message_list_response["messages"])
|
||||
if msg_num != (self.msg_count - 1):
|
||||
self._fail("(cleanup) expected %s messages, saw %s" % ((self.msg_count - 1), msg_num))
|
||||
else:
|
||||
self._pass("(cleanup) messages decreased by one")
|
||||
|
||||
all_url = self.session_url + "/all"
|
||||
message_response = self.json_delete(all_url)
|
||||
if self.debug:
|
||||
pprint(message_response)
|
||||
|
||||
message_list_response = self.json_get(self.session_url)
|
||||
if self.debug:
|
||||
pprint(message_list_response)
|
||||
if "messages" in message_list_response:
|
||||
msg_num = len(message_list_response["messages"])
|
||||
elif "empty" in message_list_response:
|
||||
msg_num = 0
|
||||
|
||||
if (msg_num == 0):
|
||||
self._pass("deleted all messages in session")
|
||||
else:
|
||||
self._fail("failed to delete all messages in session")
|
||||
|
||||
# make sure we fail on removing session incorrectly
|
||||
try:
|
||||
if self.debug:
|
||||
print("--- del -------------------- -------------------- --------------------")
|
||||
self.exit_on_error=False
|
||||
self.halt_on_error=False
|
||||
message_response = self.json_delete(self.session_url, debug_=False)
|
||||
if self.debug:
|
||||
print("--- ~del -------------------- -------------------- --------------------")
|
||||
except ValueError as ve:
|
||||
print("- - - - - - - - - - - - - - - - - - - - - - -")
|
||||
print(ve)
|
||||
print("- - - - - - - - - - - - - - - - - - - - - - -")
|
||||
|
||||
sessions_list_response = self.json_get("/status-msg")
|
||||
if self.debug:
|
||||
pprint(sessions_list_response)
|
||||
session_list = sessions_list_response["sessions"]
|
||||
counter = 0
|
||||
for session_o in session_list:
|
||||
if self.debug:
|
||||
print("session %s link %s " % (self.session_url, session_o["_links"]))
|
||||
if session_o["_links"] == self.session_url:
|
||||
counter += 1
|
||||
self._pass("session not deleted")
|
||||
break
|
||||
if counter == 0:
|
||||
self._fail("session incorrectly deleted")
|
||||
|
||||
try:
|
||||
if self.debug:
|
||||
print("--- del -------------------- -------------------- --------------------")
|
||||
self.exit_on_error=False
|
||||
self.halt_on_error=False
|
||||
message_response = self.json_delete(self.session_url+"/this", debug_=False)
|
||||
if self.debug:
|
||||
print("--- ~del -------------------- -------------------- --------------------")
|
||||
except ValueError as ve:
|
||||
print(ve)
|
||||
|
||||
sessions_list_response = self.json_get("/status-msg")
|
||||
if self.debug:
|
||||
pprint(sessions_list_response)
|
||||
session_list = sessions_list_response["sessions"]
|
||||
counter = 0
|
||||
for session_o in session_list:
|
||||
if session_o["_links"] == self.session_url:
|
||||
counter += 1
|
||||
self._fail("session not deleted: "+session_o["_links"])
|
||||
break
|
||||
if counter == 0:
|
||||
self._pass("session correctly deleted")
|
||||
|
||||
# make sure we fail on removing session zero
|
||||
|
||||
if not self.deep_clean:
|
||||
return True
|
||||
|
||||
print("Deleting all sessions...")
|
||||
counter = 0
|
||||
for session_o in session_list:
|
||||
counter += 1
|
||||
self.json_delete(session_o["_links"]+"/all")
|
||||
print("cleaned %s sessions" % counter)
|
||||
counter = 0
|
||||
for session_o in session_list:
|
||||
if session_o["session-id"] == "0":
|
||||
continue
|
||||
counter += 1
|
||||
self.json_delete(session_o["_links"]+"/this")
|
||||
print("deleted %s sessions" % counter)
|
||||
|
||||
|
||||
def main():
|
||||
lfjson_port = 8080
|
||||
parser = LFCliBase.create_bare_argparse(
|
||||
prog=__file__,
|
||||
# formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
formatter_class=argparse.RawTextHelpFormatter,
|
||||
|
||||
description="""
|
||||
Test the status message passing functions of /status-msg:
|
||||
- create a session: PUT /status-msg/<new-session-id>
|
||||
- post message: POST /status-msg/<new-session-id>
|
||||
- list sessions: GET /status-msg/
|
||||
- list messages for session: GET /status-msg/<new-session-id>
|
||||
- delete message: DELETE /status-msg/<new-session-id>/message-id
|
||||
- delete session: DELETE /status-msg/<new-session-id>/this
|
||||
- delete all messages in session: DELETE /status-msg/<new-session-id>/all
|
||||
""")
|
||||
parser.add_argument('--action', default="run_test", help="""
|
||||
Actions can be:
|
||||
run_test : run a messaging test
|
||||
new : create new session
|
||||
update : add message to session, requires --session, --key, --message
|
||||
read : read message(s) from session, requires --session
|
||||
list : list messages from session
|
||||
delete : delete message, all messages using session/all or session using session/this
|
||||
""")
|
||||
parser.add_argument('--session', type=str, help='explicit session or session/message-id')
|
||||
parser.add_argument('--deep_clean', type=bool, help='remove all messages and all sessions')
|
||||
parser.add_argument('--key', type=str, help='how to key the message')
|
||||
parser.add_argument('--message', type=str, help='message to include')
|
||||
args = parser.parse_args()
|
||||
|
||||
status_messages = TestStatusMessage(args.mgr,
|
||||
lfjson_port,
|
||||
_debug_on=False,
|
||||
_exit_on_error=False,
|
||||
_exit_on_fail=False)
|
||||
if args.action == "new":
|
||||
if args.session is not None:
|
||||
status_messages.json_put("/status-msg/"+args.session, {})
|
||||
else:
|
||||
u = uuid1()
|
||||
status_messages.json_put("/status-msg/"+u, {})
|
||||
print("created session /status-msg/"+u)
|
||||
return
|
||||
|
||||
if args.action == "update":
|
||||
if args.session is None:
|
||||
print("requires --session")
|
||||
return
|
||||
if args.key is None:
|
||||
print("requires --key")
|
||||
return
|
||||
if args.message is None:
|
||||
print("requires --message")
|
||||
return
|
||||
status_messages.json_post("/status-msg/"+args.session, {
|
||||
"key": args.key,
|
||||
"content-type": "text/plain",
|
||||
"message": args.message
|
||||
})
|
||||
return
|
||||
|
||||
if args.action == "list":
|
||||
if args.session is None:
|
||||
response_o = status_messages.json_get("/status-msg/")
|
||||
pprint(response_o["sessions"])
|
||||
else:
|
||||
response_o = status_messages.json_get("/status-msg/"+args.session)
|
||||
pprint(response_o["messages"])
|
||||
return
|
||||
|
||||
if args.action == "read":
|
||||
if args.session is None:
|
||||
print("requires --session")
|
||||
return
|
||||
response_o = status_messages.json_get("/status-msg/"+args.session)
|
||||
pprint(response_o)
|
||||
return
|
||||
|
||||
if args.action == "delete":
|
||||
if args.session is None:
|
||||
print("requires --session")
|
||||
return
|
||||
response_o = status_messages.json_delete("/status-msg/"+args.session)
|
||||
pprint(response_o)
|
||||
return
|
||||
|
||||
|
||||
if args.action == "run_test":
|
||||
if args.deep_clean:
|
||||
status_messages.deep_clean = True
|
||||
status_messages.build()
|
||||
if not status_messages.passes():
|
||||
print(status_messages.get_fail_message())
|
||||
exit(1)
|
||||
status_messages.start(False, False)
|
||||
status_messages.stop()
|
||||
if not status_messages.passes():
|
||||
print(status_messages.get_fail_message())
|
||||
exit(1)
|
||||
status_messages.cleanup()
|
||||
if status_messages.passes():
|
||||
print("Full test passed, all messages read and cleaned up")
|
||||
exit(0)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
140
py-scripts/testgroup.py
Executable file
140
py-scripts/testgroup.py
Executable file
@@ -0,0 +1,140 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
if sys.version_info[0] != 3:
|
||||
print("This script requires Python 3")
|
||||
exit(1)
|
||||
|
||||
if 'py-json' not in sys.path:
|
||||
sys.path.append('../py-json')
|
||||
|
||||
from LANforge.lfcli_base import LFCliBase
|
||||
from LANforge.LFUtils import *
|
||||
from LANforge import LFUtils
|
||||
import argparse
|
||||
import realm
|
||||
|
||||
class TestGroup(LFCliBase):
|
||||
def __init__(self, host, port,
|
||||
group_name=None,
|
||||
add_cx_list=[],
|
||||
rm_cx_list=[],
|
||||
tg_action=None,
|
||||
cx_action=None,
|
||||
list_groups=None,
|
||||
show_group=None):
|
||||
|
||||
self.local_realm = realm.Realm(lfclient_host=host, lfclient_port=port)
|
||||
self.tg_profile = self.local_realm.new_test_group_profile()
|
||||
if group_name is None and list_groups is None and (tg_action is not None or cx_action is not None or
|
||||
add_cx_list is not None or rm_cx_list is not None or show_group is not None):
|
||||
raise ValueError("Group name must be set if manipulating test groups")
|
||||
else:
|
||||
self.tg_profile.group_name = group_name
|
||||
|
||||
self.tg_action = tg_action
|
||||
self.cx_action = cx_action
|
||||
self.list_groups = list_groups
|
||||
self.show_group = show_group
|
||||
self.add_cx_list = add_cx_list
|
||||
self.rm_cx_list = rm_cx_list
|
||||
|
||||
def do_cx_action(self):
|
||||
if self.cx_action == 'start':
|
||||
print("Starting %s" % self.tg_profile.group_name)
|
||||
self.tg_profile.start_group()
|
||||
elif self.cx_action == 'stop':
|
||||
print("Stopping %s" % self.tg_profile.group_name)
|
||||
self.tg_profile.stop_group()
|
||||
elif self.cx_action == 'quiesce':
|
||||
print("Quiescing %s" % self.tg_profile.group_name)
|
||||
self.tg_profile.quiesce_group()
|
||||
|
||||
def do_tg_action(self):
|
||||
if self.tg_action == 'add':
|
||||
print("Creating %s" % self.tg_profile.group_name)
|
||||
self.tg_profile.create_group()
|
||||
if self.tg_action == 'del':
|
||||
print("Removing %s" % self.tg_profile.group_name)
|
||||
if self.tg_profile.check_group_exists():
|
||||
self.tg_profile.remove_group()
|
||||
else:
|
||||
print("%s not found, no action taken" % self.tg_profile.group_name)
|
||||
|
||||
def show_info(self):
|
||||
if self.list_groups:
|
||||
print("Current Test Groups: ")
|
||||
for group in self.tg_profile.list_groups():
|
||||
print(group)
|
||||
if self.show_group:
|
||||
print("show_group not yet implemented")
|
||||
|
||||
def update_cxs(self):
|
||||
if len(self.add_cx_list) > 0:
|
||||
for cx in self.add_cx_list:
|
||||
self.tg_profile.add_cx(cx)
|
||||
self.tg_profile.cx_list.append(cx)
|
||||
if len(self.rm_cx_list) > 0:
|
||||
for cx in self.rm_cx_list:
|
||||
self.tg_profile.rm_cx(cx)
|
||||
if cx in self.tg_profile.cx_list:
|
||||
self.tg_profile.cx_list.remove(cx)
|
||||
|
||||
|
||||
def main():
|
||||
parser = LFCliBase.create_bare_argparse(
|
||||
prog='testgroup.py',
|
||||
formatter_class=argparse.RawTextHelpFormatter,
|
||||
epilog='''Control and query test groups\n''',
|
||||
description='''testgroup.py
|
||||
--------------------
|
||||
Generic command example:
|
||||
|
||||
''')
|
||||
|
||||
parser.add_argument('--group_name', help='specify the name of the test group to use', default=None)
|
||||
parser.add_argument('--list_groups', help='list all existing test groups', action='store_true', default=False)
|
||||
|
||||
tg_group = parser.add_mutually_exclusive_group()
|
||||
tg_group.add_argument('--add_group', help='add new test group', action='store_true', default=False)
|
||||
tg_group.add_argument('--del_group', help='delete test group', action='store_true', default=False)
|
||||
parser.add_argument('--show_group', help='show connections in current test group', action='store_true', default=False)
|
||||
|
||||
cx_group = parser.add_mutually_exclusive_group()
|
||||
cx_group.add_argument('--start_group', help='start all cxs in chosen test group', default=None)
|
||||
cx_group.add_argument('--stop_group', help='stop all cxs in chosen test group', default=None)
|
||||
cx_group.add_argument('--quiesce_group', help='quiesce all cxs in chosen test groups', default=None)
|
||||
|
||||
parser.add_argument('--add_cx', help='add cx to chosen test group', nargs='*', default=[])
|
||||
parser.add_argument('--remove_cx', help='remove cx from chosen test group', nargs='*', default=[])
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
tg_action = None
|
||||
cx_action = None
|
||||
|
||||
if args.add_group:
|
||||
tg_action = 'add'
|
||||
elif args.del_group:
|
||||
tg_action = 'del'
|
||||
|
||||
if args.start_group:
|
||||
cx_action = 'start'
|
||||
elif args.stop_group:
|
||||
cx_action = 'stop'
|
||||
elif args.quiesce_group:
|
||||
cx_action = 'quiesce'
|
||||
|
||||
tg = TestGroup(host=args.mgr, port=args.mgr_port,
|
||||
group_name=args.group_name,
|
||||
add_cx_list=args.add_cx, rm_cx_list=args.remove_cx, cx_action=cx_action,
|
||||
tg_action=tg_action, list_groups=args.list_groups, show_group=args.show_group)
|
||||
|
||||
tg.do_tg_action()
|
||||
tg.update_cxs()
|
||||
tg.do_cx_action()
|
||||
tg.show_info()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
File diff suppressed because it is too large
Load Diff
61
py-scripts/tip-cicd-sanity/README.md
Normal file
61
py-scripts/tip-cicd-sanity/README.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# TIP CICD Sanity Scripts
|
||||
This directory contains scripts and modules designed for wlan sanity testing.
|
||||
|
||||
## Nightly Sanity
|
||||
This script is used to look for and test new firmware available for the APs. AP equipment IDs and SSID information used in test is stored in the lab_ap_info file
|
||||
|
||||
1. Check current CloudSDK version
|
||||
2. Find latest dev firmware on TIP jfrog and create instances on CloudSDK (if necessary)
|
||||
3. Create report_data.json file with information about versions and test case pass/fail
|
||||
4. For each AP model:
|
||||
1. Check current AP firmware *(If AP already running newest firmware, test will skip)*
|
||||
2. Create Testrail test run with required test cases included
|
||||
3. Upgrade AP via CloudSDK API
|
||||
4. Check if AP upgrade and CloudSDK connection successful
|
||||
5. Test client connectivity on SSID modes, marking TestRail and report_data.json with pass/fail
|
||||
6. Update sanity_status.json with **overall** pass/fail
|
||||
|
||||
## Throughput Test
|
||||
This script is used to test UDP and TCP throughput on different modes of SSIDs, on multiple AP models. It is designed to run on APs that have successfully passed through Nightly_Sanity test.
|
||||
|
||||
For each AP model:
|
||||
1) Read sanity_status.json to see if throughput should be run, if yes:
|
||||
1) Run throughput tests on SSIDs modes
|
||||
2) Record results to CSV file
|
||||
2) Update sanity_status.json that throughput tests have been run
|
||||
|
||||
## Environment Variables
|
||||
Environment variables required to run scripts and modules in this directory
|
||||
#### Nightly_Sanity.py
|
||||
CLOUD_SDK_URL: CloudSDK URL for API calls
|
||||
SANITY_LOG_DIR: Logger file directory
|
||||
SANITY_REPORT_DIR: Report file directory
|
||||
REPORT_TEMPLATE: Report template path
|
||||
TR_USER: TestRail Username
|
||||
TR_PWD: TestRail Password
|
||||
MILESTONE: TestRail Milestone ID
|
||||
PROJECT_ID: TestRail Project ID
|
||||
EAP_IDENTITY: EAP identity for testing
|
||||
EAP_PWD: EAP password for testing
|
||||
AP_USER: Username for AP
|
||||
JFROG_USER: Jfrog username
|
||||
JFROG_PWD: Jfrog password
|
||||
|
||||
#### cloudsdk.py
|
||||
CLOUDSDK_USER: CloudSDK username
|
||||
CLOUDSDK_PWD: CloudSDK password
|
||||
|
||||
#### cluster_version.py
|
||||
AWS_USER: CloudSDK username
|
||||
AWS_PWD: CloudSDK password
|
||||
|
||||
#### testrail_api.py
|
||||
TR_USER tr_user TestRail Username
|
||||
TR_PWD tr_pw TestRail Password
|
||||
|
||||
#### Throughput_Test.py
|
||||
CLOUD_SDK_URL: CloudSDK URL for API calls
|
||||
CSV_PATH: Path for CSV file
|
||||
EAP_IDENTITY: EAP identity for testing
|
||||
EAP_PWD: EAP password for testing
|
||||
TPUT_LOG_DIR: Logger file directory
|
||||
@@ -16,6 +16,9 @@ cloudSDK_url=os.getenv('CLOUD_SDK_URL')
|
||||
station = ["tput5000"]
|
||||
runtime = 10
|
||||
csv_path=os.getenv('CSV_PATH')
|
||||
bridge_upstream_port = "eth2"
|
||||
nat_upstream_port = "eth2"
|
||||
vlan_upstream_port = "vlan100"
|
||||
|
||||
#EAP Credentials
|
||||
identity=os.getenv('EAP_IDENTITY')
|
||||
@@ -121,6 +124,9 @@ for key in equipment_id_dict:
|
||||
print('-----------------PROFILE PUSH -------------------')
|
||||
time.sleep(180)
|
||||
|
||||
##Set port for LANForge
|
||||
port = bridge_upstream_port
|
||||
|
||||
# 5G WPA2 Enterprise UDP DS/US and TCP DS/US
|
||||
ap_model = fw_model
|
||||
firmware = ap_fw
|
||||
@@ -131,7 +137,7 @@ for key in equipment_id_dict:
|
||||
eap_type = "TTLS"
|
||||
mode = "Bridge"
|
||||
mimo = mimo_5g[fw_model]
|
||||
client_tput = single_client_throughput.eap_tput(sta_list, ssid_name, radio, security, eap_type, identity, ttls_password)
|
||||
client_tput = single_client_throughput.eap_tput(sta_list, ssid_name, radio, security, eap_type, identity, ttls_password, port)
|
||||
print(fw_model, "5 GHz WPA2-EAP throughput:\n", client_tput)
|
||||
security = "wpa2-eap"
|
||||
throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
@@ -145,7 +151,7 @@ for key in equipment_id_dict:
|
||||
security = "wpa2"
|
||||
mode = "Bridge"
|
||||
mimo = mimo_5g[fw_model]
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime)
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, port)
|
||||
print(fw_model, "5 GHz WPA2 throughput:\n",client_tput)
|
||||
security = "wpa2-psk"
|
||||
throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
@@ -159,7 +165,7 @@ for key in equipment_id_dict:
|
||||
security = "wpa"
|
||||
mode = "Bridge"
|
||||
mimo = mimo_5g[fw_model]
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime)
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, port)
|
||||
print(fw_model, "5 GHz WPA throughput:\n",client_tput)
|
||||
security = "wpa-psk"
|
||||
throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
@@ -173,7 +179,7 @@ for key in equipment_id_dict:
|
||||
# security = "open"
|
||||
#mode = "Bridge"
|
||||
#mimo = mimo_5g[fw_model]
|
||||
# client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime)
|
||||
# client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, port)
|
||||
#print(fw_model, "5 GHz Open throughput:\n",client_tput)
|
||||
#throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
|
||||
@@ -182,13 +188,13 @@ for key in equipment_id_dict:
|
||||
firmware = ap_fw
|
||||
sta_list = station
|
||||
radio = "wiphy0"
|
||||
ssid_name = profile_info_dict[fw_model]["twofourG_WPA2-EAP_SSID"]
|
||||
ssid_name = profile_info_dict[fw_model]["twoFourG_WPA2-EAP_SSID"]
|
||||
security = "wpa2"
|
||||
eap_type = "TTLS"
|
||||
mode = "Bridge"
|
||||
mimo = mimo_2dot4g[fw_model]
|
||||
client_tput = single_client_throughput.eap_tput(sta_list, ssid_name, radio, security, eap_type, identity,
|
||||
ttls_password)
|
||||
ttls_password, port)
|
||||
print(fw_model, "2.4 GHz WPA2-EAP throughput:\n", client_tput)
|
||||
security = "wpa2-eap"
|
||||
throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
@@ -202,7 +208,7 @@ for key in equipment_id_dict:
|
||||
security = "wpa2"
|
||||
mode = "Bridge"
|
||||
mimo = mimo_2dot4g[fw_model]
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime)
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, port)
|
||||
print(fw_model, "2.4 GHz WPA2 throughput:\n",client_tput)
|
||||
security = "wpa2-psk"
|
||||
throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
@@ -216,7 +222,7 @@ for key in equipment_id_dict:
|
||||
security = "wpa"
|
||||
mode = "Bridge"
|
||||
mimo = mimo_2dot4g[fw_model]
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime)
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, port)
|
||||
print(fw_model, "2.4 GHz WPA throughput:\n",client_tput)
|
||||
security = "wpa-psk"
|
||||
throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
@@ -230,7 +236,7 @@ for key in equipment_id_dict:
|
||||
# security = "open"
|
||||
#mode = "Bridge"
|
||||
#mimo = mimo_2dot4g[fw_model]
|
||||
#client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, csv_file)
|
||||
#client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, port)
|
||||
#print(fw_model, "2.4 GHz Open throughput:\n",client_tput)
|
||||
#throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
|
||||
@@ -248,6 +254,9 @@ for key in equipment_id_dict:
|
||||
print('-----------------PROFILE PUSH -------------------')
|
||||
time.sleep(180)
|
||||
|
||||
##Set port for LANForge
|
||||
port = nat_upstream_port
|
||||
|
||||
# 5G WPA2 Enterprise UDP DS/US and TCP DS/US
|
||||
ap_model = fw_model
|
||||
firmware = ap_fw
|
||||
@@ -259,7 +268,7 @@ for key in equipment_id_dict:
|
||||
mode = "NAT"
|
||||
mimo = mimo_5g[fw_model]
|
||||
client_tput = single_client_throughput.eap_tput(sta_list, ssid_name, radio, security, eap_type, identity,
|
||||
ttls_password)
|
||||
ttls_password, port)
|
||||
print(fw_model, "5 GHz WPA2-EAP NAT throughput:\n", client_tput)
|
||||
security = "wpa2-eap"
|
||||
throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
@@ -273,10 +282,9 @@ for key in equipment_id_dict:
|
||||
security = "wpa2"
|
||||
mode = "NAT"
|
||||
mimo = mimo_5g[fw_model]
|
||||
security = "wpa2-psk"
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station,
|
||||
runtime)
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, port)
|
||||
print(fw_model, "5 GHz WPA2 NAT throughput:\n", client_tput)
|
||||
security = "wpa2-psk"
|
||||
throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
|
||||
# 5G WPA UDP DS/US and TCP DS/US
|
||||
@@ -288,8 +296,7 @@ for key in equipment_id_dict:
|
||||
security = "wpa"
|
||||
mode = "NAT"
|
||||
mimo = mimo_5g[fw_model]
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station,
|
||||
runtime)
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, port)
|
||||
print(fw_model, "5 GHz WPA NAT throughput:\n", client_tput)
|
||||
security = "wpa-psk"
|
||||
throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
@@ -303,7 +310,7 @@ for key in equipment_id_dict:
|
||||
# security = "open"
|
||||
# mode = "NAT"
|
||||
#mimo = mimo_5g[fw_model]
|
||||
# client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime)
|
||||
# client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, port)
|
||||
# print(fw_model, "5 GHz Open NAT throughput:\n",client_tput)
|
||||
# throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
|
||||
@@ -312,13 +319,12 @@ for key in equipment_id_dict:
|
||||
firmware = ap_fw
|
||||
sta_list = station
|
||||
radio = "wiphy0"
|
||||
ssid_name = profile_info_dict[fw_model+'_nat']["twofourG_WPA2-EAP_SSID"]
|
||||
ssid_name = profile_info_dict[fw_model+'_nat']["twoFourG_WPA2-EAP_SSID"]
|
||||
security = "wpa2"
|
||||
eap_type = "TTLS"
|
||||
mode = "NAT"
|
||||
mimo = mimo_2dot4g[fw_model]
|
||||
client_tput = single_client_throughput.eap_tput(sta_list, ssid_name, radio, security, eap_type, identity,
|
||||
ttls_password)
|
||||
client_tput = single_client_throughput.eap_tput(sta_list, ssid_name, radio, security, eap_type, identity, ttls_password, port)
|
||||
print(fw_model, "2.4 GHz WPA2-EAP NAT throughput:\n", client_tput)
|
||||
security = "wpa2-eap"
|
||||
throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
@@ -332,8 +338,7 @@ for key in equipment_id_dict:
|
||||
security = "wpa2"
|
||||
mode = "NAT"
|
||||
mimo = mimo_2dot4g[fw_model]
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station,
|
||||
runtime)
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, port)
|
||||
print(fw_model, "2.4 GHz WPA2 NAT throughput:\n", client_tput)
|
||||
security = "wpa2-psk"
|
||||
throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
@@ -347,8 +352,7 @@ for key in equipment_id_dict:
|
||||
security = "wpa"
|
||||
mode = "NAT"
|
||||
mimo = mimo_2dot4g[fw_model]
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station,
|
||||
runtime)
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, port)
|
||||
print(fw_model, "2.4 GHz WPA NAT throughput:\n", client_tput)
|
||||
security = "wpa-psk"
|
||||
throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
@@ -362,10 +366,140 @@ for key in equipment_id_dict:
|
||||
# security = "open"
|
||||
# mode = "NAT"
|
||||
#mimo = mimo_2dot4g[fw_model]
|
||||
# client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, csv_file)
|
||||
# client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, port)
|
||||
# print(fw_model, "2.4 GHz Open NAT throughput:\n",client_tput)
|
||||
# throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
|
||||
###########################################################################
|
||||
################# Custom VLAN Mode Throughput Testing #####################
|
||||
###########################################################################
|
||||
print('Testing for Custom VLAN SSIDs')
|
||||
logger.info("Starting Custom VLAN SSID tput tests on " + key)
|
||||
###Set Proper AP Profile for NAT SSID Tests
|
||||
test_profile_id = profile_info_dict[fw_model + '_vlan']["profile_id"]
|
||||
print(test_profile_id)
|
||||
ap_profile = CloudSDK.set_ap_profile(equipment_id, test_profile_id, cloudSDK_url, bearer)
|
||||
|
||||
### Wait for Profile Push
|
||||
print('-----------------PROFILE PUSH -------------------')
|
||||
time.sleep(180)
|
||||
|
||||
##Set port for LANForge
|
||||
port = vlan_upstream_port
|
||||
|
||||
# 5G WPA2 Enterprise UDP DS/US and TCP DS/US
|
||||
ap_model = fw_model
|
||||
firmware = ap_fw
|
||||
sta_list = station
|
||||
radio = "wiphy3"
|
||||
ssid_name = profile_info_dict[fw_model + '_vlan']["fiveG_WPA2-EAP_SSID"]
|
||||
security = "wpa2"
|
||||
eap_type = "TTLS"
|
||||
mode = "VLAN"
|
||||
mimo = mimo_5g[fw_model]
|
||||
client_tput = single_client_throughput.eap_tput(sta_list, ssid_name, radio, security, eap_type, identity, ttls_password, port)
|
||||
print(fw_model, "5 GHz WPA2-EAP VLAN throughput:\n", client_tput)
|
||||
security = "wpa2-eap"
|
||||
throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
|
||||
# 5G WPA2 VLAN UDP DS/US and TCP DS/US
|
||||
ap_model = fw_model
|
||||
firmware = ap_fw
|
||||
radio = "wiphy3"
|
||||
ssid_name = profile_info_dict[fw_model + '_vlan']["fiveG_WPA2_SSID"]
|
||||
ssid_psk = profile_info_dict[fw_model + '_vlan']["fiveG_WPA2_PSK"]
|
||||
security = "wpa2"
|
||||
mode = "VLAN"
|
||||
mimo = mimo_5g[fw_model]
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, port)
|
||||
print(fw_model, "5 GHz WPA2 VLAN throughput:\n", client_tput)
|
||||
security = "wpa2-psk"
|
||||
throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
|
||||
# 5G WPA UDP DS/US and TCP DS/US
|
||||
ap_model = fw_model
|
||||
firmware = ap_fw
|
||||
radio = "wiphy3"
|
||||
ssid_name = profile_info_dict[fw_model + '_vlan']["fiveG_WPA_SSID"]
|
||||
ssid_psk = profile_info_dict[fw_model + '_vlan']["fiveG_WPA_PSK"]
|
||||
security = "wpa"
|
||||
mode = "VLAN"
|
||||
mimo = mimo_5g[fw_model]
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, port)
|
||||
print(fw_model, "5 GHz WPA VLAN throughput:\n", client_tput)
|
||||
security = "wpa-psk"
|
||||
throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
|
||||
# 5G Open UDP DS/US and TCP DS/US
|
||||
# ap_model = fw_model
|
||||
# firmware = ap_fw
|
||||
# radio = "wiphy3"
|
||||
# ssid_name = profile_info_dict[fw_model+'_vlan']["fiveG_OPEN_SSID"]
|
||||
# ssid_psk = "BLANK"
|
||||
# security = "open"
|
||||
# mode = "VLAN"
|
||||
# mimo = mimo_5g[fw_model]
|
||||
# client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, port)
|
||||
# print(fw_model, "5 GHz Open VLAN throughput:\n",client_tput)
|
||||
# throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
|
||||
# 2.4G WPA2 Enterprise UDP DS/US and TCP DS/US
|
||||
ap_model = fw_model
|
||||
firmware = ap_fw
|
||||
sta_list = station
|
||||
radio = "wiphy0"
|
||||
ssid_name = profile_info_dict[fw_model + '_vlan']["twoFourG_WPA2-EAP_SSID"]
|
||||
security = "wpa2"
|
||||
eap_type = "TTLS"
|
||||
mode = "VLAN"
|
||||
mimo = mimo_2dot4g[fw_model]
|
||||
client_tput = single_client_throughput.eap_tput(sta_list, ssid_name, radio, security, eap_type, identity, ttls_password, port)
|
||||
print(fw_model, "2.4 GHz WPA2-EAP VLAN throughput:\n", client_tput)
|
||||
security = "wpa2-eap"
|
||||
throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
|
||||
# 2.4G WPA2 UDP DS/US and TCP DS/US
|
||||
ap_model = fw_model
|
||||
firmware = ap_fw
|
||||
radio = "wiphy0"
|
||||
ssid_name = profile_info_dict[fw_model + '_vlan']["twoFourG_WPA2_SSID"]
|
||||
ssid_psk = profile_info_dict[fw_model + '_vlan']["twoFourG_WPA2_PSK"]
|
||||
security = "wpa2"
|
||||
mode = "VLAN"
|
||||
mimo = mimo_2dot4g[fw_model]
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, port)
|
||||
print(fw_model, "2.4 GHz WPA2 VLAN throughput:\n", client_tput)
|
||||
security = "wpa2-psk"
|
||||
throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
|
||||
# 2.4G WPA UDP DS/US and TCP DS/US
|
||||
ap_model = fw_model
|
||||
firmware = ap_fw
|
||||
radio = "wiphy0"
|
||||
ssid_name = profile_info_dict[fw_model + '_vlan']["twoFourG_WPA_SSID"]
|
||||
ssid_psk = profile_info_dict[fw_model + '_vlan']["twoFourG_WPA_PSK"]
|
||||
security = "wpa"
|
||||
mode = "VLAN"
|
||||
mimo = mimo_2dot4g[fw_model]
|
||||
client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, port)
|
||||
print(fw_model, "2.4 GHz WPA VLAN throughput:\n", client_tput)
|
||||
security = "wpa-psk"
|
||||
throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
|
||||
# 2.4G Open VLAN UDP DS/US and TCP DS/US
|
||||
# ap_model = fw_model
|
||||
# firmware = ap_fw
|
||||
# radio = "wiphy3"
|
||||
# ssid_name = profile_info_dict[fw_model+'_vlan']["twoFourG_OPEN_SSID"]
|
||||
# ssid_psk = "BLANK"
|
||||
# security = "open"
|
||||
# mode = "VLAN"
|
||||
# mimo = mimo_2dot4g[fw_model]
|
||||
# client_tput = single_client_throughput.main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, port)
|
||||
# print(fw_model, "2.4 GHz Open VLAN throughput:\n",client_tput)
|
||||
# throughput_csv(csv_file, ssid_name, ap_model, mimo, firmware, security, mode, client_tput)
|
||||
|
||||
|
||||
#Indicates throughput has been run for AP model
|
||||
sanity_status['sanity_status'][key] = "tput run"
|
||||
logger.info("Trhoughput tests complete on " + key)
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
##################################################################################
|
||||
# Module contains functions to get specific data from AP CLI using SSH
|
||||
#
|
||||
# Used by Nightly_Sanity and Throughput_Test #####################################
|
||||
##################################################################################
|
||||
|
||||
import paramiko
|
||||
from paramiko import SSHClient
|
||||
import socket
|
||||
@@ -54,6 +60,52 @@ def iwinfo_status(ap_ip, username, password):
|
||||
for line in stdout.read().splitlines():
|
||||
print(line)
|
||||
|
||||
except paramiko.ssh_exception.AuthenticationException:
|
||||
print("Authentication Error, Check Credentials")
|
||||
return "ERROR"
|
||||
except paramiko.SSHException:
|
||||
print("Cannot SSH to the AP")
|
||||
return "ERROR"
|
||||
except socket.timeout:
|
||||
print("AP Unreachable")
|
||||
return "ERROR"
|
||||
|
||||
def get_vif_config(ap_ip, username, password):
|
||||
try:
|
||||
client = paramiko.SSHClient()
|
||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
client.connect(ap_ip, username=username, password=password, timeout=5)
|
||||
stdin, stdout, stderr = client.exec_command(
|
||||
"/usr/opensync/bin/ovsh s Wifi_VIF_Config -c | grep 'ssid :'")
|
||||
|
||||
output = str(stdout.read(), 'utf-8')
|
||||
ssid_output = output.splitlines()
|
||||
ssid_list = [s.strip('ssid : ') for s in ssid_output]
|
||||
return ssid_list
|
||||
|
||||
except paramiko.ssh_exception.AuthenticationException:
|
||||
print("Authentication Error, Check Credentials")
|
||||
return "ERROR"
|
||||
except paramiko.SSHException:
|
||||
print("Cannot SSH to the AP")
|
||||
return "ERROR"
|
||||
except socket.timeout:
|
||||
print("AP Unreachable")
|
||||
return "ERROR"
|
||||
|
||||
def get_vif_state(ap_ip, username, password):
|
||||
try:
|
||||
client = paramiko.SSHClient()
|
||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
client.connect(ap_ip, username=username, password=password, timeout=5)
|
||||
stdin, stdout, stderr = client.exec_command(
|
||||
"/usr/opensync/bin/ovsh s Wifi_VIF_Config -c | grep 'ssid :'")
|
||||
|
||||
output = str(stdout.read(), 'utf-8')
|
||||
ssid_output = output.splitlines()
|
||||
ssid_list = [s.strip('ssid : ') for s in ssid_output]
|
||||
return ssid_list
|
||||
|
||||
except paramiko.ssh_exception.AuthenticationException:
|
||||
print("Authentication Error, Check Credentials")
|
||||
return "ERROR"
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
##################################################################################
|
||||
# Module contains functions to interact with CloudSDK using APIs
|
||||
# Start by calling get_bearer to obtain bearer token, then other APIs can be used
|
||||
#
|
||||
# Used by Nightly_Sanity and Throughput_Test #####################################
|
||||
##################################################################################
|
||||
|
||||
import base64
|
||||
import urllib.request
|
||||
from bs4 import BeautifulSoup
|
||||
@@ -112,6 +119,15 @@ class CloudSDK:
|
||||
latest_fw_id = fw_data['id']
|
||||
return latest_fw_id
|
||||
|
||||
def delete_firmware(fw_id, cloudSDK_url, bearer):
|
||||
url = cloudSDK_url + '/portal/firmware/version?firmwareVersionId=' + fw_id
|
||||
payload = {}
|
||||
headers = {
|
||||
'Authorization': 'Bearer ' + bearer
|
||||
}
|
||||
response = requests.request("DELETE", url, headers=headers, data=payload)
|
||||
return(response)
|
||||
|
||||
def update_firmware(equipment_id, latest_firmware_id, cloudSDK_url, bearer):
|
||||
url = cloudSDK_url+"/portal/equipmentGateway/requestFirmwareUpdate?equipmentId="+equipment_id+"&firmwareVersionId="+latest_firmware_id
|
||||
|
||||
@@ -150,3 +166,16 @@ class CloudSDK:
|
||||
|
||||
response = requests.request("PUT", url, headers=headers, data=json.dumps(equipment_info))
|
||||
#print(response)
|
||||
|
||||
def get_cloudsdk_version(cloudSDK_url, bearer):
|
||||
#print(latest_ap_image)
|
||||
url = cloudSDK_url+"/ping"
|
||||
|
||||
payload = {}
|
||||
headers = {
|
||||
'Authorization': 'Bearer ' + bearer
|
||||
}
|
||||
response = requests.request("GET", url, headers=headers, data=payload)
|
||||
cloud_sdk_version = response.json()
|
||||
return cloud_sdk_version
|
||||
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
import time
|
||||
from threading import Thread
|
||||
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
user=os.getenv('AWS_USER')
|
||||
password=os.getenv('AWS_PWD')
|
||||
|
||||
def main():
|
||||
chrome_options = webdriver.ChromeOptions()
|
||||
chrome_options.add_argument("--headless")
|
||||
driver = webdriver.Chrome(executable_path='/home/netex/chromedriver', options=chrome_options)
|
||||
driver.get("https://telecominfraproject.awsapps.com/start#")
|
||||
time.sleep(10);
|
||||
elem = driver.find_element_by_xpath('//*[@id="awsui-input-0"]')
|
||||
elem.send_keys(user);
|
||||
elem.send_keys(Keys.ENTER)
|
||||
|
||||
time.sleep(5);
|
||||
elem2 = driver.find_element_by_xpath('//*[@id="awsui-input-1"]')
|
||||
elem2.send_keys(password)
|
||||
elem2.send_keys(Keys.ENTER)
|
||||
|
||||
time.sleep(10);
|
||||
driver.find_element_by_xpath("//*[@id=\"app-03e8643328913682\"]").click()
|
||||
time.sleep(2);
|
||||
driver.find_element_by_xpath("//*[@id=\"ins-9f89e35be3e67abf\"]/div/div/img").click()
|
||||
time.sleep(5);
|
||||
|
||||
driver.find_element_by_xpath("//*[@id=\"temp-credentials-button\"]").click()
|
||||
time.sleep(2);
|
||||
AWS_ACCESS_KEY_ID = driver.find_element_by_xpath("//*[@id=\"env-var-linux\"]/div[1]").text
|
||||
AWS_ACCESS_KEY_ID = AWS_ACCESS_KEY_ID[26:-1]
|
||||
AWS_SECRET_ACCESS_KEY = driver.find_element_by_xpath("//*[@id=\"env-var-linux\"]/div[2]").text
|
||||
AWS_SECRET_ACCESS_KEY = AWS_SECRET_ACCESS_KEY[30:-1]
|
||||
AWS_SESSION_TOKEN = driver.find_element_by_xpath("//*[@id=\"env-var-linux\"]/div[3]").text
|
||||
AWS_SESSION_TOKEN = AWS_SESSION_TOKEN[26:-1]
|
||||
driver.close()
|
||||
|
||||
#print (AWS_ACCESS_KEY_ID)
|
||||
#print(AWS_SECRET_ACCESS_KEY)
|
||||
#print(AWS_SESSION_TOKEN)
|
||||
# //*[@id="env-var-linux"]/div[2]/text()
|
||||
# //*[@id="env-var-linux"]/div[3]/text()
|
||||
|
||||
|
||||
#os.chdir('/Users/bealla/.kube')
|
||||
|
||||
os.environ['AWS_ACCESS_KEY_ID'] = AWS_ACCESS_KEY_ID
|
||||
os.environ['AWS_SECRET_ACCESS_KEY'] = AWS_SECRET_ACCESS_KEY
|
||||
os.environ['AWS_SESSION_TOKEN'] = AWS_SESSION_TOKEN
|
||||
|
||||
get_pods = subprocess.check_output("kubectl -n tip get pods | grep tip-wlan-opensync-gw-cloud", shell=True, universal_newlines=True)
|
||||
#print(get_pods)
|
||||
|
||||
opensync = str(get_pods.split()[0])
|
||||
#print(opensync)
|
||||
|
||||
version_info = subprocess.check_output("kubectl exec -it -n tip "+opensync+" -- cat commit.properties", shell=True, universal_newlines=True)
|
||||
return version_info
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
#########################################################################################################
|
||||
# Built to allow connection and test of clients using EAP-TTLS.
|
||||
# Functions can be called to create a station, create TCP and UDP traffic, run it a short amount of time.
|
||||
#
|
||||
# Used by Nightly_Sanity and Throughput_Test ############################################################
|
||||
#########################################################################################################
|
||||
|
||||
# This will create a station, create TCP and UDP traffic, run it a short amount of time,
|
||||
# and verify whether traffic was sent and received. It also verifies the station connected
|
||||
# to the requested BSSID if bssid is specified as an argument.
|
||||
|
||||
@@ -33,10 +33,10 @@ sanity_status = {
|
||||
|
||||
##Equipment IDs for Lab APs under test
|
||||
equipment_id_dict = {
|
||||
"ea8300": "13",
|
||||
"ecw5410": "12",
|
||||
"ecw5211": "6",
|
||||
"ec420": "11"
|
||||
"ea8300": "19",
|
||||
"ecw5410": "20",
|
||||
"ecw5211": "21",
|
||||
"ec420": "27"
|
||||
}
|
||||
|
||||
equipment_ip_dict = {
|
||||
@@ -65,9 +65,17 @@ profile_info_dict = {
|
||||
"twoFourG_OPEN_SSID": "ECW5410_2dot4G_OPEN",
|
||||
"twoFourG_WPA2_SSID": "ECW5410_2dot4G_WPA2",
|
||||
"twoFourG_WPA2_PSK": "Connectus123$",
|
||||
"twoFourG_WPA_SSID":"ECW5410_2dot4G_WPA",
|
||||
"twoFourG_WPA_SSID": "ECW5410_2dot4G_WPA",
|
||||
"twoFourG_WPA_PSK": "Connectus123$",
|
||||
"twoFourG_WPA2-EAP_SSID": "ECW5410_2dot4G_WPA2-EAP"
|
||||
"twoFourG_WPA2-EAP_SSID": "ECW5410_2dot4G_WPA2-EAP",
|
||||
"ssid_list": [
|
||||
"ECW5410_5G_WPA2",
|
||||
"ECW5410_5G_WPA",
|
||||
"ECW5410_5G_WPA2-EAP",
|
||||
"ECW5410_2dot4G_WPA2",
|
||||
"ECW5410_2dot4G_WPA",
|
||||
"ECW5410_2dot4G_WPA2-EAP"
|
||||
]
|
||||
},
|
||||
|
||||
"ea8300": {
|
||||
@@ -83,7 +91,19 @@ profile_info_dict = {
|
||||
"twoFourG_WPA2_PSK": "Connectus123$",
|
||||
"twoFourG_WPA_SSID":"EA8300_2dot4G_WPA",
|
||||
"twoFourG_WPA_PSK": "Connectus123$",
|
||||
"twoFourG_WPA2-EAP_SSID": "EA8300_2dot4G_WPA2-EAP"
|
||||
"twoFourG_WPA2-EAP_SSID": "EA8300_2dot4G_WPA2-EAP",
|
||||
#EA8300 has 2x 5GHz SSIDs because it is a tri-radio AP!
|
||||
"ssid_list": [
|
||||
"EA8300_5G_WPA2",
|
||||
"EA8300_5G_WPA2",
|
||||
"EA8300_5G_WPA",
|
||||
"EA8300_5G_WPA",
|
||||
"EA8300_5G_WPA2-EAP",
|
||||
"EA8300_5G_WPA2-EAP",
|
||||
"EA8300_2dot4G_WPA2",
|
||||
"EA8300_2dot4G_WPA",
|
||||
"EA8300_2dot4G_WPA2-EAP"
|
||||
]
|
||||
},
|
||||
|
||||
"ec420": {
|
||||
@@ -99,7 +119,15 @@ profile_info_dict = {
|
||||
"twoFourG_WPA2_PSK": "Connectus123$",
|
||||
"twoFourG_WPA_SSID":"EC420_2dot4G_WPA",
|
||||
"twoFourG_WPA_PSK": "Connectus123$",
|
||||
"twoFourG_WPA2-EAP_SSID": "EC420_2dot4G_WPA2-EAP"
|
||||
"twoFourG_WPA2-EAP_SSID": "EC420_2dot4G_WPA2-EAP",
|
||||
"ssid_list": [
|
||||
"EC420_5G_WPA2",
|
||||
"EC420_5G_WPA",
|
||||
"EC420_5G_WPA2-EAP",
|
||||
"EC420_2dot4G_WPA2",
|
||||
"EC420_2dot4G_WPA",
|
||||
"EC420_2dot4G_WPA2-EAP"
|
||||
]
|
||||
},
|
||||
|
||||
"ecw5211": {
|
||||
@@ -115,7 +143,15 @@ profile_info_dict = {
|
||||
"twoFourG_WPA2_PSK": "Connectus123$",
|
||||
"twoFourG_WPA_SSID":"ECW5211_2dot4G_WPA",
|
||||
"twoFourG_WPA_PSK": "Connectus123$",
|
||||
"twoFourG_WPA2-EAP_SSID": "ECW5211_2dot4G_WPA2-EAP"
|
||||
"twoFourG_WPA2-EAP_SSID": "ECW5211_2dot4G_WPA2-EAP",
|
||||
"ssid_list": [
|
||||
"ECW5211_5G_WPA2",
|
||||
"ECW5211_5G_WPA",
|
||||
"ECW5211_5G_WPA2-EAP",
|
||||
"ECW5211_2dot4G_WPA2",
|
||||
"ECW5211_2dot4G_WPA",
|
||||
"ECW5211_2dot4G_WPA2-EAP"
|
||||
]
|
||||
},
|
||||
|
||||
"ecw5410_nat": {
|
||||
@@ -131,7 +167,15 @@ profile_info_dict = {
|
||||
"twoFourG_WPA2_PSK": "Connectus123$",
|
||||
"twoFourG_WPA_SSID":"ECW5410_2dot4G_WPA_NAT",
|
||||
"twoFourG_WPA_PSK": "Connectus123$",
|
||||
"twoFourG_WPA2-EAP_SSID": "ECW5410_2dot4G_WPA2-EAP_NAT"
|
||||
"twoFourG_WPA2-EAP_SSID": "ECW5410_2dot4G_WPA2-EAP_NAT",
|
||||
"ssid_list": [
|
||||
"ECW5410_5G_WPA2_NAT",
|
||||
"ECW5410_5G_WPA_NAT",
|
||||
"ECW5410_5G_WPA2-EAP_NAT",
|
||||
"ECW5410_2dot4G_WPA2_NAT",
|
||||
"ECW5410_2dot4G_WPA_NAT",
|
||||
"ECW5410_2dot4G_WPA2-EAP_NAT"
|
||||
]
|
||||
},
|
||||
|
||||
"ea8300_nat": {
|
||||
@@ -147,7 +191,19 @@ profile_info_dict = {
|
||||
"twoFourG_WPA2_PSK": "Connectus123$",
|
||||
"twoFourG_WPA_SSID":"EA8300_2dot4G_WPA_NAT",
|
||||
"twoFourG_WPA_PSK": "Connectus123$",
|
||||
"twoFourG_WPA2-EAP_SSID": "EA8300_2dot4G_WPA2-EAP_NAT"
|
||||
"twoFourG_WPA2-EAP_SSID": "EA8300_2dot4G_WPA2-EAP_NAT",
|
||||
#EA8300 has 2x 5GHz SSIDs because it is a tri-radio AP!
|
||||
"ssid_list": [
|
||||
"EA8300_5G_WPA2_NAT",
|
||||
"EA8300_5G_WPA2_NAT",
|
||||
"EA8300_5G_WPA_NAT",
|
||||
"EA8300_5G_WPA_NAT",
|
||||
"EA8300_5G_WPA2-EAP_NAT",
|
||||
"EA8300_5G_WPA2-EAP_NAT",
|
||||
"EA8300_2dot4G_WPA2_NAT",
|
||||
"EA8300_2dot4G_WPA_NAT",
|
||||
"EA8300_2dot4G_WPA2-EAP_NAT"
|
||||
]
|
||||
},
|
||||
|
||||
"ec420_nat": {
|
||||
@@ -163,7 +219,15 @@ profile_info_dict = {
|
||||
"twoFourG_WPA2_PSK": "Connectus123$",
|
||||
"twoFourG_WPA_SSID":"EC420_2dot4G_WPA_NAT",
|
||||
"twoFourG_WPA_PSK": "Connectus123$",
|
||||
"twoFourG_WPA2-EAP_SSID": "EC420_2dot4G_WPA2-EAP_NAT"
|
||||
"twoFourG_WPA2-EAP_SSID": "EC420_2dot4G_WPA2-EAP_NAT",
|
||||
"ssid_list": [
|
||||
"EC420_5G_WPA2_NAT",
|
||||
"EC420_5G_WPA_NAT",
|
||||
"EC420_5G_WPA2-EAP_NAT",
|
||||
"EC420_2dot4G_WPA2_NAT",
|
||||
"EC420_2dot4G_WPA_NAT",
|
||||
"EC420_2dot4G_WPA2-EAP_NAT"
|
||||
]
|
||||
},
|
||||
|
||||
"ecw5211_nat": {
|
||||
@@ -179,7 +243,15 @@ profile_info_dict = {
|
||||
"twoFourG_WPA2_PSK": "Connectus123$",
|
||||
"twoFourG_WPA_SSID":"ECW5211_2dot4G_WPA_NAT",
|
||||
"twoFourG_WPA_PSK": "Connectus123$",
|
||||
"twoFourG_WPA2-EAP_SSID": "ECW5211_2dot4G_WPA2-EAP_NAT"
|
||||
"twoFourG_WPA2-EAP_SSID": "ECW5211_2dot4G_WPA2-EAP_NAT",
|
||||
"ssid_list": [
|
||||
"ECW5211_5G_WPA2_NAT",
|
||||
"ECW5211_5G_WPA_NAT",
|
||||
"ECW5211_5G_WPA2-EAP_NAT",
|
||||
"ECW5211_2dot4G_WPA2_NAT",
|
||||
"ECW5211_2dot4G_WPA_NAT",
|
||||
"ECW5211_2dot4G_WPA2-EAP_NAT"
|
||||
]
|
||||
},
|
||||
|
||||
"ecw5410_vlan": {
|
||||
@@ -195,7 +267,15 @@ profile_info_dict = {
|
||||
"twoFourG_WPA2_PSK": "Connectus123$",
|
||||
"twoFourG_WPA_SSID":"ECW5410_2dot4G_WPA_VLAN",
|
||||
"twoFourG_WPA_PSK": "Connectus123$",
|
||||
"twoFourG_WPA2-EAP_SSID": "ECW5410_2dot4G_WPA2-EAP_VLAN"
|
||||
"twoFourG_WPA2-EAP_SSID": "ECW5410_2dot4G_WPA2-EAP_VLAN",
|
||||
"ssid_list": [
|
||||
"ECW5410_5G_WPA2_VLAN",
|
||||
"ECW5410_5G_WPA_VLAN",
|
||||
"ECW5410_5G_WPA2-EAP_VLAN",
|
||||
"ECW5410_2dot4G_WPA2_VLAN",
|
||||
"ECW5410_2dot4G_WPA_VLAN",
|
||||
"ECW5410_2dot4G_WPA2-EAP_VLAN"
|
||||
]
|
||||
},
|
||||
|
||||
"ea8300_vlan": {
|
||||
@@ -211,7 +291,19 @@ profile_info_dict = {
|
||||
"twoFourG_WPA2_PSK": "Connectus123$",
|
||||
"twoFourG_WPA_SSID":"EA8300_2dot4G_WPA_VLAN",
|
||||
"twoFourG_WPA_PSK": "Connectus123$",
|
||||
"twoFourG_WPA2-EAP_SSID": "EA8300_2dot4G_WPA2-EAP_VLAN"
|
||||
"twoFourG_WPA2-EAP_SSID": "EA8300_2dot4G_WPA2-EAP_VLAN",
|
||||
#EA8300 has 2x 5GHz SSIDs because it is a tri-radio AP!
|
||||
"ssid_list": [
|
||||
"EA8300_5G_WPA2_VLAN",
|
||||
"EA8300_5G_WPA2_VLAN",
|
||||
"EA8300_5G_WPA_VLAN",
|
||||
"EA8300_5G_WPA_VLAN",
|
||||
"EA8300_5G_WPA2-EAP_VLAN",
|
||||
"EA8300_5G_WPA2-EAP_VLAN",
|
||||
"EA8300_2dot4G_WPA2_VLAN",
|
||||
"EA8300_2dot4G_WPA_VLAN",
|
||||
"EA8300_2dot4G_WPA2-EAP_VLAN"
|
||||
]
|
||||
},
|
||||
|
||||
"ec420_vlan": {
|
||||
@@ -227,7 +319,15 @@ profile_info_dict = {
|
||||
"twoFourG_WPA2_PSK": "Connectus123$",
|
||||
"twoFourG_WPA_SSID":"EC420_2dot4G_WPA_VLAN",
|
||||
"twoFourG_WPA_PSK": "Connectus123$",
|
||||
"twoFourG_WPA2-EAP_SSID": "EC420_2dot4G_WPA2-EAP_VLAN"
|
||||
"twoFourG_WPA2-EAP_SSID": "EC420_2dot4G_WPA2-EAP_VLAN",
|
||||
"ssid_list": [
|
||||
"EC420_5G_WPA2_VLAN",
|
||||
"EC420_5G_WPA_VLAN",
|
||||
"EC420_5G_WPA2-EAP_VLAN",
|
||||
"EC420_2dot4G_WPA2_VLAN",
|
||||
"EC420_2dot4G_WPA_VLAN",
|
||||
"EC420_2dot4G_WPA2-EAP_VLAN"
|
||||
]
|
||||
},
|
||||
|
||||
"ecw5211_vlan": {
|
||||
@@ -243,6 +343,14 @@ profile_info_dict = {
|
||||
"twoFourG_WPA2_PSK": "Connectus123$",
|
||||
"twoFourG_WPA_SSID":"ECW5211_2dot4G_WPA_VLAN",
|
||||
"twoFourG_WPA_PSK": "Connectus123$",
|
||||
"twoFourG_WPA2-EAP_SSID": "ECW5211_2dot4G_WPA2-EAP_VLAN"
|
||||
"twoFourG_WPA2-EAP_SSID": "ECW5211_2dot4G_WPA2-EAP_VLAN",
|
||||
"ssid_list": [
|
||||
"ECW5211_5G_WPA2_VLAN",
|
||||
"ECW5211_5G_WPA_VLAN",
|
||||
"ECW5211_5G_WPA2-EAP_VLAN",
|
||||
"ECW5211_2dot4G_WPA2_VLAN",
|
||||
"ECW5211_2dot4G_WPA_VLAN",
|
||||
"ECW5211_2dot4G_WPA2-EAP_VLAN"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
401
py-scripts/tip-cicd-sanity/reports/report_template.php
Executable file
401
py-scripts/tip-cicd-sanity/reports/report_template.php
Executable file
@@ -0,0 +1,401 @@
|
||||
<! DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Testing Report</title>
|
||||
<head>
|
||||
|
||||
<?php
|
||||
//error_reporting(E_ALL);
|
||||
//ini_set('display_errors', '1');
|
||||
$results = file_get_contents('report_data.json');
|
||||
$json = json_decode($results, true);
|
||||
?>
|
||||
|
||||
<body bgcolor="grey">
|
||||
|
||||
<style>
|
||||
.tab1 {
|
||||
tab-size: 8;
|
||||
}
|
||||
|
||||
.tab2 {
|
||||
tab-size: 14;
|
||||
}
|
||||
|
||||
.tab4 {
|
||||
margin-left: 188;
|
||||
}
|
||||
|
||||
div.sanity {
|
||||
background-color: lightgray;
|
||||
width: 975px;
|
||||
border-style: ridge;
|
||||
padding: 10px;
|
||||
left: 0;
|
||||
font-size: 15px;
|
||||
line-height: 25px
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<header>
|
||||
<h1 style="color:green; font-size:40px; text-align: center">CICD Nightly Sanity Report - <?php echo basename(dirname(__FILE__)) ?></h1>
|
||||
</header>
|
||||
|
||||
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="4" CELLSPACING="3" Style="background-color: lightgray; font-size:16px">
|
||||
<TR>
|
||||
<TH COLSPAN="7"><BR><H3>Test Results</H3>
|
||||
</TH>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH COLSPAN="2" ROWSPAN="7"></TH>
|
||||
<TH></TH>
|
||||
<TH WIDTH="150px">EA8300 Result</TH>
|
||||
<TH WIDTH="150px">ECW5211 Result</TH>
|
||||
<TH WIDTH="150px">ECW5410 Result</TH>
|
||||
<TH WIDTH="150px">EC420 Result</TH>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN="CENTER">
|
||||
<TD ALIGN="LEFT" style="font-weight:bold">New FW Available</TD>
|
||||
<TD style="font-weight:bold"><?php echo print_r($json['fw_available']['ea8300'],true) ?></TD>
|
||||
<TD style="font-weight:bold"><?php echo print_r($json['fw_available']['ecw5211'],true) ?></TD>
|
||||
<TD style="font-weight:bold"><?php echo print_r($json['fw_available']['ecw5410'],true) ?></TD>
|
||||
<TD style="font-weight:bold"><?php echo print_r($json['fw_available']['ec420'],true) ?></TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN="CENTER" style="font-weight:bold">
|
||||
<TD ALIGN="LEFT" >FW Under Test</TD>
|
||||
<TD style="font-size:12px"><?php echo print_r($json['fw_under_test']['ea8300'],true) ?></TD>
|
||||
<TD style="font-size:12px"><?php echo print_r($json['fw_under_test']['ecw5211'],true) ?></TD>
|
||||
<TD style="font-size:12px"><?php echo print_r($json['fw_under_test']['ecw5410'],true) ?></TD>
|
||||
<TD style="font-size:12px"><?php echo print_r($json['fw_under_test']['ec420'],true) ?></TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN="CENTER" style="font-weight:bold">
|
||||
<TD ALIGN="LEFT" >CloudSDK Commit Date</TD>
|
||||
<TD style="font-size:12px"><?php echo print_r($json['cloud_sdk']['ea8300']['date'],true) ?></TD>
|
||||
<TD style="font-size:12px"><?php echo print_r($json['cloud_sdk']['ecw5211']['date'],true) ?></TD>
|
||||
<TD style="font-size:12px"><?php echo print_r($json['cloud_sdk']['ecw5410']['date'],true) ?></TD>
|
||||
<TD style="font-size:12px"><?php echo print_r($json['cloud_sdk']['ec420']['date'],true) ?></TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN="CENTER" style="font-weight:bold">
|
||||
<TD ALIGN="LEFT" >CloudSDK Commit ID</TD>
|
||||
<TD style="font-size:10px"><?php echo print_r($json['cloud_sdk']['ea8300']['commitId'],true) ?></TD>
|
||||
<TD style="font-size:10px"><?php echo print_r($json['cloud_sdk']['ecw5211']['commitId'],true) ?></TD>
|
||||
<TD style="font-size:10px"><?php echo print_r($json['cloud_sdk']['ecw5410']['commitId'],true) ?></TD>
|
||||
<TD style="font-size:10px"><?php echo print_r($json['cloud_sdk']['ec420']['commitId'],true) ?></TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN="CENTER" style="font-weight:bold">
|
||||
<TD ALIGN="LEFT" >CloudSDK Project Version</TD>
|
||||
<TD style="font-size:12px"><?php echo print_r($json['cloud_sdk']['ea8300']['projectVersion'],true) ?></TD>
|
||||
<TD style="font-size:12px"><?php echo print_r($json['cloud_sdk']['ecw5211']['projectVersion'],true) ?></TD>
|
||||
<TD style="font-size:12px"><?php echo print_r($json['cloud_sdk']['ecw5410']['projectVersion'],true) ?></TD>
|
||||
<TD style="font-size:12px"><?php echo print_r($json['cloud_sdk']['ec420']['projectVersion'],true) ?></TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN="CENTER" style="font-weight:bold">
|
||||
<TD ALIGN="LEFT">Test Pass Rate</TD>
|
||||
<TD style="font-size:14px"><?php echo print_r($json['pass_percent']['ea8300'],true) ?></TD>
|
||||
<TD style="font-size:14px"><?php echo print_r($json['pass_percent']['ecw5211'],true) ?></TD>
|
||||
<TD style="font-size:14px"><?php echo print_r($json['pass_percent']['ecw5410'],true) ?></TD>
|
||||
<TD style="font-size:14px"><?php echo print_r($json['pass_percent']['ec420'],true) ?></TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN="CENTER">
|
||||
<TH>Test Case</TH>
|
||||
<TH WIDTH= 7%">Category</TH>
|
||||
<TH>Description</TH>
|
||||
<TH></TH>
|
||||
<TH></TH>
|
||||
<TH></TH>
|
||||
<TH></TH>
|
||||
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5540</TD>
|
||||
<TD>CloudSDK</TD>
|
||||
<TD ALIGN="LEFT">Get CloudSDK Version with API</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5540'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5540'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5540'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5540'],true) ?></TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5548</TD>
|
||||
<TD>CloudSDK</TD>
|
||||
<TD ALIGN="LEFT">Create FW version on CloudSDK using API</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5548'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5548'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5548'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5548'],true) ?></TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5547</TD>
|
||||
<TD>CloudSDK</TD>
|
||||
<TD ALIGN="LEFT">Request AP Upgrade using API</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5547'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5547'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5547'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5547'],true) ?></TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>2233</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">AP Upgrade Successful</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['2233'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['2233'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['2233'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['2233'],true) ?></TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5247</TD>
|
||||
<TD>CloudSDK</TD>
|
||||
<TD ALIGN="LEFT">CloudSDK Reports Correct FW</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5247'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5247'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5247'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5247'],true) ?></TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5222</TD>
|
||||
<TD>CloudSDK</TD>
|
||||
<TD ALIGN="LEFT">AP-CloudSDK Connection Active </TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5222'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5222'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5222'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5222'],true) ?></TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5541</TD>
|
||||
<TD>CloudSDK</TD>
|
||||
<TD ALIGN="LEFT">CloudSDK Pushes Correct AP Profile - Bridge Mode </TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5541'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5541'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5541'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5541'],true) ?></TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5544</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">AP Applies Correct AP Profile - Bridge Mode </TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5544'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5544'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5544'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5544'],true) ?></TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5214</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">Client connects to 2.4 GHz WPA2-EAP - Bridge Mode</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5214'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5214'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5214'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5214'],true) ?></TD>
|
||||
</TR>
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>2237</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">Client connects to 2.4 GHz WPA2 - Bridge Mode</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['2237'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['2237'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['2237'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['2237'],true) ?></TD>
|
||||
</TR>
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>2420</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">Client connects to 2.4 GHz WPA - Bridge Mode</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['2420'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['2420'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['2420'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['2420'],true) ?></TD>
|
||||
</TR>
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5215</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">Client connects to 5 GHz WPA2-EAP - Bridge Mode</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5215'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5215'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5215'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5215'],true) ?></TD>
|
||||
</TR>
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>2236</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">Client connects to 5 GHz WPA2 - Bridge Mode</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['2236'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['2236'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['2236'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['2236'],true) ?></TD>
|
||||
</TR>
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>2419</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">Client connects to 5 GHz WPA - Bridge Mode</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['2419'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['2419'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['2419'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['2419'],true) ?></TD>
|
||||
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5542</TD>
|
||||
<TD>CloudSDK</TD>
|
||||
<TD ALIGN="LEFT">CloudSDK Pushes Correct AP Profile - NAT Mode </TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5542'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5542'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5542'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5542'],true) ?></TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5545</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">AP Applies Correct AP Profile - NAT Mode </TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5545'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5545'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5545'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5545'],true) ?></TD>
|
||||
</TR>
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5216</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">Client connects to 2.4 GHz WPA2-EAP - NAT Mode</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5216'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5216'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5216'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5216'],true) ?></TD>
|
||||
</TR>
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>4325</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">Client connects to 2.4 GHz WPA2 - NAT Mode</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['4325'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['4325'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['4325'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['4325'],true) ?></TD>
|
||||
</TR>
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>4323</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">Client connects to 2.4 GHz WPA - NAT Mode</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['4323'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['4323'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['4323'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['4323'],true) ?></TD>
|
||||
</TR>
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5217</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">Client connects to 5 GHz WPA2-EAP - NAT Mode</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5217'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5217'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5217'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5217'],true) ?></TD>
|
||||
</TR>
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>4326</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">Client connects to 5 GHz WPA2 - NAT Mode</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['4326'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['4326'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['4326'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['4326'],true) ?></TD>
|
||||
</TR>
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>4324</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">Client connects to 5 GHz WPA - NAT Mode</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['4324'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['4324'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['4324'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['4324'],true) ?></TD>
|
||||
</TR>
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5543</TD>
|
||||
<TD>CloudSDK</TD>
|
||||
<TD ALIGN="LEFT">CloudSDK Pushes Correct AP Profile - Custom VLAN </TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5543'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5543'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5543'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5543'],true) ?></TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5546</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">AP Applies Correct AP Profile - Custom VLAN </TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5546'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5546'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5546'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5546'],true) ?></TD>
|
||||
</TR>
|
||||
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5253</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">Client connects to 2.4 GHz WPA2-EAP - Custom VLAN</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5253'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5253'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5253'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5253'],true) ?></TD>
|
||||
</TR>
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5251</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">Client connects to 2.4 GHz WPA2 - Custom VLAN</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5251'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5251'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5251'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5251'],true) ?></TD>
|
||||
</TR>
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5252</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">Client connects to 2.4 GHz WPA - Custom VLAN</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5252'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5252'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5252'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5252'],true) ?></TD>
|
||||
</TR>
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5250</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">Client connects to 5 GHz WPA2-EAP - Custom VLAN</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5250'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5250'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5250'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5250'],true) ?></TD>
|
||||
</TR>
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5248</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">Client connects to 5 GHz WPA2 - Custom VLAN</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5248'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5248'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5248'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5248'],true) ?></TD>
|
||||
</TR>
|
||||
<TR ALIGN="CENTER">
|
||||
<TD>5249</TD>
|
||||
<TD>AP</TD>
|
||||
<TD ALIGN="LEFT">Client connects to 5 GHz WPA - Custom VLAN</TD>
|
||||
<TD><?php echo print_r($json['tests']['ea8300']['5249'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5211']['5249'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ecw5410']['5249'],true) ?></TD>
|
||||
<TD><?php echo print_r($json['tests']['ec420']['5249'],true) ?></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
</body>
|
||||
@@ -1,5 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
####################################################################################
|
||||
# Script is based off of LANForge sta_connect2.py
|
||||
# Script built for max throughput testing on a single client
|
||||
# The main function of the script creates a station, then tests:
|
||||
# 1. UDP Downstream (AP to STA)
|
||||
# 2. UDP Upstream (STA to AP)
|
||||
# 3. TCP Downstream (AP to STA)
|
||||
# 4. TCP Upstream (STA to AP)
|
||||
# The script will clean up the station and connections at the end of the test.
|
||||
#
|
||||
# Used by Throughput_Test ###########################################################
|
||||
####################################################################################
|
||||
|
||||
# Script is based off of sta_connect2.py
|
||||
# Script built for max throughput testing on a single client
|
||||
# The main function of the script creates a station, then tests:
|
||||
@@ -489,7 +502,7 @@ class SingleClientEAP(LFCliBase):
|
||||
self.upstream_url = None # defer construction
|
||||
self.sta_url_map = None
|
||||
self.upstream_resource = None
|
||||
self.upstream_port = "eth2"
|
||||
self.upstream_port = None
|
||||
self.station_names = []
|
||||
if _sta_name is not None:
|
||||
self.station_names = [_sta_name]
|
||||
@@ -614,7 +627,7 @@ class SingleClientEAP(LFCliBase):
|
||||
|
||||
# station_info = self.jsonGet(self.mgr_url, "%s?fields=port,ip,ap" % (self.getStaUrl()))
|
||||
duration = 0
|
||||
maxTime = 100
|
||||
maxTime = 30
|
||||
ip = "0.0.0.0"
|
||||
ap = ""
|
||||
print("Waiting for %s stations to associate to AP: " % len(self.station_names), end="")
|
||||
@@ -863,12 +876,12 @@ class SingleClientEAP(LFCliBase):
|
||||
|
||||
##Main will perform 4 throughput tests on SSID provided by input and return a list with the values
|
||||
|
||||
def main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime):
|
||||
def main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runtime, upstream_port):
|
||||
######## Establish Client Connection #########################
|
||||
singleClient = SingleClient("10.10.10.201", 8080, debug_=False)
|
||||
singleClient.sta_mode = 0
|
||||
singleClient.upstream_resource = 1
|
||||
singleClient.upstream_port = "eth2"
|
||||
singleClient.upstream_port = upstream_port
|
||||
singleClient.radio = radio
|
||||
singleClient.resource = 1
|
||||
singleClient.dut_ssid = ssid_name
|
||||
@@ -957,10 +970,10 @@ def main(ap_model, firmware, radio, ssid_name, ssid_psk, security, station, runt
|
||||
|
||||
return(tput_data)
|
||||
|
||||
def eap_tput(sta_list, ssid_name, radio, security, eap_type, identity, ttls_password):
|
||||
eap_connect = SingleClientEAP("10.10.10.201", 8080, _debug_on=True)
|
||||
def eap_tput(sta_list, ssid_name, radio, security, eap_type, identity, ttls_password, upstream_port):
|
||||
eap_connect = SingleClientEAP("10.10.10.201", 8080, _debug_on=False)
|
||||
eap_connect.upstream_resource = 1
|
||||
eap_connect.upstream_port = "eth2"
|
||||
eap_connect.upstream_port = upstream_port
|
||||
eap_connect.security = security
|
||||
eap_connect.sta_list = sta_list
|
||||
eap_connect.station_names = sta_list
|
||||
|
||||
@@ -1,441 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Custom NetExperience version of sta_connect2.py - which changest he script to look for prefix "test" instead of "sta"
|
||||
|
||||
# This will create a station, create TCP and UDP traffic, run it a short amount of time,
|
||||
# and verify whether traffic was sent and received. It also verifies the station connected
|
||||
# to the requested BSSID if bssid is specified as an argument.
|
||||
# The script will clean up the station and connections at the end of the test.
|
||||
|
||||
import sys
|
||||
|
||||
if sys.version_info[0] != 3:
|
||||
print("This script requires Python 3")
|
||||
exit(1)
|
||||
|
||||
if 'py-json' not in sys.path:
|
||||
sys.path.append('../../py-json')
|
||||
|
||||
import argparse
|
||||
import LANforge
|
||||
from LANforge import LFUtils
|
||||
# from LANforge import LFCliBase
|
||||
from LANforge import lfcli_base
|
||||
from LANforge.lfcli_base import LFCliBase
|
||||
from LANforge.LFUtils import *
|
||||
import realm
|
||||
from realm import Realm
|
||||
import pprint
|
||||
|
||||
OPEN="open"
|
||||
WEP="wep"
|
||||
WPA="wpa"
|
||||
WPA2="wpa2"
|
||||
MODE_AUTO=0
|
||||
|
||||
class TestConnect2(LFCliBase):
|
||||
def __init__(self, host, port, _dut_ssid="jedway-open-1", _dut_passwd="NA", _dut_bssid="",
|
||||
_user="", _passwd="", _sta_mode="0", _radio="wiphy0",
|
||||
_resource=1, _upstream_resource=1, _upstream_port="eth1",
|
||||
_sta_name=None, debug_=False, _dut_security=OPEN, _exit_on_error=False,
|
||||
_cleanup_on_exit=True, _runtime_sec=60, _exit_on_fail=False):
|
||||
# do not use `super(LFCLiBase,self).__init__(self, host, port, _debugOn)
|
||||
# that is py2 era syntax and will force self into the host variable, making you
|
||||
# very confused.
|
||||
super().__init__(host, port, _debug=debug_, _halt_on_error=_exit_on_error, _exit_on_fail=_exit_on_fail)
|
||||
self.debug = debug_
|
||||
self.dut_security = _dut_security
|
||||
self.dut_ssid = _dut_ssid
|
||||
self.dut_passwd = _dut_passwd
|
||||
self.dut_bssid = _dut_bssid
|
||||
self.user = _user
|
||||
self.passwd = _passwd
|
||||
self.sta_mode = _sta_mode # See add_sta LANforge CLI users guide entry
|
||||
self.radio = _radio
|
||||
self.resource = _resource
|
||||
self.upstream_resource = _upstream_resource
|
||||
self.upstream_port = _upstream_port
|
||||
self.runtime_secs = _runtime_sec
|
||||
self.cleanup_on_exit = _cleanup_on_exit
|
||||
self.sta_url_map = None # defer construction
|
||||
self.upstream_url = None # defer construction
|
||||
self.station_names = []
|
||||
if _sta_name is not None:
|
||||
self.station_names = [ _sta_name ]
|
||||
# self.localrealm :Realm = Realm(lfclient_host=host, lfclient_port=port) # py > 3.6
|
||||
self.localrealm = Realm(lfclient_host=host, lfclient_port=port) # py > 3.6
|
||||
self.resulting_stations = {}
|
||||
self.resulting_endpoints = {}
|
||||
self.station_profile = None
|
||||
self.l3_udp_profile = None
|
||||
self.l3_tcp_profile = None
|
||||
|
||||
# def get_realm(self) -> Realm: # py > 3.6
|
||||
def get_realm(self):
|
||||
return self.localrealm
|
||||
|
||||
def get_station_url(self, sta_name_=None):
|
||||
if sta_name_ is None:
|
||||
raise ValueError("get_station_url wants a station name")
|
||||
if self.sta_url_map is None:
|
||||
self.sta_url_map = {}
|
||||
for sta_name in self.station_names:
|
||||
self.sta_url_map[sta_name] = "port/1/%s/%s" % (self.resource, sta_name)
|
||||
return self.sta_url_map[sta_name_]
|
||||
|
||||
def get_upstream_url(self):
|
||||
if self.upstream_url is None:
|
||||
self.upstream_url = "port/1/%s/%s" % (self.upstream_resource, self.upstream_port)
|
||||
return self.upstream_url
|
||||
|
||||
# Compare pre-test values to post-test values
|
||||
def compare_vals(self, name, postVal, print_pass=False, print_fail=True):
|
||||
# print(f"Comparing {name}")
|
||||
if postVal > 0:
|
||||
self._pass("%s %s" % (name, postVal), print_pass)
|
||||
else:
|
||||
self._fail("%s did not report traffic: %s" % (name, postVal), print_fail)
|
||||
|
||||
def remove_stations(self):
|
||||
for name in self.station_names:
|
||||
LFUtils.removePort(self.resource, name, self.lfclient_url)
|
||||
|
||||
def num_associated(self, bssid):
|
||||
counter = 0
|
||||
# print("there are %d results" % len(self.station_results))
|
||||
fields = "_links,port,alias,ip,ap,port+type"
|
||||
self.station_results = self.localrealm.find_ports_like("test*", fields, debug_=False)
|
||||
if (self.station_results is None) or (len(self.station_results) < 1):
|
||||
self.get_failed_result_list()
|
||||
for eid,record in self.station_results.items():
|
||||
#print("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ")
|
||||
#pprint(eid)
|
||||
#pprint(record)
|
||||
if record["ap"] == bssid:
|
||||
counter += 1
|
||||
#print("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ")
|
||||
return counter
|
||||
|
||||
def clear_test_results(self):
|
||||
self.resulting_stations = {}
|
||||
self.resulting_endpoints = {}
|
||||
super().clear_test_results()
|
||||
#super(StaConnect, self).clear_test_results().test_results.clear()
|
||||
|
||||
def setup(self):
|
||||
self.clear_test_results()
|
||||
self.check_connect()
|
||||
upstream_json = self.json_get("%s?fields=alias,phantom,down,port,ip" % self.get_upstream_url(), debug_=False)
|
||||
|
||||
if upstream_json is None:
|
||||
self._fail(message="Unable to query %s, bye" % self.upstream_port, print_=True)
|
||||
return False
|
||||
|
||||
if upstream_json['interface']['ip'] == "0.0.0.0":
|
||||
if self.debug:
|
||||
pprint.pprint(upstream_json)
|
||||
self._fail("Warning: %s lacks ip address" % self.get_upstream_url(), print_=True)
|
||||
return False
|
||||
|
||||
# remove old stations
|
||||
print("Removing old stations")
|
||||
for sta_name in self.station_names:
|
||||
sta_url = self.get_station_url(sta_name)
|
||||
response = self.json_get(sta_url)
|
||||
if (response is not None) and (response["interface"] is not None):
|
||||
for sta_name in self.station_names:
|
||||
LFUtils.removePort(self.resource, sta_name, self.lfclient_url)
|
||||
LFUtils.wait_until_ports_disappear(self.lfclient_url, self.station_names)
|
||||
|
||||
# Create stations and turn dhcp on
|
||||
self.station_profile = self.localrealm.new_station_profile()
|
||||
|
||||
if self.dut_security == WPA2:
|
||||
self.station_profile.use_security(security_type="wpa2", ssid=self.dut_ssid, passwd=self.dut_passwd)
|
||||
elif self.dut_security == OPEN:
|
||||
self.station_profile.use_security(security_type="open", ssid=self.dut_ssid, passwd="[BLANK]")
|
||||
elif self.dut_security == WPA:
|
||||
self.station_profile.use_security(security_type="wpa", ssid=self.dut_ssid, passwd=self.dut_passwd)
|
||||
elif self.dut_security == WEP:
|
||||
self.station_profile.use_security(security_type="wep", ssid=self.dut_ssid, passwd=self.dut_passwd)
|
||||
self.station_profile.set_command_flag("add_sta", "create_admin_down", 1)
|
||||
|
||||
print("Adding new stations ", end="")
|
||||
self.station_profile.create(radio=self.radio, sta_names_=self.station_names, up_=False, debug=self.debug, suppress_related_commands_=True)
|
||||
LFUtils.wait_until_ports_appear(self.lfclient_url, self.station_names, debug=self.debug)
|
||||
|
||||
# Create UDP endpoints
|
||||
self.l3_udp_profile = self.localrealm.new_l3_cx_profile()
|
||||
self.l3_udp_profile.side_a_min_bps = 128000
|
||||
self.l3_udp_profile.side_b_min_bps = 128000
|
||||
self.l3_udp_profile.side_a_min_pdu = 1200
|
||||
self.l3_udp_profile.side_b_min_pdu = 1500
|
||||
self.l3_udp_profile.report_timer = 1000
|
||||
self.l3_udp_profile.name_prefix = "udp"
|
||||
self.l3_udp_profile.create(endp_type="lf_udp",
|
||||
side_a=list(self.localrealm.find_ports_like("test+")),
|
||||
side_b="%d.%s" % (self.resource, self.upstream_port),
|
||||
suppress_related_commands=True)
|
||||
|
||||
# Create TCP endpoints
|
||||
self.l3_tcp_profile = self.localrealm.new_l3_cx_profile()
|
||||
self.l3_tcp_profile.side_a_min_bps = 128000
|
||||
self.l3_tcp_profile.side_b_min_bps = 56000
|
||||
self.l3_tcp_profile.name_prefix = "tcp"
|
||||
self.l3_tcp_profile.report_timer = 1000
|
||||
self.l3_tcp_profile.create(endp_type="lf_tcp",
|
||||
side_a=list(self.localrealm.find_ports_like("test+")),
|
||||
side_b="%d.%s" % (self.resource, self.upstream_port),
|
||||
suppress_related_commands=True)
|
||||
|
||||
def start(self):
|
||||
if self.station_profile is None:
|
||||
self._fail("Incorrect setup")
|
||||
pprint.pprint(self.station_profile)
|
||||
if self.station_profile.up is None:
|
||||
self._fail("Incorrect station profile, missing profile.up")
|
||||
if self.station_profile.up == False:
|
||||
print("\nBringing ports up...")
|
||||
data = {"shelf": 1,
|
||||
"resource": self.resource,
|
||||
"port": "ALL",
|
||||
"probe_flags": 1}
|
||||
self.json_post("/cli-json/nc_show_ports", data)
|
||||
self.station_profile.admin_up()
|
||||
LFUtils.waitUntilPortsAdminUp(self.resource, self.lfclient_url, self.station_names)
|
||||
|
||||
# station_info = self.jsonGet(self.mgr_url, "%s?fields=port,ip,ap" % (self.getStaUrl()))
|
||||
duration = 0
|
||||
maxTime = 90
|
||||
ip = "0.0.0.0"
|
||||
ap = ""
|
||||
print("Waiting for %s stations to associate to AP: " % len(self.station_names), end="")
|
||||
connected_stations = {}
|
||||
while (len(connected_stations.keys()) < len(self.station_names)) and (duration < maxTime):
|
||||
duration += 3
|
||||
time.sleep(3)
|
||||
print(".", end="")
|
||||
for sta_name in self.station_names:
|
||||
sta_url = self.get_station_url(sta_name)
|
||||
station_info = self.json_get(sta_url + "?fields=port,ip,ap")
|
||||
|
||||
# LFUtils.debug_printer.pprint(station_info)
|
||||
if (station_info is not None) and ("interface" in station_info):
|
||||
if "ip" in station_info["interface"]:
|
||||
ip = station_info["interface"]["ip"]
|
||||
if "ap" in station_info["interface"]:
|
||||
ap = station_info["interface"]["ap"]
|
||||
|
||||
if (ap == "Not-Associated") or (ap == ""):
|
||||
if self.debug:
|
||||
print(" -%s," % sta_name, end="")
|
||||
else:
|
||||
if ip == "0.0.0.0":
|
||||
if self.debug:
|
||||
print(" %s (0.0.0.0)" % sta_name, end="")
|
||||
else:
|
||||
connected_stations[sta_name] = sta_url
|
||||
data = {
|
||||
"shelf":1,
|
||||
"resource": self.resource,
|
||||
"port": "ALL",
|
||||
"probe_flags": 1
|
||||
}
|
||||
self.json_post("/cli-json/nc_show_ports", data)
|
||||
|
||||
for sta_name in self.station_names:
|
||||
sta_url = self.get_station_url(sta_name)
|
||||
station_info = self.json_get(sta_url) # + "?fields=port,ip,ap")
|
||||
if station_info is None:
|
||||
print("unable to query %s" % sta_url)
|
||||
self.resulting_stations[sta_url] = station_info
|
||||
ap = station_info["interface"]["ap"]
|
||||
ip = station_info["interface"]["ip"]
|
||||
if (ap != "") and (ap != "Not-Associated"):
|
||||
print(" %s +AP %s, " % (sta_name, ap), end="")
|
||||
if self.dut_bssid != "":
|
||||
if self.dut_bssid.lower() == ap.lower():
|
||||
self._pass(sta_name+" connected to BSSID: " + ap)
|
||||
# self.test_results.append("PASSED: )
|
||||
# print("PASSED: Connected to BSSID: "+ap)
|
||||
else:
|
||||
self._fail("%s connected to wrong BSSID, requested: %s Actual: %s" % (sta_name, self.dut_bssid, ap))
|
||||
else:
|
||||
self._fail(sta_name+" did not connect to AP")
|
||||
return False
|
||||
|
||||
if ip == "0.0.0.0":
|
||||
self._fail("%s did not get an ip. Ending test" % sta_name)
|
||||
else:
|
||||
self._pass("%s connected to AP: %s With IP: %s" % (sta_name, ap, ip))
|
||||
|
||||
if self.passes() == False:
|
||||
if self.cleanup_on_exit:
|
||||
print("Cleaning up...")
|
||||
self.remove_stations()
|
||||
return False
|
||||
|
||||
# start cx traffic
|
||||
print("\nStarting CX Traffic")
|
||||
self.l3_udp_profile.start_cx()
|
||||
self.l3_tcp_profile.start_cx()
|
||||
time.sleep(1)
|
||||
# Refresh stats
|
||||
self.l3_udp_profile.refresh_cx()
|
||||
self.l3_tcp_profile.refresh_cx()
|
||||
|
||||
def collect_endp_stats(self, endp_map):
|
||||
print("Collecting Data")
|
||||
fields="?fields=name,tx+bytes,rx+bytes"
|
||||
for (cx_name, endps) in endp_map.items():
|
||||
try:
|
||||
endp_url = "/endp/%s%s" % (endps[0], fields)
|
||||
endp_json = self.json_get(endp_url)
|
||||
self.resulting_endpoints[endp_url] = endp_json
|
||||
ptest_a_tx = endp_json['endpoint']['tx bytes']
|
||||
ptest_a_rx = endp_json['endpoint']['rx bytes']
|
||||
|
||||
#ptest = self.json_get("/endp/%s?fields=tx+bytes,rx+bytes" % cx_names[cx_name]["b"])
|
||||
endp_url = "/endp/%s%s" % (endps[1], fields)
|
||||
endp_json = self.json_get(endp_url)
|
||||
self.resulting_endpoints[endp_url] = endp_json
|
||||
|
||||
ptest_b_tx = endp_json['endpoint']['tx bytes']
|
||||
ptest_b_rx = endp_json['endpoint']['rx bytes']
|
||||
|
||||
self.compare_vals("testTCP-A TX", ptest_a_tx)
|
||||
self.compare_vals("testTCP-A RX", ptest_a_rx)
|
||||
|
||||
self.compare_vals("testTCP-B TX", ptest_b_tx)
|
||||
self.compare_vals("testTCP-B RX", ptest_b_rx)
|
||||
|
||||
except Exception as e:
|
||||
self.error(e)
|
||||
|
||||
|
||||
def stop(self):
|
||||
# stop cx traffic
|
||||
print("Stopping CX Traffic")
|
||||
self.l3_udp_profile.stop_cx()
|
||||
self.l3_tcp_profile.stop_cx()
|
||||
|
||||
# Refresh stats
|
||||
print("\nRefresh CX stats")
|
||||
self.l3_udp_profile.refresh_cx()
|
||||
self.l3_tcp_profile.refresh_cx()
|
||||
|
||||
print("Sleeping for 5 seconds")
|
||||
time.sleep(5)
|
||||
|
||||
# get data for endpoints JSON
|
||||
self.collect_endp_stats(self.l3_udp_profile.created_cx)
|
||||
self.collect_endp_stats(self.l3_tcp_profile.created_cx)
|
||||
# print("\n")
|
||||
|
||||
def cleanup(self):
|
||||
# remove all endpoints and cxs
|
||||
if self.cleanup_on_exit:
|
||||
for sta_name in self.station_names:
|
||||
LFUtils.removePort(self.resource, sta_name, self.lfclient_url)
|
||||
curr_endp_names = []
|
||||
removeCX(self.lfclient_url, self.l3_udp_profile.get_cx_names())
|
||||
removeCX(self.lfclient_url, self.l3_tcp_profile.get_cx_names())
|
||||
for (cx_name, endp_names) in self.l3_udp_profile.created_cx.items():
|
||||
curr_endp_names.append(endp_names[0])
|
||||
curr_endp_names.append(endp_names[1])
|
||||
for (cx_name, endp_names) in self.l3_tcp_profile.created_cx.items():
|
||||
curr_endp_names.append(endp_names[0])
|
||||
curr_endp_names.append(endp_names[1])
|
||||
removeEndps(self.lfclient_url, curr_endp_names, debug= self.debug)
|
||||
|
||||
# ~class
|
||||
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
|
||||
def main():
|
||||
lfjson_host = "localhost"
|
||||
lfjson_port = 8080
|
||||
parser = argparse.ArgumentParser(
|
||||
description="""LANforge Unit Test: Connect Station to AP
|
||||
Example:
|
||||
./sta_connect2.py --dest 192.168.100.209 --dut_ssid OpenWrt-2 --dut_bssid 24:F5:A2:08:21:6C
|
||||
""")
|
||||
parser.add_argument("-d", "--dest", type=str, help="address of the LANforge GUI machine (localhost is default)")
|
||||
parser.add_argument("-o", "--port", type=int, help="IP Port the LANforge GUI is listening on (8080 is default)")
|
||||
parser.add_argument("-u", "--user", type=str, help="TBD: credential login/username")
|
||||
parser.add_argument("-p", "--passwd", type=str, help="TBD: credential password")
|
||||
parser.add_argument("--resource", type=str, help="LANforge Station resource ID to use, default is 1")
|
||||
parser.add_argument("--upstream_resource", type=str, help="LANforge Ethernet port resource ID to use, default is 1")
|
||||
parser.add_argument("--upstream_port", type=str, help="LANforge Ethernet port name, default is eth2")
|
||||
parser.add_argument("--radio", type=str, help="LANforge radio to use, default is wiphy0")
|
||||
parser.add_argument("--sta_mode", type=str,
|
||||
help="LANforge station-mode setting (see add_sta LANforge CLI documentation, default is 0 (auto))")
|
||||
parser.add_argument("--dut_ssid", type=str, help="DUT SSID")
|
||||
parser.add_argument("--dut_security", type=str, help="DUT security: openLF, wpa, wpa2, wpa3")
|
||||
parser.add_argument("--dut_passwd", type=str, help="DUT PSK password. Do not set for OPEN auth")
|
||||
parser.add_argument("--dut_bssid", type=str, help="DUT BSSID to which we expect to connect.")
|
||||
parser.add_argument("--debug", type=str, help="enable debugging")
|
||||
|
||||
args = parser.parse_args()
|
||||
if args.dest is not None:
|
||||
lfjson_host = args.dest
|
||||
if args.port is not None:
|
||||
lfjson_port = args.port
|
||||
|
||||
on_flags = [ 1, "1", "on", "yes", "true" ]
|
||||
debug_v = False
|
||||
if args.debug is not None:
|
||||
if args.debug in on_flags:
|
||||
debug_v = True
|
||||
|
||||
staConnect = StaConnect2(lfjson_host, lfjson_port,
|
||||
debug_=True,
|
||||
_exit_on_fail=True,
|
||||
_exit_on_error=False)
|
||||
staConnect.station_names = [ "sta0000" ]
|
||||
if args.user is not None:
|
||||
staConnect.user = args.user
|
||||
if args.passwd is not None:
|
||||
staConnect.passwd = args.passwd
|
||||
if args.sta_mode is not None:
|
||||
staConnect.sta_mode = args.sta_mode
|
||||
if args.upstream_resource is not None:
|
||||
staConnect.upstream_resource = args.upstream_resource
|
||||
if args.upstream_port is not None:
|
||||
staConnect.upstream_port = args.upstream_port
|
||||
if args.radio is not None:
|
||||
staConnect.radio = args.radio
|
||||
if args.resource is not None:
|
||||
staConnect.resource = args.resource
|
||||
if args.dut_ssid is not None:
|
||||
staConnect.dut_ssid = args.dut_ssid
|
||||
if args.dut_passwd is not None:
|
||||
staConnect.dut_passwd = args.dut_passwd
|
||||
if args.dut_bssid is not None:
|
||||
staConnect.dut_bssid = args.dut_bssid
|
||||
if args.dut_security is not None:
|
||||
staConnect.dut_security = args.dut_security
|
||||
|
||||
# staConnect.cleanup()
|
||||
staConnect.setup()
|
||||
staConnect.start()
|
||||
print("napping %f sec" % staConnect.runtime_secs)
|
||||
time.sleep(staConnect.runtime_secs)
|
||||
staConnect.stop()
|
||||
run_results = staConnect.get_result_list()
|
||||
is_passing = staConnect.passes()
|
||||
if is_passing == False:
|
||||
print("FAIL: Some tests failed")
|
||||
else:
|
||||
print("PASS: All tests pass")
|
||||
print(staConnect.get_all_message())
|
||||
|
||||
staConnect.cleanup()
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
"""
|
||||
|
||||
####################################################################
|
||||
# Custom version of testrail_api module
|
||||
#
|
||||
# Used by Nightly_Sanity ###########################################
|
||||
####################################################################
|
||||
|
||||
import base64
|
||||
import json
|
||||
|
||||
@@ -166,42 +172,13 @@ class APIClient:
|
||||
|
||||
return update_flag
|
||||
|
||||
def create_testrun(self, name, case_ids, project_id, milestone_id):
|
||||
def create_testrun(self, name, case_ids, project_id, milestone_id, description):
|
||||
result = client.send_post(
|
||||
'add_run/%s' % (project_id),
|
||||
{'name': name, 'case_ids': case_ids, 'milestone_id': milestone_id, 'include_all': False})
|
||||
{'name': name, 'case_ids': case_ids, 'milestone_id': milestone_id, 'description': description, 'include_all': False})
|
||||
print("result in post", result)
|
||||
|
||||
client: APIClient = APIClient('https://telecominfraproject.testrail.com')
|
||||
client.user = 'syama.devi@connectus.ai'
|
||||
client.password = 'Connectus123$'
|
||||
|
||||
|
||||
###Old Demo Code
|
||||
#case = client.send_get('get_case/936')
|
||||
#print("---------TEST CASE 1---------")
|
||||
#pprint(case)
|
||||
#case = client.send_get('get_case/937')
|
||||
#print("---------TEST CASE 2---------")
|
||||
#pprint(case)
|
||||
#print ("----------TEST Project ID----------")
|
||||
#proj_id = client.get_project_id(project_name= "WLAN")
|
||||
#pprint(proj_id)
|
||||
|
||||
#REST API POSTMAN PROJECT
|
||||
#projId = client.get_project_id(project_name= "REST-API-POSTMAN")
|
||||
#pprint("REST API POSTMAN PROJECT ID IS :", projId)
|
||||
|
||||
#print("---------TEST RUN ID-----------")
|
||||
#rid = client.get_run_id(test_run_name='Master',project_name='WLAN')
|
||||
#rid=client.get_run_id(test_run_name= 'Master-Run3')
|
||||
#pprint(rid)
|
||||
|
||||
#result: bool= client.update_testrail(case_id = 1, run_id=rid, status_id = 5, msg ='Test Failed')
|
||||
|
||||
#result = client.send_get('get_attachment/:1', '/Users/syamadevi/Desktop/syama/python-test/TestRail/testreport.pdf')
|
||||
#print(result)
|
||||
#project_report= client.send_get("get_reports/:%s" %proj_id)
|
||||
#print(project_report)
|
||||
|
||||
class APIError(Exception):
|
||||
pass
|
||||
|
||||
0
py-scripts/wlan_capacity_calculator.py
Normal file → Executable file
0
py-scripts/wlan_capacity_calculator.py
Normal file → Executable file
0
py-scripts/ws_generic_monitor_test.py
Normal file → Executable file
0
py-scripts/ws_generic_monitor_test.py
Normal file → Executable file
Reference in New Issue
Block a user