From 65ed7ff6de581de0645a7418f45b7183f5a55447 Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Tue, 9 Feb 2021 12:25:54 -0800 Subject: [PATCH 01/32] query-sdk: Fix API for latest merge. Need to add a logging variable when creating base class. Improve error code logging from cloud API. Signed-off-by: Ben Greear --- libs/cloudsdk/cloudsdk.py | 1 + tools/query_sdk.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index 9ce7aa8fd..7ecee28b2 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -74,6 +74,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) diff --git a/tools/query_sdk.py b/tools/query_sdk.py index cd8808233..b6b2496d5 100755 --- a/tools/query_sdk.py +++ b/tools/query_sdk.py @@ -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 From f46fd3b32565363721a70821d44de4bd5e690546 Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Tue, 9 Feb 2021 13:42:04 -0800 Subject: [PATCH 02/32] sdk-set-profile: Update to work with latest library And fix a few uses of 'test_cases' in cloudsdk library. --- libs/cloudsdk/cloudsdk.py | 10 +++++----- tools/sdk_set_profile.py | 7 ++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index 7ecee28b2..3c1b57285 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -191,12 +191,12 @@ class CloudSDK: print("CloudSDK Upgrade Request Success") if report_data: 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') + client.update_testrail(case_id=self.test_cases["upgrade_api"], run_id=rid, status_id=1, msg='Upgrade request using API successful') logger.info('Firmware upgrade API successfully sent') else: print("Cloud SDK Upgrade Request Error!") # mark upgrade test case as failed with CloudSDK error - client.update_testrail(case_id=test_cases["upgrade_api"], run_id=rid, status_id=5, msg='Error requesting upgrade via API') + client.update_testrail(case_id=self.test_cases["upgrade_api"], run_id=rid, status_id=5, msg='Error requesting upgrade via API') if report_data: report_data['tests'][key][test_cases["upgrade_api"]] = "failed" logger.warning('Firmware upgrade API failed to send') @@ -204,7 +204,7 @@ class CloudSDK: 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') + client.update_testrail(case_id=self.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') @@ -1216,7 +1216,7 @@ 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" @@ -1244,7 +1244,7 @@ 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" diff --git a/tools/sdk_set_profile.py b/tools/sdk_set_profile.py index 120ba5cca..f230b6f08 100755 --- a/tools/sdk_set_profile.py +++ b/tools/sdk_set_profile.py @@ -61,12 +61,9 @@ def main(): help="Allow over-riding the 2g-wpa SSID value.") + reporting = Reporting(reports_root=os.getcwd() + "/reports/") - - - - - base = UnitTestBase("skd-set-profile", parser) + base = UnitTestBase("skd-set-profile", parser, reporting) command_line_args = base.command_line_args From f438462cd7985dfc41f97851aea624345bd09e0b Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Tue, 9 Feb 2021 13:45:15 -0800 Subject: [PATCH 03/32] examples: Add example for setting ssid on NOLA-01 testbed. Signed-off-by: Ben Greear --- tools/USAGE_EXAMPLES.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/USAGE_EXAMPLES.txt b/tools/USAGE_EXAMPLES.txt index 284d79d2c..aed2341fe 100644 --- a/tools/USAGE_EXAMPLES.txt +++ b/tools/USAGE_EXAMPLES.txt @@ -20,7 +20,11 @@ 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 Testbed-09 (perfecto) From 7cabeb5c2588b1d54870816eaaebc41dfc91fb28 Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Tue, 9 Feb 2021 13:54:21 -0800 Subject: [PATCH 04/32] cloudsdk: Fix ssid profile creation. There was typos/bugs in choosing the bridge vs NAT setting. Signed-off-by: Ben Greear --- libs/cloudsdk/cloudsdk.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index 3c1b57285..f314796ad 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -1102,9 +1102,9 @@ class CreateAPProfiles: self.ssid_template = ssid_template if mode == "bridge": - self.mode = "name" + self.mode = "BRIDGE" if mode == "nat": - self.mode = "nat" + self.mode = "NAT" self.fiveG_eap = None self.twoFourG_eap = None self.fiveG_wpa2 = None @@ -1279,9 +1279,9 @@ class CreateAPProfiles: self.rfProfileId = lab_ap_info.rf_profile self.child_profiles = [self.rfProfileId] if mode == "bridge": - self.mode = "name" + self.mode = "BRIDGE" if mode == "nat": - self.mode = "nat" + self.mode = "NAT" if self.fiveG_wpa2: self.child_profiles.append(self.fiveG_wpa2) self.ssid_prof_config.append(self.profile_data['5g']['wpa2'][self.mode]) From 9c8e74b2ff6a857e9d16f00774e95c0e4c320572 Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Tue, 9 Feb 2021 15:22:11 -0800 Subject: [PATCH 05/32] cloudsdk: Fix bad search-and-replace regarding creating ssid. Looks like another problem with the merge, "name" should be "bridge" in many places. Can create ssids and bridge profile again. Signed-off-by: Ben Greear --- libs/cloudsdk/cloudsdk.py | 57 +++++++++++++++++++-------------------- tests/Nightly_Sanity.py | 2 +- tests/USAGE_EXAMPLES.txt | 5 ++++ 3 files changed, 34 insertions(+), 30 deletions(-) create mode 100644 tests/USAGE_EXAMPLES.txt diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index f314796ad..01bfb93ff 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -925,51 +925,51 @@ class CreateAPProfiles: 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"]] @@ -983,13 +983,13 @@ class CreateAPProfiles: { "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") } @@ -998,13 +998,13 @@ 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") } @@ -1024,35 +1024,35 @@ 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 @@ -1101,10 +1101,7 @@ 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 = "BRIDGE" - if mode == "nat": - self.mode = "NAT" + self.mode = mode self.fiveG_eap = None self.twoFourG_eap = None self.fiveG_wpa2 = None @@ -1278,10 +1275,10 @@ class CreateAPProfiles: self.fw_model = fw_model self.rfProfileId = lab_ap_info.rf_profile self.child_profiles = [self.rfProfileId] - if mode == "bridge": - self.mode = "BRIDGE" - 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.ssid_prof_config.append(self.profile_data['5g']['wpa2'][self.mode]) @@ -1318,6 +1315,8 @@ class CreateAPProfiles: name = self.command_line_args.testbed + "-" + self.fw_model + "_" + 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, self.bearer, self.customer_id, diff --git a/tests/Nightly_Sanity.py b/tests/Nightly_Sanity.py index b17e0172d..04dc8a690 100755 --- a/tests/Nightly_Sanity.py +++ b/tests/Nightly_Sanity.py @@ -478,7 +478,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/USAGE_EXAMPLES.txt b/tests/USAGE_EXAMPLES.txt new file mode 100644 index 000000000..66b0d0243 --- /dev/null +++ b/tests/USAGE_EXAMPLES.txt @@ -0,0 +1,5 @@ + + +# 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 --skip_profiles --lanforge-2g-radio 1.1.wiphy4 --lanforge-5g-radio 1.1.wiphy5 From 3b9606d83ed3ad94fee0d5142bf7ccda78f98488 Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Tue, 9 Feb 2021 16:14:42 -0800 Subject: [PATCH 06/32] nightly: Nightly works again, at least somewhat. Prefix ssids and profile names with testbed so that we won't have collisions when running multiple testbeds against the same cloud. Fix query-ap, API changes since merge.. Signed-off-by: Ben Greear --- tests/Nightly_Sanity.py | 72 ++++++++++++++++++----------------------- tools/query_ap.py | 3 +- 2 files changed, 33 insertions(+), 42 deletions(-) diff --git a/tests/Nightly_Sanity.py b/tests/Nightly_Sanity.py index 04dc8a690..ef6a1a601 100755 --- a/tests/Nightly_Sanity.py +++ b/tests/Nightly_Sanity.py @@ -160,14 +160,15 @@ class NightlySanity: 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") + 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" @@ -179,9 +180,9 @@ class NightlySanity: pass 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_bridge_profile(eq_id=self.equipment_id, fw_model=self.model, mode="bridge") + self.ap_object.validate_changes(mode="bridge") print("Profiles Created") @@ -192,14 +193,14 @@ class NightlySanity: self.reporting.update_json_report(report_data=self.ap_object.report_data) # 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" @@ -211,9 +212,9 @@ class NightlySanity: pass self.ap_object.create_ssid_profiles(ssid_template=ssid_template, skip_eap=True, 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_bridge_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,11 +244,6 @@ 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 @@ -273,8 +269,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 +295,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 +318,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 +341,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 +365,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: 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 From ae80bc92a5886eb759b771ff96bc8f69ba2c6b91 Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Wed, 10 Feb 2021 11:33:10 -0800 Subject: [PATCH 07/32] cloudsdk: Support 'ping' api, add to debug scripts. Easy way to find out what cloud version we are running. Signed-off-by: Ben Greear --- libs/cloudsdk/cloudsdk.py | 4 ++++ tools/debug_nola01.sh | 10 ++++++++-- tools/debug_nola12.sh | 20 ++++++++++++++++---- tools/query_sdk.py | 13 ++++++++++++- 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index 01bfb93ff..fb165636a 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -436,6 +436,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): 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_sdk.py b/tools/query_sdk.py index b6b2496d5..7246c7200 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'], @@ -97,6 +97,17 @@ if qtype == 'all' or qtype == 'customer': logging.error(logging.traceback.format_exc()) print("Failed to read Customer %i"%(customer_id)) +if qtype == 'all' or qtype == 'ping': + try: + rv = base.cloud.ping(base.cloudSDK_url, base.bearer) + print("Cloud Ping %s:"%(base.cloudSDK_url)) + #jobj = json.load(ssids) + print(json.dumps(rv, indent=4, sort_keys=True)) + except Exception as ex: + print(ex) + logging.error(logging.traceback.format_exc()) + print("Failed to read Cloud Ping %i"%(base.cloudSDK_url)) + if qtype == 'all' or qtype == 'firmware': try: rv = base.cloud.CloudSDK_images(base.command_line_args.model, base.cloudSDK_url, base.bearer) From a734432fc97afa1669e0e9c8ff8af26764acc85b Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Wed, 10 Feb 2021 12:07:27 -0800 Subject: [PATCH 08/32] cloudsdk: better handle when test cases are not configured. For instance when using helper tools to call into the querysdk logic, when test cases are not relavent. Fix sdk upgrade tool to use latest API. Signed-off-by: Ben Greear --- libs/JfrogHelper.py | 8 ++- libs/cloudsdk/cloudsdk.py | 102 +++++++++++++++++++++----------------- tests/UnitTestBase.py | 8 ++- tools/sdk_upgrade_fw.py | 11 ++-- 4 files changed, 72 insertions(+), 57 deletions(-) diff --git a/libs/JfrogHelper.py b/libs/JfrogHelper.py index 7acf63532..082eec3ff 100644 --- a/libs/JfrogHelper.py +++ b/libs/JfrogHelper.py @@ -15,7 +15,11 @@ class GetBuild: self.jfrog_url = 'https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/' self.build = build - def get_latest_image(self, model): + def get_latest_image(self, model, for_build=None): + + build_name = self.build + if for_build: + build_name = for_build url = self.jfrog_url + model + "/dev/" @@ -35,7 +39,7 @@ class GetBuild: soup = BeautifulSoup(html, features="html.parser") # find the last pending link on dev - last_link = soup.find_all('a', href=re.compile(self.build))[-1] + last_link = soup.find_all('a', href=re.compile(build_name))[-1] latest_file = last_link['href'] latest_fw = latest_file.replace('.tar.gz', '') return latest_fw diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index fb165636a..03fc5b729 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -189,24 +189,26 @@ class CloudSDK: if "success" in upgrade_fw: if upgrade_fw["success"] == True: print("CloudSDK Upgrade Request Success") - if report_data: + if report_data and test_cases: report_data['tests'][key][test_cases["upgrade_api"]] = "passed" - client.update_testrail(case_id=self.test_cases["upgrade_api"], run_id=rid, status_id=1, msg='Upgrade request using API successful') + client.update_testrail(case_id=test_cases["upgrade_api"], run_id=rid, status_id=1, msg='Upgrade request using API successful') logger.info('Firmware upgrade API successfully sent') else: print("Cloud SDK Upgrade Request Error!") # mark upgrade test case as failed with CloudSDK error - client.update_testrail(case_id=self.test_cases["upgrade_api"], run_id=rid, status_id=5, msg='Error requesting upgrade via API') - if report_data: - report_data['tests'][key][test_cases["upgrade_api"]] = "failed" + if test_cases: + client.update_testrail(case_id=test_cases["upgrade_api"], run_id=rid, status_id=5, msg='Error requesting upgrade via API') + if report_data: + report_data['tests'][key][test_cases["upgrade_api"]] = "failed" logger.warning('Firmware upgrade API failed to send') return False else: print("Cloud SDK Upgrade Request Error!") # mark upgrade test case as failed with CloudSDK error - client.update_testrail(case_id=self.test_cases["upgrade_api"], run_id=rid, status_id=5,msg='Error requesting upgrade via API') - if report_data: - report_data['tests'][key][test_cases["upgrade_api"]] = "failed" + if test_cases: + client.update_testrail(case_id=test_cases["upgrade_api"], run_id=rid, status_id=5,msg='Error requesting upgrade via API') + if report_data: + report_data['tests'][key][test_cases["upgrade_api"]] = "failed" logger.warning('Firmware upgrade API failed to send') return False @@ -214,7 +216,8 @@ class CloudSDK: 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) @@ -233,7 +236,8 @@ 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'] @@ -251,8 +255,9 @@ class CloudSDK: logging.error(logging.traceback.format_exc()) print("Cannot Reach AP CLI to confirm upgrade!") logger.warning('Cannot Reach AP CLI to confirm upgrade!') - 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 test_cases: + client.update_testrail(case_id=test_id_cli, run_id=rid, status_id=4, + msg='Cannot reach AP after upgrade to check CLI - re-test required') continue time.sleep(30) @@ -265,60 +270,65 @@ 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: + 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]) 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: + 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]) 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: + 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]) 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: + 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: + 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): diff --git a/tests/UnitTestBase.py b/tests/UnitTestBase.py index 60162f2a3..4f59b3ea4 100644 --- a/tests/UnitTestBase.py +++ b/tests/UnitTestBase.py @@ -97,7 +97,7 @@ from lab_ap_info import radius_info 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, @@ -239,8 +239,12 @@ 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) diff --git a/tools/sdk_upgrade_fw.py b/tools/sdk_upgrade_fw.py index a3a3a3706..83d5d8930 100755 --- a/tools/sdk_upgrade_fw.py +++ b/tools/sdk_upgrade_fw.py @@ -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) From d691f84e77a71802e950230001a1380843a14a87 Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Wed, 10 Feb 2021 12:40:26 -0800 Subject: [PATCH 09/32] examples: Add testbed 12 example usage for fw update and profile creation. Signed-off-by: Ben Greear --- tools/USAGE_EXAMPLES.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/USAGE_EXAMPLES.txt b/tools/USAGE_EXAMPLES.txt index aed2341fe..0ccae5e47 100644 --- a/tools/USAGE_EXAMPLES.txt +++ b/tools/USAGE_EXAMPLES.txt @@ -63,3 +63,17 @@ Testbed 11 (Advanced setup, 2D turntable chamber plus medium chamber, RF attenua --default-ap-profile TipWlan-2-Radios --sdk-base-url https://wlan-portal-svc.cicd.lab.wlan.tip.build \ --skip-radius --skip-wpa --verbose --testbed "NOLA-11" --ssid-5g-wpa2 Default-SSID-5gl --psk-5g-wpa2 12345678 \ --ssid-2g-wpa2 Default-SSID-2g --psk-2g-wpa2 12345678 + + +Testbed 12 (Basic, wf188n) + +# Upgrade firmware to latest +./sdk_upgrade_fw.py --testrail-user-id NONE --model wf188n --ap-jumphost-address localhost --ap-jumphost-port 8823 \ + --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP1 --testbed \"NOLA-12\" \ + --sdk-base-url https://wlan-portal-svc-ben-testbed.cicd.lab.wlan.tip.build --force-upgrade true + +./sdk_set_profile.py --testrail-user-id NONE --model wf188n --ap-jumphost-address localhost --ap-jumphost-port 8823 \ + --ap-jumphost-password pumpkin77 --ap-jumphost-tty /dev/ttyAP1 --lanforge-ip-address localhost --lanforge-port-number 8822 \ + --default-ap-profile TipWlan-2-Radios --sdk-base-url https://wlan-portal-svc-ben-testbed.cicd.lab.wlan.tip.build \ + --skip-radius --skip-wpa --verbose --testbed "NOLA-12" --ssid-5g-wpa2 Default-SSID-5gl --psk-5g-wpa2 12345678 \ + --ssid-2g-wpa2 Default-SSID-2g --psk-2g-wpa2 12345678 From 05ee08413308d280df4657585e1c665884c48c52 Mon Sep 17 00:00:00 2001 From: shivam Date: Thu, 11 Feb 2021 02:14:58 +0530 Subject: [PATCH 10/32] bridge and nat profile working fine in sdk_set_profile --- libs/cloudsdk/cloudsdk.py | 12 ++-- tests/Nightly_Sanity.py | 12 ++-- tests/UnitTestBase.py | 8 ++- tools/USAGE_EXAMPLES.txt | 3 +- tools/sdk_set_profile.py | 122 ++++++++++++++------------------------ 5 files changed, 67 insertions(+), 90 deletions(-) diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index 01bfb93ff..e56cafaaa 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -1269,7 +1269,7 @@ class CreateAPProfiles: msg='2.4G WPA SSID create failed - ' + mode + ' mode') self.test_cases["ssid_2g_wpa_" + 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 @@ -1313,7 +1313,7 @@ class CreateAPProfiles: self.child_profiles.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) @@ -1325,17 +1325,17 @@ 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, + 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) diff --git a/tests/Nightly_Sanity.py b/tests/Nightly_Sanity.py index ef6a1a601..307e5c782 100755 --- a/tests/Nightly_Sanity.py +++ b/tests/Nightly_Sanity.py @@ -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() @@ -158,8 +158,8 @@ class NightlySanity: 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) + # + # # 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), @@ -181,7 +181,7 @@ class NightlySanity: 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.create_ap_profile(eq_id=self.equipment_id, fw_model=self.model, mode="bridge") self.ap_object.validate_changes(mode="bridge") print("Profiles Created") @@ -192,6 +192,8 @@ 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="%s-SSID-NAT-2G-WPA"%(nprefix), ssid_5g_wpa="%s-SSID-NAT-5G-WPA"%(nprefix), @@ -213,7 +215,7 @@ class NightlySanity: self.ap_object.create_ssid_profiles(ssid_template=ssid_template, skip_eap=True, 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.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") diff --git a/tests/UnitTestBase.py b/tests/UnitTestBase.py index 60162f2a3..b60ae9106 100644 --- a/tests/UnitTestBase.py +++ b/tests/UnitTestBase.py @@ -97,7 +97,7 @@ from lab_ap_info import radius_info 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, @@ -240,7 +240,11 @@ 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 reporting is not None: + self.hdlr = logging.FileHandler(reporting.report_path + "/test_run.log") + else: + self.hdlr = logging.FileHandler("logs/test_run.log") + self.formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') self.hdlr.setFormatter(self.formatter) self.logger.addHandler(self.hdlr) diff --git a/tools/USAGE_EXAMPLES.txt b/tools/USAGE_EXAMPLES.txt index aed2341fe..235a40538 100644 --- a/tools/USAGE_EXAMPLES.txt +++ b/tools/USAGE_EXAMPLES.txt @@ -24,7 +24,8 @@ The ports are used as: 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 +./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 + Testbed-09 (perfecto) diff --git a/tools/sdk_set_profile.py b/tools/sdk_set_profile.py index f230b6f08..ca582529a 100755 --- a/tools/sdk_set_profile.py +++ b/tools/sdk_set_profile.py @@ -18,54 +18,47 @@ 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]") reporting = Reporting(reports_root=os.getcwd() + "/reports/") - base = UnitTestBase("skd-set-profile", parser, reporting) + 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') @@ -150,15 +143,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: @@ -170,62 +156,46 @@ 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) - # 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 + + args = command_line_args + + print("Profiles Created") + + ap_object = CreateAPProfiles(args, cloud=cloud, client=client, fw_model=fw_model) + + # 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) 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 + # obj.create_radius_profile(radius_name, rid, key) + pass + ap_object.create_ssid_profiles(ssid_template=ssid_template, skip_eap=True, mode=args.mode) - - 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() + print("Create AP with equipment-id: ", equipment_id) + ap_object.create_ap_profile(eq_id=equipment_id, fw_model=fw_model, mode=args.mode) + ap_object.validate_changes(mode=args.mode) print("Profiles Created") -main() +main() From 2ea71662c3c1982121aba4f5a4e853578952842f Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Wed, 10 Feb 2021 13:50:20 -0800 Subject: [PATCH 11/32] cloud: Add framework to modify rf profile. But not tested or enabled at this point. Evidently bugs in cloud keep it from working if you change the mode, for instance. Signed-off-by: Ben Greear --- libs/EXAMPLE-JSON-OBJECTS.txt | 207 ++++++++++++++++++++++++++++++++++ libs/cloudsdk/cloudsdk.py | 38 +++++++ tools/USAGE_EXAMPLES.txt | 5 + tools/sdk_set_profile.py | 11 +- 4 files changed, 259 insertions(+), 2 deletions(-) create mode 100644 libs/EXAMPLE-JSON-OBJECTS.txt 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/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index 6f76e49da..e76144e74 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -763,6 +763,44 @@ class CloudSDK: 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 = { + 'Content-Type': 'application/json', + 'Authorization': 'Bearer ' + bearer + } + data_str = json.dumps(profile) + 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'] + + # 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_rf_profile(cloudSDK_url, bearer, customer_id, template, name, new_prof) + + # Update then. + 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(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)) diff --git a/tools/USAGE_EXAMPLES.txt b/tools/USAGE_EXAMPLES.txt index 55a9c5a9c..8f064bda3 100644 --- a/tools/USAGE_EXAMPLES.txt +++ b/tools/USAGE_EXAMPLES.txt @@ -78,3 +78,8 @@ Testbed 12 (Basic, wf188n) --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 + diff --git a/tools/sdk_set_profile.py b/tools/sdk_set_profile.py index ca582529a..bddecc926 100755 --- a/tools/sdk_set_profile.py +++ b/tools/sdk_set_profile.py @@ -51,7 +51,13 @@ def main(): 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]") + help="Mode of AP Profile [bridge/nat/vlan]", required=True) + + # 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/") @@ -189,7 +195,8 @@ def main(): # Radius Profile needs to be set here # obj.create_radius_profile(radius_name, rid, key) pass - ap_object.create_ssid_profiles(ssid_template=ssid_template, skip_eap=True, mode=args.mode) + ap_object.create_ssid_profiles(ssid_template=ssid_template, skip_eap=True, skip_wpa=args.skip_wpa, + skip_wpa2=args.skip_wpa2, mode=args.mode) print("Create AP with equipment-id: ", equipment_id) ap_object.create_ap_profile(eq_id=equipment_id, fw_model=fw_model, mode=args.mode) From 55d9e99978bbd313d6fb5ae8714e70da6bf5b402 Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Thu, 11 Feb 2021 13:18:38 -0800 Subject: [PATCH 12/32] pytest: Start integrating with existing libraries. This is going to take more work, but getting somewhat closer. Stop using pytest/helpers, they are replaced by libraries. Existing libraries are often taking a command-line-args option as easy way to pass something to various methods. This will have to be resolved to work with the way pytest wants to run. Much hard-coding needs to be removed, and specifically, the 'set profile' logic is completley not working. Need to use library logic that can query the eq-id based on name (and query eq-name based on serial port/ssh, perhaps). Need to resolve how cmd-line can take multiple APs, but each will have different eq-id. Signed-off-by: Ben Greear --- NOLA-README.md | 1 + libs/JfrogHelper.py | 14 +++- libs/cloudsdk/cloudsdk.py | 138 +++++++++++++++++++++------------ libs/testrails/testrail_api.py | 9 +++ tests/Nightly_Sanity.py | 4 +- tests/UnitTestBase.py | 2 - tests/pytest/conftest.py | 131 ++++++++++++++++++++----------- tests/pytest/helpers/utils.py | 10 +++ tests/pytest/pytest.ini | 10 ++- tests/pytest/test_24ghz.py | 2 + tools/USAGE_EXAMPLES.txt | 16 ++++ tools/sdk_upgrade_fw.py | 8 +- 12 files changed, 236 insertions(+), 109 deletions(-) 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/JfrogHelper.py b/libs/JfrogHelper.py index 082eec3ff..ec4aeb907 100644 --- a/libs/JfrogHelper.py +++ b/libs/JfrogHelper.py @@ -8,13 +8,22 @@ 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_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 @@ -22,6 +31,7 @@ class GetBuild: build_name = for_build url = self.jfrog_url + model + "/dev/" + print("JfrogHelper::get_latest_image, url: ", url) auth = str( base64.b64encode( diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index e76144e74..c8bd807c5 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -44,6 +44,21 @@ 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 __init__(self, id, passwd, url, verbose): + self.user = id + self.password = passwd + self.base_url = url + self.assert_bad_response = False + self.verbose = verbose + 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" @@ -63,6 +78,7 @@ class CloudSDK: raise SystemExit("Exiting Script! Cloud not get bearer token for reason:",e) token_data = token_response.json() bearer_token = token_data['access_token'] + bearer = bearer_token return(bearer_token) def check_response(self, cmd, response, headers, data_str, url): @@ -84,14 +100,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, + def should_upgrade_ap_fw(self, force_upgrade, skip_upgrade, report_data, latest_ap_image, fw_model, ap_cli_fw, logger): 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.") + if logger: + logger.info(fw_model + " does not require upgrade.") cloudsdk_cluster_info = { "date": "N/A", "commitId": "N/A", @@ -100,11 +117,12 @@ class CloudSDK: 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: + 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" - logger.info(fw_model + " firmware upgrade skipped, running with " + ap_cli_fw) + if logger: + logger.info(fw_model + " firmware upgrade skipped, running with " + ap_cli_fw) cloudsdk_cluster_info = { "date": "N/A", "commitId": "N/A", @@ -113,7 +131,7 @@ 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: + 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: @@ -124,13 +142,15 @@ class CloudSDK: # 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 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) @@ -146,15 +166,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 @@ -167,15 +189,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 @@ -183,7 +207,8 @@ 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: @@ -191,25 +216,31 @@ class CloudSDK: print("CloudSDK Upgrade Request Success") 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 if test_cases: - client.update_testrail(case_id=test_cases["upgrade_api"], run_id=rid, status_id=5, msg='Error requesting upgrade via API') + if 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" - logger.warning('Firmware upgrade API failed to send') + 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 if test_cases: - client.update_testrail(case_id=test_cases["upgrade_api"], run_id=rid, status_id=5,msg='Error requesting upgrade via API') + if 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" - logger.warning('Firmware upgrade API failed to send') + if logger: + logger.warning('Firmware upgrade API failed to send') return False sdk_ok = False @@ -220,7 +251,8 @@ class CloudSDK: 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) + 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") @@ -242,7 +274,8 @@ class CloudSDK: 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 @@ -254,10 +287,12 @@ class CloudSDK: 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!') + if logger: + logger.warning('Cannot Reach AP CLI to confirm upgrade!') if test_cases: - client.update_testrail(case_id=test_id_cli, run_id=rid, status_id=4, - msg='Cannot reach AP after upgrade to check CLI - re-test required') + 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) @@ -271,10 +306,11 @@ class CloudSDK: if cloud_ap_fw == ap_image and ap_cli_fw == ap_image: print("CloudSDK and AP CLI both show upgrade success, passing upgrade test case") if test_cases: - client.update_testrail(case_id=test_id_cli, run_id=rid, status_id=1, - msg='Upgrade to ' + ap_image + ' successful') - client.update_testrail(case_id=test_id_cloud, run_id=rid, status_id=1, - msg='CLOUDSDK reporting correct firmware version.') + 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" @@ -285,10 +321,11 @@ class CloudSDK: print("AP CLI shows upgrade success - CloudSDK reporting error!") ##Raise CloudSDK error but continue testing if test_cases: - client.update_testrail(case_id=test_id_cli, run_id=rid, status_id=1, - msg='Upgrade to ' + ap_image + ' successful.') - client.update_testrail(case_id=test_id_cloud, run_id=rid, status_id=5, - msg='CLOUDSDK reporting incorrect firmware version.') + 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" @@ -299,10 +336,11 @@ class CloudSDK: print("AP CLI shows upgrade failed - CloudSDK reporting error!") # Testrail TC fail if test_cases: - client.update_testrail(case_id=test_id_cli, run_id=rid, status_id=5, - msg='AP failed to download or apply new FW. Upgrade to ' + ap_image + ' Failed') - client.update_testrail(case_id=test_id_cloud, run_id=rid, status_id=5, - msg='CLOUDSDK reporting incorrect firmware version.') + 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" @@ -313,8 +351,9 @@ class CloudSDK: print("Upgrade Failed! Confirmed on CloudSDK and AP CLI. Upgrade test case failed.") ##fail TR testcase and exit if test_cases: - client.update_testrail(case_id=test_id_cli, run_id=rid, status_id=5, - msg='AP failed to download or apply new FW. Upgrade to ' + ap_image + ' Failed') + if 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]) @@ -324,8 +363,9 @@ class CloudSDK: print("Unable to determine upgrade status. Skipping AP variant") # update TR testcase as error if test_cases: - client.update_testrail(case_id=test_id_cli, run_id=rid, status_id=4, - msg='Cannot determine upgrade status - re-test required') + if 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]) @@ -613,12 +653,12 @@ class CloudSDK: #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) @@ -635,7 +675,7 @@ class CloudSDK: url = cloudSDK_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)) diff --git a/libs/testrails/testrail_api.py b/libs/testrails/testrail_api.py index 541ea6551..116b516fd 100644 --- a/libs/testrails/testrail_api.py +++ b/libs/testrails/testrail_api.py @@ -28,6 +28,15 @@ class TestRail_Client: if command_line_args.testrail_user_id == "NONE": self.use_testrails = False + def __init__(self, url, id, passwd): + self.user = id + self.password = passwd + base_url = url + if not base_url.endswith('/'): + base_url += '/' + self.__url = base_url + 'index.php?/api/v2/' + self.use_testrails = True + def send_get(self, uri, filepath=None): """Issue a GET request (read) against the API. diff --git a/tests/Nightly_Sanity.py b/tests/Nightly_Sanity.py index 307e5c782..718908bf9 100755 --- a/tests/Nightly_Sanity.py +++ b/tests/Nightly_Sanity.py @@ -78,7 +78,7 @@ class NightlySanity: # 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) @@ -95,7 +95,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) diff --git a/tests/UnitTestBase.py b/tests/UnitTestBase.py index 8592ccbd1..ccec19d13 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}') diff --git a/tests/pytest/conftest.py b/tests/pytest/conftest.py index 44c21def0..5e9edb422 100644 --- a/tests/pytest/conftest.py +++ b/tests/pytest/conftest.py @@ -3,8 +3,27 @@ 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 +#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 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") @@ -14,6 +33,7 @@ def pytest_addoption(parser): 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("sdk-equipment-id", "cloud sdk equipment id for the access point") 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") @@ -31,6 +51,14 @@ def pytest_addoption(parser): type=str ) + parser.addoption( + "--sdk-equipment-id", + action="store", + default="-1", + help="SDK equipment ID for AP", + type=str + ) + # # Cloud SDK # parser.addoption( # "--sdk-base-url", @@ -178,62 +206,72 @@ def setup_testrails(request, instantiate_testrail, access_points): ) 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): # 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" ] - } - } + + # This is broken, see sdk_set_profile for correct way to do this. + #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'] + return True - # 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) + #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.getini("sdk-customer-id") + equipment_id = request.config.getoption("--sdk-equipment-id") + if equipment_id == "-1": + print("EQ ID invalid: ", equipment_id) + sys.exit(1) + 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): - yield CloudSDK_Client( - request.config.getini("sdk-base-url"), + yield CloudSDK( request.config.getini("sdk-user-id"), - request.config.getini("sdk-user-password") + request.config.getini("sdk-user-password"), + request.config.getini("sdk-base-url"), + False # verbose TODO: Make this configurable ) @pytest.fixture(scope="session") @@ -246,8 +284,9 @@ def instantiate_testrail(request): @pytest.fixture(scope="session") def instantiate_jFrog(request): - yield jFrog_Client( - request.config.getini("jfrog-base-url"), + yield GetBuild( request.config.getini("jfrog-user-id"), - request.config.getini("jfrog-user-password") + request.config.getini("jfrog-user-password"), + "pending", # TODO make this optional + url=request.config.getini("jfrog-base-url") ) diff --git a/tests/pytest/helpers/utils.py b/tests/pytest/helpers/utils.py index a1267e140..60e686639 100644 --- a/tests/pytest/helpers/utils.py +++ b/tests/pytest/helpers/utils.py @@ -109,6 +109,16 @@ class jFrog_Client: return f"https://{self.user}:{self.password}@{self.baseUrl}/{model}/dev/{latest_image}.tar.gz" # Class for CloudSDK Interaction via RestAPI + +# Map firmware directory name to cloud's model name. +cloud_sdk_models = { + "ec420": "EC420-G1", + "ea8300": "EA8300-CA", + "ecw5211": "ECW5211", + "ecw5410": "ECW5410", + "wf188n": "WF188N" + } + class CloudSDK_Client: def __init__(self, url, user, password): self.baseUrl = f"https://{url}" diff --git a/tests/pytest/pytest.ini b/tests/pytest/pytest.ini index 97b34e4a7..d5c430be9 100644 --- a/tests/pytest/pytest.ini +++ b/tests/pytest/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 @@ -21,10 +21,12 @@ lanforge-ethernet-port=eth2 # Cloud SDK settings sdk-customer-id=2 +# equipment ID is unique for each AP, have to be told what to use or query it based on other info. +sdk-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/test_24ghz.py b/tests/pytest/test_24ghz.py index 0f5dd8c11..3605ba4d3 100644 --- a/tests/pytest/test_24ghz.py +++ b/tests/pytest/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 diff --git a/tools/USAGE_EXAMPLES.txt b/tools/USAGE_EXAMPLES.txt index 8f064bda3..b0883001f 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 @@ -83,3 +84,18 @@ Testbed 12 (Basic, wf188n) ./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.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-ben-testbed.cicd.lab.wlan.tip.build --force-upgrade true + diff --git a/tools/sdk_upgrade_fw.py b/tools/sdk_upgrade_fw.py index 83d5d8930..b88cf857f 100755 --- a/tools/sdk_upgrade_fw.py +++ b/tools/sdk_upgrade_fw.py @@ -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) @@ -166,11 +166,11 @@ print('Current Active AP FW from CLI:', ap_cli_fw) ##Compare Latest and Current AP FW and Upgrade report_data = None -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) 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) From 98b007833636c372810f0a9719ca63ab77a619d8 Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Thu, 11 Feb 2021 15:44:50 -0800 Subject: [PATCH 13/32] pytest: Make cmd-line args match what the stand-alone tools were using. And create cmd-line-args based on pytest input so we can pass it into the library guts. --- libs/cloudsdk/cloudsdk.py | 6 +- tests/Nightly_Sanity.py | 2 +- tests/UnitTestBase.py | 355 +++++++++++++++++++++++---------- tests/pytest/EXAMPLE-USAGE.txt | 10 + tests/pytest/conftest.py | 277 ++++++++++++------------- tests/pytest/helpers/utils.py | 220 ++++---------------- tests/pytest/pytest.ini | 4 +- tools/query_sdk.py | 2 +- tools/sdk_set_profile.py | 4 +- tools/sdk_upgrade_fw.py | 2 +- 10 files changed, 440 insertions(+), 442 deletions(-) create mode 100644 tests/pytest/EXAMPLE-USAGE.txt diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index c8bd807c5..965dc9519 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -531,9 +531,9 @@ class CloudSDK: 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 diff --git a/tests/Nightly_Sanity.py b/tests/Nightly_Sanity.py index 718908bf9..e3c837155 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']) diff --git a/tests/UnitTestBase.py b/tests/UnitTestBase.py index ccec19d13..4d06837e5 100644 --- a/tests/UnitTestBase.py +++ b/tests/UnitTestBase.py @@ -92,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("--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("--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=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() diff --git a/tests/pytest/EXAMPLE-USAGE.txt b/tests/pytest/EXAMPLE-USAGE.txt new file mode 100644 index 000000000..66410f9ce --- /dev/null +++ b/tests/pytest/EXAMPLE-USAGE.txt @@ -0,0 +1,10 @@ +# 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-ben-testbed.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 + diff --git a/tests/pytest/conftest.py b/tests/pytest/conftest.py index 5e9edb422..d13bac31d 100644 --- a/tests/pytest/conftest.py +++ b/tests/pytest/conftest.py @@ -3,7 +3,7 @@ from time import sleep, gmtime, strftime import sys import os -#sys.path.append(os.path.join(os.path.dirname(__file__), 'helpers')) +sys.path.append(os.path.join(os.path.dirname(__file__), 'helpers')) sys.path.append(f'..') @@ -19,6 +19,7 @@ sys.path.append(f'../../libs/') sys.path.append(f'../test_utility/') +from utils import * from UnitTestBase import * from JfrogHelper import * from cloudsdk import * @@ -29,11 +30,43 @@ 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("sdk-equipment-id", "cloud sdk equipment id for the access point") + 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?") + parser.addini("skip-wpa2", "Should we skip setting up WPA2?") + parser.addini("skip-radius", "Should we skip setting up EAP/Radius?") + 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") @@ -43,127 +76,8 @@ def pytest_addoption(parser): 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 - ) + add_base_parse_args_pytest(parser) - parser.addoption( - "--sdk-equipment-id", - action="store", - default="-1", - help="SDK equipment ID for AP", - 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( @@ -182,9 +96,10 @@ def pytest_unconfigure(config): @pytest.fixture(scope="session") def setup_testrails(request, instantiate_testrail, access_points): - if request.config.getoption("--no-testrails"): + 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: @@ -215,22 +130,73 @@ def setup_cloudsdk(request, instantiate_cloudsdk): print("Cloud SDK cleanup done") request.addfinalizer(fin) - # This is broken, see sdk_set_profile for correct way to do this. - #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" ] - # } - #} + # Set up bridged setup by default. + + command_line_args = create_command_line_args(request) + + cloud = instantiate_cloudsdk + + cloud.assert_bad_response = True + + model_id = command_line_args.model + 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) + + 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=client, fw_model=fw_model) + + # Logic to create AP Profiles (Bridge Mode) + + ap_object.set_ssid_psk_data(ssid_2g_wpa=command_line_args.ssid_2g_wpa, + ssid_5g_wpa=command_line_args.ssid_5g_wpa, + psk_2g_wpa=command_line_args.psk_2g_wpa, + psk_5g_wpa=command_line_args.psk_5g_wpa, + ssid_2g_wpa2=command_line_args.ssid_2g_wpa2, + ssid_5g_wpa2=command_line_args.ssid_5g_wpa2, + psk_2g_wpa2=command_line_args.psk_2g_wpa2, + psk_5g_wpa2=command_line_args.psk_5g_wpa2) + + print(ap_object) + + 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 + # obj.create_radius_profile(radius_name, rid, key) + pass + ap_object.create_ssid_profiles(ssid_template=ssid_template, skip_eap=True, skip_wpa=command_line_args.skip_wpa, + skip_wpa2=command_line_args.skip_wpa2, mode=command_line_args.mode) + + 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") + + yield ap_object @pytest.fixture(scope="session") def update_firmware(request, setup_testrails, instantiate_jFrog, instantiate_cloudsdk, access_points): @@ -254,11 +220,8 @@ def update_firmware(request, setup_testrails, instantiate_jFrog, instantiate_clo jfrog_user = instantiate_jFrog.get_user() jfrog_pwd = instantiate_jFrog.get_passwd() testrail_rid = 0 - customer_id = request.config.getini("sdk-customer-id") - equipment_id = request.config.getoption("--sdk-equipment-id") - if equipment_id == "-1": - print("EQ ID invalid: ", equipment_id) - sys.exit(1) + 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) @@ -267,13 +230,35 @@ def update_firmware(request, setup_testrails, instantiate_jFrog, instantiate_clo @pytest.fixture(scope="session") def instantiate_cloudsdk(request): - yield CloudSDK( + rv = CloudSDK( request.config.getini("sdk-user-id"), request.config.getini("sdk-user-password"), request.config.getini("sdk-base-url"), False # verbose TODO: Make this configurable ) + equipment_id = request.config.getoption("--equipment-id") + if equipment_id == "-1": + eq_id = ap_ssh_ovsh_nodec(create_command_line_args(request), '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( diff --git a/tests/pytest/helpers/utils.py b/tests/pytest/helpers/utils.py index 60e686639..d08590d1c 100644 --- a/tests/pytest/helpers/utils.py +++ b/tests/pytest/helpers/utils.py @@ -1,114 +1,7 @@ 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 +import argparse # Map firmware directory name to cloud's model name. cloud_sdk_models = { @@ -119,78 +12,45 @@ cloud_sdk_models = { "wf188n": "WF188N" } -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']}" - } +# 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() - 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"] + # 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") - 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()]) + 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") - 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) + 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") + return command_line_args diff --git a/tests/pytest/pytest.ini b/tests/pytest/pytest.ini index d5c430be9..acea6fe28 100644 --- a/tests/pytest/pytest.ini +++ b/tests/pytest/pytest.ini @@ -20,9 +20,9 @@ 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. -sdk-equipment-id=-1 +equipment-id=-1 markers = featureA: marks tests as slow (deselect with '-m "not slow"') diff --git a/tools/query_sdk.py b/tools/query_sdk.py index 7246c7200..f67feb40e 100755 --- a/tools/query_sdk.py +++ b/tools/query_sdk.py @@ -136,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 bddecc926..c367a58f3 100755 --- a/tools/sdk_set_profile.py +++ b/tools/sdk_set_profile.py @@ -94,8 +94,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 @@ -124,7 +122,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']) diff --git a/tools/sdk_upgrade_fw.py b/tools/sdk_upgrade_fw.py index b88cf857f..102aef458 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']) From 06fbba1aadadacbdd66dc9c15f68f2fb529e99db Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Thu, 11 Feb 2021 16:18:07 -0800 Subject: [PATCH 14/32] pytest: Clean up some tools vs pytest breakage in that last commit. Seems you cannot have two __init__ methods in a class, so change code to only one one variant. Signed-off-by: Ben Greear --- libs/cloudsdk/cloudsdk.py | 14 ++------------ libs/testrails/testrail_api.py | 9 --------- tests/UnitTestBase.py | 9 +++++---- tests/pytest/conftest.py | 23 +++++++---------------- tests/pytest/helpers/utils.py | 8 ++++++++ tests/pytest/test_24ghz.py | 26 +++++++++++++------------- 6 files changed, 35 insertions(+), 54 deletions(-) diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index 965dc9519..a479dd014 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -48,15 +48,6 @@ class CloudSDK: self.cloud_type = "v1" self.refresh_bearer() - def __init__(self, id, passwd, url, verbose): - self.user = id - self.password = passwd - self.base_url = url - self.assert_bad_response = False - self.verbose = verbose - self.cloud_type = "v1" - self.refresh_bearer() - def refresh_bearer(self): self.bearer = self.get_bearer(self.base_url, self.cloud_type) @@ -672,7 +663,7 @@ class CloudSDK: 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 ' + self.bearer @@ -1429,8 +1420,7 @@ class CreateAPProfiles: msg='AP profile for ' + mode + ' tests could not be created using API') 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) def cleanup_profile(self): pass diff --git a/libs/testrails/testrail_api.py b/libs/testrails/testrail_api.py index 116b516fd..541ea6551 100644 --- a/libs/testrails/testrail_api.py +++ b/libs/testrails/testrail_api.py @@ -28,15 +28,6 @@ class TestRail_Client: if command_line_args.testrail_user_id == "NONE": self.use_testrails = False - def __init__(self, url, id, passwd): - self.user = id - self.password = passwd - base_url = url - if not base_url.endswith('/'): - base_url += '/' - self.__url = base_url + 'index.php?/api/v2/' - self.use_testrails = True - def send_get(self, uri, filepath=None): """Issue a GET request (read) against the API. diff --git a/tests/UnitTestBase.py b/tests/UnitTestBase.py index 4d06837e5..46e15f6b0 100644 --- a/tests/UnitTestBase.py +++ b/tests/UnitTestBase.py @@ -145,8 +145,8 @@ def add_base_parse_args(parser): default="password") parser.add_argument("--testrail-run-prefix", type=str, help="testrail run prefix", default="prefix-1") - parser.add_argument("--milestone", type=str, help="testrail milestone ID", - default="milestone-1") + parser.add_argument("--testrail-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") @@ -288,8 +288,8 @@ def add_base_parse_args_pytest(parser): default="password") parser.addoption("--testrail-run-prefix", type=str, help="testrail run prefix", default="prefix-1") - parser.addoption("--milestone", type=str, help="testrail milestone ID", - default="milestone-1") + parser.addoption("--testrail-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") @@ -403,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/pytest/conftest.py b/tests/pytest/conftest.py index d13bac31d..b25632b2a 100644 --- a/tests/pytest/conftest.py +++ b/tests/pytest/conftest.py @@ -124,7 +124,7 @@ def setup_testrails(request, instantiate_testrail, access_points): # 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): +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") @@ -138,7 +138,6 @@ def setup_cloudsdk(request, instantiate_cloudsdk): cloud.assert_bad_response = True - model_id = command_line_args.model equipment_id = instantiate_cloudsdk.equipment_id print("equipment-id: %s" % (equipment_id)) @@ -164,7 +163,7 @@ def setup_cloudsdk(request, instantiate_cloudsdk): radius_name = "%s-%s-%s" % (command_line_args.testbed, fw_model, "Radius") print("Create profiles") - ap_object = CreateAPProfiles(command_line_args, cloud=cloud, client=client, fw_model=fw_model) + ap_object = CreateAPProfiles(command_line_args, cloud=cloud, client=instantiate_testrail, fw_model=fw_model) # Logic to create AP Profiles (Bridge Mode) @@ -230,16 +229,12 @@ def update_firmware(request, setup_testrails, instantiate_jFrog, instantiate_clo @pytest.fixture(scope="session") def instantiate_cloudsdk(request): - rv = CloudSDK( - request.config.getini("sdk-user-id"), - request.config.getini("sdk-user-password"), - request.config.getini("sdk-base-url"), - False # verbose TODO: Make this configurable - ) + 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(create_command_line_args(request), 'id') + eq_id = ap_ssh_ovsh_nodec(command_line_args, 'id') print("EQ Id: %s" % (eq_id)) # Now, query equipment to find something that matches. @@ -260,12 +255,8 @@ def instantiate_cloudsdk(request): yield rv @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") - ) +def instantiate_testrail(request): + yield TestRail_Client(create_command_line_args(request)) @pytest.fixture(scope="session") def instantiate_jFrog(request): diff --git a/tests/pytest/helpers/utils.py b/tests/pytest/helpers/utils.py index d08590d1c..16451d23f 100644 --- a/tests/pytest/helpers/utils.py +++ b/tests/pytest/helpers/utils.py @@ -53,4 +53,12 @@ def create_command_line_args(request): 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/test_24ghz.py b/tests/pytest/test_24ghz.py index 3605ba4d3..7df8cc000 100644 --- a/tests/pytest/test_24ghz.py +++ b/tests/pytest/test_24ghz.py @@ -41,19 +41,19 @@ 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.featureB + #def test_feature_b(self): + # pass - @pytest.mark.featureC - def test_feature_c(self): - assert 1 == 0 + #@pytest.mark.featureC + #def test_feature_c(self): + # assert 1 == 0 - @pytest.mark.featureD - def test_feature_d(self): - pytest.skip("speedup") + #@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 + #@pytest.mark.xfail + #@pytest.mark.featureE + #def test_feature_e(self): + # assert 1 == 0 From 74cca6bdc08bcd684efe4b628d1cae0a5f6e9061 Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Thu, 11 Feb 2021 16:20:54 -0800 Subject: [PATCH 15/32] pytest: Move files into /tests/ Code will need changing next, this is pure rename. Signed-off-by: Ben Greear --- tests/{pytest => }/Dockerfile | 0 tests/{pytest => }/EXAMPLE-USAGE.txt | 0 tests/{pytest => }/conftest.py | 0 tests/{pytest => }/helpers/utils.py | 0 tests/{pytest => }/pytest.ini | 0 tests/{pytest => }/test_24ghz.py | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename tests/{pytest => }/Dockerfile (100%) rename tests/{pytest => }/EXAMPLE-USAGE.txt (100%) rename tests/{pytest => }/conftest.py (100%) rename tests/{pytest => }/helpers/utils.py (100%) rename tests/{pytest => }/pytest.ini (100%) rename tests/{pytest => }/test_24ghz.py (100%) 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/pytest/EXAMPLE-USAGE.txt b/tests/EXAMPLE-USAGE.txt similarity index 100% rename from tests/pytest/EXAMPLE-USAGE.txt rename to tests/EXAMPLE-USAGE.txt diff --git a/tests/pytest/conftest.py b/tests/conftest.py similarity index 100% rename from tests/pytest/conftest.py rename to tests/conftest.py diff --git a/tests/pytest/helpers/utils.py b/tests/helpers/utils.py similarity index 100% rename from tests/pytest/helpers/utils.py rename to tests/helpers/utils.py diff --git a/tests/pytest/pytest.ini b/tests/pytest.ini similarity index 100% rename from tests/pytest/pytest.ini rename to tests/pytest.ini diff --git a/tests/pytest/test_24ghz.py b/tests/test_24ghz.py similarity index 100% rename from tests/pytest/test_24ghz.py rename to tests/test_24ghz.py From e8389ca569fb38450b2c248579dd2df8ff4589a0 Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Thu, 11 Feb 2021 16:33:43 -0800 Subject: [PATCH 16/32] consolidate examples files. --- tests/EXAMPLE-USAGE.txt | 7 +++++++ tests/USAGE_EXAMPLES.txt | 5 ----- 2 files changed, 7 insertions(+), 5 deletions(-) delete mode 100644 tests/USAGE_EXAMPLES.txt diff --git a/tests/EXAMPLE-USAGE.txt b/tests/EXAMPLE-USAGE.txt index 66410f9ce..c3f9ed487 100644 --- a/tests/EXAMPLE-USAGE.txt +++ b/tests/EXAMPLE-USAGE.txt @@ -8,3 +8,10 @@ pytest test_24ghz.py --testrail-user-id NONE --ap-jumphost-address localhost --a --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 --skip_profiles --lanforge-2g-radio 1.1.wiphy4 --lanforge-5g-radio 1.1.wiphy5 diff --git a/tests/USAGE_EXAMPLES.txt b/tests/USAGE_EXAMPLES.txt deleted file mode 100644 index 66b0d0243..000000000 --- a/tests/USAGE_EXAMPLES.txt +++ /dev/null @@ -1,5 +0,0 @@ - - -# 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 --skip_profiles --lanforge-2g-radio 1.1.wiphy4 --lanforge-5g-radio 1.1.wiphy5 From 4bb2e2a71accf73b60a1199a07a1a7d9cb4e9ad9 Mon Sep 17 00:00:00 2001 From: shivam Date: Fri, 12 Feb 2021 16:14:13 +0530 Subject: [PATCH 17/32] Radius and EAP Clients are working from sdk_set_profile.py --- libs/cloudsdk/cloudsdk.py | 245 +++++++++---------- tests/Nightly_Sanity.py | 15 +- tests/UnitTestBase.py | 4 +- tests/templates/radius_profile_template.json | 1 + tools/sdk_set_profile.py | 10 +- 5 files changed, 134 insertions(+), 141 deletions(-) create mode 100644 tests/templates/radius_profile_template.json diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index a479dd014..aca31bd9b 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): @@ -52,7 +53,7 @@ class CloudSDK: 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 + '''", @@ -66,11 +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'] bearer = bearer_token - return(bearer_token) + return (bearer_token) def check_response(self, cmd, response, headers, data_str, url): if response.status_code >= 500 or self.verbose: @@ -104,7 +105,7 @@ class CloudSDK: "date": "N/A", "commitId": "N/A", "projectVersion": "N/A" - } + } if report_data: report_data['cloud_sdk'][key] = cloudsdk_cluster_info @@ -123,7 +124,7 @@ class CloudSDK: 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)) + 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" @@ -131,7 +132,6 @@ class CloudSDK: return do_upgrade - # client is testrail client 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): @@ -177,7 +177,7 @@ 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) if testrail_client: @@ -208,7 +208,8 @@ class CloudSDK: if report_data and test_cases: report_data['tests'][key][test_cases["upgrade_api"]] = "passed" 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') + 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: @@ -216,7 +217,8 @@ class CloudSDK: # mark upgrade test case as failed with CloudSDK error 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') + 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: @@ -227,7 +229,8 @@ class CloudSDK: # mark upgrade test case as failed with CloudSDK error 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') + 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: @@ -241,17 +244,17 @@ class CloudSDK: if test_cases: test_id_cloud = test_cases["cloud_fw"] cloud_ap_fw = self.ap_firmware(customer_id, equipment_id, cloudSDK_url, bearer) - print('Current AP Firmware from CloudSDK: %s requested-image: %s'%(cloud_ap_fw, ap_image)) + 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.") @@ -271,7 +274,7 @@ class CloudSDK: 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" @@ -363,7 +366,7 @@ class CloudSDK: 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 @@ -373,17 +376,17 @@ class CloudSDK: status_code = status_response.status_code if status_code == 200: status_data = status_response.json() - #print(status_data) + # print(status_data) current_ap_fw = status_data[2]['details']['reportedSwVersion'] return current_ap_fw 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 @@ -394,14 +397,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 @@ -409,13 +412,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 = { @@ -438,7 +441,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() @@ -449,12 +452,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 @@ -464,7 +467,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() @@ -491,7 +494,8 @@ 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 @@ -505,7 +509,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 @@ -516,7 +520,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 get_customer_locations(self, cloudSDK_url, bearer, customer_id): url_base = cloudSDK_url + "/portal/location/forCustomer" + "?customerId=" + customer_id @@ -573,10 +577,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 = { @@ -585,12 +589,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 = { @@ -599,12 +603,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 = { @@ -613,12 +617,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 = { @@ -627,12 +631,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 = { @@ -641,7 +645,7 @@ 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): @@ -658,7 +662,7 @@ 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) @@ -674,8 +678,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 = { @@ -693,14 +697,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() @@ -720,27 +724,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): + print("create-ssid-profile, template: %s" % (template)) profile = self.get_customer_profile_by_name(cloudSDK_url, bearer, customer_id, template) profile['name'] = name @@ -762,7 +767,6 @@ 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): @@ -774,7 +778,7 @@ class CloudSDK: ssid, passkey, radius, security, mode, vlan, radios) # Update then. - print("Update existing ssid profile, name: %s"%(name)) + print("Update existing ssid profile, name: %s" % (name)) profile['name'] = name profile['details']['ssid'] = ssid profile['details']['keyStr'] = passkey @@ -797,7 +801,7 @@ class CloudSDK: # 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)) + print("create-rf-profile, template: %s" % (template)) url = cloudSDK_url + "/portal/profile" headers = { @@ -809,7 +813,7 @@ class CloudSDK: self.check_response("POST", response, headers, data_str, url) ssid_profile = response.json() return ssid_profile['id'] - + # Not tested yet. def create_or_update_rf_profile(self, cloudSDK_url, bearer, customer_id, template, name, new_prof): @@ -820,7 +824,7 @@ class CloudSDK: return self.create_rf_profile(cloudSDK_url, bearer, customer_id, template, name, new_prof) # Update then. - print("Update existing ssid profile, name: %s"%(name)) + print("Update existing ssid profile, name: %s" % (name)) url = cloudSDK_url + "/portal/profile" headers = { @@ -834,12 +838,11 @@ class CloudSDK: 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) @@ -868,7 +871,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() @@ -876,51 +879,31 @@ 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)) + with open(template, 'r+') as radius_profile: + profile = json.load(radius_profile) - 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 + # profile = {"model_type": "Profile", "id": 129, "customerId": "2", "profileType": "radius", "name": "Automation_Radius_Nightly", "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": []} + profile['name'] = name + profile['customerId'] = customer_id + profile['details']["primaryRadiusAuthServer"]['ipAddress'] = server_ip + profile['details']["primaryRadiusAuthServer"]['secret'] = secret + profile['details']["primaryRadiusAuthServer"]['port'] = auth_port - 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 + with open(template, 'w') as radius_profile: + json.dump(profile, radius_profile) 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'] - + response = requests.request("POST", url, headers=headers, data=open(template, 'rb')) + radius_profile = response.json() + radius_profile_id = radius_profile['id'] + return radius_profile_id # Library for creating AP Profiles @@ -958,11 +941,11 @@ 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 } @@ -1139,11 +1122,11 @@ class CreateAPProfiles: 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'] @@ -1166,10 +1149,10 @@ 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') + 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.") @@ -1196,7 +1179,6 @@ class CreateAPProfiles: print("CreateAPProfile::create_ssid_profile, skip-wpa: ", skip_wpa, " skip-wpa2: ", skip_wpa2, " skip-eap: ", skip_eap) - if not skip_eap: # 5G eap try: @@ -1220,7 +1202,8 @@ 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" @@ -1236,7 +1219,8 @@ class CreateAPProfiles: mode.upper(), 1, ["is2dot4GHz"]) 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, + 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: @@ -1244,11 +1228,11 @@ 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: # 5g wpa2 try: @@ -1271,7 +1255,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" @@ -1280,7 +1265,8 @@ 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.profile_data['2g']['wpa2'][ + self.mode], self.ssid_data['2g']['wpa2'][self.mode], self.psk_data['2g']['wpa2'][self.mode], "Radius-Accounting-Profile", @@ -1296,11 +1282,11 @@ 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=self.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: # 5g wpa try: @@ -1324,7 +1310,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=self.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" @@ -1340,7 +1327,8 @@ class CreateAPProfiles: mode.upper(), 1, ["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, + 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" except Exception as ex: @@ -1348,7 +1336,8 @@ class CreateAPProfiles: 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, + self.client.update_testrail(case_id=self.test_cases["ssid_2g_wpa_" + 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" @@ -1408,17 +1397,17 @@ 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_"+ self.mode], run_id=self.rid, status_id=1, + 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_"+self.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_"+self.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_"+self.mode] = "failed" + self.test_cases["ap_" + self.mode] = "failed" self.ap_profile = self.cloud.set_ap_profile(eq_id, self.test_profile_id) diff --git a/tests/Nightly_Sanity.py b/tests/Nightly_Sanity.py index e3c837155..01a47f6d4 100755 --- a/tests/Nightly_Sanity.py +++ b/tests/Nightly_Sanity.py @@ -121,7 +121,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 +132,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,7 +153,7 @@ 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) @@ -175,9 +175,10 @@ class NightlySanity: 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) @@ -212,7 +213,7 @@ 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_profile(eq_id=self.equipment_id, fw_model=self.model, mode="nat") diff --git a/tests/UnitTestBase.py b/tests/UnitTestBase.py index 46e15f6b0..7f2d76c34 100644 --- a/tests/UnitTestBase.py +++ b/tests/UnitTestBase.py @@ -145,7 +145,7 @@ def add_base_parse_args(parser): default="password") parser.add_argument("--testrail-run-prefix", type=str, help="testrail run prefix", default="prefix-1") - parser.add_argument("--testrail-milestone", type=str, help="testrail milestone ID", + 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", @@ -288,7 +288,7 @@ def add_base_parse_args_pytest(parser): default="password") parser.addoption("--testrail-run-prefix", type=str, help="testrail run prefix", default="prefix-1") - parser.addoption("--testrail-milestone", type=str, help="testrail milestone ID", + 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", 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/tools/sdk_set_profile.py b/tools/sdk_set_profile.py index c367a58f3..34b242027 100755 --- a/tools/sdk_set_profile.py +++ b/tools/sdk_set_profile.py @@ -184,16 +184,18 @@ def main(): 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 - # obj.create_radius_profile(radius_name, rid, key) - pass - ap_object.create_ssid_profiles(ssid_template=ssid_template, skip_eap=True, skip_wpa=args.skip_wpa, + radius_name = "Automation_Radius_Nightly-09" + 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) From 199d7b86dc8b9245a181f11a80980a9f01d50598 Mon Sep 17 00:00:00 2001 From: shivam Date: Mon, 15 Feb 2021 00:52:00 +0530 Subject: [PATCH 18/32] removed file IO for radius --- libs/cloudsdk/cloudsdk.py | 13 +++++-------- tools/sdk_set_profile.py | 3 ++- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index aca31bd9b..c6cdfceb2 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -882,25 +882,22 @@ class CloudSDK: 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): - with open(template, 'r+') as radius_profile: - profile = json.load(radius_profile) - - # profile = {"model_type": "Profile", "id": 129, "customerId": "2", "profileType": "radius", "name": "Automation_Radius_Nightly", "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": []} + null = None + profile = {"model_type": "Profile", "id": 129, "customerId": "2", "profileType": "radius", "name": "Automation_Radius_Nightly-1553", "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": []} profile['name'] = name profile['customerId'] = customer_id profile['details']["primaryRadiusAuthServer"]['ipAddress'] = server_ip profile['details']["primaryRadiusAuthServer"]['secret'] = secret profile['details']["primaryRadiusAuthServer"]['port'] = auth_port - with open(template, 'w') as radius_profile: - json.dump(profile, radius_profile) - url = cloudSDK_url + "/portal/profile" headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + bearer } - response = requests.request("POST", url, headers=headers, data=open(template, 'rb')) + + 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 diff --git a/tools/sdk_set_profile.py b/tools/sdk_set_profile.py index 34b242027..0dc921152 100755 --- a/tools/sdk_set_profile.py +++ b/tools/sdk_set_profile.py @@ -191,7 +191,7 @@ def main(): if not args.skip_profiles: if not args.skip_radius: # Radius Profile needs to be set here - radius_name = "Automation_Radius_Nightly-09" + 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) @@ -206,3 +206,4 @@ def main(): main() + From 2f1db3bb19f91af7db8bff0b989a854c07dd98fe Mon Sep 17 00:00:00 2001 From: shivam Date: Mon, 15 Feb 2021 23:18:32 +0530 Subject: [PATCH 19/32] added examples on NOLA-01 with latest sdk base url, and some cloudsdk fix --- libs/cloudsdk/cloudsdk.py | 4 ++-- tools/USAGE_EXAMPLES.txt | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index c6cdfceb2..6b7246b6c 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -93,7 +93,7 @@ class CloudSDK: return True def should_upgrade_ap_fw(self, force_upgrade, skip_upgrade, report_data, latest_ap_image, fw_model, ap_cli_fw, - logger): + logger, key): do_upgrade = False if ap_cli_fw == latest_ap_image and force_upgrade != True: print('FW does not require updating') @@ -135,7 +135,7 @@ class CloudSDK: # client is testrail client 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 = self.base_url diff --git a/tools/USAGE_EXAMPLES.txt b/tools/USAGE_EXAMPLES.txt index b0883001f..3541e1b91 100644 --- a/tools/USAGE_EXAMPLES.txt +++ b/tools/USAGE_EXAMPLES.txt @@ -25,9 +25,11 @@ The ports are used as: 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_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) From aa7e2dbc3149428b248d9ee56c483bc5e3d0ab3b Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Mon, 15 Feb 2021 14:45:37 -0800 Subject: [PATCH 20/32] sdk-upgrade: Fix to work against latest library method. Signed-off-by: Ben Greear --- tools/sdk_upgrade_fw.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/sdk_upgrade_fw.py b/tools/sdk_upgrade_fw.py index 102aef458..edaf9c10b 100755 --- a/tools/sdk_upgrade_fw.py +++ b/tools/sdk_upgrade_fw.py @@ -165,9 +165,10 @@ 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(command_line_args.force_upgrade, command_line_args.skip_upgrade, - report_data, ap_image, fw_model, ap_cli_fw, logger) + report_data, ap_image, fw_model, ap_cli_fw, logger, key) cloudModel = cloud_sdk_models[model_id] pf = cloud.do_upgrade_ap_fw(command_line_args, report_data, test_cases, client, From 4a25cad2d8b4d8e6eeca846ba16b665d3d7e042d Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Mon, 15 Feb 2021 17:01:47 -0800 Subject: [PATCH 21/32] Update example usage notes. --- libs/lab_ap_info.py | 4 +++- tools/USAGE_EXAMPLES.txt | 38 ++++++++++++++++++++++++++++++-------- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/libs/lab_ap_info.py b/libs/lab_ap_info.py index 9ef5b3fb5..124357de3 100755 --- a/libs/lab_ap_info.py +++ b/libs/lab_ap_info.py @@ -25,7 +25,9 @@ cloud_sdk_models = { "ea8300": "EA8300-CA", "ecw5211": "ECW5211", "ecw5410": "ECW5410", - "wf188n": "WF188N" + "wf188n": "WF188N", + "eap101": "EAP101", + "eap102": "EAP102" } mimo_5g = { diff --git a/tools/USAGE_EXAMPLES.txt b/tools/USAGE_EXAMPLES.txt index 3541e1b91..7385a32d4 100644 --- a/tools/USAGE_EXAMPLES.txt +++ b/tools/USAGE_EXAMPLES.txt @@ -37,36 +37,58 @@ 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 + --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) From 865c5408e188bd5eb87dd30b1194e9eaf13bd353 Mon Sep 17 00:00:00 2001 From: shivam Date: Wed, 17 Feb 2021 01:07:01 +0530 Subject: [PATCH 22/32] Radius and EAP Profile are working now Signed-off-by: shivam --- libs/cloudsdk/cloudsdk.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index 6b7246b6c..a02427c63 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -769,7 +769,7 @@ class CloudSDK: 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): + 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: @@ -787,7 +787,9 @@ 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', @@ -796,6 +798,7 @@ class CloudSDK: data_str = json.dumps(profile) response = requests.request("PUT", url, headers=headers, data=data_str) self.check_response("PUT", response, headers, data_str, url) + print("SSID SHIVAM TEST", profile) return profile['id'] # General usage: get the default profile, modify it accordingly, pass it back to here @@ -883,7 +886,7 @@ class CloudSDK: subnet_mask, region, server_name, server_ip, secret, auth_port): null = None - profile = {"model_type": "Profile", "id": 129, "customerId": "2", "profileType": "radius", "name": "Automation_Radius_Nightly-1553", "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": []} + 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 @@ -899,6 +902,7 @@ class CloudSDK: json_profile_data = json.dumps(profile).encode("utf-8") response = requests.request("POST", url, headers=headers, data=json_profile_data) radius_profile = response.json() + print("RADIUS SHIVAM TEST", radius_profile) radius_profile_id = radius_profile['id'] return radius_profile_id @@ -1171,7 +1175,8 @@ class CreateAPProfiles: 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) @@ -1179,6 +1184,7 @@ class CreateAPProfiles: if not skip_eap: # 5G eap try: + 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, @@ -1187,7 +1193,9 @@ class CreateAPProfiles: None, self.radius_name, "wpa2OnlyRadius", mode.upper(), 1, - ["is5GHzU", "is5GHz", "is5GHzL"]) + ["is5GHzU", "is5GHz", "is5GHzL"], + radius_profile=self.radius_profile) + 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, @@ -1214,7 +1222,7 @@ class CreateAPProfiles: None, self.radius_name, "wpa2OnlyRadius", mode.upper(), 1, - ["is2dot4GHz"]) + ["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, From 015ba8b49292e194668418291b77b59610cf489e Mon Sep 17 00:00:00 2001 From: shivam Date: Wed, 17 Feb 2021 01:09:45 +0530 Subject: [PATCH 23/32] Removed some extra prints Signed-off-by: shivam --- libs/cloudsdk/cloudsdk.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index a02427c63..8e2dcf71c 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -798,7 +798,6 @@ class CloudSDK: data_str = json.dumps(profile) response = requests.request("PUT", url, headers=headers, data=data_str) self.check_response("PUT", response, headers, data_str, url) - print("SSID SHIVAM TEST", profile) return profile['id'] # General usage: get the default profile, modify it accordingly, pass it back to here @@ -902,7 +901,6 @@ class CloudSDK: json_profile_data = json.dumps(profile).encode("utf-8") response = requests.request("POST", url, headers=headers, data=json_profile_data) radius_profile = response.json() - print("RADIUS SHIVAM TEST", radius_profile) radius_profile_id = radius_profile['id'] return radius_profile_id From d9ec4ddcaea1e9bca84c184f1e8b6a237875be8a Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Wed, 17 Feb 2021 11:20:38 -0800 Subject: [PATCH 24/32] nightly: Fix library API. And update usage notes. Signed-off-by: Ben Greear --- tests/EXAMPLE-USAGE.txt | 22 ++++++++++++++++++++-- tests/Nightly_Sanity.py | 3 ++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/tests/EXAMPLE-USAGE.txt b/tests/EXAMPLE-USAGE.txt index c3f9ed487..6a9cf30cd 100644 --- a/tests/EXAMPLE-USAGE.txt +++ b/tests/EXAMPLE-USAGE.txt @@ -4,7 +4,7 @@ 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-ben-testbed.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-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 @@ -14,4 +14,22 @@ pytest test_24ghz.py --testrail-user-id NONE --ap-jumphost-address localhost --a ./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 --skip_profiles --lanforge-2g-radio 1.1.wiphy4 --lanforge-5g-radio 1.1.wiphy5 + --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 01a47f6d4..3dd380779 100755 --- a/tests/Nightly_Sanity.py +++ b/tests/Nightly_Sanity.py @@ -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.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 From 8305de56448b4aeb4fed4b818c0cd4ab8888c46f Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Wed, 17 Feb 2021 16:07:26 -0800 Subject: [PATCH 25/32] nightly: Fix typo bug in radius logic. Probably more is needed, next run I disabled radius again... Signed-off-by: Ben Greear --- tests/Nightly_Sanity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Nightly_Sanity.py b/tests/Nightly_Sanity.py index 3dd380779..d8a96489e 100755 --- a/tests/Nightly_Sanity.py +++ b/tests/Nightly_Sanity.py @@ -252,7 +252,7 @@ class NightlySanity: # 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" From edc6830b3dcca22c8af734df609c055e1ab2faad Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Thu, 18 Feb 2021 09:43:57 -0800 Subject: [PATCH 26/32] cloudsdk: Add try/catch debugging around fw update error. At least some of the time this code throws exception, add some logging. Signed-off-by: Ben Greear --- libs/cloudsdk/cloudsdk.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index 8e2dcf71c..2fd6e074b 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -377,8 +377,20 @@ class CloudSDK: if status_code == 200: status_data = status_response.json() # print(status_data) - current_ap_fw = status_data[2]['details']['reportedSwVersion'] - return current_ap_fw + 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") From c0a53fb1bf09d6a1dceab776c6b2c4da195d3cb2 Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Thu, 18 Feb 2021 13:28:45 -0800 Subject: [PATCH 27/32] Update notes for nola-15 testbed. Signed-off-by: Ben Greear --- tools/USAGE_EXAMPLES.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/USAGE_EXAMPLES.txt b/tools/USAGE_EXAMPLES.txt index 7385a32d4..26de00b41 100644 --- a/tools/USAGE_EXAMPLES.txt +++ b/tools/USAGE_EXAMPLES.txt @@ -114,12 +114,13 @@ 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.cicd.lab.wlan.tip.build \ + --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-ben-testbed.cicd.lab.wlan.tip.build --force-upgrade true + --sdk-base-url https://wlan-portal-svc-nola-15.cicd.lab.wlan.tip.build --force-upgrade true + From 14141e8871d60e53a0916bf1961697fb0defdac2 Mon Sep 17 00:00:00 2001 From: shivam Date: Fri, 19 Feb 2021 20:16:01 +0530 Subject: [PATCH 28/32] ssid profile push bugs update Signed-off-by: shivam --- libs/cloudsdk/cloudsdk.py | 8 ++++++++ tools/sdk_set_profile.py | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index 8e2dcf71c..03cd2dcfe 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -1148,6 +1148,7 @@ class CreateAPProfiles: self.server_name, self.server_ip, self.secret, self.auth_port) print("radius profile Id is", self.radius_profile) + time.sleep(5) 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" @@ -1194,6 +1195,7 @@ class CreateAPProfiles: ["is5GHzU", "is5GHz", "is5GHzL"], radius_profile=self.radius_profile) + time.sleep(5) 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, @@ -1222,6 +1224,7 @@ class CreateAPProfiles: mode.upper(), 1, ["is2dot4GHz"], radius_profile=self.radius_profile) print("2.4G EAP SSID created successfully - " + mode + " mode") + time.sleep(5) 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') @@ -1249,6 +1252,7 @@ class CreateAPProfiles: mode.upper(), 1, ["is5GHzU", "is5GHz", "is5GHzL"]) print("5G WPA2 SSID created successfully - " + mode + " mode") + time.sleep(5) 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') @@ -1276,6 +1280,7 @@ class CreateAPProfiles: "wpa2OnlyPSK", self.mode.upper(), 1, ["is2dot4GHz"]) print("2.4G WPA2 SSID created successfully - " + mode + " mode") + time.sleep(5) 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') @@ -1303,6 +1308,7 @@ class CreateAPProfiles: mode.upper(), 1, ["is5GHzU", "is5GHz", "is5GHzL"]) print("5G WPA SSID created successfully - " + mode + " mode") + time.sleep(5) self.client.update_testrail(case_id=self.test_cases["ssid_5g_wpa_" + mode], run_id=self.rid, status_id=1, @@ -1330,6 +1336,7 @@ class CreateAPProfiles: mode.upper(), 1, ["is2dot4GHz"]) print("2.4G WPA SSID created successfully - " + mode + " mode") + time.sleep(5) 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') @@ -1400,6 +1407,7 @@ class CreateAPProfiles: self.child_profiles) self.test_profile_id = self.create_ap_profile print("Test Profile ID for Test is:", self.test_profile_id) + 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_" + self.mode] = "passed" diff --git a/tools/sdk_set_profile.py b/tools/sdk_set_profile.py index 0dc921152..dc5cf68be 100755 --- a/tools/sdk_set_profile.py +++ b/tools/sdk_set_profile.py @@ -191,14 +191,16 @@ def main(): 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_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(5) ap_object.create_ap_profile(eq_id=equipment_id, fw_model=fw_model, mode=args.mode) ap_object.validate_changes(mode=args.mode) From 09dbe5b454ab852e028a7821113b59457cdfb18b Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Fri, 19 Feb 2021 13:17:46 -0800 Subject: [PATCH 29/32] cloudsdk: Fix typo. Brain was coding in some other language... Signed-off-by: Ben Greear --- libs/cloudsdk/cloudsdk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index 871e16aef..1991104ca 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -386,7 +386,7 @@ class CloudSDK: logging.error(logging.traceback.format_exc()) if not self.verbose: # Force full logging for this, result is not as expected. - self.verbose = true; + self.verbose = True self.check_response("GET", status_response, headers, payload, equip_fw_url) self.verbose = False return ("ERROR") From be1e17fc614a5dc467e7647e3d87f98b136319ea Mon Sep 17 00:00:00 2001 From: shivam Date: Mon, 22 Feb 2021 13:31:59 +0530 Subject: [PATCH 30/32] some improvements in profile creation logic Signed-off-by: shivam --- libs/cloudsdk/cloudsdk.py | 128 +++++++++++++++++++++++++++++++------- tools/sdk_set_profile.py | 12 ++-- 2 files changed, 115 insertions(+), 25 deletions(-) diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index 871e16aef..b27092983 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -390,7 +390,7 @@ class CloudSDK: self.check_response("GET", status_response, headers, payload, equip_fw_url) self.verbose = False return ("ERROR") - + else: return ("ERROR") @@ -507,13 +507,13 @@ class CloudSDK: 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)) + 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 = { @@ -756,7 +756,7 @@ class CloudSDK: return profile['id'] def create_ssid_profile(self, cloudSDK_url, bearer, customer_id, template, name, ssid, passkey, radius, security, - mode, vlan, radios): + 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) @@ -768,13 +768,17 @@ 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() @@ -787,7 +791,7 @@ class CloudSDK: 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) + ssid, passkey, radius, security, mode, vlan, radios, radius_profile) # Update then. print("Update existing ssid profile, name: %s" % (name)) @@ -807,7 +811,10 @@ class CloudSDK: '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'] @@ -897,7 +904,13 @@ class CloudSDK: subnet_mask, region, server_name, server_ip, secret, 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 = {"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 @@ -925,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 @@ -963,6 +978,7 @@ class CreateAPProfiles: 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, @@ -997,6 +1013,7 @@ 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 = { @@ -1054,7 +1071,6 @@ class CreateAPProfiles: def create_ssid_data(self, args, fw_model): ssid_data = self.profile_data.copy() - psk_data = { "5g": { @@ -1088,7 +1104,6 @@ class CreateAPProfiles: } } - return ssid_data, psk_data def set_ssid_psk_data(self, @@ -1160,7 +1175,7 @@ class CreateAPProfiles: self.server_name, self.server_ip, self.secret, self.auth_port) print("radius profile Id is", self.radius_profile) - time.sleep(5) + 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" @@ -1179,6 +1194,7 @@ 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 + self.mode = mode self.fiveG_eap = None self.twoFourG_eap = None @@ -1193,9 +1209,14 @@ class CreateAPProfiles: 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, @@ -1207,7 +1228,7 @@ class CreateAPProfiles: ["is5GHzU", "is5GHz", "is5GHzL"], radius_profile=self.radius_profile) - time.sleep(5) + 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, @@ -1226,6 +1247,7 @@ class CreateAPProfiles: # 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, @@ -1234,9 +1256,10 @@ class CreateAPProfiles: None, self.radius_name, "wpa2OnlyRadius", mode.upper(), 1, - ["is2dot4GHz"], radius_profile=self.radius_profile) + ["is2dot4GHz"], + radius_profile=self.radius_profile) print("2.4G EAP SSID created successfully - " + mode + " mode") - time.sleep(5) + 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') @@ -1252,6 +1275,11 @@ class CreateAPProfiles: 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, @@ -1264,7 +1292,7 @@ class CreateAPProfiles: mode.upper(), 1, ["is5GHzU", "is5GHz", "is5GHzL"]) print("5G WPA2 SSID created successfully - " + mode + " mode") - time.sleep(5) + 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') @@ -1292,7 +1320,7 @@ class CreateAPProfiles: "wpa2OnlyPSK", self.mode.upper(), 1, ["is2dot4GHz"]) print("2.4G WPA2 SSID created successfully - " + mode + " mode") - time.sleep(5) + 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') @@ -1308,6 +1336,11 @@ class CreateAPProfiles: 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, @@ -1320,7 +1353,7 @@ class CreateAPProfiles: mode.upper(), 1, ["is5GHzU", "is5GHz", "is5GHzL"]) print("5G WPA SSID created successfully - " + mode + " mode") - time.sleep(5) + time.sleep(self.sleep) self.client.update_testrail(case_id=self.test_cases["ssid_5g_wpa_" + mode], run_id=self.rid, status_id=1, @@ -1348,7 +1381,7 @@ class CreateAPProfiles: mode.upper(), 1, ["is2dot4GHz"]) print("2.4G WPA SSID created successfully - " + mode + " mode") - time.sleep(5) + 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') @@ -1375,36 +1408,43 @@ class CreateAPProfiles: 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 + "_" + self.mode @@ -1433,9 +1473,54 @@ class CreateAPProfiles: self.test_cases["ap_" + self.mode] = "failed" 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"): @@ -1504,3 +1589,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/tools/sdk_set_profile.py b/tools/sdk_set_profile.py index dc5cf68be..dedc15452 100755 --- a/tools/sdk_set_profile.py +++ b/tools/sdk_set_profile.py @@ -53,6 +53,8 @@ def main(): 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"], @@ -164,13 +166,14 @@ def main(): bearer = cloud.get_bearer(cloudSDK_url, cloud_type) radius_name = "%s-%s-%s" % (command_line_args.testbed, fw_model, "Radius") - + sleep = command_line_args.sleep + sleep = sleep/1000 args = command_line_args print("Profiles Created") - ap_object = CreateAPProfiles(args, cloud=cloud, client=client, fw_model=fw_model) + ap_object = CreateAPProfiles(args, cloud=cloud, client=client, fw_model=fw_model, sleep=sleep) # Logic to create AP Profiles (Bridge Mode) @@ -200,10 +203,11 @@ def main(): print("Create AP with equipment-id: ", equipment_id) - time.sleep(5) + 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") From 2144f05d810ab3720c00b56e239e7e5b0de22fba Mon Sep 17 00:00:00 2001 From: shivam Date: Mon, 22 Feb 2021 16:06:28 +0530 Subject: [PATCH 31/32] pytest hardcoded for now Signed-off-by: shivam --- tests/conftest.py | 55 ++++++++++++++++++++++++++++++--------------- tests/test_24ghz.py | 27 +++++++++++++--------- 2 files changed, 54 insertions(+), 28 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index b25632b2a..5b556ddde 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -53,9 +53,9 @@ def pytest_addoption(parser): 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?") - parser.addini("skip-wpa2", "Should we skip setting up WPA2?") - parser.addini("skip-radius", "Should we skip setting up EAP/Radius?") + 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") @@ -73,7 +73,8 @@ def pytest_addoption(parser): 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-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) @@ -156,6 +157,19 @@ def setup_cloudsdk(request, instantiate_cloudsdk, instantiate_testrail): 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) @@ -167,35 +181,40 @@ def setup_cloudsdk(request, instantiate_cloudsdk, instantiate_testrail): # Logic to create AP Profiles (Bridge Mode) - ap_object.set_ssid_psk_data(ssid_2g_wpa=command_line_args.ssid_2g_wpa, - ssid_5g_wpa=command_line_args.ssid_5g_wpa, - psk_2g_wpa=command_line_args.psk_2g_wpa, - psk_5g_wpa=command_line_args.psk_5g_wpa, - ssid_2g_wpa2=command_line_args.ssid_2g_wpa2, - ssid_5g_wpa2=command_line_args.ssid_5g_wpa2, - psk_2g_wpa2=command_line_args.psk_2g_wpa2, - psk_5g_wpa2=command_line_args.psk_5g_wpa2) + # 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 - # obj.create_radius_profile(radius_name, rid, key) - pass - ap_object.create_ssid_profiles(ssid_template=ssid_template, skip_eap=True, skip_wpa=command_line_args.skip_wpa, - skip_wpa2=command_line_args.skip_wpa2, mode=command_line_args.mode) + 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 ap_object + yield data @pytest.fixture(scope="session") def update_firmware(request, setup_testrails, instantiate_jFrog, instantiate_cloudsdk, access_points): diff --git a/tests/test_24ghz.py b/tests/test_24ghz.py index 7df8cc000..ddd1481a4 100644 --- a/tests/test_24ghz.py +++ b/tests/test_24ghz.py @@ -13,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 = ['py0000'] staConnect.bringup_time_sec = 60 staConnect.cleanup_on_exit = True staConnect.setup() @@ -41,6 +40,14 @@ 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.client_connectivity + # def test_single_client_wpa(self): + # pass + # + # @pytest.mark.client_connectivity + # def test_single_client_eap(self): + # pass + #@pytest.mark.featureB #def test_feature_b(self): # pass From b4f32018972825c02886aa39f1f5e7bb4b956e34 Mon Sep 17 00:00:00 2001 From: shivam Date: Mon, 22 Feb 2021 18:54:11 +0530 Subject: [PATCH 32/32] pytest case is working with hardcoded now, wanna standerdize it in later commits Signed-off-by: shivam --- libs/cloudsdk/cloudsdk.py | 67 +- libs/lab_ap_info.py | 1269 ++++++++++++++++++++++++++++++++++++- tests/test_24ghz.py | 4 +- 3 files changed, 1305 insertions(+), 35 deletions(-) diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index 62296b19b..ab2f7211d 100755 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -997,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, @@ -1194,8 +1201,12 @@ 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 - - self.mode = mode + 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 @@ -1220,11 +1231,11 @@ class CreateAPProfiles: 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, + "wpa2OnlyRadius", self.mode.upper(), self.value, ["is5GHzU", "is5GHz", "is5GHzL"], radius_profile=self.radius_profile) @@ -1251,11 +1262,11 @@ class CreateAPProfiles: 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, + self.mode.upper(), self.value, ["is2dot4GHz"], radius_profile=self.radius_profile) print("2.4G EAP SSID created successfully - " + mode + " mode") @@ -1285,11 +1296,11 @@ class CreateAPProfiles: 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) @@ -1313,11 +1324,11 @@ class CreateAPProfiles: 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], + 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) @@ -1346,11 +1357,11 @@ class CreateAPProfiles: 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) @@ -1374,27 +1385,27 @@ 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") 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, + 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_profile(self, eq_id=None, fw_model=None, mode="bridge"): self.ssid_prof_config = [] diff --git a/libs/lab_ap_info.py b/libs/lab_ap_info.py index 124357de3..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, @@ -26,6 +36,9 @@ cloud_sdk_models = { "ecw5211": "ECW5211", "ecw5410": "ECW5410", "wf188n": "WF188N", + "wf194c": "WF194C", + "ex227": "EX227", + "ex447": "EX447", "eap101": "EAP101", "eap102": "EAP102" } @@ -34,19 +47,80 @@ 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, @@ -104,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/test_24ghz.py b/tests/test_24ghz.py index ddd1481a4..fbe6e8686 100644 --- a/tests/test_24ghz.py +++ b/tests/test_24ghz.py @@ -24,10 +24,10 @@ class Test24ghz(object): staConnect.radio = lf_config["2g_radio"] # staConnect.runtime_secs = lf_config["runtime_duration"] staConnect.resource = 1 - staConnect.dut_ssid = "NOLA-01g-ecw5410-2G_WPA2'" + staConnect.dut_ssid = "NOLA-01g-ecw5410-2G_WPA2" staConnect.dut_passwd = "ecw5410-2G_WPA2" staConnect.dut_security = "wpa2" - staConnect.station_names = ['py0000'] + staConnect.station_names = ['sta0000'] staConnect.bringup_time_sec = 60 staConnect.cleanup_on_exit = True staConnect.setup()