mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-12-01 10:24:02 +00:00
Fixed merge conflicts
This commit is contained in:
@@ -15,7 +15,11 @@ class GetBuild:
|
||||
self.jfrog_url = 'https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/'
|
||||
self.build = build
|
||||
|
||||
def get_latest_image(self, model):
|
||||
def get_latest_image(self, model, for_build=None):
|
||||
|
||||
build_name = self.build
|
||||
if for_build:
|
||||
build_name = for_build
|
||||
|
||||
url = self.jfrog_url + model + "/dev/"
|
||||
|
||||
@@ -35,7 +39,7 @@ class GetBuild:
|
||||
soup = BeautifulSoup(html, features="html.parser")
|
||||
|
||||
# find the last pending link on dev
|
||||
last_link = soup.find_all('a', href=re.compile(self.build))[-1]
|
||||
last_link = soup.find_all('a', href=re.compile(build_name))[-1]
|
||||
latest_file = last_link['href']
|
||||
latest_fw = latest_file.replace('.tar.gz', '')
|
||||
return latest_fw
|
||||
|
||||
@@ -189,14 +189,15 @@ class CloudSDK:
|
||||
if "success" in upgrade_fw:
|
||||
if upgrade_fw["success"] == True:
|
||||
print("CloudSDK Upgrade Request Success")
|
||||
if report_data:
|
||||
if report_data and test_cases:
|
||||
report_data['tests'][key][test_cases["upgrade_api"]] = "passed"
|
||||
client.update_testrail(case_id=self.test_cases["upgrade_api"], run_id=rid, status_id=1, msg='Upgrade request using API successful')
|
||||
client.update_testrail(case_id=test_cases["upgrade_api"], run_id=rid, status_id=1, msg='Upgrade request using API successful')
|
||||
logger.info('Firmware upgrade API successfully sent')
|
||||
else:
|
||||
print("Cloud SDK Upgrade Request Error!")
|
||||
# mark upgrade test case as failed with CloudSDK error
|
||||
client.update_testrail(case_id=self.test_cases["upgrade_api"], run_id=rid, status_id=5, msg='Error requesting upgrade via API')
|
||||
if test_cases:
|
||||
client.update_testrail(case_id=test_cases["upgrade_api"], run_id=rid, status_id=5, msg='Error requesting upgrade via API')
|
||||
if report_data:
|
||||
report_data['tests'][key][test_cases["upgrade_api"]] = "failed"
|
||||
logger.warning('Firmware upgrade API failed to send')
|
||||
@@ -204,7 +205,8 @@ class CloudSDK:
|
||||
else:
|
||||
print("Cloud SDK Upgrade Request Error!")
|
||||
# mark upgrade test case as failed with CloudSDK error
|
||||
client.update_testrail(case_id=self.test_cases["upgrade_api"], run_id=rid, status_id=5,msg='Error requesting upgrade via API')
|
||||
if test_cases:
|
||||
client.update_testrail(case_id=test_cases["upgrade_api"], run_id=rid, status_id=5,msg='Error requesting upgrade via API')
|
||||
if report_data:
|
||||
report_data['tests'][key][test_cases["upgrade_api"]] = "failed"
|
||||
logger.warning('Firmware upgrade API failed to send')
|
||||
@@ -214,6 +216,7 @@ class CloudSDK:
|
||||
for i in range(10):
|
||||
time.sleep(30)
|
||||
# Check if upgrade success is displayed on CloudSDK
|
||||
if test_cases:
|
||||
test_id_cloud = test_cases["cloud_fw"]
|
||||
cloud_ap_fw = self.ap_firmware(customer_id, equipment_id, cloudSDK_url, bearer)
|
||||
print('Current AP Firmware from CloudSDK: %s requested-image: %s'%(cloud_ap_fw, ap_image))
|
||||
@@ -233,6 +236,7 @@ class CloudSDK:
|
||||
if sdk_ok:
|
||||
for i in range(10):
|
||||
# Check if upgrade successful on AP CLI
|
||||
if test_cases:
|
||||
test_id_cli = test_cases["ap_upgrade"]
|
||||
try:
|
||||
ap_cli_info = ssh_cli_active_fw(command_line_args)
|
||||
@@ -251,6 +255,7 @@ class CloudSDK:
|
||||
logging.error(logging.traceback.format_exc())
|
||||
print("Cannot Reach AP CLI to confirm upgrade!")
|
||||
logger.warning('Cannot Reach AP CLI to confirm upgrade!')
|
||||
if test_cases:
|
||||
client.update_testrail(case_id=test_id_cli, run_id=rid, status_id=4,
|
||||
msg='Cannot reach AP after upgrade to check CLI - re-test required')
|
||||
continue
|
||||
@@ -265,6 +270,7 @@ class CloudSDK:
|
||||
# Check status
|
||||
if cloud_ap_fw == ap_image and ap_cli_fw == ap_image:
|
||||
print("CloudSDK and AP CLI both show upgrade success, passing upgrade test case")
|
||||
if test_cases:
|
||||
client.update_testrail(case_id=test_id_cli, run_id=rid, status_id=1,
|
||||
msg='Upgrade to ' + ap_image + ' successful')
|
||||
client.update_testrail(case_id=test_id_cloud, run_id=rid, status_id=1,
|
||||
@@ -278,6 +284,7 @@ class CloudSDK:
|
||||
elif cloud_ap_fw != ap_image and ap_cli_fw == ap_image:
|
||||
print("AP CLI shows upgrade success - CloudSDK reporting error!")
|
||||
##Raise CloudSDK error but continue testing
|
||||
if test_cases:
|
||||
client.update_testrail(case_id=test_id_cli, run_id=rid, status_id=1,
|
||||
msg='Upgrade to ' + ap_image + ' successful.')
|
||||
client.update_testrail(case_id=test_id_cloud, run_id=rid, status_id=5,
|
||||
@@ -291,6 +298,7 @@ class CloudSDK:
|
||||
elif cloud_ap_fw == ap_image and ap_cli_fw != ap_image:
|
||||
print("AP CLI shows upgrade failed - CloudSDK reporting error!")
|
||||
# Testrail TC fail
|
||||
if test_cases:
|
||||
client.update_testrail(case_id=test_id_cli, run_id=rid, status_id=5,
|
||||
msg='AP failed to download or apply new FW. Upgrade to ' + ap_image + ' Failed')
|
||||
client.update_testrail(case_id=test_id_cloud, run_id=rid, status_id=5,
|
||||
@@ -304,6 +312,7 @@ class CloudSDK:
|
||||
elif cloud_ap_fw != ap_image and ap_cli_fw != ap_image:
|
||||
print("Upgrade Failed! Confirmed on CloudSDK and AP CLI. Upgrade test case failed.")
|
||||
##fail TR testcase and exit
|
||||
if test_cases:
|
||||
client.update_testrail(case_id=test_id_cli, run_id=rid, status_id=5,
|
||||
msg='AP failed to download or apply new FW. Upgrade to ' + ap_image + ' Failed')
|
||||
if report_data:
|
||||
@@ -314,6 +323,7 @@ class CloudSDK:
|
||||
else:
|
||||
print("Unable to determine upgrade status. Skipping AP variant")
|
||||
# update TR testcase as error
|
||||
if test_cases:
|
||||
client.update_testrail(case_id=test_id_cli, run_id=rid, status_id=4,
|
||||
msg='Cannot determine upgrade status - re-test required')
|
||||
if report_data:
|
||||
@@ -436,6 +446,10 @@ class CloudSDK:
|
||||
url_base = cloudSDK_url + "/portal/profile/forCustomer" + "?customerId=" + customer_id
|
||||
return self.get_paged_url(bearer, url_base)
|
||||
|
||||
def ping(self, cloudSDK_url, bearer):
|
||||
url_base = cloudSDK_url + "/ping"
|
||||
return [self.get_url(bearer, url_base)]
|
||||
|
||||
# This is querys all and filters locally. Maybe there is better way to get cloud to
|
||||
# do the filtering?
|
||||
def get_customer_profile_by_name(self, cloudSDK_url, bearer, customer_id, name):
|
||||
|
||||
@@ -239,12 +239,13 @@ class UnitTestBase:
|
||||
|
||||
self.build = self.command_line_args.build_id
|
||||
|
||||
self.logger = logging.getLogger(log_name)
|
||||
if reporting is not None:
|
||||
self.hdlr = logging.FileHandler(reporting.report_path + "/test_run.log")
|
||||
else:
|
||||
self.hdlr = logging.FileHandler("logs/test_run.log")
|
||||
|
||||
self.logger = logging.getLogger(log_name)
|
||||
|
||||
if not reporting:
|
||||
self.hdlr = logging.FileHandler("./logs/test_run.log")
|
||||
else:
|
||||
self.hdlr = logging.FileHandler(reporting.report_path + "/test_run.log")
|
||||
self.formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
|
||||
self.hdlr.setFormatter(self.formatter)
|
||||
self.logger.addHandler(self.hdlr)
|
||||
|
||||
@@ -64,3 +64,17 @@ Testbed 11 (Advanced setup, 2D turntable chamber plus medium chamber, RF attenua
|
||||
--default-ap-profile TipWlan-2-Radios --sdk-base-url https://wlan-portal-svc.cicd.lab.wlan.tip.build \
|
||||
--skip-radius --skip-wpa --verbose --testbed "NOLA-11" --ssid-5g-wpa2 Default-SSID-5gl --psk-5g-wpa2 12345678 \
|
||||
--ssid-2g-wpa2 Default-SSID-2g --psk-2g-wpa2 12345678
|
||||
|
||||
|
||||
Testbed 12 (Basic, wf188n)
|
||||
|
||||
# Upgrade firmware to latest
|
||||
./sdk_upgrade_fw.py --testrail-user-id NONE --model wf188n --ap-jumphost-address localhost --ap-jumphost-port 8823 \
|
||||
--ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP1 --testbed \"NOLA-12\" \
|
||||
--sdk-base-url https://wlan-portal-svc-ben-testbed.cicd.lab.wlan.tip.build --force-upgrade true
|
||||
|
||||
./sdk_set_profile.py --testrail-user-id NONE --model wf188n --ap-jumphost-address localhost --ap-jumphost-port 8823 \
|
||||
--ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP1 --lanforge-ip-address localhost --lanforge-port-number 8822 \
|
||||
--default-ap-profile TipWlan-2-Radios --sdk-base-url https://wlan-portal-svc-ben-testbed.cicd.lab.wlan.tip.build \
|
||||
--skip-radius --skip-wpa --verbose --testbed "NOLA-12" --ssid-5g-wpa2 Default-SSID-5gl --psk-5g-wpa2 12345678 \
|
||||
--ssid-2g-wpa2 Default-SSID-2g --psk-2g-wpa2 12345678
|
||||
|
||||
@@ -12,7 +12,12 @@ APTTY=/dev/ttyAP1
|
||||
MODEL=ecw5410
|
||||
|
||||
# cloud sdk profile dump
|
||||
./query_sdk.py --testrail-user-id NONE --model $MODEL --sdk-base-url https://$PORTAL --sdk-user-id support@example.com --sdk-user-password support --type profile --cmd get > /tmp/nola-$NOLANUM-profiles.txt
|
||||
./query_sdk.py --testrail-user-id NONE --model $MODEL --sdk-base-url https://$PORTAL --sdk-user-id support@example.com \
|
||||
--sdk-user-password support --type profile --cmd get > /tmp/nola-$NOLANUM-profiles.txt
|
||||
|
||||
# cloud version info
|
||||
./query_sdk.py --testrail-user-id NONE --model $MODEL --sdk-base-url https://$PORTAL --sdk-user-id support@example.com \
|
||||
--sdk-user-password support --type ping > /tmp/nola-$NOLANUM-sdk-ping.txt
|
||||
|
||||
# ovsdb-client dump
|
||||
./query_ap.py --ap-jumphost-address localhost --ap-jumphost-port $APPORT --ap-jumphost-password pumpkin77 --ap-jumphost-tty $APTTY -m $MODEL --cmd "ovsdb-client dump" > /tmp/nola-$NOLANUM-ap.txt
|
||||
@@ -20,6 +25,7 @@ MODEL=ecw5410
|
||||
# interface info
|
||||
./query_ap.py --ap-jumphost-address localhost --ap-jumphost-port $APPORT --ap-jumphost-password pumpkin77 --ap-jumphost-tty $APTTY -m $MODEL --cmd "iwinfo && brctl show" > /tmp/nola-$NOLANUM-ap-if.txt
|
||||
|
||||
|
||||
# TODO: Add more things here as we learn what better provides debug info to cloud.
|
||||
|
||||
echo "Grab: /tmp/nola-$NOLANUM-profiles.txt /tmp/nola-$NOLANUM-ap.txt /tmp/nola-$NOLANUM-ap-if.txt"
|
||||
echo "Grab: /tmp/nola-$NOLANUM-profiles.txt /tmp/nola-$NOLANUM-ap.txt /tmp/nola-$NOLANUM-ap-if.txt /tmp/nola-$NOLANUM-sdk-ping.txt"
|
||||
|
||||
@@ -5,15 +5,27 @@
|
||||
|
||||
set -x
|
||||
|
||||
NOLANUM=12
|
||||
PORTAL=wlan-portal-svc-ben-testbed.cicd.lab.wlan.tip.build
|
||||
APPORT=8823
|
||||
APTTY=/dev/ttyAP1
|
||||
MODEL=wf188n
|
||||
|
||||
# cloud sdk profile dump
|
||||
./query_sdk.py --testrail-user-id NONE --model ecw5410 --sdk-base-url https://wlan-portal-svc-ben-testbed.cicd.lab.wlan.tip.build --sdk-user-id support@example.com --sdk-user-password support --type profile --cmd get > /tmp/nola-12-profiles.txt
|
||||
./query_sdk.py --testrail-user-id NONE --model $MODEL --sdk-base-url https://$PORTAL --sdk-user-id support@example.com \
|
||||
--sdk-user-password support --type profile --cmd get > /tmp/nola-$NOLANUM-profiles.txt
|
||||
|
||||
# cloud version info
|
||||
./query_sdk.py --testrail-user-id NONE --model $MODEL --sdk-base-url https://$PORTAL --sdk-user-id support@example.com \
|
||||
--sdk-user-password support --type ping > /tmp/nola-$NOLANUM-sdk-ping.txt
|
||||
|
||||
# ovsdb-client dump
|
||||
./query_ap.py --ap-jumphost-address localhost --ap-jumphost-port 8823 --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP1 -m ecw5410 --cmd "ovsdb-client dump" > /tmp/nola-12-ap.txt
|
||||
./query_ap.py --ap-jumphost-address localhost --ap-jumphost-port $APPORT --ap-jumphost-password pumpkin77 --ap-jumphost-tty $APTTY -m $MODEL --cmd "ovsdb-client dump" > /tmp/nola-$NOLANUM-ap.txt
|
||||
|
||||
# interface info
|
||||
./query_ap.py --ap-jumphost-address localhost --ap-jumphost-port 8823 --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP1 -m ecw5410 --cmd "iwinfo && brctl show" > /tmp/nola-12-ap-if.txt
|
||||
./query_ap.py --ap-jumphost-address localhost --ap-jumphost-port $APPORT --ap-jumphost-password pumpkin77 --ap-jumphost-tty $APTTY -m $MODEL --cmd "iwinfo && brctl show" > /tmp/nola-$NOLANUM-ap-if.txt
|
||||
|
||||
|
||||
# TODO: Add more things here as we learn what better provides debug info to cloud.
|
||||
|
||||
echo "Grab: /tmp/nola-12-profiles.txt /tmp/nola-12-ap.txt /tmp/nola-12-ap-if.txt"
|
||||
echo "Grab: /tmp/nola-$NOLANUM-profiles.txt /tmp/nola-$NOLANUM-ap.txt /tmp/nola-$NOLANUM-ap-if.txt /tmp/nola-$NOLANUM-sdk-ping.txt"
|
||||
|
||||
@@ -10,7 +10,7 @@ parser = argparse.ArgumentParser(description="Query SDK Objects", add_help=False
|
||||
parser.add_argument("--type", type=str, help="Type of thing to query",
|
||||
choices=['profile', 'customer', 'location', 'equipment', 'portalUser',
|
||||
'status', 'client-sessions', 'client-info', 'alarm', 'service-metric',
|
||||
'event', 'firmware', 'all'],
|
||||
'event', 'firmware', 'ping', 'all'],
|
||||
default = "all")
|
||||
parser.add_argument("--cmd", type=str, help="Operation to do, default is 'get'",
|
||||
choices=['get', 'delete', 'child_of'],
|
||||
@@ -97,6 +97,17 @@ if qtype == 'all' or qtype == 'customer':
|
||||
logging.error(logging.traceback.format_exc())
|
||||
print("Failed to read Customer %i"%(customer_id))
|
||||
|
||||
if qtype == 'all' or qtype == 'ping':
|
||||
try:
|
||||
rv = base.cloud.ping(base.cloudSDK_url, base.bearer)
|
||||
print("Cloud Ping %s:"%(base.cloudSDK_url))
|
||||
#jobj = json.load(ssids)
|
||||
print(json.dumps(rv, indent=4, sort_keys=True))
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
logging.error(logging.traceback.format_exc())
|
||||
print("Failed to read Cloud Ping %i"%(base.cloudSDK_url))
|
||||
|
||||
if qtype == 'all' or qtype == 'firmware':
|
||||
try:
|
||||
rv = base.cloud.CloudSDK_images(base.command_line_args.model, base.cloudSDK_url, base.bearer)
|
||||
|
||||
@@ -138,15 +138,12 @@ ap_image = command_line_args.ap_image
|
||||
|
||||
apModel = model_id
|
||||
cloudModel = cloud_sdk_models[apModel]
|
||||
build = command_line_args.build_id # ie, pending
|
||||
|
||||
if not ap_image:
|
||||
# then get latest from jfrog
|
||||
# print(cloudModel)
|
||||
jfrog_url = 'https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/'
|
||||
url = jfrog_url + apModel + "/dev/"
|
||||
Build: GetBuild = GetBuild(jfrog_user, jfrog_pwd)
|
||||
latest_image = Build.get_latest_image(url, build)
|
||||
print(apModel, "Latest FW on jFrog:", latest_image)
|
||||
ap_image = latest_image
|
||||
Build: GetBuild = GetBuild(jfrog_user, jfrog_pwd, build)
|
||||
ap_image = Build.get_latest_image(apModel)
|
||||
|
||||
##Get Bearer Token to make sure its valid (long tests can require re-auth)
|
||||
bearer = cloud.get_bearer(cloudSDK_url, cloud_type)
|
||||
|
||||
Reference in New Issue
Block a user