mirror of
				https://github.com/Telecominfraproject/wlan-testing.git
				synced 2025-10-31 19:08:01 +00:00 
			
		
		
		
	Added base pip module for tip_2x target module
Signed-off-by: shivam <shivam.thakur@candelatech.com>
This commit is contained in:
		
							
								
								
									
										0
									
								
								libs/tip_2x/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								libs/tip_2x/README.md
									
									
									
									
									
										Normal file
									
								
							| @@ -18,14 +18,13 @@ $ pip3 install pexpect-serial | |||||||
| 
 | 
 | ||||||
| import sys | import sys | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| if sys.version_info[0] != 3: | if sys.version_info[0] != 3: | ||||||
|     print("This script requires Python 3") |     print("This script requires Python 3") | ||||||
|     exit() |     exit() | ||||||
| 
 | 
 | ||||||
| try: | try: | ||||||
|     import importlib |     import importlib | ||||||
|  | 
 | ||||||
|     re = importlib.import_module("re") |     re = importlib.import_module("re") | ||||||
|     logging = importlib.import_module("logging") |     logging = importlib.import_module("logging") | ||||||
|     time = importlib.import_module("time") |     time = importlib.import_module("time") | ||||||
							
								
								
									
										0
									
								
								libs/tip_2x/setup.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								libs/tip_2x/setup.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										134
									
								
								libs/tip_2x/tip_2x.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										134
									
								
								libs/tip_2x/tip_2x.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,134 @@ | |||||||
