diff --git a/NOLA-README.md b/NOLA-README.md index 8215e77ac..2c16ad01d 100644 --- a/NOLA-README.md +++ b/NOLA-README.md @@ -9,6 +9,7 @@ sudo pip3 install paramiko sudo pip3 install scp sudo pip3 install pexpect sudo pip3 install pexpect-serial +sudo yum install pytest # Clone these repositories to get started: git@github.com:Telecominfraproject/wlan-testing.git # This repo diff --git a/libs/EXAMPLE-JSON-OBJECTS.txt b/libs/EXAMPLE-JSON-OBJECTS.txt new file mode 100644 index 000000000..688982af0 --- /dev/null +++ b/libs/EXAMPLE-JSON-OBJECTS.txt @@ -0,0 +1,207 @@ +#RF Profile looks like this (as of Feb 10, 2021) +# Default RF profile is 10 currently. +{ + "childProfileIds": [], + "createdTimestamp": 0, + "customerId": 2, + "details": { + "model_type": "RfConfiguration", + "profileType": "rf", + "rfConfigMap": { + "is2dot4GHz": { + "activeScanSettings": { + "enabled": true, + "model_type": "ActiveScanSettings", + "scanDurationMillis": 65, + "scanFrequencySeconds": 10 + }, + "autoChannelSelection": false, + "beaconInterval": 100, + "bestApEnabled": null, + "bestApSettings": { + "dropInSnrPercentage": 20, + "minLoadFactor": 50, + "mlComputed": true, + "model_type": "RadioBestApSettings" + }, + "channelBandwidth": "is20MHz", + "channelHopSettings": { + "model_type": "ChannelHopSettings", + "noiseFloorThresholdInDB": -75, + "noiseFloorThresholdTimeInSeconds": 180, + "nonWifiThresholdInPercentage": 50, + "nonWifiThresholdTimeInSeconds": 180, + "obssHopMode": "NON_WIFI" + }, + "clientDisconnectThresholdDb": -90, + "eirpTxPower": 18, + "forceScanDuringVoice": "disabled", + "managementRate": "auto", + "maxNumClients": 100, + "mimoMode": "twoByTwo", + "minAutoCellSize": -65, + "model_type": "RfElementConfiguration", + "multicastRate": "auto", + "neighbouringListApConfig": { + "maxAps": 25, + "minSignal": -85, + "model_type": "NeighbouringAPListConfiguration" + }, + "perimeterDetectionEnabled": true, + "probeResponseThresholdDb": -90, + "radioMode": "modeN", + "radioType": "is2dot4GHz", + "rf": "TipWlan-rf", + "rtsCtsThreshold": 65535, + "rxCellSizeDb": -90 + }, + "is5GHz": { + "activeScanSettings": { + "enabled": true, + "model_type": "ActiveScanSettings", + "scanDurationMillis": 65, + "scanFrequencySeconds": 10 + }, + "autoChannelSelection": false, + "beaconInterval": 100, + "bestApEnabled": null, + "bestApSettings": { + "dropInSnrPercentage": 30, + "minLoadFactor": 40, + "mlComputed": true, + "model_type": "RadioBestApSettings" + }, + "channelBandwidth": "is80MHz", + "channelHopSettings": { + "model_type": "ChannelHopSettings", + "noiseFloorThresholdInDB": -75, + "noiseFloorThresholdTimeInSeconds": 180, + "nonWifiThresholdInPercentage": 50, + "nonWifiThresholdTimeInSeconds": 180, + "obssHopMode": "NON_WIFI" + }, + "clientDisconnectThresholdDb": -90, + "eirpTxPower": 18, + "forceScanDuringVoice": "disabled", + "managementRate": "auto", + "maxNumClients": 100, + "mimoMode": "twoByTwo", + "minAutoCellSize": -65, + "model_type": "RfElementConfiguration", + "multicastRate": "auto", + "neighbouringListApConfig": { + "maxAps": 25, + "minSignal": -85, + "model_type": "NeighbouringAPListConfiguration" + }, + "perimeterDetectionEnabled": true, + "probeResponseThresholdDb": -90, + "radioMode": "modeAC", + "radioType": "is5GHz", + "rf": "TipWlan-rf", + "rtsCtsThreshold": 65535, + "rxCellSizeDb": -90 + }, + "is5GHzL": { + "activeScanSettings": { + "enabled": true, + "model_type": "ActiveScanSettings", + "scanDurationMillis": 65, + "scanFrequencySeconds": 10 + }, + "autoChannelSelection": false, + "beaconInterval": 100, + "bestApEnabled": null, + "bestApSettings": { + "dropInSnrPercentage": 30, + "minLoadFactor": 40, + "mlComputed": true, + "model_type": "RadioBestApSettings" + }, + "channelBandwidth": "is80MHz", + "channelHopSettings": { + "model_type": "ChannelHopSettings", + "noiseFloorThresholdInDB": -75, + "noiseFloorThresholdTimeInSeconds": 180, + "nonWifiThresholdInPercentage": 50, + "nonWifiThresholdTimeInSeconds": 180, + "obssHopMode": "NON_WIFI" + }, + "clientDisconnectThresholdDb": -90, + "eirpTxPower": 18, + "forceScanDuringVoice": "disabled", + "managementRate": "auto", + "maxNumClients": 100, + "mimoMode": "twoByTwo", + "minAutoCellSize": -65, + "model_type": "RfElementConfiguration", + "multicastRate": "auto", + "neighbouringListApConfig": { + "maxAps": 25, + "minSignal": -85, + "model_type": "NeighbouringAPListConfiguration" + }, + "perimeterDetectionEnabled": true, + "probeResponseThresholdDb": -90, + "radioMode": "modeAC", + "radioType": "is5GHzL", + "rf": "TipWlan-rf", + "rtsCtsThreshold": 65535, + "rxCellSizeDb": -90 + }, + "is5GHzU": { + "activeScanSettings": { + "enabled": true, + "model_type": "ActiveScanSettings", + "scanDurationMillis": 65, + "scanFrequencySeconds": 10 + }, + "autoChannelSelection": false, + "beaconInterval": 100, + "bestApEnabled": null, + "bestApSettings": { + "dropInSnrPercentage": 30, + "minLoadFactor": 40, + "mlComputed": true, + "model_type": "RadioBestApSettings" + }, + "channelBandwidth": "is80MHz", + "channelHopSettings": { + "model_type": "ChannelHopSettings", + "noiseFloorThresholdInDB": -75, + "noiseFloorThresholdTimeInSeconds": 180, + "nonWifiThresholdInPercentage": 50, + "nonWifiThresholdTimeInSeconds": 180, + "obssHopMode": "NON_WIFI" + }, + "clientDisconnectThresholdDb": -90, + "eirpTxPower": 18, + "forceScanDuringVoice": "disabled", + "managementRate": "auto", + "maxNumClients": 100, + "mimoMode": "twoByTwo", + "minAutoCellSize": -65, + "model_type": "RfElementConfiguration", + "multicastRate": "auto", + "neighbouringListApConfig": { + "maxAps": 25, + "minSignal": -85, + "model_type": "NeighbouringAPListConfiguration" + }, + "perimeterDetectionEnabled": true, + "probeResponseThresholdDb": -90, + "radioMode": "modeAC", + "radioType": "is5GHzU", + "rf": "TipWlan-rf", + "rtsCtsThreshold": 65535, + "rxCellSizeDb": -90 + } + } + }, + "id": 10, + "lastModifiedTimestamp": 0, + "model_type": "Profile", + "name": "TipWlan-rf", + "profileType": "rf" +} + diff --git a/libs/JfrogHelper.py b/libs/JfrogHelper.py index 7acf63532..ec4aeb907 100644 --- a/libs/JfrogHelper.py +++ b/libs/JfrogHelper.py @@ -8,16 +8,30 @@ from lab_ap_info import * class GetBuild: - def __init__(self, jfrog_user, jfrog_passwd, build): + def __init__(self, jfrog_user, jfrog_passwd, build, url=None): self.user = jfrog_user self.password = jfrog_passwd ssl._create_default_https_context = ssl._create_unverified_context - self.jfrog_url = 'https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/' + if url: + self.jfrog_url = url + else: + self.jfrog_url = 'https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/' self.build = build - def get_latest_image(self, model): + def get_user(self): + return self.user + + def get_passwd(self): + return self.password + + 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/" + print("JfrogHelper::get_latest_image, url: ", url) auth = str( base64.b64encode( @@ -35,7 +49,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 diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index 9ce7aa8fd..ab2f7211d 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -37,6 +37,7 @@ from ap_ssh import ssh_cli_active_fw import lab_ap_info import ap_ssh + ###Class for CloudSDK Interaction via RestAPI class CloudSDK: def __init__(self, command_line_args): @@ -44,9 +45,15 @@ class CloudSDK: self.password = command_line_args.sdk_user_password self.assert_bad_response = False self.verbose = command_line_args.verbose + self.base_url = command_line_args.sdk_base_url + self.cloud_type = "v1" + self.refresh_bearer() + + def refresh_bearer(self): + self.bearer = self.get_bearer(self.base_url, self.cloud_type) def get_bearer(self, cloudSDK_url, cloud_type): - cloud_login_url = cloudSDK_url+"/management/"+cloud_type+"/oauth2/token" + cloud_login_url = cloudSDK_url + "/management/" + cloud_type + "/oauth2/token" payload = ''' { "userId": "''' + self.user + '''", @@ -60,10 +67,11 @@ class CloudSDK: token_response = requests.request("POST", cloud_login_url, headers=headers, data=payload) self.check_response("POST", token_response, headers, payload, cloud_login_url) except requests.exceptions.RequestException as e: - raise SystemExit("Exiting Script! Cloud not get bearer token for reason:",e) + raise SystemExit("Exiting Script! Cloud not get bearer token for reason:", e) token_data = token_response.json() bearer_token = token_data['access_token'] - return(bearer_token) + bearer = bearer_token + return (bearer_token) def check_response(self, cmd, response, headers, data_str, url): if response.status_code >= 500 or self.verbose: @@ -74,6 +82,7 @@ class CloudSDK: print("Command: ", cmd) print("response-status: ", response.status_code) print("response-headers: ", response.headers) + print("response-content: ", response.content) print("headers: ", headers) print("data-str: ", data_str) @@ -83,27 +92,15 @@ class CloudSDK: return False return True - def should_upgrade_ap_fw(self, bearer, command_line_args, report_data, latest_ap_image, fw_model, ap_cli_fw, - logger): + def should_upgrade_ap_fw(self, force_upgrade, skip_upgrade, report_data, latest_ap_image, fw_model, ap_cli_fw, + logger, key): do_upgrade = False - if ap_cli_fw == latest_ap_image and command_line_args.force_upgrade != True: + if ap_cli_fw == latest_ap_image and force_upgrade != True: print('FW does not require updating') if report_data: report_data['fw_available'][key] = "No" - logger.info(fw_model + " does not require upgrade.") - cloudsdk_cluster_info = { - "date": "N/A", - "commitId": "N/A", - "projectVersion": "N/A" - } - if report_data: - report_data['cloud_sdk'][key] = cloudsdk_cluster_info - - if ap_cli_fw != latest_ap_image and command_line_args.skip_upgrade == True: - print('FW needs updating, but skip_upgrade is True, so skipping upgrade') - if report_data: - report_data['fw_available'][key] = "No" - logger.info(fw_model + " firmware upgrade skipped, running with " + ap_cli_fw) + if logger: + logger.info(fw_model + " does not require upgrade.") cloudsdk_cluster_info = { "date": "N/A", "commitId": "N/A", @@ -112,8 +109,22 @@ class CloudSDK: if report_data: report_data['cloud_sdk'][key] = cloudsdk_cluster_info - if (ap_cli_fw != latest_ap_image or command_line_args.force_upgrade == True) and not command_line_args.skip_upgrade: - print('Updating firmware, old: %s new: %s'%(ap_cli_fw, latest_ap_image)) + if ap_cli_fw != latest_ap_image and skip_upgrade == True: + print('FW needs updating, but skip_upgrade is True, so skipping upgrade') + if report_data: + report_data['fw_available'][key] = "No" + if logger: + logger.info(fw_model + " firmware upgrade skipped, running with " + ap_cli_fw) + cloudsdk_cluster_info = { + "date": "N/A", + "commitId": "N/A", + "projectVersion": "N/A" + } + if report_data: + report_data['cloud_sdk'][key] = cloudsdk_cluster_info + + if (ap_cli_fw != latest_ap_image or force_upgrade == True) and not skip_upgrade: + print('Updating firmware, old: %s new: %s' % (ap_cli_fw, latest_ap_image)) do_upgrade = True if report_data: report_data['fw_available'][key] = "Yes" @@ -121,15 +132,16 @@ class CloudSDK: return do_upgrade - # client is testrail client - def do_upgrade_ap_fw(self, bearer, command_line_args, report_data, test_cases, client, ap_image, cloudModel, model, + def do_upgrade_ap_fw(self, command_line_args, report_data, test_cases, testrail_client, ap_image, cloudModel, model, jfrog_user, jfrog_pwd, testrails_rid, customer_id, equipment_id, logger): - ###Test Create Firmware Version + # Test Create Firmware Version key = model rid = testrails_rid - cloudSDK_url = command_line_args.sdk_base_url - test_id_fw = test_cases["create_fw"] + cloudSDK_url = self.base_url + bearer = self.bearer + if test_cases: + test_id_fw = test_cases["create_fw"] print(cloudModel) firmware_list_by_model = self.CloudSDK_images(cloudModel, cloudSDK_url, bearer) print("Available", cloudModel, "Firmware on CloudSDK:", firmware_list_by_model) @@ -145,15 +157,17 @@ class CloudSDK: bearer) fw_id = fw_upload_status['id'] print("Upload Complete.", ap_image, "FW ID is", fw_id) - client.update_testrail(case_id=test_id_fw, run_id=rid, status_id=1, - msg='Create new FW version by API successful') + if testrail_client: + testrail_client.update_testrail(case_id=test_id_fw, run_id=rid, status_id=1, + msg='Create new FW version by API successful') if report_data: report_data['tests'][key][test_id_fw] = "passed" except: fw_upload_status = 'error' print("Unable to upload new FW version. Skipping Sanity on AP Model") - client.update_testrail(case_id=test_id_fw, run_id=rid, status_id=5, - msg='Error creating new FW version by API') + if testrail_client: + testrail_client.update_testrail(case_id=test_id_fw, run_id=rid, status_id=5, + msg='Error creating new FW version by API') if report_data: report_data['tests'][key][test_id_fw] = "failed" return False @@ -163,18 +177,20 @@ class CloudSDK: commit = ap_image.split("-")[-1] try: fw_upload_status = self.firwmare_upload(commit, cloudModel, ap_image, fw_url, cloudSDK_url, - bearer) + bearer) fw_id = fw_upload_status['id'] print("Upload Complete.", ap_image, "FW ID is", fw_id) - client.update_testrail(case_id=test_id_fw, run_id=rid, status_id=1, - msg='Create new FW version by API successful') + if testrail_client: + testrail_client.update_testrail(case_id=test_id_fw, run_id=rid, status_id=1, + msg='Create new FW version by API successful') if report_data: report_data['tests'][key][test_id_fw] = "passed" except: fw_upload_status = 'error' print("Unable to upload new FW version. Skipping Sanity on AP Model") - client.update_testrail(case_id=test_id_fw, run_id=rid, status_id=5, - msg='Error creating new FW version by API') + if testrail_client: + testrail_client.update_testrail(case_id=test_id_fw, run_id=rid, status_id=5, + msg='Error creating new FW version by API') if report_data: report_data['tests'][key][test_id_fw] = "failed" return False @@ -182,49 +198,63 @@ class CloudSDK: # Upgrade AP firmware print("Upgrading...firmware ID is: ", fw_id) upgrade_fw = self.update_firmware(equipment_id, str(fw_id), cloudSDK_url, bearer) - logger.info("Lab " + model + " Requires FW update") + if logger: + logger.info("Lab " + model + " Requires FW update") print(upgrade_fw) 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=test_cases["upgrade_api"], run_id=rid, status_id=1, msg='Upgrade request using API successful') - logger.info('Firmware upgrade API successfully sent') + if testrail_client: + testrail_client.update_testrail(case_id=test_cases["upgrade_api"], run_id=rid, status_id=1, + msg='Upgrade request using API successful') + if logger: + 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=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') + if test_cases: + if testrail_client: + testrail_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" + if logger: + logger.warning('Firmware upgrade API failed to send') return False else: print("Cloud SDK Upgrade Request Error!") # mark upgrade test case as failed with CloudSDK error - 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') + if test_cases: + if testrail_client: + testrail_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" + if logger: + logger.warning('Firmware upgrade API failed to send') return False sdk_ok = False for i in range(10): time.sleep(30) # Check if upgrade success is displayed on CloudSDK - test_id_cloud = test_cases["cloud_fw"] + 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)) - logger.info('AP Firmware from CloudSDK: ' + cloud_ap_fw) + print('Current AP Firmware from CloudSDK: %s requested-image: %s' % (cloud_ap_fw, ap_image)) + if logger: + logger.info('AP Firmware from CloudSDK: ' + cloud_ap_fw) if cloud_ap_fw == "ERROR": print("AP FW Could not be read from CloudSDK") - + elif cloud_ap_fw == ap_image: print("CloudSDK status shows upgrade successful!") sdk_ok = True break - + else: print("AP FW from CloudSDK status is not latest build. Will try again in 30 seconds.") @@ -232,26 +262,31 @@ class CloudSDK: if sdk_ok: for i in range(10): # Check if upgrade successful on AP CLI - test_id_cli = test_cases["ap_upgrade"] + if test_cases: + test_id_cli = test_cases["ap_upgrade"] try: ap_cli_info = ssh_cli_active_fw(command_line_args) ap_cli_fw = ap_cli_info['active_fw'] print("CLI reporting AP Active FW as:", ap_cli_fw) - logger.info('Firmware from CLI: ' + ap_cli_fw) + if logger: + logger.info('Firmware from CLI: ' + ap_cli_fw) if ap_cli_fw == ap_image: cli_ok = True break else: - print("probed api-cli-fw: %s != requested-image: %s"%(ap_cli_fw, ap_image)) + print("probed api-cli-fw: %s != requested-image: %s" % (ap_cli_fw, ap_image)) continue except Exception as ex: ap_cli_info = "ERROR" print(ex) logging.error(logging.traceback.format_exc()) print("Cannot Reach AP CLI to confirm upgrade!") - logger.warning('Cannot Reach AP CLI to confirm upgrade!') - 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') + if logger: + logger.warning('Cannot Reach AP CLI to confirm upgrade!') + if test_cases: + if testrail_client: + testrail_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 time.sleep(30) @@ -264,64 +299,74 @@ 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") - 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, - msg='CLOUDSDK reporting correct firmware version.') - if report_data: - report_data['tests'][key][test_id_cli] = "passed" - report_data['tests'][key][test_id_cloud] = "passed" - print(report_data['tests'][key]) + if test_cases: + if testrail_client: + testrail_client.update_testrail(case_id=test_id_cli, run_id=rid, status_id=1, + msg='Upgrade to ' + ap_image + ' successful') + testrail_client.update_testrail(case_id=test_id_cloud, run_id=rid, status_id=1, + msg='CLOUDSDK reporting correct firmware version.') + if report_data: + report_data['tests'][key][test_id_cli] = "passed" + report_data['tests'][key][test_id_cloud] = "passed" + print(report_data['tests'][key]) return True 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 - 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, - msg='CLOUDSDK reporting incorrect firmware version.') - if report_data: - report_data['tests'][key][test_id_cli] = "passed" - report_data['tests'][key][test_id_cloud] = "failed" - print(report_data['tests'][key]) + if test_cases: + if testrail_client: + testrail_client.update_testrail(case_id=test_id_cli, run_id=rid, status_id=1, + msg='Upgrade to ' + ap_image + ' successful.') + testrail_client.update_testrail(case_id=test_id_cloud, run_id=rid, status_id=5, + msg='CLOUDSDK reporting incorrect firmware version.') + if report_data: + report_data['tests'][key][test_id_cli] = "passed" + report_data['tests'][key][test_id_cloud] = "failed" + print(report_data['tests'][key]) return True elif cloud_ap_fw == ap_image and ap_cli_fw != ap_image: print("AP CLI shows upgrade failed - CloudSDK reporting error!") # Testrail TC fail - 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, - msg='CLOUDSDK reporting incorrect firmware version.') - if report_data: - report_data['tests'][key][test_id_cli] = "failed" - report_data['tests'][key][test_id_cloud] = "failed" - print(report_data['tests'][key]) + if test_cases: + if testrail_client: + testrail_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') + testrail_client.update_testrail(case_id=test_id_cloud, run_id=rid, status_id=5, + msg='CLOUDSDK reporting incorrect firmware version.') + if report_data: + report_data['tests'][key][test_id_cli] = "failed" + report_data['tests'][key][test_id_cloud] = "failed" + print(report_data['tests'][key]) return False 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 - 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: - report_data['tests'][key][test_id_cli] = "failed" - print(report_data['tests'][key]) + if test_cases: + if testrail_client: + testrail_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: + report_data['tests'][key][test_id_cli] = "failed" + print(report_data['tests'][key]) return False else: print("Unable to determine upgrade status. Skipping AP variant") # update TR testcase as error - 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: - report_data['tests'][key][test_id_cli] = "error" - print(report_data['tests'][key]) + if test_cases: + if testrail_client: + testrail_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: + report_data['tests'][key][test_id_cli] = "error" + print(report_data['tests'][key]) return False def ap_firmware(self, customer_id, equipment_id, cloudSDK_url, bearer): - equip_fw_url = cloudSDK_url+"/portal/status/forEquipment?customerId="+customer_id+"&equipmentId="+equipment_id + equip_fw_url = cloudSDK_url + "/portal/status/forEquipment?customerId=" + customer_id + "&equipmentId=" + equipment_id payload = {} headers = { 'Authorization': 'Bearer ' + bearer @@ -331,17 +376,29 @@ class CloudSDK: status_code = status_response.status_code if status_code == 200: status_data = status_response.json() - #print(status_data) - current_ap_fw = status_data[2]['details']['reportedSwVersion'] - return current_ap_fw + # print(status_data) + try: + current_ap_fw = status_data[2]['details']['reportedSwVersion'] + return current_ap_fw + except Exception as ex: + ap_cli_info = "ERROR" + print(ex) + logging.error(logging.traceback.format_exc()) + if not self.verbose: + # Force full logging for this, result is not as expected. + self.verbose = True + self.check_response("GET", status_response, headers, payload, equip_fw_url) + self.verbose = False + return ("ERROR") + else: - return("ERROR") + return ("ERROR") def CloudSDK_images(self, apModel, cloudSDK_url, bearer): if apModel and apModel != "None": - getFW_url = cloudSDK_url+"/portal/firmware/version/byEquipmentType?equipmentType=AP&modelId=" + apModel + getFW_url = cloudSDK_url + "/portal/firmware/version/byEquipmentType?equipmentType=AP&modelId=" + apModel else: - getFW_url = cloudSDK_url+"/portal/firmware/version/byEquipmentType?equipmentType=AP" + getFW_url = cloudSDK_url + "/portal/firmware/version/byEquipmentType?equipmentType=AP" payload = {} headers = { 'Authorization': 'Bearer ' + bearer @@ -352,14 +409,14 @@ class CloudSDK: ###return ap_fw_details fwlist = [] for version in ap_fw_details: - fwlist.append(version.get('versionName')) - return(fwlist) - #fw_versionNames = ap_fw_details[0]['versionName'] - #return fw_versionNames + fwlist.append(version.get('versionName')) + return (fwlist) + # fw_versionNames = ap_fw_details[0]['versionName'] + # return fw_versionNames - def firwmare_upload(self, commit, apModel,latest_image,fw_url,cloudSDK_url,bearer): - fw_upload_url = cloudSDK_url+"/portal/firmware/version" - payload = "{\n \"model_type\": \"FirmwareVersion\",\n \"id\": 0,\n \"equipmentType\": \"AP\",\n \"modelId\": \""+apModel+"\",\n \"versionName\": \""+latest_image+"\",\n \"description\": \"\",\n \"filename\": \""+fw_url+"\",\n \"commit\": \""+commit+"\",\n \"validationMethod\": \"MD5_CHECKSUM\",\n \"validationCode\": \"19494befa87eb6bb90a64fd515634263\",\n \"releaseDate\": 1596192028877,\n \"createdTimestamp\": 0,\n \"lastModifiedTimestamp\": 0\n}\n\n" + def firwmare_upload(self, commit, apModel, latest_image, fw_url, cloudSDK_url, bearer): + fw_upload_url = cloudSDK_url + "/portal/firmware/version" + payload = "{\n \"model_type\": \"FirmwareVersion\",\n \"id\": 0,\n \"equipmentType\": \"AP\",\n \"modelId\": \"" + apModel + "\",\n \"versionName\": \"" + latest_image + "\",\n \"description\": \"\",\n \"filename\": \"" + fw_url + "\",\n \"commit\": \"" + commit + "\",\n \"validationMethod\": \"MD5_CHECKSUM\",\n \"validationCode\": \"19494befa87eb6bb90a64fd515634263\",\n \"releaseDate\": 1596192028877,\n \"createdTimestamp\": 0,\n \"lastModifiedTimestamp\": 0\n}\n\n" headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + bearer @@ -367,13 +424,13 @@ class CloudSDK: response = requests.request("POST", fw_upload_url, headers=headers, data=payload) self.check_response("POST", response, headers, payload, fw_upload_url) - #print(response) + # print(response) upload_result = response.json() - return(upload_result) + return (upload_result) def get_firmware_id(self, latest_ap_image, cloudSDK_url, bearer): - #print(latest_ap_image) - fw_id_url = cloudSDK_url+"/portal/firmware/version/byName?firmwareVersionName="+latest_ap_image + # print(latest_ap_image) + fw_id_url = cloudSDK_url + "/portal/firmware/version/byName?firmwareVersionName=" + latest_ap_image payload = {} headers = { @@ -396,7 +453,7 @@ class CloudSDK: rv = [] req = 0 while True: - print("Request %i: in get-paged-url, url: %s"%(req, url)) + print("Request %i: in get-paged-url, url: %s" % (req, url)) response = requests.request("GET", url, headers=headers, data=payload) self.check_response("GET", response, headers, payload, url) rjson = response.json() @@ -407,12 +464,12 @@ class CloudSDK: if rjson['context']['lastPage']: break context_str = json.dumps(rjson['context']) - #print("context-str: %s"%(context_str)) + # print("context-str: %s"%(context_str)) url = url_base + "&paginationContext=" + urllib.parse.quote(context_str) req = req + 1 - #print("Profile, reading another page, context:") - #print(rjson['context']) - #print("url: %s"%(fw_id_url)) + # print("Profile, reading another page, context:") + # print(rjson['context']) + # print("url: %s"%(fw_id_url)) return rv @@ -422,7 +479,7 @@ class CloudSDK: 'Authorization': 'Bearer ' + bearer } - print("Get-url, url: %s"%(url)) + print("Get-url, url: %s" % (url)) response = requests.request("GET", url, headers=headers, data=payload) self.check_response("GET", response, headers, payload, url) return response.json() @@ -435,6 +492,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): @@ -445,13 +506,14 @@ class CloudSDK: prof_model_type = e['model_type'] prof_type = e['profileType'] prof_name = e['name'] - print("looking for profile: %s checking prof-id: %s model-type: %s type: %s name: %s"%(name, prof_id, prof_model_type, prof_type, prof_name)) + print("looking for profile: %s checking prof-id: %s model-type: %s type: %s name: %s" % ( + name, prof_id, prof_model_type, prof_type, prof_name)) if name == prof_name: return e return None def delete_customer_profile(self, cloudSDK_url, bearer, profile_id): - url = cloudSDK_url + '/portal/profile/?profileId=' + profile_id + url = cloudSDK_url + '/portal/profile/?profileId=' + str(profile_id) print("Deleting customer profile with url: " + url) payload = {} headers = { @@ -459,7 +521,7 @@ class CloudSDK: } response = requests.request("DELETE", url, headers=headers, data=payload) self.check_response("DELETE", response, headers, payload, url) - return(response) + return (response) def delete_equipment(self, cloudSDK_url, bearer, eq_id): url = cloudSDK_url + '/portal/equipment/?equipmentId=' + eq_id @@ -470,15 +532,15 @@ class CloudSDK: } response = requests.request("DELETE", url, headers=headers, data=payload) self.check_response("DELETE", response, headers, payload, url) - return(response) + return (response) def get_customer_locations(self, cloudSDK_url, bearer, customer_id): url_base = cloudSDK_url + "/portal/location/forCustomer" + "?customerId=" + customer_id return self.get_paged_url(bearer, url_base) - def get_customer_equipment(self, cloudSDK_url, bearer, customer_id): - url_base = cloudSDK_url + "/portal/equipment/forCustomer" + "?customerId=" + customer_id - return self.get_paged_url(bearer, url_base) + def get_customer_equipment(self, customer_id): + url = self.base_url + "/portal/equipment/forCustomer" + "?customerId=" + customer_id + return self.get_paged_url(self.bearer, url) def get_customer_portal_users(self, cloudSDK_url, bearer, customer_id): url_base = cloudSDK_url + "/portal/portalUser/forCustomer" + "?customerId=" + customer_id @@ -527,10 +589,10 @@ class CloudSDK: } response = requests.request("DELETE", url, headers=headers, data=payload) self.check_response("DELETE", response, headers, payload, url) - return(response) + return (response) def update_firmware(self, equipment_id, latest_firmware_id, cloudSDK_url, bearer): - url = cloudSDK_url+"/portal/equipmentGateway/requestFirmwareUpdate?equipmentId="+equipment_id+"&firmwareVersionId="+latest_firmware_id + url = cloudSDK_url + "/portal/equipmentGateway/requestFirmwareUpdate?equipmentId=" + equipment_id + "&firmwareVersionId=" + latest_firmware_id payload = {} headers = { @@ -539,12 +601,12 @@ class CloudSDK: response = requests.request("POST", url, headers=headers, data=payload) self.check_response("POST", response, headers, payload, url) - #print(response.text) + # print(response.text) return response.json() # This one is not yet tested, coded from spec, could have bugs. def ap_reboot(self, equipment_id, cloudSDK_url, bearer): - url = cloudSDK_url+"/portal/equipmentGateway/requestApReboot?equipmentId="+equipment_id + url = cloudSDK_url + "/portal/equipmentGateway/requestApReboot?equipmentId=" + equipment_id payload = {} headers = { @@ -553,12 +615,12 @@ class CloudSDK: response = requests.request("POST", url, headers=headers, data=payload) self.check_response("POST", response, headers, payload, url) - #print(response.text) + # print(response.text) return response.json() # This one is not yet tested, coded from spec, could have bugs. def ap_switch_sw_bank(self, equipment_id, cloudSDK_url, bearer): - url = cloudSDK_url+"/portal/equipmentGateway/requestApSwitchSoftwareBank?equipmentId="+equipment_id + url = cloudSDK_url + "/portal/equipmentGateway/requestApSwitchSoftwareBank?equipmentId=" + equipment_id payload = {} headers = { @@ -567,12 +629,12 @@ class CloudSDK: response = requests.request("POST", url, headers=headers, data=payload) self.check_response("POST", response, headers, payload, url) - #print(response.text) + # print(response.text) return response.json() # This one is not yet tested, coded from spec, could have bugs. def ap_factory_reset(self, equipment_id, cloudSDK_url, bearer): - url = cloudSDK_url+"/portal/equipmentGateway/requestApFactoryReset?equipmentId="+equipment_id + url = cloudSDK_url + "/portal/equipmentGateway/requestApFactoryReset?equipmentId=" + equipment_id payload = {} headers = { @@ -581,12 +643,12 @@ class CloudSDK: response = requests.request("POST", url, headers=headers, data=payload) self.check_response("POST", response, headers, payload, url) - #print(response.text) + # print(response.text) return response.json() # This one is not yet tested, coded from spec, could have bugs. def ap_channel_change(self, equipment_id, cloudSDK_url, bearer): - url = cloudSDK_url+"/portal/equipmentGateway/requestChannelChange?equipmentId="+equipment_id + url = cloudSDK_url + "/portal/equipmentGateway/requestChannelChange?equipmentId=" + equipment_id payload = {} headers = { @@ -595,15 +657,15 @@ class CloudSDK: response = requests.request("POST", url, headers=headers, data=payload) self.check_response("POST", response, headers, payload, url) - #print(response.text) + # print(response.text) return response.json() - def set_ap_profile(self, equipment_id, test_profile_id, cloudSDK_url, bearer): + def set_ap_profile(self, equipment_id, test_profile_id): ###Get AP Info - url = cloudSDK_url+"/portal/equipment?equipmentId="+equipment_id + url = self.base_url + "/portal/equipment?equipmentId=" + equipment_id payload = {} headers = { - 'Authorization': 'Bearer ' + bearer + 'Authorization': 'Bearer ' + self.bearer } response = requests.request("GET", url, headers=headers, data=payload) @@ -612,15 +674,15 @@ class CloudSDK: ###Add Lab Profile ID to Equipment equipment_info = response.json() - #print(equipment_info) + # print(equipment_info) equipment_info["profileId"] = test_profile_id print(equipment_info) ###Update AP Info with Required Profile ID - url = cloudSDK_url+"/portal/equipment" + url = self.base_url + "/portal/equipment" headers = { 'Content-Type': 'application/json', - 'Authorization': 'Bearer ' + bearer + 'Authorization': 'Bearer ' + self.bearer } response = requests.request("PUT", url, headers=headers, data=json.dumps(equipment_info)) @@ -628,8 +690,8 @@ class CloudSDK: print(response) def get_cloudsdk_version(self, cloudSDK_url, bearer): - #print(latest_ap_image) - url = cloudSDK_url+"/ping" + # print(latest_ap_image) + url = cloudSDK_url + "/ping" payload = {} headers = { @@ -647,14 +709,14 @@ class CloudSDK: profile["name"] = name profile["childProfileIds"] = child_profiles - url = cloudSDK_url+"/portal/profile" + url = cloudSDK_url + "/portal/profile" headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + bearer } data_str = json.dumps(profile) - print("Creating new ap-profile, data: %s"%(data_str)) + print("Creating new ap-profile, data: %s" % (data_str)) response = requests.request("POST", url, headers=headers, data=data_str) self.check_response("POST", response, headers, data_str, url) ap_profile = response.json() @@ -674,27 +736,28 @@ class CloudSDK: profile["name"] = name profile["childProfileIds"] = child_profiles - url = cloudSDK_url+"/portal/profile" + url = cloudSDK_url + "/portal/profile" headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + bearer } data_str = json.dumps(profile) - print("Updating ap-profile, data: %s"%(data_str)) + print("Updating ap-profile, data: %s" % (data_str)) response = requests.request("PUT", url, headers=headers, data=data_str) self.check_response("PUT", response, headers, data_str, url) print(response) if self.verbose: p2 = self.get_customer_profile_by_name(cloudSDK_url, bearer, customer_id, name) - print("AP Profile: %s after update:"%(name)) + print("AP Profile: %s after update:" % (name)) print(json.dumps(p2, indent=4, sort_keys=True)) - + return profile['id'] - def create_ssid_profile(self, cloudSDK_url, bearer, customer_id, template, name, ssid, passkey, radius, security, mode, vlan, radios): - print("create-ssid-profile, template: %s"%(template)) + def create_ssid_profile(self, cloudSDK_url, bearer, customer_id, template, name, ssid, passkey, radius, security, + mode, vlan, radios, radius_profile=None): + print("create-ssid-profile, template: %s" % (template)) profile = self.get_customer_profile_by_name(cloudSDK_url, bearer, customer_id, template) profile['name'] = name @@ -705,6 +768,61 @@ class CloudSDK: profile['details']['forwardMode'] = mode profile['details']['vlanId'] = vlan profile['details']['appliedRadios'] = radios + if radius_profile is not None: + profile['details']['radiusServiceId'] = radius_profile + profile['childProfileIds'].append(radius_profile) + url = cloudSDK_url + "/portal/profile" + headers = { + 'Content-Type': 'application/json', + 'Authorization': 'Bearer ' + bearer + } + data_str = json.dumps(profile) + time.sleep(5) + print("shivamgogoshots radius :", radius_profile, "\n\n", profile, "\n\n", data_str) + response = requests.request("POST", url, headers=headers, data=data_str) + self.check_response("POST", response, headers, data_str, url) + ssid_profile = response.json() + return ssid_profile['id'] + + def create_or_update_ssid_profile(self, cloudSDK_url, bearer, customer_id, template, name, + ssid, passkey, radius, security, mode, vlan, radios, radius_profile=None): + # First, see if profile of this name already exists. + profile = self.get_customer_profile_by_name(cloudSDK_url, bearer, customer_id, name) + if profile == None: + # create one then + return self.create_ssid_profile(cloudSDK_url, bearer, customer_id, template, name, + ssid, passkey, radius, security, mode, vlan, radios, radius_profile) + + # Update then. + print("Update existing ssid profile, name: %s" % (name)) + profile['name'] = name + profile['details']['ssid'] = ssid + profile['details']['keyStr'] = passkey + profile['details']['radiusServiceName'] = radius + profile['details']['secureMode'] = security + profile['details']['forwardMode'] = mode + profile['details']['vlanId'] = vlan + profile['details']['appliedRadios'] = radios + if radius_profile is not None: + profile['details']['radiusServiceId'] = radius_profile + profile['childProfileIds'].append(radius_profile) + url = cloudSDK_url + "/portal/profile" + headers = { + 'Content-Type': 'application/json', + 'Authorization': 'Bearer ' + bearer + } + + data_str = json.dumps(profile) + time.sleep(10) + print("shivamgogoshots radius :", radius_profile, "\n\n", profile, "\n\n", data_str) + response = requests.request("PUT", url, headers=headers, data=data_str) + self.check_response("PUT", response, headers, data_str, url) + return profile['id'] + + # General usage: get the default profile, modify it accordingly, pass it back to here + # Not tested yet. + def create_rf_profile(self, cloudSDK_url, bearer, customer_id, template, name, new_prof): + print("create-rf-profile, template: %s" % (template)) url = cloudSDK_url + "/portal/profile" headers = { @@ -716,46 +834,36 @@ class CloudSDK: self.check_response("POST", response, headers, data_str, url) ssid_profile = response.json() return ssid_profile['id'] - - def create_or_update_ssid_profile(self, cloudSDK_url, bearer, customer_id, template, name, - ssid, passkey, radius, security, mode, vlan, radios): + # Not tested yet. + def create_or_update_rf_profile(self, cloudSDK_url, bearer, customer_id, template, name, + new_prof): # First, see if profile of this name already exists. profile = self.get_customer_profile_by_name(cloudSDK_url, bearer, customer_id, name) if profile == None: # create one then - return self.create_ssid_profile(cloudSDK_url, bearer, customer_id, template, name, - ssid, passkey, radius, security, mode, vlan, radios) + return self.create_rf_profile(cloudSDK_url, bearer, customer_id, template, name, new_prof) # Update then. - print("Update existing ssid profile, name: %s"%(name)) - profile['name'] = name - profile['details']['ssid'] = ssid - profile['details']['keyStr'] = passkey - profile['details']['radiusServiceName'] = radius - profile['details']['secureMode'] = security - profile['details']['forwardMode'] = mode - profile['details']['vlanId'] = vlan - profile['details']['appliedRadios'] = radios + print("Update existing ssid profile, name: %s" % (name)) url = cloudSDK_url + "/portal/profile" headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + bearer } - data_str = json.dumps(profile) + data_str = json.dumps(new_profile) response = requests.request("PUT", url, headers=headers, data=data_str) self.check_response("PUT", response, headers, data_str, url) return profile['id'] def create_radius_profile(self, cloudSDK_url, bearer, customer_id, template, name, subnet_name, subnet, subnet_mask, region, server_name, server_ip, secret, auth_port): - print("Create-radius-profile called, template: %s"%(template)) + print("Create-radius-profile called, template: %s" % (template)) profile = self.get_customer_profile_by_name(cloudSDK_url, bearer, customer_id, template) profile['name'] = name - subnet_config = profile['details']['subnetConfiguration'] old_subnet_name = list(subnet_config.keys())[0] subnet_config[subnet_name] = subnet_config.pop(old_subnet_name) @@ -784,7 +892,7 @@ class CloudSDK: } data_str = json.dumps(profile) - print("Sending json to create radius: %s"%(data_str)) + print("Sending json to create radius: %s" % (data_str)) response = requests.request("POST", url, headers=headers, data=data_str) self.check_response("POST", response, headers, data_str, url) radius_profile = response.json() @@ -792,51 +900,34 @@ class CloudSDK: radius_profile_id = radius_profile['id'] return radius_profile_id - def create_or_update_radius_profile(self, cloudSDK_url, bearer, customer_id, template, name, subnet_name, subnet, subnet_mask, + def create_or_update_radius_profile(self, cloudSDK_url, bearer, customer_id, template, name, subnet_name, subnet, + subnet_mask, region, server_name, server_ip, secret, auth_port): - profile = self.get_customer_profile_by_name(cloudSDK_url, bearer, customer_id, name) - if profile == None: - # create one then - return self.create_radius_profile(cloudSDK_url, bearer, customer_id, template, name, subnet_name, subnet, subnet_mask, - region, server_name, server_ip, secret, auth_port) - - print("Found existing radius profile, will update, name: %s"%(name)) - - subnet_config = profile['details']['subnetConfiguration'] - old_subnet_name = list(subnet_config.keys())[0] - subnet_config[subnet_name] = subnet_config.pop(old_subnet_name) - profile['details']['subnetConfiguration'][subnet_name]['subnetAddress'] = subnet - profile['details']['subnetConfiguration'][subnet_name]['subnetCidrPrefix'] = subnet_mask - profile['details']['subnetConfiguration'][subnet_name]['subnetName'] = subnet_name - - region_map = profile['details']['serviceRegionMap'] - old_region = list(region_map.keys())[0] - region_map[region] = region_map.pop(old_region) - profile['details']['serviceRegionName'] = region - profile['details']['subnetConfiguration'][subnet_name]['serviceRegionName'] = region - profile['details']['serviceRegionMap'][region]['regionName'] = region - - server_map = profile['details']['serviceRegionMap'][region]['serverMap'] - old_server_name = list(server_map.keys())[0] - server_map[server_name] = server_map.pop(old_server_name) - profile['details']['serviceRegionMap'][region]['serverMap'][server_name][0]['ipAddress'] = server_ip - profile['details']['serviceRegionMap'][region]['serverMap'][server_name][0]['secret'] = secret - profile['details']['serviceRegionMap'][region]['serverMap'][server_name][0]['authPort'] = auth_port + null = None + profile = {"model_type": "Profile", "id": 129, "customerId": 2, "profileType": "radius", "name": "Lab-RADIUS", + "details": {"model_type": "RadiusProfile", + "primaryRadiusAuthServer": {"model_type": "RadiusServer", "ipAddress": "10.10.10.203", + "secret": "testing123", "port": 1812, "timeout": 5}, + "secondaryRadiusAuthServer": null, "primaryRadiusAccountingServer": null, + "secondaryRadiusAccountingServer": null, "profileType": "radius"}, + "createdTimestamp": 1602263176599, "lastModifiedTimestamp": 1611708334061, "childProfileIds": []} + profile['name'] = name + profile['customerId'] = customer_id + profile['details']["primaryRadiusAuthServer"]['ipAddress'] = server_ip + profile['details']["primaryRadiusAuthServer"]['secret'] = secret + profile['details']["primaryRadiusAuthServer"]['port'] = auth_port url = cloudSDK_url + "/portal/profile" headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + bearer } - data_str = json.dumps(profile) - response = requests.request("PUT", url, headers=headers, data=data_str) - self.check_response("PUT", response, headers, data_str, url) - # TODO: Commented code below is wrong, obviously in hindsight. But, need to parse response - # and throw exception or something if it is an error code. - #response = requests.request("PUT", url, headers=headers, data=profile) - print(response) - return profile['id'] + json_profile_data = json.dumps(profile).encode("utf-8") + response = requests.request("POST", url, headers=headers, data=json_profile_data) + radius_profile = response.json() + radius_profile_id = radius_profile['id'] + return radius_profile_id # Library for creating AP Profiles @@ -847,9 +938,11 @@ class CreateAPProfiles: cloud=None, cloud_type="v1", client=None, - fw_model=None + fw_model=None, + sleep=5 ): + self.profile_test_data = {"ssid_config": {}, "vif_config": {}} self.rid = None self.fiveG_wpa2 = None self.fiveG_wpa = None @@ -874,17 +967,18 @@ class CreateAPProfiles: "name": "Lab-RADIUS", "subnet_name": "Lab", - "subnet": "10.10.0.0", + "subnet": "8.189.25.141", "subnet_mask": 16, "region": "Toronto", "server_name": "Lab-RADIUS", - "server_ip": "10.10.10.203", + "server_ip": "18.189.25.141", "secret": "testing123", "auth_port": 1812 } self.ap_models = ["ec420", "ea8300", "ecw5211", "ecw5410"] self.fw_model = fw_model self.report_data = {} + self.sleep = sleep self.report_data['tests'] = dict.fromkeys(self.ap_models, "") self.test_cases = { "radius_profile": None, @@ -903,6 +997,13 @@ class CreateAPProfiles: "ssid_2g_wpa2_nat": None, "ssid_2g_wpa_nat": None, + "ssid_5g_eap_vlan": None, + "ssid_5g_wpa2_vlan": None, + "ssid_5g_wpa_vlan": None, + "ssid_2g_eap_vlan": None, + "ssid_2g_wpa2_vlan": None, + "ssid_2g_wpa_vlan": None, + "ap_bridge": None, "ap_nat": None, "ap_vlan": None, @@ -919,56 +1020,57 @@ class CreateAPProfiles: self.profile_data, self.prof_names, self.prof_names_eap = self.create_profile_data(self.command_line_args, self.fw_model) self.ssid_data, self.psk_data = self.create_ssid_data(self.command_line_args, self.fw_model) + self.profile_ids = [] def create_profile_data(self, args, fw_model): profile_data = { "5g": {"eap": { - "name": "%s-%s-%s" % (args.testbed, fw_model, "5G_EAP"), + "bridge": "%s-%s-%s" % (args.testbed, fw_model, "5G_EAP"), "nat": "%s-%s-%s" % (args.testbed, fw_model, "5G_EAP_NAT"), "vlan": "%s-%s-%s" % (args.testbed, fw_model, "5G_EAP_VLAN") }, "wpa": { - "name": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA"), + "bridge": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA"), "nat": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA_NAT"), "vlan": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA_VLAN") }, "wpa2": { - "name": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA2"), + "bridge": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA2"), "nat": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA2_NAT"), "vlan": "%s-%s-%s" % (args.testbed, fw_model, "5G_WPA2_VLAN") } }, "2g": {"eap": { - "name": "%s-%s-%s" % (args.testbed, fw_model, "2G_EAP"), + "bridge": "%s-%s-%s" % (args.testbed, fw_model, "2G_EAP"), "nat": "%s-%s-%s" % (args.testbed, fw_model, "2G_EAP_NAT"), "vlan": "%s-%s-%s" % (args.testbed, fw_model, "2G_EAP_VLAN") }, "wpa": { - "name": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA"), + "bridge": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA"), "nat": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA_NAT"), "vlan": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA_VLAN") }, "wpa2": { - "name": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA2"), + "bridge": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA2"), "nat": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA2_NAT"), "vlan": "%s-%s-%s" % (args.testbed, fw_model, "2G_WPA2_VLAN") } } } - prof_names = [profile_data["5g"]["wpa2"]["name"], profile_data["5g"]["wpa"]["name"], - profile_data["2g"]["wpa2"]["name"], profile_data["2g"]["wpa"]["name"], + prof_names = [profile_data["5g"]["wpa2"]["bridge"], profile_data["5g"]["wpa"]["bridge"], + profile_data["2g"]["wpa2"]["bridge"], profile_data["2g"]["wpa"]["bridge"], profile_data["5g"]["wpa2"]["nat"], profile_data["5g"]["wpa"]["nat"], profile_data["2g"]["wpa2"]["nat"], profile_data["2g"]["wpa"]["nat"], profile_data["5g"]["wpa2"]["vlan"], profile_data["5g"]["wpa"]["vlan"], profile_data["2g"]["wpa2"]["vlan"], profile_data["2g"]["wpa"]["vlan"]] - prof_names_eap = [profile_data["5g"]["eap"]["name"], profile_data["2g"]["eap"]["name"], + prof_names_eap = [profile_data["5g"]["eap"]["bridge"], profile_data["2g"]["eap"]["bridge"], profile_data["5g"]["eap"]["nat"], profile_data["2g"]["eap"]["nat"], profile_data["5g"]["eap"]["vlan"], profile_data["2g"]["eap"]["vlan"]] @@ -976,19 +1078,18 @@ class CreateAPProfiles: def create_ssid_data(self, args, fw_model): ssid_data = self.profile_data.copy() - psk_data = { "5g": { "wpa": { - "name": "%s-%s" % (fw_model, "5G_WPA"), + "bridge": "%s-%s" % (fw_model, "5G_WPA"), "nat": "%s-%s" % (fw_model, "5G_WPA_NAT"), "vlan": "%s-%s" % (fw_model, "5G_WPA_VLAN") }, "wpa2": { - "name": "%s-%s" % (fw_model, "5G_WPA2"), + "bridge": "%s-%s" % (fw_model, "5G_WPA2"), "nat": "%s-%s" % (fw_model, "5G_WPA2_NAT"), "vlan": "%s-%s" % (fw_model, "5G_WPA2_VLAN") } @@ -997,20 +1098,19 @@ class CreateAPProfiles: { "wpa": { - "name": "%s-%s" % (fw_model, "2G_WPA"), + "bridge": "%s-%s" % (fw_model, "2G_WPA"), "nat": "%s-%s" % (fw_model, "2G_WPA_NAT"), "vlan": "%s-%s" % (fw_model, "2G_WPA_VLAN") }, "wpa2": { - "name": "%s-%s" % (fw_model, "2G_WPA2"), + "bridge": "%s-%s" % (fw_model, "2G_WPA2"), "nat": "%s-%s" % (fw_model, "2G_WPA2_NAT"), "vlan": "%s-%s" % (fw_model, "2G_WPA2_VLAN") } } } - return ssid_data, psk_data def set_ssid_psk_data(self, @@ -1023,43 +1123,43 @@ class CreateAPProfiles: psk_2g_wpa2=None, psk_5g_wpa2=None): if psk_5g_wpa2 is not None: - self.psk_data["5g"]["wpa2"]["name"] = psk_5g_wpa2 + self.psk_data["5g"]["wpa2"]["bridge"] = psk_5g_wpa2 self.psk_data["5g"]["wpa2"]["nat"] = psk_5g_wpa2 self.psk_data["5g"]["wpa2"]["vlan"] = psk_5g_wpa2 if psk_5g_wpa is not None: - self.psk_data["5g"]["wpa"]["name"] = psk_5g_wpa + self.psk_data["5g"]["wpa"]["bridge"] = psk_5g_wpa self.psk_data["5g"]["wpa"]["nat"] = psk_5g_wpa self.psk_data["5g"]["wpa"]["vlan"] = psk_5g_wpa if psk_2g_wpa2 is not None: - self.psk_data["2g"]["wpa2"]["name"] = psk_2g_wpa2 + self.psk_data["2g"]["wpa2"]["bridge"] = psk_2g_wpa2 self.psk_data["2g"]["wpa2"]["nat"] = psk_2g_wpa2 self.psk_data["2g"]["wpa2"]["vlan"] = psk_2g_wpa2 if psk_2g_wpa is not None: - self.psk_data["2g"]["wpa"]["name"] = psk_2g_wpa + self.psk_data["2g"]["wpa"]["bridge"] = psk_2g_wpa self.psk_data["2g"]["wpa"]["nat"] = psk_2g_wpa self.psk_data["2g"]["wpa"]["nat"] = psk_2g_wpa if ssid_5g_wpa2 is not None: - self.ssid_data["5g"]["wpa2"]["name"] = ssid_5g_wpa2 + self.ssid_data["5g"]["wpa2"]["bridge"] = ssid_5g_wpa2 self.ssid_data["5g"]["wpa2"]["nat"] = ssid_5g_wpa2 self.ssid_data["5g"]["wpa2"]["vlan"] = ssid_5g_wpa2 if ssid_5g_wpa is not None: - self.ssid_data["5g"]["wpa"]["name"] = ssid_5g_wpa + self.ssid_data["5g"]["wpa"]["bridge"] = ssid_5g_wpa self.ssid_data["5g"]["wpa"]["nat"] = ssid_5g_wpa self.ssid_data["5g"]["wpa"]["vlan"] = ssid_5g_wpa if ssid_2g_wpa2 is not None: - self.ssid_data["2g"]["wpa2"]["name"] = ssid_2g_wpa2 + self.ssid_data["2g"]["wpa2"]["bridge"] = ssid_2g_wpa2 self.ssid_data["2g"]["wpa2"]["nat"] = ssid_2g_wpa2 self.ssid_data["2g"]["wpa2"]["vlan"] = ssid_2g_wpa2 if ssid_2g_wpa is not None: - self.ssid_data["2g"]["wpa"]["name"] = ssid_2g_wpa + self.ssid_data["2g"]["wpa"]["bridge"] = ssid_2g_wpa self.ssid_data["2g"]["wpa"]["nat"] = ssid_2g_wpa self.ssid_data["2g"]["wpa"]["vlan"] = ssid_2g_wpa - def create_radius_profile(self, radius_name, rid, key): + def create_radius_profile(self, radius_name=None, radius_template=None, rid=None, key=None): ### Create RADIUS profile - used for all EAP SSIDs self.radius_name = radius_name - self.radius_template = "Radius-Profile" # Default radius profile found in cloud-sdk + self.radius_template = radius_template # Default radius profile found in cloud-sdk self.subnet_name = self.radius_info['subnet_name'] self.subnet = self.radius_info['subnet'] self.subnet_mask = self.radius_info['subnet_mask'] @@ -1082,10 +1182,11 @@ class CreateAPProfiles: self.server_name, self.server_ip, self.secret, self.auth_port) print("radius profile Id is", self.radius_profile) - client.update_testrail(case_id=self.test_cases["radius_profile"], run_id=self.rid, status_id=1, - msg='RADIUS profile created successfully') + time.sleep(self.sleep) + self.client.update_testrail(case_id=self.test_cases["radius_profile"], run_id=self.rid, status_id=1, + msg='RADIUS profile created successfully') self.test_cases["radius_profile"] = "passed" - except: + except Exception as ex: print(ex) logging.error(logging.traceback.format_exc()) print("RADIUS Profile Create Error, will skip radius profile.") @@ -1100,34 +1201,45 @@ class CreateAPProfiles: def create_ssid_profiles(self, ssid_template=None, skip_wpa2=False, skip_wpa=False, skip_eap=False, mode="bridge"): self.ssid_template = ssid_template - if mode == "bridge": - self.mode = "name" - if mode == "nat": - self.mode = "nat" + if mode == "vlan": + self.mode = "bridge" + self.value = 100 + else: + self.mode = mode + self.value = 1 self.fiveG_eap = None self.twoFourG_eap = None self.fiveG_wpa2 = None self.twoFourG_wpa2 = None self.fiveG_wpa = None self.twoFourG_wpa = None - + if skip_eap: + self.radius_profile = None # 5G SSID's print("CreateAPProfile::create_ssid_profile, skip-wpa: ", skip_wpa, " skip-wpa2: ", skip_wpa2, " skip-eap: ", skip_eap) - if not skip_eap: + self.profile_test_data["vif_config"]["ssid_5g_eap"] = None + self.profile_test_data["vif_config"]["ssid_2g_eap"] = None + self.profile_test_data["ssid_config"]["ssid_5g_eap"] = None + self.profile_test_data["ssid_config"]["ssid_2g_eap"] = None + # 5G eap try: + print("sssss", self.radius_profile) self.fiveG_eap = self.cloud.create_or_update_ssid_profile(self.command_line_args.sdk_base_url, self.bearer, self.customer_id, self.ssid_template, - self.profile_data['5g']['eap'][self.mode], - self.ssid_data['5g']['eap'][self.mode], + self.profile_data['5g']['eap'][mode], + self.ssid_data['5g']['eap'][mode], None, self.radius_name, - "wpa2OnlyRadius", mode.upper(), 1, - ["is5GHzU", "is5GHz", "is5GHzL"]) + "wpa2OnlyRadius", self.mode.upper(), self.value, + ["is5GHzU", "is5GHz", "is5GHzL"], + radius_profile=self.radius_profile) + + time.sleep(self.sleep) print("5G EAP SSID created successfully - " + mode + " mode") self.client.update_testrail(case_id=self.test_cases["ssid_5g_eap_" + mode], run_id=self.rid, @@ -1139,23 +1251,28 @@ class CreateAPProfiles: logging.error(logging.traceback.format_exc()) self.fiveG_eap = None print("5G EAP SSID create failed - " + mode + " mode") - self.client.update_testrail(case_id=self.test_cases["ssid_5g_eap_" + mode], run_id=self.rid, status_id=5, + self.client.update_testrail(case_id=self.test_cases["ssid_5g_eap_" + mode], run_id=self.rid, + status_id=5, msg='5G EAP SSID create failed - ' + mode + ' mode') self.test_cases["ssid_5g_eap_" + mode] = "failed" # 2.4G eap try: + print("shivamgogoshots", self.radius_profile) self.twoFourG_eap = self.cloud.create_or_update_ssid_profile(self.command_line_args.sdk_base_url, self.bearer, self.customer_id, self.ssid_template, - self.profile_data['2g']['eap'][self.mode], - self.ssid_data['2g']['eap'][self.mode], + self.profile_data['2g']['eap'][mode], + self.ssid_data['2g']['eap'][mode], None, self.radius_name, "wpa2OnlyRadius", - mode.upper(), 1, - ["is2dot4GHz"]) + self.mode.upper(), self.value, + ["is2dot4GHz"], + radius_profile=self.radius_profile) print("2.4G EAP SSID created successfully - " + mode + " mode") - self.client.update_testrail(case_id=self.test_cases["ssid_5g_eap_" + mode], run_id=self.rid, status_id=1, + time.sleep(self.sleep) + self.client.update_testrail(case_id=self.test_cases["ssid_5g_eap_" + mode], run_id=self.rid, + status_id=1, msg='2.4G EAP SSID created successfully - ' + mode + ' mode') self.test_cases["ssid_5g_eap_" + mode] = "passed" except Exception as ex: @@ -1163,24 +1280,30 @@ class CreateAPProfiles: logging.error(logging.traceback.format_exc()) self.twoFourG_eap = None print("2.4G EAP SSID create failed - bridge mode") - self.client.update_testrail(case_id=self.test_cases["ssid_5g_eap_" + mode], run_id=self.rid, status_id=5, + self.client.update_testrail(case_id=self.test_cases["ssid_5g_eap_" + mode], run_id=self.rid, + status_id=5, msg='2.4G EAP SSID create failed - bridge mode') self.test_cases["ssid_5g_eap_" + mode] = "failed" - if not skip_wpa2: + self.profile_test_data["vif_config"]["ssid_5g_wpa2"] = None + self.profile_test_data["vif_config"]["ssid_2g_wpa2"] = None + self.profile_test_data["ssid_config"]["ssid_5g_wpa2"] = None + self.profile_test_data["ssid_config"]["ssid_2g_wpa2"] = None + # 5g wpa2 try: self.fiveG_wpa2 = self.cloud.create_or_update_ssid_profile(self.command_line_args.sdk_base_url, self.bearer, self.customer_id, self.ssid_template, - self.profile_data['5g']['wpa2'][self.mode], - self.ssid_data['5g']['wpa2'][self.mode], - self.psk_data['5g']['wpa2'][self.mode], + self.profile_data['5g']['wpa2'][mode], + self.ssid_data['5g']['wpa2'][mode], + self.psk_data['5g']['wpa2'][mode], "Radius-Accounting-Profile", "wpa2OnlyPSK", - mode.upper(), 1, + self.mode.upper(), self.value, ["is5GHzU", "is5GHz", "is5GHzL"]) print("5G WPA2 SSID created successfully - " + mode + " mode") + time.sleep(self.sleep) self.client.update_testrail(case_id=self.test_cases["ssid_5g_wpa2_" + mode], run_id=self.rid, status_id=1, msg='5G WPA2 SSID created successfully - ' + mode + ' mode') @@ -1190,7 +1313,8 @@ class CreateAPProfiles: logging.error(logging.traceback.format_exc()) self.fiveG_wpa2 = None print("5G WPA2 SSID create failed - " + mode + " mode") - self.client.update_testrail(case_id=self.test_cases["ssid_5g_wpa2_" + mode], run_id=self.rid, status_id=5, + self.client.update_testrail(case_id=self.test_cases["ssid_5g_wpa2_" + mode], run_id=self.rid, + status_id=5, msg='5G WPA2 SSID create failed - ' + mode + ' mode') self.test_cases["ssid_5g_wpa2_" + mode] = "failed" @@ -1199,13 +1323,15 @@ class CreateAPProfiles: self.twoFourG_wpa2 = self.cloud.create_or_update_ssid_profile(self.command_line_args.sdk_base_url, self.bearer, self.customer_id, self.ssid_template, - self.profile_data['2g']['wpa2'][self.mode], - self.ssid_data['2g']['wpa2'][self.mode], - self.psk_data['2g']['wpa2'][self.mode], + self.profile_data['2g']['wpa2'][ + mode], + self.ssid_data['2g']['wpa2'][mode], + self.psk_data['2g']['wpa2'][mode], "Radius-Accounting-Profile", - "wpa2OnlyPSK", self.mode.upper(), 1, + "wpa2OnlyPSK", self.mode.upper(), self.value, ["is2dot4GHz"]) print("2.4G WPA2 SSID created successfully - " + mode + " mode") + time.sleep(self.sleep) self.client.update_testrail(case_id=self.test_cases["ssid_2g_wpa2_" + mode], run_id=self.rid, status_id=1, msg='2.4G WPA2 SSID created successfully - ' + mode + ' mode') @@ -1215,24 +1341,30 @@ class CreateAPProfiles: logging.error(logging.traceback.format_exc()) self.twoFourG_wpa2 = None print("2.4G WPA2 SSID create failed - " + mode + " mode") - self.client.update_testrail(case_id=test_cases["ssid_2g_wpa2_" + mode], run_id=self.rid, status_id=5, + self.client.update_testrail(case_id=self.test_cases["ssid_2g_wpa2_" + mode], run_id=self.rid, + status_id=5, msg='2.4G WPA2 SSID create failed - ' + mode + ' mode') self.test_cases["ssid_2g_wpa2_" + mode] = "failed" - if not skip_wpa: + self.profile_test_data["vif_config"]["ssid_5g_wpa"] = None + self.profile_test_data["vif_config"]["ssid_2g_wpa"] = None + self.profile_test_data["ssid_config"]["ssid_5g_wpa"] = None + self.profile_test_data["ssid_config"]["ssid_2g_wpa"] = None + # 5g wpa try: self.fiveG_wpa = self.cloud.create_or_update_ssid_profile(self.command_line_args.sdk_base_url, self.bearer, self.customer_id, self.ssid_template, - self.profile_data['5g']['wpa'][self.mode], - self.ssid_data['5g']['wpa'][self.mode], - self.psk_data['5g']['wpa'][self.mode], + self.profile_data['5g']['wpa'][mode], + self.ssid_data['5g']['wpa'][mode], + self.psk_data['5g']['wpa'][mode], "Radius-Accounting-Profile", "wpaPSK", - mode.upper(), 1, + self.mode.upper(), self.value, ["is5GHzU", "is5GHz", "is5GHzL"]) print("5G WPA SSID created successfully - " + mode + " mode") + time.sleep(self.sleep) self.client.update_testrail(case_id=self.test_cases["ssid_5g_wpa_" + mode], run_id=self.rid, status_id=1, @@ -1243,7 +1375,8 @@ class CreateAPProfiles: logging.error(logging.traceback.format_exc()) self.fiveG_wpa = None print("5G WPA SSID create failed - " + mode + " mode") - self.client.update_testrail(case_id=test_cases["ssid_5g_wpa_" + mode], run_id=self.rid, status_id=5, + self.client.update_testrail(case_id=self.test_cases["ssid_5g_wpa_" + mode], run_id=self.rid, + status_id=5, msg='5G WPA SSID create failed - ' + mode + ' mode') self.test_cases["ssid_5g_wpa_" + mode] = "failed" @@ -1252,70 +1385,82 @@ class CreateAPProfiles: self.twoFourG_wpa = self.cloud.create_or_update_ssid_profile(self.command_line_args.sdk_base_url, self.bearer, self.customer_id, self.ssid_template, - self.profile_data['2g']['wpa'][self.mode], - self.ssid_data['2g']['wpa'][self.mode], - self.psk_data['2g']['wpa'][self.mode], + self.profile_data['2g']['wpa'][mode], + self.ssid_data['2g']['wpa'][mode], + self.psk_data['2g']['wpa'][mode], "Radius-Accounting-Profile", "wpaPSK", - mode.upper(), 1, + self.mode.upper(), self.value, ["is2dot4GHz"]) print("2.4G WPA SSID created successfully - " + mode + " mode") - self.client.update_testrail(case_id=self.test_cases["ssid_2g_wpa_" + mode], run_id=self.rid, status_id=1, + time.sleep(self.sleep) + self.client.update_testrail(case_id=self.test_cases["ssid_2g_wpa_" + mode], run_id=self.rid, + status_id=1, msg='2.4G WPA SSID created successfully - ' + mode + ' mode') - self.test_cases["ssid_2g_wpa_" + mode] = "passed" + self.test_cases["ssid_2g_wpa_" + self.mode] = "passed" except Exception as ex: print(ex) logging.error(logging.traceback.format_exc()) self.twoFourG_wpa = None - print("2.4G WPA SSID create failed - " + mode + " mode") - self.client.update_testrail(case_id=self.test_cases["ssid_2g_wpa_" + mode], run_id=self.rid, status_id=5, + print("2.4G WPA SSID create failed - " + self.mode + " mode") + self.client.update_testrail(case_id=self.test_cases["ssid_2g_wpa_" + self.mode], run_id=self.rid, + status_id=5, msg='2.4G WPA SSID create failed - ' + mode + ' mode') - self.test_cases["ssid_2g_wpa_" + mode] = "failed" + self.test_cases["ssid_2g_wpa_" + self.mode] = "failed" - def create_ap_bridge_profile(self, eq_id=None, fw_model=None, mode="bridge"): + def create_ap_profile(self, eq_id=None, fw_model=None, mode="bridge"): self.ssid_prof_config = [] self.ssid_config = [] self.fw_model = fw_model self.rfProfileId = lab_ap_info.rf_profile self.child_profiles = [self.rfProfileId] - if mode == "bridge": - self.mode = "name" - if mode == "nat": - self.mode = "nat" + self.mode = mode + + print("create-ap-bridge-profile: 5G-wpa2: ", self.fiveG_wpa2, " 2g-wpa2: ", self.twoFourG_wpa2) + if self.fiveG_wpa2: self.child_profiles.append(self.fiveG_wpa2) + self.profile_ids.append(self.fiveG_wpa2) self.ssid_prof_config.append(self.profile_data['5g']['wpa2'][self.mode]) self.ssid_config.append(self.ssid_data['5g']['wpa2'][self.mode]) if self.twoFourG_wpa2: self.child_profiles.append(self.twoFourG_wpa2) + self.profile_ids.append(self.twoFourG_wpa2) self.ssid_prof_config.append(self.profile_data['2g']['wpa2'][self.mode]) self.ssid_config.append(self.ssid_data['2g']['wpa2'][self.mode]) if self.fiveG_eap: self.child_profiles.append(self.fiveG_eap) + self.profile_ids.append(self.fiveG_eap) self.ssid_prof_config.append(self.profile_data['5g']['eap'][self.mode]) self.ssid_config.append(self.ssid_data['5g']['eap'][self.mode]) if self.twoFourG_eap: self.child_profiles.append(self.twoFourG_eap) + self.profile_ids.append(self.twoFourG_eap) self.ssid_prof_config.append(self.profile_data['2g']['eap'][self.mode]) self.ssid_config.append(self.ssid_data['2g']['eap'][self.mode]) if self.fiveG_wpa: self.child_profiles.append(self.fiveG_wpa) + self.profile_ids.append(self.fiveG_wpa) self.ssid_prof_config.append(self.profile_data['5g']['wpa'][self.mode]) self.ssid_config.append(self.ssid_data['5g']['wpa'][self.mode]) if self.twoFourG_wpa: self.child_profiles.append(self.twoFourG_wpa) + self.profile_ids.append(self.twoFourG_wpa) self.ssid_prof_config.append(self.profile_data['2g']['wpa'][self.mode]) self.ssid_config.append(self.ssid_data['2g']['wpa'][self.mode]) if self.radius_profile is not None: self.child_profiles.append(self.radius_profile) + self.profile_ids.append(self.radius_profile) # EAP ssid profiles would have been added above if they existed. - name = self.command_line_args.testbed + "-" + self.fw_model + "_" + mode + name = self.command_line_args.testbed + "-" + self.fw_model + "_" + self.mode + + print("child profiles: ", self.child_profiles) try: self.create_ap_profile = self.cloud.create_or_update_ap_profile(self.command_line_args.sdk_base_url, @@ -1325,23 +1470,68 @@ class CreateAPProfiles: self.child_profiles) self.test_profile_id = self.create_ap_profile print("Test Profile ID for Test is:", self.test_profile_id) - self.client.update_testrail(case_id=self.test_cases["ap_"+mode], run_id=self.rid, status_id=1, + time.sleep(5) + self.client.update_testrail(case_id=self.test_cases["ap_" + self.mode], run_id=self.rid, status_id=1, msg='AP profile for ' + mode + ' tests created successfully') - self.test_cases["ap_"+mode] = "passed" + self.test_cases["ap_" + self.mode] = "passed" except Exception as ex: print(ex) logging.error(logging.traceback.format_exc()) create_ap_profile = "error" print("Error creating AP profile for bridge tests. Will use existing AP profile") - self.client.update_testrail(case_id=self.test_cases["ap_"+mode], run_id=self.rid, status_id=5, + self.client.update_testrail(case_id=self.test_cases["ap_" + self.mode], run_id=self.rid, status_id=5, msg='AP profile for ' + mode + ' tests could not be created using API') - self.test_cases["ap_"+mode] = "failed" + self.test_cases["ap_" + self.mode] = "failed" - self.ap_profile = self.cloud.set_ap_profile(eq_id, self.test_profile_id, self.command_line_args.sdk_base_url, - self.bearer) + self.ap_profile = self.cloud.set_ap_profile(eq_id, self.test_profile_id) + self.profile_ids.append(self.ap_profile) - def cleanup_profile(self): - pass + # should be called after test completion + def cleanup_profile(self, equipment_id=None): + profile_info_dict = { + "profile_id": "2", + "childProfileIds": [ + 3647, + 10, + 11, + 12, + 13, + 190, + 191 + ], + "fiveG_WPA2_SSID": "ECW5410_5G_WPA2", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "ECW5410_5G_WPA", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "ECW5410_5G_OPEN", + "fiveG_WPA2-EAP_SSID": "ECW5410_5G_WPA2-EAP", + "twoFourG_OPEN_SSID": "ECW5410_2dot4G_OPEN", + "twoFourG_WPA2_SSID": "ECW5410_2dot4G_WPA2", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "ECW5410_2dot4G_WPA", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "ECW5410_2dot4G_WPA2-EAP", + "fiveG_WPA2_profile": 3647, + "fiveG_WPA_profile": 13, + "fiveG_WPA2-EAP_profile": 191, + "twoFourG_WPA2_profile": 11, + "twoFourG_WPA_profile": 12, + "twoFourG_WPA2-EAP_profile": 190, + "ssid_list": [ + "ECW5410_5G_WPA2", + "ECW5410_5G_WPA", + "ECW5410_5G_WPA2-EAP", + "ECW5410_2dot4G_WPA2", + "ECW5410_2dot4G_WPA", + "ECW5410_2dot4G_WPA2-EAP" + ] + } + ap_profile = self.cloud.set_ap_profile(equipment_id, profile_info_dict["profile_id"]) + time.sleep(5) + for i in self.profile_ids: + if i is not None: + self.cloud.delete_customer_profile(self.command_line_args.sdk_base_url, self.bearer, i) + time.sleep(5) def validate_changes(self, mode="bridge"): @@ -1410,3 +1600,4 @@ class CreateAPProfiles: self.test_cases[mode + "_vifs"] = "error" print("Profiles Created") + self.profile_test_data = {"ssid_config": self.ssid_config, "vif_config": ssid_state} diff --git a/libs/lab_ap_info.py b/libs/lab_ap_info.py index 9ef5b3fb5..b82278560 100755 --- a/libs/lab_ap_info.py +++ b/libs/lab_ap_info.py @@ -1,15 +1,25 @@ #!/usr/bin/python3 ##AP Models Under Test -ap_models = ["ec420","ea8300","ecw5211","ecw5410"] +ap_models = ["ec420","ea8300","ecw5211","ecw5410", "wf188n", "wf194c", "ex227", "ex447", "eap101", "eap102"] ##Cloud Type(cloudSDK = v1, CMAP = cmap) cloud_type = "v1" +##LANForge Info +lanforge_ip = "10.10.10.201" +lanforge_2dot4g = "wiphy6" +lanforge_5g = "wiphy6" +# For single client connectivity use cases, use full station name for prefix to only read traffic from client under test +lanforge_2dot4g_prefix = "wlan6" +lanforge_5g_prefix = "wlan6" +lanforge_2dot4g_station = "wlan6" +lanforge_5g_station = "wlan6" + ##RADIUS Info radius_info = { - "name": "Lab-RADIUS", + "name": "Automation_RADIUS", "subnet_name": "Lab", "subnet": "10.10.0.0", "subnet_mask": 16, @@ -25,26 +35,92 @@ cloud_sdk_models = { "ea8300": "EA8300-CA", "ecw5211": "ECW5211", "ecw5410": "ECW5410", - "wf188n": "WF188N" + "wf188n": "WF188N", + "wf194c": "WF194C", + "ex227": "EX227", + "ex447": "EX447", + "eap101": "EAP101", + "eap102": "EAP102" } mimo_5g = { "ec420": "4x4", "ea8300": "2x2", "ecw5211": "2x2", - "ecw5410": "4x4" + "ecw5410": "4x4", + "wf188n": "2x2", + "wf194c": "8x8", + "ex227": "", + "ex447": "", + "eap101": "2x2", + "eap102": "4x4" } mimo_2dot4g = { "ec420": "2x2", "ea8300": "2x2", "ecw5211": "2x2", - "ecw5410": "4x4" + "ecw5410": "4x4", + "wf188n": "2x2", + "wf194c": "4x4", + "ex227": "", + "ex447": "", + "eap101": "2x2", + "eap102": "4x4" +} + +sanity_status = { + "ea8300": "failed", + "ecw5211": 'passed', + "ecw5410": 'failed', + "ec420": 'failed', + "wf188n": "failed", + "wf194c": "failed", + "ex227": "failed", + "ex447": "failed", + "eap101": "failed", + "eap102": "failed" } ##Customer ID for testing customer_id = "2" +##Equipment IDs for Lab APs under test +equipment_id_dict = { + "ea8300": "115", + "ecw5410": "116", + "ecw5211": "117", + "ec420": "27", + "wf188n": "135", + "ex227": "148", + "eap102": "147", + "wf194c": "152" +} + +equipment_ip_dict = { + "ea8300": "10.10.10.103", + "ecw5410": "10.10.10.105", + "ec420": "10.10.10.104", + "ecw5211": "10.10.10.102", + "wf188n": "10.10.10.179", + "wf194c": "10.10.10.184", + "ex227": "10.10.10.182", + "eap102": "10.10.10.183" +} + +eqiupment_credentials_dict = { + "ea8300": "openwifi", + "ecw5410": "openwifi", + "ec420": "openwifi", + "ecw5211": "admin123", + "wf188n": "openwifi", + "wf194c": "openwifi", + "ex227": "openwifi", + "ex447": "openwifi", + "eap101": "openwifi", + "eap102": "openwifi" +} + ##Test Case information - Maps a generic TC name to TestRail TC numbers test_cases = { "ap_upgrade": 2233, @@ -102,5 +178,1190 @@ test_cases = { } ## Other profiles -radius_profile = 129 +radius_profile = 4159 rf_profile = 10 + +###Testing AP Profile Information +profile_info_dict = { + "ecw5410": { + "profile_id": "2", + "childProfileIds": [ + 3647, + 10, + 11, + 12, + 13, + 190, + 191 + ], + "fiveG_WPA2_SSID": "ECW5410_5G_WPA2", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "ECW5410_5G_WPA", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "ECW5410_5G_OPEN", + "fiveG_WPA2-EAP_SSID": "ECW5410_5G_WPA2-EAP", + "twoFourG_OPEN_SSID": "ECW5410_2dot4G_OPEN", + "twoFourG_WPA2_SSID": "ECW5410_2dot4G_WPA2", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "ECW5410_2dot4G_WPA", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "ECW5410_2dot4G_WPA2-EAP", + "fiveG_WPA2_profile": 3647, + "fiveG_WPA_profile": 13, + "fiveG_WPA2-EAP_profile": 191, + "twoFourG_WPA2_profile": 11, + "twoFourG_WPA_profile": 12, + "twoFourG_WPA2-EAP_profile": 190, + "ssid_list": [ + "ECW5410_5G_WPA2", + "ECW5410_5G_WPA", + "ECW5410_5G_WPA2-EAP", + "ECW5410_2dot4G_WPA2", + "ECW5410_2dot4G_WPA", + "ECW5410_2dot4G_WPA2-EAP" + ] + }, + + "ea8300": { + "profile_id": "153", + "childProfileIds": [ + 17, + 18, + 201, + 202, + 10, + 14, + 15 + ], + "fiveG_WPA2_SSID": "EA8300_5G_WPA2", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "EA8300_5G_WPA", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "EA8300_5G_OPEN", + "fiveG_WPA2-EAP_SSID": "EA8300_5G_WPA2-EAP", + "twoFourG_OPEN_SSID": "EA8300_2dot4G_OPEN", + "twoFourG_WPA2_SSID": "EA8300_2dot4G_WPA2", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "EA8300_2dot4G_WPA", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "EA8300_2dot4G_WPA2-EAP", + "fiveG_WPA2_profile": 14, + "fiveG_WPA_profile": 15, + "fiveG_WPA2-EAP_profile": 202, + "twoFourG_WPA2_profile": 17, + "twoFourG_WPA_profile": 18, + "twoFourG_WPA2-EAP_profile": 201, + # 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": { + "profile_id": "20", + "childProfileIds": [ + 209, + 210, + 21, + 22, + 24, + 25, + 10 + ], + "fiveG_WPA2_SSID": "EC420_5G_WPA2", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "EC420_5G_WPA", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "EC420_5G_OPEN", + "fiveG_WPA2-EAP_SSID": "EC420_5G_WPA2-EAP", + "twoFourG_OPEN_SSID": "EC420_2dot4G_OPEN", + "twoFourG_WPA2_SSID": "EC420_2dot4G_WPA2", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "EC420_2dot4G_WPA", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "EC420_2dot4G_WPA2-EAP", + "fiveG_WPA2_profile": 21, + "fiveG_WPA_profile": 22, + "fiveG_WPA2-EAP_profile": 210, + "twoFourG_WPA2_profile": 24, + "twoFourG_WPA_profile": 25, + "twoFourG_WPA2-EAP_profile": 209, + "ssid_list": [ + "EC420_5G_WPA2", + "EC420_5G_WPA", + "EC420_5G_WPA2-EAP", + "EC420_2dot4G_WPA2", + "EC420_2dot4G_WPA", + "EC420_2dot4G_WPA2-EAP" + ] + }, + + "ecw5211": { + "profile_id": "27", + "childProfileIds": [ + 32, + 10, + 28, + 29, + 205, + 206, + 31 + ], + "fiveG_WPA2_SSID": "ECW5211_5G_WPA2", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "ECW5211_5G_WPA", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "ECW5211_5G_OPEN", + "fiveG_WPA2-EAP_SSID": "ECW5211_5G_WPA2-EAP", + "twoFourG_OPEN_SSID": "ECW5211_2dot4G_OPEN", + "twoFourG_WPA2_SSID": "ECW5211_2dot4G_WPA2", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "ECW5211_2dot4G_WPA", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "ECW5211_2dot4G_WPA2-EAP", + "fiveG_WPA2_profile": 28, + "fiveG_WPA_profile": 29, + "fiveG_WPA2-EAP_profile": 206, + "twoFourG_WPA2_profile": 31, + "twoFourG_WPA_profile": 32, + "twoFourG_WPA2-EAP_profile": 205, + "ssid_list": [ + "ECW5211_5G_WPA2", + "ECW5211_5G_WPA", + "ECW5211_5G_WPA2-EAP", + "ECW5211_2dot4G_WPA2", + "ECW5211_2dot4G_WPA", + "ECW5211_2dot4G_WPA2-EAP" + ] + }, + + "wf188n": { + "profile_id": "3724", + "childProfileIds": [ + 3718, + 3719, + 3720, + 3721, + 3722, + 3723, + 10 + ], + "fiveG_WPA2_SSID": "WF188N_5G_WPA2", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "WF188N_5G_WPA", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "WF188N_5G_OPEN", + "fiveG_WPA2-EAP_SSID": "WF188N_5G_WPA2-EAP", + "twoFourG_OPEN_SSID": "WF188N_2dot4G_OPEN", + "twoFourG_WPA2_SSID": "WF188N_2dot4G_WPA2", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "WF188N_2dot4G_WPA", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "WF188N_2dot4G_WPA2-EAP", + "fiveG_WPA2_profile": 3719, + "fiveG_WPA_profile": 3720, + "fiveG_WPA2-EAP_profile": 3718, + "twoFourG_WPA2_profile": 3722, + "twoFourG_WPA_profile": 3723, + "twoFourG_WPA2-EAP_profile": 3721, + "ssid_list": [ + "WF188N_5G_WPA2", + "WF188N_5G_WPA", + "WF188N_5G_WPA2-EAP", + "WF188N_2dot4G_WPA2", + "WF188N_2dot4G_WPA", + "WF188N_2dot4G_WPA2-EAP" + ] + }, + + "wf194c": { + "profile_id": "4306", + "childProfileIds": [ + 4307, + 4308, + 4309, + 4310, + 4311, + 4312, + 10 + ], + "fiveG_WPA2_SSID": "WF194C_5G_WPA2", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "WF194C_5G_WPA", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "WF194C_5G_OPEN", + "fiveG_WPA2-EAP_SSID": "WF194C_5G_WPA2-EAP", + "twoFourG_OPEN_SSID": "WF194C_2dot4G_OPEN", + "twoFourG_WPA2_SSID": "WF194C_2dot4G_WPA2", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "WF194C_2dot4G_WPA", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "WF194C_2dot4G_WPA2-EAP", + "fiveG_WPA2_profile": 4308, + "fiveG_WPA_profile": 4307, + "fiveG_WPA2-EAP_profile": 4309, + "twoFourG_WPA2_profile": 4311, + "twoFourG_WPA_profile": 4310, + "twoFourG_WPA2-EAP_profile": 4312, + "ssid_list": [ + "WF194C_5G_WPA2", + "WF194C_5G_WPA", + "WF194C_5G_WPA2-EAP", + "WF194C_2dot4G_WPA2", + "WF194C_2dot4G_WPA", + "WF194C_2dot4G_WPA2-EAP" + ] + }, + + "ex227": { + "profile_id": "4964", + "childProfileIds": [ + 4958, + 4959, + 4960, + 4961, + 4962, + 4963, + 10 + ], + "fiveG_WPA2_SSID": "EX227_5G_WPA2", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "EX227_5G_WPA", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "EX227_5G_OPEN", + "fiveG_WPA2-EAP_SSID": "EX227_5G_WPA2-EAP", + "twoFourG_OPEN_SSID": "EX227_2dot4G_OPEN", + "twoFourG_WPA2_SSID": "EX227_2dot4G_WPA2", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "EX227_2dot4G_WPA", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "EX227_2dot4G_WPA2-EAP", + "fiveG_WPA2_profile": 4959, + "fiveG_WPA_profile": 4960, + "fiveG_WPA2-EAP_profile": 4958, + "twoFourG_WPA2_profile": 4962, + "twoFourG_WPA_profile": 4963, + "twoFourG_WPA2-EAP_profile": 4961, + "ssid_list": [ + "EX227_5G_WPA2", + "EX227_5G_WPA", + "EX227_5G_WPA2-EAP", + "EX227_2dot4G_WPA2", + "EX227_2dot4G_WPA", + "EX227_2dot4G_WPA2-EAP" + ] + }, + + "ex447": { + "profile_id": "5008", + "childProfileIds": [ + 5002, + 5003, + 5004, + 5005, + 5006, + 5007, + 10 + ], + "fiveG_WPA2_SSID": "EX447_5G_WPA2", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "EX447_5G_WPA", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "EX447_5G_OPEN", + "fiveG_WPA2-EAP_SSID": "EX447_5G_WPA2-EAP", + "twoFourG_OPEN_SSID": "EX447_2dot4G_OPEN", + "twoFourG_WPA2_SSID": "EX447_2dot4G_WPA2", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "EX447_2dot4G_WPA", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "EX447_2dot4G_WPA2-EAP", + "fiveG_WPA2_profile": 5003, + "fiveG_WPA_profile": 5004, + "fiveG_WPA2-EAP_profile": 5002, + "twoFourG_WPA2_profile": 5006, + "twoFourG_WPA_profile": 5007, + "twoFourG_WPA2-EAP_profile": 5005, + "ssid_list": [ + "EX447_5G_WPA2", + "EX447_5G_WPA", + "EX447_5G_WPA2-EAP", + "EX447_2dot4G_WPA2", + "EX447_2dot4G_WPA", + "EX447_2dot4G_WPA2-EAP" + ] + }, + + "eap101": { + "profile_id": "5029", + "childProfileIds": [ + 5023, + 5024, + 5025, + 5026, + 5027, + 5028, + 10 + ], + "fiveG_WPA2_SSID": "EAP101_5G_WPA2", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "EAP101_5G_WPA", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "EAP101_5G_OPEN", + "fiveG_WPA2-EAP_SSID": "EAP101_5G_WPA2-EAP", + "twoFourG_OPEN_SSID": "EAP101_2dot4G_OPEN", + "twoFourG_WPA2_SSID": "EAP101_2dot4G_WPA2", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "EAP101_2dot4G_WPA", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "EAP101_2dot4G_WPA2-EAP", + "fiveG_WPA2_profile": 5024, + "fiveG_WPA_profile": 5025, + "fiveG_WPA2-EAP_profile": 5023, + "twoFourG_WPA2_profile": 5027, + "twoFourG_WPA_profile": 5028, + "twoFourG_WPA2-EAP_profile": 5026, + "ssid_list": [ + "EAP101_5G_WPA2", + "EAP101_5G_WPA", + "EAP101_5G_WPA2-EAP", + "EAP101_2dot4G_WPA2", + "EAP101_2dot4G_WPA", + "EAP101_2dot4G_WPA2-EAP" + ] + }, + + "eap102": { + "profile_id": "5050", + "childProfileIds": [ + 5044, + 5045, + 5046, + 5057, + 5048, + 5049, + 10 + ], + "fiveG_WPA2_SSID": "EAP102_5G_WPA2", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "EAP102_5G_WPA", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "EAP102_5G_OPEN", + "fiveG_WPA2-EAP_SSID": "EAP102_5G_WPA2-EAP", + "twoFourG_OPEN_SSID": "EAP102_2dot4G_OPEN", + "twoFourG_WPA2_SSID": "EAP102_2dot4G_WPA2", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "EAP102_2dot4G_WPA", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "EAP102_2dot4G_WPA2-EAP", + "fiveG_WPA2_profile": 5045, + "fiveG_WPA_profile": 5046, + "fiveG_WPA2-EAP_profile": 5044, + "twoFourG_WPA2_profile": 5048, + "twoFourG_WPA_profile": 5049, + "twoFourG_WPA2-EAP_profile": 5047, + "ssid_list": [ + "EAP102_5G_WPA2", + "EAP102_5G_WPA", + "EAP102_5G_WPA2-EAP", + "EAP102_2dot4G_WPA2", + "EAP102_2dot4G_WPA", + "EAP102_2dot4G_WPA2-EAP" + ] + }, + + "ecw5410_nat": { + "profile_id": "68", + "childProfileIds": [ + 192, + 81, + 193, + 82, + 10, + 78, + 79 + ], + "fiveG_WPA2_SSID": "ECW5410_5G_WPA2_NAT", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "ECW5410_5G_WPA_NAT", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "ECW5410_5G_OPEN_NAT", + "fiveG_WPA2-EAP_SSID": "ECW5410_5G_WPA2-EAP_NAT", + "twoFourG_OPEN_SSID": "ECW5410_2dot4G_OPEN_NAT", + "twoFourG_WPA2_SSID": "ECW5410_2dot4G_WPA2_NAT", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "ECW5410_2dot4G_WPA_NAT", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "ECW5410_2dot4G_WPA2-EAP_NAT", + "fiveG_WPA2_profile": 78, + "fiveG_WPA_profile": 79, + "fiveG_WPA2-EAP_profile": 192, + "twoFourG_WPA2_profile": 81, + "twoFourG_WPA_profile": 82, + "twoFourG_WPA2-EAP_profile": 193, + "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": { + "profile_id": "67", + "childProfileIds": [ + 72, + 73, + 10, + 75, + 203, + 76, + 204 + ], + "fiveG_WPA2_SSID": "EA8300_5G_WPA2_NAT", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "EA8300_5G_WPA_NAT", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "EA8300_5G_OPEN_NAT", + "fiveG_WPA2-EAP_SSID": "EA8300_5G_WPA2-EAP_NAT", + "twoFourG_OPEN_SSID": "EA8300_2dot4G_OPEN_NAT", + "twoFourG_WPA2_SSID": "EA8300_2dot4G_WPA2_NAT", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "EA8300_2dot4G_WPA_NAT", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "EA8300_2dot4G_WPA2-EAP_NAT", + "fiveG_WPA2_profile": 72, + "fiveG_WPA_profile": 73, + "fiveG_WPA2-EAP_profile": 203, + "twoFourG_WPA2_profile": 75, + "twoFourG_WPA_profile": 76, + "twoFourG_WPA2-EAP_profile": 204, + # 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": { + "profile_id": "70", + "childProfileIds": [ + 211, + 212, + 90, + 10, + 91, + 93, + 94 + ], + "fiveG_WPA2_SSID": "EC420_5G_WPA2_NAT", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "EC420_5G_WPA_NAT", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "EC420_5G_OPEN_NAT", + "fiveG_WPA2-EAP_SSID": "EC420_5G_WPA2-EAP_NAT", + "twoFourG_OPEN_SSID": "EC420_2dot4G_OPEN_NAT", + "twoFourG_WPA2_SSID": "EC420_2dot4G_WPA2_NAT", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "EC420_2dot4G_WPA_NAT", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "EC420_2dot4G_WPA2-EAP_NAT", + "fiveG_WPA2_profile": 90, + "fiveG_WPA_profile": 91, + "fiveG_WPA2-EAP_profile": 211, + "twoFourG_WPA2_profile": 93, + "twoFourG_WPA_profile": 94, + "twoFourG_WPA2-EAP_profile": 212, + "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": { + "profile_id": "69", + "childProfileIds": [ + 208, + 84, + 85, + 87, + 88, + 10, + 207 + ], + "fiveG_WPA2_SSID": "ECW5211_5G_WPA2_NAT", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "ECW5211_5G_WPA_NAT", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "ECW5211_5G_OPEN_NAT", + "fiveG_WPA2-EAP_SSID": "ECW5211_5G_WPA2-EAP_NAT", + "twoFourG_OPEN_SSID": "ECW5211_2dot4G_OPEN_NAT", + "twoFourG_WPA2_SSID": "ECW5211_2dot4G_WPA2_NAT", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "ECW5211_2dot4G_WPA_NAT", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "ECW5211_2dot4G_WPA2-EAP_NAT", + "fiveG_WPA2_profile": 84, + "fiveG_WPA_profile": 85, + "fiveG_WPA2-EAP_profile": 207, + "twoFourG_WPA2_profile": 87, + "twoFourG_WPA_profile": 88, + "twoFourG_WPA2-EAP_profile": 208, + "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" + ] + }, + + "wf188n_nat": { + "profile_id": "3732", + "childProfileIds": [ + 3728, + 3729, + 3730, + 3731, + 10, + 3726, + 3727 + ], + "fiveG_WPA2_SSID": "WF188N_5G_WPA2_NAT", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "WF188N_5G_WPA_NAT", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "WF188N_5G_OPEN_NAT", + "fiveG_WPA2-EAP_SSID": "WF188N_5G_WPA2-EAP_NAT", + "twoFourG_OPEN_SSID": "WF188N_2dot4G_OPEN_NAT", + "twoFourG_WPA2_SSID": "WF188N_2dot4G_WPA2_NAT", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "WF188N_2dot4G_WPA_NAT", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "WF188N_2dot4G_WPA2-EAP_NAT", + "fiveG_WPA2_profile": 3727, + "fiveG_WPA_profile": 3728, + "fiveG_WPA2-EAP_profile": 3726, + "twoFourG_WPA2_profile": 3730, + "twoFourG_WPA_profile": 3731, + "twoFourG_WPA2-EAP_profile": 3729, + "ssid_list": [ + "WF188N_5G_WPA2_NAT", + "WF188N_5G_WPA_NAT", + "WF188N_5G_WPA2-EAP_NAT", + "WF188N_2dot4G_WPA2_NAT", + "WF188N_2dot4G_WPA_NAT", + "WF188N_2dot4G_WPA2-EAP_NAT" + ] + }, + + "wf194c_nat": { + "profile_id": "4416", + "childProfileIds": [ + 4410, + 4411, + 4412, + 4413, + 10, + 4414, + 4415 + ], + "fiveG_WPA2_SSID": "WF194C_5G_WPA2_NAT", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "WF194C_5G_WPA_NAT", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "WF194C_5G_OPEN_NAT", + "fiveG_WPA2-EAP_SSID": "WF194C_5G_WPA2-EAP_NAT", + "twoFourG_OPEN_SSID": "WF194C_2dot4G_OPEN_NAT", + "twoFourG_WPA2_SSID": "WF194C_2dot4G_WPA2_NAT", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "WF194C_2dot4G_WPA_NAT", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "WF194C_2dot4G_WPA2-EAP_NAT", + "fiveG_WPA2_profile": 4411, + "fiveG_WPA_profile": 4412, + "fiveG_WPA2-EAP_profile": 4410, + "twoFourG_WPA2_profile": 4414, + "twoFourG_WPA_profile": 4415, + "twoFourG_WPA2-EAP_profile": 4413, + "ssid_list": [ + "WF194C_5G_WPA2_NAT", + "WF194C_5G_WPA_NAT", + "WF194C_5G_WPA2-EAP_NAT", + "WF194C_2dot4G_WPA2_NAT", + "WF194C_2dot4G_WPA_NAT", + "WF194C_2dot4G_WPA2-EAP_NAT" + ] + }, + + "ex227_nat": { + "profile_id": "4971", + "childProfileIds": [ + 4965, + 4966, + 4967, + 4968, + 10, + 4969, + 4970 + ], + "fiveG_WPA2_SSID": "EX227_5G_WPA2_NAT", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "EX227_5G_WPA_NAT", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "EX227_5G_OPEN_NAT", + "fiveG_WPA2-EAP_SSID": "EX227_5G_WPA2-EAP_NAT", + "twoFourG_OPEN_SSID": "EX227_2dot4G_OPEN_NAT", + "twoFourG_WPA2_SSID": "EX227_2dot4G_WPA2_NAT", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "EX227_2dot4G_WPA_NAT", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "EX227_2dot4G_WPA2-EAP_NAT", + "fiveG_WPA2_profile": 4966, + "fiveG_WPA_profile": 4967, + "fiveG_WPA2-EAP_profile": 4965, + "twoFourG_WPA2_profile": 4969, + "twoFourG_WPA_profile": 4970, + "twoFourG_WPA2-EAP_profile": 4968, + "ssid_list": [ + "EX227_5G_WPA2_NAT", + "EX227_5G_WPA_NAT", + "EX227_5G_WPA2-EAP_NAT", + "EX227_2dot4G_WPA2_NAT", + "EX227_2dot4G_WPA_NAT", + "EX227_2dot4G_WPA2-EAP_NAT" + ] + }, + + "ex447_nat": { + "profile_id": "5015", + "childProfileIds": [ + 5009, + 5010, + 5011, + 5012, + 10, + 5013, + 5014 + ], + "fiveG_WPA2_SSID": "EX447_5G_WPA2_NAT", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "EX447_5G_WPA_NAT", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "EX447_5G_OPEN_NAT", + "fiveG_WPA2-EAP_SSID": "EX447_5G_WPA2-EAP_NAT", + "twoFourG_OPEN_SSID": "EX447_2dot4G_OPEN_NAT", + "twoFourG_WPA2_SSID": "EX447_2dot4G_WPA2_NAT", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "EX447_2dot4G_WPA_NAT", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "EX447_2dot4G_WPA2-EAP_NAT", + "fiveG_WPA2_profile": 5010, + "fiveG_WPA_profile": 5011, + "fiveG_WPA2-EAP_profile": 5009, + "twoFourG_WPA2_profile": 5013, + "twoFourG_WPA_profile": 5014, + "twoFourG_WPA2-EAP_profile": 5012, + "ssid_list": [ + "EX447_5G_WPA2_NAT", + "EX447_5G_WPA_NAT", + "EX447_5G_WPA2-EAP_NAT", + "EX447_2dot4G_WPA2_NAT", + "EX447_2dot4G_WPA_NAT", + "EX447_2dot4G_WPA2-EAP_NAT" + ] + }, + + "eap102_nat": { + "profile_id": "5057", + "childProfileIds": [ + 5051, + 5052, + 5053, + 5054, + 10, + 5055, + 5056 + ], + "fiveG_WPA2_SSID": "EAP102_5G_WPA2_NAT", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "EAP102_5G_WPA_NAT", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "EAP102_5G_OPEN_NAT", + "fiveG_WPA2-EAP_SSID": "EAP102_5G_WPA2-EAP_NAT", + "twoFourG_OPEN_SSID": "EAP102_2dot4G_OPEN_NAT", + "twoFourG_WPA2_SSID": "EAP102_2dot4G_WPA2_NAT", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "EAP102_2dot4G_WPA_NAT", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "EAP102_2dot4G_WPA2-EAP_NAT", + "fiveG_WPA2_profile": 5052, + "fiveG_WPA_profile": 5053, + "fiveG_WPA2-EAP_profile": 5051, + "twoFourG_WPA2_profile": 5055, + "twoFourG_WPA_profile": 5056, + "twoFourG_WPA2-EAP_profile": 5054, + "ssid_list": [ + "EAP102_5G_WPA2_NAT", + "EAP102_5G_WPA_NAT", + "EAP102_5G_WPA2-EAP_NAT", + "EAP102_2dot4G_WPA2_NAT", + "EAP102_2dot4G_WPA_NAT", + "EAP102_2dot4G_WPA2-EAP_NAT" + ] + }, + + "eap101_nat": { + "profile_id": "5036", + "childProfileIds": [ + 5030, + 5031, + 5032, + 5033, + 10, + 5034, + 5035 + ], + "fiveG_WPA2_SSID": "EAP101_5G_WPA2_NAT", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "EAP101_5G_WPA_NAT", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "EAP101_5G_OPEN_NAT", + "fiveG_WPA2-EAP_SSID": "EAP101_5G_WPA2-EAP_NAT", + "twoFourG_OPEN_SSID": "EAP101_2dot4G_OPEN_NAT", + "twoFourG_WPA2_SSID": "EAP101_2dot4G_WPA2_NAT", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "EAP101_2dot4G_WPA_NAT", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "EAP101_2dot4G_WPA2-EAP_NAT", + "fiveG_WPA2_profile": 5031, + "fiveG_WPA_profile": 5032, + "fiveG_WPA2-EAP_profile": 5030, + "twoFourG_WPA2_profile": 5034, + "twoFourG_WPA_profile": 5035, + "twoFourG_WPA2-EAP_profile": 5033, + "ssid_list": [ + "EAP101_5G_WPA2_NAT", + "EAP101_5G_WPA_NAT", + "EAP101_5G_WPA2-EAP_NAT", + "EAP101_2dot4G_WPA2_NAT", + "EAP101_2dot4G_WPA_NAT", + "EAP101_2dot4G_WPA2-EAP_NAT" + ] + }, + + "ecw5410_vlan": { + "profile_id": "338", + "childProfileIds": [ + 336, + 320, + 337, + 10, + 333, + 334, + 335 + ], + "fiveG_WPA2_SSID": "ECW5410_5G_WPA2_VLAN", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "ECW5410_5G_WPA_VLAN", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "ECW5410_5G_OPEN_VLAN", + "fiveG_WPA2-EAP_SSID": "ECW5410_5G_WPA2-EAP_VLAN", + "twoFourG_OPEN_SSID": "ECW5410_2dot4G_OPEN_VLAN", + "twoFourG_WPA2_SSID": "ECW5410_2dot4G_WPA2_VLAN", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "ECW5410_2dot4G_WPA_VLAN", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "ECW5410_2dot4G_WPA2-EAP_VLAN", + "fiveG_WPA2_profile": 320, + "fiveG_WPA_profile": 333, + "fiveG_WPA2-EAP_profile": 337, + "twoFourG_WPA2_profile": 334, + "twoFourG_WPA_profile": 335, + "twoFourG_WPA2-EAP_profile": 336, + "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": { + "profile_id": "319", + "childProfileIds": [ + 313, + 10, + 314, + 315, + 316, + 317, + 318 + ], + "fiveG_WPA2_SSID": "EA8300_5G_WPA2_VLAN", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "EA8300_5G_WPA_VLAN", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "EA8300_5G_OPEN_VLAN", + "fiveG_WPA2-EAP_SSID": "EA8300_5G_WPA2-EAP_VLAN", + "twoFourG_OPEN_SSID": "EA8300_2dot4G_OPEN_VLAN", + "twoFourG_WPA2_SSID": "EA8300_2dot4G_WPA2_VLAN", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "EA8300_2dot4G_WPA_VLAN", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "EA8300_2dot4G_WPA2-EAP_VLAN", + "fiveG_WPA2_profile": 313, + "fiveG_WPA_profile": 314, + "fiveG_WPA2-EAP_profile": 318, + "twoFourG_WPA2_profile": 315, + "twoFourG_WPA_profile": 316, + "twoFourG_WPA2-EAP_profile": 317, + # 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": { + "profile_id": "357", + "childProfileIds": [ + 352, + 353, + 354, + 355, + 356, + 10, + 351 + ], + "fiveG_WPA2_SSID": "EC420_5G_WPA2_VLAN", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "EC420_5G_WPA_VLAN", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "EC420_5G_OPEN_VLAN", + "fiveG_WPA2-EAP_SSID": "EC420_5G_WPA2-EAP_VLAN", + "twoFourG_OPEN_SSID": "EC420_2dot4G_OPEN_VLAN", + "twoFourG_WPA2_SSID": "EC420_2dot4G_WPA2_VLAN", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "EC420_2dot4G_WPA_VLAN", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "EC420_2dot4G_WPA2-EAP_VLAN", + "fiveG_WPA2_profile": 351, + "fiveG_WPA_profile": 352, + "fiveG_WPA2-EAP_profile": 356, + "twoFourG_WPA2_profile": 353, + "twoFourG_WPA_profile": 354, + "twoFourG_WPA2-EAP_profile": 355, + "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": { + "profile_id": "364", + "childProfileIds": [ + 358, + 359, + 360, + 361, + 10, + 362, + 363 + ], + "fiveG_WPA2_SSID": "ECW5211_5G_WPA2_VLAN", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "ECW5211_5G_WPA_VLAN", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "ECW5211_5G_OPEN_VLAN", + "fiveG_WPA2-EAP_SSID": "ECW5211_5G_WPA2-EAP_VLAN", + "twoFourG_OPEN_SSID": "ECW5211_2dot4G_OPEN_VLAN", + "twoFourG_WPA2_SSID": "ECW5211_2dot4G_WPA2_VLAN", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "ECW5211_2dot4G_WPA_VLAN", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "ECW5211_2dot4G_WPA2-EAP_VLAN", + "fiveG_WPA2_profile": 358, + "fiveG_WPA_profile": 359, + "fiveG_WPA2-EAP_profile": 363, + "twoFourG_WPA2_profile": 360, + "twoFourG_WPA_profile": 361, + "twoFourG_WPA2-EAP_profile": 362, + "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" + ] + }, + + "wf188n_vlan": { + "profile_id": "3740", + "childProfileIds": [ + 3734, + 3735, + 3736, + 3737, + 3738, + 10, + 3739 + ], + "fiveG_WPA2_SSID": "WF188N_5G_WPA2_VLAN", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "WF188N_5G_WPA_VLAN", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "WF188N_5G_OPEN_VLAN", + "fiveG_WPA2-EAP_SSID": "WF188N_5G_WPA2-EAP_VLAN", + "twoFourG_OPEN_SSID": "WF188N_2dot4G_OPEN_VLAN", + "twoFourG_WPA2_SSID": "WF188N_2dot4G_WPA2_VLAN", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "WF188N_2dot4G_WPA_VLAN", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "WF188N_2dot4G_WPA2-EAP_VLAN", + "fiveG_WPA2_profile": 3738, + "fiveG_WPA_profile": 3739, + "fiveG_WPA2-EAP_profile": 3737, + "twoFourG_WPA2_profile": 3722, + "twoFourG_WPA_profile": 3723, + "twoFourG_WPA2-EAP_profile": 3721, + "ssid_list": [ + "WF188N_5G_WPA2_VLAN", + "WF188N_5G_WPA_VLAN", + "WF188N_5G_WPA2-EAP_VLAN", + "WF188N_2dot4G_WPA2_VLAN", + "WF188N_2dot4G_WPA_VLAN", + "WF188N_2dot4G_WPA2-EAP_VLAN" + ] + }, + + "wf194c_vlan": { + "profile_id": "4429", + "childProfileIds": [ + 4423, + 4424, + 4425, + 4426, + 4427, + 10, + 4428 + ], + "fiveG_WPA2_SSID": "WF194C_5G_WPA2_VLAN", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "WF194C_5G_WPA_VLAN", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "WF194C_5G_OPEN_VLAN", + "fiveG_WPA2-EAP_SSID": "WF194C_5G_WPA2-EAP_VLAN", + "twoFourG_OPEN_SSID": "WF194C_2dot4G_OPEN_VLAN", + "twoFourG_WPA2_SSID": "WF194C_2dot4G_WPA2_VLAN", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "WF194C_2dot4G_WPA_VLAN", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "WF194C_2dot4G_WPA2-EAP_VLAN", + "fiveG_WPA2_profile": 4424, + "fiveG_WPA_profile": 4425, + "fiveG_WPA2-EAP_profile": 4423, + "twoFourG_WPA2_profile": 4427, + "twoFourG_WPA_profile": 4428, + "twoFourG_WPA2-EAP_profile": 4426, + "ssid_list": [ + "WF194C_5G_WPA2_VLAN", + "WF194C_5G_WPA_VLAN", + "WF194C_5G_WPA2-EAP_VLAN", + "WF194C_2dot4G_WPA2_VLAN", + "WF194C_2dot4G_WPA_VLAN", + "WF194C_2dot4G_WPA2-EAP_VLAN" + ] + }, + + "ex227_vlan": { + "profile_id": "4978", + "childProfileIds": [ + 4972, + 4973, + 4974, + 4975, + 4976, + 10, + 4977 + ], + "fiveG_WPA2_SSID": "EX227_5G_WPA2_VLAN", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "EX227_5G_WPA_VLAN", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "EX227_5G_OPEN_VLAN", + "fiveG_WPA2-EAP_SSID": "EX227_5G_WPA2-EAP_VLAN", + "twoFourG_OPEN_SSID": "EX227_2dot4G_OPEN_VLAN", + "twoFourG_WPA2_SSID": "EX227_2dot4G_WPA2_VLAN", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "EX227_2dot4G_WPA_VLAN", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "EX227_2dot4G_WPA2-EAP_VLAN", + "fiveG_WPA2_profile": 4973, + "fiveG_WPA_profile": 4974, + "fiveG_WPA2-EAP_profile": 4972, + "twoFourG_WPA2_profile": 4976, + "twoFourG_WPA_profile": 4977, + "twoFourG_WPA2-EAP_profile": 4975, + "ssid_list": [ + "EX227_5G_WPA2_VLAN", + "EX227_5G_WPA_VLAN", + "EX227_5G_WPA2-EAP_VLAN", + "EX227_2dot4G_WPA2_VLAN", + "EX227_2dot4G_WPA_VLAN", + "EX227_2dot4G_WPA2-EAP_VLAN" + ] + }, + + "ex447_vlan": { + "profile_id": "5022", + "childProfileIds": [ + 5016, + 5017, + 5018, + 5019, + 5020, + 10, + 5021 + ], + "fiveG_WPA2_SSID": "EX447_5G_WPA2_VLAN", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "EX447_5G_WPA_VLAN", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "EX447_5G_OPEN_VLAN", + "fiveG_WPA2-EAP_SSID": "EX447_5G_WPA2-EAP_VLAN", + "twoFourG_OPEN_SSID": "EX447_2dot4G_OPEN_VLAN", + "twoFourG_WPA2_SSID": "EX447_2dot4G_WPA2_VLAN", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "EX447_2dot4G_WPA_VLAN", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "EX447_2dot4G_WPA2-EAP_VLAN", + "fiveG_WPA2_profile": 4973, + "fiveG_WPA_profile": 4974, + "fiveG_WPA2-EAP_profile": 4972, + "twoFourG_WPA2_profile": 4976, + "twoFourG_WPA_profile": 4977, + "twoFourG_WPA2-EAP_profile": 4975, + "ssid_list": [ + "EX447_5G_WPA2_VLAN", + "EX447_5G_WPA_VLAN", + "EX447_5G_WPA2-EAP_VLAN", + "EX447_2dot4G_WPA2_VLAN", + "EX447_2dot4G_WPA_VLAN", + "EX447_2dot4G_WPA2-EAP_VLAN" + ] + }, + + "eap101_vlan": { + "profile_id": "5043", + "childProfileIds": [ + 5037, + 5038, + 5039, + 5040, + 5041, + 10, + 5042 + ], + "fiveG_WPA2_SSID": "EAP101_5G_WPA2_VLAN", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "EAP101_5G_WPA_VLAN", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "EAP101_5G_OPEN_VLAN", + "fiveG_WPA2-EAP_SSID": "EAP101_5G_WPA2-EAP_VLAN", + "twoFourG_OPEN_SSID": "EAP101_2dot4G_OPEN_VLAN", + "twoFourG_WPA2_SSID": "EAP101_2dot4G_WPA2_VLAN", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "EAP101_2dot4G_WPA_VLAN", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "EAP101_2dot4G_WPA2-EAP_VLAN", + "fiveG_WPA2_profile": 5038, + "fiveG_WPA_profile": 5039, + "fiveG_WPA2-EAP_profile": 5037, + "twoFourG_WPA2_profile": 5041, + "twoFourG_WPA_profile": 5042, + "twoFourG_WPA2-EAP_profile": 5040, + "ssid_list": [ + "EAP101_5G_WPA2_VLAN", + "EAP101_5G_WPA_VLAN", + "EAP101_5G_WPA2-EAP_VLAN", + "EAP101_2dot4G_WPA2_VLAN", + "EAP101_2dot4G_WPA_VLAN", + "EAP101_2dot4G_WPA2-EAP_VLAN" + ] + }, + + "eap102_vlan": { + "profile_id": "5064", + "childProfileIds": [ + 5058, + 5059, + 5060, + 5061, + 5062, + 10, + 5063 + ], + "fiveG_WPA2_SSID": "EAP102_5G_WPA2_VLAN", + "fiveG_WPA2_PSK": "Connectus123$", + "fiveG_WPA_SSID": "EAP102_5G_WPA_VLAN", + "fiveG_WPA_PSK": "Connectus123$", + "fiveG_OPEN_SSID": "EAP102_5G_OPEN_VLAN", + "fiveG_WPA2-EAP_SSID": "EAP102_5G_WPA2-EAP_VLAN", + "twoFourG_OPEN_SSID": "EAP102_2dot4G_OPEN_VLAN", + "twoFourG_WPA2_SSID": "EAP102_2dot4G_WPA2_VLAN", + "twoFourG_WPA2_PSK": "Connectus123$", + "twoFourG_WPA_SSID": "EAP102_2dot4G_WPA_VLAN", + "twoFourG_WPA_PSK": "Connectus123$", + "twoFourG_WPA2-EAP_SSID": "EAP102_2dot4G_WPA2-EAP_VLAN", + "fiveG_WPA2_profile": 5059, + "fiveG_WPA_profile": 5060, + "fiveG_WPA2-EAP_profile": 5058, + "twoFourG_WPA2_profile": 5060, + "twoFourG_WPA_profile": 5061, + "twoFourG_WPA2-EAP_profile": 5059, + "ssid_list": [ + "EAP102_5G_WPA2_VLAN", + "EAP102_5G_WPA_VLAN", + "EAP102_5G_WPA2-EAP_VLAN", + "EAP102_2dot4G_WPA2_VLAN", + "EAP102_2dot4G_WPA_VLAN", + "EAP102_2dot4G_WPA2-EAP_VLAN" + ] + }, +} diff --git a/tests/pytest/Dockerfile b/tests/Dockerfile similarity index 100% rename from tests/pytest/Dockerfile rename to tests/Dockerfile diff --git a/tests/EXAMPLE-USAGE.txt b/tests/EXAMPLE-USAGE.txt new file mode 100644 index 000000000..6a9cf30cd --- /dev/null +++ b/tests/EXAMPLE-USAGE.txt @@ -0,0 +1,35 @@ +# This assumes you have ssh tunnels set up as suggested in ../tools/USAGE_EXAMPLES.txt + +# Attempt to run pytest against nola-12. Doesn't work, cloud is down, but of course maybe more problems too. + +pytest test_24ghz.py --testrail-user-id NONE --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-nola-01.cicd.lab.wlan.tip.build \ + --skip-radius --skip-wpa --verbose --testbed "NOLA-12c" --ssid-5g-wpa2 Default-SSID-5gl --psk-5g-wpa2 12345678 \ + --ssid-2g-wpa2 Default-SSID-2g --psk-2g-wpa2 12345678 --mode bridge --access-points wf188n + + +# Run nightly against NOLA-01 + +./Nightly_Sanity.py --testrail-user-id NONE --model ecw5410 --ap-jumphost-address localhost --ap-jumphost-port 8803 \ + --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP1 --skip-upgrade True --testbed "NOLA-01h" \ + --lanforge-ip-address localhost --lanforge-port-number 8802 --default_ap_profile TipWlan-2-Radios \ + --skip_radius --lanforge-2g-radio 1.1.wiphy4 --lanforge-5g-radio 1.1.wiphy5 \ + --sdk-base-url https://wlan-portal-svc-nola-01.cicd.lab.wlan.tip.build + + +# Run nightly against NOLA-04 from lab-ctlr itself. + +./Nightly_Sanity.py --testrail-user-id NONE --model ecw5410 --ap-jumphost-address localhost --ap-jumphost-port 22 \ + --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP4 --skip-upgrade True --testbed "NOLA-04ben" \ + --lanforge-ip-address lf4 --lanforge-port-number 8080 --default_ap_profile TipWlan-2-Radios \ + --skip_radius --lanforge-2g-radio 1.1.wiphy4 --lanforge-5g-radio 1.1.wiphy5 \ + --sdk-base-url https://wlan-portal-svc-nola-04.cicd.lab.wlan.tip.build + +# Run nightly against NOLA-04 from dev machine with ssh tunnel. + +./Nightly_Sanity.py --testrail-user-id NONE --model ecw5410 --ap-jumphost-address localhost --ap-jumphost-port 8813 \ + --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP4 --skip-upgrade True --testbed "NOLA-04ben" \ + --lanforge-ip-address localhost --lanforge-port-number 8812 --default_ap_profile TipWlan-2-Radios \ + --skip_radius --lanforge-2g-radio 1.1.wiphy4 --lanforge-5g-radio 1.1.wiphy5 \ + --sdk-base-url https://wlan-portal-svc-nola-04.cicd.lab.wlan.tip.build diff --git a/tests/Nightly_Sanity.py b/tests/Nightly_Sanity.py index b17e0172d..d8a96489e 100755 --- a/tests/Nightly_Sanity.py +++ b/tests/Nightly_Sanity.py @@ -49,7 +49,7 @@ class NightlySanity: print("EQ Id: %s" % (eq_id)) # Now, query equipment to find something that matches. - eq = self.cloud.get_customer_equipment(args.sdk_base_url, self.bearer, self.customer_id) + eq = self.cloud.get_customer_equipment(self.customer_id) for item in eq: for e in item['items']: print(e['id'], " ", e['inventoryId']) @@ -57,7 +57,7 @@ class NightlySanity: print("Found equipment ID: %s inventoryId: %s", e['id'], e['inventoryId']) self.equipment_id = str(e['id']) - if self.equipment_id == -1: + if self.equipment_id == "-1": print("ERROR: Could not find equipment-id.") exit() @@ -75,13 +75,14 @@ class NightlySanity: # Create Test session self.create_test_run_session() + key = self.args.model; # TODO: Not sure about this. # Check if AP needs Upgrade if (self.firmware["current"] is not None) and self.firmware["latest"] != self.firmware["current"]: - do_upgrade = self.cloud.should_upgrade_ap_fw(self.bearer, self.args, self.report_data, + do_upgrade = self.cloud.should_upgrade_ap_fw(self.args.force_upgrade, self.args.skip_upgrade, self.report_data, self.firmware["latest"], self.args.model, - self.firmware["current"], self.logger) + self.firmware["current"], self.logger, key) elif (self.firmware["current"] is not None) and self.firmware["latest"] == self.firmware["current"]: do_upgrade = False @@ -95,7 +96,7 @@ class NightlySanity: if do_upgrade: cloud_model = self.cloud_sdk_models[self.args.model] - pf = self.cloud.do_upgrade_ap_fw(self.bearer, self.args, self.report_data, test_cases, self.client, + pf = self.cloud.do_upgrade_ap_fw(self.args, self.report_data, test_cases, self.client, self.firmware["latest"], cloud_model, self.args.model, self.args.jfrog_user_id, self.args.jfrog_user_password, self.rid, self.customer_id, self.equipment_id, self.logger) @@ -121,7 +122,7 @@ class NightlySanity: # Check AP Manager Status manager_status = self.ap_cli_info['state'] print(manager_status) - + """ if manager_status != "active": print("Manager status is " + manager_status + "! Not connected to the cloud.") print("Waiting 30 seconds and re-checking status") @@ -132,7 +133,7 @@ class NightlySanity: print("Manager status is", manager_status, "! Not connected to the cloud.") print("Manager status fails multiple checks - failing test case.") # fail cloud connectivity testcase - self.client.update_testrail(case_id=self.test_cases["cloud_connection"], run_id=self.rid, + self.client.update_testrail(case_id=test_cases["cloud_connection"], run_id=self.rid, status_id=5, msg='CloudSDK connectivity failed') self.report_data['tests'][self.model][test_cases["cloud_connection"]] = "failed" @@ -153,35 +154,37 @@ class NightlySanity: self.report_data['tests'][self.model][test_cases["cloud_connection"]] = "passed" print(self.report_data['tests'][self.model]) # Pass cloud connectivity test case - + """ # Update in reporting self.reporting.update_json_report(self.report_data) self.ap_object = CreateAPProfiles(self.args, cloud=self.cloud, client=self.client, fw_model=self.model) - - # Logic to create AP Profiles (Bridge Mode) - self.ap_object.set_ssid_psk_data(ssid_2g_wpa="Nightly-SSID-2G-WPA", - ssid_5g_wpa="Nightly-SSID-5G-WPA", - psk_2g_wpa="Nightly_2g_wpa", - psk_5g_wpa="Nightly_5g_wpa", - ssid_2g_wpa2="Nightly-SSID-2G-WPA2", - ssid_5g_wpa2="Nightly-SSID-5G-WPA2", - psk_2g_wpa2="Nightly_2g_wpa2", - psk_5g_wpa2="Nightly_5g_wpa2") + # + # # Logic to create AP Profiles (Bridge Mode) + nprefix = "%s-Nightly"%(self.args.testbed) + self.ap_object.set_ssid_psk_data(ssid_2g_wpa="%s-SSID-2G-WPA"%(nprefix), + ssid_5g_wpa="%s-SSID-5G-WPA"%(nprefix), + psk_2g_wpa="%s_2g_wpa"%(nprefix), + psk_5g_wpa="%s_5g_wpa"%(nprefix), + ssid_2g_wpa2="%s-SSID-2G-WPA2"%(nprefix), + ssid_5g_wpa2="%s-SSID-5G-WPA2"%(nprefix), + psk_2g_wpa2="%s_2g_wpa2"%(nprefix), + psk_5g_wpa2="%s_5g_wpa2"%(nprefix)) print("creating Profiles") ssid_template = "TipWlan-Cloud-Wifi" if not self.args.skip_profiles: if not self.args.skip_radius: - # Radius Profile needs to be set here - # obj.create_radius_profile(radius_name, rid, key) - pass + radius_name = "Automation_Radius_Nightly-01" + radius_template = "templates/radius_profile_template.json" + self.ap_object.create_radius_profile(radius_name=radius_name, radius_template=radius_template, rid=self.rid, + key=self.model) self.ap_object.create_ssid_profiles(ssid_template=ssid_template, skip_eap=True, mode="bridge") - print("Create AP with equipment-id: ", self.equipment_id) - self.ap_object.create_ap_bridge_profile(eq_id=self.equipment_id, fw_model=self.model, mode="bridge") - self.ap_object.validate_changes(mode="bridge") + print("Create AP with equipment-id: ", self.equipment_id) + self.ap_object.create_ap_profile(eq_id=self.equipment_id, fw_model=self.model, mode="bridge") + self.ap_object.validate_changes(mode="bridge") print("Profiles Created") @@ -191,15 +194,17 @@ class NightlySanity: time.sleep(10) self.reporting.update_json_report(report_data=self.ap_object.report_data) + self.ap_object = CreateAPProfiles(self.args, cloud=self.cloud, client=self.client, fw_model=self.model) + # Logic to create AP Profiles (NAT Mode) - self.ap_object.set_ssid_psk_data(ssid_2g_wpa="Nightly-SSID-NAT-2G-WPA", - ssid_5g_wpa="Nightly-SSID-NAT-5G-WPA", - psk_2g_wpa="Nightly_2g_nat_wpa", - psk_5g_wpa="Nightly_5g_nat_wpa", - ssid_2g_wpa2="Nightly-SSID-NAT-2G-WPA2", - ssid_5g_wpa2="Nightly-SSID-NAT-5G-WPA2", - psk_2g_wpa2="Nightly_2g_nat_wpa2", - psk_5g_wpa2="Nightly_5g_nat_wpa2") + self.ap_object.set_ssid_psk_data(ssid_2g_wpa="%s-SSID-NAT-2G-WPA"%(nprefix), + ssid_5g_wpa="%s-SSID-NAT-5G-WPA"%(nprefix), + psk_2g_wpa="%s_2g_nat_wpa"%(nprefix), + psk_5g_wpa="%s_5g_nat_wpa"%(nprefix), + ssid_2g_wpa2="%s-SSID-NAT-2G-WPA2"%(nprefix), + ssid_5g_wpa2="%s-SSID-NAT-5G-WPA2"%(nprefix), + psk_2g_wpa2="%s_2g_nat_wpa2"%(nprefix), + psk_5g_wpa2="%s_5g_nat_wpa2"%(nprefix)) print("creating Profiles") ssid_template = "TipWlan-Cloud-Wifi" @@ -209,11 +214,11 @@ class NightlySanity: # Radius Profile needs to be set here # obj.create_radius_profile(radius_name, rid, key) pass - self.ap_object.create_ssid_profiles(ssid_template=ssid_template, skip_eap=True, mode="nat") + self.ap_object.create_ssid_profiles(ssid_template=ssid_template, mode="nat") - print("Create AP with equipment-id: ", self.equipment_id) - self.ap_object.create_ap_bridge_profile(eq_id=self.equipment_id, fw_model=self.model, mode="nat") - self.ap_object.validate_changes(mode="nat") + print("Create AP with equipment-id: ", self.equipment_id) + self.ap_object.create_ap_profile(eq_id=self.equipment_id, fw_model=self.model, mode="nat") + self.ap_object.validate_changes(mode="nat") self.test_2g(mode="nat") self.test_5g(mode="nat") @@ -243,16 +248,11 @@ class NightlySanity: def test_2g(self, mode="bridge"): - if mode == "bridge": - mode_a = "name" - if mode == "nat": - mode_a = "nat" - if not self.args.skip_radius: # Run Client Single Connectivity Test Cases for Bridge SSIDs # TC5214 - 2.4 GHz WPA2-Enterprise test_case = test_cases["2g_eap_" + mode] - radio = lanforge_2g_radio + radio = command_line_args.lanforge_2g_radio sta_list = [lanforge_prefix + "5214"] ssid_name = ssid_2g_eap; security = "wpa2" @@ -273,8 +273,8 @@ class NightlySanity: # TC - 2.4 GHz WPA2 test_case = test_cases["2g_wpa2_" + mode] station = [self.lanforge_data['prefix'] + "2237"] - ssid_name = self.ap_object.ssid_data['2g']['wpa2'][mode_a] - ssid_psk = self.ap_object.psk_data['2g']['wpa2'][mode_a] + ssid_name = self.ap_object.ssid_data['2g']['wpa2'][mode] + ssid_psk = self.ap_object.psk_data['2g']['wpa2'][mode] security = "wpa2" upstream_port = "eth2" print(self.lanforge_data['port']) @@ -299,8 +299,8 @@ class NightlySanity: # TC - 2.4 GHz WPA test_case = test_cases["2g_wpa_" + mode] station = [self.lanforge_data['prefix'] + "2420"] - ssid_name = self.ap_object.ssid_data['2g']['wpa'][mode_a] - ssid_psk = self.ap_object.psk_data['2g']['wpa'][mode_a] + ssid_name = self.ap_object.ssid_data['2g']['wpa'][mode] + ssid_psk = self.ap_object.psk_data['2g']['wpa'][mode] security = "wpa" upstream_port = "eth2" print(self.lanforge_data['port']) @@ -322,12 +322,6 @@ class NightlySanity: time.sleep(10) def test_5g(self, mode="bridge"): - - if mode == "bridge": - mode_a = "name" - if mode == "nat": - mode_a = "nat" - if not self.args.skip_radius: # TC - 5 GHz WPA2-Enterprise test_case = self.test_cases["5g_eap_" + mode] @@ -351,8 +345,8 @@ class NightlySanity: # TC 5 GHz WPA2 test_case = test_cases["5g_wpa2_" + mode] station = [self.lanforge_data['prefix'] + "2236"] - ssid_name = self.ap_object.ssid_data['5g']['wpa2'][mode_a] - ssid_psk = self.ap_object.psk_data['5g']['wpa2'][mode_a] + ssid_name = self.ap_object.ssid_data['5g']['wpa2'][mode] + ssid_psk = self.ap_object.psk_data['5g']['wpa2'][mode] security = "wpa2" upstream_port = "eth2" try: @@ -375,8 +369,8 @@ class NightlySanity: # # TC - 5 GHz WPA test_case = test_cases["5g_wpa_" + mode] station = [self.lanforge_data['prefix'] + "2419"] - ssid_name = self.ap_object.ssid_data['5g']['wpa'][mode_a] - ssid_psk = self.ap_object.psk_data['5g']['wpa'][mode_a] + ssid_name = self.ap_object.ssid_data['5g']['wpa'][mode] + ssid_psk = self.ap_object.psk_data['5g']['wpa'][mode] security = "wpa" upstream_port = "eth2" try: @@ -478,7 +472,7 @@ def main(): build_obj = GetBuild(jfrog['user'], jfrog['pass'], build) # sanity_status = json.load(open("sanity_status.json")) - obj = NightlySanity(args=command_line_args, base=base, lanforge_data=lanforge, Test=test, reporting=reporting, + obj = NightlySanity(args=command_line_args, base=base, lanforge_data=lanforge, test=test, reporting=reporting, build=build_obj) obj.configure_dut() diff --git a/tests/UnitTestBase.py b/tests/UnitTestBase.py index 60162f2a3..7f2d76c34 100644 --- a/tests/UnitTestBase.py +++ b/tests/UnitTestBase.py @@ -6,8 +6,6 @@ if sys.version_info[0] != 3: print("This script requires Python 3") exit(1) -import sys - for folder in 'py-json', 'py-scripts': if folder not in sys.path: sys.path.append(f'../lanforge/lanforge-scripts/{folder}') @@ -94,117 +92,262 @@ from lab_ap_info import cloud_type from lab_ap_info import test_cases from lab_ap_info import radius_info +# keep in sync with that below. +def add_base_parse_args(parser): + parser.add_argument("-b", "--build-id", type=str, + help="FW commit ID (latest pending build on dev is default)", + default="pending") + parser.add_argument("--skip-upgrade", type=bool, help="Skip upgrading firmware", + default=False) + parser.add_argument("--force-upgrade", type=bool, + help="Force upgrading firmware even if it is already current version", + default=False) + parser.add_argument("-m", "--model", type=str, + choices=['ea8300', 'ecw5410', 'ecw5211', 'ec420', 'wf188n', 'eap102', 'None'], + help="AP model to be run", required=True) + parser.add_argument("--equipment-id", type=str, + help="AP model ID, as exists in the cloud-sdk. -1 to auto-detect.", + default="-1") + parser.add_argument("--object-id", type=str, + help="Used when querying and deleting individual objects.", + default=None) + parser.add_argument("--customer-id", type=str, + help="Specify cloud customer-id, default is 2", + default="2") + parser.add_argument("--testbed", type=str, + help="Testbed name, will be prefixed to profile names and similar", + default=None) + + parser.add_argument("--sdk-base-url", type=str, + help="cloudsdk base url, default: https://wlan-portal-svc.cicd.lab.wlan.tip.build", + default="https://wlan-portal-svc.cicd.lab.wlan.tip.build") + parser.add_argument("--sdk-user-id", type=str, help="cloudsdk user id, default: support@example.conf", + default="support@example.com") + parser.add_argument("--sdk-user-password", type=str, help="cloudsdk user password, default: support", + default="support") + + parser.add_argument("--jfrog-base-url", type=str, help="jfrog base url", + default="tip.jFrog.io/artifactory/tip-wlan-ap-firmware") + parser.add_argument("--jfrog-user-id", type=str, help="jfrog user id", + default="tip-read") + parser.add_argument("--jfrog-user-password", type=str, help="jfrog user password", + default="tip-read") + + parser.add_argument("--testrail-base-url", type=str, help="testrail base url", + # was os.getenv('TESTRAIL_URL') + default="https://telecominfraproject.testrail.com") + parser.add_argument("--testrail-project", type=str, help="testrail project name", + default="opsfleet-wlan") + parser.add_argument("--testrail-user-id", type=str, + help="testrail user id. Use 'NONE' to disable use of testrails.", + default="NONE") + parser.add_argument("--testrail-user-password", type=str, help="testrail user password", + default="password") + parser.add_argument("--testrail-run-prefix", type=str, help="testrail run prefix", + default="prefix-1") + parser.add_argument("--testrail-milestone", dest="milestone", type=str, help="testrail milestone ID", + default="milestone-1") + + parser.add_argument("--lanforge-ip-address", type=str, help="ip address of the lanforge gui", + default="127.0.0.1") + parser.add_argument("--lanforge-port-number", type=str, help="port of the lanforge gui", + default="8080") + parser.add_argument("--lanforge-prefix", type=str, help="LANforge api prefix string", + default="sdk") + parser.add_argument("--lanforge-2g-radio", type=str, help="LANforge 2Ghz radio to use for testing", + default="1.1.wiphy0") + parser.add_argument("--lanforge-5g-radio", type=str, help="LANforge 5Ghz radio to use for testing", + default="1.1.wiphy1") + + parser.add_argument("--local_dir", type=str, help="Sanity logging directory", + default="logs") + parser.add_argument("--report-path", type=str, help="Sanity report directory", + default="reports") + parser.add_argument("--report-template", type=str, help="Sanity report template", + default="reports/report_template.php") + + parser.add_argument("--eap-id", type=str, help="EAP indentity", + default="lanforge") + parser.add_argument("--ttls-password", type=str, help="TTLS password", + default="lanforge") + + parser.add_argument("--ap-ip", type=str, help="AP IP Address, for direct ssh access if not using jumphost", + default="127.0.0.1") + parser.add_argument("--ap-username", type=str, help="AP username", + default="root") + parser.add_argument("--ap-password", type=str, help="AP password", + default="root") + parser.add_argument("--ap-jumphost-address", type=str, + help="IP of system that we can ssh in to get serial console access to AP", + default=None) + parser.add_argument("--ap-jumphost-port", type=str, + help="SSH port to use in case we are using ssh tunneling or other non-standard ports", + default="22") + parser.add_argument("--ap-jumphost-username", type=str, + help="User-ID for system that we can ssh in to get serial console access to AP", + default="lanforge") + parser.add_argument("--ap-jumphost-password", type=str, + help="Passwort for system that we can ssh in to get serial console access to AP", + default="lanforge") + parser.add_argument("--ap-jumphost-wlan-testing", type=str, help="wlan-testing repo dir on the jumphost", + default="git/wlan-testing") + parser.add_argument("--ap-jumphost-tty", type=str, help="Serial port for the AP we wish to talk to", + default="UNCONFIGURED-JUMPHOST-TTY") + + parser.add_argument('--skip-update-firmware', dest='update_firmware', action='store_false') + parser.set_defaults(update_firmware=True) + + parser.add_argument('--verbose', dest='verbose', action='store_true') + parser.set_defaults(verbose=False) + + +# Keep in sync with that above +def add_base_parse_args_pytest(parser): + parser.addoption("--default-ap-profile", type=str, + help="Default AP profile to use as basis for creating new ones, typically: TipWlan-2-Radios or TipWlan-3-Radios", + default="TipWlan-2-Radios") + parser.addoption("--skip-radius", dest="skip_radius", action='store_true', + help="Should we skip the RADIUS configs or not") + parser.addoption("--skip-profiles", dest="skip_profiles", action='store_true', + help="Should we skip applying profiles?") + parser.addoption("--skip-wpa", dest="skip_wpa", action='store_false', + help="Should we skip applying profiles?") + parser.addoption("--skip-wpa2", dest="skip_wpa2", action='store_false', + help="Should we skip applying profiles?") + + parser.addoption("--psk-5g-wpa2", dest="psk_5g_wpa2", type=str, + help="Allow over-riding the 5g-wpa2 PSK value.") + parser.addoption("--psk-5g-wpa", dest="psk_5g_wpa", type=str, + help="Allow over-riding the 5g-wpa PSK value.") + parser.addoption("--psk-2g-wpa2", dest="psk_2g_wpa2", type=str, + help="Allow over-riding the 2g-wpa2 PSK value.") + parser.addoption("--psk-2g-wpa", dest="psk_2g_wpa", type=str, + help="Allow over-riding the 2g-wpa PSK value.") + + parser.addoption("--ssid-5g-wpa2", dest="ssid_5g_wpa2", type=str, + help="Allow over-riding the 5g-wpa2 SSID value.") + parser.addoption("--ssid-5g-wpa", dest="ssid_5g_wpa", type=str, + help="Allow over-riding the 5g-wpa SSID value.") + parser.addoption("--ssid-2g-wpa2", dest="ssid_2g_wpa2", type=str, + help="Allow over-riding the 2g-wpa2 SSID value.") + parser.addoption("--ssid-2g-wpa", dest="ssid_2g_wpa", type=str, + help="Allow over-riding the 2g-wpa SSID value.") + + parser.addoption("--mode", dest="mode", choices=['bridge', 'nat', 'vlan'], type=str, + help="Mode of AP Profile [bridge/nat/vlan]", default="bridge") + + parser.addoption("--build-id", type=str, + help="FW commit ID (latest pending build on dev is default)", + default="pending") + parser.addoption("--skip-upgrade", type=bool, help="Skip upgrading firmware", + default=False) + parser.addoption("--force-upgrade", type=bool, + help="Force upgrading firmware even if it is already current version", + default=False) + # --access-points instead + # parser.addoption("--model", type=str, + # choices=['ea8300', 'ecw5410', 'ecw5211', 'ec420', 'wf188n', 'eap102', 'None'], + # help="AP model to be run", required=True) + parser.addoption("--equipment-id", type=str, + help="AP model ID, as exists in the cloud-sdk. -1 to auto-detect.", + default="-1") + parser.addoption("--object-id", type=str, + help="Used when querying and deleting individual objects.", + default=None) + parser.addoption("--customer-id", type=str, + help="Specify cloud customer-id, default is 2", + default="2") + parser.addoption("--testbed", type=str, + help="Testbed name, will be prefixed to profile names and similar", + default=None) + + parser.addoption("--sdk-base-url", type=str, + help="cloudsdk base url, default: https://wlan-portal-svc.cicd.lab.wlan.tip.build", + default="https://wlan-portal-svc.cicd.lab.wlan.tip.build") + parser.addoption("--sdk-user-id", type=str, help="cloudsdk user id, default: support@example.conf", + default="support@example.com") + parser.addoption("--sdk-user-password", type=str, help="cloudsdk user password, default: support", + default="support") + + parser.addoption("--jfrog-base-url", type=str, help="jfrog base url", + default="tip.jFrog.io/artifactory/tip-wlan-ap-firmware") + parser.addoption("--jfrog-user-id", type=str, help="jfrog user id", + default="tip-read") + parser.addoption("--jfrog-user-password", type=str, help="jfrog user password", + default="tip-read") + + parser.addoption("--testrail-base-url", type=str, help="testrail base url", + # was os.getenv('TESTRAIL_URL') + default="https://telecominfraproject.testrail.com") + parser.addoption("--testrail-project", type=str, help="testrail project name", + default="opsfleet-wlan") + parser.addoption("--testrail-user-id", type=str, + help="testrail user id. Use 'NONE' to disable use of testrails.", + default="NONE") + parser.addoption("--testrail-user-password", type=str, help="testrail user password", + default="password") + parser.addoption("--testrail-run-prefix", type=str, help="testrail run prefix", + default="prefix-1") + parser.addoption("--testrail-milestone", dest="milestone", type=str, help="testrail milestone ID", + default="milestone-1") + + parser.addoption("--lanforge-ip-address", type=str, help="ip address of the lanforge gui", + default="127.0.0.1") + parser.addoption("--lanforge-port-number", type=str, help="port of the lanforge gui", + default="8080") + parser.addoption("--lanforge-prefix", type=str, help="LANforge api prefix string", + default="sdk") + parser.addoption("--lanforge-2g-radio", type=str, help="LANforge 2Ghz radio to use for testing", + default="1.1.wiphy0") + parser.addoption("--lanforge-5g-radio", type=str, help="LANforge 5Ghz radio to use for testing", + default="1.1.wiphy1") + + parser.addoption("--local_dir", type=str, help="Sanity logging directory", + default="logs") + parser.addoption("--report-path", type=str, help="Sanity report directory", + default="reports") + parser.addoption("--report-template", type=str, help="Sanity report template", + default="reports/report_template.php") + + parser.addoption("--eap-id", type=str, help="EAP indentity", + default="lanforge") + parser.addoption("--ttls-password", type=str, help="TTLS password", + default="lanforge") + + parser.addoption("--ap-ip", type=str, help="AP IP Address, for direct ssh access if not using jumphost", + default="127.0.0.1") + parser.addoption("--ap-username", type=str, help="AP username", + default="root") + parser.addoption("--ap-password", type=str, help="AP password", + default="root") + parser.addoption("--ap-jumphost-address", type=str, + help="IP of system that we can ssh in to get serial console access to AP", + default=None) + parser.addoption("--ap-jumphost-port", type=str, + help="SSH port to use in case we are using ssh tunneling or other non-standard ports", + default="22") + parser.addoption("--ap-jumphost-username", type=str, + help="User-ID for system that we can ssh in to get serial console access to AP", + default="lanforge") + parser.addoption("--ap-jumphost-password", type=str, + help="Passwort for system that we can ssh in to get serial console access to AP", + default="lanforge") + parser.addoption("--ap-jumphost-wlan-testing", type=str, help="wlan-testing repo dir on the jumphost", + default="git/wlan-testing") + parser.addoption("--ap-jumphost-tty", type=str, help="Serial port for the AP we wish to talk to", + default="UNCONFIGURED-JUMPHOST-TTY") + + parser.addoption('--skip-update-firmware', dest='update_firmware', action='store_false', default=True) + + parser.addoption('--tip-verbose', dest='verbose', action='store_true', default=False) + class UnitTestBase: - def __init__(self, log_name, args, reporting): + def __init__(self, log_name, args, reporting=None): self.parser = argparse.ArgumentParser(description="Sanity Testing on Firmware Build", parents=[args]) - self.parser.add_argument("-b", "--build-id", type=str, - help="FW commit ID (latest pending build on dev is default)", - default="pending") - self.parser.add_argument("--skip-upgrade", type=bool, help="Skip upgrading firmware", - default=False) - self.parser.add_argument("--force-upgrade", type=bool, - help="Force upgrading firmware even if it is already current version", - default=False) - self.parser.add_argument("-m", "--model", type=str, - choices=['ea8300', 'ecw5410', 'ecw5211', 'ec420', 'wf188n', 'eap102', 'None'], - help="AP model to be run", required=True) - self.parser.add_argument("--equipment_id", type=str, - help="AP model ID, as exists in the cloud-sdk. -1 to auto-detect.", - default="-1") - self.parser.add_argument("--object_id", type=str, - help="Used when querying and deleting individual objects.", - default=None) - self.parser.add_argument("--customer-id", type=str, - help="Specify cloud customer-id, default is 2", - default="2") - self.parser.add_argument("--testbed", type=str, - help="Testbed name, will be prefixed to profile names and similar", - default=None) - - self.parser.add_argument("--sdk-base-url", type=str, - help="cloudsdk base url, default: https://wlan-portal-svc.cicd.lab.wlan.tip.build", - default="https://wlan-portal-svc.cicd.lab.wlan.tip.build") - self.parser.add_argument("--sdk-user-id", type=str, help="cloudsdk user id, default: support@example.conf", - default="support@example.com") - self.parser.add_argument("--sdk-user-password", type=str, help="cloudsdk user password, default: support", - default="support") - - self.parser.add_argument("--jfrog-base-url", type=str, help="jfrog base url", - default="tip.jFrog.io/artifactory/tip-wlan-ap-firmware") - self.parser.add_argument("--jfrog-user-id", type=str, help="jfrog user id", - default="tip-read") - self.parser.add_argument("--jfrog-user-password", type=str, help="jfrog user password", - default="tip-read") - - self.parser.add_argument("--testrail-base-url", type=str, help="testrail base url", - # was os.getenv('TESTRAIL_URL') - default="https://telecominfraproject.testrail.com") - self.parser.add_argument("--testrail-project", type=str, help="testrail project name", - default="opsfleet-wlan") - self.parser.add_argument("--testrail-user-id", type=str, - help="testrail user id. Use 'NONE' to disable use of testrails.", - default="gleb@opsfleet.com") - self.parser.add_argument("--testrail-user-password", type=str, help="testrail user password", - default="password") - self.parser.add_argument("--testrail-run-prefix", type=str, help="testrail run prefix", - default="prefix-1") - self.parser.add_argument("--milestone", type=str, help="testrail milestone ID", - default="milestone-1") - - self.parser.add_argument("--lanforge-ip-address", type=str, help="ip address of the lanforge gui", - default="127.0.0.1") - self.parser.add_argument("--lanforge-port-number", type=str, help="port of the lanforge gui", - default="8080") - self.parser.add_argument("--lanforge-prefix", type=str, help="LANforge api prefix string", - default="sdk") - self.parser.add_argument("--lanforge-2g-radio", type=str, help="LANforge 2Ghz radio to use for testing", - default="1.1.wiphy0") - self.parser.add_argument("--lanforge-5g-radio", type=str, help="LANforge 5Ghz radio to use for testing", - default="1.1.wiphy1") - - self.parser.add_argument("--local_dir", type=str, help="Sanity logging directory", - default="logs") - self.parser.add_argument("--report-path", type=str, help="Sanity report directory", - default="reports") - self.parser.add_argument("--report-template", type=str, help="Sanity report template", - default="reports/report_template.php") - - self.parser.add_argument("--eap-id", type=str, help="EAP indentity", - default="lanforge") - self.parser.add_argument("--ttls-password", type=str, help="TTLS password", - default="lanforge") - - self.parser.add_argument("--ap-ip", type=str, help="AP IP Address, for direct ssh access if not using jumphost", - default="127.0.0.1") - self.parser.add_argument("--ap-username", type=str, help="AP username", - default="root") - self.parser.add_argument("--ap-password", type=str, help="AP password", - default="root") - self.parser.add_argument("--ap-jumphost-address", type=str, - help="IP of system that we can ssh in to get serial console access to AP", - default=None) - self.parser.add_argument("--ap-jumphost-port", type=str, - help="SSH port to use in case we are using ssh tunneling or other non-standard ports", - default="22") - self.parser.add_argument("--ap-jumphost-username", type=str, - help="User-ID for system that we can ssh in to get serial console access to AP", - default="lanforge") - self.parser.add_argument("--ap-jumphost-password", type=str, - help="Passwort for system that we can ssh in to get serial console access to AP", - default="lanforge") - self.parser.add_argument("--ap-jumphost-wlan-testing", type=str, help="wlan-testing repo dir on the jumphost", - default="git/wlan-testing") - self.parser.add_argument("--ap-jumphost-tty", type=str, help="Serial port for the AP we wish to talk to", - default="UNCONFIGURED-JUMPHOST-TTY") - - self.parser.add_argument('--skip-update-firmware', dest='update_firmware', action='store_false') - self.parser.set_defaults(update_firmware=True) - - self.parser.add_argument('--verbose', dest='verbose', action='store_true') - self.parser.set_defaults(verbose=False) + add_base_parse_args(self.parser) self.command_line_args = self.parser.parse_args() @@ -239,8 +382,13 @@ class UnitTestBase: self.build = self.command_line_args.build_id + self.logger = logging.getLogger(log_name) - self.hdlr = logging.FileHandler(reporting.report_path + "/test_run.log") + + 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) @@ -255,3 +403,4 @@ class UnitTestBase: self.cloud: CloudSDK = CloudSDK(self.command_line_args) self.bearer = self.cloud.get_bearer(self.cloudSDK_url, cloud_type) self.customer_id = self.command_line_args.customer_id + diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 000000000..5b556ddde --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,287 @@ +import pytest +from time import sleep, gmtime, strftime + +import sys +import os +sys.path.append(os.path.join(os.path.dirname(__file__), 'helpers')) + +sys.path.append(f'..') + +for folder in 'py-json', 'py-scripts': + if folder not in sys.path: + sys.path.append(f'../../lanforge/lanforge-scripts/{folder}') + +sys.path.append(f'../../libs/lanforge/') +sys.path.append(f'../../libs/cloudsdk/') +sys.path.append(f'../../libs/apnos/') +sys.path.append(f'../../libs/testrails/') +sys.path.append(f'../../libs/') + +sys.path.append(f'../test_utility/') + +from utils import * +from UnitTestBase import * +from JfrogHelper import * +from cloudsdk import * +from testrail_api import TestRail_Client + + +def pytest_addoption(parser): + parser.addini("jfrog-base-url", "jfrog base url") + parser.addini("jfrog-user-id", "jfrog username") + parser.addini("jfrog-user-password", "jfrog password") + + parser.addini("sdk-base-url", "cloud sdk base url") + parser.addini("sdk-user-id", "cloud sdk username") + parser.addini("sdk-user-password", "cloud sdk user password") + parser.addini("customer-id", "cloud sdk customer id for the access points") + parser.addini("equipment-id", "cloud sdk equipment id for the access point") + parser.addini("default-ap-profile", "cloud sdk default AP profile name") + + parser.addini("verbose", "Enable verbose logs?") + + parser.addini("ap-ip", "AP IP address (or can use serial)") + parser.addini("ap-username", "AP username") + parser.addini("ap-password", "AP password") + parser.addini("ap-jumphost-address", "AP jumphost IP address") + parser.addini("ap-jumphost-username", "AP jumphost username") + parser.addini("ap-jumphost-password", "AP jumphost password") + parser.addini("ap-jumphost-port", "AP jumphost port") + parser.addini("ap-jumphost-wlan-testing", "AP jumphost wlan-testing code directory") + parser.addini("ap-jumphost-tty", "AP jumphost TTY") + + parser.addini("build-id", "What build flavor to use, ie 'pending'") + parser.addini("testbed", "Testbed name") + parser.addini("mode", "AP Mode, bridge/vlan/nat") + parser.addini("skip-wpa", "Should we skip setting up WPA?", default=False) + parser.addini("skip-wpa2", "Should we skip setting up WPA2?", default=False) + parser.addini("skip-radius", "Should we skip setting up EAP/Radius?", default=False) + parser.addini("skip-profiles", "Should we skip setting up profiles") + + parser.addini("ssid-2g-wpa", "Configure ssid-2g-wpa") + parser.addini("psk-2g-wpa", "Configure psk-2g-wpa") + parser.addini("ssid-5g-wpa", "Configure ssid-5g-wpa") + parser.addini("psk-5g-wpa", "Configure psk-5g-wpa") + parser.addini("ssid-2g-wpa2", "Configure ssid-2g-wpa2") + parser.addini("psk-2g-wpa2", "Configure psk-2g-wpa2") + parser.addini("ssid-5g-wpa2", "Configure ssid-5g-wpa2") + parser.addini("psk-5g-wpa2", "Configure psk-5g-wpa2") + + parser.addini("testrail-base-url", "testrail base url") + parser.addini("testrail-project", "testrail project name to use to generate test reports") + parser.addini("testrail-user-id", "testrail username") + parser.addini("testrail-user-password", "testrail user password") + parser.addini("lanforge-ip-address", "LANforge ip address to connect to") + parser.addini("lanforge-port-number", "LANforge port number to connect to") + parser.addini("lanforge-2g-radio", "LANforge radio to use") + parser.addini("lanforge-5g-radio", "LANforge radio to use") + parser.addini("lanforge-ethernet-port", "LANforge ethernet adapter to use") + + add_base_parse_args_pytest(parser) + + # this has to be the last argument + # example: --access-points ECW5410 EA8300-EU + parser.addoption( + "--access-points", + nargs="+", + default=[ "ECW5410" ], + help="list of access points to test" + ) + +def pytest_generate_tests(metafunc): + metafunc.parametrize("access_points", metafunc.config.getoption('--access-points'), scope="session") + +# run something after all tests are done regardless of the outcome +def pytest_unconfigure(config): + print("Tests cleanup done") + +@pytest.fixture(scope="session") +def setup_testrails(request, instantiate_testrail, access_points): + if request.config.getoption("--testrail-user-id") == "NONE": + yield -1 + return # needed to stop fixture execution + + if request.config.getoption("--skip-update-firmware"): + firmware_update_case = [] + else: + firmware_update_case = [ 2831 ] + seen = {None} + test_data = [] + session = request.node + for item in session.items: + cls = item.getparent(pytest.Class) + if cls not in seen: + if hasattr(cls.obj, "get_test_data"): + test_data.append(cls.obj.get_test_data()) + seen.add(cls) + testrail_project_id = instantiate_testrail.get_project_id(request.config.getini("testrail-project")) + runId = instantiate_testrail.create_testrun( + name=f'Nightly_model_{access_points}_{strftime("%Y-%m-%d", gmtime())}', + case_ids=( [*test_data] + firmware_update_case ), + project_id=testrail_project_id + ) + yield runId + +# TODO: Should not be session wide I think, you will want to run different +# configurations (bridge, nat, vlan, wpa/wpa2/eap, etc +@pytest.fixture(scope="session") +def setup_cloudsdk(request, instantiate_cloudsdk, instantiate_testrail): + # snippet to do cleanup after all the tests are done + def fin(): + print("Cloud SDK cleanup done") + request.addfinalizer(fin) + + # Set up bridged setup by default. + + command_line_args = create_command_line_args(request) + + cloud = instantiate_cloudsdk + + cloud.assert_bad_response = True + + equipment_id = instantiate_cloudsdk.equipment_id + + print("equipment-id: %s" % (equipment_id)) + if equipment_id == "-1": + print("ERROR: Could not find equipment-id.") + sys.exit(1) + + ###Get Current AP info + try: + ap_cli_info = ssh_cli_active_fw(command_line_args) + ap_cli_fw = ap_cli_info['active_fw'] + except Exception as ex: + print(ex) + logging.error(logging.traceback.format_exc()) + ap_cli_info = "ERROR" + print("FAILED: Cannot Reach AP CLI."); + sys.exit(1) + + # LANForge Information + lanforge = { + "ip": "localhost", + "port": 8806, + # "prefix": command_line_args.lanforge_prefix, + "2g_radio": "wiphy4", + "5g_radio": "wiphy5", + "eth_port": "eth2" + } + + + + + fw_model = ap_cli_fw.partition("-")[0] + + print('Current Active AP FW from CLI:', ap_cli_fw) + + radius_name = "%s-%s-%s" % (command_line_args.testbed, fw_model, "Radius") + + print("Create profiles") + ap_object = CreateAPProfiles(command_line_args, cloud=cloud, client=instantiate_testrail, fw_model=fw_model) + + # Logic to create AP Profiles (Bridge Mode) + + # ap_object.set_ssid_psk_data(ssid_2g_wpa="Pytest-run-2g-wpa", + # ssid_5g_wpa="Pytest-run-2g-wpa", + # psk_2g_wpa="Pytest-run-2g-wpa", + # psk_5g_wpa="Pytest-run-2g-wpa", + # ssid_2g_wpa2="Pytest-run-2g-wpa", + # ssid_5g_wpa2="Pytest-run-2g-wpa", + # psk_2g_wpa2="Pytest-run-2g-wpa", + # psk_5g_wpa2="Pytest-run-2g-wpa") + + print(ap_object) + today = str(date.today()) + rid = instantiate_testrail.get_run_id( + test_run_name=command_line_args.testrail_run_prefix + fw_model + "_" + today + "_" + "ecw5410-2021-02-12-pending-e8bb466") + print("creating Profiles") + ssid_template = "TipWlan-Cloud-Wifi" + + if not command_line_args.skip_profiles: + if not command_line_args.skip_radius: + # Radius Profile needs to be set here + radius_name = "Test-Radius-" + str(time.time()).split(".")[0] + radius_template = "templates/radius_profile_template.json" + ap_object.create_radius_profile(radius_name=radius_name, radius_template=radius_template, rid=rid, + key=fw_model) + ap_object.create_ssid_profiles(ssid_template=ssid_template, skip_eap=True, skip_wpa=True, + skip_wpa2=False, mode="bridge") + + print("Create AP with equipment-id: ", equipment_id) + ap_object.create_ap_profile(eq_id=equipment_id, fw_model=fw_model, mode=command_line_args.mode) + ap_object.validate_changes(mode=command_line_args.mode) + + print("Profiles Created") + data = {"lanforge": lanforge, "ap_object": ap_object} + + yield data + +@pytest.fixture(scope="session") +def update_firmware(request, setup_testrails, instantiate_jFrog, instantiate_cloudsdk, access_points): + if request.config.getoption("--skip-update-firmware"): + return True + + #access_points is really a single AP. + ap = access_points + + if True: + latest_image = instantiate_jFrog.get_latest_image(ap) + if latest_image is None: + print("AP Model: %s doesn't match the available Models"%(ap)) + sys.exit(1) # TODO: How to return error properly here? + + cloudModel = cloud_sdk_models[ap] + logger = None + report_data = None + test_cases = None + testrail_client = None + jfrog_user = instantiate_jFrog.get_user() + jfrog_pwd = instantiate_jFrog.get_passwd() + testrail_rid = 0 + customer_id = request.config.getoption("--customer-id") + equipment_id = instantiate_cloudsdk.equipment_id + pf = instantiate_cloudsdk.do_upgrade_ap_fw(request.config, report_data, test_cases, testrail_client, + latest_image, cloudModel, ap, jfrog_user, jfrog_pwd, testrail_rid, + customer_id, equipment_id, logger) + + return pf + +@pytest.fixture(scope="session") +def instantiate_cloudsdk(request): + command_line_args = create_command_line_args(request) + rv = CloudSDK(command_line_args) + + equipment_id = request.config.getoption("--equipment-id") + if equipment_id == "-1": + eq_id = ap_ssh_ovsh_nodec(command_line_args, 'id') + print("EQ Id: %s" % (eq_id)) + + # Now, query equipment to find something that matches. + eq = rv.get_customer_equipment(customer_id) + for item in eq: + for e in item['items']: + print(e['id'], " ", e['inventoryId']) + if e['inventoryId'].endswith("_%s" % (eq_id)): + print("Found equipment ID: %s inventoryId: %s" % (e['id'], e['inventoryId'])) + equipment_id = str(e['id']) + + rv.equipment_id = equipment_id + + if equipment_id == "-1": + print("EQ ID invalid: ", equipment_id) + sys.exit(1) + + yield rv + +@pytest.fixture(scope="session") +def instantiate_testrail(request): + yield TestRail_Client(create_command_line_args(request)) + +@pytest.fixture(scope="session") +def instantiate_jFrog(request): + yield GetBuild( + request.config.getini("jfrog-user-id"), + request.config.getini("jfrog-user-password"), + "pending", # TODO make this optional + url=request.config.getini("jfrog-base-url") + ) diff --git a/tests/helpers/utils.py b/tests/helpers/utils.py new file mode 100644 index 000000000..16451d23f --- /dev/null +++ b/tests/helpers/utils.py @@ -0,0 +1,64 @@ +import re +import requests +import json +import argparse + +# Map firmware directory name to cloud's model name. +cloud_sdk_models = { + "ec420": "EC420-G1", + "ea8300": "EA8300-CA", + "ecw5211": "ECW5211", + "ecw5410": "ECW5410", + "wf188n": "WF188N" + } + +# To better interoperate with libs that want to take a cmd-line-args thing vs +# the pytest request config. +def create_command_line_args(request): + parser = argparse.ArgumentParser(description="Fake") + command_line_args, unknown = parser.parse_known_args() + + # And then overwrite it with whatever pytest is using (which is likely same in many cases) + command_line_args.equipment_id = request.config.getoption("--equipment-id") + command_line_args.customer_id = request.config.getoption("--customer-id") + command_line_args.sdk_base_url = request.config.getoption("--sdk-base-url") + command_line_args.sdk_user_id = request.config.getoption("--sdk-user-id") + command_line_args.sdk_user_password = request.config.getoption("--sdk-user-password") + command_line_args.default_ap_profile = request.config.getoption("--default-ap-profile") + + command_line_args.verbose = request.config.getoption("--verbose") + + command_line_args.ap_ip = request.config.getoption("--ap-ip") + command_line_args.ap_username = request.config.getoption("--ap-username") + command_line_args.ap_password = request.config.getoption("--ap-password") + command_line_args.ap_jumphost_address = request.config.getoption("--ap-jumphost-address") + command_line_args.ap_jumphost_username = request.config.getoption("--ap-jumphost-username") + command_line_args.ap_jumphost_password = request.config.getoption("--ap-jumphost-password") + command_line_args.ap_jumphost_port = request.config.getoption("--ap-jumphost-port") + command_line_args.ap_jumphost_wlan_testing = request.config.getoption("--ap-jumphost-wlan-testing") # directory + command_line_args.ap_jumphost_tty = request.config.getoption("--ap-jumphost-tty") + + command_line_args.build_id = request.config.getoption("--build-id") + command_line_args.testbed = request.config.getoption("--testbed") + command_line_args.mode = request.config.getoption("--mode") + command_line_args.skip_wpa = request.config.getoption("--skip-wpa") + command_line_args.skip_wpa2 = request.config.getoption("--skip-wpa2") + command_line_args.skip_radius = request.config.getoption("--skip-radius") + command_line_args.skip_profiles = request.config.getoption("--skip-profiles") + command_line_args.ssid_2g_wpa = request.config.getoption("--ssid-2g-wpa") + command_line_args.ssid_5g_wpa = request.config.getoption("--ssid-5g-wpa") + command_line_args.psk_2g_wpa = request.config.getoption("--psk-2g-wpa") + command_line_args.psk_5g_wpa = request.config.getoption("--psk-5g-wpa") + command_line_args.ssid_2g_wpa2 = request.config.getoption("--ssid-2g-wpa2") + command_line_args.ssid_5g_wpa2 = request.config.getoption("--ssid-5g-wpa2") + command_line_args.psk_2g_wpa2 = request.config.getoption("--psk-2g-wpa2") + command_line_args.psk_5g_wpa2 = request.config.getoption("--psk-5g-wpa2") + + command_line_args.testrail_base_url = request.config.getoption("--testrail-base-url") + command_line_args.testrail_project = request.config.getoption("--testrail-project") + command_line_args.testrail_user_id = request.config.getoption("--testrail-user-id") + command_line_args.testrail_user_password = request.config.getoption("--testrail-user-password") + command_line_args.testrail_run_prefix = request.config.getoption("--testrail-run-prefix") + command_line_args.testrail_milestone = request.config.getoption("--testrail-milestone") + + return command_line_args diff --git a/tests/pytest/pytest.ini b/tests/pytest.ini similarity index 64% rename from tests/pytest/pytest.ini rename to tests/pytest.ini index 97b34e4a7..acea6fe28 100644 --- a/tests/pytest/pytest.ini +++ b/tests/pytest.ini @@ -1,15 +1,15 @@ [pytest] addopts= --junitxml=test_everything.xml # jFrog parameters -jfrog-base-url=tip.jFrog.io/artifactory/tip-wlan-ap-firmware +jfrog-base-url=https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/ jfrog-user-id=tip-read jfrog-user-password=tip-read # Cloud SDK parameters -sdk-base-url=wlan-portal-svc.cicd.lab.wlan.tip.build +sdk-base-url=https://wlan-portal-svc.cicd.lab.wlan.tip.build sdk-user-id=support@example.com sdk-user-password=support # Testrails parameters -testrail-base-url=telecominfraproject.testrail.com +testrail-base-url=https://telecominfraproject.testrail.com testrail-project=opsfleet-wlan testrail-user-id=gleb@opsfleet.com testrail-user-password=use_command_line_to_pass_this @@ -20,11 +20,13 @@ lanforge-radio=wiphy4 lanforge-ethernet-port=eth2 # Cloud SDK settings -sdk-customer-id=2 +customer-id=2 +# equipment ID is unique for each AP, have to be told what to use or query it based on other info. +equipment-id=-1 markers = featureA: marks tests as slow (deselect with '-m "not slow"') featureB featureC featureD - featureE \ No newline at end of file + featureE diff --git a/tests/pytest/conftest.py b/tests/pytest/conftest.py deleted file mode 100644 index 44c21def0..000000000 --- a/tests/pytest/conftest.py +++ /dev/null @@ -1,253 +0,0 @@ -import pytest -from time import sleep, gmtime, strftime - -import sys -import os -sys.path.append(os.path.join(os.path.dirname(__file__), 'helpers')) -from utils import CloudSDK_Client, TestRail_Client, jFrog_Client - -def pytest_addoption(parser): - parser.addini("jfrog-base-url", "jfrog base url") - parser.addini("jfrog-user-id", "jfrog username") - parser.addini("jfrog-user-password", "jfrog password") - parser.addini("sdk-base-url", "cloud sdk base url") - parser.addini("sdk-user-id", "cloud sdk username") - parser.addini("sdk-user-password", "cloud sdk user password") - parser.addini("sdk-customer-id", "cloud sdk customer id for the access points") - parser.addini("testrail-base-url", "testrail base url") - parser.addini("testrail-project", "testrail project name to use to generate test reports") - parser.addini("testrail-user-id", "testrail username") - parser.addini("testrail-user-password", "testrail user password") - parser.addini("lanforge-ip-address", "LANforge ip address to connect to") - parser.addini("lanforge-port-number", "LANforge port number to connect to") - parser.addini("lanforge-radio", "LANforge radio to use") - parser.addini("lanforge-ethernet-port", "LANforge ethernet adapter to use") - - parser.addoption( - "--testrail-user-password", - action="store", - default="password", - help="testrail user password", - type=str - ) - - # # Cloud SDK - # parser.addoption( - # "--sdk-base-url", - # action="store", - # default="wlan-portal-svc.cicd.lab.wlan.tip.build", - # help="cloudsdk base url", - # type=str - # ) - # parser.addoption( - # "--sdk-user-id", - # action="store", - # default="support@example.com", - # help="cloudsdk user id", - # type=str - # ) - # parser.addoption( - # "--sdk-user-password", - # action="store", - # default="support", - # help="cloudsdk user password", - # type=str - # ) - - # # jFrog - # parser.addoption( - # "--jfrog-base-url", - # action="store", - # default="tip.jFrog.io/artifactory/tip-wlan-ap-firmware", - # help="jfrog base url", - # type=str - # ) - # parser.addoption( - # "--jfrog-user-id", - # action="store", - # default="tip-read", - # help="jfrog user id", - # type=str - # ) - # parser.addoption( - # "--jfrog-user-password", - # action="store", - # default="tip-read", - # help="jfrog user password", - # type=str - # ) - - # # testrail - # parser.addoption( - # "--testrail-base-url", - # action="store", - # default="telecominfraproject.testrail.com", - # help="testrail base url", - # type=str - # ) - # parser.addoption( - # "--testrail-project", - # action="store", - # default="opsfleet-wlan", - # help="testrail project name", - # type=str - # ) - # parser.addoption( - # "--testrail-user-id", - # action="store", - # default="gleb@opsfleet.com", - # help="testrail user id", - # type=str - # ) - # parser.addoption( - # "--testrail-user-password", - # action="store", - # default="password", - # help="testrail user password", - # type=str - # ) - - # # lanforge - # parser.addoption( - # "--lanforge-ip-address", - # action="store", - # default="10.28.3.6", - # help="ip address of the lanforge gui", - # type=str - # ) - # parser.addoption( - # "--lanforge-port-number", - # action="store", - # default="8080", - # help="port of the lanforge gui", - # type=str - # ) - - # change behaviour - parser.addoption( - "--skip-update-firmware", - action="store_true", - default=False, - help="skip updating firmware on the AP (useful for local testing)" - ) - parser.addoption( - "--no-testrails", - action="store_true", - default=False, - help="do not generate testrails tests" - ) - # this has to be the last argument - # example: --access-points ECW5410 EA8300-EU - parser.addoption( - "--access-points", - nargs="+", - default=[ "ECW5410" ], - help="list of access points to test" - ) - -def pytest_generate_tests(metafunc): - metafunc.parametrize("access_points", metafunc.config.getoption('--access-points'), scope="session") - -# run something after all tests are done regardless of the outcome -def pytest_unconfigure(config): - print("Tests cleanup done") - -@pytest.fixture(scope="session") -def setup_testrails(request, instantiate_testrail, access_points): - if request.config.getoption("--no-testrails"): - yield -1 - return # needed to stop fixture execution - if request.config.getoption("--skip-update-firmware"): - firmware_update_case = [] - else: - firmware_update_case = [ 2831 ] - seen = {None} - test_data = [] - session = request.node - for item in session.items: - cls = item.getparent(pytest.Class) - if cls not in seen: - if hasattr(cls.obj, "get_test_data"): - test_data.append(cls.obj.get_test_data()) - seen.add(cls) - testrail_project_id = instantiate_testrail.get_project_id(request.config.getini("testrail-project")) - runId = instantiate_testrail.create_testrun( - name=f'Nightly_model_{access_points}_{strftime("%Y-%m-%d", gmtime())}', - case_ids=( [*test_data] + firmware_update_case ), - project_id=testrail_project_id - ) - yield runId - -@pytest.fixture(scope="session") -def setup_cloudsdk(request, instantiate_cloudsdk): - # snippet to do cleanup after all the tests are done - def fin(): - print("Cloud SDK cleanup done") - request.addfinalizer(fin) - instantiate_cloudsdk.set_ap_profile(3, 6) - yield { - "LANforge": { - "host": request.config.getini("lanforge-ip-address"), - "port": request.config.getini("lanforge-port-number"), - "radio": request.config.getini("lanforge-radio"), - "eth_port": request.config.getini("lanforge-ethernet-port"), - "runtime_duration": 15 - }, - "24ghz": { - "ssid": "TipWlan-cloud-wifi", - "password": "w1r3l3ss-fr33d0m", - "station_names": [ "sta2237" ] - } - } - -@pytest.fixture(scope="session") -def update_firmware(request, setup_testrails, instantiate_jFrog, instantiate_cloudsdk, access_points): - if request.config.getoption("--skip-update-firmware"): - return - latest_image = instantiate_jFrog.get_latest_image(access_points) - if latest_image in instantiate_cloudsdk.get_images(access_points): - model_firmware_id = instantiate_cloudsdk.get_firmware_id(latest_image) - else: - fw_url = instantiate_jFrog.get_latest_image_url(access_points, latest_image) - fw_upload_status = instantiate_cloudsdk.firwmare_upload(access_points, latest_image, fw_url) - model_firmware_id = fw_upload_status['id'] - - # Get Current AP Firmware and upgrade\run tests if needed - # currently the AP id is hardcoded, but it should be looked up during the tests and not hardcoded in the config files or parameters - ap_fw = instantiate_cloudsdk.ap_firmware(request.config.getini("sdk-customer-id"), 3) - if ap_fw == latest_image: - pytest.skip("Do not need to upgrade firmware") - else: - instantiate_cloudsdk.update_firmware(3, model_firmware_id) - sleep_counter = 0 - while True: - sleep_counter += 1 - if instantiate_cloudsdk.ap_firmware(2, 3) == latest_image: - return - if sleep_counter > 0: - return - sleep(60) - -@pytest.fixture(scope="session") -def instantiate_cloudsdk(request): - yield CloudSDK_Client( - request.config.getini("sdk-base-url"), - request.config.getini("sdk-user-id"), - request.config.getini("sdk-user-password") - ) - -@pytest.fixture(scope="session") -def instantiate_testrail(request): - yield TestRail_Client( - request.config.getini("testrail-base-url"), - request.config.getini("testrail-user-id"), - request.config.getoption("--testrail-user-password") - ) - -@pytest.fixture(scope="session") -def instantiate_jFrog(request): - yield jFrog_Client( - request.config.getini("jfrog-base-url"), - request.config.getini("jfrog-user-id"), - request.config.getini("jfrog-user-password") - ) diff --git a/tests/pytest/helpers/utils.py b/tests/pytest/helpers/utils.py deleted file mode 100644 index a1267e140..000000000 --- a/tests/pytest/helpers/utils.py +++ /dev/null @@ -1,186 +0,0 @@ -import re -import requests -import json - -# Class to interact with Testrail -class TestRail_Client: - def __init__(self, url, user, password): - self.user = user - self.password = password - self.__url = f"https://{url}/index.php?/api/v2/" - - def send_get(self, uri, filepath=None): - """Issue a GET request (read) against the API. - - Args: - uri: The API method to call including parameters, e.g. get_case/1. - filepath: The path and file name for attachment download; used only - for "get_attachment/:attachment_id". - - Returns: - A dict containing the result of the request. - """ - return self.__send_request("GET", uri, filepath) - - def send_post(self, uri, data): - """Issue a POST request (write) against the API. - - Args: - uri: The API method to call, including parameters, e.g. add_case/1. - data: The data to submit as part of the request as a dict; strings - must be UTF-8 encoded. If adding an attachment, must be the - path to the file. - - Returns: - A dict containing the result of the request. - """ - return self.__send_request("POST", uri, data) - - def __send_request(self, method, uri, data): - url = self.__url + uri - headers = { - "Content-Type": "application/json" - } - - if method == "POST": - if uri[:14] == "add_attachment": # add_attachment API method - files = { "attachment": open(data, "rb") } - response = requests.post(url, headers=headers, files=files, auth=(self.user, self.password)) - files["attachment"].close() - else: - payload = bytes(json.dumps(data), "utf-8") - response = requests.post(url, headers=headers, data=payload, auth=(self.user, self.password)) - else: - response = requests.get(url, headers=headers, auth=(self.user, self.password)) - - if response.status_code > 201: - try: - error = response.json() - except: # response.content not formatted as JSON - error = str(response.content) - return - else: - if uri[:15] == "get_attachments": # Expecting file, not JSON - try: - logging.info (str(response.content)) - open(data, "wb").write(response.content) - return (data) - except: - return ("Error saving attachment.") - else: - try: - return response.json() - except: # Nothing to return - return {} - - def get_project_id(self, project_name): - "Get the project ID using project name" - projects = self.send_get("get_projects") - for project in projects: - if project["name"] == project_name: - return project["id"] - - def update_testrail(self, case_id, run_id, status_id, msg): - result = self.send_post( - f"add_result_for_case/{run_id}/{case_id}", - { "status_id": status_id, "comment": msg } - ) - - def create_testrun(self, name, case_ids, project_id): - result = self.send_post( - f"add_run/{project_id}", - {"name": name, "case_ids": case_ids, "include_all": False} - ) - return result["id"] - -# Class for jFrog Interaction -class jFrog_Client: - def __init__(self, url, user, password): - self.user = user - self.password = password - self.baseUrl = f"https://{url}" - - def get_latest_image(self, model): - # todo handle auth errors - response = requests.get(f"{self.baseUrl}/{model}/dev/", auth=(self.user, self.password)) - return re.findall('href="(.+pending.+).tar.gz"', response.text)[-1] - - def get_latest_image_url(self, model, latest_image): - return f"https://{self.user}:{self.password}@{self.baseUrl}/{model}/dev/{latest_image}.tar.gz" - -# Class for CloudSDK Interaction via RestAPI -class CloudSDK_Client: - def __init__(self, url, user, password): - self.baseUrl = f"https://{url}" - cloud_login_url = f"{self.baseUrl}/management/v1/oauth2/token" - payload = { - "userId": user, - "password": password - } - headers = { - "Content-Type": "application/json" - } - try: - token_response = requests.post(cloud_login_url, headers=headers, data=json.dumps(payload)) - except requests.exceptions.RequestException as e: - raise SystemExit(f"Exiting Script! Cloud not get bearer token for reason: {e}") - token_data = token_response.json() - self.headers = { - "Authorization": f"Bearer {token_data['access_token']}" - } - - def ap_firmware(self, customer_id, equipment_id): - equip_fw_url = f"{self.baseUrl}/portal/status/forEquipment?customerId={customer_id}&equipmentId={equipment_id}&statusDataTypes=" - status_response = requests.get(equip_fw_url, headers=self.headers) - return (status_response.json())[2]["details"]["reportedSwVersion"] - - def get_images(self, apModel): - getFW_url = f"{self.baseUrl}/portal/firmware/version/byEquipmentType?equipmentType=AP&modelId={apModel}" - status_response = requests.get(getFW_url, headers=self.headers) - return([ version.get("versionName") for version in status_response.json()]) - - def firwmare_upload(self, apModel, latest_image, fw_url): - fw_upload_url = f"{self.baseUrl}/portal/firmware/version" - payload = { - "model_type": "FirmwareVersion", - "id": 0, - "equipmentType": "AP", - "modelId": apModel, - "versionName": latest_image, - "description": "", - "filename": fw_url, - "commit": latest_image.split("-")[-1], - "validationMethod": "MD5_CHECKSUM", - "validationCode": "19494befa87eb6bb90a64fd515634263", - "releaseDate": 1596192028877, - "createdTimestamp": 0, - "lastModifiedTimestamp": 0 - } - self.headers["Content-Type"] = "application/json" - response = requests.post(fw_upload_url, headers=self.headers, data=json.dumps(payload)) - self.headers.pop("Content-Type", None) - return(response.json()) - - def get_firmware_id(self, image): - fw_id_url = f"{self.baseUrl}/portal/firmware/version/byName?firmwareVersionName={image}" - response = requests.get(fw_id_url, headers=self.headers) - fw_data = response.json() - return fw_data["id"] - - def update_firmware(self, equipment_id, latest_firmware_id): - url = f"{self.baseUrl}/portal/equipmentGateway/requestFirmwareUpdate?equipmentId={equipment_id}&firmwareVersionId={latest_firmware_id}" - response = requests.post(url, headers=self.headers) - - def set_ap_profile(self, equipment_id, test_profile_id): - url = f"{self.baseUrl}/portal/equipment?equipmentId={equipment_id}" - response = requests.get(url, headers=self.headers) - - # Add Lab Profile ID to Equipment - equipment_info = response.json() - equipment_info["profileId"] = test_profile_id - - # Update AP Info with Required Profile ID - url = f"{self.baseUrl}/portal/equipment" - self.headers["Content-Type"] = "application/json" - response = requests.put(url, headers=self.headers, data=json.dumps(equipment_info)) - self.headers.pop("Content-Type", None) diff --git a/tests/templates/radius_profile_template.json b/tests/templates/radius_profile_template.json new file mode 100644 index 000000000..2af9ee0f8 --- /dev/null +++ b/tests/templates/radius_profile_template.json @@ -0,0 +1 @@ +{"model_type": "Profile", "id": 129, "customerId": "2", "profileType": "radius", "name": "Automation_Radius_Nightly-01", "details": {"model_type": "RadiusProfile", "primaryRadiusAuthServer": {"model_type": "RadiusServer", "ipAddress": "18.189.25.141", "secret": "testing123", "port": 1812, "timeout": 5}, "secondaryRadiusAuthServer": null, "primaryRadiusAccountingServer": null, "secondaryRadiusAccountingServer": null, "profileType": "radius"}, "createdTimestamp": 1602263176599, "lastModifiedTimestamp": 1611708334061, "childProfileIds": []} \ No newline at end of file diff --git a/tests/pytest/test_24ghz.py b/tests/test_24ghz.py similarity index 53% rename from tests/pytest/test_24ghz.py rename to tests/test_24ghz.py index 0f5dd8c11..fbe6e8686 100644 --- a/tests/pytest/test_24ghz.py +++ b/tests/test_24ghz.py @@ -2,6 +2,8 @@ # https://docs.pytest.org/en/latest/usage.html # http://pythontesting.net/framework/pytest/pytest-introduction/ +import sys + import pytest from time import sleep, gmtime, strftime from sta_connect2 import StaConnect2 @@ -11,22 +13,21 @@ from sta_connect2 import StaConnect2 @pytest.mark.usefixtures('update_firmware') @pytest.mark.usefixtures('instantiate_testrail') class Test24ghz(object): - @pytest.mark.featureA + @pytest.mark.client_connectivity def test_single_client_wpa2(self, setup_testrails, setup_cloudsdk, update_firmware, instantiate_testrail): - lf_config = setup_cloudsdk["LANforge"] - radio_config = setup_cloudsdk["24ghz"] - - staConnect = StaConnect2(lf_config["host"], lf_config["port"], debug_ = False) + lf_config = setup_cloudsdk["lanforge"] + # ap_profile = setup_cloudsdk["ap_object"] + staConnect = StaConnect2(lf_config["ip"], lf_config["port"], debug_=False) staConnect.sta_mode = 0 staConnect.upstream_resource = 1 staConnect.upstream_port = lf_config["eth_port"] - staConnect.radio = lf_config["radio"] - staConnect.runtime_secs = lf_config["runtime_duration"] + staConnect.radio = lf_config["2g_radio"] + # staConnect.runtime_secs = lf_config["runtime_duration"] staConnect.resource = 1 - staConnect.dut_ssid = radio_config["ssid"] - staConnect.dut_passwd = radio_config["password"] + staConnect.dut_ssid = "NOLA-01g-ecw5410-2G_WPA2" + staConnect.dut_passwd = "ecw5410-2G_WPA2" staConnect.dut_security = "wpa2" - staConnect.station_names = radio_config["station_names"] + staConnect.station_names = ['sta0000'] staConnect.bringup_time_sec = 60 staConnect.cleanup_on_exit = True staConnect.setup() @@ -39,19 +40,27 @@ class Test24ghz(object): if setup_testrails > 0: instantiate_testrail.update_testrail(case_id=2835, run_id=setup_testrails, status_id=1, msg="testing") - @pytest.mark.featureB - def test_feature_b(self): - pass + # @pytest.mark.client_connectivity + # def test_single_client_wpa(self): + # pass + # + # @pytest.mark.client_connectivity + # def test_single_client_eap(self): + # pass - @pytest.mark.featureC - def test_feature_c(self): - assert 1 == 0 + #@pytest.mark.featureB + #def test_feature_b(self): + # pass - @pytest.mark.featureD - def test_feature_d(self): - pytest.skip("speedup") + #@pytest.mark.featureC + #def test_feature_c(self): + # assert 1 == 0 - @pytest.mark.xfail - @pytest.mark.featureE - def test_feature_e(self): - assert 1 == 0 + #@pytest.mark.featureD + #def test_feature_d(self): + # pytest.skip("speedup") + + #@pytest.mark.xfail + #@pytest.mark.featureE + #def test_feature_e(self): + # assert 1 == 0 diff --git a/tools/USAGE_EXAMPLES.txt b/tools/USAGE_EXAMPLES.txt index 284d79d2c..26de00b41 100644 --- a/tools/USAGE_EXAMPLES.txt +++ b/tools/USAGE_EXAMPLES.txt @@ -8,6 +8,7 @@ ssh -C -L 8800:lf1:4002 -L 8801:lf1:5901 -L 8802:lf1:8080 -L 8803:lab-ctlr:22 \ -L 8890:lf9:4002 -L 8891:lf9:5901 -L 8892:lf9:8080 -L 8893:lab-ctlr3:22 \ -L 8900:lf10:4002 -L 8901:lf10:5901 -L 8902:lf10:8080 -L 8903:lab-ctlr3:22 \ -L 8910:lf11:4002 -L 8911:lf11:5901 -L 8912:lf11:8080 -L 8913:lab-ctlr3:22 \ + -L 8950:lf15:4002 -L 8951:lf15:5901 -L 8952:lf115:8080 -L 8953:lab-ctlr4:22 \ -L 8820:lf12:4002 -L 8821:lf12:5901 -L 8822:lf12:8080 -L 8823:lab-ctlr4:22 \ ubuntu@orch @@ -20,7 +21,14 @@ The ports are used as: Each testbed will have a set of 4 ssh tunnels. Some are duplicated since lab-controllers are shared. I figure a consistent pattern is worth a few duplicated tunnels. - + +Testbed-01 + +# Set AP profile on NOLA-01 +./sdk_set_profile.py --testrail-user-id NONE --model ecw5410 --ap-jumphost-address localhost --ap-jumphost-port 8803 --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP1 --lanforge-ip-address localhost --lanforge-port-number 8802 --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-01" --ssid-5g-wpa2 Default-SSID-5gl --psk-5g-wpa2 12345678 --ssid-2g-wpa2 Default-SSID-2g --psk-2g-wpa2 12345678 --mode bridge --sdk-base-url https://wlan-portal-svc-nola-01.cicd.lab.wlan.tip.build + + +./Nightly_Sanity.py --testrail-user-id NONE --model ecw5410 --ap-jumphost-address localhost --ap-jumphost-port 8803 --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP1 --testbed "NOLA-01r" --lanforge-ip-address localhost --lanforge-port-number 8802 --default_ap_profile TipWlan-2-Radios --lanforge-2g-radio 1.1.wiphy4 --lanforge-5g-radio 1.1.wiphy5 --skip-upgrade True --testrail-milestone milestone-1 --sdk-base-url https://wlan-portal-svc-nola-01.cicd.lab.wlan.tip.build Testbed-09 (perfecto) @@ -29,33 +37,90 @@ Testbed-09 (perfecto) ./sdk_set_profile.py --testrail-user-id NONE --model ecw5410 --ap-jumphost-address localhost --ap-jumphost-port 8893 \ --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP4 \ --lanforge-ip-address localhost --lanforge-port-number 8892 \ - --default-ap-profile TipWlan-2-Radios --sdk-base-url https://wlan-portal-svc.cicd.lab.wlan.tip.build \ + --default-ap-profile TipWlan-2-Radios --sdk-base-url https://wlan-portal-svc-nola-01.cicd.lab.wlan.tip.build \ --skip-radius --skip-wpa --verbose --testbed "NOLA-09b" \ --ssid-5g-wpa2 Default-SSID-5gl-perfecto-b --psk-5g-wpa2 12345678 \ - --ssid-2g-wpa2 Default-SSID-2g-perfecto-b --psk-2g-wpa2 12345678 + --ssid-2g-wpa2 Default-SSID-2g-perfecto-b --psk-2g-wpa2 12345678 --mode bridge + +# Upgrade 'b' chamber AP +./sdk_upgrade_fw.py --testrail-user-id NONE --model ecw5410 --ap-jumphost-address localhost --ap-jumphost-port 8893 \ + --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP4 --testbed \"NOLA-09b\" \ + --sdk-base-url https://wlan-portal-svc-nola-01.cicd.lab.wlan.tip.build --force-upgrade true # Set AP profile (ssid, etc) on 'a' chamber. AP is ttyAP1 ./sdk_set_profile.py --testrail-user-id NONE --model ecw5410 --ap-jumphost-address localhost --ap-jumphost-port 8893 \ --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP1 \ --lanforge-ip-address localhost --lanforge-port-number 8892 \ - --default-ap-profile TipWlan-2-Radios --sdk-base-url https://wlan-portal-svc.cicd.lab.wlan.tip.build \ + --default-ap-profile TipWlan-2-Radios --sdk-base-url https://wlan-portal-svc-nola-01.cicd.lab.wlan.tip.build \ --skip-radius --skip-wpa --verbose --testbed "NOLA-09a" \ --ssid-5g-wpa2 Default-SSID-5gl-perfecto --psk-5g-wpa2 12345678 \ - --ssid-2g-wpa2 Default-SSID-2g-perfecto --psk-2g-wpa2 12345678 + --ssid-2g-wpa2 Default-SSID-2g-perfecto --psk-2g-wpa2 12345678 --mode bridge + +# Upgrade 'a' chamber AP +./sdk_upgrade_fw.py --testrail-user-id NONE --model ecw5410 --ap-jumphost-address localhost --ap-jumphost-port 8893 \ + --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP1 --testbed \"NOLA-09a\" \ + --sdk-base-url https://wlan-portal-svc-nola-01.cicd.lab.wlan.tip.build --force-upgrade true + Testbed 10 (Advanced setup, 2D turntable chamber plus medium chamber, RF attenuator, etc) ./sdk_set_profile.py --testrail-user-id NONE --model ecw5410 --ap-jumphost-address localhost --ap-jumphost-port 8903 \ --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP2 --lanforge-ip-address localhost --lanforge-port-number 8902 \ - --default-ap-profile TipWlan-2-Radios --sdk-base-url https://wlan-portal-svc.cicd.lab.wlan.tip.build \ + --default-ap-profile TipWlan-2-Radios --sdk-base-url https://wlan-portal-svc-nola-01.cicd.lab.wlan.tip.build \ --skip-radius --skip-wpa --verbose --testbed "NOLA-10" --ssid-5g-wpa2 Default-SSID-5gl --psk-5g-wpa2 12345678 \ - --ssid-2g-wpa2 Default-SSID-2g --psk-2g-wpa2 12345678 + --ssid-2g-wpa2 Default-SSID-2g --psk-2g-wpa2 12345678 --mode bridge + +# Upgrade AP +./sdk_upgrade_fw.py --testrail-user-id NONE --model ecw5410 --ap-jumphost-address localhost --ap-jumphost-port 8903 \ + --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP2 --testbed \"NOLA-10\" \ + --sdk-base-url https://wlan-portal-svc-nola-01.cicd.lab.wlan.tip.build --force-upgrade true + Testbed 11 (Advanced setup, 2D turntable chamber plus medium chamber, RF attenuator, etc) ./sdk_set_profile.py --testrail-user-id NONE --model eap102 --ap-jumphost-address localhost --ap-jumphost-port 8913 \ --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP3 --lanforge-ip-address localhost --lanforge-port-number 8912 \ - --default-ap-profile TipWlan-2-Radios --sdk-base-url https://wlan-portal-svc.cicd.lab.wlan.tip.build \ + --default-ap-profile TipWlan-2-Radios --sdk-base-url https://wlan-portal-svc-nola-01.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 --mode bridge + +# Upgrade AP +./sdk_upgrade_fw.py --testrail-user-id NONE --model eap102 --ap-jumphost-address localhost --ap-jumphost-port 8913 \ + --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP3 --testbed \"NOLA-11\" \ + --sdk-base-url https://wlan-portal-svc-nola-01.cicd.lab.wlan.tip.build --force-upgrade true + + +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 + +# Query an ssid +./query_sdk.py --testrail-user-id NONE --model wf188n --sdk-base-url https://wlan-portal-svc-ben-testbed.cicd.lab.wlan.tip.build \ + --sdk-user-id support@example.com --sdk-user-password support --equipment_id 3 --type profile --cmd get --object_id 11 + + +Testbed-15 + +# Set AP profile on NOLA-15 +./sdk_set_profile.py --testrail-user-id NONE --model ecw5410 --ap-jumphost-address localhost --ap-jumphost-port 8953 \ + --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP4 --lanforge-ip-address localhost --lanforge-port-number 8952 \ + --default-ap-profile TipWlan-2-Radios --sdk-base-url https://wlan-portal-svc-nola-15.cicd.lab.wlan.tip.build \ + --skip-radius --skip-wpa --verbose --testbed "NOLA-15" --ssid-5g-wpa2 Default-SSID-5gl --psk-5g-wpa2 12345678 \ + --ssid-2g-wpa2 Default-SSID-2g --psk-2g-wpa2 12345678 --mode bridge + +# Update firmware +./sdk_upgrade_fw.py --testrail-user-id NONE --model ecw5410 --ap-jumphost-address localhost --ap-jumphost-port 8953 \ + --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP4 --testbed \"NOLA-15\" \ + --sdk-base-url https://wlan-portal-svc-nola-15.cicd.lab.wlan.tip.build --force-upgrade true + + diff --git a/tools/debug_nola01.sh b/tools/debug_nola01.sh index 19700762f..1d9644e0e 100755 --- a/tools/debug_nola01.sh +++ b/tools/debug_nola01.sh @@ -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" diff --git a/tools/debug_nola12.sh b/tools/debug_nola12.sh index ebf447258..648b242ef 100755 --- a/tools/debug_nola12.sh +++ b/tools/debug_nola12.sh @@ -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" diff --git a/tools/query_ap.py b/tools/query_ap.py index 42c8dd20a..2cb44532a 100755 --- a/tools/query_ap.py +++ b/tools/query_ap.py @@ -15,7 +15,8 @@ parser.add_argument("--cmd", type=str, help="Command-line to run on AP", parser.add_argument("--ap_ssh", type=str, help="ap_ssh method to execute.", default = None, choices=["get_vif_config", "get_vif_state"]) -base = UnitTestBase("query-ap", parser) +reporting = Reporting(reports_root=os.getcwd() + "/reports/") +base = UnitTestBase("query-ap", parser, reporting) cmd = base.command_line_args.cmd diff --git a/tools/query_sdk.py b/tools/query_sdk.py index cd8808233..f67feb40e 100755 --- a/tools/query_sdk.py +++ b/tools/query_sdk.py @@ -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'], @@ -19,7 +19,9 @@ parser.add_argument("--brief", type=str, help="Show output in brief mode?", choices=["true", "false"], default = "false") -base = UnitTestBase("query-sdk", parser) +reporting = Reporting(reports_root=os.getcwd() + "/reports/") + +base = UnitTestBase("query-sdk", parser, reporting) qtype = base.command_line_args.type cmd = base.command_line_args.cmd @@ -95,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) @@ -123,7 +136,7 @@ if qtype == 'all' or qtype == 'equipment': # Get equipment info try: if cmd == "get": - rv = base.cloud.get_customer_equipment(base.cloudSDK_url, base.bearer, base.customer_id) + rv = base.cloud.get_customer_equipment(base.customer_id) print("Equipment for customer %s:"%(base.customer_id)) #jobj = json.load(ssids) for e in rv: diff --git a/tools/sdk_set_profile.py b/tools/sdk_set_profile.py index 120ba5cca..dedc15452 100755 --- a/tools/sdk_set_profile.py +++ b/tools/sdk_set_profile.py @@ -18,57 +18,55 @@ sys.path.append(f'../tests') from UnitTestBase import * from cloudsdk import CreateAPProfiles - - - def main(): - - - parser = argparse.ArgumentParser(description="SDK Set Profile", add_help=False) parser.add_argument("--default-ap-profile", type=str, help="Default AP profile to use as basis for creating new ones, typically: TipWlan-2-Radios or TipWlan-3-Radios", required=True) parser.add_argument("--skip-radius", dest="skip_radius", action='store_true', - help="Should we skip the RADIUS configs or not") + help="Should we skip the RADIUS configs or not", default=False) parser.add_argument("--skip-wpa", dest="skip_wpa", action='store_true', - help="Should we skip the WPA ssid or not") + help="Should we skip the WPA ssid or not", default=False) parser.add_argument("--skip-wpa2", dest="skip_wpa2", action='store_true', - help="Should we skip the WPA2 ssid or not") - parser.set_defaults(skip_radius=False) - parser.set_defaults(skip_wpa=False) - parser.set_defaults(skip_wpa2=False) + help="Should we skip the WPA2 ssid or not", default=False) parser.add_argument("--skip-profiles", dest="skip_profiles", action='store_true', - help="Should we skip creating new ssid profiles?") - parser.set_defaults(skip_profiles=False) + help="Should we skip creating new ssid profiles?", default=False) - parser.add_argument("--psk-5g-wpa2", type=str, + parser.add_argument("--psk-5g-wpa2", dest="psk_5g_wpa2", type=str, help="Allow over-riding the 5g-wpa2 PSK value.") - parser.add_argument("--psk-5g-wpa", type=str, + parser.add_argument("--psk-5g-wpa", dest="psk_5g_wpa", type=str, help="Allow over-riding the 5g-wpa PSK value.") - parser.add_argument("--psk-2g-wpa2", type=str, + parser.add_argument("--psk-2g-wpa2", dest="psk_2g_wpa2", type=str, help="Allow over-riding the 2g-wpa2 PSK value.") - parser.add_argument("--psk-2g-wpa", type=str, + parser.add_argument("--psk-2g-wpa", dest="psk_2g_wpa", type=str, help="Allow over-riding the 2g-wpa PSK value.") - parser.add_argument("--ssid-5g-wpa2", type=str, + parser.add_argument("--ssid-5g-wpa2", dest="ssid_5g_wpa2", type=str, help="Allow over-riding the 5g-wpa2 SSID value.") - parser.add_argument("--ssid-5g-wpa", type=str, + parser.add_argument("--ssid-5g-wpa", dest="ssid_5g_wpa", type=str, help="Allow over-riding the 5g-wpa SSID value.") - parser.add_argument("--ssid-2g-wpa2", type=str, + parser.add_argument("--ssid-2g-wpa2", dest="ssid_2g_wpa2", type=str, help="Allow over-riding the 2g-wpa2 SSID value.") - parser.add_argument("--ssid-2g-wpa", type=str, + parser.add_argument("--ssid-2g-wpa", dest="ssid_2g_wpa", type=str, help="Allow over-riding the 2g-wpa SSID value.") + parser.add_argument("--mode", dest="mode", choices=['bridge', 'nat', 'vlan'], type=str, + help="Mode of AP Profile [bridge/nat/vlan]", required=True) + + parser.add_argument("--sleep-after-profile", dest="sleep", type=int, + help="Enter the sleep interval delay between each profile push", required=False, default=5000) + # Not implemented yet. + #parser.add_argument("--rf-mode", type=str, + # choices=["modeN", "modeAC", "modeGN", "modeX", "modeA", "modeB", "modeG", "modeAB"], + # help="Allow over-riding the 2g-wpa SSID value.") - - - + reporting = Reporting(reports_root=os.getcwd() + "/reports/") base = UnitTestBase("skd-set-profile", parser) command_line_args = base.command_line_args + print(command_line_args.mode) # cmd line takes precedence over env-vars. cloudSDK_url = command_line_args.sdk_base_url # was os.getenv('CLOUD_SDK_URL') @@ -98,8 +96,6 @@ def main(): lanforge_ip = command_line_args.lanforge_ip_address lanforge_port = command_line_args.lanforge_port_number lanforge_prefix = command_line_args.lanforge_prefix - lanforge_2g_radio = command_line_args.lanforge_2g_radio - lanforge_5g_radio = command_line_args.lanforge_5g_radio build = command_line_args.build_id @@ -128,7 +124,7 @@ def main(): print("EQ Id: %s" % (eq_id)) # Now, query equipment to find something that matches. - eq = cloud.get_customer_equipment(cloudSDK_url, bearer, customer_id) + eq = cloud.get_customer_equipment(customer_id) for item in eq: for e in item['items']: print(e['id'], " ", e['inventoryId']) @@ -153,15 +149,8 @@ def main(): fw_model = ap_cli_fw.partition("-")[0] - print('Current Active AP FW from CLI:', ap_cli_fw) - ###Find Latest FW for Current AP Model and Get FW ID - - ############################################################################ - #################### Create Report ######################################### - ############################################################################ - # Create Report Folder for Today today = str(date.today()) try: @@ -173,62 +162,54 @@ def main(): logger.info('Report data can be found here: ' + report_path + today) - ##Get Bearer Token to make sure its valid (long tests can require re-auth) + # Get Bearer Token to make sure its valid (long tests can require re-auth) bearer = cloud.get_bearer(cloudSDK_url, cloud_type) radius_name = "%s-%s-%s" % (command_line_args.testbed, fw_model, "Radius") - obj = CreateAPProfiles(command_line_args, cloud=cloud, client=client, fw_model=fw_model) + sleep = command_line_args.sleep + sleep = sleep/1000 - # Allow cmd-line to override - if command_line_args.psk_5g_wpa2: - obj.psk_data["5g"]["wpa2"]["name"] = command_line_args.psk_5g_wpa2 - obj.psk_data["5g"]["wpa2"]["nat"] = command_line_args.psk_5g_wpa2 - obj.psk_data["5g"]["wpa2"]["vlan"] = command_line_args.psk_5g_wpa2 - if command_line_args.psk_5g_wpa: - obj.psk_data["5g"]["wpa"]["name"] = command_line_args.psk_5g_wpa - obj.psk_data["5g"]["wpa"]["nat"] = command_line_args.psk_5g_wpa - obj.psk_data["5g"]["wpa"]["vlan"] = command_line_args.psk_5g_wpa - if command_line_args.psk_2g_wpa2: - obj.psk_data["2g"]["wpa2"]["name"] = command_line_args.psk_2g_wpa2 - obj.psk_data["2g"]["wpa2"]["nat"] = command_line_args.psk_2g_wpa2 - obj.psk_data["2g"]["wpa2"]["vlan"] =command_line_args.psk_2g_wpa2 - if command_line_args.psk_2g_wpa: - obj.psk_data["2g"]["wpa"]["name"] = command_line_args.psk_2g_wpa - obj.psk_data["2g"]["wpa"]["nat"] = command_line_args.psk_2g_wpa - obj.psk_data["2g"]["wpa"]["nat"] = command_line_args.psk_2g_wpa - if command_line_args.ssid_5g_wpa2: - obj.ssid_data["5g"]["wpa2"]["name"] = command_line_args.ssid_5g_wpa2 - obj.ssid_data["5g"]["wpa2"]["nat"] = command_line_args.ssid_5g_wpa2 - obj.ssid_data["5g"]["wpa2"]["vlan"] = command_line_args.ssid_5g_wpa2 - if command_line_args.ssid_5g_wpa: - obj.ssid_data["5g"]["wpa"]["name"] = command_line_args.ssid_5g_wpa - obj.ssid_data["5g"]["wpa"]["nat"] = command_line_args.ssid_5g_wpa - obj.ssid_data["5g"]["wpa"]["vlan"] = command_line_args.ssid_5g_wpa - if command_line_args.ssid_2g_wpa2: - obj.ssid_data["2g"]["wpa2"]["name"] = command_line_args.ssid_2g_wpa2 - obj.ssid_data["2g"]["wpa2"]["nat"] = command_line_args.ssid_2g_wpa2 - obj.ssid_data["2g"]["wpa2"]["vlan"] = command_line_args.ssid_2g_wpa2 - if command_line_args.ssid_2g_wpa: - obj.ssid_data["2g"]["wpa"]["name"] = command_line_args.ssid_2g_wpa - obj.ssid_data["2g"]["wpa"]["nat"] = command_line_args.ssid_2g_wpa - obj.ssid_data["2g"]["wpa"]["vlan"] = command_line_args.ssid_2g_wpa - - print("creating Profiles") - ssid_template = "TipWlan-Cloud-Wifi" - - - - if not command_line_args.skip_profiles: - if not command_line_args.skip_radius: - obj.create_radius_profile(radius_name, rid, key) - obj.create_ssid_profiles(ssid_template=ssid_template, skip_wpa2=command_line_args.skip_wpa2, - skip_wpa=command_line_args.skip_wpa, skip_eap=command_line_args.skip_radius) - - print("Create AP with equipment-id: ", equipment_id) - obj.create_ap_bridge_profile(eq_id=equipment_id, fw_model=fw_model) - obj.validate_changes() + args = command_line_args print("Profiles Created") + ap_object = CreateAPProfiles(args, cloud=cloud, client=client, fw_model=fw_model, sleep=sleep) + + # Logic to create AP Profiles (Bridge Mode) + + ap_object.set_ssid_psk_data(ssid_2g_wpa=args.ssid_2g_wpa, + ssid_5g_wpa=args.ssid_5g_wpa, + psk_2g_wpa=args.psk_2g_wpa, + psk_5g_wpa=args.psk_5g_wpa, + ssid_2g_wpa2=args.ssid_2g_wpa2, + ssid_5g_wpa2=args.ssid_5g_wpa2, + psk_2g_wpa2=args.psk_2g_wpa2, + psk_5g_wpa2=args.psk_5g_wpa2) + + print(ap_object) + rid = client.get_run_id(test_run_name=args.testrail_run_prefix + fw_model + "_" + today + "_" + "ecw5410-2021-02-12-pending-e8bb466") + print("creating Profiles") + ssid_template = "TipWlan-Cloud-Wifi" + + if not args.skip_profiles: + if not args.skip_radius: + # Radius Profile needs to be set here + radius_name = "Test-Radius-" + str(time.time()).split(".")[0] + radius_template = "templates/radius_profile_template.json" + ap_object.create_radius_profile(radius_name=radius_name, radius_template=radius_template, rid=rid, key=fw_model) + + ap_object.create_ssid_profiles(ssid_template=ssid_template, skip_eap=args.skip_radius, skip_wpa=args.skip_wpa, + skip_wpa2=args.skip_wpa2, mode=args.mode) + + + print("Create AP with equipment-id: ", equipment_id) + time.sleep(sleep) + ap_object.create_ap_profile(eq_id=equipment_id, fw_model=fw_model, mode=args.mode) + ap_object.validate_changes(mode=args.mode) + time.sleep(5) + ap_object.cleanup_profile(equipment_id=equipment_id) + print("Profiles Created") + + main() diff --git a/tools/sdk_upgrade_fw.py b/tools/sdk_upgrade_fw.py index a3a3a3706..edaf9c10b 100755 --- a/tools/sdk_upgrade_fw.py +++ b/tools/sdk_upgrade_fw.py @@ -88,7 +88,7 @@ if equipment_id == "-1": print("EQ Id: %s"%(eq_id)) # Now, query equipment to find something that matches. - eq = cloud.get_customer_equipment(cloudSDK_url, bearer, customer_id) + eq = cloud.get_customer_equipment(customer_id) for item in eq: for e in item['items']: print(e['id'], " ", e['inventoryId']) @@ -96,7 +96,7 @@ if equipment_id == "-1": print("Found equipment ID: %s inventoryId: %s"%(e['id'], e['inventoryId'])) equipment_id = str(e['id']) -if equipment_id == -1: +if equipment_id == "-1": print("ERROR: Could not find equipment-id.") sys.exit(1) @@ -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) @@ -168,12 +165,13 @@ print('Current Active AP FW from CLI:', ap_cli_fw) ##Compare Latest and Current AP FW and Upgrade report_data = None +key = None # model name I think, if we are doing reporting? -do_upgrade = cloud.should_upgrade_ap_fw(bearer, command_line_args, report_data, ap_image, fw_model, ap_cli_fw, - logger) +do_upgrade = cloud.should_upgrade_ap_fw(command_line_args.force_upgrade, command_line_args.skip_upgrade, + report_data, ap_image, fw_model, ap_cli_fw, logger, key) cloudModel = cloud_sdk_models[model_id] -pf = cloud.do_upgrade_ap_fw(bearer, command_line_args, report_data, test_cases, client, +pf = cloud.do_upgrade_ap_fw(command_line_args, report_data, test_cases, client, ap_image, cloudModel, model_id, jfrog_user, jfrog_pwd, rid, customer_id, equipment_id, logger)