From 2e5d0f89d8e68a70c7e7ba656c842b50caa14f8f Mon Sep 17 00:00:00 2001 From: bealler Date: Fri, 19 Feb 2021 12:14:57 -0500 Subject: [PATCH] Add test to update SSID and run connectivity --- py-scripts/tip-cicd-sanity/Nightly_Sanity.py | 86 +++++++++++++++++++- py-scripts/tip-cicd-sanity/cloudsdk.py | 27 ++++++ py-scripts/tip-cicd-sanity/lab_ap_info.py | 7 +- 3 files changed, 116 insertions(+), 4 deletions(-) diff --git a/py-scripts/tip-cicd-sanity/Nightly_Sanity.py b/py-scripts/tip-cicd-sanity/Nightly_Sanity.py index bbb9dd30..8b200899 100755 --- a/py-scripts/tip-cicd-sanity/Nightly_Sanity.py +++ b/py-scripts/tip-cicd-sanity/Nightly_Sanity.py @@ -403,7 +403,6 @@ for key in equipment_ids: else: print('Manager Status Active. Proceed with tests...') ###Find Latest FW for Current AP Model and Get FW ID - time.sleep(30) ##Compare Latest and Current AP FW and Upgrade latest_ap_image = ap_latest_dict[fw_model] @@ -519,7 +518,7 @@ for key in equipment_ids: json.dump(report_data, report_json_file) # Update TR Testrun with CloudSDK info for use in QA portal - sdk_description = cloudsdk_cluster_info["date"]+"(Commit ID: "+cloudsdk_cluster_info["commitId"] + sdk_description = cloudsdk_cluster_info["date"]+" (Commit ID: "+cloudsdk_cluster_info["commitId"]+")" update_test = client.update_testrun(rid,sdk_description) print(update_test) @@ -1117,6 +1116,33 @@ for key in equipment_ids: report_data['tests'][key][int(test_case)] = test_result time.sleep(10) + # Update SSID Profile + update_profile_id = str(fiveG_wpa) + update_ssid = key+"_Updated_SSID" + update_auth = "wpa2OnlyPSK" + update_security = "wpa2" + update_psk = "12345678" + update_profile = CloudSDK.update_ssid_profile(cloudSDK_url, bearer, update_profile_id, update_ssid, update_auth, update_psk) + print(update_profile) + time.sleep(90) + + # TC - Update Bridge SSID profile + test_case = test_cases["bridge_ssid_update"] + radio = lab_ap_info.lanforge_5g + station = [lab_ap_info.lanforge_5g_station] + prefix = lab_ap_info.lanforge_5g_prefix + try: + test_result = Test.Single_Client_Connectivity(port, radio, prefix, update_ssid, update_psk, + update_security, station, + test_case, + rid) + except: + test_result = "error" + Test.testrail_retest(test_case, rid, update_ssid) + pass + report_data['tests'][key][int(test_case)] = test_result + time.sleep(5) + print(report_data['tests'][key]) logger.info("Testing for " + fw_model + "Bridge Mode SSIDs Complete") with open(report_path + today + '/report_data.json', 'w') as report_json_file: @@ -1487,6 +1513,34 @@ for key in equipment_ids: report_data['tests'][key][int(test_case)] = test_result time.sleep(10) + # Update SSID Profile + update_profile_id = str(fiveG_wpa2) + update_ssid = key + "_Updated_SSID_NAT" + update_auth = "wpaPSK" + update_security = "wpa" + update_psk = "12345678" + update_profile = CloudSDK.update_ssid_profile(cloudSDK_url, bearer, update_profile_id, update_ssid, + update_auth, update_psk) + print(update_profile) + time.sleep(90) + + # TC - Update NAT SSID profile + test_case = test_cases["nat_ssid_update"] + radio = lab_ap_info.lanforge_5g + station = [lab_ap_info.lanforge_5g_station] + prefix = lab_ap_info.lanforge_5g_prefix + try: + test_result = Test.Single_Client_Connectivity(port, radio, prefix, update_ssid, update_psk, + update_security, station, + test_case, + rid) + except: + test_result = "error" + Test.testrail_retest(test_case, rid, update_ssid) + pass + report_data['tests'][key][int(test_case)] = test_result + time.sleep(5) + print(report_data['tests'][key]) logger.info("Testing for " + fw_model + "NAT Mode SSIDs Complete") with open(report_path + today + '/report_data.json', 'w') as report_json_file: @@ -1859,6 +1913,34 @@ for key in equipment_ids: report_data['tests'][key][int(test_case)] = test_result time.sleep(10) + # Update SSID Profile + update_profile_id = str(fiveG_wpa) + update_ssid = key + "_Updated_SSID_NAT" + update_auth = "open" + update_security = "open" + update_psk = "" + update_profile = CloudSDK.update_ssid_profile(cloudSDK_url, bearer, update_profile_id, update_ssid, + update_auth, update_psk) + print(update_profile) + time.sleep(90) + + # TC - Updated VLAN SSID profile + test_case = test_cases["vlan_ssid_update"] + radio = lab_ap_info.lanforge_5g + station = [lab_ap_info.lanforge_5g_station] + prefix = lab_ap_info.lanforge_5g_prefix + try: + test_result = Test.Single_Client_Connectivity(port, radio, prefix, update_ssid, update_psk, + update_security, station, + test_case, + rid) + except: + test_result = "error" + Test.testrail_retest(test_case, rid, update_ssid) + pass + report_data['tests'][key][int(test_case)] = test_result + time.sleep(5) + print(report_data['tests'][key]) logger.info("Testing for " + fw_model + "Custom VLAN SSIDs Complete") else: diff --git a/py-scripts/tip-cicd-sanity/cloudsdk.py b/py-scripts/tip-cicd-sanity/cloudsdk.py index d285d767..bae762fa 100755 --- a/py-scripts/tip-cicd-sanity/cloudsdk.py +++ b/py-scripts/tip-cicd-sanity/cloudsdk.py @@ -270,3 +270,30 @@ class CloudSDK: return("SUCCESS") else: return ("ERROR") + + def update_ssid_profile(cloudSDK_url, bearer, profile_id, new_ssid, new_secure_mode, new_psk): + get_profile_url = cloudSDK_url + "/portal/profile?profileId="+profile_id + + payload = {} + headers = headers = { + 'Authorization': 'Bearer ' + bearer + } + + response = requests.request("GET", get_profile_url, headers=headers, data=payload) + original_profile = response.json() + print(original_profile) + + original_profile['details']['ssid'] = new_ssid + original_profile['details']['secureMode'] = new_secure_mode + original_profile['details']['keyStr'] = new_psk + + put_profile_url = cloudSDK_url + "/portal/profile" + payload = original_profile + headers = headers = { + 'Content-Type': 'application/json', + 'Authorization': 'Bearer ' + bearer + } + response = requests.request("PUT", put_profile_url, headers=headers, json=payload) + print(response) + updated_profile = response.json() + return updated_profile \ No newline at end of file diff --git a/py-scripts/tip-cicd-sanity/lab_ap_info.py b/py-scripts/tip-cicd-sanity/lab_ap_info.py index d1c83f5c..d6bb714e 100755 --- a/py-scripts/tip-cicd-sanity/lab_ap_info.py +++ b/py-scripts/tip-cicd-sanity/lab_ap_info.py @@ -93,7 +93,7 @@ equipment_id_dict = { "ecw5410": "5", "ecw5211": "2", "ec420": "11", - "wf188n": "1", + "wf188n": "14", "ex227": "8", "eap102": "7", "wf194c": "4" @@ -176,7 +176,10 @@ test_cases = { "ssid_5g_eap_vlan": 5659, "ssid_5g_wpa2_vlan": 5660, "ssid_5g_wpa_vlan": 5661, - "radius_profile": 5808 + "radius_profile": 5808, + "bridge_ssid_update": 8742, + "nat_ssid_update": 8743, + "vlan_ssid_update": 8744 } ## Other profiles