mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-02 19:58:03 +00:00
Add CloudSDK version in TestRail run description. Additional logger outputs for Nightly_Sanity.py
This commit is contained in:
@@ -277,7 +277,6 @@ ap_models = ["ec420","ea8300","ecw5211","ecw5410"]
|
|||||||
print("Getting CloudSDK version information...")
|
print("Getting CloudSDK version information...")
|
||||||
try:
|
try:
|
||||||
cluster_ver = cluster_version.main()
|
cluster_ver = cluster_version.main()
|
||||||
print(cluster_ver)
|
|
||||||
|
|
||||||
print("CloudSDK Version Information:")
|
print("CloudSDK Version Information:")
|
||||||
print("-------------------------------------------")
|
print("-------------------------------------------")
|
||||||
@@ -313,9 +312,12 @@ except OSError:
|
|||||||
else:
|
else:
|
||||||
print ("Successfully created the directory %s " % report_path)
|
print ("Successfully created the directory %s " % report_path)
|
||||||
|
|
||||||
#Copy report template to folder
|
logger.info('Report data can be found here: '+report_path+today)
|
||||||
|
|
||||||
|
#Copy report template to folder. If template doesn't exist, continue anyway with log
|
||||||
try:
|
try:
|
||||||
copyfile(report_template,report_path+today+'/report.php')
|
copyfile(report_template,report_path+today+'/report.php')
|
||||||
|
|
||||||
except:
|
except:
|
||||||
print("No report template created. Report data will still be saved. Continuing with tests...")
|
print("No report template created. Report data will still be saved. Continuing with tests...")
|
||||||
|
|
||||||
@@ -445,7 +447,7 @@ for key in equipment_id_dict:
|
|||||||
###Create Test Run
|
###Create Test Run
|
||||||
today = str(date.today())
|
today = str(date.today())
|
||||||
test_run_name = "Daily_Sanity_" + fw_model + "_" + today + "_" + latest_ap_image
|
test_run_name = "Daily_Sanity_" + fw_model + "_" + today + "_" + latest_ap_image
|
||||||
client.create_testrun(name=test_run_name, case_ids=test_cases, project_id=projId, milestone_id=milestoneId)
|
client.create_testrun(name=test_run_name, case_ids=test_cases, project_id=projId, milestone_id=milestoneId, description='CloudSDK version info:\n'+cluster_ver)
|
||||||
rid = client.get_run_id(test_run_name="Daily_Sanity_" + fw_model + "_" + today + "_" + latest_ap_image)
|
rid = client.get_run_id(test_run_name="Daily_Sanity_" + fw_model + "_" + today + "_" + latest_ap_image)
|
||||||
print("TIP run ID is:", rid)
|
print("TIP run ID is:", rid)
|
||||||
|
|
||||||
@@ -456,12 +458,13 @@ for key in equipment_id_dict:
|
|||||||
if upgrade_fw["success"] == True:
|
if upgrade_fw["success"] == True:
|
||||||
print("CloudSDK Upgrade Request Success")
|
print("CloudSDK Upgrade Request Success")
|
||||||
report_data['tests'][key][2233] = "running"
|
report_data['tests'][key][2233] = "running"
|
||||||
#print(report_data)
|
logger.info('Firmware upgrade API successfully sent')
|
||||||
else:
|
else:
|
||||||
print("Cloud SDK Upgrade Request Error!")
|
print("Cloud SDK Upgrade Request Error!")
|
||||||
# mark upgrade test case as failed with CloudSDK error
|
# mark upgrade test case as failed with CloudSDK error
|
||||||
client.update_testrail(case_id="2233", run_id=rid, status_id=5, msg='Error calling CloudSDK firmware upgrade API')
|
client.update_testrail(case_id="2233", run_id=rid, status_id=5, msg='Error calling CloudSDK firmware upgrade API')
|
||||||
report_data['tests'][key][2233] = "failed"
|
report_data['tests'][key][2233] = "failed"
|
||||||
|
logger.warning('Firmware upgrade API failed to send')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print("Wait for AP Upgrade")
|
print("Wait for AP Upgrade")
|
||||||
@@ -470,6 +473,7 @@ for key in equipment_id_dict:
|
|||||||
# Check if upgrade success is displayed on CloudSDK
|
# Check if upgrade success is displayed on CloudSDK
|
||||||
cloud_ap_fw = CloudSDK.ap_firmware(customer_id, equipment_id, cloudSDK_url, bearer)
|
cloud_ap_fw = CloudSDK.ap_firmware(customer_id, equipment_id, cloudSDK_url, bearer)
|
||||||
print('Current AP Firmware from CloudSDK:', cloud_ap_fw)
|
print('Current AP Firmware from CloudSDK:', cloud_ap_fw)
|
||||||
|
logger.info('AP Firmware from CloudSDK: '+cloud_ap_fw)
|
||||||
if cloud_ap_fw == "ERROR":
|
if cloud_ap_fw == "ERROR":
|
||||||
print("AP FW Could not be read from CloudSDK")
|
print("AP FW Could not be read from CloudSDK")
|
||||||
|
|
||||||
@@ -484,9 +488,11 @@ for key in equipment_id_dict:
|
|||||||
ap_cli_info = ssh_cli_active_fw(ap_ip, ap_username, ap_password)
|
ap_cli_info = ssh_cli_active_fw(ap_ip, ap_username, ap_password)
|
||||||
ap_cli_fw = ap_cli_info['active_fw']
|
ap_cli_fw = ap_cli_info['active_fw']
|
||||||
print("CLI reporting AP Active FW as:", ap_cli_fw)
|
print("CLI reporting AP Active FW as:", ap_cli_fw)
|
||||||
|
logger.info('Firmware from CLI: ' + ap_cli_fw)
|
||||||
except:
|
except:
|
||||||
ap_cli_info = "ERROR"
|
ap_cli_info = "ERROR"
|
||||||
print("Cannot Reach AP CLI to confirm upgrade!")
|
print("Cannot Reach AP CLI to confirm upgrade!")
|
||||||
|
logger.warning('Cannot Reach AP CLI to confirm upgrade!')
|
||||||
client.update_testrail(case_id="2233", run_id=rid, status_id=4, msg='Cannot reach AP after upgrade to check CLI - re-test required')
|
client.update_testrail(case_id="2233", run_id=rid, status_id=4, msg='Cannot reach AP after upgrade to check CLI - re-test required')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
@@ -172,42 +172,13 @@ class APIClient:
|
|||||||
|
|
||||||
return update_flag
|
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(
|
result = client.send_post(
|
||||||
'add_run/%s' % (project_id),
|
'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)
|
print("result in post", result)
|
||||||
|
|
||||||
client: APIClient = APIClient('https://telecominfraproject.testrail.com')
|
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):
|
class APIError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user