From e35ebe5f2775c9f036f59c42b1c4339fc1ab1c82 Mon Sep 17 00:00:00 2001 From: shivamcandela Date: Fri, 13 Aug 2021 14:36:41 +0530 Subject: [PATCH] sanity adjustments for 1.x Signed-off-by: shivamcandela --- tests/configuration.py | 6 +- ...enterprise_security_modes_configuration.py | 4 +- tests/e2e/basic/conftest.py | 9 +- tests/e2e/basic/test_firmware.py | 35 +---- tests/fixtures_1x.py | 125 ++++++++++++++---- 5 files changed, 111 insertions(+), 68 deletions(-) diff --git a/tests/configuration.py b/tests/configuration.py index dfe827b7f..2e7c73cd4 100644 --- a/tests/configuration.py +++ b/tests/configuration.py @@ -102,9 +102,9 @@ CONFIGURATION = { "ip": "10.28.3.8", "port": 8080, "ssh_port": 22, - "2.4G-Radio": ["wiphy4"], - "5G-Radio": ["wiphy5"], - "AX-Radio": ["wiphy0", "wiphy1", "wiphy2", "wiphy3"], + "2.4G-Radio": ["1.1.wiphy4"], + "5G-Radio": ["1.1.wiphy5"], + "AX-Radio": ["1.1.wiphy0", "1.1.wiphy1", "1.1.wiphy2", "1.1.wiphy3"], "upstream": "1.1.eth2", "upstream_subnet": "10.28.2.1/24", "uplink": "1.1.eth3", diff --git a/tests/e2e/basic/configuration_tests/bridge_mode/test_enterprise_security_modes_configuration.py b/tests/e2e/basic/configuration_tests/bridge_mode/test_enterprise_security_modes_configuration.py index 209798709..1fc761638 100644 --- a/tests/e2e/basic/configuration_tests/bridge_mode/test_enterprise_security_modes_configuration.py +++ b/tests/e2e/basic/configuration_tests/bridge_mode/test_enterprise_security_modes_configuration.py @@ -45,13 +45,13 @@ class TestSetupBridgeEnterpriseSuiteA(object): @pytest.mark.twog def test_setup_wpa_enterprise_2g_ssid_profile(self, setup_profiles, update_report, test_cases): """ WPA Enterprise SSID 2.4G """ - assert setup_profiles['wpa2_enterprise_2g'] + assert setup_profiles['wpa_enterprise_2g'] @pytest.mark.wpa_enterprise @pytest.mark.fiveg def test_setup_wpa_enterprise_5g_ssid_profile(self, setup_profiles, update_report, test_cases): """ WPA Enterprise SSID 5G """ - assert setup_profiles['wpa2_enterprise_5g'] + assert setup_profiles['wpa_enterprise_5g'] @pytest.mark.sanity_light @pytest.mark.wpa2_enterprise diff --git a/tests/e2e/basic/conftest.py b/tests/e2e/basic/conftest.py index 790c2ef15..d64d7081d 100644 --- a/tests/e2e/basic/conftest.py +++ b/tests/e2e/basic/conftest.py @@ -47,7 +47,6 @@ def create_lanforge_chamberview_dut(lf_tools): return dut_name - @pytest.fixture(scope="class") def setup_profiles(request, setup_controller, testbed, get_equipment_id, fixtures_ver, instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools, @@ -78,10 +77,10 @@ def setup_profiles(request, setup_controller, testbed, get_equipment_id, fixture # call this, if 1.x return_var = fixtures_ver.setup_profiles(request, param, setup_controller, testbed, get_equipment_id, - instantiate_profile, - get_markers, create_lanforge_chamberview_dut, lf_tools, - get_security_flags, get_configuration, radius_info, get_apnos, - radius_accounting_info) + instantiate_profile, + get_markers, create_lanforge_chamberview_dut, lf_tools, + get_security_flags, get_configuration, radius_info, get_apnos, + radius_accounting_info) yield return_var diff --git a/tests/e2e/basic/test_firmware.py b/tests/e2e/basic/test_firmware.py index ca9330626..8b86d39e1 100644 --- a/tests/e2e/basic/test_firmware.py +++ b/tests/e2e/basic/test_firmware.py @@ -6,7 +6,8 @@ import allure import pytest -pytestmark = [pytest.mark.firmware, pytest.mark.sanity, pytest.mark.sanity_light, pytest.mark.usefixtures("setup_test_run")] +pytestmark = [pytest.mark.firmware, pytest.mark.sanity, pytest.mark.sanity_light, + pytest.mark.usefixtures("setup_test_run")] @allure.testcase("firmware upgrade from Cloud") @@ -16,14 +17,8 @@ class TestFirmware(object): @pytest.mark.firmware_create def test_firmware_create(self, upload_firmware, update_report, test_cases): if upload_firmware != 0: - update_report.update_testrail(case_id=test_cases["create_fw"], - status_id=1, - msg='Create new FW version by API successful') PASS = True else: - update_report.update_testrail(case_id=test_cases["create_fw"], - status_id=5, - msg='Error creating new FW version by API') PASS = False assert PASS @@ -31,14 +26,8 @@ class TestFirmware(object): def test_firmware_upgrade_request(self, upgrade_firmware, update_report, test_cases): print(upgrade_firmware) if not upgrade_firmware: - update_report.update_testrail(case_id=test_cases["upgrade_api"], - status_id=0, - msg='Error requesting upgrade via API') PASS = False else: - update_report.update_testrail(case_id=test_cases["upgrade_api"], - status_id=1, - msg='Upgrade request using API successful') PASS = True assert PASS @@ -48,39 +37,21 @@ class TestFirmware(object): ap_fw_list = [] for i in get_equipment_id: ap_fw_list.append(setup_controller.get_ap_firmware_old_method(equipment_id=i)) - if get_latest_firmware != ap_fw_list: - update_report.update_testrail(case_id=test_cases["cloud_fw"], - status_id=5, - msg='CLOUDSDK reporting incorrect firmware version.') - else: - update_report.update_testrail(case_id=test_cases["cloud_fw"], - status_id=1, - msg='CLOUDSDK reporting correct firmware version.') assert get_latest_firmware == ap_fw_list @pytest.mark.firmware_ap - def test_ap_firmware(get_configuration, get_apnos, get_latest_firmware, update_report, test_cases): """yields the active version of firmware on ap""" active_fw_list = [] try: for access_point in get_configuration['access_point']: - ap_ssh = get_apnos(access_point) + ap_ssh = get_apnos(access_point, sdk="1.x") active_fw = ap_ssh.get_active_firmware() active_fw_list.append(active_fw) except Exception as e: print(e) active_fw_list = [] - if active_fw_list == get_latest_firmware: - update_report.update_testrail(case_id=test_cases["ap_upgrade"], - status_id=1, - msg='Upgrade to ' + str(get_latest_firmware) + ' successful') - else: - update_report.update_testrail(case_id=test_cases["ap_upgrade"], - status_id=4, - msg='Cannot reach AP after upgrade to check CLI - re-test required') - assert active_fw_list == get_latest_firmware diff --git a/tests/fixtures_1x.py b/tests/fixtures_1x.py index 0437162e6..f0165ee2b 100644 --- a/tests/fixtures_1x.py +++ b/tests/fixtures_1x.py @@ -168,12 +168,18 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("5G", "is5GHz") j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_open_ssid_profile(profile_data=j) - test_cases["open_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["open_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["open_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["open_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["open_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["open_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") @@ -192,12 +198,18 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("5G", "is5GHz") j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wpa_ssid_profile(profile_data=j) - test_cases["wpa_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") @@ -217,12 +229,18 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("5G", "is5GHz") j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=j) - test_cases["wpa2_personal_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa2_personal_2g"] = True + if j["appliedRadios"].__contains__("5G"): + test_cases["wpa2_personal_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa2_personal_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa2_personal_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa2_personal_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") @@ -243,12 +261,18 @@ class Fixtures_1x: creates_profile = instantiate_profile.create_wpa_wpa2_personal_mixed_ssid_profile( profile_data=j) - test_cases["wpa_wpa2_personal_mixed_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa_wpa2_personal_mixed_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa_wpa2_personal_mixed_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa_wpa2_personal_mixed_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa_wpa2_personal_mixed_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa_wpa2_personal_mixed_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") @@ -268,12 +292,18 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wpa3_personal_ssid_profile(profile_data=j) - test_cases["wpa3_personal_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa3_personal_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa3_personal_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa3_personal_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa3_personal_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa3_personal_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") if mode == "wpa3_personal_mixed": @@ -292,12 +322,18 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wpa3_personal_mixed_ssid_profile( profile_data=j) - test_cases["wpa3_personal_mixed_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa3_personal_mixed_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa3_personal_mixed_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa3_personal_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa3_personal_mixed_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa3_personal_mixed_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") @@ -316,13 +352,19 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("5G", "is5GHz") j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wpa_enterprise_ssid_profile(profile_data=j) - test_cases["wpa_enterprise_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa_enterprise_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa_enterprise_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa_enterprise_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa_enterprise_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa_enterprise_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") if mode == "wpa2_enterprise": @@ -340,12 +382,19 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("5G", "is5GHz") j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=j) - test_cases["wpa2_enterprise_2g"] = True + + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa2_enterprise_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa2_enterprise_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa2_enterprise_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa2_enterprise_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa2_enterprise_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") if mode == "wpa3_enterprise": @@ -363,12 +412,18 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("5G", "is5GHz") j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wpa3_enterprise_ssid_profile(profile_data=j) - test_cases["wpa3_enterprise_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa3_enterprise_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa3_enterprise_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa3_enterprise_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa3_enterprise_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa3_enterprise_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") @@ -388,12 +443,18 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wpa_wpa2_enterprise_mixed_ssid_profile( profile_data=j) - test_cases["wpa_wpa2_enterprise_mixed_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa_wpa2_enterprise_mixed_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa_wpa2_enterprise_mixed_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa_wpa2_enterprise_mixed_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa_wpa2_enterprise_mixed_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa_wpa2_enterprise_mixed_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") if mode == "wpa3_enterprise_mixed": @@ -412,12 +473,18 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wpa3_enterprise_mixed_ssid_profile( profile_data=j) - test_cases["wpa3_enterprise_mixed_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa3_enterprise_mixed_2g"] = True + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa3_enterprise_mixed_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa3_enterprise_mixed_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wpa3_enterprise_mixed_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wpa3_enterprise_mixed_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") @@ -436,12 +503,18 @@ class Fixtures_1x: j["appliedRadios"][i] = j["appliedRadios"][i].replace("5G", "is5GHz") j["appliedRadios"][i] = j["appliedRadios"][i].replace("2G", "is2dot4GHz") creates_profile = instantiate_profile.create_wep_ssid_profile(profile_data=j) - test_cases["wpa3_enterprise_2g"] = True + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wep_2g"] = True + if j["appliedRadios"].__contains__("is5GHzU"): + test_cases["wep_5g"] = True allure.attach(body=str(creates_profile), name="SSID Profile Created") except Exception as e: print(e) - test_cases["wpa3_enterprise_2g"] = False + if j["appliedRadios"].__contains__("is2dot4GHz"): + test_cases["wep_2g"] = False + if j["appliedRadios"].__contains__("is5GHz"): + test_cases["wep_5g"] = False allure.attach(body=str(e), name="SSID Profile Creation Failed") # Equipment AP Profile Creation @@ -464,7 +537,7 @@ class Fixtures_1x: print(e) print("failed to create AP Profile") - ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") + ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/", sdk="1.x") # ssid_names = [] # for i in instantiate_profile.profile_creation_ids["ssid"]: # ssid_names.append(instantiate_profile.get_ssid_name_by_profile_id(profile_id=i)) @@ -488,7 +561,7 @@ class Fixtures_1x: allure.attach( body=str("VIF Config: " + str(vif_config) + "\n" + "SSID Pushed from Controller: " + str(ssid_names)), name="SSID Profiles in VIF Config and Controller: ") - ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") + ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/", sdk="1.x") # This loop will check the VIF Config with VIF State test_cases['vifs'] = False