|  | """ | ||||||
|  |     Telecom Infra Project OpenWifi 2.X (Ucentral libraries for Test Automation) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | """ | ||||||
|  | import importlib | ||||||
|  |  | ||||||
|  | import pytest | ||||||
|  |  | ||||||
|  | logging = importlib.import_module("logging") | ||||||
|  |  | ||||||
|  | ap_lib = importlib.import_module("ap_lib") | ||||||
|  | controller = importlib.import_module("controller") | ||||||
|  |  | ||||||
|  | """ | ||||||
|  |     Custom Class Imports needed for OpenWifi 2.X | ||||||
|  | """ | ||||||
|  |  | ||||||
|  | ConfigureController = controller.ConfigureController | ||||||
|  | Controller = controller.Controller | ||||||
|  | FMSUtils = controller.FMSUtils | ||||||
|  | ProvUtils = controller.ProvUtils | ||||||
|  | UProfileUtility = controller.UProfileUtility | ||||||
|  | APLIBS = ap_lib.APLIBS | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class tip_2x: | ||||||
|  |     """ | ||||||
|  |         Standard OpenWifi wlan-testing specific variables | ||||||
|  |  | ||||||
|  |     """ | ||||||
|  |     controller_data = {} | ||||||
|  |     device_under_tests_info = [] | ||||||
|  |     """ | ||||||
|  |         OpenWifi 2.x Specific Variables that will be only scoped in tip_2x Library | ||||||
|  |  | ||||||
|  |     """ | ||||||
|  |     ow_sec_url = "" | ||||||
|  |     ow_sec_login_username = "" | ||||||
|  |     ow_sec_login_password = "" | ||||||
|  |     target = "tip_2x" | ||||||
|  |     controller_library_object = object() | ||||||
|  |     dut_library_object = object() | ||||||
|  |  | ||||||
|  |     def __init__(self, controller_data=None, target=None, | ||||||
|  |                  device_under_tests_info=[], logging_level=logging.INFO): | ||||||
|  |         logging.basicConfig(format='%(asctime)s - %(message)s', level=logging_level) | ||||||
|  |         if target != self.target: | ||||||
|  |             logging.error("Target version is : " + target + " Expected target is tip_2x.") | ||||||
|  |             pytest.exit("Target should be 'tip_2x', Current Target is : " + target) | ||||||
|  |         if controller_data is None: | ||||||
|  |             controller_data = {} | ||||||
|  |         self.controller_data = controller_data | ||||||
|  |         self.device_under_tests_info = device_under_tests_info | ||||||
|  |         self.setup_metadata() | ||||||
|  |  | ||||||
|  |     """ | ||||||
|  |         Controller and Access Point specific metadata that is related to OpenWifi 2.x | ||||||
|  |     """ | ||||||
|  |  | ||||||
|  |     def setup_metadata(self): | ||||||
|  |         logging.info("setting up the Controller metadata for tip_2x Library: " + str(self.controller_data)) | ||||||
|  |         logging.info("setting up the DUT metadata for tip_2x Library: " + str(self.device_under_tests_info)) | ||||||
|  |         logging.info("Number of DUT's configured: " + str(len(self.device_under_tests_info))) | ||||||
|  |         self.ow_sec_url = self.controller_data["url"] | ||||||
|  |         self.ow_sec_login_username = self.controller_data["username"] | ||||||
|  |         self.ow_sec_login_password = self.controller_data["password"] | ||||||
|  |  | ||||||
|  |     def setup_objects(self): | ||||||
|  |         self.controller_library_object = Controller() | ||||||
|  |         self.dut_library_object = APLIBS() | ||||||
|  |  | ||||||
|  |     """ Standard getter methods. Should be available for all type of libraries. Commonly used by wlan-testing""" | ||||||
|  |  | ||||||
|  |     def get_dut_library_object(self): | ||||||
|  |         return self.dut_library_object | ||||||
|  |  | ||||||
|  |     def get_controller_library_object(self): | ||||||
|  |         return self.controller_library_object | ||||||
|  |  | ||||||
|  |     def get_controller_data(self): | ||||||
|  |         return self.controller_data | ||||||
|  |  | ||||||
|  |     def get_device_under_tests_info(self): | ||||||
|  |         return self.device_under_tests_info | ||||||
|  |  | ||||||
|  |     def get_number_of_dut(self): | ||||||
|  |         return len(self.device_under_tests_info) | ||||||
|  |  | ||||||
|  |     def get_dut_logs(self, dut_idx=0): | ||||||
|  |         return self.dut_library_object.get_logs(idx=0) | ||||||
|  |  | ||||||
|  |     def get_controller_logs(self): | ||||||
|  |         pass | ||||||
|  |  | ||||||
|  |     def setup_configuration(self): | ||||||
|  |         pass | ||||||
|  |  | ||||||
|  |     def get_dut_version(self): | ||||||
|  |         pass | ||||||
|  |  | ||||||
|  |     def get_controller_version(self): | ||||||
|  |         pass | ||||||
|  |  | ||||||
|  |     # def get_controller_logs(self): | ||||||
|  |     #     pass | ||||||
|  |     # | ||||||
|  |     # def setup_configuration(self): | ||||||
|  |     #     pass | ||||||
|  |  | ||||||
|  |  | ||||||
|  | if __name__ == '__main__': | ||||||
|  |     basic_1 = { | ||||||
|  |         "target": "tip_2x", | ||||||
|  |         "controller": { | ||||||
|  |             "url": "https://sec-qa01.cicd.lab.wlan.tip.build:16001", | ||||||
|  |             "username": "tip@ucentral.com", | ||||||
|  |             "password": "OpenWifi%123" | ||||||
|  |         }, | ||||||
|  |         "device_under_tests": [{ | ||||||
|  |             "model": "wallys_dr40x9", | ||||||
|  |             "mode": "wifi5", | ||||||
|  |             "serial": "c44bd1005b30", | ||||||
|  |             "jumphost": True, | ||||||
|  |             "ip": "10.28.3.100", | ||||||
|  |             "username": "lanforge", | ||||||
|  |             "password": "pumpkin77", | ||||||
|  |             "port": 22, | ||||||
|  |             "serial_tty": "/dev/ttyAP8", | ||||||
|  |             "version": "next-latest" | ||||||
|  |         }], | ||||||
|  |         "traffic_generator": {} | ||||||
|  |     } | ||||||
|  |     var = tip_2x(controller_data=basic_1["controller"], device_under_tests_info=basic_1["device_under_tests"]) | ||||||
| @@ -1,128 +1,128 @@ | |||||||
| import os | # import os | ||||||
| import sys | # import sys | ||||||
|  | # | ||||||
| sys.path.append( | # sys.path.append( | ||||||
|     os.path.dirname( | #     os.path.dirname( | ||||||
|         os.path.realpath(__file__) | #         os.path.realpath(__file__) | ||||||
|     ) | #     ) | ||||||
| ) | # ) | ||||||
| if "libs" not in sys.path: | # if "libs" not in sys.path: | ||||||
|     sys.path.append(f'../libs') | #     sys.path.append(f'../libs') | ||||||
|  | # | ||||||
| from controller.controller_1x.controller import ProfileUtility | # from controller.controller_1x.controller import ProfileUtility | ||||||
| from controller.controller_2x.controller import UProfileUtility | # from controller.controller_2x.controller import UProfileUtility | ||||||
| from controller.controller_3x.controller import CController | # from controller.controller_3x.controller import CController | ||||||
| import time | # import time | ||||||
| from lanforge.lf_tests import RunTest | # from lanforge.lf_tests import RunTest | ||||||
| from lanforge.lf_tools import ChamberView | # from lanforge.lf_tools import ChamberView | ||||||
| import pytest | # import pytest | ||||||
| import allure | # import allure | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def instantiate_profile(request): | # def instantiate_profile(request): | ||||||
|     if request.config.getoption("1.x"): | #     if request.config.getoption("1.x"): | ||||||
|         yield ProfileUtility | #         yield ProfileUtility | ||||||
|     elif request.config.getoption("cc.1"): | #     elif request.config.getoption("cc.1"): | ||||||
|         yield CController | #         yield CController | ||||||
|     else: | #     else: | ||||||
|         yield UProfileUtility | #         yield UProfileUtility | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def create_lanforge_chamberview(lf_tools): | # def create_lanforge_chamberview(lf_tools): | ||||||
|     scenario_object, scenario_name = lf_tools.Chamber_View() | #     scenario_object, scenario_name = lf_tools.Chamber_View() | ||||||
|     return scenario_name | #     return scenario_name | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def setup_vlan(): | # def setup_vlan(): | ||||||
|     vlan_id = [100] | #     vlan_id = [100] | ||||||
|     allure.attach(body=str(vlan_id), name="VLAN Created: ") | #     allure.attach(body=str(vlan_id), name="VLAN Created: ") | ||||||
|     yield vlan_id[0] | #     yield vlan_id[0] | ||||||
|  | # | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="class") | # @pytest.fixture(scope="class") | ||||||
| def setup_profiles(request, setup_controller, testbed, get_equipment_ref, fixtures_ver, | # def setup_profiles(request, setup_controller, testbed, get_equipment_ref, fixtures_ver, | ||||||
|                    instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools, | #                    instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools, | ||||||
|                    get_security_flags, get_configuration, radius_info, get_apnos, radius_accounting_info, | #                    get_security_flags, get_configuration, radius_info, get_apnos, radius_accounting_info, | ||||||
|                    run_lf, cc_1, lf_reports): | #                    run_lf, cc_1, lf_reports): | ||||||
|     lf_tools.reset_scenario() | #     lf_tools.reset_scenario() | ||||||
|     param = dict(request.param) | #     param = dict(request.param) | ||||||
|  | # | ||||||
|     # VLAN Setup | #     # VLAN Setup | ||||||
|     if request.param["mode"] == "VLAN": | #     if request.param["mode"] == "VLAN": | ||||||
|  | # | ||||||
|         vlan_list = list() | #         vlan_list = list() | ||||||
|         refactored_vlan_list = list() | #         refactored_vlan_list = list() | ||||||
|         ssid_modes = request.param["ssid_modes"].keys() | #         ssid_modes = request.param["ssid_modes"].keys() | ||||||
|         for mode in ssid_modes: | #         for mode in ssid_modes: | ||||||
|             for ssid in range(len(request.param["ssid_modes"][mode])): | #             for ssid in range(len(request.param["ssid_modes"][mode])): | ||||||
|                 if "vlan" in request.param["ssid_modes"][mode][ssid]: | #                 if "vlan" in request.param["ssid_modes"][mode][ssid]: | ||||||
|                     vlan_list.append(request.param["ssid_modes"][mode][ssid]["vlan"]) | #                     vlan_list.append(request.param["ssid_modes"][mode][ssid]["vlan"]) | ||||||
|                 else: | #                 else: | ||||||
|                     pass | #                     pass | ||||||
|         if vlan_list: | #         if vlan_list: | ||||||
|             [refactored_vlan_list.append(x) for x in vlan_list if x not in refactored_vlan_list] | #             [refactored_vlan_list.append(x) for x in vlan_list if x not in refactored_vlan_list] | ||||||
|             vlan_list = refactored_vlan_list | #             vlan_list = refactored_vlan_list | ||||||
|             for i in range(len(vlan_list)): | #             for i in range(len(vlan_list)): | ||||||
|                 if vlan_list[i] > 4095 or vlan_list[i] < 1: | #                 if vlan_list[i] > 4095 or vlan_list[i] < 1: | ||||||
|                     vlan_list.pop(i) | #                     vlan_list.pop(i) | ||||||
|     if request.param["mode"] == "VLAN": | #     if request.param["mode"] == "VLAN": | ||||||
|         lf_tools.add_vlan(vlan_ids=vlan_list) | #         lf_tools.add_vlan(vlan_ids=vlan_list) | ||||||
|     print("fixture version ", fixtures_ver) | #     print("fixture version ", fixtures_ver) | ||||||
|     if cc_1: | #     if cc_1: | ||||||
|         return_var = fixtures_ver.setup_profiles(request, param, run_lf, instantiate_profile, get_configuration, | #         return_var = fixtures_ver.setup_profiles(request, param, run_lf, instantiate_profile, get_configuration, | ||||||
|                                                  get_markers, | #                                                  get_markers, | ||||||
|                                                  lf_tools, lf_reports) | #                                                  lf_tools, lf_reports) | ||||||
|     else: | #     else: | ||||||
|         return_var = fixtures_ver.setup_profiles(request, param, setup_controller, testbed, get_equipment_ref, | #         return_var = fixtures_ver.setup_profiles(request, param, setup_controller, testbed, get_equipment_ref, | ||||||
|                                              instantiate_profile, | #                                              instantiate_profile, | ||||||
|                                              get_markers, create_lanforge_chamberview_dut, lf_tools, | #                                              get_markers, create_lanforge_chamberview_dut, lf_tools, | ||||||
|                                              get_security_flags, get_configuration, radius_info, get_apnos, | #                                              get_security_flags, get_configuration, radius_info, get_apnos, | ||||||
|                                              radius_accounting_info, run_lf=run_lf) | #                                              radius_accounting_info, run_lf=run_lf) | ||||||
|  | # | ||||||
|     yield return_var | #     yield return_var | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def station_names_twog(request, get_configuration): | # def station_names_twog(request, get_configuration): | ||||||
|     station_names = [] | #     station_names = [] | ||||||
|     for i in range(0, int(request.config.getini("num_stations"))): | #     for i in range(0, int(request.config.getini("num_stations"))): | ||||||
|         station_names.append(get_configuration["traffic_generator"]["details"]["2.4G-Station-Name"] + "0" + str(i)) | #         station_names.append(get_configuration["traffic_generator"]["details"]["2.4G-Station-Name"] + "0" + str(i)) | ||||||
|     yield station_names | #     yield station_names | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def station_names_fiveg(request, get_configuration): | # def station_names_fiveg(request, get_configuration): | ||||||
|     station_names = [] | #     station_names = [] | ||||||
|     for i in range(0, int(request.config.getini("num_stations"))): | #     for i in range(0, int(request.config.getini("num_stations"))): | ||||||
|         station_names.append(get_configuration["traffic_generator"]["details"]["5G-Station-Name"] + "0" + str(i)) | #         station_names.append(get_configuration["traffic_generator"]["details"]["5G-Station-Name"] + "0" + str(i)) | ||||||
|     yield station_names | #     yield station_names | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def num_stations(request): | # def num_stations(request): | ||||||
|     num_sta = int(request.config.getini("num_stations")) | #     num_sta = int(request.config.getini("num_stations")) | ||||||
|     yield num_sta | #     yield num_sta | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="class") | # @pytest.fixture(scope="class") | ||||||
| def get_vif_state(get_apnos, get_configuration): | # def get_vif_state(get_apnos, get_configuration): | ||||||
|     ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") | #     ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") | ||||||
|     vif_config = list(ap_ssh.get_vif_config_ssids()) | #     vif_config = list(ap_ssh.get_vif_config_ssids()) | ||||||
|     vif_state = list(ap_ssh.get_vif_state_ssids()) | #     vif_state = list(ap_ssh.get_vif_state_ssids()) | ||||||
|     vif_state.sort() | #     vif_state.sort() | ||||||
|     vif_config.sort() | #     vif_config.sort() | ||||||
|     allure.attach(name="vif_state", body=str(vif_state)) | #     allure.attach(name="vif_state", body=str(vif_state)) | ||||||
|     yield vif_state | #     yield vif_state | ||||||
|  | # | ||||||
| @pytest.fixture(scope="class") | # @pytest.fixture(scope="class") | ||||||
| def get_vlan_list(get_apnos, get_configuration): | # def get_vlan_list(get_apnos, get_configuration): | ||||||
|     ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") | #     ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") | ||||||
|     vlan_list = list(ap_ssh.get_vlan()) | #     vlan_list = list(ap_ssh.get_vlan()) | ||||||
|     vlan_list.sort() | #     vlan_list.sort() | ||||||
|     allure.attach(name="vlan_list", body=str(vlan_list)) | #     allure.attach(name="vlan_list", body=str(vlan_list)) | ||||||
|     yield vlan_list | #     yield vlan_list | ||||||
|  | # | ||||||
|   | |||||||
| @@ -1,152 +1,152 @@ | |||||||
| import json | # import json | ||||||
| import os | # import os | ||||||
| import sys | # import sys | ||||||
|  | # | ||||||
| sys.path.append( | # sys.path.append( | ||||||
|     os.path.dirname( | #     os.path.dirname( | ||||||
|         os.path.realpath(__file__) | #         os.path.realpath(__file__) | ||||||
|     ) | #     ) | ||||||
| ) | # ) | ||||||
| if "libs" not in sys.path: | # if "libs" not in sys.path: | ||||||
|     sys.path.append(f'../libs') | #     sys.path.append(f'../libs') | ||||||
|  | # | ||||||
| from controller.controller_1x.controller import ProfileUtility | # from controller.controller_1x.controller import ProfileUtility | ||||||
| from controller.controller_2x.controller import UProfileUtility | # from controller.controller_2x.controller import UProfileUtility | ||||||
| from controller.controller_3x.controller import CController | # from controller.controller_3x.controller import CController | ||||||
| import time | # import time | ||||||
| from lanforge.lf_tools import ChamberView | # from lanforge.lf_tools import ChamberView | ||||||
| import pytest | # import pytest | ||||||
| import allure | # import allure | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def instantiate_profile(request): | # def instantiate_profile(request): | ||||||
|     if request.config.getoption("1.x"): | #     if request.config.getoption("1.x"): | ||||||
|         yield ProfileUtility | #         yield ProfileUtility | ||||||
|     elif request.config.getoption("cc.1"): | #     elif request.config.getoption("cc.1"): | ||||||
|         yield CController | #         yield CController | ||||||
|     else: | #     else: | ||||||
|         yield UProfileUtility | #         yield UProfileUtility | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def create_lanforge_chamberview(lf_tools): | # def create_lanforge_chamberview(lf_tools): | ||||||
|     scenario_object, scenario_name = lf_tools.Chamber_View() | #     scenario_object, scenario_name = lf_tools.Chamber_View() | ||||||
|     return scenario_name | #     return scenario_name | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def create_lanforge_chamberview_dut(lf_tools, run_lf): | # def create_lanforge_chamberview_dut(lf_tools, run_lf): | ||||||
|     if not run_lf: | #     if not run_lf: | ||||||
|         dut_object, dut_name = lf_tools.Create_Dut() | #         dut_object, dut_name = lf_tools.Create_Dut() | ||||||
|         return dut_name | #         return dut_name | ||||||
|     return "" | #     return "" | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="class") | # @pytest.fixture(scope="class") | ||||||
| def setup_profiles(request, setup_controller, testbed, get_equipment_ref, fixtures_ver, reset_scenario_lf, | # def setup_profiles(request, setup_controller, testbed, get_equipment_ref, fixtures_ver, reset_scenario_lf, | ||||||
|                    instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools, run_lf, | #                    instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools, run_lf, | ||||||
|                    get_security_flags, get_configuration, radius_info, get_apnos, radius_accounting_info, cc_1): | #                    get_security_flags, get_configuration, radius_info, get_apnos, radius_accounting_info, cc_1): | ||||||
|     param = dict(request.param) | #     param = dict(request.param) | ||||||
|  | # | ||||||
|     # VLAN Setup | #     # VLAN Setup | ||||||
|     if request.param["mode"] == "VLAN": | #     if request.param["mode"] == "VLAN": | ||||||
|  | # | ||||||
|         vlan_list = list() | #         vlan_list = list() | ||||||
|         refactored_vlan_list = list() | #         refactored_vlan_list = list() | ||||||
|         ssid_modes = request.param["ssid_modes"].keys() | #         ssid_modes = request.param["ssid_modes"].keys() | ||||||
|         for mode in ssid_modes: | #         for mode in ssid_modes: | ||||||
|             for ssid in range(len(request.param["ssid_modes"][mode])): | #             for ssid in range(len(request.param["ssid_modes"][mode])): | ||||||
|                 if "vlan" in request.param["ssid_modes"][mode][ssid]: | #                 if "vlan" in request.param["ssid_modes"][mode][ssid]: | ||||||
|                     vlan_list.append(request.param["ssid_modes"][mode][ssid]["vlan"]) | #                     vlan_list.append(request.param["ssid_modes"][mode][ssid]["vlan"]) | ||||||
|                 else: | #                 else: | ||||||
|                     pass | #                     pass | ||||||
|         if vlan_list: | #         if vlan_list: | ||||||
|             [refactored_vlan_list.append(x) for x in vlan_list if x not in refactored_vlan_list] | #             [refactored_vlan_list.append(x) for x in vlan_list if x not in refactored_vlan_list] | ||||||
|             vlan_list = refactored_vlan_list | #             vlan_list = refactored_vlan_list | ||||||
|             for i in range(len(vlan_list)): | #             for i in range(len(vlan_list)): | ||||||
|                 if vlan_list[i] > 4095 or vlan_list[i] < 1: | #                 if vlan_list[i] > 4095 or vlan_list[i] < 1: | ||||||
|                     vlan_list.pop(i) | #                     vlan_list.pop(i) | ||||||
|     if request.param["mode"] == "VLAN": | #     if request.param["mode"] == "VLAN": | ||||||
|         lf_tools.reset_scenario() | #         lf_tools.reset_scenario() | ||||||
|         lf_tools.add_vlan(vlan_ids=vlan_list) | #         lf_tools.add_vlan(vlan_ids=vlan_list) | ||||||
|  | # | ||||||
|     # call this, if 1.x | #     # call this, if 1.x | ||||||
|     print("fixture version ", fixtures_ver) | #     print("fixture version ", fixtures_ver) | ||||||
|     if cc_1: | #     if cc_1: | ||||||
|         return_var = fixtures_ver.setup_profiles(request, param, run_lf, instantiate_profile, get_configuration, get_markers, lf_tools) | #         return_var = fixtures_ver.setup_profiles(request, param, run_lf, instantiate_profile, get_configuration, get_markers, lf_tools) | ||||||
|     else: | #     else: | ||||||
|         return_var = fixtures_ver.setup_profiles(request, param, setup_controller, testbed, get_equipment_ref, | #         return_var = fixtures_ver.setup_profiles(request, param, setup_controller, testbed, get_equipment_ref, | ||||||
|                                              instantiate_profile, | #                                              instantiate_profile, | ||||||
|                                              get_markers, create_lanforge_chamberview_dut, lf_tools, | #                                              get_markers, create_lanforge_chamberview_dut, lf_tools, | ||||||
|                                              get_security_flags, get_configuration, radius_info, get_apnos, | #                                              get_security_flags, get_configuration, radius_info, get_apnos, | ||||||
|                                              radius_accounting_info, run_lf=run_lf) | #                                              radius_accounting_info, run_lf=run_lf) | ||||||
|  | # | ||||||
|     yield return_var | #     yield return_var | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def station_names_twog(request, get_configuration): | # def station_names_twog(request, get_configuration): | ||||||
|     station_names = [] | #     station_names = [] | ||||||
|     for i in range(0, int(request.config.getini("num_stations"))): | #     for i in range(0, int(request.config.getini("num_stations"))): | ||||||
|         station_names.append(get_configuration["traffic_generator"]["details"]["2.4G-Station-Name"] + "0" + str(i)) | #         station_names.append(get_configuration["traffic_generator"]["details"]["2.4G-Station-Name"] + "0" + str(i)) | ||||||
|     yield station_names | #     yield station_names | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def station_names_fiveg(request, get_configuration): | # def station_names_fiveg(request, get_configuration): | ||||||
|     station_names = [] | #     station_names = [] | ||||||
|     for i in range(0, int(request.config.getini("num_stations"))): | #     for i in range(0, int(request.config.getini("num_stations"))): | ||||||
|         station_names.append(get_configuration["traffic_generator"]["details"]["5G-Station-Name"] + "0" + str(i)) | #         station_names.append(get_configuration["traffic_generator"]["details"]["5G-Station-Name"] + "0" + str(i)) | ||||||
|     yield station_names | #     yield station_names | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def station_names_ax(request, get_configuration): | # def station_names_ax(request, get_configuration): | ||||||
|     station_names = [] | #     station_names = [] | ||||||
|     for i in range(0, int(request.config.getini("num_stations"))): | #     for i in range(0, int(request.config.getini("num_stations"))): | ||||||
|         station_names.append(get_configuration["traffic_generator"]["details"]["AX-Station-Name"] + "0" + str(i)) | #         station_names.append(get_configuration["traffic_generator"]["details"]["AX-Station-Name"] + "0" + str(i)) | ||||||
|     yield station_names | #     yield station_names | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def num_stations(request): | # def num_stations(request): | ||||||
|     num_sta = int(request.config.getini("num_stations")) | #     num_sta = int(request.config.getini("num_stations")) | ||||||
|     yield num_sta | #     yield num_sta | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="class") | # @pytest.fixture(scope="class") | ||||||
| def get_vif_state(get_apnos, get_configuration, request, lf_tools, run_lf): | # def get_vif_state(get_apnos, get_configuration, request, lf_tools, run_lf): | ||||||
|     if request.config.getoption("1.x"): | #     if request.config.getoption("1.x"): | ||||||
|         ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/", sdk="1.x") | #         ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/", sdk="1.x") | ||||||
|         vif_state = list(ap_ssh.get_vif_state_ssids()) | #         vif_state = list(ap_ssh.get_vif_state_ssids()) | ||||||
|         vif_state.sort() | #         vif_state.sort() | ||||||
|         yield vif_state | #         yield vif_state | ||||||
|     else: | #     else: | ||||||
|         yield lf_tools.ssid_list | #         yield lf_tools.ssid_list | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def dfs_start(fixtures_ver, get_apnos, get_configuration): | # def dfs_start(fixtures_ver, get_apnos, get_configuration): | ||||||
|     dfs_start = fixtures_ver.dfs(get_apnos, get_configuration) | #     dfs_start = fixtures_ver.dfs(get_apnos, get_configuration) | ||||||
|     yield dfs_start | #     yield dfs_start | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="class") | # @pytest.fixture(scope="class") | ||||||
| def get_vlan_list(get_apnos, get_configuration): | # def get_vlan_list(get_apnos, get_configuration): | ||||||
|     ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") | #     ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") | ||||||
|     vlan_list = list(ap_ssh.get_vlan()) | #     vlan_list = list(ap_ssh.get_vlan()) | ||||||
|     vlan_list.sort() | #     vlan_list.sort() | ||||||
|     yield vlan_list | #     yield vlan_list | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def reset_scenario_lf(request, lf_tools, run_lf): | # def reset_scenario_lf(request, lf_tools, run_lf): | ||||||
|     if not run_lf: | #     if not run_lf: | ||||||
|         lf_tools.reset_scenario() | #         lf_tools.reset_scenario() | ||||||
|         def teardown_session(): | #         def teardown_session(): | ||||||
|             lf_tools.reset_scenario() | #             lf_tools.reset_scenario() | ||||||
|  | # | ||||||
|         request.addfinalizer(teardown_session) | #         request.addfinalizer(teardown_session) | ||||||
|     yield "" | #     yield "" | ||||||
|  | # | ||||||
|   | |||||||
							
								
								
									
										1020
									
								
								tests/e2e/conftest.1
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1020
									
								
								tests/e2e/conftest.1
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,390 +1,390 @@ | |||||||
| import os | # import os | ||||||
| import sys | # import sys | ||||||
|  | # | ||||||
| sys.path.append( | # sys.path.append( | ||||||
|     os.path.dirname( | #     os.path.dirname( | ||||||
|         os.path.realpath(__file__) | #         os.path.realpath(__file__) | ||||||
|     ) | #     ) | ||||||
| ) | # ) | ||||||
| if "libs" not in sys.path: | # if "libs" not in sys.path: | ||||||
|     sys.path.append(f"../libs") | #     sys.path.append(f"../libs") | ||||||
|  | # | ||||||
| import time | # import time | ||||||
| import pytest | # import pytest | ||||||
| import allure | # import allure | ||||||
| from collections import defaultdict | # from collections import defaultdict | ||||||
| from lanforge.lf_tests import RunTest | # from lanforge.lf_tests import RunTest | ||||||
| from configuration import PASSPOINT_RADIUS_SERVER_DATA | # from configuration import PASSPOINT_RADIUS_SERVER_DATA | ||||||
| from configuration import PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA | # from configuration import PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA | ||||||
| from configuration import PASSPOINT_PROVIDER_INFO | # from configuration import PASSPOINT_PROVIDER_INFO | ||||||
| from configuration import PASSPOINT_OPERATOR_INFO | # from configuration import PASSPOINT_OPERATOR_INFO | ||||||
| from configuration import PASSPOINT_VENUE_INFO | # from configuration import PASSPOINT_VENUE_INFO | ||||||
| from configuration import PASSPOINT_PROFILE_INFO | # from configuration import PASSPOINT_PROFILE_INFO | ||||||
| from controller.controller_1x.controller import ProfileUtility | # from controller.controller_1x.controller import ProfileUtility | ||||||
|  | # | ||||||
|  | # | ||||||
| @allure.feature("PASSPOINT CONNECTIVITY SETUP") | # @allure.feature("PASSPOINT CONNECTIVITY SETUP") | ||||||
| @pytest.fixture(scope="class") | # @pytest.fixture(scope="class") | ||||||
| def setup_profiles(request, setup_controller, testbed, setup_vlan, get_equipment_ref, | # def setup_profiles(request, setup_controller, testbed, setup_vlan, get_equipment_ref, | ||||||
|                    instantiate_profile, get_markers, passpoint_provider_info, passpoint_operator_info, | #                    instantiate_profile, get_markers, passpoint_provider_info, passpoint_operator_info, | ||||||
|                    passpoint_venue_info, passpoint_profile_info, | #                    passpoint_venue_info, passpoint_profile_info, | ||||||
|                    get_configuration, passpoint_radius_server_info, passpoint_radius_accounting_server_info, get_apnos): | #                    get_configuration, passpoint_radius_server_info, passpoint_radius_accounting_server_info, get_apnos): | ||||||
|     instantiate_profile = instantiate_profile(sdk_client=setup_controller) | #     instantiate_profile = instantiate_profile(sdk_client=setup_controller) | ||||||
|     vlan_id, mode = 0, 0 | #     vlan_id, mode = 0, 0 | ||||||
|     instantiate_profile.cleanup_objects() | #     instantiate_profile.cleanup_objects() | ||||||
|     parameter = dict(request.param) | #     parameter = dict(request.param) | ||||||
|     test_cases = {} | #     test_cases = {} | ||||||
|     profile_data = {} | #     profile_data = {} | ||||||
|     if parameter["mode"] not in ["BRIDGE", "NAT", "VLAN"]: | #     if parameter["mode"] not in ["BRIDGE", "NAT", "VLAN"]: | ||||||
|         print("Invalid Mode: ", parameter["mode"]) | #         print("Invalid Mode: ", parameter["mode"]) | ||||||
|         yield test_cases | #         yield test_cases | ||||||
|  | # | ||||||
|     if parameter["mode"] == "NAT": | #     if parameter["mode"] == "NAT": | ||||||
|         mode = "NAT" | #         mode = "NAT" | ||||||
|         vlan_id = 1 | #         vlan_id = 1 | ||||||
|     if parameter["mode"] == "BRIDGE": | #     if parameter["mode"] == "BRIDGE": | ||||||
|         mode = "BRIDGE" | #         mode = "BRIDGE" | ||||||
|         vlan_id = 1 | #         vlan_id = 1 | ||||||
|     if parameter["mode"] == "VLAN": | #     if parameter["mode"] == "VLAN": | ||||||
|         mode = "BRIDGE" | #         mode = "BRIDGE" | ||||||
|         vlan_id = setup_vlan | #         vlan_id = setup_vlan | ||||||
|  | # | ||||||
|     ap_profile = testbed + "-Equipment-AP-Passpoint" | #     ap_profile = testbed + "-Equipment-AP-Passpoint" | ||||||
|     instantiate_profile.delete_profile_by_name(profile_name=ap_profile) | #     instantiate_profile.delete_profile_by_name(profile_name=ap_profile) | ||||||
|     profile_data["equipment_ap"] = {"profile_name": ap_profile} | #     profile_data["equipment_ap"] = {"profile_name": ap_profile} | ||||||
|  | # | ||||||
|     profile_data["ssid"] = {} | #     profile_data["ssid"] = {} | ||||||
|     # Only passpoint SSID need to be applied with passpoint profiles leaving ssid used for | #     # Only passpoint SSID need to be applied with passpoint profiles leaving ssid used for | ||||||
|     # profile download - passpoint_profile_download | #     # profile download - passpoint_profile_download | ||||||
|     profile_data["allowed_ssids"] = [] | #     profile_data["allowed_ssids"] = [] | ||||||
|     for i in parameter["ssid_modes"]: | #     for i in parameter["ssid_modes"]: | ||||||
|         profile_data["ssid"][i] = [] | #         profile_data["ssid"][i] = [] | ||||||
|         for j in range(len(parameter["ssid_modes"][i])): | #         for j in range(len(parameter["ssid_modes"][i])): | ||||||
|             profile_name = testbed + "-SSID-" + i + "-" + str(j) + "-" + parameter["mode"] | #             profile_name = testbed + "-SSID-" + i + "-" + str(j) + "-" + parameter["mode"] | ||||||
|             data = parameter["ssid_modes"][i][j] | #             data = parameter["ssid_modes"][i][j] | ||||||
|             data["profile_name"] = profile_name | #             data["profile_name"] = profile_name | ||||||
|             if "mode" not in dict(data).keys(): | #             if "mode" not in dict(data).keys(): | ||||||
|                 data["mode"] = mode | #                 data["mode"] = mode | ||||||
|             if "vlan" not in dict(data).keys(): | #             if "vlan" not in dict(data).keys(): | ||||||
|                 data["vlan"] = vlan_id | #                 data["vlan"] = vlan_id | ||||||
|             instantiate_profile.delete_profile_by_name(profile_name=profile_name) | #             instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||||
|             profile_data["ssid"][i].append(data) | #             profile_data["ssid"][i].append(data) | ||||||
|  | # | ||||||
|     instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile-" + mode) | #     instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile-" + mode) | ||||||
|     time.sleep(10) | #     time.sleep(10) | ||||||
|  | # | ||||||
|     # RF Profile Creation | #     # RF Profile Creation | ||||||
|     rf_profile_data = { | #     rf_profile_data = { | ||||||
|         "name": testbed + "-RF-Profile-" + parameter["mode"] + "-" + get_configuration["access_point"][0]["mode"] | #         "name": testbed + "-RF-Profile-" + parameter["mode"] + "-" + get_configuration["access_point"][0]["mode"] | ||||||
|     } | #     } | ||||||
|     try: | #     try: | ||||||
|         instantiate_profile.delete_profile_by_name(profile_name=rf_profile_data["name"]) | #         instantiate_profile.delete_profile_by_name(profile_name=rf_profile_data["name"]) | ||||||
|         rf_profile_data = instantiate_profile.set_rf_profile(profile_data=rf_profile_data, | #         rf_profile_data = instantiate_profile.set_rf_profile(profile_data=rf_profile_data, | ||||||
|                                                              mode=get_configuration["access_point"][0]["mode"]) | #                                                              mode=get_configuration["access_point"][0]["mode"]) | ||||||
|         allure.attach(body=str(rf_profile_data), | #         allure.attach(body=str(rf_profile_data), | ||||||
|                       name="RF Profile Created : " + get_configuration["access_point"][0]["mode"]) | #                       name="RF Profile Created : " + get_configuration["access_point"][0]["mode"]) | ||||||
|     except Exception as e: | #     except Exception as e: | ||||||
|         print(e) | #         print(e) | ||||||
|         allure.attach(body=str(e), name="Exception ") | #         allure.attach(body=str(e), name="Exception ") | ||||||
|  | # | ||||||
|     # Radius Profile Creation | #     # Radius Profile Creation | ||||||
|     passpoint_radius_server_info = passpoint_radius_server_info | #     passpoint_radius_server_info = passpoint_radius_server_info | ||||||
|     passpoint_radius_server_info["name"] = testbed + "-Automation-Radius-Profile" | #     passpoint_radius_server_info["name"] = testbed + "-Automation-Radius-Profile" | ||||||
|     instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile") | #     instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile") | ||||||
|     try: | #     try: | ||||||
|         instantiate_profile.create_radius_profile(radius_info=passpoint_radius_server_info, | #         instantiate_profile.create_radius_profile(radius_info=passpoint_radius_server_info, | ||||||
|                                                   radius_accounting_info=passpoint_radius_accounting_server_info) | #                                                   radius_accounting_info=passpoint_radius_accounting_server_info) | ||||||
|         test_cases["radius_profile"] = True | #         test_cases["radius_profile"] = True | ||||||
|         allure.attach(body=str(passpoint_radius_server_info), name="Radius Profile Created") | #         allure.attach(body=str(passpoint_radius_server_info), name="Radius Profile Created") | ||||||
|     except Exception as e: | #     except Exception as e: | ||||||
|         print(e) | #         print(e) | ||||||
|         test_cases["radius_profile"] = False | #         test_cases["radius_profile"] = False | ||||||
|  | # | ||||||
|     # SSID Profile Creation | #     # SSID Profile Creation | ||||||
|     for mode in profile_data["ssid"]: | #     for mode in profile_data["ssid"]: | ||||||
|         if mode == "open": | #         if mode == "open": | ||||||
|             for j in profile_data["ssid"][mode]: | #             for j in profile_data["ssid"][mode]: | ||||||
|                 try: | #                 try: | ||||||
|                     if "is2dot4GHz" in list(j["appliedRadios"]): | #                     if "is2dot4GHz" in list(j["appliedRadios"]): | ||||||
|                         creates_profile = instantiate_profile.create_open_ssid_profile(profile_data=j) | #                         creates_profile = instantiate_profile.create_open_ssid_profile(profile_data=j) | ||||||
|                         test_cases[j["ssid_name"]] = {"sdk": True} | #                         test_cases[j["ssid_name"]] = {"sdk": True} | ||||||
|                         allure.attach(body=str(creates_profile), name="SSID Profile Created") | #                         allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||||
|                 except Exception as e: | #                 except Exception as e: | ||||||
|                     print(e) | #                     print(e) | ||||||
|                     test_cases[j["ssid_name"]] = {"sdk": False} | #                     test_cases[j["ssid_name"]] = {"sdk": False} | ||||||
|                     allure.attach(body=str(e), name="SSID Profile Creation Failed") | #                     allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||||
|         if mode == "wpa_eap": | #         if mode == "wpa_eap": | ||||||
|             for j in profile_data["ssid"][mode]: | #             for j in profile_data["ssid"][mode]: | ||||||
|                 if mode in get_markers.keys() and get_markers[mode]: | #                 if mode in get_markers.keys() and get_markers[mode]: | ||||||
|                     try: | #                     try: | ||||||
|                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | #                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | ||||||
|                                 j["appliedRadios"]): | #                                 j["appliedRadios"]): | ||||||
|                             creates_profile = instantiate_profile.create_wpa_eap_passpoint_ssid_profile(profile_data=j) | #                             creates_profile = instantiate_profile.create_wpa_eap_passpoint_ssid_profile(profile_data=j) | ||||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||||
|                     except Exception as e: | #                     except Exception as e: | ||||||
|                         print(e) | #                         print(e) | ||||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||||
|                     try: | #                     try: | ||||||
|                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | #                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | ||||||
|                                 j["appliedRadios"]): | #                                 j["appliedRadios"]): | ||||||
|                             creates_profile = instantiate_profile.create_wpa_eap_passpoint_ssid_profile(profile_data=j) | #                             creates_profile = instantiate_profile.create_wpa_eap_passpoint_ssid_profile(profile_data=j) | ||||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||||
|                     except Exception as e: | #                     except Exception as e: | ||||||
|                         print(e) | #                         print(e) | ||||||
|                         test_cases[j["wpa_eap_5g"]] = {"sdk": False} | #                         test_cases[j["wpa_eap_5g"]] = {"sdk": False} | ||||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||||
|         if mode == "wpa2_eap": | #         if mode == "wpa2_eap": | ||||||
|             for j in profile_data["ssid"][mode]: | #             for j in profile_data["ssid"][mode]: | ||||||
|                 if mode in get_markers.keys() and get_markers[mode]: | #                 if mode in get_markers.keys() and get_markers[mode]: | ||||||
|                     try: | #                     try: | ||||||
|                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | #                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | ||||||
|                                 j["appliedRadios"]): | #                                 j["appliedRadios"]): | ||||||
|                             creates_profile = instantiate_profile.create_wpa2_eap_passpoint_ssid_profile(profile_data=j) | #                             creates_profile = instantiate_profile.create_wpa2_eap_passpoint_ssid_profile(profile_data=j) | ||||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||||
|                     except Exception as e: | #                     except Exception as e: | ||||||
|                         print(e) | #                         print(e) | ||||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||||
|                     try: | #                     try: | ||||||
|                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | #                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | ||||||
|                                 j["appliedRadios"]): | #                                 j["appliedRadios"]): | ||||||
|                             creates_profile = instantiate_profile.create_wpa2_eap_passpoint_ssid_profile(profile_data=j) | #                             creates_profile = instantiate_profile.create_wpa2_eap_passpoint_ssid_profile(profile_data=j) | ||||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||||
|                     except Exception as e: | #                     except Exception as e: | ||||||
|                         print(e) | #                         print(e) | ||||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||||
|         if mode == "wpa2_only_eap": | #         if mode == "wpa2_only_eap": | ||||||
|             for j in profile_data["ssid"][mode]: | #             for j in profile_data["ssid"][mode]: | ||||||
|                 if mode in get_markers.keys() and get_markers[mode]: | #                 if mode in get_markers.keys() and get_markers[mode]: | ||||||
|                     try: | #                     try: | ||||||
|                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | #                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | ||||||
|                                 j["appliedRadios"]): | #                                 j["appliedRadios"]): | ||||||
|                             creates_profile = instantiate_profile.create_wpa2_only_eap_passpoint_ssid_profile( | #                             creates_profile = instantiate_profile.create_wpa2_only_eap_passpoint_ssid_profile( | ||||||
|                                 profile_data=j) | #                                 profile_data=j) | ||||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||||
|                     except Exception as e: | #                     except Exception as e: | ||||||
|                         print(e) | #                         print(e) | ||||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||||
|                     try: | #                     try: | ||||||
|                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | #                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | ||||||
|                                 j["appliedRadios"]): | #                                 j["appliedRadios"]): | ||||||
|                             creates_profile = instantiate_profile.create_wpa2_only_eap_passpoint_ssid_profile( | #                             creates_profile = instantiate_profile.create_wpa2_only_eap_passpoint_ssid_profile( | ||||||
|                                 profile_data=j) | #                                 profile_data=j) | ||||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||||
|                     except Exception as e: | #                     except Exception as e: | ||||||
|                         print(e) | #                         print(e) | ||||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||||
|  | # | ||||||
|     # Passpoint OSU ID provider profile creation | #     # Passpoint OSU ID provider profile creation | ||||||
|     passpoint_provider_info = passpoint_provider_info | #     passpoint_provider_info = passpoint_provider_info | ||||||
|     test_cases["passpoint_osu_id_provider"] = dict() | #     test_cases["passpoint_osu_id_provider"] = dict() | ||||||
|     profile_name = testbed + "-Automation-Passpoint-OSU-ID-Provider-Profile" | #     profile_name = testbed + "-Automation-Passpoint-OSU-ID-Provider-Profile" | ||||||
|     passpoint_provider_info["profile_name"] = profile_name | #     passpoint_provider_info["profile_name"] = profile_name | ||||||
|     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | #     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||||
|     try: | #     try: | ||||||
|         creates_profile = instantiate_profile.create_passpoint_osu_id_provider_profile( | #         creates_profile = instantiate_profile.create_passpoint_osu_id_provider_profile( | ||||||
|             profile_data=passpoint_provider_info) | #             profile_data=passpoint_provider_info) | ||||||
|         allure.attach(body=str(creates_profile), name="Passpoint OSU ID provider Profile Created") | #         allure.attach(body=str(creates_profile), name="Passpoint OSU ID provider Profile Created") | ||||||
|         test_cases["passpoint_osu_id_provider"] = {"sdk": True} | #         test_cases["passpoint_osu_id_provider"] = {"sdk": True} | ||||||
|     except Exception as e: | #     except Exception as e: | ||||||
|         print(e) | #         print(e) | ||||||
|         test_cases["passpoint_osu_id_provider"] = {"sdk": False} | #         test_cases["passpoint_osu_id_provider"] = {"sdk": False} | ||||||
|         allure.attach(body=str(e), name="Passpoint OSU ID provider Profile Creation Failed") | #         allure.attach(body=str(e), name="Passpoint OSU ID provider Profile Creation Failed") | ||||||
|  | # | ||||||
|     # Passpoint operator profile creation | #     # Passpoint operator profile creation | ||||||
|     test_cases["passpoint_operator_profile"] = dict() | #     test_cases["passpoint_operator_profile"] = dict() | ||||||
|     passpoint_operator_info = passpoint_operator_info | #     passpoint_operator_info = passpoint_operator_info | ||||||
|     profile_name = testbed + "-Automation-Passpoint-Operator-Profile" | #     profile_name = testbed + "-Automation-Passpoint-Operator-Profile" | ||||||
|     passpoint_operator_info["profile_name"] = profile_name | #     passpoint_operator_info["profile_name"] = profile_name | ||||||
|     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | #     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||||
|     try: | #     try: | ||||||
|         creates_profile = instantiate_profile.create_passpoint_operator_profile(profile_data=passpoint_operator_info) | #         creates_profile = instantiate_profile.create_passpoint_operator_profile(profile_data=passpoint_operator_info) | ||||||
|         allure.attach(body=str(creates_profile), name="Passpoint Operator Profile Created") | #         allure.attach(body=str(creates_profile), name="Passpoint Operator Profile Created") | ||||||
|         test_cases["passpoint_operator_profile"] = {"sdk": True} | #         test_cases["passpoint_operator_profile"] = {"sdk": True} | ||||||
|         profile_data["passpoint_operator"] = profile_name | #         profile_data["passpoint_operator"] = profile_name | ||||||
|     except Exception as e: | #     except Exception as e: | ||||||
|         print(e) | #         print(e) | ||||||
|         test_cases["passpoint_operator_profile"] = {"sdk": False} | #         test_cases["passpoint_operator_profile"] = {"sdk": False} | ||||||
|         allure.attach(body=str(e), name="Passpoint Operator Profile Creation Failed") | #         allure.attach(body=str(e), name="Passpoint Operator Profile Creation Failed") | ||||||
|  | # | ||||||
|     # Passpoint Venue profile creation | #     # Passpoint Venue profile creation | ||||||
|     passpoint_venue_info = passpoint_venue_info | #     passpoint_venue_info = passpoint_venue_info | ||||||
|     test_cases["passpoint_venue_profile"] = dict() | #     test_cases["passpoint_venue_profile"] = dict() | ||||||
|     profile_name = testbed + "-Automation-Passpoint-Venue-Profile" | #     profile_name = testbed + "-Automation-Passpoint-Venue-Profile" | ||||||
|     passpoint_venue_info["profile_name"] = profile_name | #     passpoint_venue_info["profile_name"] = profile_name | ||||||
|     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | #     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||||
|     try: | #     try: | ||||||
|         creates_profile = instantiate_profile.create_passpoint_venue_profile(profile_data=passpoint_venue_info) | #         creates_profile = instantiate_profile.create_passpoint_venue_profile(profile_data=passpoint_venue_info) | ||||||
|         allure.attach(body=str(creates_profile), name="Passpoint Venue Profile Created") | #         allure.attach(body=str(creates_profile), name="Passpoint Venue Profile Created") | ||||||
|         test_cases["passpoint_venue_profile"] = {"sdk": True} | #         test_cases["passpoint_venue_profile"] = {"sdk": True} | ||||||
|         profile_data["passpoint_venue"] = profile_name | #         profile_data["passpoint_venue"] = profile_name | ||||||
|     except Exception as e: | #     except Exception as e: | ||||||
|         print(e) | #         print(e) | ||||||
|         test_cases["passpoint_venue"] = {"sdk": False} | #         test_cases["passpoint_venue"] = {"sdk": False} | ||||||
|         allure.attach(body=str(e), name="Passpoint Venue Profile Creation Failed") | #         allure.attach(body=str(e), name="Passpoint Venue Profile Creation Failed") | ||||||
|  | # | ||||||
|     # Passpoint profile creation | #     # Passpoint profile creation | ||||||
|     passpoint_profile_info = passpoint_profile_info | #     passpoint_profile_info = passpoint_profile_info | ||||||
|     profile_name = testbed + "-Automation-Passpoint-Profile" | #     profile_name = testbed + "-Automation-Passpoint-Profile" | ||||||
|     passpoint_profile_info["profile_name"] = profile_name | #     passpoint_profile_info["profile_name"] = profile_name | ||||||
|     passpoint_profile_info["allowed_ssids"] = profile_data["allowed_ssids"] | #     passpoint_profile_info["allowed_ssids"] = profile_data["allowed_ssids"] | ||||||
|     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | #     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||||
|     try: | #     try: | ||||||
|         creates_profile = instantiate_profile.create_passpoint_profile(profile_data=passpoint_profile_info) | #         creates_profile = instantiate_profile.create_passpoint_profile(profile_data=passpoint_profile_info) | ||||||
|         allure.attach(body=str(creates_profile), name="Passpoint Profile Created") | #         allure.attach(body=str(creates_profile), name="Passpoint Profile Created") | ||||||
|         test_cases["passpoint"] = {"sdk": True} | #         test_cases["passpoint"] = {"sdk": True} | ||||||
|         profile_data["passpoint"] = profile_name | #         profile_data["passpoint"] = profile_name | ||||||
|     except Exception as e: | #     except Exception as e: | ||||||
|         print(e) | #         print(e) | ||||||
|         test_cases["passpoint"] = {"sdk": False} | #         test_cases["passpoint"] = {"sdk": False} | ||||||
|         allure.attach(body=str(e), name="Passpoint Profile Creation Failed") | #         allure.attach(body=str(e), name="Passpoint Profile Creation Failed") | ||||||
|  | # | ||||||
|     # Update SSID profile with passpoint config | #     # Update SSID profile with passpoint config | ||||||
|     passpoint_profile_info = passpoint_profile_info | #     passpoint_profile_info = passpoint_profile_info | ||||||
|     ssid_to_apply = None | #     ssid_to_apply = None | ||||||
|     for ssid_profile in profile_data["ssid"].keys(): | #     for ssid_profile in profile_data["ssid"].keys(): | ||||||
|         for ssid in profile_data["ssid"][ssid_profile]: | #         for ssid in profile_data["ssid"][ssid_profile]: | ||||||
|             if ssid["ssid_name"] == "passpoint_profile_download": | #             if ssid["ssid_name"] == "passpoint_profile_download": | ||||||
|                 ssid_to_apply = ssid["ssid_name"] | #                 ssid_to_apply = ssid["ssid_name"] | ||||||
|                 continue | #                 continue | ||||||
|             if ssid["ssid_name"] in test_cases.keys(): | #             if ssid["ssid_name"] in test_cases.keys(): | ||||||
|                 allure.attach(body=str(ssid), name="Updating SSID profile") | #                 allure.attach(body=str(ssid), name="Updating SSID profile") | ||||||
|                 passpoint_profile_info["ssid_profile_name"] = ssid["profile_name"] | #                 passpoint_profile_info["ssid_profile_name"] = ssid["profile_name"] | ||||||
|                 instantiate_profile.update_ssid_profile(profile_info=passpoint_profile_info) | #                 instantiate_profile.update_ssid_profile(profile_info=passpoint_profile_info) | ||||||
|  | # | ||||||
|     # Equipment AP Profile Creation | #     # Equipment AP Profile Creation | ||||||
|     ap_profile_info = dict() | #     ap_profile_info = dict() | ||||||
|     ap_profile_info["profile_name"] = profile_data["equipment_ap"]["profile_name"] | #     ap_profile_info["profile_name"] = profile_data["equipment_ap"]["profile_name"] | ||||||
|     ap_profile_info["ssid_names"] = [ssid_to_apply] | #     ap_profile_info["ssid_names"] = [ssid_to_apply] | ||||||
|     try: | #     try: | ||||||
|         instantiate_profile.set_ap_profile_custom(profile_data=ap_profile_info) | #         instantiate_profile.set_ap_profile_custom(profile_data=ap_profile_info) | ||||||
|         test_cases["equipment_ap"] = {"sdk": True} | #         test_cases["equipment_ap"] = {"sdk": True} | ||||||
|         allure.attach(body=str(profile_data["equipment_ap"]), name="Equipment AP Profile Created") | #         allure.attach(body=str(profile_data["equipment_ap"]), name="Equipment AP Profile Created") | ||||||
|     except Exception as e: | #     except Exception as e: | ||||||
|         print(e) | #         print(e) | ||||||
|         test_cases["equipment_ap"] = {"sdk": False} | #         test_cases["equipment_ap"] = {"sdk": False} | ||||||
|         allure.attach(body=str(e), name="Equipment AP Profile Creation Failed") | #         allure.attach(body=str(e), name="Equipment AP Profile Creation Failed") | ||||||
|  | # | ||||||
|  | # | ||||||
|     def teardown_session(): | #     def teardown_session(): | ||||||
|         print("\nRemoving Profiles") | #         print("\nRemoving Profiles") | ||||||
|         instantiate_profile.delete_profile_by_name(profile_name=profile_data['equipment_ap']['profile_name']) | #         instantiate_profile.delete_profile_by_name(profile_name=profile_data['equipment_ap']['profile_name']) | ||||||
|         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["ssid"]) | #         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["ssid"]) | ||||||
|         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["radius"]) | #         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["radius"]) | ||||||
|         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["rf"]) | #         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["rf"]) | ||||||
|         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint_osu_id_provider"]) | #         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint_osu_id_provider"]) | ||||||
|         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint_operator"]) | #         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint_operator"]) | ||||||
|         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint_venue"]) | #         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint_venue"]) | ||||||
|         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint"]) | #         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint"]) | ||||||
|         allure.attach(body=str(profile_data['equipment_ap']['profile_name'] + "\n"), | #         allure.attach(body=str(profile_data['equipment_ap']['profile_name'] + "\n"), | ||||||
|                       name="Tear Down in Profiles ") | #                       name="Tear Down in Profiles ") | ||||||
|         time.sleep(20) | #         time.sleep(20) | ||||||
|  | # | ||||||
|     request.addfinalizer(teardown_session) | #     request.addfinalizer(teardown_session) | ||||||
|     yield test_cases, instantiate_profile, profile_data | #     yield test_cases, instantiate_profile, profile_data | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="function") | # @pytest.fixture(scope="function") | ||||||
| def push_ap_profile(request, setup_profiles, get_equipment_ref, get_apnos, get_configuration): | # def push_ap_profile(request, setup_profiles, get_equipment_ref, get_apnos, get_configuration): | ||||||
|     parameter = dict(request.param) | #     parameter = dict(request.param) | ||||||
|     test_cases, instantiate_profile, profile_data = setup_profiles | #     test_cases, instantiate_profile, profile_data = setup_profiles | ||||||
|     ssid_names = parameter["ssid_names"] | #     ssid_names = parameter["ssid_names"] | ||||||
|     ap_profile_info = dict() | #     ap_profile_info = dict() | ||||||
|     ap_profile_info["profile_name"] = profile_data["equipment_ap"]["profile_name"] | #     ap_profile_info["profile_name"] = profile_data["equipment_ap"]["profile_name"] | ||||||
|     test_cases = {} | #     test_cases = {} | ||||||
|     ap_profile_info["ssid_names"] = ssid_names | #     ap_profile_info["ssid_names"] = ssid_names | ||||||
|     try: | #     try: | ||||||
|         instantiate_profile.update_ap_profile(profile_data=ap_profile_info) | #         instantiate_profile.update_ap_profile(profile_data=ap_profile_info) | ||||||
|         test_cases["equipment_ap"] = {"sdk": True} | #         test_cases["equipment_ap"] = {"sdk": True} | ||||||
|         allure.attach(body=str(ap_profile_info["profile_name"]), name="Equipment AP Profile Updated") | #         allure.attach(body=str(ap_profile_info["profile_name"]), name="Equipment AP Profile Updated") | ||||||
|     except Exception as e: | #     except Exception as e: | ||||||
|         print(e) | #         print(e) | ||||||
|         test_cases["equipment_ap"] = {"sdk": False} | #         test_cases["equipment_ap"] = {"sdk": False} | ||||||
|         allure.attach(body=str(e), name="Equipment AP Profile Update Failed") | #         allure.attach(body=str(e), name="Equipment AP Profile Update Failed") | ||||||
|  | # | ||||||
|     print("Pushing profiles on AP  :: ", ap_profile_info) | #     print("Pushing profiles on AP  :: ", ap_profile_info) | ||||||
|     allure.attach(body=str(ap_profile_info), name="Pushing profiles on AP  :: ") | #     allure.attach(body=str(ap_profile_info), name="Pushing profiles on AP  :: ") | ||||||
|     # Push the Equipment AP Profile to AP | #     # Push the Equipment AP Profile to AP | ||||||
|     try: | #     try: | ||||||
|         for i in get_equipment_ref: | #         for i in get_equipment_ref: | ||||||
|             instantiate_profile.push_profile_old_method(equipment_id=i) | #             instantiate_profile.push_profile_old_method(equipment_id=i) | ||||||
|     except Exception as e: | #     except Exception as e: | ||||||
|         print(e) | #         print(e) | ||||||
|         print("failed to push AP Profile") | #         print("failed to push AP Profile") | ||||||
|  | # | ||||||
|     # Check the VIF Config and VIF State of SSIDs | #     # Check the VIF Config and VIF State of SSIDs | ||||||
|     time_start = time.time() | #     time_start = time.time() | ||||||
|     ap_ssh = get_apnos(get_configuration["access_point"][0], pwd="../libs/apnos/") | #     ap_ssh = get_apnos(get_configuration["access_point"][0], pwd="../libs/apnos/") | ||||||
|     while time.time() - time_start < 240: | #     while time.time() - time_start < 240: | ||||||
|         if ((time.time() - time_start) / 10) == 15: | #         if ((time.time() - time_start) / 10) == 15: | ||||||
|             ap_ssh = get_apnos(get_configuration["access_point"][0], pwd="../libs/apnos/") | #             ap_ssh = get_apnos(get_configuration["access_point"][0], pwd="../libs/apnos/") | ||||||
|         vif_config = list(ap_ssh.get_vif_config_ssids()) | #         vif_config = list(ap_ssh.get_vif_config_ssids()) | ||||||
|         vif_config.sort() | #         vif_config.sort() | ||||||
|         vif_state = list(ap_ssh.get_vif_state_ssids()) | #         vif_state = list(ap_ssh.get_vif_state_ssids()) | ||||||
|         vif_state.sort() | #         vif_state.sort() | ||||||
|         for ssid in ssid_names: | #         for ssid in ssid_names: | ||||||
|             test_cases[ssid] = dict() | #             test_cases[ssid] = dict() | ||||||
|             test_cases[ssid]["vif_config"] = True if ssid in vif_config else False | #             test_cases[ssid]["vif_config"] = True if ssid in vif_config else False | ||||||
|             test_cases[ssid]["vif_state"] = True if ssid in vif_state else False | #             test_cases[ssid]["vif_state"] = True if ssid in vif_state else False | ||||||
|         ssid_names.sort() | #         ssid_names.sort() | ||||||
|         if vif_config == ssid_names == vif_state: | #         if vif_config == ssid_names == vif_state: | ||||||
|             print("Waiting for Radios to apply config ") | #             print("Waiting for Radios to apply config ") | ||||||
|             time.sleep(200) | #             time.sleep(200) | ||||||
|             break | #             break | ||||||
|         time.sleep(10) | #         time.sleep(10) | ||||||
|     allure.attach(body=str(vif_config), name="vifC status on AP :: ") | #     allure.attach(body=str(vif_config), name="vifC status on AP :: ") | ||||||
|     allure.attach(body=str(vif_state), name="vifS status on AP :: ") | #     allure.attach(body=str(vif_state), name="vifS status on AP :: ") | ||||||
|  | # | ||||||
|     yield test_cases | #     yield test_cases | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def passpoint_radius_server_info(): | # def passpoint_radius_server_info(): | ||||||
|     allure.attach(body=str(PASSPOINT_RADIUS_SERVER_DATA), name="Passpoint RADIUS server Info: ") | #     allure.attach(body=str(PASSPOINT_RADIUS_SERVER_DATA), name="Passpoint RADIUS server Info: ") | ||||||
|     yield PASSPOINT_RADIUS_SERVER_DATA | #     yield PASSPOINT_RADIUS_SERVER_DATA | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def passpoint_radius_accounting_server_info(): | # def passpoint_radius_accounting_server_info(): | ||||||
|     allure.attach(body=str(PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA), name="Passpoint RADIUS account server Info: ") | #     allure.attach(body=str(PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA), name="Passpoint RADIUS account server Info: ") | ||||||
|     yield PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA | #     yield PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def passpoint_provider_info(): | # def passpoint_provider_info(): | ||||||
|     allure.attach(body=str(PASSPOINT_PROVIDER_INFO), name="Passpoint Provider Info: ") | #     allure.attach(body=str(PASSPOINT_PROVIDER_INFO), name="Passpoint Provider Info: ") | ||||||
|     yield PASSPOINT_PROVIDER_INFO | #     yield PASSPOINT_PROVIDER_INFO | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def passpoint_operator_info(): | # def passpoint_operator_info(): | ||||||
|     allure.attach(body=str(PASSPOINT_OPERATOR_INFO), name="Passpoint operator Info: ") | #     allure.attach(body=str(PASSPOINT_OPERATOR_INFO), name="Passpoint operator Info: ") | ||||||
|     yield PASSPOINT_OPERATOR_INFO | #     yield PASSPOINT_OPERATOR_INFO | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def passpoint_venue_info(): | # def passpoint_venue_info(): | ||||||
|     allure.attach(body=str(PASSPOINT_VENUE_INFO), name="Passpoint venue Info: ") | #     allure.attach(body=str(PASSPOINT_VENUE_INFO), name="Passpoint venue Info: ") | ||||||
|     yield PASSPOINT_VENUE_INFO | #     yield PASSPOINT_VENUE_INFO | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def passpoint_profile_info(): | # def passpoint_profile_info(): | ||||||
|     allure.attach(body=str(PASSPOINT_PROFILE_INFO), name="Passpoint profile Info: ") | #     allure.attach(body=str(PASSPOINT_PROFILE_INFO), name="Passpoint profile Info: ") | ||||||
|     yield PASSPOINT_PROFILE_INFO | #     yield PASSPOINT_PROFILE_INFO | ||||||
|   | |||||||
| @@ -1,391 +1,391 @@ | |||||||
| import os | # import os | ||||||
| import sys | # import sys | ||||||
|  | # | ||||||
| sys.path.append( | # sys.path.append( | ||||||
|     os.path.dirname( | #     os.path.dirname( | ||||||
|         os.path.realpath(__file__) | #         os.path.realpath(__file__) | ||||||
|     ) | #     ) | ||||||
| ) | # ) | ||||||
| if "libs" not in sys.path: | # if "libs" not in sys.path: | ||||||
|     sys.path.append(f"../libs") | #     sys.path.append(f"../libs") | ||||||
|  | # | ||||||
| import time | # import time | ||||||
| import pytest | # import pytest | ||||||
| import allure | # import allure | ||||||
| from collections import defaultdict | # from collections import defaultdict | ||||||
| from lanforge.lf_tests import RunTest | # from lanforge.lf_tests import RunTest | ||||||
| from configuration import PASSPOINT_RADIUS_SERVER_DATA | # from configuration import PASSPOINT_RADIUS_SERVER_DATA | ||||||
| from configuration import PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA | # from configuration import PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA | ||||||
| from configuration import PASSPOINT_PROVIDER_INFO | # from configuration import PASSPOINT_PROVIDER_INFO | ||||||
| from configuration import PASSPOINT_OPERATOR_INFO | # from configuration import PASSPOINT_OPERATOR_INFO | ||||||
| from configuration import PASSPOINT_VENUE_INFO | # from configuration import PASSPOINT_VENUE_INFO | ||||||
| from configuration import PASSPOINT_PROFILE_INFO | # from configuration import PASSPOINT_PROFILE_INFO | ||||||
| from controller.controller_1x.controller import ProfileUtility | # from controller.controller_1x.controller import ProfileUtility | ||||||
|  | # | ||||||
|  | # | ||||||
| @allure.feature("PASSPOINT CONNECTIVITY SETUP") | # @allure.feature("PASSPOINT CONNECTIVITY SETUP") | ||||||
| @pytest.fixture(scope="class") | # @pytest.fixture(scope="class") | ||||||
| def setup_profiles(request, setup_controller, testbed, setup_vlan, get_equipment_ref, | # def setup_profiles(request, setup_controller, testbed, setup_vlan, get_equipment_ref, | ||||||
|                    instantiate_profile, get_markers, passpoint_provider_info, passpoint_operator_info, | #                    instantiate_profile, get_markers, passpoint_provider_info, passpoint_operator_info, | ||||||
|                    passpoint_venue_info, passpoint_profile_info, | #                    passpoint_venue_info, passpoint_profile_info, | ||||||
|                    get_configuration, passpoint_radius_server_info, passpoint_radius_accounting_server_info, get_apnos): | #                    get_configuration, passpoint_radius_server_info, passpoint_radius_accounting_server_info, get_apnos): | ||||||
|     instantiate_profile = instantiate_profile(sdk_client=setup_controller) | #     instantiate_profile = instantiate_profile(sdk_client=setup_controller) | ||||||
|     vlan_id, mode = 0, 0 | #     vlan_id, mode = 0, 0 | ||||||
|     instantiate_profile.cleanup_objects() | #     instantiate_profile.cleanup_objects() | ||||||
|     parameter = dict(request.param) | #     parameter = dict(request.param) | ||||||
|     test_cases = {} | #     test_cases = {} | ||||||
|     profile_data = {} | #     profile_data = {} | ||||||
|     if parameter["mode"] not in ["BRIDGE", "NAT", "VLAN"]: | #     if parameter["mode"] not in ["BRIDGE", "NAT", "VLAN"]: | ||||||
|         print("Invalid Mode: ", parameter["mode"]) | #         print("Invalid Mode: ", parameter["mode"]) | ||||||
|         allure.attach(body=parameter["mode"], name="Invalid Mode: ") | #         allure.attach(body=parameter["mode"], name="Invalid Mode: ") | ||||||
|         yield test_cases | #         yield test_cases | ||||||
|  | # | ||||||
|     if parameter["mode"] == "NAT": | #     if parameter["mode"] == "NAT": | ||||||
|         mode = "NAT" | #         mode = "NAT" | ||||||
|         vlan_id = 1 | #         vlan_id = 1 | ||||||
|     if parameter["mode"] == "BRIDGE": | #     if parameter["mode"] == "BRIDGE": | ||||||
|         mode = "BRIDGE" | #         mode = "BRIDGE" | ||||||
|         vlan_id = 1 | #         vlan_id = 1 | ||||||
|     if parameter["mode"] == "VLAN": | #     if parameter["mode"] == "VLAN": | ||||||
|         mode = "BRIDGE" | #         mode = "BRIDGE" | ||||||
|         vlan_id = setup_vlan | #         vlan_id = setup_vlan | ||||||
|  | # | ||||||
|     ap_profile = testbed + "-Equipment-AP-Passpoint" | #     ap_profile = testbed + "-Equipment-AP-Passpoint" | ||||||
|     instantiate_profile.delete_profile_by_name(profile_name=ap_profile) | #     instantiate_profile.delete_profile_by_name(profile_name=ap_profile) | ||||||
|     profile_data["equipment_ap"] = {"profile_name": ap_profile} | #     profile_data["equipment_ap"] = {"profile_name": ap_profile} | ||||||
|  | # | ||||||
|     profile_data["ssid"] = {} | #     profile_data["ssid"] = {} | ||||||
|     # Only passpoint SSID need to be applied with passpoint profiles leaving ssid used for | #     # Only passpoint SSID need to be applied with passpoint profiles leaving ssid used for | ||||||
|     # profile download - passpoint_profile_download | #     # profile download - passpoint_profile_download | ||||||
|     profile_data["allowed_ssids"] = [] | #     profile_data["allowed_ssids"] = [] | ||||||
|     for i in parameter["ssid_modes"]: | #     for i in parameter["ssid_modes"]: | ||||||
|         profile_data["ssid"][i] = [] | #         profile_data["ssid"][i] = [] | ||||||
|         for j in range(len(parameter["ssid_modes"][i])): | #         for j in range(len(parameter["ssid_modes"][i])): | ||||||
|             profile_name = testbed + "-SSID-" + i + "-" + str(j) + "-" + parameter["mode"] | #             profile_name = testbed + "-SSID-" + i + "-" + str(j) + "-" + parameter["mode"] | ||||||
|             data = parameter["ssid_modes"][i][j] | #             data = parameter["ssid_modes"][i][j] | ||||||
|             data["profile_name"] = profile_name | #             data["profile_name"] = profile_name | ||||||
|             if "mode" not in dict(data).keys(): | #             if "mode" not in dict(data).keys(): | ||||||
|                 data["mode"] = mode | #                 data["mode"] = mode | ||||||
|             if "vlan" not in dict(data).keys(): | #             if "vlan" not in dict(data).keys(): | ||||||
|                 data["vlan"] = vlan_id | #                 data["vlan"] = vlan_id | ||||||
|             instantiate_profile.delete_profile_by_name(profile_name=profile_name) | #             instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||||
|             profile_data["ssid"][i].append(data) | #             profile_data["ssid"][i].append(data) | ||||||
|  | # | ||||||
|     instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile-" + mode) | #     instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile-" + mode) | ||||||
|     time.sleep(10) | #     time.sleep(10) | ||||||
|  | # | ||||||
|     # RF Profile Creation | #     # RF Profile Creation | ||||||
|     rf_profile_data = { | #     rf_profile_data = { | ||||||
|         "name": testbed + "-RF-Profile-" + parameter["mode"] + "-" + get_configuration["access_point"][0]["mode"] | #         "name": testbed + "-RF-Profile-" + parameter["mode"] + "-" + get_configuration["access_point"][0]["mode"] | ||||||
|     } | #     } | ||||||
|     try: | #     try: | ||||||
|         instantiate_profile.delete_profile_by_name(profile_name=rf_profile_data["name"]) | #         instantiate_profile.delete_profile_by_name(profile_name=rf_profile_data["name"]) | ||||||
|         rf_profile_data = instantiate_profile.set_rf_profile(profile_data=rf_profile_data, | #         rf_profile_data = instantiate_profile.set_rf_profile(profile_data=rf_profile_data, | ||||||
|                                                              mode=get_configuration["access_point"][0]["mode"]) | #                                                              mode=get_configuration["access_point"][0]["mode"]) | ||||||
|         allure.attach(body=str(rf_profile_data), | #         allure.attach(body=str(rf_profile_data), | ||||||
|                       name="RF Profile Created : " + get_configuration["access_point"][0]["mode"]) | #                       name="RF Profile Created : " + get_configuration["access_point"][0]["mode"]) | ||||||
|     except Exception as e: | #     except Exception as e: | ||||||
|         print(e) | #         print(e) | ||||||
|         allure.attach(body=str(e), name="Exception ") | #         allure.attach(body=str(e), name="Exception ") | ||||||
|  | # | ||||||
|     # Radius Profile Creation | #     # Radius Profile Creation | ||||||
|     passpoint_radius_server_info = passpoint_radius_server_info | #     passpoint_radius_server_info = passpoint_radius_server_info | ||||||
|     passpoint_radius_server_info["name"] = testbed + "-Automation-Radius-Profile" | #     passpoint_radius_server_info["name"] = testbed + "-Automation-Radius-Profile" | ||||||
|     instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile") | #     instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile") | ||||||
|     try: | #     try: | ||||||
|         instantiate_profile.create_radius_profile(radius_info=passpoint_radius_server_info, | #         instantiate_profile.create_radius_profile(radius_info=passpoint_radius_server_info, | ||||||
|                                                   radius_accounting_info=passpoint_radius_accounting_server_info) | #                                                   radius_accounting_info=passpoint_radius_accounting_server_info) | ||||||
|         test_cases["radius_profile"] = True | #         test_cases["radius_profile"] = True | ||||||
|         allure.attach(body=str(passpoint_radius_server_info), name="Radius Profile Created") | #         allure.attach(body=str(passpoint_radius_server_info), name="Radius Profile Created") | ||||||
|     except Exception as e: | #     except Exception as e: | ||||||
|         print(e) | #         print(e) | ||||||
|         test_cases["radius_profile"] = False | #         test_cases["radius_profile"] = False | ||||||
|  | # | ||||||
|     # SSID Profile Creation | #     # SSID Profile Creation | ||||||
|     for mode in profile_data["ssid"]: | #     for mode in profile_data["ssid"]: | ||||||
|         if mode == "open": | #         if mode == "open": | ||||||
|             for j in profile_data["ssid"][mode]: | #             for j in profile_data["ssid"][mode]: | ||||||
|                 try: | #                 try: | ||||||
|                     if "is2dot4GHz" in list(j["appliedRadios"]): | #                     if "is2dot4GHz" in list(j["appliedRadios"]): | ||||||
|                         creates_profile = instantiate_profile.create_open_ssid_profile(profile_data=j) | #                         creates_profile = instantiate_profile.create_open_ssid_profile(profile_data=j) | ||||||
|                         test_cases[j["ssid_name"]] = {"sdk": True} | #                         test_cases[j["ssid_name"]] = {"sdk": True} | ||||||
|                         allure.attach(body=str(creates_profile), name="SSID Profile Created") | #                         allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||||
|                 except Exception as e: | #                 except Exception as e: | ||||||
|                     print(e) | #                     print(e) | ||||||
|                     test_cases[j["ssid_name"]] = {"sdk": False} | #                     test_cases[j["ssid_name"]] = {"sdk": False} | ||||||
|                     allure.attach(body=str(e), name="SSID Profile Creation Failed") | #                     allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||||
|         if mode == "wpa_eap": | #         if mode == "wpa_eap": | ||||||
|             for j in profile_data["ssid"][mode]: | #             for j in profile_data["ssid"][mode]: | ||||||
|                 if mode in get_markers.keys() and get_markers[mode]: | #                 if mode in get_markers.keys() and get_markers[mode]: | ||||||
|                     try: | #                     try: | ||||||
|                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | #                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | ||||||
|                                 j["appliedRadios"]): | #                                 j["appliedRadios"]): | ||||||
|                             creates_profile = instantiate_profile.create_wpa_eap_passpoint_ssid_profile(profile_data=j) | #                             creates_profile = instantiate_profile.create_wpa_eap_passpoint_ssid_profile(profile_data=j) | ||||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||||
|                     except Exception as e: | #                     except Exception as e: | ||||||
|                         print(e) | #                         print(e) | ||||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||||
|                     try: | #                     try: | ||||||
|                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | #                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | ||||||
|                                 j["appliedRadios"]): | #                                 j["appliedRadios"]): | ||||||
|                             creates_profile = instantiate_profile.create_wpa_eap_passpoint_ssid_profile(profile_data=j) | #                             creates_profile = instantiate_profile.create_wpa_eap_passpoint_ssid_profile(profile_data=j) | ||||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||||
|                     except Exception as e: | #                     except Exception as e: | ||||||
|                         print(e) | #                         print(e) | ||||||
|                         test_cases[j["wpa_eap_5g"]] = {"sdk": False} | #                         test_cases[j["wpa_eap_5g"]] = {"sdk": False} | ||||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||||
|         if mode == "wpa2_eap": | #         if mode == "wpa2_eap": | ||||||
|             for j in profile_data["ssid"][mode]: | #             for j in profile_data["ssid"][mode]: | ||||||
|                 if mode in get_markers.keys() and get_markers[mode]: | #                 if mode in get_markers.keys() and get_markers[mode]: | ||||||
|                     try: | #                     try: | ||||||
|                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | #                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | ||||||
|                                 j["appliedRadios"]): | #                                 j["appliedRadios"]): | ||||||
|                             creates_profile = instantiate_profile.create_wpa2_eap_passpoint_ssid_profile(profile_data=j) | #                             creates_profile = instantiate_profile.create_wpa2_eap_passpoint_ssid_profile(profile_data=j) | ||||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||||
|                     except Exception as e: | #                     except Exception as e: | ||||||
|                         print(e) | #                         print(e) | ||||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||||
|                     try: | #                     try: | ||||||
|                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | #                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | ||||||
|                                 j["appliedRadios"]): | #                                 j["appliedRadios"]): | ||||||
|                             creates_profile = instantiate_profile.create_wpa2_eap_passpoint_ssid_profile(profile_data=j) | #                             creates_profile = instantiate_profile.create_wpa2_eap_passpoint_ssid_profile(profile_data=j) | ||||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||||
|                     except Exception as e: | #                     except Exception as e: | ||||||
|                         print(e) | #                         print(e) | ||||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||||
|         if mode == "wpa2_only_eap": | #         if mode == "wpa2_only_eap": | ||||||
|             for j in profile_data["ssid"][mode]: | #             for j in profile_data["ssid"][mode]: | ||||||
|                 if mode in get_markers.keys() and get_markers[mode]: | #                 if mode in get_markers.keys() and get_markers[mode]: | ||||||
|                     try: | #                     try: | ||||||
|                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | #                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | ||||||
|                                 j["appliedRadios"]): | #                                 j["appliedRadios"]): | ||||||
|                             creates_profile = instantiate_profile.create_wpa2_only_eap_passpoint_ssid_profile( | #                             creates_profile = instantiate_profile.create_wpa2_only_eap_passpoint_ssid_profile( | ||||||
|                                 profile_data=j) | #                                 profile_data=j) | ||||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||||
|                     except Exception as e: | #                     except Exception as e: | ||||||
|                         print(e) | #                         print(e) | ||||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||||
|                     try: | #                     try: | ||||||
|                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | #                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | ||||||
|                                 j["appliedRadios"]): | #                                 j["appliedRadios"]): | ||||||
|                             creates_profile = instantiate_profile.create_wpa2_only_eap_passpoint_ssid_profile( | #                             creates_profile = instantiate_profile.create_wpa2_only_eap_passpoint_ssid_profile( | ||||||
|                                 profile_data=j) | #                                 profile_data=j) | ||||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||||
|                     except Exception as e: | #                     except Exception as e: | ||||||
|                         print(e) | #                         print(e) | ||||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||||
|  | # | ||||||
|     # Passpoint OSU ID provider profile creation | #     # Passpoint OSU ID provider profile creation | ||||||
|     passpoint_provider_info = passpoint_provider_info | #     passpoint_provider_info = passpoint_provider_info | ||||||
|     test_cases["passpoint_osu_id_provider"] = dict() | #     test_cases["passpoint_osu_id_provider"] = dict() | ||||||
|     profile_name = testbed + "-Automation-Passpoint-OSU-ID-Provider-Profile" | #     profile_name = testbed + "-Automation-Passpoint-OSU-ID-Provider-Profile" | ||||||
|     passpoint_provider_info["profile_name"] = profile_name | #     passpoint_provider_info["profile_name"] = profile_name | ||||||
|     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | #     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||||
|     try: | #     try: | ||||||
|         creates_profile = instantiate_profile.create_passpoint_osu_id_provider_profile( | #         creates_profile = instantiate_profile.create_passpoint_osu_id_provider_profile( | ||||||
|             profile_data=passpoint_provider_info) | #             profile_data=passpoint_provider_info) | ||||||
|         allure.attach(body=str(creates_profile), name="Passpoint OSU ID provider Profile Created") | #         allure.attach(body=str(creates_profile), name="Passpoint OSU ID provider Profile Created") | ||||||
|         test_cases["passpoint_osu_id_provider"] = {"sdk": True} | #         test_cases["passpoint_osu_id_provider"] = {"sdk": True} | ||||||
|     except Exception as e: | #     except Exception as e: | ||||||
|         print(e) | #         print(e) | ||||||
|         test_cases["passpoint_osu_id_provider"] = {"sdk": False} | #         test_cases["passpoint_osu_id_provider"] = {"sdk": False} | ||||||
|         allure.attach(body=str(e), name="Passpoint OSU ID provider Profile Creation Failed") | #         allure.attach(body=str(e), name="Passpoint OSU ID provider Profile Creation Failed") | ||||||
|  | # | ||||||
|     # Passpoint operator profile creation | #     # Passpoint operator profile creation | ||||||
|     test_cases["passpoint_operator_profile"] = dict() | #     test_cases["passpoint_operator_profile"] = dict() | ||||||
|     passpoint_operator_info = passpoint_operator_info | #     passpoint_operator_info = passpoint_operator_info | ||||||
|     profile_name = testbed + "-Automation-Passpoint-Operator-Profile" | #     profile_name = testbed + "-Automation-Passpoint-Operator-Profile" | ||||||
|     passpoint_operator_info["profile_name"] = profile_name | #     passpoint_operator_info["profile_name"] = profile_name | ||||||
|     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | #     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||||
|     try: | #     try: | ||||||
|         creates_profile = instantiate_profile.create_passpoint_operator_profile(profile_data=passpoint_operator_info) | #         creates_profile = instantiate_profile.create_passpoint_operator_profile(profile_data=passpoint_operator_info) | ||||||
|         allure.attach(body=str(creates_profile), name="Passpoint Operator Profile Created") | #         allure.attach(body=str(creates_profile), name="Passpoint Operator Profile Created") | ||||||
|         test_cases["passpoint_operator_profile"] = {"sdk": True} | #         test_cases["passpoint_operator_profile"] = {"sdk": True} | ||||||
|         profile_data["passpoint_operator"] = profile_name | #         profile_data["passpoint_operator"] = profile_name | ||||||
|     except Exception as e: | #     except Exception as e: | ||||||
|         print(e) | #         print(e) | ||||||
|         test_cases["passpoint_operator_profile"] = {"sdk": False} | #         test_cases["passpoint_operator_profile"] = {"sdk": False} | ||||||
|         allure.attach(body=str(e), name="Passpoint Operator Profile Creation Failed") | #         allure.attach(body=str(e), name="Passpoint Operator Profile Creation Failed") | ||||||
|  | # | ||||||
|     # Passpoint Venue profile creation | #     # Passpoint Venue profile creation | ||||||
|     passpoint_venue_info = passpoint_venue_info | #     passpoint_venue_info = passpoint_venue_info | ||||||
|     test_cases["passpoint_venue_profile"] = dict() | #     test_cases["passpoint_venue_profile"] = dict() | ||||||
|     profile_name = testbed + "-Automation-Passpoint-Venue-Profile" | #     profile_name = testbed + "-Automation-Passpoint-Venue-Profile" | ||||||
|     passpoint_venue_info["profile_name"] = profile_name | #     passpoint_venue_info["profile_name"] = profile_name | ||||||
|     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | #     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||||
|     try: | #     try: | ||||||
|         creates_profile = instantiate_profile.create_passpoint_venue_profile(profile_data=passpoint_venue_info) | #         creates_profile = instantiate_profile.create_passpoint_venue_profile(profile_data=passpoint_venue_info) | ||||||
|         allure.attach(body=str(creates_profile), name="Passpoint Venue Profile Created") | #         allure.attach(body=str(creates_profile), name="Passpoint Venue Profile Created") | ||||||
|         test_cases["passpoint_venue_profile"] = {"sdk": True} | #         test_cases["passpoint_venue_profile"] = {"sdk": True} | ||||||
|         profile_data["passpoint_venue"] = profile_name | #         profile_data["passpoint_venue"] = profile_name | ||||||
|     except Exception as e: | #     except Exception as e: | ||||||
|         print(e) | #         print(e) | ||||||
|         test_cases["passpoint_venue"] = {"sdk": False} | #         test_cases["passpoint_venue"] = {"sdk": False} | ||||||
|         allure.attach(body=str(e), name="Passpoint Venue Profile Creation Failed") | #         allure.attach(body=str(e), name="Passpoint Venue Profile Creation Failed") | ||||||
|  | # | ||||||
|     # Passpoint profile creation | #     # Passpoint profile creation | ||||||
|     passpoint_profile_info = passpoint_profile_info | #     passpoint_profile_info = passpoint_profile_info | ||||||
|     profile_name = testbed + "-Automation-Passpoint-Profile" | #     profile_name = testbed + "-Automation-Passpoint-Profile" | ||||||
|     passpoint_profile_info["profile_name"] = profile_name | #     passpoint_profile_info["profile_name"] = profile_name | ||||||
|     passpoint_profile_info["allowed_ssids"] = profile_data["allowed_ssids"] | #     passpoint_profile_info["allowed_ssids"] = profile_data["allowed_ssids"] | ||||||
|     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | #     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||||
|     try: | #     try: | ||||||
|         creates_profile = instantiate_profile.create_passpoint_profile(profile_data=passpoint_profile_info) | #         creates_profile = instantiate_profile.create_passpoint_profile(profile_data=passpoint_profile_info) | ||||||
|         allure.attach(body=str(creates_profile), name="Passpoint Profile Created") | #         allure.attach(body=str(creates_profile), name="Passpoint Profile Created") | ||||||
|         test_cases["passpoint"] = {"sdk": True} | #         test_cases["passpoint"] = {"sdk": True} | ||||||
|         profile_data["passpoint"] = profile_name | #         profile_data["passpoint"] = profile_name | ||||||
|     except Exception as e: | #     except Exception as e: | ||||||
|         print(e) | #         print(e) | ||||||
|         test_cases["passpoint"] = {"sdk": False} | #         test_cases["passpoint"] = {"sdk": False} | ||||||
|         allure.attach(body=str(e), name="Passpoint Profile Creation Failed") | #         allure.attach(body=str(e), name="Passpoint Profile Creation Failed") | ||||||
|  | # | ||||||
|     # Update SSID profile with passpoint config | #     # Update SSID profile with passpoint config | ||||||
|     passpoint_profile_info = passpoint_profile_info | #     passpoint_profile_info = passpoint_profile_info | ||||||
|     ssid_to_apply = None | #     ssid_to_apply = None | ||||||
|     for ssid_profile in profile_data["ssid"].keys(): | #     for ssid_profile in profile_data["ssid"].keys(): | ||||||
|         for ssid in profile_data["ssid"][ssid_profile]: | #         for ssid in profile_data["ssid"][ssid_profile]: | ||||||
|             if ssid["ssid_name"] == "passpoint_profile_download": | #             if ssid["ssid_name"] == "passpoint_profile_download": | ||||||
|                 ssid_to_apply = ssid["ssid_name"] | #                 ssid_to_apply = ssid["ssid_name"] | ||||||
|                 continue | #                 continue | ||||||
|             if ssid["ssid_name"] in test_cases.keys(): | #             if ssid["ssid_name"] in test_cases.keys(): | ||||||
|                 allure.attach(body=str(ssid), name="Updating SSID profile") | #                 allure.attach(body=str(ssid), name="Updating SSID profile") | ||||||
|                 passpoint_profile_info["ssid_profile_name"] = ssid["profile_name"] | #                 passpoint_profile_info["ssid_profile_name"] = ssid["profile_name"] | ||||||
|                 instantiate_profile.update_ssid_profile(profile_info=passpoint_profile_info) | #                 instantiate_profile.update_ssid_profile(profile_info=passpoint_profile_info) | ||||||
|  | # | ||||||
|     # Equipment AP Profile Creation | #     # Equipment AP Profile Creation | ||||||
|     ap_profile_info = dict() | #     ap_profile_info = dict() | ||||||
|     ap_profile_info["profile_name"] = profile_data["equipment_ap"]["profile_name"] | #     ap_profile_info["profile_name"] = profile_data["equipment_ap"]["profile_name"] | ||||||
|     ap_profile_info["ssid_names"] = [ssid_to_apply] | #     ap_profile_info["ssid_names"] = [ssid_to_apply] | ||||||
|     try: | #     try: | ||||||
|         instantiate_profile.set_ap_profile_custom(profile_data=ap_profile_info) | #         instantiate_profile.set_ap_profile_custom(profile_data=ap_profile_info) | ||||||
|         test_cases["equipment_ap"] = {"sdk": True} | #         test_cases["equipment_ap"] = {"sdk": True} | ||||||
|         allure.attach(body=str(profile_data["equipment_ap"]), name="Equipment AP Profile Created") | #         allure.attach(body=str(profile_data["equipment_ap"]), name="Equipment AP Profile Created") | ||||||
|     except Exception as e: | #     except Exception as e: | ||||||
|         print(e) | #         print(e) | ||||||
|         test_cases["equipment_ap"] = {"sdk": False} | #         test_cases["equipment_ap"] = {"sdk": False} | ||||||
|         allure.attach(body=str(e), name="Equipment AP Profile Creation Failed") | #         allure.attach(body=str(e), name="Equipment AP Profile Creation Failed") | ||||||
|  | # | ||||||
|  | # | ||||||
|     def teardown_session(): | #     def teardown_session(): | ||||||
|         print("\nRemoving Profiles") | #         print("\nRemoving Profiles") | ||||||
|         instantiate_profile.delete_profile_by_name(profile_name=profile_data['equipment_ap']['profile_name']) | #         instantiate_profile.delete_profile_by_name(profile_name=profile_data['equipment_ap']['profile_name']) | ||||||
|         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["ssid"]) | #         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["ssid"]) | ||||||
|         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["radius"]) | #         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["radius"]) | ||||||
|         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["rf"]) | #         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["rf"]) | ||||||
|         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint_osu_id_provider"]) | #         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint_osu_id_provider"]) | ||||||
|         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint_operator"]) | #         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint_operator"]) | ||||||
|         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint_venue"]) | #         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint_venue"]) | ||||||
|         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint"]) | #         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint"]) | ||||||
|         allure.attach(body=str(profile_data['equipment_ap']['profile_name'] + "\n"), | #         allure.attach(body=str(profile_data['equipment_ap']['profile_name'] + "\n"), | ||||||
|                       name="Tear Down in Profiles ") | #                       name="Tear Down in Profiles ") | ||||||
|         time.sleep(20) | #         time.sleep(20) | ||||||
|  | # | ||||||
|     request.addfinalizer(teardown_session) | #     request.addfinalizer(teardown_session) | ||||||
|     yield test_cases, instantiate_profile, profile_data | #     yield test_cases, instantiate_profile, profile_data | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="function") | # @pytest.fixture(scope="function") | ||||||
| def push_ap_profile(request, setup_profiles, get_equipment_ref, get_apnos, get_configuration): | # def push_ap_profile(request, setup_profiles, get_equipment_ref, get_apnos, get_configuration): | ||||||
|     parameter = dict(request.param) | #     parameter = dict(request.param) | ||||||
|     test_cases, instantiate_profile, profile_data = setup_profiles | #     test_cases, instantiate_profile, profile_data = setup_profiles | ||||||
|     ssid_names = parameter["ssid_names"] | #     ssid_names = parameter["ssid_names"] | ||||||
|     ap_profile_info = dict() | #     ap_profile_info = dict() | ||||||
|     ap_profile_info["profile_name"] = profile_data["equipment_ap"]["profile_name"] | #     ap_profile_info["profile_name"] = profile_data["equipment_ap"]["profile_name"] | ||||||
|     test_cases = {} | #     test_cases = {} | ||||||
|     ap_profile_info["ssid_names"] = ssid_names | #     ap_profile_info["ssid_names"] = ssid_names | ||||||
|     try: | #     try: | ||||||
|         instantiate_profile.update_ap_profile(profile_data=ap_profile_info) | #         instantiate_profile.update_ap_profile(profile_data=ap_profile_info) | ||||||
|         test_cases["equipment_ap"] = {"sdk": True} | #         test_cases["equipment_ap"] = {"sdk": True} | ||||||
|         allure.attach(body=str(ap_profile_info["profile_name"]), name="Equipment AP Profile Updated") | #         allure.attach(body=str(ap_profile_info["profile_name"]), name="Equipment AP Profile Updated") | ||||||
|     except Exception as e: | #     except Exception as e: | ||||||
|         print(e) | #         print(e) | ||||||
|         test_cases["equipment_ap"] = {"sdk": False} | #         test_cases["equipment_ap"] = {"sdk": False} | ||||||
|         allure.attach(body=str(e), name="Equipment AP Profile Update Failed") | #         allure.attach(body=str(e), name="Equipment AP Profile Update Failed") | ||||||
|  | # | ||||||
|     print("Pushing profiles on AP  :: ", ap_profile_info) | #     print("Pushing profiles on AP  :: ", ap_profile_info) | ||||||
|     allure.attach(body=str(ap_profile_info), name="Pushing profiles on AP  :: ") | #     allure.attach(body=str(ap_profile_info), name="Pushing profiles on AP  :: ") | ||||||
|     # Push the Equipment AP Profile to AP | #     # Push the Equipment AP Profile to AP | ||||||
|     try: | #     try: | ||||||
|         for i in get_equipment_ref: | #         for i in get_equipment_ref: | ||||||
|             instantiate_profile.push_profile_old_method(equipment_id=i) | #             instantiate_profile.push_profile_old_method(equipment_id=i) | ||||||
|     except Exception as e: | #     except Exception as e: | ||||||
|         print(e) | #         print(e) | ||||||
|         print("failed to push AP Profile") | #         print("failed to push AP Profile") | ||||||
|  | # | ||||||
|     # Check the VIF Config and VIF State of SSIDs | #     # Check the VIF Config and VIF State of SSIDs | ||||||
|     time_start = time.time() | #     time_start = time.time() | ||||||
|     ap_ssh = get_apnos(get_configuration["access_point"][0], pwd="../libs/apnos/") | #     ap_ssh = get_apnos(get_configuration["access_point"][0], pwd="../libs/apnos/") | ||||||
|     while time.time() - time_start < 240: | #     while time.time() - time_start < 240: | ||||||
|         if ((time.time() - time_start) / 10) == 15: | #         if ((time.time() - time_start) / 10) == 15: | ||||||
|             ap_ssh = get_apnos(get_configuration["access_point"][0], pwd="../libs/apnos/") | #             ap_ssh = get_apnos(get_configuration["access_point"][0], pwd="../libs/apnos/") | ||||||
|         vif_config = list(ap_ssh.get_vif_config_ssids()) | #         vif_config = list(ap_ssh.get_vif_config_ssids()) | ||||||
|         vif_config.sort() | #         vif_config.sort() | ||||||
|         vif_state = list(ap_ssh.get_vif_state_ssids()) | #         vif_state = list(ap_ssh.get_vif_state_ssids()) | ||||||
|         vif_state.sort() | #         vif_state.sort() | ||||||
|         for ssid in ssid_names: | #         for ssid in ssid_names: | ||||||
|             test_cases[ssid] = dict() | #             test_cases[ssid] = dict() | ||||||
|             test_cases[ssid]["vif_config"] = True if ssid in vif_config else False | #             test_cases[ssid]["vif_config"] = True if ssid in vif_config else False | ||||||
|             test_cases[ssid]["vif_state"] = True if ssid in vif_state else False | #             test_cases[ssid]["vif_state"] = True if ssid in vif_state else False | ||||||
|         ssid_names.sort() | #         ssid_names.sort() | ||||||
|         if vif_config == ssid_names == vif_state: | #         if vif_config == ssid_names == vif_state: | ||||||
|             print("Waiting for Radios to apply config ") | #             print("Waiting for Radios to apply config ") | ||||||
|             time.sleep(200) | #             time.sleep(200) | ||||||
|             break | #             break | ||||||
|         time.sleep(10) | #         time.sleep(10) | ||||||
|     allure.attach(body=str(vif_config), name="vifC status on AP :: ") | #     allure.attach(body=str(vif_config), name="vifC status on AP :: ") | ||||||
|     allure.attach(body=str(vif_state), name="vifS status on AP :: ") | #     allure.attach(body=str(vif_state), name="vifS status on AP :: ") | ||||||
|  | # | ||||||
|     yield test_cases | #     yield test_cases | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def passpoint_radius_server_info(): | # def passpoint_radius_server_info(): | ||||||
|     allure.attach(body=str(PASSPOINT_RADIUS_SERVER_DATA), name="Passpoint RADIUS server Info: ") | #     allure.attach(body=str(PASSPOINT_RADIUS_SERVER_DATA), name="Passpoint RADIUS server Info: ") | ||||||
|     yield PASSPOINT_RADIUS_SERVER_DATA | #     yield PASSPOINT_RADIUS_SERVER_DATA | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def passpoint_radius_accounting_server_info(): | # def passpoint_radius_accounting_server_info(): | ||||||
|     allure.attach(body=str(PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA), name="Passpoint RADIUS account server Info: ") | #     allure.attach(body=str(PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA), name="Passpoint RADIUS account server Info: ") | ||||||
|     yield PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA | #     yield PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def passpoint_provider_info(): | # def passpoint_provider_info(): | ||||||
|     allure.attach(body=str(PASSPOINT_PROVIDER_INFO), name="Passpoint Provider Info: ") | #     allure.attach(body=str(PASSPOINT_PROVIDER_INFO), name="Passpoint Provider Info: ") | ||||||
|     yield PASSPOINT_PROVIDER_INFO | #     yield PASSPOINT_PROVIDER_INFO | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def passpoint_operator_info(): | # def passpoint_operator_info(): | ||||||
|     allure.attach(body=str(PASSPOINT_OPERATOR_INFO), name="Passpoint operator Info: ") | #     allure.attach(body=str(PASSPOINT_OPERATOR_INFO), name="Passpoint operator Info: ") | ||||||
|     yield PASSPOINT_OPERATOR_INFO | #     yield PASSPOINT_OPERATOR_INFO | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def passpoint_venue_info(): | # def passpoint_venue_info(): | ||||||
|     allure.attach(body=str(PASSPOINT_VENUE_INFO), name="Passpoint venue Info: ") | #     allure.attach(body=str(PASSPOINT_VENUE_INFO), name="Passpoint venue Info: ") | ||||||
|     yield PASSPOINT_VENUE_INFO | #     yield PASSPOINT_VENUE_INFO | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def passpoint_profile_info(): | # def passpoint_profile_info(): | ||||||
|     allure.attach(body=str(PASSPOINT_PROFILE_INFO), name="Passpoint profile Info: ") | #     allure.attach(body=str(PASSPOINT_PROFILE_INFO), name="Passpoint profile Info: ") | ||||||
|     yield PASSPOINT_PROFILE_INFO | #     yield PASSPOINT_PROFILE_INFO | ||||||
|   | |||||||
| @@ -1,160 +1,160 @@ | |||||||
| import json | # import json | ||||||
| import os | # import os | ||||||
| import sys | # import sys | ||||||
|  | # | ||||||
| sys.path.append( | # sys.path.append( | ||||||
|     os.path.dirname( | #     os.path.dirname( | ||||||
|         os.path.realpath(__file__) | #         os.path.realpath(__file__) | ||||||
|     ) | #     ) | ||||||
| ) | # ) | ||||||
| if "libs" not in sys.path: | # if "libs" not in sys.path: | ||||||
|     sys.path.append(f'../libs') | #     sys.path.append(f'../libs') | ||||||
|  | # | ||||||
| from controller.controller_1x.controller import ProfileUtility | # from controller.controller_1x.controller import ProfileUtility | ||||||
| from controller.controller_2x.controller import UProfileUtility | # from controller.controller_2x.controller import UProfileUtility | ||||||
| import time | # import time | ||||||
| from lanforge.lf_tests import RunTest | # from lanforge.lf_tests import RunTest | ||||||
| from lanforge.lf_tools import ChamberView | # from lanforge.lf_tools import ChamberView | ||||||
| import pytest | # import pytest | ||||||
| import allure | # import allure | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def instantiate_profile(request): | # def instantiate_profile(request): | ||||||
|     if request.config.getoption("1.x"): | #     if request.config.getoption("1.x"): | ||||||
|         yield ProfileUtility | #         yield ProfileUtility | ||||||
|     else: | #     else: | ||||||
|         yield UProfileUtility | #         yield UProfileUtility | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def lf_tools(get_configuration, testbed): | # def lf_tools(get_configuration, testbed): | ||||||
|     lf_tools_obj = ChamberView(lanforge_data=get_configuration['traffic_generator']['details'], | #     lf_tools_obj = ChamberView(lanforge_data=get_configuration['traffic_generator']['details'], | ||||||
|                                access_point_data=get_configuration['access_point'], | #                                access_point_data=get_configuration['access_point'], | ||||||
|                                testbed=testbed) | #                                testbed=testbed) | ||||||
|     yield lf_tools_obj | #     yield lf_tools_obj | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def create_lanforge_chamberview(lf_tools): | # def create_lanforge_chamberview(lf_tools): | ||||||
|     scenario_object, scenario_name = lf_tools.Chamber_View() | #     scenario_object, scenario_name = lf_tools.Chamber_View() | ||||||
|     return scenario_name | #     return scenario_name | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def create_lanforge_chamberview_dut(lf_tools): | # def create_lanforge_chamberview_dut(lf_tools): | ||||||
|     dut_object, dut_name = lf_tools.Create_Dut() | #     dut_object, dut_name = lf_tools.Create_Dut() | ||||||
|     yield dut_name | #     yield dut_name | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def setup_mesh_scenario(lf_tools): | # def setup_mesh_scenario(lf_tools): | ||||||
|     mesh_obj  = lf_tools.create_mesh_scenario() | #     mesh_obj  = lf_tools.create_mesh_scenario() | ||||||
|     yield mesh_obj | #     yield mesh_obj | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def create_lanforge_chamberview_dut(lf_tools, skip_lf): | # def create_lanforge_chamberview_dut(lf_tools, skip_lf): | ||||||
|     dut_name = "" | #     dut_name = "" | ||||||
|     if not skip_lf: | #     if not skip_lf: | ||||||
|         dut_object, dut_name = lf_tools.Create_Dut() | #         dut_object, dut_name = lf_tools.Create_Dut() | ||||||
|     return dut_name | #     return dut_name | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def create_mesh_dut(lf_tools, skip_lf, ssid_data): | # def create_mesh_dut(lf_tools, skip_lf, ssid_data): | ||||||
|     dut_name = "" | #     dut_name = "" | ||||||
|     if not skip_lf: | #     if not skip_lf: | ||||||
|         mesh_dut_object, dut_name = lf_tools.create_mesh_dut(ssid_data=ssid_data) | #         mesh_dut_object, dut_name = lf_tools.create_mesh_dut(ssid_data=ssid_data) | ||||||
|     yield dut_name | #     yield dut_name | ||||||
|  | # | ||||||
| @pytest.fixture(scope="class") | # @pytest.fixture(scope="class") | ||||||
| def setup_mesh_profile_fix(request, fixtures_ver, get_apnos, get_configuration, setup_controller, instantiate_profile,get_markers,  get_equipment_ref, | # def setup_mesh_profile_fix(request, fixtures_ver, get_apnos, get_configuration, setup_controller, instantiate_profile,get_markers,  get_equipment_ref, | ||||||
|                            lf_tools, ): | #                            lf_tools, ): | ||||||
|     param = dict(request.param) | #     param = dict(request.param) | ||||||
|     ret_var = fixtures_ver.setup_mesh_profile(request, param, get_apnos, get_configuration, setup_controller, instantiate_profile, get_markers, get_equipment_ref, | #     ret_var = fixtures_ver.setup_mesh_profile(request, param, get_apnos, get_configuration, setup_controller, instantiate_profile, get_markers, get_equipment_ref, | ||||||
|                                               lf_tools, skip_lf=False, open_flow=None | #                                               lf_tools, skip_lf=False, open_flow=None | ||||||
|                                               ) | #                                               ) | ||||||
|     yield ret_var | #     yield ret_var | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="class") | # @pytest.fixture(scope="class") | ||||||
| def setup_profiles(request, setup_controller, testbed, get_equipment_id, fixtures_ver, | # def setup_profiles(request, setup_controller, testbed, get_equipment_id, fixtures_ver, | ||||||
|                    instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools, | #                    instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools, | ||||||
|                    get_security_flags, get_configuration, radius_info, get_apnos, radius_accounting_info): | #                    get_security_flags, get_configuration, radius_info, get_apnos, radius_accounting_info): | ||||||
|     lf_tools.reset_scenario() | #     lf_tools.reset_scenario() | ||||||
|     param = dict(request.param) | #     param = dict(request.param) | ||||||
|  | # | ||||||
|     # VLAN Setup | #     # VLAN Setup | ||||||
|     if request.param["mode"] == "VLAN": | #     if request.param["mode"] == "VLAN": | ||||||
|  | # | ||||||
|         vlan_list = list() | #         vlan_list = list() | ||||||
|         refactored_vlan_list = list() | #         refactored_vlan_list = list() | ||||||
|         ssid_modes = request.param["ssid_modes"].keys() | #         ssid_modes = request.param["ssid_modes"].keys() | ||||||
|         for mode in ssid_modes: | #         for mode in ssid_modes: | ||||||
|             for ssid in range(len(request.param["ssid_modes"][mode])): | #             for ssid in range(len(request.param["ssid_modes"][mode])): | ||||||
|                 if "vlan" in request.param["ssid_modes"][mode][ssid]: | #                 if "vlan" in request.param["ssid_modes"][mode][ssid]: | ||||||
|                     vlan_list.append(request.param["ssid_modes"][mode][ssid]["vlan"]) | #                     vlan_list.append(request.param["ssid_modes"][mode][ssid]["vlan"]) | ||||||
|                 else: | #                 else: | ||||||
|                     pass | #                     pass | ||||||
|         if vlan_list: | #         if vlan_list: | ||||||
|             [refactored_vlan_list.append(x) for x in vlan_list if x not in refactored_vlan_list] | #             [refactored_vlan_list.append(x) for x in vlan_list if x not in refactored_vlan_list] | ||||||
|             vlan_list = refactored_vlan_list | #             vlan_list = refactored_vlan_list | ||||||
|             for i in range(len(vlan_list)): | #             for i in range(len(vlan_list)): | ||||||
|                 if vlan_list[i] > 4095 or vlan_list[i] < 1: | #                 if vlan_list[i] > 4095 or vlan_list[i] < 1: | ||||||
|                     vlan_list.pop(i) | #                     vlan_list.pop(i) | ||||||
|     if request.param["mode"] == "VLAN": | #     if request.param["mode"] == "VLAN": | ||||||
|         lf_tools.add_vlan(vlan_ids=vlan_list) | #         lf_tools.add_vlan(vlan_ids=vlan_list) | ||||||
|  | # | ||||||
|     # call this, if 1.x | #     # call this, if 1.x | ||||||
|     return_var = fixtures_ver.setup_profiles(request, param, setup_controller, testbed, get_equipment_id, | #     return_var = fixtures_ver.setup_profiles(request, param, setup_controller, testbed, get_equipment_id, | ||||||
|                                              instantiate_profile, | #                                              instantiate_profile, | ||||||
|                                              get_markers, create_lanforge_chamberview_dut, lf_tools, | #                                              get_markers, create_lanforge_chamberview_dut, lf_tools, | ||||||
|                                              get_security_flags, get_configuration, radius_info, get_apnos, | #                                              get_security_flags, get_configuration, radius_info, get_apnos, | ||||||
|                                              radius_accounting_info) | #                                              radius_accounting_info) | ||||||
|  | # | ||||||
|     yield return_var | #     yield return_var | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def lf_test(get_configuration, setup_influx): | # def lf_test(get_configuration, setup_influx): | ||||||
|     obj = RunTest(configuration_data=get_configuration, influx_params=setup_influx) | #     obj = RunTest(configuration_data=get_configuration, influx_params=setup_influx) | ||||||
|     yield obj | #     yield obj | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def station_names_twog(request, get_configuration): | # def station_names_twog(request, get_configuration): | ||||||
|     station_names = [] | #     station_names = [] | ||||||
|     for i in range(0, int(request.config.getini("num_stations"))): | #     for i in range(0, int(request.config.getini("num_stations"))): | ||||||
|         station_names.append(get_configuration["traffic_generator"]["details"]["2.4G-Station-Name"] + "0" + str(i)) | #         station_names.append(get_configuration["traffic_generator"]["details"]["2.4G-Station-Name"] + "0" + str(i)) | ||||||
|     yield station_names | #     yield station_names | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def station_names_fiveg(request, get_configuration): | # def station_names_fiveg(request, get_configuration): | ||||||
|     station_names = [] | #     station_names = [] | ||||||
|     for i in range(0, int(request.config.getini("num_stations"))): | #     for i in range(0, int(request.config.getini("num_stations"))): | ||||||
|         station_names.append(get_configuration["traffic_generator"]["details"]["5G-Station-Name"] + "0" + str(i)) | #         station_names.append(get_configuration["traffic_generator"]["details"]["5G-Station-Name"] + "0" + str(i)) | ||||||
|     yield station_names | #     yield station_names | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="session") | # @pytest.fixture(scope="session") | ||||||
| def num_stations(request): | # def num_stations(request): | ||||||
|     num_sta = int(request.config.getini("num_stations")) | #     num_sta = int(request.config.getini("num_stations")) | ||||||
|     yield num_sta | #     yield num_sta | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="class") | # @pytest.fixture(scope="class") | ||||||
| def get_vif_state(get_apnos, get_configuration, request, lf_tools): | # def get_vif_state(get_apnos, get_configuration, request, lf_tools): | ||||||
|     if request.config.getoption("1.x"): | #     if request.config.getoption("1.x"): | ||||||
|         ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/", sdk="1.x") | #         ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/", sdk="1.x") | ||||||
|         vif_state = list(ap_ssh.get_vif_state_ssids()) | #         vif_state = list(ap_ssh.get_vif_state_ssids()) | ||||||
|         vif_state.sort() | #         vif_state.sort() | ||||||
|         yield vif_state | #         yield vif_state | ||||||
|     else: | #     else: | ||||||
|         yield lf_tools.ssid_list | #         yield lf_tools.ssid_list | ||||||
|  | # | ||||||
|  | # | ||||||
| @pytest.fixture(scope="class") | # @pytest.fixture(scope="class") | ||||||
| def get_vlan_list(get_apnos, get_configuration): | # def get_vlan_list(get_apnos, get_configuration): | ||||||
|     ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") | #     ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") | ||||||
|     vlan_list = list(ap_ssh.get_vlan()) | #     vlan_list = list(ap_ssh.get_vlan()) | ||||||
|     vlan_list.sort() | #     vlan_list.sort() | ||||||
|     yield vlan_list | #     yield vlan_list | ||||||
|   | |||||||
							
								
								
									
										1324
									
								
								tests/fixtures_1x.py
									
									
									
									
									
								
							
							
						
						
									
										1324
									
								
								tests/fixtures_1x.py
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,400 +1,400 @@ | |||||||
| import allure | # import allure | ||||||
| import pytest | # import pytest | ||||||
| import os | # import os | ||||||
| import sys | # import sys | ||||||
| """ Environment Paths """ | # """ Environment Paths """ | ||||||
| if "libs" not in sys.path: | # if "libs" not in sys.path: | ||||||
|     sys.path.append(f'../libs') | #     sys.path.append(f'../libs') | ||||||
| for folder in 'py-json', 'py-scripts': | # for folder in 'py-json', 'py-scripts': | ||||||
|     if folder not in sys.path: | #     if folder not in sys.path: | ||||||
|         sys.path.append(f'../lanforge/lanforge-scripts/{folder}') | #         sys.path.append(f'../lanforge/lanforge-scripts/{folder}') | ||||||
|  | # | ||||||
| sys.path.append( | # sys.path.append( | ||||||
|     os.path.dirname( | #     os.path.dirname( | ||||||
|         os.path.realpath(__file__) | #         os.path.realpath(__file__) | ||||||
|     ) | #     ) | ||||||
| ) | # ) | ||||||
| sys.path.append(f"../lanforge/lanforge-scripts/py-scripts/tip-cicd-sanity") | # sys.path.append(f"../lanforge/lanforge-scripts/py-scripts/tip-cicd-sanity") | ||||||
|  | # | ||||||
| sys.path.append(f'../libs') | # sys.path.append(f'../libs') | ||||||
| sys.path.append(f'../libs/lanforge/') | # sys.path.append(f'../libs/lanforge/') | ||||||
| sys.path.append(f'../lanforge/lanforge-scripts') | # sys.path.append(f'../lanforge/lanforge-scripts') | ||||||
|  | # | ||||||
| from LANforge.LFUtils import * | # from LANforge.LFUtils import * | ||||||
|  | # | ||||||
| if 'py-json' not in sys.path: | # if 'py-json' not in sys.path: | ||||||
|     sys.path.append('../py-scripts') | #     sys.path.append('../py-scripts') | ||||||
| from controller.controller_3x.controller import CController | # from controller.controller_3x.controller import CController | ||||||
|  | # | ||||||
|  | # | ||||||
| class Fixtures_3x: | # class Fixtures_3x: | ||||||
|  | # | ||||||
|     def __init__(self, configuration={}, run_lf=False, cc_1=False): | #     def __init__(self, configuration={}, run_lf=False, cc_1=False): | ||||||
|         self.lab_info = configuration | #         self.lab_info = configuration | ||||||
|         self.run_lf = run_lf | #         self.run_lf = run_lf | ||||||
|         self.cc_1 = cc_1 | #         self.cc_1 = cc_1 | ||||||
|         # print(self.lab_info) | #         # print(self.lab_info) | ||||||
|         print("cc.1") | #         print("cc.1") | ||||||
|         self.controller_obj = "" | #         self.controller_obj = "" | ||||||
|  | # | ||||||
|  | # | ||||||
|     def setup_profiles(self, request, param, run_lf, instantiate_profile, get_configuration, get_markers, lf_tools, lf_reports): | #     def setup_profiles(self, request, param, run_lf, instantiate_profile, get_configuration, get_markers, lf_tools, lf_reports): | ||||||
|         table1= [] | #         table1= [] | ||||||
|         instantiate_profile_obj = instantiate_profile(controller_data=get_configuration['controller'], | #         instantiate_profile_obj = instantiate_profile(controller_data=get_configuration['controller'], | ||||||
|                                                   timeout="10", ssid_data=None, | #                                                   timeout="10", ssid_data=None, | ||||||
|                                                   ap_data=self.lab_info['access_point'], type=0) | #                                                   ap_data=self.lab_info['access_point'], type=0) | ||||||
|  | # | ||||||
|         instantiate_profile_obj.enable_all_bands() | #         instantiate_profile_obj.enable_all_bands() | ||||||
|  | # | ||||||
|  | # | ||||||
|         if run_lf: | #         if run_lf: | ||||||
|             return 0 | #             return 0 | ||||||
|         print("check params") | #         print("check params") | ||||||
|         # gives parameter value of setup_params_general | #         # gives parameter value of setup_params_general | ||||||
|         parameter = dict(param) | #         parameter = dict(param) | ||||||
|         print("parameter", parameter) | #         print("parameter", parameter) | ||||||
|  | # | ||||||
|         test_cases = {} | #         test_cases = {} | ||||||
|         profile_data= {} | #         profile_data= {} | ||||||
|         var = "" | #         var = "" | ||||||
|         list_key = list(parameter.keys()) | #         list_key = list(parameter.keys()) | ||||||
|  | # | ||||||
|         if parameter['mode'] not in ["BRIDGE", "NAT", "VLAN"]: | #         if parameter['mode'] not in ["BRIDGE", "NAT", "VLAN"]: | ||||||
|             print("Invalid Mode: ", parameter['mode']) | #             print("Invalid Mode: ", parameter['mode']) | ||||||
|             return test_cases | #             return test_cases | ||||||
|         profile_data["ssid"] = {} | #         profile_data["ssid"] = {} | ||||||
|         lf_dut_data = [] | #         lf_dut_data = [] | ||||||
|         for i in parameter["ssid_modes"]: | #         for i in parameter["ssid_modes"]: | ||||||
|             profile_data["ssid"][i] = [] | #             profile_data["ssid"][i] = [] | ||||||
|             for j in range(len(parameter["ssid_modes"][i])): | #             for j in range(len(parameter["ssid_modes"][i])): | ||||||
|                 data = parameter["ssid_modes"][i][j] | #                 data = parameter["ssid_modes"][i][j] | ||||||
|                 profile_data["ssid"][i].append(data) | #                 profile_data["ssid"][i].append(data) | ||||||
|  | # | ||||||
|         # profile data will give ssid data like {'ssid': {'wpa2_personal': [{'ssid_name': 'ssid_wpa2_2g', 'appliedRadios': ['2G'], 'security_key': 'something'}, {'ssid_name': 'ssid_wpa2_5g', 'appliedRadios': ['5G'], 'security_key': 'something'}], 'wpa3_personal': [{'ssid_name': 'ssid_wpa2_5g', 'appliedRadios': ['6G'], 'security_key': 'something'}]}} | #         # profile data will give ssid data like {'ssid': {'wpa2_personal': [{'ssid_name': 'ssid_wpa2_2g', 'appliedRadios': ['2G'], 'security_key': 'something'}, {'ssid_name': 'ssid_wpa2_5g', 'appliedRadios': ['5G'], 'security_key': 'something'}], 'wpa3_personal': [{'ssid_name': 'ssid_wpa2_5g', 'appliedRadios': ['6G'], 'security_key': 'something'}]}} | ||||||
|         print("profile data", profile_data) | #         print("profile data", profile_data) | ||||||
|  | # | ||||||
|  | # | ||||||
|         # create wlan | #         # create wlan | ||||||
|         for mode in profile_data['ssid']: | #         for mode in profile_data['ssid']: | ||||||
|             if mode == "wpa2_personal": | #             if mode == "wpa2_personal": | ||||||
|                 for j in profile_data["ssid"][mode]: | #                 for j in profile_data["ssid"][mode]: | ||||||
|                     if mode in get_markers.keys() and get_markers[mode]: | #                     if mode in get_markers.keys() and get_markers[mode]: | ||||||
|                         try: | #                         try: | ||||||
|                             if j["appliedRadios"].__contains__("2G"): | #                             if j["appliedRadios"].__contains__("2G"): | ||||||
|                                 lf_dut_data.append(j) | #                                 lf_dut_data.append(j) | ||||||
|                             if j["appliedRadios"].__contains__("5G"): | #                             if j["appliedRadios"].__contains__("5G"): | ||||||
|                                 lf_dut_data.append(j) | #                                 lf_dut_data.append(j) | ||||||
|                             if j["appliedRadios"].__contains__("6G"): | #                             if j["appliedRadios"].__contains__("6G"): | ||||||
|                                 lf_dut_data.append(j) | #                                 lf_dut_data.append(j) | ||||||
|                             j["appliedRadios"] = list(set(j["appliedRadios"])) | #                             j["appliedRadios"] = list(set(j["appliedRadios"])) | ||||||
|                             j['security'] = 'wpa2' | #                             j['security'] = 'wpa2' | ||||||
|                             # print("dut data", lf_dut_data) | #                             # print("dut data", lf_dut_data) | ||||||
|                             test_cases["wpa_2g"] = True | #                             test_cases["wpa_2g"] = True | ||||||
|                         except Exception as e: | #                         except Exception as e: | ||||||
|                             print(e) | #                             print(e) | ||||||
|                             test_cases["wpa2_personal"] = False | #                             test_cases["wpa2_personal"] = False | ||||||
|             if mode == "wpa3_personal": | #             if mode == "wpa3_personal": | ||||||
|                 for j in profile_data["ssid"][mode]: | #                 for j in profile_data["ssid"][mode]: | ||||||
|                     if mode in get_markers.keys() and get_markers[mode]: | #                     if mode in get_markers.keys() and get_markers[mode]: | ||||||
|                         print( profile_data["ssid"][mode]) | #                         print( profile_data["ssid"][mode]) | ||||||
|                         print(j) | #                         print(j) | ||||||
|                         try: | #                         try: | ||||||
|                             if j["appliedRadios"].__contains__("2G"): | #                             if j["appliedRadios"].__contains__("2G"): | ||||||
|                                 lf_dut_data.append(j) | #                                 lf_dut_data.append(j) | ||||||
|                             if j["appliedRadios"].__contains__("5G"): | #                             if j["appliedRadios"].__contains__("5G"): | ||||||
|                                 lf_dut_data.append(j) | #                                 lf_dut_data.append(j) | ||||||
|                             if j["appliedRadios"].__contains__("6G"): | #                             if j["appliedRadios"].__contains__("6G"): | ||||||
|                                 lf_dut_data.append(j) | #                                 lf_dut_data.append(j) | ||||||
|                                 print(lf_dut_data) | #                                 print(lf_dut_data) | ||||||
|                             j["appliedRadios"] = list(set(j["appliedRadios"])) | #                             j["appliedRadios"] = list(set(j["appliedRadios"])) | ||||||
|                             j['security'] = 'wpa3' | #                             j['security'] = 'wpa3' | ||||||
|                             test_cases["wpa_2g"] = True | #                             test_cases["wpa_2g"] = True | ||||||
|                         except Exception as e: | #                         except Exception as e: | ||||||
|                             print(e) | #                             print(e) | ||||||
|                             test_cases["wpa3_personal"] = False | #                             test_cases["wpa3_personal"] = False | ||||||
|  | # | ||||||
|         # lf dut data [{'ssid_name': 'ssid_wpa2_2g', 'appliedRadios': ['2G'], 'security_key': 'something', 'security': 'wpa2'}, {'ssid_name': 'ssid_wpa2_5g', 'appliedRadios': ['5G'], 'security_key': 'something', 'security': 'wpa2'}, {'ssid_name': 'ssid_wpa2_5g', 'appliedRadios': ['6G'], 'security_key': 'something', 'security': 'wpa3'}] | #         # lf dut data [{'ssid_name': 'ssid_wpa2_2g', 'appliedRadios': ['2G'], 'security_key': 'something', 'security': 'wpa2'}, {'ssid_name': 'ssid_wpa2_5g', 'appliedRadios': ['5G'], 'security_key': 'something', 'security': 'wpa2'}, {'ssid_name': 'ssid_wpa2_5g', 'appliedRadios': ['6G'], 'security_key': 'something', 'security': 'wpa3'}] | ||||||
|         print("lf dut data", lf_dut_data) | #         print("lf dut data", lf_dut_data) | ||||||
|         allure.attach(name="wlan data passing", body=str(parameter)) | #         allure.attach(name="wlan data passing", body=str(parameter)) | ||||||
|         ap = instantiate_profile_obj.show_ap_summary() | #         ap = instantiate_profile_obj.show_ap_summary() | ||||||
|         print("show ap summ", ap) | #         print("show ap summ", ap) | ||||||
|         allure.attach(name="show ap summary", body=str(ap)) | #         allure.attach(name="show ap summary", body=str(ap)) | ||||||
|  | # | ||||||
|         print("create 3 wlans on slot1,2 and 3") | #         print("create 3 wlans on slot1,2 and 3") | ||||||
|         for ap_name in range(len(self.lab_info['access_point'])): | #         for ap_name in range(len(self.lab_info['access_point'])): | ||||||
|             print("ap ", ap_name) | #             print("ap ", ap_name) | ||||||
|             # instantiate controller object | #             # instantiate controller object | ||||||
|  | # | ||||||
|             print("set channel and bandwidth") | #             print("set channel and bandwidth") | ||||||
|             instantiate_profile_obj = instantiate_profile(controller_data=get_configuration['controller'], | #             instantiate_profile_obj = instantiate_profile(controller_data=get_configuration['controller'], | ||||||
|                                                           timeout="10", ssid_data=lf_dut_data, | #                                                           timeout="10", ssid_data=lf_dut_data, | ||||||
|                                                           ap_data=self.lab_info['access_point'], type=ap_name) | #                                                           ap_data=self.lab_info['access_point'], type=ap_name) | ||||||
|             instantiate_profile_obj.set_channel(band="6g", channel=self.lab_info['access_point'][ap_name]["channel_6g"], | #             instantiate_profile_obj.set_channel(band="6g", channel=self.lab_info['access_point'][ap_name]["channel_6g"], | ||||||
|                                                 slot=self.lab_info['access_point'][ap_name]["6g_slot"]) | #                                                 slot=self.lab_info['access_point'][ap_name]["6g_slot"]) | ||||||
|             allure.attach(name="set 6g channel on " + str(ap_name + 1) + " ap ", body=str(self.lab_info['access_point'][ap_name]["channel_6g"])) | #             allure.attach(name="set 6g channel on " + str(ap_name + 1) + " ap ", body=str(self.lab_info['access_point'][ap_name]["channel_6g"])) | ||||||
|             instantiate_profile_obj.set_channel(band="5g", channel=self.lab_info['access_point'][ap_name]["channel_5g"], | #             instantiate_profile_obj.set_channel(band="5g", channel=self.lab_info['access_point'][ap_name]["channel_5g"], | ||||||
|                                                 slot=self.lab_info['access_point'][ap_name]["5g_slot"]) | #                                                 slot=self.lab_info['access_point'][ap_name]["5g_slot"]) | ||||||
|             allure.attach(name="set 5g channel on " + str(ap_name + 1) + " ap ", body=str(self.lab_info['access_point'][ap_name]["channel_5g"])) | #             allure.attach(name="set 5g channel on " + str(ap_name + 1) + " ap ", body=str(self.lab_info['access_point'][ap_name]["channel_5g"])) | ||||||
|             instantiate_profile_obj.set_channel(band="2g", channel=self.lab_info['access_point'][ap_name]["channel_2g"], | #             instantiate_profile_obj.set_channel(band="2g", channel=self.lab_info['access_point'][ap_name]["channel_2g"], | ||||||
|                                                 slot=self.lab_info['access_point'][ap_name]["2g_slot"]) | #                                                 slot=self.lab_info['access_point'][ap_name]["2g_slot"]) | ||||||
|             allure.attach(name="set 2g channel on " + str(ap_name + 1) + " ap ", body=str(self.lab_info['access_point'][ap_name]["channel_2g"])) | #             allure.attach(name="set 2g channel on " + str(ap_name + 1) + " ap ", body=str(self.lab_info['access_point'][ap_name]["channel_2g"])) | ||||||
|             print(self.lab_info['access_point'][ap_name]["ap_name"]) | #             print(self.lab_info['access_point'][ap_name]["ap_name"]) | ||||||
|             check_admin = instantiate_profile_obj.check_admin_state_2ghz(ap_name=self.lab_info['access_point'][ap_name]["ap_name"]) | #             check_admin = instantiate_profile_obj.check_admin_state_2ghz(ap_name=self.lab_info['access_point'][ap_name]["ap_name"]) | ||||||
|             allure.attach(name="2ghz ap admin state for " + str(ap_name + 1) + " ap", body=str(check_admin)) | #             allure.attach(name="2ghz ap admin state for " + str(ap_name + 1) + " ap", body=str(check_admin)) | ||||||
|  | # | ||||||
|             check_admin_5 = instantiate_profile_obj.check_admin_state_5ghz(ap_name=self.lab_info['access_point'][ap_name]["ap_name"]) | #             check_admin_5 = instantiate_profile_obj.check_admin_state_5ghz(ap_name=self.lab_info['access_point'][ap_name]["ap_name"]) | ||||||
|             allure.attach(name="5ghz ap admin state for " + str(ap_name + 1) + " ap", body=str(check_admin_5)) | #             allure.attach(name="5ghz ap admin state for " + str(ap_name + 1) + " ap", body=str(check_admin_5)) | ||||||
|  | # | ||||||
|             check_admin_6 = instantiate_profile_obj.check_admin_state_6ghz(ap_name=self.lab_info['access_point'][ap_name]["ap_name"]) | #             check_admin_6 = instantiate_profile_obj.check_admin_state_6ghz(ap_name=self.lab_info['access_point'][ap_name]["ap_name"]) | ||||||
|             allure.attach(name="6ghz ap admin state for " + str(ap_name + 1) + " ap", body=str(check_admin_6)) | #             allure.attach(name="6ghz ap admin state for " + str(ap_name + 1) + " ap", body=str(check_admin_6)) | ||||||
|  | # | ||||||
|             # table1.append(tab) | #             # table1.append(tab) | ||||||
|  | # | ||||||
|  | # | ||||||
|             if ap_name == 0: | #             if ap_name == 0: | ||||||
|                 for band in range(len(lf_dut_data)): | #                 for band in range(len(lf_dut_data)): | ||||||
|                     if lf_dut_data[band]["appliedRadios"] == ["2G"]: | #                     if lf_dut_data[band]["appliedRadios"] == ["2G"]: | ||||||
|                         instantiate_profile_obj.no_logging_console() | #                         instantiate_profile_obj.no_logging_console() | ||||||
|                         instantiate_profile_obj.line_console() | #                         instantiate_profile_obj.line_console() | ||||||
|                         id_slot = instantiate_profile_obj.get_slot_id_wlan() | #                         id_slot = instantiate_profile_obj.get_slot_id_wlan() | ||||||
|                         ssid_name = instantiate_profile_obj.get_ssid_name_on_id() | #                         ssid_name = instantiate_profile_obj.get_ssid_name_on_id() | ||||||
|                         if id_slot[0] == "1": | #                         if id_slot[0] == "1": | ||||||
|                             instantiate_profile_obj.show_shutdown_2ghz_ap() | #                             instantiate_profile_obj.show_shutdown_2ghz_ap() | ||||||
|                             instantiate_profile_obj.disable_wlan(wlan=ssid_name[0]) | #                             instantiate_profile_obj.disable_wlan(wlan=ssid_name[0]) | ||||||
|                             instantiate_profile_obj.ap_2ghz_shutdown() | #                             instantiate_profile_obj.ap_2ghz_shutdown() | ||||||
|                             instantiate_profile_obj.get_ssids() | #                             instantiate_profile_obj.get_ssids() | ||||||
|                             instantiate_profile_obj.delete_wlan(ssid=ssid_name[0]) | #                             instantiate_profile_obj.delete_wlan(ssid=ssid_name[0]) | ||||||
|                             instantiate_profile_obj.get_ssids() | #                             instantiate_profile_obj.get_ssids() | ||||||
|                             instantiate_profile_obj.create_wlan_wpa2(id="1", wlan=lf_dut_data[0]['ssid_name'], | #                             instantiate_profile_obj.create_wlan_wpa2(id="1", wlan=lf_dut_data[0]['ssid_name'], | ||||||
|                                                                      wlanssid=lf_dut_data[0]['ssid_name'], | #                                                                      wlanssid=lf_dut_data[0]['ssid_name'], | ||||||
|                                                                      key=lf_dut_data[0]['security_key']) | #                                                                      key=lf_dut_data[0]['security_key']) | ||||||
|                         else: | #                         else: | ||||||
|                             print(lf_dut_data[0]['ssid_name']) | #                             print(lf_dut_data[0]['ssid_name']) | ||||||
|                             instantiate_profile_obj.get_ssids() | #                             instantiate_profile_obj.get_ssids() | ||||||
|                             instantiate_profile_obj.show_shutdown_2ghz_ap() | #                             instantiate_profile_obj.show_shutdown_2ghz_ap() | ||||||
|                             instantiate_profile_obj.get_ssids() | #                             instantiate_profile_obj.get_ssids() | ||||||
|                             instantiate_profile_obj.create_wlan_wpa2(id="1", wlan=lf_dut_data[0]['ssid_name'], | #                             instantiate_profile_obj.create_wlan_wpa2(id="1", wlan=lf_dut_data[0]['ssid_name'], | ||||||
|                                                                      wlanssid=lf_dut_data[0]['ssid_name'], | #                                                                      wlanssid=lf_dut_data[0]['ssid_name'], | ||||||
|                                                                      key=lf_dut_data[0]['security_key']) | #                                                                      key=lf_dut_data[0]['security_key']) | ||||||
|                             instantiate_profile_obj.get_ssids() | #                             instantiate_profile_obj.get_ssids() | ||||||
|  | # | ||||||
|                         if "roam_type" not in list_key: | #                         if "roam_type" not in list_key: | ||||||
|                             # add wlan to single ap | #                             # add wlan to single ap | ||||||
|                             instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile(wlan=lf_dut_data[0]['ssid_name']) | #                             instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile(wlan=lf_dut_data[0]['ssid_name']) | ||||||
|                         instantiate_profile_obj.enable_wlan( wlan=lf_dut_data[0]['ssid_name']) | #                         instantiate_profile_obj.enable_wlan( wlan=lf_dut_data[0]['ssid_name']) | ||||||
|                         instantiate_profile_obj.enable_2ghz_netwrk(id="1", wlan=lf_dut_data[0]['ssid_name'], | #                         instantiate_profile_obj.enable_2ghz_netwrk(id="1", wlan=lf_dut_data[0]['ssid_name'], | ||||||
|                                                                    wlanssid=lf_dut_data[0]['ssid_name'], | #                                                                    wlanssid=lf_dut_data[0]['ssid_name'], | ||||||
|                                                                    key=lf_dut_data[0]['security_key']) | #                                                                    key=lf_dut_data[0]['security_key']) | ||||||
|                         instantiate_profile_obj.enable_ap_2ghz() | #                         instantiate_profile_obj.enable_ap_2ghz() | ||||||
|                         if parameter["ft+psk"] == True: | #                         if parameter["ft+psk"] == True: | ||||||
|                             instantiate_profile_obj.enable_ft_psk(ssid=lf_dut_data[0]['ssid_name'], | #                             instantiate_profile_obj.enable_ft_psk(ssid=lf_dut_data[0]['ssid_name'], | ||||||
|                                                                   key=lf_dut_data[0]['security_key']) | #                                                                   key=lf_dut_data[0]['security_key']) | ||||||
|                         if parameter["ft-otd"] == True: | #                         if parameter["ft-otd"] == True: | ||||||
|                             instantiate_profile_obj.enable_ftotd_psk(ssid=lf_dut_data[0]['ssid_name'], | #                             instantiate_profile_obj.enable_ftotd_psk(ssid=lf_dut_data[0]['ssid_name'], | ||||||
|                                                                   key=lf_dut_data[0]['security_key']) | #                                                                   key=lf_dut_data[0]['security_key']) | ||||||
|  | # | ||||||
|                         if 'dtim' in list_key: | #                         if 'dtim' in list_key: | ||||||
|                             instantiate_profile_obj.set_dtim_2ghz(wlan=lf_dut_data[0]['ssid_name'], value=parameter["dtim"]) | #                             instantiate_profile_obj.set_dtim_2ghz(wlan=lf_dut_data[0]['ssid_name'], value=parameter["dtim"]) | ||||||
|                         instantiate_profile_obj.get_ssids() | #                         instantiate_profile_obj.get_ssids() | ||||||
|  | # | ||||||
|                     if lf_dut_data[band]["appliedRadios"] == ["5G"]: | #                     if lf_dut_data[band]["appliedRadios"] == ["5G"]: | ||||||
|                         instantiate_profile_obj.no_logging_console() | #                         instantiate_profile_obj.no_logging_console() | ||||||
|                         instantiate_profile_obj.line_console() | #                         instantiate_profile_obj.line_console() | ||||||
|                         id_slot = instantiate_profile_obj.get_slot_id_wlan() | #                         id_slot = instantiate_profile_obj.get_slot_id_wlan() | ||||||
|                         print(id_slot) | #                         print(id_slot) | ||||||
|                         ssid_name = instantiate_profile_obj.get_ssid_name_on_id() | #                         ssid_name = instantiate_profile_obj.get_ssid_name_on_id() | ||||||
|                         print(ssid_name) | #                         print(ssid_name) | ||||||
|                         if id_slot[1] == "2": | #                         if id_slot[1] == "2": | ||||||
|                             # if ssid present on slot 2 delete it and create new | #                             # if ssid present on slot 2 delete it and create new | ||||||
|                             instantiate_profile_obj.show_shutdown_5ghz_ap() | #                             instantiate_profile_obj.show_shutdown_5ghz_ap() | ||||||
|                             instantiate_profile_obj.disable_wlan(wlan=ssid_name[1]) | #                             instantiate_profile_obj.disable_wlan(wlan=ssid_name[1]) | ||||||
|                             instantiate_profile_obj.ap_5ghz_shutdown() | #                             instantiate_profile_obj.ap_5ghz_shutdown() | ||||||
|                             instantiate_profile_obj.get_ssids() | #                             instantiate_profile_obj.get_ssids() | ||||||
|                             instantiate_profile_obj.delete_wlan(ssid=ssid_name[1]) | #                             instantiate_profile_obj.delete_wlan(ssid=ssid_name[1]) | ||||||
|                             instantiate_profile_obj.get_ssids() | #                             instantiate_profile_obj.get_ssids() | ||||||
|                             instantiate_profile_obj.create_wlan_wpa2(id="2", wlan=lf_dut_data[1]['ssid_name'], | #                             instantiate_profile_obj.create_wlan_wpa2(id="2", wlan=lf_dut_data[1]['ssid_name'], | ||||||
|                                                                      wlanssid=lf_dut_data[1]['ssid_name'], | #                                                                      wlanssid=lf_dut_data[1]['ssid_name'], | ||||||
|                                                                      key=lf_dut_data[1]['security_key']) | #                                                                      key=lf_dut_data[1]['security_key']) | ||||||
|                         else: | #                         else: | ||||||
|                             print(lf_dut_data[1]['ssid_name']) | #                             print(lf_dut_data[1]['ssid_name']) | ||||||
|                             instantiate_profile_obj.get_ssids() | #                             instantiate_profile_obj.get_ssids() | ||||||
|                             instantiate_profile_obj.show_shutdown_5ghz_ap() | #                             instantiate_profile_obj.show_shutdown_5ghz_ap() | ||||||
|                             instantiate_profile_obj.get_ssids() | #                             instantiate_profile_obj.get_ssids() | ||||||
|                             instantiate_profile_obj.create_wlan_wpa2(id="2", wlan=lf_dut_data[1]['ssid_name'], | #                             instantiate_profile_obj.create_wlan_wpa2(id="2", wlan=lf_dut_data[1]['ssid_name'], | ||||||
|                                                                      wlanssid=lf_dut_data[1]['ssid_name'], | #                                                                      wlanssid=lf_dut_data[1]['ssid_name'], | ||||||
|                                                                      key=lf_dut_data[1]['security_key']) | #                                                                      key=lf_dut_data[1]['security_key']) | ||||||
|                             instantiate_profile_obj.get_ssids() | #                             instantiate_profile_obj.get_ssids() | ||||||
|  | # | ||||||
|                         if "roam_type" not in list_key: | #                         if "roam_type" not in list_key: | ||||||
|                             instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile(wlan=lf_dut_data[1]['ssid_name']) | #                             instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile(wlan=lf_dut_data[1]['ssid_name']) | ||||||
|                         instantiate_profile_obj.enable_wlan(wlan=lf_dut_data[1]['ssid_name']) | #                         instantiate_profile_obj.enable_wlan(wlan=lf_dut_data[1]['ssid_name']) | ||||||
|                         instantiate_profile_obj.enable_5ghz_netwrk(id="2", wlan=lf_dut_data[1]['ssid_name'], | #                         instantiate_profile_obj.enable_5ghz_netwrk(id="2", wlan=lf_dut_data[1]['ssid_name'], | ||||||
|                                                                    wlanssid=lf_dut_data[1]['ssid_name'], | #                                                                    wlanssid=lf_dut_data[1]['ssid_name'], | ||||||
|                                                                    key=lf_dut_data[1]['security_key']) | #                                                                    key=lf_dut_data[1]['security_key']) | ||||||
|                         instantiate_profile_obj.enable_ap_5ghz() | #                         instantiate_profile_obj.enable_ap_5ghz() | ||||||
|                         if parameter["ft+psk"] == True: | #                         if parameter["ft+psk"] == True: | ||||||
|                             instantiate_profile_obj.enable_ft_psk(ssid=lf_dut_data[1]['ssid_name'], | #                             instantiate_profile_obj.enable_ft_psk(ssid=lf_dut_data[1]['ssid_name'], | ||||||
|                                                                   key=lf_dut_data[1]['security_key']) | #                                                                   key=lf_dut_data[1]['security_key']) | ||||||
|                         if parameter["ft-otd"] == True: | #                         if parameter["ft-otd"] == True: | ||||||
|                             instantiate_profile_obj.enable_ftotd_psk(ssid=lf_dut_data[1]['ssid_name'], | #                             instantiate_profile_obj.enable_ftotd_psk(ssid=lf_dut_data[1]['ssid_name'], | ||||||
|                                                                   key=lf_dut_data[1]['security_key']) | #                                                                   key=lf_dut_data[1]['security_key']) | ||||||
|                         if 'dtim' in list_key: | #                         if 'dtim' in list_key: | ||||||
|                             instantiate_profile_obj.set_dtim_5ghz(wlan=lf_dut_data[1]['ssid_name'], value=parameter["dtim"]) | #                             instantiate_profile_obj.set_dtim_5ghz(wlan=lf_dut_data[1]['ssid_name'], value=parameter["dtim"]) | ||||||
|  | # | ||||||
|                         instantiate_profile_obj.get_ssids() | #                         instantiate_profile_obj.get_ssids() | ||||||
|                     if lf_dut_data[band]["appliedRadios"] == ["6G"]: | #                     if lf_dut_data[band]["appliedRadios"] == ["6G"]: | ||||||
|                         instantiate_profile_obj.no_logging_console() | #                         instantiate_profile_obj.no_logging_console() | ||||||
|                         instantiate_profile_obj.line_console() | #                         instantiate_profile_obj.line_console() | ||||||
|                         id_slot = instantiate_profile_obj.get_slot_id_wlan() | #                         id_slot = instantiate_profile_obj.get_slot_id_wlan() | ||||||
|                         print(id_slot) | #                         print(id_slot) | ||||||
|                         ssid_name = instantiate_profile_obj.get_ssid_name_on_id() | #                         ssid_name = instantiate_profile_obj.get_ssid_name_on_id() | ||||||
|                         print(ssid_name) | #                         print(ssid_name) | ||||||
|                         if id_slot[2] == "3": | #                         if id_slot[2] == "3": | ||||||
|                             instantiate_profile_obj.show_shutdown_6ghz_ap() | #                             instantiate_profile_obj.show_shutdown_6ghz_ap() | ||||||
|                             # instantiate_profile_obj.show_shutdown_5ghz_ap() | #                             # instantiate_profile_obj.show_shutdown_5ghz_ap() | ||||||
|                             # instantiate_profile_obj.show_shutdown_2ghz_ap() | #                             # instantiate_profile_obj.show_shutdown_2ghz_ap() | ||||||
|                             instantiate_profile_obj.disable_wlan(wlan=ssid_name[2]) | #                             instantiate_profile_obj.disable_wlan(wlan=ssid_name[2]) | ||||||
|                             instantiate_profile_obj.ap_6ghz_shutdown() | #                             instantiate_profile_obj.ap_6ghz_shutdown() | ||||||
|                             instantiate_profile_obj.get_ssids() | #                             instantiate_profile_obj.get_ssids() | ||||||
|                             instantiate_profile_obj.delete_wlan(ssid=ssid_name[2]) | #                             instantiate_profile_obj.delete_wlan(ssid=ssid_name[2]) | ||||||
|                             instantiate_profile_obj.get_ssids() | #                             instantiate_profile_obj.get_ssids() | ||||||
|                             instantiate_profile_obj.create_wlan_wpa3(id="3", wlan=lf_dut_data[2]['ssid_name'], | #                             instantiate_profile_obj.create_wlan_wpa3(id="3", wlan=lf_dut_data[2]['ssid_name'], | ||||||
|                                                                               wlanssid=lf_dut_data[2]['ssid_name'], | #                                                                               wlanssid=lf_dut_data[2]['ssid_name'], | ||||||
|                                                                               key=lf_dut_data[2]['security_key']) | #                                                                               key=lf_dut_data[2]['security_key']) | ||||||
|                         else: | #                         else: | ||||||
|                             instantiate_profile_obj.get_ssids() | #                             instantiate_profile_obj.get_ssids() | ||||||
|                             instantiate_profile_obj.show_shutdown_6ghz_ap() | #                             instantiate_profile_obj.show_shutdown_6ghz_ap() | ||||||
|                             instantiate_profile_obj.get_ssids() | #                             instantiate_profile_obj.get_ssids() | ||||||
|                             instantiate_profile_obj.create_wlan_wpa3(id="3", wlan=lf_dut_data[2]['ssid_name'], | #                             instantiate_profile_obj.create_wlan_wpa3(id="3", wlan=lf_dut_data[2]['ssid_name'], | ||||||
|                                                                      wlanssid=lf_dut_data[2]['ssid_name'], | #                                                                      wlanssid=lf_dut_data[2]['ssid_name'], | ||||||
|                                                                      key=lf_dut_data[2]['security_key']) | #                                                                      key=lf_dut_data[2]['security_key']) | ||||||
|                             instantiate_profile_obj.get_ssids() | #                             instantiate_profile_obj.get_ssids() | ||||||
|  | # | ||||||
|                         if "roam_type" not in list_key: | #                         if "roam_type" not in list_key: | ||||||
|                             instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile( | #                             instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile( | ||||||
|                                 wlan=lf_dut_data[2]['ssid_name']) | #                                 wlan=lf_dut_data[2]['ssid_name']) | ||||||
|                         instantiate_profile_obj.enable_wlan( wlan=lf_dut_data[2]['ssid_name']) | #                         instantiate_profile_obj.enable_wlan( wlan=lf_dut_data[2]['ssid_name']) | ||||||
|                         instantiate_profile_obj.enable_6ghz_netwrk(id="3", wlan=lf_dut_data[2]['ssid_name'], | #                         instantiate_profile_obj.enable_6ghz_netwrk(id="3", wlan=lf_dut_data[2]['ssid_name'], | ||||||
|                                                                    wlanssid=lf_dut_data[2]['ssid_name'], | #                                                                    wlanssid=lf_dut_data[2]['ssid_name'], | ||||||
|                                                                    key=lf_dut_data[2]['security_key']) | #                                                                    key=lf_dut_data[2]['security_key']) | ||||||
|                         instantiate_profile_obj.enable_ap_6ghz() | #                         instantiate_profile_obj.enable_ap_6ghz() | ||||||
|                         # if parameter["ft+psk"] == True: | #                         # if parameter["ft+psk"] == True: | ||||||
|                         #      instantiate_profile_obj.enable_ft_sae(ssid=lf_dut_data[2]['ssid_name'], key=lf_dut_data[2]['security_key']) | #                         #      instantiate_profile_obj.enable_ft_sae(ssid=lf_dut_data[2]['ssid_name'], key=lf_dut_data[2]['security_key']) | ||||||
|                         if parameter["ft-dot1x"] == True: | #                         if parameter["ft-dot1x"] == True: | ||||||
|                             instantiate_profile_obj.enable_ft_dot1x_wpa3(ssid=lf_dut_data[2]['ssid_name']) | #                             instantiate_profile_obj.enable_ft_dot1x_wpa3(ssid=lf_dut_data[2]['ssid_name']) | ||||||
|                         if parameter["ft-dot1x_sha256"] == True: | #                         if parameter["ft-dot1x_sha256"] == True: | ||||||
|                             instantiate_profile_obj.enable_ft_dot1x_sha256_wpa3(ssid=lf_dut_data[2]['ssid_name'], | #                             instantiate_profile_obj.enable_ft_dot1x_sha256_wpa3(ssid=lf_dut_data[2]['ssid_name'], | ||||||
|                                                                                 radius=get_configuration['controller']["radius"]) | #                                                                                 radius=get_configuration['controller']["radius"]) | ||||||
|                         instantiate_profile_obj.get_ssids() | #                         instantiate_profile_obj.get_ssids() | ||||||
|  | # | ||||||
|         twog_sum = instantiate_profile_obj.show_2ghz_summary() | #         twog_sum = instantiate_profile_obj.show_2ghz_summary() | ||||||
|         fiveg_sum = instantiate_profile_obj.show_5ghz_summary() | #         fiveg_sum = instantiate_profile_obj.show_5ghz_summary() | ||||||
|         sixg_sum = instantiate_profile_obj.show_6ghz_summary() | #         sixg_sum = instantiate_profile_obj.show_6ghz_summary() | ||||||
|         allure.attach(name="ap admin state 2ghz ", body=str(twog_sum)) | #         allure.attach(name="ap admin state 2ghz ", body=str(twog_sum)) | ||||||
|         allure.attach(name="ap admin state 5ghz ", body=str(fiveg_sum)) | #         allure.attach(name="ap admin state 5ghz ", body=str(fiveg_sum)) | ||||||
|         allure.attach(name="ap admin state 6ghz", body=str(sixg_sum)) | #         allure.attach(name="ap admin state 6ghz", body=str(sixg_sum)) | ||||||
|         sumy = instantiate_profile_obj.get_ssids() | #         sumy = instantiate_profile_obj.get_ssids() | ||||||
|         allure.attach(name="wlan summary after creating test wlan", body=str(sumy)) | #         allure.attach(name="wlan summary after creating test wlan", body=str(sumy)) | ||||||
|         if "roam_type" in list_key: | #         if "roam_type" in list_key: | ||||||
|             print("after creating wlan's assign wlan to respective tag policy") | #             print("after creating wlan's assign wlan to respective tag policy") | ||||||
|             for ap_name in range(len(self.lab_info['access_point'])): | #             for ap_name in range(len(self.lab_info['access_point'])): | ||||||
|                 print("ap ", ap_name) | #                 print("ap ", ap_name) | ||||||
|                 instantiate_profile_obj = instantiate_profile(controller_data=get_configuration['controller'], timeout="10", | #                 instantiate_profile_obj = instantiate_profile(controller_data=get_configuration['controller'], timeout="10", | ||||||
|                                                               ssid_data=lf_dut_data, ap_data=self.lab_info['access_point'], | #                                                               ssid_data=lf_dut_data, ap_data=self.lab_info['access_point'], | ||||||
|                                                               type=ap_name) | #                                                               type=ap_name) | ||||||
|                 if parameter["roam_type"] == "fiveg_to_fiveg": | #                 if parameter["roam_type"] == "fiveg_to_fiveg": | ||||||
|                     # add 5g wlan to both ap's | #                     # add 5g wlan to both ap's | ||||||
|                     instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile(wlan=lf_dut_data[1]['ssid_name']) | #                     instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile(wlan=lf_dut_data[1]['ssid_name']) | ||||||
|                 if parameter["roam_type"] == "fiveg_to_sixg": | #                 if parameter["roam_type"] == "fiveg_to_sixg": | ||||||
|                     if ap_name == 0: | #                     if ap_name == 0: | ||||||
|                         # add 5g ssid to 5g ap | #                         # add 5g ssid to 5g ap | ||||||
|                         instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile(wlan=lf_dut_data[1]['ssid_name']) | #                         instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile(wlan=lf_dut_data[1]['ssid_name']) | ||||||
|                     if ap_name == 1: | #                     if ap_name == 1: | ||||||
|                         # add 6g ssid to 6g ap | #                         # add 6g ssid to 6g ap | ||||||
|                         instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile(wlan=lf_dut_data[2]['ssid_name']) | #                         instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile(wlan=lf_dut_data[2]['ssid_name']) | ||||||
|  | # | ||||||
|                 else: | #                 else: | ||||||
|                     instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile( | #                     instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile( | ||||||
|                         wlan=lf_dut_data[0]['ssid_name']) | #                         wlan=lf_dut_data[0]['ssid_name']) | ||||||
|                     instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile( | #                     instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile( | ||||||
|                         wlan=lf_dut_data[1]['ssid_name']) | #                         wlan=lf_dut_data[1]['ssid_name']) | ||||||
|                     instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile( | #                     instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile( | ||||||
|                         wlan=lf_dut_data[2]['ssid_name']) | #                         wlan=lf_dut_data[2]['ssid_name']) | ||||||
|  | # | ||||||
|  | # | ||||||
|  | # | ||||||
|  | # | ||||||
|         bssid_list_2g = [] | #         bssid_list_2g = [] | ||||||
|         bssid_list_5g = [] | #         bssid_list_5g = [] | ||||||
|         ssid_data_list = [] | #         ssid_data_list = [] | ||||||
|  | # | ||||||
|         for ap_name in range(len(self.lab_info['access_point'])): | #         for ap_name in range(len(self.lab_info['access_point'])): | ||||||
|             print("ap ", ap_name) | #             print("ap ", ap_name) | ||||||
|             # instantiate controller object | #             # instantiate controller object | ||||||
|             instantiate_profile_obj = instantiate_profile(controller_data=get_configuration['controller'], timeout="10", | #             instantiate_profile_obj = instantiate_profile(controller_data=get_configuration['controller'], timeout="10", | ||||||
|                                                       ssid_data=lf_dut_data, ap_data=self.lab_info['access_point'], type=ap_name) | #                                                       ssid_data=lf_dut_data, ap_data=self.lab_info['access_point'], type=ap_name) | ||||||
|             bss2_info = instantiate_profile_obj.get_ap_bssid_2g() | #             bss2_info = instantiate_profile_obj.get_ap_bssid_2g() | ||||||
|             allure.attach(name="wlan 2g bssid info", body=str(bss2_info)) | #             allure.attach(name="wlan 2g bssid info", body=str(bss2_info)) | ||||||
|             bss5_info = instantiate_profile_obj.get_ap_bssid_5g() | #             bss5_info = instantiate_profile_obj.get_ap_bssid_5g() | ||||||
|             allure.attach(name="wlan 5g bssid info", body=str(bss5_info)) | #             allure.attach(name="wlan 5g bssid info", body=str(bss5_info)) | ||||||
|             bss6_info = instantiate_profile_obj.get_ap_bssid_6g() | #             bss6_info = instantiate_profile_obj.get_ap_bssid_6g() | ||||||
|             allure.attach(name="wlan 6g bssid info", body=str(bss6_info)) | #             allure.attach(name="wlan 6g bssid info", body=str(bss6_info)) | ||||||
|  | # | ||||||
|             bssid_2g = instantiate_profile_obj.cal_bssid_2g() | #             bssid_2g = instantiate_profile_obj.cal_bssid_2g() | ||||||
|             print("bssid 2g", bssid_2g) | #             print("bssid 2g", bssid_2g) | ||||||
|             lst_2g = bssid_list_2g.append(bssid_2g) | #             lst_2g = bssid_list_2g.append(bssid_2g) | ||||||
|  | # | ||||||
|             bssid_5g = instantiate_profile_obj.cal_bssid_5g() | #             bssid_5g = instantiate_profile_obj.cal_bssid_5g() | ||||||
|             print("bssid 5g ", bssid_5g) | #             print("bssid 5g ", bssid_5g) | ||||||
|             lst_5g = bssid_list_5g.append(bssid_5g) | #             lst_5g = bssid_list_5g.append(bssid_5g) | ||||||
|             # print(bssid_5g) | #             # print(bssid_5g) | ||||||
|             # print(bssid_list_2g) | #             # print(bssid_list_2g) | ||||||
|             # print(bssid_list_5g) | #             # print(bssid_list_5g) | ||||||
|             ssid_data = [] | #             ssid_data = [] | ||||||
|             try: | #             try: | ||||||
|                 idx_mapping = {} | #                 idx_mapping = {} | ||||||
|                 bssid = "" | #                 bssid = "" | ||||||
|                 for interface in range(len(lf_dut_data)): | #                 for interface in range(len(lf_dut_data)): | ||||||
|                     if interface == 0: | #                     if interface == 0: | ||||||
|                         bssid = bssid_2g | #                         bssid = bssid_2g | ||||||
|                     if interface == 1: | #                     if interface == 1: | ||||||
|                         bssid = bssid_5g | #                         bssid = bssid_5g | ||||||
|                     if lf_dut_data[interface]['security'] == "psk2": | #                     if lf_dut_data[interface]['security'] == "psk2": | ||||||
|                         lf_dut_data[interface]['security'] = "WPA2" | #                         lf_dut_data[interface]['security'] = "WPA2" | ||||||
|                     ssid = ["ssid_idx=" + str(interface) + | #                     ssid = ["ssid_idx=" + str(interface) + | ||||||
|                             " ssid=" + lf_dut_data[interface]['ssid_name'] + | #                             " ssid=" + lf_dut_data[interface]['ssid_name'] + | ||||||
|                             " security=" + lf_dut_data[interface]['security'] + | #                             " security=" + lf_dut_data[interface]['security'] + | ||||||
|                             " password=" + lf_dut_data[interface]['security_key'] + | #                             " password=" + lf_dut_data[interface]['security_key'] + | ||||||
|                             " bssid=" + bssid | #                             " bssid=" + bssid | ||||||
|                             ] | #                             ] | ||||||
|                     ssid_data.append(ssid) | #                     ssid_data.append(ssid) | ||||||
|  | # | ||||||
|             except Exception as e: | #             except Exception as e: | ||||||
|                 print(e) | #                 print(e) | ||||||
|                 pass | #                 pass | ||||||
|             # print("nikita",ssid_data) | #             # print("nikita",ssid_data) | ||||||
|             ssid_data_list.append(ssid_data) | #             ssid_data_list.append(ssid_data) | ||||||
|         print("final ssid data", ssid_data_list) | #         print("final ssid data", ssid_data_list) | ||||||
|         # ssid_data = [[['ssid_idx=0 ssid=ssid_wpa2_2g security=WPA2 password=something bssid=68:7d:b4:5f:5c:30'], | #         # ssid_data = [[['ssid_idx=0 ssid=ssid_wpa2_2g security=WPA2 password=something bssid=68:7d:b4:5f:5c:30'], | ||||||
|         #               ['ssid_idx=1 ssid=ssid_wpa2_5g security=WPA2 password=something bssid=68:7d:b4:5f:5c:3e']], | #         #               ['ssid_idx=1 ssid=ssid_wpa2_5g security=WPA2 password=something bssid=68:7d:b4:5f:5c:3e']], | ||||||
|         #              [['ssid_idx=0 ssid=ssid_wpa2_2g security=WPA2 password=something bssid=14:16:9d:53:58:c0'], | #         #              [['ssid_idx=0 ssid=ssid_wpa2_2g security=WPA2 password=something bssid=14:16:9d:53:58:c0'], | ||||||
|         #               ['ssid_idx=1 ssid=ssid_wpa2_5g security=WPA2 password=something bssid=14:16:9d:53:58:ce']]] | #         #               ['ssid_idx=1 ssid=ssid_wpa2_5g security=WPA2 password=something bssid=14:16:9d:53:58:ce']]] | ||||||
|         lf_tools.create_non_meh_dut(ssid_data=ssid_data_list) | #         lf_tools.create_non_meh_dut(ssid_data=ssid_data_list) | ||||||
|         table1 = [["show ap summary", "done"], ["Configure wlan", "done"], ["configure channel/width", "done"], | #         table1 = [["show ap summary", "done"], ["Configure wlan", "done"], ["configure channel/width", "done"], | ||||||
|                   ["ap admin state up", "done"], ["checking admin state of ap", "done"], | #                   ["ap admin state up", "done"], ["checking admin state of ap", "done"], | ||||||
|                   ["sniffer capture", "done"], | #                   ["sniffer capture", "done"], | ||||||
|                   ["client connect", "don"], ["roam", "done"], ["sniffer verification", "done"], | #                   ["client connect", "don"], ["roam", "done"], ["sniffer verification", "done"], | ||||||
|                   ["iteration", "done"], | #                   ["iteration", "done"], | ||||||
|                   ["table display", "done"], ["check in controller client connected", "done"], | #                   ["table display", "done"], ["check in controller client connected", "done"], | ||||||
|                   ["Bring down unused band before start of testcase", "done"]] | #                   ["Bring down unused band before start of testcase", "done"]] | ||||||
|         tab1 = lf_reports.table2(table=table1) | #         tab1 = lf_reports.table2(table=table1) | ||||||
|         allure.attach(name="skeleton of code", body=str(tab1)) | #         allure.attach(name="skeleton of code", body=str(tab1)) | ||||||
|  | # | ||||||
|  | # | ||||||
|  | # | ||||||
|  | # | ||||||
|  | # | ||||||
|  | # | ||||||
|  | # | ||||||
|  | # | ||||||
|  | # | ||||||
|   | |||||||
							
								
								
									
										41
									
								
								tests/imports.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								tests/imports.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,41 @@ | |||||||
|  | """ | ||||||
|  |     Registered Target Imports | ||||||
|  |  | ||||||
|  | """ | ||||||
|  | import sys | ||||||
|  | import importlib | ||||||
|  | sys.path.append('/usr/local/bin') | ||||||
|  | ######################################################################################################################## | ||||||
|  | """ | ||||||
|  |     Target Name:tip_2x | ||||||
|  |     Target Module:tip-2x-0.1 | ||||||
|  |     Author Name:Shivam Thakur | ||||||
|  |     Organization:Telecom Infra Project | ||||||
|  |     Register ID:1 | ||||||
|  |     Email:shivam.thakur@candelatech.com | ||||||
|  |     description:TIP OpenWIFI 2.X Library | ||||||
|  | """ | ||||||
|  | try: | ||||||
|  |     target = importlib.import_module("tip_2x") | ||||||
|  |     target = target.tip_2x | ||||||
|  | except ImportError as e: | ||||||
|  |     print(e) | ||||||
|  |     sys.exit("Python Import Error: " + str(e)) | ||||||
|  | ######################################################################################################################## | ||||||
|  | # ###################################################################################################################### | ||||||
|  | # """ | ||||||
|  | #     Target Name:<Vendor-Package-Name> | ||||||
|  | #     Target Module:<Vendor-Package-Name-0.1> | ||||||
|  | #     Author Name:<Author Name> | ||||||
|  | #     Organization:<Vendor Organization Name> | ||||||
|  | #     Register ID:2 | ||||||
|  | #     Email:shivam.thakur@candelatech.com | ||||||
|  | #     description:<Description of Library> | ||||||
|  | # """ | ||||||
|  | # try: | ||||||
|  | #     target = importlib.import_module("tip_2x") | ||||||
|  | #     target = target.tip_2x | ||||||
|  | # except ImportError as e: | ||||||
|  | #     print(e) | ||||||
|  | #     sys.exit("Python Import Error: " + str(e)) | ||||||
|  | # ###################################################################################################################### | ||||||
| @@ -2,12 +2,13 @@ | |||||||
|  |  | ||||||
| "CONFIGURATION" : { | "CONFIGURATION" : { | ||||||
|     "basic-01": { |     "basic-01": { | ||||||
|  |         "target": "tip_2x", | ||||||
|         "controller": { |         "controller": { | ||||||
|             "url": "https://sec-qa01.cicd.lab.wlan.tip.build:16001", |             "url": "https://sec-qa01.cicd.lab.wlan.tip.build:16001", | ||||||
|             "username": "tip@ucentral.com", |             "username": "tip@ucentral.com", | ||||||
|             "password": "OpenWifi%123" |             "password": "OpenWifi%123" | ||||||
|         }, |         }, | ||||||
|         "access_point": [ |         "device_under_tests": [ | ||||||
|             { |             { | ||||||
|                 "model": "wallys_dr40x9", |                 "model": "wallys_dr40x9", | ||||||
|                 "mode": "wifi5", |                 "mode": "wifi5", | ||||||
|   | |||||||
| @@ -32,6 +32,6 @@ milestone=29 | |||||||
|  |  | ||||||
| filterwarnings=ignore::UserWarning | filterwarnings=ignore::UserWarning | ||||||
|  |  | ||||||
| markers=sanity: Run the sanity for Client Connectivity test | markers=ow_sanity_lf: Run the sanity for Client Connectivity test | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								tests/scan_ssid.csv
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								tests/scan_ssid.csv
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | |||||||
|  | ,age,auth,beacon,bss,channel,entity id,frequency,info,signal,ssid | ||||||
|  | 0,37900464,WPA2,100,00:06:ae:6f:6f:e6,1,1.1.4,2412,2x2 MCS 0-11 AX,-41.0,ssid_wpa2_dual_band | ||||||
|  | 1,4918,Open,100,90:3c:b3:9d:69:1b,1,1.1.4,2412,2x2 MCS 0-11 AX,-39.0,ssid_open_2g_vlan | ||||||
|  | 2,21029543,WPA,100,92:3c:b3:9d:69:1b,1,1.1.4,2412,2x2 MCS 0-11 AX,-38.0,ssid_wpa_2g | ||||||
|  | 3,21029518,WPA2,100,96:3c:b3:9d:69:1b,1,1.1.4,2412,2x2 MCS 0-11 AX,-39.0,ssid_wpa2_2g | ||||||
|  | 4,21029083,WPA WPA2,100,9a:3c:b3:9d:69:1b,1,1.1.4,2412,2x2 MCS 0-11 AX,-39.0,ssid_wpa_wpa2_p_m_2g | ||||||
| 
 | 
| @@ -324,3 +324,8 @@ class TestFMS(object): | |||||||
|             allure.attach(name=str(data['firmware']) + str(current_version_ap), body="") |             allure.attach(name=str(data['firmware']) + str(current_version_ap), body="") | ||||||
|             status.append(current_version_ap == data['firmware'].split()) |             status.append(current_version_ap == data['firmware'].split()) | ||||||
|         assert False not in status |         assert False not in status | ||||||
|  |  | ||||||
|  |  | ||||||
|  | @pytest.mark.shivam | ||||||
|  | def test_abc(get_target_object): | ||||||
|  |     assert True | ||||||
		Reference in New Issue
	
	Block a user
	 shivam
					shivam