mirror of
				https://github.com/Telecominfraproject/wlan-testing.git
				synced 2025-10-30 18:38:06 +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 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| if sys.version_info[0] != 3: | ||||
|     print("This script requires Python 3") | ||||
|     exit() | ||||
| 
 | ||||
| try: | ||||
|     import importlib | ||||
| 
 | ||||
|     re = importlib.import_module("re") | ||||
|     logging = importlib.import_module("logging") | ||||
|     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 sys | ||||
|  | ||||
| sys.path.append( | ||||
|     os.path.dirname( | ||||
|         os.path.realpath(__file__) | ||||
|     ) | ||||
| ) | ||||
| if "libs" not in sys.path: | ||||
|     sys.path.append(f'../libs') | ||||
|  | ||||
| from controller.controller_1x.controller import ProfileUtility | ||||
| from controller.controller_2x.controller import UProfileUtility | ||||
| from controller.controller_3x.controller import CController | ||||
| import time | ||||
| from lanforge.lf_tests import RunTest | ||||
| from lanforge.lf_tools import ChamberView | ||||
| import pytest | ||||
| import allure | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def instantiate_profile(request): | ||||
|     if request.config.getoption("1.x"): | ||||
|         yield ProfileUtility | ||||
|     elif request.config.getoption("cc.1"): | ||||
|         yield CController | ||||
|     else: | ||||
|         yield UProfileUtility | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def create_lanforge_chamberview(lf_tools): | ||||
|     scenario_object, scenario_name = lf_tools.Chamber_View() | ||||
|     return scenario_name | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def setup_vlan(): | ||||
|     vlan_id = [100] | ||||
|     allure.attach(body=str(vlan_id), name="VLAN Created: ") | ||||
|     yield vlan_id[0] | ||||
|  | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="class") | ||||
| def setup_profiles(request, setup_controller, testbed, get_equipment_ref, fixtures_ver, | ||||
|                    instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools, | ||||
|                    get_security_flags, get_configuration, radius_info, get_apnos, radius_accounting_info, | ||||
|                    run_lf, cc_1, lf_reports): | ||||
|     lf_tools.reset_scenario() | ||||
|     param = dict(request.param) | ||||
|  | ||||
|     # VLAN Setup | ||||
|     if request.param["mode"] == "VLAN": | ||||
|  | ||||
|         vlan_list = list() | ||||
|         refactored_vlan_list = list() | ||||
|         ssid_modes = request.param["ssid_modes"].keys() | ||||
|         for mode in ssid_modes: | ||||
|             for ssid in range(len(request.param["ssid_modes"][mode])): | ||||
|                 if "vlan" in request.param["ssid_modes"][mode][ssid]: | ||||
|                     vlan_list.append(request.param["ssid_modes"][mode][ssid]["vlan"]) | ||||
|                 else: | ||||
|                     pass | ||||
|         if vlan_list: | ||||
|             [refactored_vlan_list.append(x) for x in vlan_list if x not in refactored_vlan_list] | ||||
|             vlan_list = refactored_vlan_list | ||||
|             for i in range(len(vlan_list)): | ||||
|                 if vlan_list[i] > 4095 or vlan_list[i] < 1: | ||||
|                     vlan_list.pop(i) | ||||
|     if request.param["mode"] == "VLAN": | ||||
|         lf_tools.add_vlan(vlan_ids=vlan_list) | ||||
|     print("fixture version ", fixtures_ver) | ||||
|     if cc_1: | ||||
|         return_var = fixtures_ver.setup_profiles(request, param, run_lf, instantiate_profile, get_configuration, | ||||
|                                                  get_markers, | ||||
|                                                  lf_tools, lf_reports) | ||||
|     else: | ||||
|         return_var = fixtures_ver.setup_profiles(request, param, setup_controller, testbed, get_equipment_ref, | ||||
|                                              instantiate_profile, | ||||
|                                              get_markers, create_lanforge_chamberview_dut, lf_tools, | ||||
|                                              get_security_flags, get_configuration, radius_info, get_apnos, | ||||
|                                              radius_accounting_info, run_lf=run_lf) | ||||
|  | ||||
|     yield return_var | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def station_names_twog(request, get_configuration): | ||||
|     station_names = [] | ||||
|     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)) | ||||
|     yield station_names | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def station_names_fiveg(request, get_configuration): | ||||
|     station_names = [] | ||||
|     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)) | ||||
|     yield station_names | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def num_stations(request): | ||||
|     num_sta = int(request.config.getini("num_stations")) | ||||
|     yield num_sta | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="class") | ||||
| def get_vif_state(get_apnos, get_configuration): | ||||
|     ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") | ||||
|     vif_config = list(ap_ssh.get_vif_config_ssids()) | ||||
|     vif_state = list(ap_ssh.get_vif_state_ssids()) | ||||
|     vif_state.sort() | ||||
|     vif_config.sort() | ||||
|     allure.attach(name="vif_state", body=str(vif_state)) | ||||
|     yield vif_state | ||||
|  | ||||
| @pytest.fixture(scope="class") | ||||
| def get_vlan_list(get_apnos, get_configuration): | ||||
|     ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") | ||||
|     vlan_list = list(ap_ssh.get_vlan()) | ||||
|     vlan_list.sort() | ||||
|     allure.attach(name="vlan_list", body=str(vlan_list)) | ||||
|     yield vlan_list | ||||
|  | ||||
| # import os | ||||
| # import sys | ||||
| # | ||||
| # sys.path.append( | ||||
| #     os.path.dirname( | ||||
| #         os.path.realpath(__file__) | ||||
| #     ) | ||||
| # ) | ||||
| # if "libs" not in sys.path: | ||||
| #     sys.path.append(f'../libs') | ||||
| # | ||||
| # from controller.controller_1x.controller import ProfileUtility | ||||
| # from controller.controller_2x.controller import UProfileUtility | ||||
| # from controller.controller_3x.controller import CController | ||||
| # import time | ||||
| # from lanforge.lf_tests import RunTest | ||||
| # from lanforge.lf_tools import ChamberView | ||||
| # import pytest | ||||
| # import allure | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def instantiate_profile(request): | ||||
| #     if request.config.getoption("1.x"): | ||||
| #         yield ProfileUtility | ||||
| #     elif request.config.getoption("cc.1"): | ||||
| #         yield CController | ||||
| #     else: | ||||
| #         yield UProfileUtility | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def create_lanforge_chamberview(lf_tools): | ||||
| #     scenario_object, scenario_name = lf_tools.Chamber_View() | ||||
| #     return scenario_name | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def setup_vlan(): | ||||
| #     vlan_id = [100] | ||||
| #     allure.attach(body=str(vlan_id), name="VLAN Created: ") | ||||
| #     yield vlan_id[0] | ||||
| # | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="class") | ||||
| # def setup_profiles(request, setup_controller, testbed, get_equipment_ref, fixtures_ver, | ||||
| #                    instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools, | ||||
| #                    get_security_flags, get_configuration, radius_info, get_apnos, radius_accounting_info, | ||||
| #                    run_lf, cc_1, lf_reports): | ||||
| #     lf_tools.reset_scenario() | ||||
| #     param = dict(request.param) | ||||
| # | ||||
| #     # VLAN Setup | ||||
| #     if request.param["mode"] == "VLAN": | ||||
| # | ||||
| #         vlan_list = list() | ||||
| #         refactored_vlan_list = list() | ||||
| #         ssid_modes = request.param["ssid_modes"].keys() | ||||
| #         for mode in ssid_modes: | ||||
| #             for ssid in range(len(request.param["ssid_modes"][mode])): | ||||
| #                 if "vlan" in request.param["ssid_modes"][mode][ssid]: | ||||
| #                     vlan_list.append(request.param["ssid_modes"][mode][ssid]["vlan"]) | ||||
| #                 else: | ||||
| #                     pass | ||||
| #         if vlan_list: | ||||
| #             [refactored_vlan_list.append(x) for x in vlan_list if x not in refactored_vlan_list] | ||||
| #             vlan_list = refactored_vlan_list | ||||
| #             for i in range(len(vlan_list)): | ||||
| #                 if vlan_list[i] > 4095 or vlan_list[i] < 1: | ||||
| #                     vlan_list.pop(i) | ||||
| #     if request.param["mode"] == "VLAN": | ||||
| #         lf_tools.add_vlan(vlan_ids=vlan_list) | ||||
| #     print("fixture version ", fixtures_ver) | ||||
| #     if cc_1: | ||||
| #         return_var = fixtures_ver.setup_profiles(request, param, run_lf, instantiate_profile, get_configuration, | ||||
| #                                                  get_markers, | ||||
| #                                                  lf_tools, lf_reports) | ||||
| #     else: | ||||
| #         return_var = fixtures_ver.setup_profiles(request, param, setup_controller, testbed, get_equipment_ref, | ||||
| #                                              instantiate_profile, | ||||
| #                                              get_markers, create_lanforge_chamberview_dut, lf_tools, | ||||
| #                                              get_security_flags, get_configuration, radius_info, get_apnos, | ||||
| #                                              radius_accounting_info, run_lf=run_lf) | ||||
| # | ||||
| #     yield return_var | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def station_names_twog(request, get_configuration): | ||||
| #     station_names = [] | ||||
| #     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)) | ||||
| #     yield station_names | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def station_names_fiveg(request, get_configuration): | ||||
| #     station_names = [] | ||||
| #     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)) | ||||
| #     yield station_names | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def num_stations(request): | ||||
| #     num_sta = int(request.config.getini("num_stations")) | ||||
| #     yield num_sta | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="class") | ||||
| # def get_vif_state(get_apnos, get_configuration): | ||||
| #     ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") | ||||
| #     vif_config = list(ap_ssh.get_vif_config_ssids()) | ||||
| #     vif_state = list(ap_ssh.get_vif_state_ssids()) | ||||
| #     vif_state.sort() | ||||
| #     vif_config.sort() | ||||
| #     allure.attach(name="vif_state", body=str(vif_state)) | ||||
| #     yield vif_state | ||||
| # | ||||
| # @pytest.fixture(scope="class") | ||||
| # def get_vlan_list(get_apnos, get_configuration): | ||||
| #     ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") | ||||
| #     vlan_list = list(ap_ssh.get_vlan()) | ||||
| #     vlan_list.sort() | ||||
| #     allure.attach(name="vlan_list", body=str(vlan_list)) | ||||
| #     yield vlan_list | ||||
| # | ||||
|   | ||||
| @@ -1,152 +1,152 @@ | ||||
| import json | ||||
| import os | ||||
| import sys | ||||
|  | ||||
| sys.path.append( | ||||
|     os.path.dirname( | ||||
|         os.path.realpath(__file__) | ||||
|     ) | ||||
| ) | ||||
| if "libs" not in sys.path: | ||||
|     sys.path.append(f'../libs') | ||||
|  | ||||
| from controller.controller_1x.controller import ProfileUtility | ||||
| from controller.controller_2x.controller import UProfileUtility | ||||
| from controller.controller_3x.controller import CController | ||||
| import time | ||||
| from lanforge.lf_tools import ChamberView | ||||
| import pytest | ||||
| import allure | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def instantiate_profile(request): | ||||
|     if request.config.getoption("1.x"): | ||||
|         yield ProfileUtility | ||||
|     elif request.config.getoption("cc.1"): | ||||
|         yield CController | ||||
|     else: | ||||
|         yield UProfileUtility | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def create_lanforge_chamberview(lf_tools): | ||||
|     scenario_object, scenario_name = lf_tools.Chamber_View() | ||||
|     return scenario_name | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def create_lanforge_chamberview_dut(lf_tools, run_lf): | ||||
|     if not run_lf: | ||||
|         dut_object, dut_name = lf_tools.Create_Dut() | ||||
|         return dut_name | ||||
|     return "" | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="class") | ||||
| 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, | ||||
|                    get_security_flags, get_configuration, radius_info, get_apnos, radius_accounting_info, cc_1): | ||||
|     param = dict(request.param) | ||||
|  | ||||
|     # VLAN Setup | ||||
|     if request.param["mode"] == "VLAN": | ||||
|  | ||||
|         vlan_list = list() | ||||
|         refactored_vlan_list = list() | ||||
|         ssid_modes = request.param["ssid_modes"].keys() | ||||
|         for mode in ssid_modes: | ||||
|             for ssid in range(len(request.param["ssid_modes"][mode])): | ||||
|                 if "vlan" in request.param["ssid_modes"][mode][ssid]: | ||||
|                     vlan_list.append(request.param["ssid_modes"][mode][ssid]["vlan"]) | ||||
|                 else: | ||||
|                     pass | ||||
|         if vlan_list: | ||||
|             [refactored_vlan_list.append(x) for x in vlan_list if x not in refactored_vlan_list] | ||||
|             vlan_list = refactored_vlan_list | ||||
|             for i in range(len(vlan_list)): | ||||
|                 if vlan_list[i] > 4095 or vlan_list[i] < 1: | ||||
|                     vlan_list.pop(i) | ||||
|     if request.param["mode"] == "VLAN": | ||||
|         lf_tools.reset_scenario() | ||||
|         lf_tools.add_vlan(vlan_ids=vlan_list) | ||||
|  | ||||
|     # call this, if 1.x | ||||
|     print("fixture version ", fixtures_ver) | ||||
|     if cc_1: | ||||
|         return_var = fixtures_ver.setup_profiles(request, param, run_lf, instantiate_profile, get_configuration, get_markers, lf_tools) | ||||
|     else: | ||||
|         return_var = fixtures_ver.setup_profiles(request, param, setup_controller, testbed, get_equipment_ref, | ||||
|                                              instantiate_profile, | ||||
|                                              get_markers, create_lanforge_chamberview_dut, lf_tools, | ||||
|                                              get_security_flags, get_configuration, radius_info, get_apnos, | ||||
|                                              radius_accounting_info, run_lf=run_lf) | ||||
|  | ||||
|     yield return_var | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def station_names_twog(request, get_configuration): | ||||
|     station_names = [] | ||||
|     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)) | ||||
|     yield station_names | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def station_names_fiveg(request, get_configuration): | ||||
|     station_names = [] | ||||
|     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)) | ||||
|     yield station_names | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def station_names_ax(request, get_configuration): | ||||
|     station_names = [] | ||||
|     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)) | ||||
|     yield station_names | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def num_stations(request): | ||||
|     num_sta = int(request.config.getini("num_stations")) | ||||
|     yield num_sta | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="class") | ||||
| def get_vif_state(get_apnos, get_configuration, request, lf_tools, run_lf): | ||||
|     if request.config.getoption("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.sort() | ||||
|         yield vif_state | ||||
|     else: | ||||
|         yield lf_tools.ssid_list | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def dfs_start(fixtures_ver, get_apnos, get_configuration): | ||||
|     dfs_start = fixtures_ver.dfs(get_apnos, get_configuration) | ||||
|     yield dfs_start | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="class") | ||||
| def get_vlan_list(get_apnos, get_configuration): | ||||
|     ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") | ||||
|     vlan_list = list(ap_ssh.get_vlan()) | ||||
|     vlan_list.sort() | ||||
|     yield vlan_list | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def reset_scenario_lf(request, lf_tools, run_lf): | ||||
|     if not run_lf: | ||||
|         lf_tools.reset_scenario() | ||||
|         def teardown_session(): | ||||
|             lf_tools.reset_scenario() | ||||
|  | ||||
|         request.addfinalizer(teardown_session) | ||||
|     yield "" | ||||
|  | ||||
| # import json | ||||
| # import os | ||||
| # import sys | ||||
| # | ||||
| # sys.path.append( | ||||
| #     os.path.dirname( | ||||
| #         os.path.realpath(__file__) | ||||
| #     ) | ||||
| # ) | ||||
| # if "libs" not in sys.path: | ||||
| #     sys.path.append(f'../libs') | ||||
| # | ||||
| # from controller.controller_1x.controller import ProfileUtility | ||||
| # from controller.controller_2x.controller import UProfileUtility | ||||
| # from controller.controller_3x.controller import CController | ||||
| # import time | ||||
| # from lanforge.lf_tools import ChamberView | ||||
| # import pytest | ||||
| # import allure | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def instantiate_profile(request): | ||||
| #     if request.config.getoption("1.x"): | ||||
| #         yield ProfileUtility | ||||
| #     elif request.config.getoption("cc.1"): | ||||
| #         yield CController | ||||
| #     else: | ||||
| #         yield UProfileUtility | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def create_lanforge_chamberview(lf_tools): | ||||
| #     scenario_object, scenario_name = lf_tools.Chamber_View() | ||||
| #     return scenario_name | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def create_lanforge_chamberview_dut(lf_tools, run_lf): | ||||
| #     if not run_lf: | ||||
| #         dut_object, dut_name = lf_tools.Create_Dut() | ||||
| #         return dut_name | ||||
| #     return "" | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="class") | ||||
| # 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, | ||||
| #                    get_security_flags, get_configuration, radius_info, get_apnos, radius_accounting_info, cc_1): | ||||
| #     param = dict(request.param) | ||||
| # | ||||
| #     # VLAN Setup | ||||
| #     if request.param["mode"] == "VLAN": | ||||
| # | ||||
| #         vlan_list = list() | ||||
| #         refactored_vlan_list = list() | ||||
| #         ssid_modes = request.param["ssid_modes"].keys() | ||||
| #         for mode in ssid_modes: | ||||
| #             for ssid in range(len(request.param["ssid_modes"][mode])): | ||||
| #                 if "vlan" in request.param["ssid_modes"][mode][ssid]: | ||||
| #                     vlan_list.append(request.param["ssid_modes"][mode][ssid]["vlan"]) | ||||
| #                 else: | ||||
| #                     pass | ||||
| #         if vlan_list: | ||||
| #             [refactored_vlan_list.append(x) for x in vlan_list if x not in refactored_vlan_list] | ||||
| #             vlan_list = refactored_vlan_list | ||||
| #             for i in range(len(vlan_list)): | ||||
| #                 if vlan_list[i] > 4095 or vlan_list[i] < 1: | ||||
| #                     vlan_list.pop(i) | ||||
| #     if request.param["mode"] == "VLAN": | ||||
| #         lf_tools.reset_scenario() | ||||
| #         lf_tools.add_vlan(vlan_ids=vlan_list) | ||||
| # | ||||
| #     # call this, if 1.x | ||||
| #     print("fixture version ", fixtures_ver) | ||||
| #     if cc_1: | ||||
| #         return_var = fixtures_ver.setup_profiles(request, param, run_lf, instantiate_profile, get_configuration, get_markers, lf_tools) | ||||
| #     else: | ||||
| #         return_var = fixtures_ver.setup_profiles(request, param, setup_controller, testbed, get_equipment_ref, | ||||
| #                                              instantiate_profile, | ||||
| #                                              get_markers, create_lanforge_chamberview_dut, lf_tools, | ||||
| #                                              get_security_flags, get_configuration, radius_info, get_apnos, | ||||
| #                                              radius_accounting_info, run_lf=run_lf) | ||||
| # | ||||
| #     yield return_var | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def station_names_twog(request, get_configuration): | ||||
| #     station_names = [] | ||||
| #     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)) | ||||
| #     yield station_names | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def station_names_fiveg(request, get_configuration): | ||||
| #     station_names = [] | ||||
| #     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)) | ||||
| #     yield station_names | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def station_names_ax(request, get_configuration): | ||||
| #     station_names = [] | ||||
| #     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)) | ||||
| #     yield station_names | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def num_stations(request): | ||||
| #     num_sta = int(request.config.getini("num_stations")) | ||||
| #     yield num_sta | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="class") | ||||
| # def get_vif_state(get_apnos, get_configuration, request, lf_tools, run_lf): | ||||
| #     if request.config.getoption("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.sort() | ||||
| #         yield vif_state | ||||
| #     else: | ||||
| #         yield lf_tools.ssid_list | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def dfs_start(fixtures_ver, get_apnos, get_configuration): | ||||
| #     dfs_start = fixtures_ver.dfs(get_apnos, get_configuration) | ||||
| #     yield dfs_start | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="class") | ||||
| # def get_vlan_list(get_apnos, get_configuration): | ||||
| #     ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") | ||||
| #     vlan_list = list(ap_ssh.get_vlan()) | ||||
| #     vlan_list.sort() | ||||
| #     yield vlan_list | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def reset_scenario_lf(request, lf_tools, run_lf): | ||||
| #     if not run_lf: | ||||
| #         lf_tools.reset_scenario() | ||||
| #         def teardown_session(): | ||||
| #             lf_tools.reset_scenario() | ||||
| # | ||||
| #         request.addfinalizer(teardown_session) | ||||
| #     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 sys | ||||
|  | ||||
| sys.path.append( | ||||
|     os.path.dirname( | ||||
|         os.path.realpath(__file__) | ||||
|     ) | ||||
| ) | ||||
| if "libs" not in sys.path: | ||||
|     sys.path.append(f"../libs") | ||||
|  | ||||
| import time | ||||
| import pytest | ||||
| import allure | ||||
| from collections import defaultdict | ||||
| from lanforge.lf_tests import RunTest | ||||
| from configuration import PASSPOINT_RADIUS_SERVER_DATA | ||||
| from configuration import PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA | ||||
| from configuration import PASSPOINT_PROVIDER_INFO | ||||
| from configuration import PASSPOINT_OPERATOR_INFO | ||||
| from configuration import PASSPOINT_VENUE_INFO | ||||
| from configuration import PASSPOINT_PROFILE_INFO | ||||
| from controller.controller_1x.controller import ProfileUtility | ||||
|  | ||||
|  | ||||
| @allure.feature("PASSPOINT CONNECTIVITY SETUP") | ||||
| @pytest.fixture(scope="class") | ||||
| def setup_profiles(request, setup_controller, testbed, setup_vlan, get_equipment_ref, | ||||
|                    instantiate_profile, get_markers, passpoint_provider_info, passpoint_operator_info, | ||||
|                    passpoint_venue_info, passpoint_profile_info, | ||||
|                    get_configuration, passpoint_radius_server_info, passpoint_radius_accounting_server_info, get_apnos): | ||||
|     instantiate_profile = instantiate_profile(sdk_client=setup_controller) | ||||
|     vlan_id, mode = 0, 0 | ||||
|     instantiate_profile.cleanup_objects() | ||||
|     parameter = dict(request.param) | ||||
|     test_cases = {} | ||||
|     profile_data = {} | ||||
|     if parameter["mode"] not in ["BRIDGE", "NAT", "VLAN"]: | ||||
|         print("Invalid Mode: ", parameter["mode"]) | ||||
|         yield test_cases | ||||
|  | ||||
|     if parameter["mode"] == "NAT": | ||||
|         mode = "NAT" | ||||
|         vlan_id = 1 | ||||
|     if parameter["mode"] == "BRIDGE": | ||||
|         mode = "BRIDGE" | ||||
|         vlan_id = 1 | ||||
|     if parameter["mode"] == "VLAN": | ||||
|         mode = "BRIDGE" | ||||
|         vlan_id = setup_vlan | ||||
|  | ||||
|     ap_profile = testbed + "-Equipment-AP-Passpoint" | ||||
|     instantiate_profile.delete_profile_by_name(profile_name=ap_profile) | ||||
|     profile_data["equipment_ap"] = {"profile_name": ap_profile} | ||||
|  | ||||
|     profile_data["ssid"] = {} | ||||
|     # Only passpoint SSID need to be applied with passpoint profiles leaving ssid used for | ||||
|     # profile download - passpoint_profile_download | ||||
|     profile_data["allowed_ssids"] = [] | ||||
|     for i in parameter["ssid_modes"]: | ||||
|         profile_data["ssid"][i] = [] | ||||
|         for j in range(len(parameter["ssid_modes"][i])): | ||||
|             profile_name = testbed + "-SSID-" + i + "-" + str(j) + "-" + parameter["mode"] | ||||
|             data = parameter["ssid_modes"][i][j] | ||||
|             data["profile_name"] = profile_name | ||||
|             if "mode" not in dict(data).keys(): | ||||
|                 data["mode"] = mode | ||||
|             if "vlan" not in dict(data).keys(): | ||||
|                 data["vlan"] = vlan_id | ||||
|             instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
|             profile_data["ssid"][i].append(data) | ||||
|  | ||||
|     instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile-" + mode) | ||||
|     time.sleep(10) | ||||
|  | ||||
|     # RF Profile Creation | ||||
|     rf_profile_data = { | ||||
|         "name": testbed + "-RF-Profile-" + parameter["mode"] + "-" + get_configuration["access_point"][0]["mode"] | ||||
|     } | ||||
|     try: | ||||
|         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, | ||||
|                                                              mode=get_configuration["access_point"][0]["mode"]) | ||||
|         allure.attach(body=str(rf_profile_data), | ||||
|                       name="RF Profile Created : " + get_configuration["access_point"][0]["mode"]) | ||||
|     except Exception as e: | ||||
|         print(e) | ||||
|         allure.attach(body=str(e), name="Exception ") | ||||
|  | ||||
|     # Radius Profile Creation | ||||
|     passpoint_radius_server_info = passpoint_radius_server_info | ||||
|     passpoint_radius_server_info["name"] = testbed + "-Automation-Radius-Profile" | ||||
|     instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile") | ||||
|     try: | ||||
|         instantiate_profile.create_radius_profile(radius_info=passpoint_radius_server_info, | ||||
|                                                   radius_accounting_info=passpoint_radius_accounting_server_info) | ||||
|         test_cases["radius_profile"] = True | ||||
|         allure.attach(body=str(passpoint_radius_server_info), name="Radius Profile Created") | ||||
|     except Exception as e: | ||||
|         print(e) | ||||
|         test_cases["radius_profile"] = False | ||||
|  | ||||
|     # SSID Profile Creation | ||||
|     for mode in profile_data["ssid"]: | ||||
|         if mode == "open": | ||||
|             for j in profile_data["ssid"][mode]: | ||||
|                 try: | ||||
|                     if "is2dot4GHz" in list(j["appliedRadios"]): | ||||
|                         creates_profile = instantiate_profile.create_open_ssid_profile(profile_data=j) | ||||
|                         test_cases[j["ssid_name"]] = {"sdk": True} | ||||
|                         allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
|                 except Exception as e: | ||||
|                     print(e) | ||||
|                     test_cases[j["ssid_name"]] = {"sdk": False} | ||||
|                     allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
|         if mode == "wpa_eap": | ||||
|             for j in profile_data["ssid"][mode]: | ||||
|                 if mode in get_markers.keys() and get_markers[mode]: | ||||
|                     try: | ||||
|                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | ||||
|                                 j["appliedRadios"]): | ||||
|                             creates_profile = instantiate_profile.create_wpa_eap_passpoint_ssid_profile(profile_data=j) | ||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
|                     except Exception as e: | ||||
|                         print(e) | ||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
|                     try: | ||||
|                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | ||||
|                                 j["appliedRadios"]): | ||||
|                             creates_profile = instantiate_profile.create_wpa_eap_passpoint_ssid_profile(profile_data=j) | ||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
|                     except Exception as e: | ||||
|                         print(e) | ||||
|                         test_cases[j["wpa_eap_5g"]] = {"sdk": False} | ||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
|         if mode == "wpa2_eap": | ||||
|             for j in profile_data["ssid"][mode]: | ||||
|                 if mode in get_markers.keys() and get_markers[mode]: | ||||
|                     try: | ||||
|                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | ||||
|                                 j["appliedRadios"]): | ||||
|                             creates_profile = instantiate_profile.create_wpa2_eap_passpoint_ssid_profile(profile_data=j) | ||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
|                     except Exception as e: | ||||
|                         print(e) | ||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
|                     try: | ||||
|                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | ||||
|                                 j["appliedRadios"]): | ||||
|                             creates_profile = instantiate_profile.create_wpa2_eap_passpoint_ssid_profile(profile_data=j) | ||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
|                     except Exception as e: | ||||
|                         print(e) | ||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
|         if mode == "wpa2_only_eap": | ||||
|             for j in profile_data["ssid"][mode]: | ||||
|                 if mode in get_markers.keys() and get_markers[mode]: | ||||
|                     try: | ||||
|                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | ||||
|                                 j["appliedRadios"]): | ||||
|                             creates_profile = instantiate_profile.create_wpa2_only_eap_passpoint_ssid_profile( | ||||
|                                 profile_data=j) | ||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
|                     except Exception as e: | ||||
|                         print(e) | ||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
|                     try: | ||||
|                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | ||||
|                                 j["appliedRadios"]): | ||||
|                             creates_profile = instantiate_profile.create_wpa2_only_eap_passpoint_ssid_profile( | ||||
|                                 profile_data=j) | ||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
|                     except Exception as e: | ||||
|                         print(e) | ||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
|  | ||||
|     # Passpoint OSU ID provider profile creation | ||||
|     passpoint_provider_info = passpoint_provider_info | ||||
|     test_cases["passpoint_osu_id_provider"] = dict() | ||||
|     profile_name = testbed + "-Automation-Passpoint-OSU-ID-Provider-Profile" | ||||
|     passpoint_provider_info["profile_name"] = profile_name | ||||
|     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
|     try: | ||||
|         creates_profile = instantiate_profile.create_passpoint_osu_id_provider_profile( | ||||
|             profile_data=passpoint_provider_info) | ||||
|         allure.attach(body=str(creates_profile), name="Passpoint OSU ID provider Profile Created") | ||||
|         test_cases["passpoint_osu_id_provider"] = {"sdk": True} | ||||
|     except Exception as e: | ||||
|         print(e) | ||||
|         test_cases["passpoint_osu_id_provider"] = {"sdk": False} | ||||
|         allure.attach(body=str(e), name="Passpoint OSU ID provider Profile Creation Failed") | ||||
|  | ||||
|     # Passpoint operator profile creation | ||||
|     test_cases["passpoint_operator_profile"] = dict() | ||||
|     passpoint_operator_info = passpoint_operator_info | ||||
|     profile_name = testbed + "-Automation-Passpoint-Operator-Profile" | ||||
|     passpoint_operator_info["profile_name"] = profile_name | ||||
|     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
|     try: | ||||
|         creates_profile = instantiate_profile.create_passpoint_operator_profile(profile_data=passpoint_operator_info) | ||||
|         allure.attach(body=str(creates_profile), name="Passpoint Operator Profile Created") | ||||
|         test_cases["passpoint_operator_profile"] = {"sdk": True} | ||||
|         profile_data["passpoint_operator"] = profile_name | ||||
|     except Exception as e: | ||||
|         print(e) | ||||
|         test_cases["passpoint_operator_profile"] = {"sdk": False} | ||||
|         allure.attach(body=str(e), name="Passpoint Operator Profile Creation Failed") | ||||
|  | ||||
|     # Passpoint Venue profile creation | ||||
|     passpoint_venue_info = passpoint_venue_info | ||||
|     test_cases["passpoint_venue_profile"] = dict() | ||||
|     profile_name = testbed + "-Automation-Passpoint-Venue-Profile" | ||||
|     passpoint_venue_info["profile_name"] = profile_name | ||||
|     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
|     try: | ||||
|         creates_profile = instantiate_profile.create_passpoint_venue_profile(profile_data=passpoint_venue_info) | ||||
|         allure.attach(body=str(creates_profile), name="Passpoint Venue Profile Created") | ||||
|         test_cases["passpoint_venue_profile"] = {"sdk": True} | ||||
|         profile_data["passpoint_venue"] = profile_name | ||||
|     except Exception as e: | ||||
|         print(e) | ||||
|         test_cases["passpoint_venue"] = {"sdk": False} | ||||
|         allure.attach(body=str(e), name="Passpoint Venue Profile Creation Failed") | ||||
|  | ||||
|     # Passpoint profile creation | ||||
|     passpoint_profile_info = passpoint_profile_info | ||||
|     profile_name = testbed + "-Automation-Passpoint-Profile" | ||||
|     passpoint_profile_info["profile_name"] = profile_name | ||||
|     passpoint_profile_info["allowed_ssids"] = profile_data["allowed_ssids"] | ||||
|     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
|     try: | ||||
|         creates_profile = instantiate_profile.create_passpoint_profile(profile_data=passpoint_profile_info) | ||||
|         allure.attach(body=str(creates_profile), name="Passpoint Profile Created") | ||||
|         test_cases["passpoint"] = {"sdk": True} | ||||
|         profile_data["passpoint"] = profile_name | ||||
|     except Exception as e: | ||||
|         print(e) | ||||
|         test_cases["passpoint"] = {"sdk": False} | ||||
|         allure.attach(body=str(e), name="Passpoint Profile Creation Failed") | ||||
|  | ||||
|     # Update SSID profile with passpoint config | ||||
|     passpoint_profile_info = passpoint_profile_info | ||||
|     ssid_to_apply = None | ||||
|     for ssid_profile in profile_data["ssid"].keys(): | ||||
|         for ssid in profile_data["ssid"][ssid_profile]: | ||||
|             if ssid["ssid_name"] == "passpoint_profile_download": | ||||
|                 ssid_to_apply = ssid["ssid_name"] | ||||
|                 continue | ||||
|             if ssid["ssid_name"] in test_cases.keys(): | ||||
|                 allure.attach(body=str(ssid), name="Updating SSID profile") | ||||
|                 passpoint_profile_info["ssid_profile_name"] = ssid["profile_name"] | ||||
|                 instantiate_profile.update_ssid_profile(profile_info=passpoint_profile_info) | ||||
|  | ||||
|     # Equipment AP Profile Creation | ||||
|     ap_profile_info = dict() | ||||
|     ap_profile_info["profile_name"] = profile_data["equipment_ap"]["profile_name"] | ||||
|     ap_profile_info["ssid_names"] = [ssid_to_apply] | ||||
|     try: | ||||
|         instantiate_profile.set_ap_profile_custom(profile_data=ap_profile_info) | ||||
|         test_cases["equipment_ap"] = {"sdk": True} | ||||
|         allure.attach(body=str(profile_data["equipment_ap"]), name="Equipment AP Profile Created") | ||||
|     except Exception as e: | ||||
|         print(e) | ||||
|         test_cases["equipment_ap"] = {"sdk": False} | ||||
|         allure.attach(body=str(e), name="Equipment AP Profile Creation Failed") | ||||
|  | ||||
|  | ||||
|     def teardown_session(): | ||||
|         print("\nRemoving Profiles") | ||||
|         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["radius"]) | ||||
|         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_operator"]) | ||||
|         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint_venue"]) | ||||
|         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint"]) | ||||
|         allure.attach(body=str(profile_data['equipment_ap']['profile_name'] + "\n"), | ||||
|                       name="Tear Down in Profiles ") | ||||
|         time.sleep(20) | ||||
|  | ||||
|     request.addfinalizer(teardown_session) | ||||
|     yield test_cases, instantiate_profile, profile_data | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="function") | ||||
| def push_ap_profile(request, setup_profiles, get_equipment_ref, get_apnos, get_configuration): | ||||
|     parameter = dict(request.param) | ||||
|     test_cases, instantiate_profile, profile_data = setup_profiles | ||||
|     ssid_names = parameter["ssid_names"] | ||||
|     ap_profile_info = dict() | ||||
|     ap_profile_info["profile_name"] = profile_data["equipment_ap"]["profile_name"] | ||||
|     test_cases = {} | ||||
|     ap_profile_info["ssid_names"] = ssid_names | ||||
|     try: | ||||
|         instantiate_profile.update_ap_profile(profile_data=ap_profile_info) | ||||
|         test_cases["equipment_ap"] = {"sdk": True} | ||||
|         allure.attach(body=str(ap_profile_info["profile_name"]), name="Equipment AP Profile Updated") | ||||
|     except Exception as e: | ||||
|         print(e) | ||||
|         test_cases["equipment_ap"] = {"sdk": False} | ||||
|         allure.attach(body=str(e), name="Equipment AP Profile Update Failed") | ||||
|  | ||||
|     print("Pushing profiles on AP  :: ", ap_profile_info) | ||||
|     allure.attach(body=str(ap_profile_info), name="Pushing profiles on AP  :: ") | ||||
|     # Push the Equipment AP Profile to AP | ||||
|     try: | ||||
|         for i in get_equipment_ref: | ||||
|             instantiate_profile.push_profile_old_method(equipment_id=i) | ||||
|     except Exception as e: | ||||
|         print(e) | ||||
|         print("failed to push AP Profile") | ||||
|  | ||||
|     # Check the VIF Config and VIF State of SSIDs | ||||
|     time_start = time.time() | ||||
|     ap_ssh = get_apnos(get_configuration["access_point"][0], pwd="../libs/apnos/") | ||||
|     while time.time() - time_start < 240: | ||||
|         if ((time.time() - time_start) / 10) == 15: | ||||
|             ap_ssh = get_apnos(get_configuration["access_point"][0], pwd="../libs/apnos/") | ||||
|         vif_config = list(ap_ssh.get_vif_config_ssids()) | ||||
|         vif_config.sort() | ||||
|         vif_state = list(ap_ssh.get_vif_state_ssids()) | ||||
|         vif_state.sort() | ||||
|         for ssid in ssid_names: | ||||
|             test_cases[ssid] = dict() | ||||
|             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 | ||||
|         ssid_names.sort() | ||||
|         if vif_config == ssid_names == vif_state: | ||||
|             print("Waiting for Radios to apply config ") | ||||
|             time.sleep(200) | ||||
|             break | ||||
|         time.sleep(10) | ||||
|     allure.attach(body=str(vif_config), name="vifC status on AP :: ") | ||||
|     allure.attach(body=str(vif_state), name="vifS status on AP :: ") | ||||
|  | ||||
|     yield test_cases | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def passpoint_radius_server_info(): | ||||
|     allure.attach(body=str(PASSPOINT_RADIUS_SERVER_DATA), name="Passpoint RADIUS server Info: ") | ||||
|     yield PASSPOINT_RADIUS_SERVER_DATA | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def passpoint_radius_accounting_server_info(): | ||||
|     allure.attach(body=str(PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA), name="Passpoint RADIUS account server Info: ") | ||||
|     yield PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def passpoint_provider_info(): | ||||
|     allure.attach(body=str(PASSPOINT_PROVIDER_INFO), name="Passpoint Provider Info: ") | ||||
|     yield PASSPOINT_PROVIDER_INFO | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def passpoint_operator_info(): | ||||
|     allure.attach(body=str(PASSPOINT_OPERATOR_INFO), name="Passpoint operator Info: ") | ||||
|     yield PASSPOINT_OPERATOR_INFO | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def passpoint_venue_info(): | ||||
|     allure.attach(body=str(PASSPOINT_VENUE_INFO), name="Passpoint venue Info: ") | ||||
|     yield PASSPOINT_VENUE_INFO | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def passpoint_profile_info(): | ||||
|     allure.attach(body=str(PASSPOINT_PROFILE_INFO), name="Passpoint profile Info: ") | ||||
|     yield PASSPOINT_PROFILE_INFO | ||||
| # import os | ||||
| # import sys | ||||
| # | ||||
| # sys.path.append( | ||||
| #     os.path.dirname( | ||||
| #         os.path.realpath(__file__) | ||||
| #     ) | ||||
| # ) | ||||
| # if "libs" not in sys.path: | ||||
| #     sys.path.append(f"../libs") | ||||
| # | ||||
| # import time | ||||
| # import pytest | ||||
| # import allure | ||||
| # from collections import defaultdict | ||||
| # from lanforge.lf_tests import RunTest | ||||
| # from configuration import PASSPOINT_RADIUS_SERVER_DATA | ||||
| # from configuration import PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA | ||||
| # from configuration import PASSPOINT_PROVIDER_INFO | ||||
| # from configuration import PASSPOINT_OPERATOR_INFO | ||||
| # from configuration import PASSPOINT_VENUE_INFO | ||||
| # from configuration import PASSPOINT_PROFILE_INFO | ||||
| # from controller.controller_1x.controller import ProfileUtility | ||||
| # | ||||
| # | ||||
| # @allure.feature("PASSPOINT CONNECTIVITY SETUP") | ||||
| # @pytest.fixture(scope="class") | ||||
| # def setup_profiles(request, setup_controller, testbed, setup_vlan, get_equipment_ref, | ||||
| #                    instantiate_profile, get_markers, passpoint_provider_info, passpoint_operator_info, | ||||
| #                    passpoint_venue_info, passpoint_profile_info, | ||||
| #                    get_configuration, passpoint_radius_server_info, passpoint_radius_accounting_server_info, get_apnos): | ||||
| #     instantiate_profile = instantiate_profile(sdk_client=setup_controller) | ||||
| #     vlan_id, mode = 0, 0 | ||||
| #     instantiate_profile.cleanup_objects() | ||||
| #     parameter = dict(request.param) | ||||
| #     test_cases = {} | ||||
| #     profile_data = {} | ||||
| #     if parameter["mode"] not in ["BRIDGE", "NAT", "VLAN"]: | ||||
| #         print("Invalid Mode: ", parameter["mode"]) | ||||
| #         yield test_cases | ||||
| # | ||||
| #     if parameter["mode"] == "NAT": | ||||
| #         mode = "NAT" | ||||
| #         vlan_id = 1 | ||||
| #     if parameter["mode"] == "BRIDGE": | ||||
| #         mode = "BRIDGE" | ||||
| #         vlan_id = 1 | ||||
| #     if parameter["mode"] == "VLAN": | ||||
| #         mode = "BRIDGE" | ||||
| #         vlan_id = setup_vlan | ||||
| # | ||||
| #     ap_profile = testbed + "-Equipment-AP-Passpoint" | ||||
| #     instantiate_profile.delete_profile_by_name(profile_name=ap_profile) | ||||
| #     profile_data["equipment_ap"] = {"profile_name": ap_profile} | ||||
| # | ||||
| #     profile_data["ssid"] = {} | ||||
| #     # Only passpoint SSID need to be applied with passpoint profiles leaving ssid used for | ||||
| #     # profile download - passpoint_profile_download | ||||
| #     profile_data["allowed_ssids"] = [] | ||||
| #     for i in parameter["ssid_modes"]: | ||||
| #         profile_data["ssid"][i] = [] | ||||
| #         for j in range(len(parameter["ssid_modes"][i])): | ||||
| #             profile_name = testbed + "-SSID-" + i + "-" + str(j) + "-" + parameter["mode"] | ||||
| #             data = parameter["ssid_modes"][i][j] | ||||
| #             data["profile_name"] = profile_name | ||||
| #             if "mode" not in dict(data).keys(): | ||||
| #                 data["mode"] = mode | ||||
| #             if "vlan" not in dict(data).keys(): | ||||
| #                 data["vlan"] = vlan_id | ||||
| #             instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
| #             profile_data["ssid"][i].append(data) | ||||
| # | ||||
| #     instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile-" + mode) | ||||
| #     time.sleep(10) | ||||
| # | ||||
| #     # RF Profile Creation | ||||
| #     rf_profile_data = { | ||||
| #         "name": testbed + "-RF-Profile-" + parameter["mode"] + "-" + get_configuration["access_point"][0]["mode"] | ||||
| #     } | ||||
| #     try: | ||||
| #         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, | ||||
| #                                                              mode=get_configuration["access_point"][0]["mode"]) | ||||
| #         allure.attach(body=str(rf_profile_data), | ||||
| #                       name="RF Profile Created : " + get_configuration["access_point"][0]["mode"]) | ||||
| #     except Exception as e: | ||||
| #         print(e) | ||||
| #         allure.attach(body=str(e), name="Exception ") | ||||
| # | ||||
| #     # Radius Profile Creation | ||||
| #     passpoint_radius_server_info = passpoint_radius_server_info | ||||
| #     passpoint_radius_server_info["name"] = testbed + "-Automation-Radius-Profile" | ||||
| #     instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile") | ||||
| #     try: | ||||
| #         instantiate_profile.create_radius_profile(radius_info=passpoint_radius_server_info, | ||||
| #                                                   radius_accounting_info=passpoint_radius_accounting_server_info) | ||||
| #         test_cases["radius_profile"] = True | ||||
| #         allure.attach(body=str(passpoint_radius_server_info), name="Radius Profile Created") | ||||
| #     except Exception as e: | ||||
| #         print(e) | ||||
| #         test_cases["radius_profile"] = False | ||||
| # | ||||
| #     # SSID Profile Creation | ||||
| #     for mode in profile_data["ssid"]: | ||||
| #         if mode == "open": | ||||
| #             for j in profile_data["ssid"][mode]: | ||||
| #                 try: | ||||
| #                     if "is2dot4GHz" in list(j["appliedRadios"]): | ||||
| #                         creates_profile = instantiate_profile.create_open_ssid_profile(profile_data=j) | ||||
| #                         test_cases[j["ssid_name"]] = {"sdk": True} | ||||
| #                         allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
| #                 except Exception as e: | ||||
| #                     print(e) | ||||
| #                     test_cases[j["ssid_name"]] = {"sdk": False} | ||||
| #                     allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
| #         if mode == "wpa_eap": | ||||
| #             for j in profile_data["ssid"][mode]: | ||||
| #                 if mode in get_markers.keys() and get_markers[mode]: | ||||
| #                     try: | ||||
| #                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | ||||
| #                                 j["appliedRadios"]): | ||||
| #                             creates_profile = instantiate_profile.create_wpa_eap_passpoint_ssid_profile(profile_data=j) | ||||
| #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
| #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
| #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
| #                     except Exception as e: | ||||
| #                         print(e) | ||||
| #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
| #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
| #                     try: | ||||
| #                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | ||||
| #                                 j["appliedRadios"]): | ||||
| #                             creates_profile = instantiate_profile.create_wpa_eap_passpoint_ssid_profile(profile_data=j) | ||||
| #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
| #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
| #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
| #                     except Exception as e: | ||||
| #                         print(e) | ||||
| #                         test_cases[j["wpa_eap_5g"]] = {"sdk": False} | ||||
| #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
| #         if mode == "wpa2_eap": | ||||
| #             for j in profile_data["ssid"][mode]: | ||||
| #                 if mode in get_markers.keys() and get_markers[mode]: | ||||
| #                     try: | ||||
| #                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | ||||
| #                                 j["appliedRadios"]): | ||||
| #                             creates_profile = instantiate_profile.create_wpa2_eap_passpoint_ssid_profile(profile_data=j) | ||||
| #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
| #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
| #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
| #                     except Exception as e: | ||||
| #                         print(e) | ||||
| #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
| #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
| #                     try: | ||||
| #                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | ||||
| #                                 j["appliedRadios"]): | ||||
| #                             creates_profile = instantiate_profile.create_wpa2_eap_passpoint_ssid_profile(profile_data=j) | ||||
| #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
| #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
| #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
| #                     except Exception as e: | ||||
| #                         print(e) | ||||
| #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
| #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
| #         if mode == "wpa2_only_eap": | ||||
| #             for j in profile_data["ssid"][mode]: | ||||
| #                 if mode in get_markers.keys() and get_markers[mode]: | ||||
| #                     try: | ||||
| #                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | ||||
| #                                 j["appliedRadios"]): | ||||
| #                             creates_profile = instantiate_profile.create_wpa2_only_eap_passpoint_ssid_profile( | ||||
| #                                 profile_data=j) | ||||
| #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
| #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
| #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
| #                     except Exception as e: | ||||
| #                         print(e) | ||||
| #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
| #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
| #                     try: | ||||
| #                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | ||||
| #                                 j["appliedRadios"]): | ||||
| #                             creates_profile = instantiate_profile.create_wpa2_only_eap_passpoint_ssid_profile( | ||||
| #                                 profile_data=j) | ||||
| #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
| #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
| #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
| #                     except Exception as e: | ||||
| #                         print(e) | ||||
| #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
| #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
| # | ||||
| #     # Passpoint OSU ID provider profile creation | ||||
| #     passpoint_provider_info = passpoint_provider_info | ||||
| #     test_cases["passpoint_osu_id_provider"] = dict() | ||||
| #     profile_name = testbed + "-Automation-Passpoint-OSU-ID-Provider-Profile" | ||||
| #     passpoint_provider_info["profile_name"] = profile_name | ||||
| #     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
| #     try: | ||||
| #         creates_profile = instantiate_profile.create_passpoint_osu_id_provider_profile( | ||||
| #             profile_data=passpoint_provider_info) | ||||
| #         allure.attach(body=str(creates_profile), name="Passpoint OSU ID provider Profile Created") | ||||
| #         test_cases["passpoint_osu_id_provider"] = {"sdk": True} | ||||
| #     except Exception as e: | ||||
| #         print(e) | ||||
| #         test_cases["passpoint_osu_id_provider"] = {"sdk": False} | ||||
| #         allure.attach(body=str(e), name="Passpoint OSU ID provider Profile Creation Failed") | ||||
| # | ||||
| #     # Passpoint operator profile creation | ||||
| #     test_cases["passpoint_operator_profile"] = dict() | ||||
| #     passpoint_operator_info = passpoint_operator_info | ||||
| #     profile_name = testbed + "-Automation-Passpoint-Operator-Profile" | ||||
| #     passpoint_operator_info["profile_name"] = profile_name | ||||
| #     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
| #     try: | ||||
| #         creates_profile = instantiate_profile.create_passpoint_operator_profile(profile_data=passpoint_operator_info) | ||||
| #         allure.attach(body=str(creates_profile), name="Passpoint Operator Profile Created") | ||||
| #         test_cases["passpoint_operator_profile"] = {"sdk": True} | ||||
| #         profile_data["passpoint_operator"] = profile_name | ||||
| #     except Exception as e: | ||||
| #         print(e) | ||||
| #         test_cases["passpoint_operator_profile"] = {"sdk": False} | ||||
| #         allure.attach(body=str(e), name="Passpoint Operator Profile Creation Failed") | ||||
| # | ||||
| #     # Passpoint Venue profile creation | ||||
| #     passpoint_venue_info = passpoint_venue_info | ||||
| #     test_cases["passpoint_venue_profile"] = dict() | ||||
| #     profile_name = testbed + "-Automation-Passpoint-Venue-Profile" | ||||
| #     passpoint_venue_info["profile_name"] = profile_name | ||||
| #     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
| #     try: | ||||
| #         creates_profile = instantiate_profile.create_passpoint_venue_profile(profile_data=passpoint_venue_info) | ||||
| #         allure.attach(body=str(creates_profile), name="Passpoint Venue Profile Created") | ||||
| #         test_cases["passpoint_venue_profile"] = {"sdk": True} | ||||
| #         profile_data["passpoint_venue"] = profile_name | ||||
| #     except Exception as e: | ||||
| #         print(e) | ||||
| #         test_cases["passpoint_venue"] = {"sdk": False} | ||||
| #         allure.attach(body=str(e), name="Passpoint Venue Profile Creation Failed") | ||||
| # | ||||
| #     # Passpoint profile creation | ||||
| #     passpoint_profile_info = passpoint_profile_info | ||||
| #     profile_name = testbed + "-Automation-Passpoint-Profile" | ||||
| #     passpoint_profile_info["profile_name"] = profile_name | ||||
| #     passpoint_profile_info["allowed_ssids"] = profile_data["allowed_ssids"] | ||||
| #     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
| #     try: | ||||
| #         creates_profile = instantiate_profile.create_passpoint_profile(profile_data=passpoint_profile_info) | ||||
| #         allure.attach(body=str(creates_profile), name="Passpoint Profile Created") | ||||
| #         test_cases["passpoint"] = {"sdk": True} | ||||
| #         profile_data["passpoint"] = profile_name | ||||
| #     except Exception as e: | ||||
| #         print(e) | ||||
| #         test_cases["passpoint"] = {"sdk": False} | ||||
| #         allure.attach(body=str(e), name="Passpoint Profile Creation Failed") | ||||
| # | ||||
| #     # Update SSID profile with passpoint config | ||||
| #     passpoint_profile_info = passpoint_profile_info | ||||
| #     ssid_to_apply = None | ||||
| #     for ssid_profile in profile_data["ssid"].keys(): | ||||
| #         for ssid in profile_data["ssid"][ssid_profile]: | ||||
| #             if ssid["ssid_name"] == "passpoint_profile_download": | ||||
| #                 ssid_to_apply = ssid["ssid_name"] | ||||
| #                 continue | ||||
| #             if ssid["ssid_name"] in test_cases.keys(): | ||||
| #                 allure.attach(body=str(ssid), name="Updating SSID profile") | ||||
| #                 passpoint_profile_info["ssid_profile_name"] = ssid["profile_name"] | ||||
| #                 instantiate_profile.update_ssid_profile(profile_info=passpoint_profile_info) | ||||
| # | ||||
| #     # Equipment AP Profile Creation | ||||
| #     ap_profile_info = dict() | ||||
| #     ap_profile_info["profile_name"] = profile_data["equipment_ap"]["profile_name"] | ||||
| #     ap_profile_info["ssid_names"] = [ssid_to_apply] | ||||
| #     try: | ||||
| #         instantiate_profile.set_ap_profile_custom(profile_data=ap_profile_info) | ||||
| #         test_cases["equipment_ap"] = {"sdk": True} | ||||
| #         allure.attach(body=str(profile_data["equipment_ap"]), name="Equipment AP Profile Created") | ||||
| #     except Exception as e: | ||||
| #         print(e) | ||||
| #         test_cases["equipment_ap"] = {"sdk": False} | ||||
| #         allure.attach(body=str(e), name="Equipment AP Profile Creation Failed") | ||||
| # | ||||
| # | ||||
| #     def teardown_session(): | ||||
| #         print("\nRemoving Profiles") | ||||
| #         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["radius"]) | ||||
| #         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_operator"]) | ||||
| #         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint_venue"]) | ||||
| #         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint"]) | ||||
| #         allure.attach(body=str(profile_data['equipment_ap']['profile_name'] + "\n"), | ||||
| #                       name="Tear Down in Profiles ") | ||||
| #         time.sleep(20) | ||||
| # | ||||
| #     request.addfinalizer(teardown_session) | ||||
| #     yield test_cases, instantiate_profile, profile_data | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="function") | ||||
| # def push_ap_profile(request, setup_profiles, get_equipment_ref, get_apnos, get_configuration): | ||||
| #     parameter = dict(request.param) | ||||
| #     test_cases, instantiate_profile, profile_data = setup_profiles | ||||
| #     ssid_names = parameter["ssid_names"] | ||||
| #     ap_profile_info = dict() | ||||
| #     ap_profile_info["profile_name"] = profile_data["equipment_ap"]["profile_name"] | ||||
| #     test_cases = {} | ||||
| #     ap_profile_info["ssid_names"] = ssid_names | ||||
| #     try: | ||||
| #         instantiate_profile.update_ap_profile(profile_data=ap_profile_info) | ||||
| #         test_cases["equipment_ap"] = {"sdk": True} | ||||
| #         allure.attach(body=str(ap_profile_info["profile_name"]), name="Equipment AP Profile Updated") | ||||
| #     except Exception as e: | ||||
| #         print(e) | ||||
| #         test_cases["equipment_ap"] = {"sdk": False} | ||||
| #         allure.attach(body=str(e), name="Equipment AP Profile Update Failed") | ||||
| # | ||||
| #     print("Pushing profiles on AP  :: ", ap_profile_info) | ||||
| #     allure.attach(body=str(ap_profile_info), name="Pushing profiles on AP  :: ") | ||||
| #     # Push the Equipment AP Profile to AP | ||||
| #     try: | ||||
| #         for i in get_equipment_ref: | ||||
| #             instantiate_profile.push_profile_old_method(equipment_id=i) | ||||
| #     except Exception as e: | ||||
| #         print(e) | ||||
| #         print("failed to push AP Profile") | ||||
| # | ||||
| #     # Check the VIF Config and VIF State of SSIDs | ||||
| #     time_start = time.time() | ||||
| #     ap_ssh = get_apnos(get_configuration["access_point"][0], pwd="../libs/apnos/") | ||||
| #     while time.time() - time_start < 240: | ||||
| #         if ((time.time() - time_start) / 10) == 15: | ||||
| #             ap_ssh = get_apnos(get_configuration["access_point"][0], pwd="../libs/apnos/") | ||||
| #         vif_config = list(ap_ssh.get_vif_config_ssids()) | ||||
| #         vif_config.sort() | ||||
| #         vif_state = list(ap_ssh.get_vif_state_ssids()) | ||||
| #         vif_state.sort() | ||||
| #         for ssid in ssid_names: | ||||
| #             test_cases[ssid] = dict() | ||||
| #             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 | ||||
| #         ssid_names.sort() | ||||
| #         if vif_config == ssid_names == vif_state: | ||||
| #             print("Waiting for Radios to apply config ") | ||||
| #             time.sleep(200) | ||||
| #             break | ||||
| #         time.sleep(10) | ||||
| #     allure.attach(body=str(vif_config), name="vifC status on AP :: ") | ||||
| #     allure.attach(body=str(vif_state), name="vifS status on AP :: ") | ||||
| # | ||||
| #     yield test_cases | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def passpoint_radius_server_info(): | ||||
| #     allure.attach(body=str(PASSPOINT_RADIUS_SERVER_DATA), name="Passpoint RADIUS server Info: ") | ||||
| #     yield PASSPOINT_RADIUS_SERVER_DATA | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def passpoint_radius_accounting_server_info(): | ||||
| #     allure.attach(body=str(PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA), name="Passpoint RADIUS account server Info: ") | ||||
| #     yield PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def passpoint_provider_info(): | ||||
| #     allure.attach(body=str(PASSPOINT_PROVIDER_INFO), name="Passpoint Provider Info: ") | ||||
| #     yield PASSPOINT_PROVIDER_INFO | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def passpoint_operator_info(): | ||||
| #     allure.attach(body=str(PASSPOINT_OPERATOR_INFO), name="Passpoint operator Info: ") | ||||
| #     yield PASSPOINT_OPERATOR_INFO | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def passpoint_venue_info(): | ||||
| #     allure.attach(body=str(PASSPOINT_VENUE_INFO), name="Passpoint venue Info: ") | ||||
| #     yield PASSPOINT_VENUE_INFO | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def passpoint_profile_info(): | ||||
| #     allure.attach(body=str(PASSPOINT_PROFILE_INFO), name="Passpoint profile Info: ") | ||||
| #     yield PASSPOINT_PROFILE_INFO | ||||
|   | ||||
| @@ -1,391 +1,391 @@ | ||||
| import os | ||||
| import sys | ||||
|  | ||||
| sys.path.append( | ||||
|     os.path.dirname( | ||||
|         os.path.realpath(__file__) | ||||
|     ) | ||||
| ) | ||||
| if "libs" not in sys.path: | ||||
|     sys.path.append(f"../libs") | ||||
|  | ||||
| import time | ||||
| import pytest | ||||
| import allure | ||||
| from collections import defaultdict | ||||
| from lanforge.lf_tests import RunTest | ||||
| from configuration import PASSPOINT_RADIUS_SERVER_DATA | ||||
| from configuration import PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA | ||||
| from configuration import PASSPOINT_PROVIDER_INFO | ||||
| from configuration import PASSPOINT_OPERATOR_INFO | ||||
| from configuration import PASSPOINT_VENUE_INFO | ||||
| from configuration import PASSPOINT_PROFILE_INFO | ||||
| from controller.controller_1x.controller import ProfileUtility | ||||
|  | ||||
|  | ||||
| @allure.feature("PASSPOINT CONNECTIVITY SETUP") | ||||
| @pytest.fixture(scope="class") | ||||
| def setup_profiles(request, setup_controller, testbed, setup_vlan, get_equipment_ref, | ||||
|                    instantiate_profile, get_markers, passpoint_provider_info, passpoint_operator_info, | ||||
|                    passpoint_venue_info, passpoint_profile_info, | ||||
|                    get_configuration, passpoint_radius_server_info, passpoint_radius_accounting_server_info, get_apnos): | ||||
|     instantiate_profile = instantiate_profile(sdk_client=setup_controller) | ||||
|     vlan_id, mode = 0, 0 | ||||
|     instantiate_profile.cleanup_objects() | ||||
|     parameter = dict(request.param) | ||||
|     test_cases = {} | ||||
|     profile_data = {} | ||||
|     if parameter["mode"] not in ["BRIDGE", "NAT", "VLAN"]: | ||||
|         print("Invalid Mode: ", parameter["mode"]) | ||||
|         allure.attach(body=parameter["mode"], name="Invalid Mode: ") | ||||
|         yield test_cases | ||||
|  | ||||
|     if parameter["mode"] == "NAT": | ||||
|         mode = "NAT" | ||||
|         vlan_id = 1 | ||||
|     if parameter["mode"] == "BRIDGE": | ||||
|         mode = "BRIDGE" | ||||
|         vlan_id = 1 | ||||
|     if parameter["mode"] == "VLAN": | ||||
|         mode = "BRIDGE" | ||||
|         vlan_id = setup_vlan | ||||
|  | ||||
|     ap_profile = testbed + "-Equipment-AP-Passpoint" | ||||
|     instantiate_profile.delete_profile_by_name(profile_name=ap_profile) | ||||
|     profile_data["equipment_ap"] = {"profile_name": ap_profile} | ||||
|  | ||||
|     profile_data["ssid"] = {} | ||||
|     # Only passpoint SSID need to be applied with passpoint profiles leaving ssid used for | ||||
|     # profile download - passpoint_profile_download | ||||
|     profile_data["allowed_ssids"] = [] | ||||
|     for i in parameter["ssid_modes"]: | ||||
|         profile_data["ssid"][i] = [] | ||||
|         for j in range(len(parameter["ssid_modes"][i])): | ||||
|             profile_name = testbed + "-SSID-" + i + "-" + str(j) + "-" + parameter["mode"] | ||||
|             data = parameter["ssid_modes"][i][j] | ||||
|             data["profile_name"] = profile_name | ||||
|             if "mode" not in dict(data).keys(): | ||||
|                 data["mode"] = mode | ||||
|             if "vlan" not in dict(data).keys(): | ||||
|                 data["vlan"] = vlan_id | ||||
|             instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
|             profile_data["ssid"][i].append(data) | ||||
|  | ||||
|     instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile-" + mode) | ||||
|     time.sleep(10) | ||||
|  | ||||
|     # RF Profile Creation | ||||
|     rf_profile_data = { | ||||
|         "name": testbed + "-RF-Profile-" + parameter["mode"] + "-" + get_configuration["access_point"][0]["mode"] | ||||
|     } | ||||
|     try: | ||||
|         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, | ||||
|                                                              mode=get_configuration["access_point"][0]["mode"]) | ||||
|         allure.attach(body=str(rf_profile_data), | ||||
|                       name="RF Profile Created : " + get_configuration["access_point"][0]["mode"]) | ||||
|     except Exception as e: | ||||
|         print(e) | ||||
|         allure.attach(body=str(e), name="Exception ") | ||||
|  | ||||
|     # Radius Profile Creation | ||||
|     passpoint_radius_server_info = passpoint_radius_server_info | ||||
|     passpoint_radius_server_info["name"] = testbed + "-Automation-Radius-Profile" | ||||
|     instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile") | ||||
|     try: | ||||
|         instantiate_profile.create_radius_profile(radius_info=passpoint_radius_server_info, | ||||
|                                                   radius_accounting_info=passpoint_radius_accounting_server_info) | ||||
|         test_cases["radius_profile"] = True | ||||
|         allure.attach(body=str(passpoint_radius_server_info), name="Radius Profile Created") | ||||
|     except Exception as e: | ||||
|         print(e) | ||||
|         test_cases["radius_profile"] = False | ||||
|  | ||||
|     # SSID Profile Creation | ||||
|     for mode in profile_data["ssid"]: | ||||
|         if mode == "open": | ||||
|             for j in profile_data["ssid"][mode]: | ||||
|                 try: | ||||
|                     if "is2dot4GHz" in list(j["appliedRadios"]): | ||||
|                         creates_profile = instantiate_profile.create_open_ssid_profile(profile_data=j) | ||||
|                         test_cases[j["ssid_name"]] = {"sdk": True} | ||||
|                         allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
|                 except Exception as e: | ||||
|                     print(e) | ||||
|                     test_cases[j["ssid_name"]] = {"sdk": False} | ||||
|                     allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
|         if mode == "wpa_eap": | ||||
|             for j in profile_data["ssid"][mode]: | ||||
|                 if mode in get_markers.keys() and get_markers[mode]: | ||||
|                     try: | ||||
|                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | ||||
|                                 j["appliedRadios"]): | ||||
|                             creates_profile = instantiate_profile.create_wpa_eap_passpoint_ssid_profile(profile_data=j) | ||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
|                     except Exception as e: | ||||
|                         print(e) | ||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
|                     try: | ||||
|                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | ||||
|                                 j["appliedRadios"]): | ||||
|                             creates_profile = instantiate_profile.create_wpa_eap_passpoint_ssid_profile(profile_data=j) | ||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
|                     except Exception as e: | ||||
|                         print(e) | ||||
|                         test_cases[j["wpa_eap_5g"]] = {"sdk": False} | ||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
|         if mode == "wpa2_eap": | ||||
|             for j in profile_data["ssid"][mode]: | ||||
|                 if mode in get_markers.keys() and get_markers[mode]: | ||||
|                     try: | ||||
|                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | ||||
|                                 j["appliedRadios"]): | ||||
|                             creates_profile = instantiate_profile.create_wpa2_eap_passpoint_ssid_profile(profile_data=j) | ||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
|                     except Exception as e: | ||||
|                         print(e) | ||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
|                     try: | ||||
|                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | ||||
|                                 j["appliedRadios"]): | ||||
|                             creates_profile = instantiate_profile.create_wpa2_eap_passpoint_ssid_profile(profile_data=j) | ||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
|                     except Exception as e: | ||||
|                         print(e) | ||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
|         if mode == "wpa2_only_eap": | ||||
|             for j in profile_data["ssid"][mode]: | ||||
|                 if mode in get_markers.keys() and get_markers[mode]: | ||||
|                     try: | ||||
|                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | ||||
|                                 j["appliedRadios"]): | ||||
|                             creates_profile = instantiate_profile.create_wpa2_only_eap_passpoint_ssid_profile( | ||||
|                                 profile_data=j) | ||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
|                     except Exception as e: | ||||
|                         print(e) | ||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
|                     try: | ||||
|                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | ||||
|                                 j["appliedRadios"]): | ||||
|                             creates_profile = instantiate_profile.create_wpa2_only_eap_passpoint_ssid_profile( | ||||
|                                 profile_data=j) | ||||
|                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
|                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
|                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
|                     except Exception as e: | ||||
|                         print(e) | ||||
|                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
|                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
|  | ||||
|     # Passpoint OSU ID provider profile creation | ||||
|     passpoint_provider_info = passpoint_provider_info | ||||
|     test_cases["passpoint_osu_id_provider"] = dict() | ||||
|     profile_name = testbed + "-Automation-Passpoint-OSU-ID-Provider-Profile" | ||||
|     passpoint_provider_info["profile_name"] = profile_name | ||||
|     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
|     try: | ||||
|         creates_profile = instantiate_profile.create_passpoint_osu_id_provider_profile( | ||||
|             profile_data=passpoint_provider_info) | ||||
|         allure.attach(body=str(creates_profile), name="Passpoint OSU ID provider Profile Created") | ||||
|         test_cases["passpoint_osu_id_provider"] = {"sdk": True} | ||||
|     except Exception as e: | ||||
|         print(e) | ||||
|         test_cases["passpoint_osu_id_provider"] = {"sdk": False} | ||||
|         allure.attach(body=str(e), name="Passpoint OSU ID provider Profile Creation Failed") | ||||
|  | ||||
|     # Passpoint operator profile creation | ||||
|     test_cases["passpoint_operator_profile"] = dict() | ||||
|     passpoint_operator_info = passpoint_operator_info | ||||
|     profile_name = testbed + "-Automation-Passpoint-Operator-Profile" | ||||
|     passpoint_operator_info["profile_name"] = profile_name | ||||
|     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
|     try: | ||||
|         creates_profile = instantiate_profile.create_passpoint_operator_profile(profile_data=passpoint_operator_info) | ||||
|         allure.attach(body=str(creates_profile), name="Passpoint Operator Profile Created") | ||||
|         test_cases["passpoint_operator_profile"] = {"sdk": True} | ||||
|         profile_data["passpoint_operator"] = profile_name | ||||
|     except Exception as e: | ||||
|         print(e) | ||||
|         test_cases["passpoint_operator_profile"] = {"sdk": False} | ||||
|         allure.attach(body=str(e), name="Passpoint Operator Profile Creation Failed") | ||||
|  | ||||
|     # Passpoint Venue profile creation | ||||
|     passpoint_venue_info = passpoint_venue_info | ||||
|     test_cases["passpoint_venue_profile"] = dict() | ||||
|     profile_name = testbed + "-Automation-Passpoint-Venue-Profile" | ||||
|     passpoint_venue_info["profile_name"] = profile_name | ||||
|     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
|     try: | ||||
|         creates_profile = instantiate_profile.create_passpoint_venue_profile(profile_data=passpoint_venue_info) | ||||
|         allure.attach(body=str(creates_profile), name="Passpoint Venue Profile Created") | ||||
|         test_cases["passpoint_venue_profile"] = {"sdk": True} | ||||
|         profile_data["passpoint_venue"] = profile_name | ||||
|     except Exception as e: | ||||
|         print(e) | ||||
|         test_cases["passpoint_venue"] = {"sdk": False} | ||||
|         allure.attach(body=str(e), name="Passpoint Venue Profile Creation Failed") | ||||
|  | ||||
|     # Passpoint profile creation | ||||
|     passpoint_profile_info = passpoint_profile_info | ||||
|     profile_name = testbed + "-Automation-Passpoint-Profile" | ||||
|     passpoint_profile_info["profile_name"] = profile_name | ||||
|     passpoint_profile_info["allowed_ssids"] = profile_data["allowed_ssids"] | ||||
|     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
|     try: | ||||
|         creates_profile = instantiate_profile.create_passpoint_profile(profile_data=passpoint_profile_info) | ||||
|         allure.attach(body=str(creates_profile), name="Passpoint Profile Created") | ||||
|         test_cases["passpoint"] = {"sdk": True} | ||||
|         profile_data["passpoint"] = profile_name | ||||
|     except Exception as e: | ||||
|         print(e) | ||||
|         test_cases["passpoint"] = {"sdk": False} | ||||
|         allure.attach(body=str(e), name="Passpoint Profile Creation Failed") | ||||
|  | ||||
|     # Update SSID profile with passpoint config | ||||
|     passpoint_profile_info = passpoint_profile_info | ||||
|     ssid_to_apply = None | ||||
|     for ssid_profile in profile_data["ssid"].keys(): | ||||
|         for ssid in profile_data["ssid"][ssid_profile]: | ||||
|             if ssid["ssid_name"] == "passpoint_profile_download": | ||||
|                 ssid_to_apply = ssid["ssid_name"] | ||||
|                 continue | ||||
|             if ssid["ssid_name"] in test_cases.keys(): | ||||
|                 allure.attach(body=str(ssid), name="Updating SSID profile") | ||||
|                 passpoint_profile_info["ssid_profile_name"] = ssid["profile_name"] | ||||
|                 instantiate_profile.update_ssid_profile(profile_info=passpoint_profile_info) | ||||
|  | ||||
|     # Equipment AP Profile Creation | ||||
|     ap_profile_info = dict() | ||||
|     ap_profile_info["profile_name"] = profile_data["equipment_ap"]["profile_name"] | ||||
|     ap_profile_info["ssid_names"] = [ssid_to_apply] | ||||
|     try: | ||||
|         instantiate_profile.set_ap_profile_custom(profile_data=ap_profile_info) | ||||
|         test_cases["equipment_ap"] = {"sdk": True} | ||||
|         allure.attach(body=str(profile_data["equipment_ap"]), name="Equipment AP Profile Created") | ||||
|     except Exception as e: | ||||
|         print(e) | ||||
|         test_cases["equipment_ap"] = {"sdk": False} | ||||
|         allure.attach(body=str(e), name="Equipment AP Profile Creation Failed") | ||||
|  | ||||
|  | ||||
|     def teardown_session(): | ||||
|         print("\nRemoving Profiles") | ||||
|         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["radius"]) | ||||
|         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_operator"]) | ||||
|         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint_venue"]) | ||||
|         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint"]) | ||||
|         allure.attach(body=str(profile_data['equipment_ap']['profile_name'] + "\n"), | ||||
|                       name="Tear Down in Profiles ") | ||||
|         time.sleep(20) | ||||
|  | ||||
|     request.addfinalizer(teardown_session) | ||||
|     yield test_cases, instantiate_profile, profile_data | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="function") | ||||
| def push_ap_profile(request, setup_profiles, get_equipment_ref, get_apnos, get_configuration): | ||||
|     parameter = dict(request.param) | ||||
|     test_cases, instantiate_profile, profile_data = setup_profiles | ||||
|     ssid_names = parameter["ssid_names"] | ||||
|     ap_profile_info = dict() | ||||
|     ap_profile_info["profile_name"] = profile_data["equipment_ap"]["profile_name"] | ||||
|     test_cases = {} | ||||
|     ap_profile_info["ssid_names"] = ssid_names | ||||
|     try: | ||||
|         instantiate_profile.update_ap_profile(profile_data=ap_profile_info) | ||||
|         test_cases["equipment_ap"] = {"sdk": True} | ||||
|         allure.attach(body=str(ap_profile_info["profile_name"]), name="Equipment AP Profile Updated") | ||||
|     except Exception as e: | ||||
|         print(e) | ||||
|         test_cases["equipment_ap"] = {"sdk": False} | ||||
|         allure.attach(body=str(e), name="Equipment AP Profile Update Failed") | ||||
|  | ||||
|     print("Pushing profiles on AP  :: ", ap_profile_info) | ||||
|     allure.attach(body=str(ap_profile_info), name="Pushing profiles on AP  :: ") | ||||
|     # Push the Equipment AP Profile to AP | ||||
|     try: | ||||
|         for i in get_equipment_ref: | ||||
|             instantiate_profile.push_profile_old_method(equipment_id=i) | ||||
|     except Exception as e: | ||||
|         print(e) | ||||
|         print("failed to push AP Profile") | ||||
|  | ||||
|     # Check the VIF Config and VIF State of SSIDs | ||||
|     time_start = time.time() | ||||
|     ap_ssh = get_apnos(get_configuration["access_point"][0], pwd="../libs/apnos/") | ||||
|     while time.time() - time_start < 240: | ||||
|         if ((time.time() - time_start) / 10) == 15: | ||||
|             ap_ssh = get_apnos(get_configuration["access_point"][0], pwd="../libs/apnos/") | ||||
|         vif_config = list(ap_ssh.get_vif_config_ssids()) | ||||
|         vif_config.sort() | ||||
|         vif_state = list(ap_ssh.get_vif_state_ssids()) | ||||
|         vif_state.sort() | ||||
|         for ssid in ssid_names: | ||||
|             test_cases[ssid] = dict() | ||||
|             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 | ||||
|         ssid_names.sort() | ||||
|         if vif_config == ssid_names == vif_state: | ||||
|             print("Waiting for Radios to apply config ") | ||||
|             time.sleep(200) | ||||
|             break | ||||
|         time.sleep(10) | ||||
|     allure.attach(body=str(vif_config), name="vifC status on AP :: ") | ||||
|     allure.attach(body=str(vif_state), name="vifS status on AP :: ") | ||||
|  | ||||
|     yield test_cases | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def passpoint_radius_server_info(): | ||||
|     allure.attach(body=str(PASSPOINT_RADIUS_SERVER_DATA), name="Passpoint RADIUS server Info: ") | ||||
|     yield PASSPOINT_RADIUS_SERVER_DATA | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def passpoint_radius_accounting_server_info(): | ||||
|     allure.attach(body=str(PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA), name="Passpoint RADIUS account server Info: ") | ||||
|     yield PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def passpoint_provider_info(): | ||||
|     allure.attach(body=str(PASSPOINT_PROVIDER_INFO), name="Passpoint Provider Info: ") | ||||
|     yield PASSPOINT_PROVIDER_INFO | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def passpoint_operator_info(): | ||||
|     allure.attach(body=str(PASSPOINT_OPERATOR_INFO), name="Passpoint operator Info: ") | ||||
|     yield PASSPOINT_OPERATOR_INFO | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def passpoint_venue_info(): | ||||
|     allure.attach(body=str(PASSPOINT_VENUE_INFO), name="Passpoint venue Info: ") | ||||
|     yield PASSPOINT_VENUE_INFO | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def passpoint_profile_info(): | ||||
|     allure.attach(body=str(PASSPOINT_PROFILE_INFO), name="Passpoint profile Info: ") | ||||
|     yield PASSPOINT_PROFILE_INFO | ||||
| # import os | ||||
| # import sys | ||||
| # | ||||
| # sys.path.append( | ||||
| #     os.path.dirname( | ||||
| #         os.path.realpath(__file__) | ||||
| #     ) | ||||
| # ) | ||||
| # if "libs" not in sys.path: | ||||
| #     sys.path.append(f"../libs") | ||||
| # | ||||
| # import time | ||||
| # import pytest | ||||
| # import allure | ||||
| # from collections import defaultdict | ||||
| # from lanforge.lf_tests import RunTest | ||||
| # from configuration import PASSPOINT_RADIUS_SERVER_DATA | ||||
| # from configuration import PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA | ||||
| # from configuration import PASSPOINT_PROVIDER_INFO | ||||
| # from configuration import PASSPOINT_OPERATOR_INFO | ||||
| # from configuration import PASSPOINT_VENUE_INFO | ||||
| # from configuration import PASSPOINT_PROFILE_INFO | ||||
| # from controller.controller_1x.controller import ProfileUtility | ||||
| # | ||||
| # | ||||
| # @allure.feature("PASSPOINT CONNECTIVITY SETUP") | ||||
| # @pytest.fixture(scope="class") | ||||
| # def setup_profiles(request, setup_controller, testbed, setup_vlan, get_equipment_ref, | ||||
| #                    instantiate_profile, get_markers, passpoint_provider_info, passpoint_operator_info, | ||||
| #                    passpoint_venue_info, passpoint_profile_info, | ||||
| #                    get_configuration, passpoint_radius_server_info, passpoint_radius_accounting_server_info, get_apnos): | ||||
| #     instantiate_profile = instantiate_profile(sdk_client=setup_controller) | ||||
| #     vlan_id, mode = 0, 0 | ||||
| #     instantiate_profile.cleanup_objects() | ||||
| #     parameter = dict(request.param) | ||||
| #     test_cases = {} | ||||
| #     profile_data = {} | ||||
| #     if parameter["mode"] not in ["BRIDGE", "NAT", "VLAN"]: | ||||
| #         print("Invalid Mode: ", parameter["mode"]) | ||||
| #         allure.attach(body=parameter["mode"], name="Invalid Mode: ") | ||||
| #         yield test_cases | ||||
| # | ||||
| #     if parameter["mode"] == "NAT": | ||||
| #         mode = "NAT" | ||||
| #         vlan_id = 1 | ||||
| #     if parameter["mode"] == "BRIDGE": | ||||
| #         mode = "BRIDGE" | ||||
| #         vlan_id = 1 | ||||
| #     if parameter["mode"] == "VLAN": | ||||
| #         mode = "BRIDGE" | ||||
| #         vlan_id = setup_vlan | ||||
| # | ||||
| #     ap_profile = testbed + "-Equipment-AP-Passpoint" | ||||
| #     instantiate_profile.delete_profile_by_name(profile_name=ap_profile) | ||||
| #     profile_data["equipment_ap"] = {"profile_name": ap_profile} | ||||
| # | ||||
| #     profile_data["ssid"] = {} | ||||
| #     # Only passpoint SSID need to be applied with passpoint profiles leaving ssid used for | ||||
| #     # profile download - passpoint_profile_download | ||||
| #     profile_data["allowed_ssids"] = [] | ||||
| #     for i in parameter["ssid_modes"]: | ||||
| #         profile_data["ssid"][i] = [] | ||||
| #         for j in range(len(parameter["ssid_modes"][i])): | ||||
| #             profile_name = testbed + "-SSID-" + i + "-" + str(j) + "-" + parameter["mode"] | ||||
| #             data = parameter["ssid_modes"][i][j] | ||||
| #             data["profile_name"] = profile_name | ||||
| #             if "mode" not in dict(data).keys(): | ||||
| #                 data["mode"] = mode | ||||
| #             if "vlan" not in dict(data).keys(): | ||||
| #                 data["vlan"] = vlan_id | ||||
| #             instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
| #             profile_data["ssid"][i].append(data) | ||||
| # | ||||
| #     instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile-" + mode) | ||||
| #     time.sleep(10) | ||||
| # | ||||
| #     # RF Profile Creation | ||||
| #     rf_profile_data = { | ||||
| #         "name": testbed + "-RF-Profile-" + parameter["mode"] + "-" + get_configuration["access_point"][0]["mode"] | ||||
| #     } | ||||
| #     try: | ||||
| #         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, | ||||
| #                                                              mode=get_configuration["access_point"][0]["mode"]) | ||||
| #         allure.attach(body=str(rf_profile_data), | ||||
| #                       name="RF Profile Created : " + get_configuration["access_point"][0]["mode"]) | ||||
| #     except Exception as e: | ||||
| #         print(e) | ||||
| #         allure.attach(body=str(e), name="Exception ") | ||||
| # | ||||
| #     # Radius Profile Creation | ||||
| #     passpoint_radius_server_info = passpoint_radius_server_info | ||||
| #     passpoint_radius_server_info["name"] = testbed + "-Automation-Radius-Profile" | ||||
| #     instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Automation-Radius-Profile") | ||||
| #     try: | ||||
| #         instantiate_profile.create_radius_profile(radius_info=passpoint_radius_server_info, | ||||
| #                                                   radius_accounting_info=passpoint_radius_accounting_server_info) | ||||
| #         test_cases["radius_profile"] = True | ||||
| #         allure.attach(body=str(passpoint_radius_server_info), name="Radius Profile Created") | ||||
| #     except Exception as e: | ||||
| #         print(e) | ||||
| #         test_cases["radius_profile"] = False | ||||
| # | ||||
| #     # SSID Profile Creation | ||||
| #     for mode in profile_data["ssid"]: | ||||
| #         if mode == "open": | ||||
| #             for j in profile_data["ssid"][mode]: | ||||
| #                 try: | ||||
| #                     if "is2dot4GHz" in list(j["appliedRadios"]): | ||||
| #                         creates_profile = instantiate_profile.create_open_ssid_profile(profile_data=j) | ||||
| #                         test_cases[j["ssid_name"]] = {"sdk": True} | ||||
| #                         allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
| #                 except Exception as e: | ||||
| #                     print(e) | ||||
| #                     test_cases[j["ssid_name"]] = {"sdk": False} | ||||
| #                     allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
| #         if mode == "wpa_eap": | ||||
| #             for j in profile_data["ssid"][mode]: | ||||
| #                 if mode in get_markers.keys() and get_markers[mode]: | ||||
| #                     try: | ||||
| #                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | ||||
| #                                 j["appliedRadios"]): | ||||
| #                             creates_profile = instantiate_profile.create_wpa_eap_passpoint_ssid_profile(profile_data=j) | ||||
| #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
| #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
| #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
| #                     except Exception as e: | ||||
| #                         print(e) | ||||
| #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
| #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
| #                     try: | ||||
| #                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | ||||
| #                                 j["appliedRadios"]): | ||||
| #                             creates_profile = instantiate_profile.create_wpa_eap_passpoint_ssid_profile(profile_data=j) | ||||
| #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
| #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
| #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
| #                     except Exception as e: | ||||
| #                         print(e) | ||||
| #                         test_cases[j["wpa_eap_5g"]] = {"sdk": False} | ||||
| #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
| #         if mode == "wpa2_eap": | ||||
| #             for j in profile_data["ssid"][mode]: | ||||
| #                 if mode in get_markers.keys() and get_markers[mode]: | ||||
| #                     try: | ||||
| #                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | ||||
| #                                 j["appliedRadios"]): | ||||
| #                             creates_profile = instantiate_profile.create_wpa2_eap_passpoint_ssid_profile(profile_data=j) | ||||
| #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
| #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
| #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
| #                     except Exception as e: | ||||
| #                         print(e) | ||||
| #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
| #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
| #                     try: | ||||
| #                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | ||||
| #                                 j["appliedRadios"]): | ||||
| #                             creates_profile = instantiate_profile.create_wpa2_eap_passpoint_ssid_profile(profile_data=j) | ||||
| #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
| #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
| #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
| #                     except Exception as e: | ||||
| #                         print(e) | ||||
| #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
| #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
| #         if mode == "wpa2_only_eap": | ||||
| #             for j in profile_data["ssid"][mode]: | ||||
| #                 if mode in get_markers.keys() and get_markers[mode]: | ||||
| #                     try: | ||||
| #                         if "twog" in get_markers.keys() and get_markers["twog"] and "is2dot4GHz" in list( | ||||
| #                                 j["appliedRadios"]): | ||||
| #                             creates_profile = instantiate_profile.create_wpa2_only_eap_passpoint_ssid_profile( | ||||
| #                                 profile_data=j) | ||||
| #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
| #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
| #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
| #                     except Exception as e: | ||||
| #                         print(e) | ||||
| #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
| #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
| #                     try: | ||||
| #                         if "fiveg" in get_markers.keys() and get_markers["fiveg"] and "is5GHz" in list( | ||||
| #                                 j["appliedRadios"]): | ||||
| #                             creates_profile = instantiate_profile.create_wpa2_only_eap_passpoint_ssid_profile( | ||||
| #                                 profile_data=j) | ||||
| #                             profile_data["allowed_ssids"].append(creates_profile._id) | ||||
| #                             test_cases[j["ssid_name"]] = {"sdk": True} | ||||
| #                             allure.attach(body=str(creates_profile), name="SSID Profile Created") | ||||
| #                     except Exception as e: | ||||
| #                         print(e) | ||||
| #                         test_cases[j["ssid_name"]] = {"sdk": False} | ||||
| #                         allure.attach(body=str(e), name="SSID Profile Creation Failed") | ||||
| # | ||||
| #     # Passpoint OSU ID provider profile creation | ||||
| #     passpoint_provider_info = passpoint_provider_info | ||||
| #     test_cases["passpoint_osu_id_provider"] = dict() | ||||
| #     profile_name = testbed + "-Automation-Passpoint-OSU-ID-Provider-Profile" | ||||
| #     passpoint_provider_info["profile_name"] = profile_name | ||||
| #     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
| #     try: | ||||
| #         creates_profile = instantiate_profile.create_passpoint_osu_id_provider_profile( | ||||
| #             profile_data=passpoint_provider_info) | ||||
| #         allure.attach(body=str(creates_profile), name="Passpoint OSU ID provider Profile Created") | ||||
| #         test_cases["passpoint_osu_id_provider"] = {"sdk": True} | ||||
| #     except Exception as e: | ||||
| #         print(e) | ||||
| #         test_cases["passpoint_osu_id_provider"] = {"sdk": False} | ||||
| #         allure.attach(body=str(e), name="Passpoint OSU ID provider Profile Creation Failed") | ||||
| # | ||||
| #     # Passpoint operator profile creation | ||||
| #     test_cases["passpoint_operator_profile"] = dict() | ||||
| #     passpoint_operator_info = passpoint_operator_info | ||||
| #     profile_name = testbed + "-Automation-Passpoint-Operator-Profile" | ||||
| #     passpoint_operator_info["profile_name"] = profile_name | ||||
| #     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
| #     try: | ||||
| #         creates_profile = instantiate_profile.create_passpoint_operator_profile(profile_data=passpoint_operator_info) | ||||
| #         allure.attach(body=str(creates_profile), name="Passpoint Operator Profile Created") | ||||
| #         test_cases["passpoint_operator_profile"] = {"sdk": True} | ||||
| #         profile_data["passpoint_operator"] = profile_name | ||||
| #     except Exception as e: | ||||
| #         print(e) | ||||
| #         test_cases["passpoint_operator_profile"] = {"sdk": False} | ||||
| #         allure.attach(body=str(e), name="Passpoint Operator Profile Creation Failed") | ||||
| # | ||||
| #     # Passpoint Venue profile creation | ||||
| #     passpoint_venue_info = passpoint_venue_info | ||||
| #     test_cases["passpoint_venue_profile"] = dict() | ||||
| #     profile_name = testbed + "-Automation-Passpoint-Venue-Profile" | ||||
| #     passpoint_venue_info["profile_name"] = profile_name | ||||
| #     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
| #     try: | ||||
| #         creates_profile = instantiate_profile.create_passpoint_venue_profile(profile_data=passpoint_venue_info) | ||||
| #         allure.attach(body=str(creates_profile), name="Passpoint Venue Profile Created") | ||||
| #         test_cases["passpoint_venue_profile"] = {"sdk": True} | ||||
| #         profile_data["passpoint_venue"] = profile_name | ||||
| #     except Exception as e: | ||||
| #         print(e) | ||||
| #         test_cases["passpoint_venue"] = {"sdk": False} | ||||
| #         allure.attach(body=str(e), name="Passpoint Venue Profile Creation Failed") | ||||
| # | ||||
| #     # Passpoint profile creation | ||||
| #     passpoint_profile_info = passpoint_profile_info | ||||
| #     profile_name = testbed + "-Automation-Passpoint-Profile" | ||||
| #     passpoint_profile_info["profile_name"] = profile_name | ||||
| #     passpoint_profile_info["allowed_ssids"] = profile_data["allowed_ssids"] | ||||
| #     instantiate_profile.delete_profile_by_name(profile_name=profile_name) | ||||
| #     try: | ||||
| #         creates_profile = instantiate_profile.create_passpoint_profile(profile_data=passpoint_profile_info) | ||||
| #         allure.attach(body=str(creates_profile), name="Passpoint Profile Created") | ||||
| #         test_cases["passpoint"] = {"sdk": True} | ||||
| #         profile_data["passpoint"] = profile_name | ||||
| #     except Exception as e: | ||||
| #         print(e) | ||||
| #         test_cases["passpoint"] = {"sdk": False} | ||||
| #         allure.attach(body=str(e), name="Passpoint Profile Creation Failed") | ||||
| # | ||||
| #     # Update SSID profile with passpoint config | ||||
| #     passpoint_profile_info = passpoint_profile_info | ||||
| #     ssid_to_apply = None | ||||
| #     for ssid_profile in profile_data["ssid"].keys(): | ||||
| #         for ssid in profile_data["ssid"][ssid_profile]: | ||||
| #             if ssid["ssid_name"] == "passpoint_profile_download": | ||||
| #                 ssid_to_apply = ssid["ssid_name"] | ||||
| #                 continue | ||||
| #             if ssid["ssid_name"] in test_cases.keys(): | ||||
| #                 allure.attach(body=str(ssid), name="Updating SSID profile") | ||||
| #                 passpoint_profile_info["ssid_profile_name"] = ssid["profile_name"] | ||||
| #                 instantiate_profile.update_ssid_profile(profile_info=passpoint_profile_info) | ||||
| # | ||||
| #     # Equipment AP Profile Creation | ||||
| #     ap_profile_info = dict() | ||||
| #     ap_profile_info["profile_name"] = profile_data["equipment_ap"]["profile_name"] | ||||
| #     ap_profile_info["ssid_names"] = [ssid_to_apply] | ||||
| #     try: | ||||
| #         instantiate_profile.set_ap_profile_custom(profile_data=ap_profile_info) | ||||
| #         test_cases["equipment_ap"] = {"sdk": True} | ||||
| #         allure.attach(body=str(profile_data["equipment_ap"]), name="Equipment AP Profile Created") | ||||
| #     except Exception as e: | ||||
| #         print(e) | ||||
| #         test_cases["equipment_ap"] = {"sdk": False} | ||||
| #         allure.attach(body=str(e), name="Equipment AP Profile Creation Failed") | ||||
| # | ||||
| # | ||||
| #     def teardown_session(): | ||||
| #         print("\nRemoving Profiles") | ||||
| #         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["radius"]) | ||||
| #         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_operator"]) | ||||
| #         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint_venue"]) | ||||
| #         instantiate_profile.delete_profile(instantiate_profile.profile_creation_ids["passpoint"]) | ||||
| #         allure.attach(body=str(profile_data['equipment_ap']['profile_name'] + "\n"), | ||||
| #                       name="Tear Down in Profiles ") | ||||
| #         time.sleep(20) | ||||
| # | ||||
| #     request.addfinalizer(teardown_session) | ||||
| #     yield test_cases, instantiate_profile, profile_data | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="function") | ||||
| # def push_ap_profile(request, setup_profiles, get_equipment_ref, get_apnos, get_configuration): | ||||
| #     parameter = dict(request.param) | ||||
| #     test_cases, instantiate_profile, profile_data = setup_profiles | ||||
| #     ssid_names = parameter["ssid_names"] | ||||
| #     ap_profile_info = dict() | ||||
| #     ap_profile_info["profile_name"] = profile_data["equipment_ap"]["profile_name"] | ||||
| #     test_cases = {} | ||||
| #     ap_profile_info["ssid_names"] = ssid_names | ||||
| #     try: | ||||
| #         instantiate_profile.update_ap_profile(profile_data=ap_profile_info) | ||||
| #         test_cases["equipment_ap"] = {"sdk": True} | ||||
| #         allure.attach(body=str(ap_profile_info["profile_name"]), name="Equipment AP Profile Updated") | ||||
| #     except Exception as e: | ||||
| #         print(e) | ||||
| #         test_cases["equipment_ap"] = {"sdk": False} | ||||
| #         allure.attach(body=str(e), name="Equipment AP Profile Update Failed") | ||||
| # | ||||
| #     print("Pushing profiles on AP  :: ", ap_profile_info) | ||||
| #     allure.attach(body=str(ap_profile_info), name="Pushing profiles on AP  :: ") | ||||
| #     # Push the Equipment AP Profile to AP | ||||
| #     try: | ||||
| #         for i in get_equipment_ref: | ||||
| #             instantiate_profile.push_profile_old_method(equipment_id=i) | ||||
| #     except Exception as e: | ||||
| #         print(e) | ||||
| #         print("failed to push AP Profile") | ||||
| # | ||||
| #     # Check the VIF Config and VIF State of SSIDs | ||||
| #     time_start = time.time() | ||||
| #     ap_ssh = get_apnos(get_configuration["access_point"][0], pwd="../libs/apnos/") | ||||
| #     while time.time() - time_start < 240: | ||||
| #         if ((time.time() - time_start) / 10) == 15: | ||||
| #             ap_ssh = get_apnos(get_configuration["access_point"][0], pwd="../libs/apnos/") | ||||
| #         vif_config = list(ap_ssh.get_vif_config_ssids()) | ||||
| #         vif_config.sort() | ||||
| #         vif_state = list(ap_ssh.get_vif_state_ssids()) | ||||
| #         vif_state.sort() | ||||
| #         for ssid in ssid_names: | ||||
| #             test_cases[ssid] = dict() | ||||
| #             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 | ||||
| #         ssid_names.sort() | ||||
| #         if vif_config == ssid_names == vif_state: | ||||
| #             print("Waiting for Radios to apply config ") | ||||
| #             time.sleep(200) | ||||
| #             break | ||||
| #         time.sleep(10) | ||||
| #     allure.attach(body=str(vif_config), name="vifC status on AP :: ") | ||||
| #     allure.attach(body=str(vif_state), name="vifS status on AP :: ") | ||||
| # | ||||
| #     yield test_cases | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def passpoint_radius_server_info(): | ||||
| #     allure.attach(body=str(PASSPOINT_RADIUS_SERVER_DATA), name="Passpoint RADIUS server Info: ") | ||||
| #     yield PASSPOINT_RADIUS_SERVER_DATA | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def passpoint_radius_accounting_server_info(): | ||||
| #     allure.attach(body=str(PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA), name="Passpoint RADIUS account server Info: ") | ||||
| #     yield PASSPOINT_RADIUS_ACCOUNTING_SERVER_DATA | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def passpoint_provider_info(): | ||||
| #     allure.attach(body=str(PASSPOINT_PROVIDER_INFO), name="Passpoint Provider Info: ") | ||||
| #     yield PASSPOINT_PROVIDER_INFO | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def passpoint_operator_info(): | ||||
| #     allure.attach(body=str(PASSPOINT_OPERATOR_INFO), name="Passpoint operator Info: ") | ||||
| #     yield PASSPOINT_OPERATOR_INFO | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def passpoint_venue_info(): | ||||
| #     allure.attach(body=str(PASSPOINT_VENUE_INFO), name="Passpoint venue Info: ") | ||||
| #     yield PASSPOINT_VENUE_INFO | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def passpoint_profile_info(): | ||||
| #     allure.attach(body=str(PASSPOINT_PROFILE_INFO), name="Passpoint profile Info: ") | ||||
| #     yield PASSPOINT_PROFILE_INFO | ||||
|   | ||||
| @@ -1,160 +1,160 @@ | ||||
| import json | ||||
| import os | ||||
| import sys | ||||
|  | ||||
| sys.path.append( | ||||
|     os.path.dirname( | ||||
|         os.path.realpath(__file__) | ||||
|     ) | ||||
| ) | ||||
| if "libs" not in sys.path: | ||||
|     sys.path.append(f'../libs') | ||||
|  | ||||
| from controller.controller_1x.controller import ProfileUtility | ||||
| from controller.controller_2x.controller import UProfileUtility | ||||
| import time | ||||
| from lanforge.lf_tests import RunTest | ||||
| from lanforge.lf_tools import ChamberView | ||||
| import pytest | ||||
| import allure | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def instantiate_profile(request): | ||||
|     if request.config.getoption("1.x"): | ||||
|         yield ProfileUtility | ||||
|     else: | ||||
|         yield UProfileUtility | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def lf_tools(get_configuration, testbed): | ||||
|     lf_tools_obj = ChamberView(lanforge_data=get_configuration['traffic_generator']['details'], | ||||
|                                access_point_data=get_configuration['access_point'], | ||||
|                                testbed=testbed) | ||||
|     yield lf_tools_obj | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def create_lanforge_chamberview(lf_tools): | ||||
|     scenario_object, scenario_name = lf_tools.Chamber_View() | ||||
|     return scenario_name | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def create_lanforge_chamberview_dut(lf_tools): | ||||
|     dut_object, dut_name = lf_tools.Create_Dut() | ||||
|     yield dut_name | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def setup_mesh_scenario(lf_tools): | ||||
|     mesh_obj  = lf_tools.create_mesh_scenario() | ||||
|     yield mesh_obj | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def create_lanforge_chamberview_dut(lf_tools, skip_lf): | ||||
|     dut_name = "" | ||||
|     if not skip_lf: | ||||
|         dut_object, dut_name = lf_tools.Create_Dut() | ||||
|     return dut_name | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def create_mesh_dut(lf_tools, skip_lf, ssid_data): | ||||
|     dut_name = "" | ||||
|     if not skip_lf: | ||||
|         mesh_dut_object, dut_name = lf_tools.create_mesh_dut(ssid_data=ssid_data) | ||||
|     yield dut_name | ||||
|  | ||||
| @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, | ||||
|                            lf_tools, ): | ||||
|     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, | ||||
|                                               lf_tools, skip_lf=False, open_flow=None | ||||
|                                               ) | ||||
|     yield ret_var | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="class") | ||||
| def setup_profiles(request, setup_controller, testbed, get_equipment_id, fixtures_ver, | ||||
|                    instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools, | ||||
|                    get_security_flags, get_configuration, radius_info, get_apnos, radius_accounting_info): | ||||
|     lf_tools.reset_scenario() | ||||
|     param = dict(request.param) | ||||
|  | ||||
|     # VLAN Setup | ||||
|     if request.param["mode"] == "VLAN": | ||||
|  | ||||
|         vlan_list = list() | ||||
|         refactored_vlan_list = list() | ||||
|         ssid_modes = request.param["ssid_modes"].keys() | ||||
|         for mode in ssid_modes: | ||||
|             for ssid in range(len(request.param["ssid_modes"][mode])): | ||||
|                 if "vlan" in request.param["ssid_modes"][mode][ssid]: | ||||
|                     vlan_list.append(request.param["ssid_modes"][mode][ssid]["vlan"]) | ||||
|                 else: | ||||
|                     pass | ||||
|         if vlan_list: | ||||
|             [refactored_vlan_list.append(x) for x in vlan_list if x not in refactored_vlan_list] | ||||
|             vlan_list = refactored_vlan_list | ||||
|             for i in range(len(vlan_list)): | ||||
|                 if vlan_list[i] > 4095 or vlan_list[i] < 1: | ||||
|                     vlan_list.pop(i) | ||||
|     if request.param["mode"] == "VLAN": | ||||
|         lf_tools.add_vlan(vlan_ids=vlan_list) | ||||
|  | ||||
|     # call this, if 1.x | ||||
|     return_var = fixtures_ver.setup_profiles(request, param, setup_controller, testbed, get_equipment_id, | ||||
|                                              instantiate_profile, | ||||
|                                              get_markers, create_lanforge_chamberview_dut, lf_tools, | ||||
|                                              get_security_flags, get_configuration, radius_info, get_apnos, | ||||
|                                              radius_accounting_info) | ||||
|  | ||||
|     yield return_var | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def lf_test(get_configuration, setup_influx): | ||||
|     obj = RunTest(configuration_data=get_configuration, influx_params=setup_influx) | ||||
|     yield obj | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def station_names_twog(request, get_configuration): | ||||
|     station_names = [] | ||||
|     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)) | ||||
|     yield station_names | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def station_names_fiveg(request, get_configuration): | ||||
|     station_names = [] | ||||
|     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)) | ||||
|     yield station_names | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="session") | ||||
| def num_stations(request): | ||||
|     num_sta = int(request.config.getini("num_stations")) | ||||
|     yield num_sta | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="class") | ||||
| def get_vif_state(get_apnos, get_configuration, request, lf_tools): | ||||
|     if request.config.getoption("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.sort() | ||||
|         yield vif_state | ||||
|     else: | ||||
|         yield lf_tools.ssid_list | ||||
|  | ||||
|  | ||||
| @pytest.fixture(scope="class") | ||||
| def get_vlan_list(get_apnos, get_configuration): | ||||
|     ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") | ||||
|     vlan_list = list(ap_ssh.get_vlan()) | ||||
|     vlan_list.sort() | ||||
|     yield vlan_list | ||||
| # import json | ||||
| # import os | ||||
| # import sys | ||||
| # | ||||
| # sys.path.append( | ||||
| #     os.path.dirname( | ||||
| #         os.path.realpath(__file__) | ||||
| #     ) | ||||
| # ) | ||||
| # if "libs" not in sys.path: | ||||
| #     sys.path.append(f'../libs') | ||||
| # | ||||
| # from controller.controller_1x.controller import ProfileUtility | ||||
| # from controller.controller_2x.controller import UProfileUtility | ||||
| # import time | ||||
| # from lanforge.lf_tests import RunTest | ||||
| # from lanforge.lf_tools import ChamberView | ||||
| # import pytest | ||||
| # import allure | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def instantiate_profile(request): | ||||
| #     if request.config.getoption("1.x"): | ||||
| #         yield ProfileUtility | ||||
| #     else: | ||||
| #         yield UProfileUtility | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def lf_tools(get_configuration, testbed): | ||||
| #     lf_tools_obj = ChamberView(lanforge_data=get_configuration['traffic_generator']['details'], | ||||
| #                                access_point_data=get_configuration['access_point'], | ||||
| #                                testbed=testbed) | ||||
| #     yield lf_tools_obj | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def create_lanforge_chamberview(lf_tools): | ||||
| #     scenario_object, scenario_name = lf_tools.Chamber_View() | ||||
| #     return scenario_name | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def create_lanforge_chamberview_dut(lf_tools): | ||||
| #     dut_object, dut_name = lf_tools.Create_Dut() | ||||
| #     yield dut_name | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def setup_mesh_scenario(lf_tools): | ||||
| #     mesh_obj  = lf_tools.create_mesh_scenario() | ||||
| #     yield mesh_obj | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def create_lanforge_chamberview_dut(lf_tools, skip_lf): | ||||
| #     dut_name = "" | ||||
| #     if not skip_lf: | ||||
| #         dut_object, dut_name = lf_tools.Create_Dut() | ||||
| #     return dut_name | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def create_mesh_dut(lf_tools, skip_lf, ssid_data): | ||||
| #     dut_name = "" | ||||
| #     if not skip_lf: | ||||
| #         mesh_dut_object, dut_name = lf_tools.create_mesh_dut(ssid_data=ssid_data) | ||||
| #     yield dut_name | ||||
| # | ||||
| # @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, | ||||
| #                            lf_tools, ): | ||||
| #     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, | ||||
| #                                               lf_tools, skip_lf=False, open_flow=None | ||||
| #                                               ) | ||||
| #     yield ret_var | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="class") | ||||
| # def setup_profiles(request, setup_controller, testbed, get_equipment_id, fixtures_ver, | ||||
| #                    instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools, | ||||
| #                    get_security_flags, get_configuration, radius_info, get_apnos, radius_accounting_info): | ||||
| #     lf_tools.reset_scenario() | ||||
| #     param = dict(request.param) | ||||
| # | ||||
| #     # VLAN Setup | ||||
| #     if request.param["mode"] == "VLAN": | ||||
| # | ||||
| #         vlan_list = list() | ||||
| #         refactored_vlan_list = list() | ||||
| #         ssid_modes = request.param["ssid_modes"].keys() | ||||
| #         for mode in ssid_modes: | ||||
| #             for ssid in range(len(request.param["ssid_modes"][mode])): | ||||
| #                 if "vlan" in request.param["ssid_modes"][mode][ssid]: | ||||
| #                     vlan_list.append(request.param["ssid_modes"][mode][ssid]["vlan"]) | ||||
| #                 else: | ||||
| #                     pass | ||||
| #         if vlan_list: | ||||
| #             [refactored_vlan_list.append(x) for x in vlan_list if x not in refactored_vlan_list] | ||||
| #             vlan_list = refactored_vlan_list | ||||
| #             for i in range(len(vlan_list)): | ||||
| #                 if vlan_list[i] > 4095 or vlan_list[i] < 1: | ||||
| #                     vlan_list.pop(i) | ||||
| #     if request.param["mode"] == "VLAN": | ||||
| #         lf_tools.add_vlan(vlan_ids=vlan_list) | ||||
| # | ||||
| #     # call this, if 1.x | ||||
| #     return_var = fixtures_ver.setup_profiles(request, param, setup_controller, testbed, get_equipment_id, | ||||
| #                                              instantiate_profile, | ||||
| #                                              get_markers, create_lanforge_chamberview_dut, lf_tools, | ||||
| #                                              get_security_flags, get_configuration, radius_info, get_apnos, | ||||
| #                                              radius_accounting_info) | ||||
| # | ||||
| #     yield return_var | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def lf_test(get_configuration, setup_influx): | ||||
| #     obj = RunTest(configuration_data=get_configuration, influx_params=setup_influx) | ||||
| #     yield obj | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def station_names_twog(request, get_configuration): | ||||
| #     station_names = [] | ||||
| #     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)) | ||||
| #     yield station_names | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def station_names_fiveg(request, get_configuration): | ||||
| #     station_names = [] | ||||
| #     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)) | ||||
| #     yield station_names | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="session") | ||||
| # def num_stations(request): | ||||
| #     num_sta = int(request.config.getini("num_stations")) | ||||
| #     yield num_sta | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="class") | ||||
| # def get_vif_state(get_apnos, get_configuration, request, lf_tools): | ||||
| #     if request.config.getoption("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.sort() | ||||
| #         yield vif_state | ||||
| #     else: | ||||
| #         yield lf_tools.ssid_list | ||||
| # | ||||
| # | ||||
| # @pytest.fixture(scope="class") | ||||
| # def get_vlan_list(get_apnos, get_configuration): | ||||
| #     ap_ssh = get_apnos(get_configuration['access_point'][0], pwd="../libs/apnos/") | ||||
| #     vlan_list = list(ap_ssh.get_vlan()) | ||||
| #     vlan_list.sort() | ||||
| #     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 pytest | ||||
| import os | ||||
| import sys | ||||
| """ Environment Paths """ | ||||
| if "libs" not in sys.path: | ||||
|     sys.path.append(f'../libs') | ||||
| for folder in 'py-json', 'py-scripts': | ||||
|     if folder not in sys.path: | ||||
|         sys.path.append(f'../lanforge/lanforge-scripts/{folder}') | ||||
|  | ||||
| sys.path.append( | ||||
|     os.path.dirname( | ||||
|         os.path.realpath(__file__) | ||||
|     ) | ||||
| ) | ||||
| sys.path.append(f"../lanforge/lanforge-scripts/py-scripts/tip-cicd-sanity") | ||||
|  | ||||
| sys.path.append(f'../libs') | ||||
| sys.path.append(f'../libs/lanforge/') | ||||
| sys.path.append(f'../lanforge/lanforge-scripts') | ||||
|  | ||||
| from LANforge.LFUtils import * | ||||
|  | ||||
| if 'py-json' not in sys.path: | ||||
|     sys.path.append('../py-scripts') | ||||
| from controller.controller_3x.controller import CController | ||||
|  | ||||
|  | ||||
| class Fixtures_3x: | ||||
|  | ||||
|     def __init__(self, configuration={}, run_lf=False, cc_1=False): | ||||
|         self.lab_info = configuration | ||||
|         self.run_lf = run_lf | ||||
|         self.cc_1 = cc_1 | ||||
|         # print(self.lab_info) | ||||
|         print("cc.1") | ||||
|         self.controller_obj = "" | ||||
|  | ||||
|  | ||||
|     def setup_profiles(self, request, param, run_lf, instantiate_profile, get_configuration, get_markers, lf_tools, lf_reports): | ||||
|         table1= [] | ||||
|         instantiate_profile_obj = instantiate_profile(controller_data=get_configuration['controller'], | ||||
|                                                   timeout="10", ssid_data=None, | ||||
|                                                   ap_data=self.lab_info['access_point'], type=0) | ||||
|  | ||||
|         instantiate_profile_obj.enable_all_bands() | ||||
|  | ||||
|  | ||||
|         if run_lf: | ||||
|             return 0 | ||||
|         print("check params") | ||||
|         # gives parameter value of setup_params_general | ||||
|         parameter = dict(param) | ||||
|         print("parameter", parameter) | ||||
|  | ||||
|         test_cases = {} | ||||
|         profile_data= {} | ||||
|         var = "" | ||||
|         list_key = list(parameter.keys()) | ||||
|  | ||||
|         if parameter['mode'] not in ["BRIDGE", "NAT", "VLAN"]: | ||||
|             print("Invalid Mode: ", parameter['mode']) | ||||
|             return test_cases | ||||
|         profile_data["ssid"] = {} | ||||
|         lf_dut_data = [] | ||||
|         for i in parameter["ssid_modes"]: | ||||
|             profile_data["ssid"][i] = [] | ||||
|             for j in range(len(parameter["ssid_modes"][i])): | ||||
|                 data = parameter["ssid_modes"][i][j] | ||||
|                 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'}]}} | ||||
|         print("profile data", profile_data) | ||||
|  | ||||
|  | ||||
|         # create wlan | ||||
|         for mode in profile_data['ssid']: | ||||
|             if mode == "wpa2_personal": | ||||
|                 for j in profile_data["ssid"][mode]: | ||||
|                     if mode in get_markers.keys() and get_markers[mode]: | ||||
|                         try: | ||||
|                             if j["appliedRadios"].__contains__("2G"): | ||||
|                                 lf_dut_data.append(j) | ||||
|                             if j["appliedRadios"].__contains__("5G"): | ||||
|                                 lf_dut_data.append(j) | ||||
|                             if j["appliedRadios"].__contains__("6G"): | ||||
|                                 lf_dut_data.append(j) | ||||
|                             j["appliedRadios"] = list(set(j["appliedRadios"])) | ||||
|                             j['security'] = 'wpa2' | ||||
|                             # print("dut data", lf_dut_data) | ||||
|                             test_cases["wpa_2g"] = True | ||||
|                         except Exception as e: | ||||
|                             print(e) | ||||
|                             test_cases["wpa2_personal"] = False | ||||
|             if mode == "wpa3_personal": | ||||
|                 for j in profile_data["ssid"][mode]: | ||||
|                     if mode in get_markers.keys() and get_markers[mode]: | ||||
|                         print( profile_data["ssid"][mode]) | ||||
|                         print(j) | ||||
|                         try: | ||||
|                             if j["appliedRadios"].__contains__("2G"): | ||||
|                                 lf_dut_data.append(j) | ||||
|                             if j["appliedRadios"].__contains__("5G"): | ||||
|                                 lf_dut_data.append(j) | ||||
|                             if j["appliedRadios"].__contains__("6G"): | ||||
|                                 lf_dut_data.append(j) | ||||
|                                 print(lf_dut_data) | ||||
|                             j["appliedRadios"] = list(set(j["appliedRadios"])) | ||||
|                             j['security'] = 'wpa3' | ||||
|                             test_cases["wpa_2g"] = True | ||||
|                         except Exception as e: | ||||
|                             print(e) | ||||
|                             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'}] | ||||
|         print("lf dut data", lf_dut_data) | ||||
|         allure.attach(name="wlan data passing", body=str(parameter)) | ||||
|         ap = instantiate_profile_obj.show_ap_summary() | ||||
|         print("show ap summ", ap) | ||||
|         allure.attach(name="show ap summary", body=str(ap)) | ||||
|  | ||||
|         print("create 3 wlans on slot1,2 and 3") | ||||
|         for ap_name in range(len(self.lab_info['access_point'])): | ||||
|             print("ap ", ap_name) | ||||
|             # instantiate controller object | ||||
|  | ||||
|             print("set channel and bandwidth") | ||||
|             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) | ||||
|             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"]) | ||||
|             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"], | ||||
|                                                 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"])) | ||||
|             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"]) | ||||
|             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"]) | ||||
|             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)) | ||||
|  | ||||
|             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)) | ||||
|  | ||||
|             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)) | ||||
|  | ||||
|             # table1.append(tab) | ||||
|  | ||||
|  | ||||
|             if ap_name == 0: | ||||
|                 for band in range(len(lf_dut_data)): | ||||
|                     if lf_dut_data[band]["appliedRadios"] == ["2G"]: | ||||
|                         instantiate_profile_obj.no_logging_console() | ||||
|                         instantiate_profile_obj.line_console() | ||||
|                         id_slot = instantiate_profile_obj.get_slot_id_wlan() | ||||
|                         ssid_name = instantiate_profile_obj.get_ssid_name_on_id() | ||||
|                         if id_slot[0] == "1": | ||||
|                             instantiate_profile_obj.show_shutdown_2ghz_ap() | ||||
|                             instantiate_profile_obj.disable_wlan(wlan=ssid_name[0]) | ||||
|                             instantiate_profile_obj.ap_2ghz_shutdown() | ||||
|                             instantiate_profile_obj.get_ssids() | ||||
|                             instantiate_profile_obj.delete_wlan(ssid=ssid_name[0]) | ||||
|                             instantiate_profile_obj.get_ssids() | ||||
|                             instantiate_profile_obj.create_wlan_wpa2(id="1", wlan=lf_dut_data[0]['ssid_name'], | ||||
|                                                                      wlanssid=lf_dut_data[0]['ssid_name'], | ||||
|                                                                      key=lf_dut_data[0]['security_key']) | ||||
|                         else: | ||||
|                             print(lf_dut_data[0]['ssid_name']) | ||||
|                             instantiate_profile_obj.get_ssids() | ||||
|                             instantiate_profile_obj.show_shutdown_2ghz_ap() | ||||
|                             instantiate_profile_obj.get_ssids() | ||||
|                             instantiate_profile_obj.create_wlan_wpa2(id="1", wlan=lf_dut_data[0]['ssid_name'], | ||||
|                                                                      wlanssid=lf_dut_data[0]['ssid_name'], | ||||
|                                                                      key=lf_dut_data[0]['security_key']) | ||||
|                             instantiate_profile_obj.get_ssids() | ||||
|  | ||||
|                         if "roam_type" not in list_key: | ||||
|                             # 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.enable_wlan( 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'], | ||||
|                                                                    key=lf_dut_data[0]['security_key']) | ||||
|                         instantiate_profile_obj.enable_ap_2ghz() | ||||
|                         if parameter["ft+psk"] == True: | ||||
|                             instantiate_profile_obj.enable_ft_psk(ssid=lf_dut_data[0]['ssid_name'], | ||||
|                                                                   key=lf_dut_data[0]['security_key']) | ||||
|                         if parameter["ft-otd"] == True: | ||||
|                             instantiate_profile_obj.enable_ftotd_psk(ssid=lf_dut_data[0]['ssid_name'], | ||||
|                                                                   key=lf_dut_data[0]['security_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.get_ssids() | ||||
|  | ||||
|                     if lf_dut_data[band]["appliedRadios"] == ["5G"]: | ||||
|                         instantiate_profile_obj.no_logging_console() | ||||
|                         instantiate_profile_obj.line_console() | ||||
|                         id_slot = instantiate_profile_obj.get_slot_id_wlan() | ||||
|                         print(id_slot) | ||||
|                         ssid_name = instantiate_profile_obj.get_ssid_name_on_id() | ||||
|                         print(ssid_name) | ||||
|                         if id_slot[1] == "2": | ||||
|                             # if ssid present on slot 2 delete it and create new | ||||
|                             instantiate_profile_obj.show_shutdown_5ghz_ap() | ||||
|                             instantiate_profile_obj.disable_wlan(wlan=ssid_name[1]) | ||||
|                             instantiate_profile_obj.ap_5ghz_shutdown() | ||||
|                             instantiate_profile_obj.get_ssids() | ||||
|                             instantiate_profile_obj.delete_wlan(ssid=ssid_name[1]) | ||||
|                             instantiate_profile_obj.get_ssids() | ||||
|                             instantiate_profile_obj.create_wlan_wpa2(id="2", wlan=lf_dut_data[1]['ssid_name'], | ||||
|                                                                      wlanssid=lf_dut_data[1]['ssid_name'], | ||||
|                                                                      key=lf_dut_data[1]['security_key']) | ||||
|                         else: | ||||
|                             print(lf_dut_data[1]['ssid_name']) | ||||
|                             instantiate_profile_obj.get_ssids() | ||||
|                             instantiate_profile_obj.show_shutdown_5ghz_ap() | ||||
|                             instantiate_profile_obj.get_ssids() | ||||
|                             instantiate_profile_obj.create_wlan_wpa2(id="2", wlan=lf_dut_data[1]['ssid_name'], | ||||
|                                                                      wlanssid=lf_dut_data[1]['ssid_name'], | ||||
|                                                                      key=lf_dut_data[1]['security_key']) | ||||
|                             instantiate_profile_obj.get_ssids() | ||||
|  | ||||
|                         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.enable_wlan(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'], | ||||
|                                                                    key=lf_dut_data[1]['security_key']) | ||||
|                         instantiate_profile_obj.enable_ap_5ghz() | ||||
|                         if parameter["ft+psk"] == True: | ||||
|                             instantiate_profile_obj.enable_ft_psk(ssid=lf_dut_data[1]['ssid_name'], | ||||
|                                                                   key=lf_dut_data[1]['security_key']) | ||||
|                         if parameter["ft-otd"] == True: | ||||
|                             instantiate_profile_obj.enable_ftotd_psk(ssid=lf_dut_data[1]['ssid_name'], | ||||
|                                                                   key=lf_dut_data[1]['security_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.get_ssids() | ||||
|                     if lf_dut_data[band]["appliedRadios"] == ["6G"]: | ||||
|                         instantiate_profile_obj.no_logging_console() | ||||
|                         instantiate_profile_obj.line_console() | ||||
|                         id_slot = instantiate_profile_obj.get_slot_id_wlan() | ||||
|                         print(id_slot) | ||||
|                         ssid_name = instantiate_profile_obj.get_ssid_name_on_id() | ||||
|                         print(ssid_name) | ||||
|                         if id_slot[2] == "3": | ||||
|                             instantiate_profile_obj.show_shutdown_6ghz_ap() | ||||
|                             # instantiate_profile_obj.show_shutdown_5ghz_ap() | ||||
|                             # instantiate_profile_obj.show_shutdown_2ghz_ap() | ||||
|                             instantiate_profile_obj.disable_wlan(wlan=ssid_name[2]) | ||||
|                             instantiate_profile_obj.ap_6ghz_shutdown() | ||||
|                             instantiate_profile_obj.get_ssids() | ||||
|                             instantiate_profile_obj.delete_wlan(ssid=ssid_name[2]) | ||||
|                             instantiate_profile_obj.get_ssids() | ||||
|                             instantiate_profile_obj.create_wlan_wpa3(id="3", wlan=lf_dut_data[2]['ssid_name'], | ||||
|                                                                               wlanssid=lf_dut_data[2]['ssid_name'], | ||||
|                                                                               key=lf_dut_data[2]['security_key']) | ||||
|                         else: | ||||
|                             instantiate_profile_obj.get_ssids() | ||||
|                             instantiate_profile_obj.show_shutdown_6ghz_ap() | ||||
|                             instantiate_profile_obj.get_ssids() | ||||
|                             instantiate_profile_obj.create_wlan_wpa3(id="3", wlan=lf_dut_data[2]['ssid_name'], | ||||
|                                                                      wlanssid=lf_dut_data[2]['ssid_name'], | ||||
|                                                                      key=lf_dut_data[2]['security_key']) | ||||
|                             instantiate_profile_obj.get_ssids() | ||||
|  | ||||
|                         if "roam_type" not in list_key: | ||||
|                             instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile( | ||||
|                                 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'], | ||||
|                                                                    wlanssid=lf_dut_data[2]['ssid_name'], | ||||
|                                                                    key=lf_dut_data[2]['security_key']) | ||||
|                         instantiate_profile_obj.enable_ap_6ghz() | ||||
|                         # 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']) | ||||
|                         if parameter["ft-dot1x"] == True: | ||||
|                             instantiate_profile_obj.enable_ft_dot1x_wpa3(ssid=lf_dut_data[2]['ssid_name']) | ||||
|                         if parameter["ft-dot1x_sha256"] == True: | ||||
|                             instantiate_profile_obj.enable_ft_dot1x_sha256_wpa3(ssid=lf_dut_data[2]['ssid_name'], | ||||
|                                                                                 radius=get_configuration['controller']["radius"]) | ||||
|                         instantiate_profile_obj.get_ssids() | ||||
|  | ||||
|         twog_sum = instantiate_profile_obj.show_2ghz_summary() | ||||
|         fiveg_sum = instantiate_profile_obj.show_5ghz_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 5ghz ", body=str(fiveg_sum)) | ||||
|         allure.attach(name="ap admin state 6ghz", body=str(sixg_sum)) | ||||
|         sumy = instantiate_profile_obj.get_ssids() | ||||
|         allure.attach(name="wlan summary after creating test wlan", body=str(sumy)) | ||||
|         if "roam_type" in list_key: | ||||
|             print("after creating wlan's assign wlan to respective tag policy") | ||||
|             for ap_name in range(len(self.lab_info['access_point'])): | ||||
|                 print("ap ", ap_name) | ||||
|                 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) | ||||
|                 if parameter["roam_type"] == "fiveg_to_fiveg": | ||||
|                     # add 5g wlan to both ap's | ||||
|                     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 ap_name == 0: | ||||
|                         # add 5g ssid to 5g ap | ||||
|                         instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile(wlan=lf_dut_data[1]['ssid_name']) | ||||
|                     if ap_name == 1: | ||||
|                         # add 6g ssid to 6g ap | ||||
|                         instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile(wlan=lf_dut_data[2]['ssid_name']) | ||||
|  | ||||
|                 else: | ||||
|                     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[1]['ssid_name']) | ||||
|                     instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile( | ||||
|                         wlan=lf_dut_data[2]['ssid_name']) | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|         bssid_list_2g = [] | ||||
|         bssid_list_5g = [] | ||||
|         ssid_data_list = [] | ||||
|  | ||||
|         for ap_name in range(len(self.lab_info['access_point'])): | ||||
|             print("ap ", ap_name) | ||||
|             # instantiate controller object | ||||
|             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) | ||||
|             bss2_info = instantiate_profile_obj.get_ap_bssid_2g() | ||||
|             allure.attach(name="wlan 2g bssid info", body=str(bss2_info)) | ||||
|             bss5_info = instantiate_profile_obj.get_ap_bssid_5g() | ||||
|             allure.attach(name="wlan 5g bssid info", body=str(bss5_info)) | ||||
|             bss6_info = instantiate_profile_obj.get_ap_bssid_6g() | ||||
|             allure.attach(name="wlan 6g bssid info", body=str(bss6_info)) | ||||
|  | ||||
|             bssid_2g = instantiate_profile_obj.cal_bssid_2g() | ||||
|             print("bssid 2g", bssid_2g) | ||||
|             lst_2g = bssid_list_2g.append(bssid_2g) | ||||
|  | ||||
|             bssid_5g = instantiate_profile_obj.cal_bssid_5g() | ||||
|             print("bssid 5g ", bssid_5g) | ||||
|             lst_5g = bssid_list_5g.append(bssid_5g) | ||||
|             # print(bssid_5g) | ||||
|             # print(bssid_list_2g) | ||||
|             # print(bssid_list_5g) | ||||
|             ssid_data = [] | ||||
|             try: | ||||
|                 idx_mapping = {} | ||||
|                 bssid = "" | ||||
|                 for interface in range(len(lf_dut_data)): | ||||
|                     if interface == 0: | ||||
|                         bssid = bssid_2g | ||||
|                     if interface == 1: | ||||
|                         bssid = bssid_5g | ||||
|                     if lf_dut_data[interface]['security'] == "psk2": | ||||
|                         lf_dut_data[interface]['security'] = "WPA2" | ||||
|                     ssid = ["ssid_idx=" + str(interface) + | ||||
|                             " ssid=" + lf_dut_data[interface]['ssid_name'] + | ||||
|                             " security=" + lf_dut_data[interface]['security'] + | ||||
|                             " password=" + lf_dut_data[interface]['security_key'] + | ||||
|                             " bssid=" + bssid | ||||
|                             ] | ||||
|                     ssid_data.append(ssid) | ||||
|  | ||||
|             except Exception as e: | ||||
|                 print(e) | ||||
|                 pass | ||||
|             # print("nikita",ssid_data) | ||||
|             ssid_data_list.append(ssid_data) | ||||
|         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_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=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) | ||||
|         table1 = [["show ap summary", "done"], ["Configure wlan", "done"], ["configure channel/width", "done"], | ||||
|                   ["ap admin state up", "done"], ["checking admin state of ap", "done"], | ||||
|                   ["sniffer capture", "done"], | ||||
|                   ["client connect", "don"], ["roam", "done"], ["sniffer verification", "done"], | ||||
|                   ["iteration", "done"], | ||||
|                   ["table display", "done"], ["check in controller client connected", "done"], | ||||
|                   ["Bring down unused band before start of testcase", "done"]] | ||||
|         tab1 = lf_reports.table2(table=table1) | ||||
|         allure.attach(name="skeleton of code", body=str(tab1)) | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| # import allure | ||||
| # import pytest | ||||
| # import os | ||||
| # import sys | ||||
| # """ Environment Paths """ | ||||
| # if "libs" not in sys.path: | ||||
| #     sys.path.append(f'../libs') | ||||
| # for folder in 'py-json', 'py-scripts': | ||||
| #     if folder not in sys.path: | ||||
| #         sys.path.append(f'../lanforge/lanforge-scripts/{folder}') | ||||
| # | ||||
| # sys.path.append( | ||||
| #     os.path.dirname( | ||||
| #         os.path.realpath(__file__) | ||||
| #     ) | ||||
| # ) | ||||
| # sys.path.append(f"../lanforge/lanforge-scripts/py-scripts/tip-cicd-sanity") | ||||
| # | ||||
| # sys.path.append(f'../libs') | ||||
| # sys.path.append(f'../libs/lanforge/') | ||||
| # sys.path.append(f'../lanforge/lanforge-scripts') | ||||
| # | ||||
| # from LANforge.LFUtils import * | ||||
| # | ||||
| # if 'py-json' not in sys.path: | ||||
| #     sys.path.append('../py-scripts') | ||||
| # from controller.controller_3x.controller import CController | ||||
| # | ||||
| # | ||||
| # class Fixtures_3x: | ||||
| # | ||||
| #     def __init__(self, configuration={}, run_lf=False, cc_1=False): | ||||
| #         self.lab_info = configuration | ||||
| #         self.run_lf = run_lf | ||||
| #         self.cc_1 = cc_1 | ||||
| #         # print(self.lab_info) | ||||
| #         print("cc.1") | ||||
| #         self.controller_obj = "" | ||||
| # | ||||
| # | ||||
| #     def setup_profiles(self, request, param, run_lf, instantiate_profile, get_configuration, get_markers, lf_tools, lf_reports): | ||||
| #         table1= [] | ||||
| #         instantiate_profile_obj = instantiate_profile(controller_data=get_configuration['controller'], | ||||
| #                                                   timeout="10", ssid_data=None, | ||||
| #                                                   ap_data=self.lab_info['access_point'], type=0) | ||||
| # | ||||
| #         instantiate_profile_obj.enable_all_bands() | ||||
| # | ||||
| # | ||||
| #         if run_lf: | ||||
| #             return 0 | ||||
| #         print("check params") | ||||
| #         # gives parameter value of setup_params_general | ||||
| #         parameter = dict(param) | ||||
| #         print("parameter", parameter) | ||||
| # | ||||
| #         test_cases = {} | ||||
| #         profile_data= {} | ||||
| #         var = "" | ||||
| #         list_key = list(parameter.keys()) | ||||
| # | ||||
| #         if parameter['mode'] not in ["BRIDGE", "NAT", "VLAN"]: | ||||
| #             print("Invalid Mode: ", parameter['mode']) | ||||
| #             return test_cases | ||||
| #         profile_data["ssid"] = {} | ||||
| #         lf_dut_data = [] | ||||
| #         for i in parameter["ssid_modes"]: | ||||
| #             profile_data["ssid"][i] = [] | ||||
| #             for j in range(len(parameter["ssid_modes"][i])): | ||||
| #                 data = parameter["ssid_modes"][i][j] | ||||
| #                 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'}]}} | ||||
| #         print("profile data", profile_data) | ||||
| # | ||||
| # | ||||
| #         # create wlan | ||||
| #         for mode in profile_data['ssid']: | ||||
| #             if mode == "wpa2_personal": | ||||
| #                 for j in profile_data["ssid"][mode]: | ||||
| #                     if mode in get_markers.keys() and get_markers[mode]: | ||||
| #                         try: | ||||
| #                             if j["appliedRadios"].__contains__("2G"): | ||||
| #                                 lf_dut_data.append(j) | ||||
| #                             if j["appliedRadios"].__contains__("5G"): | ||||
| #                                 lf_dut_data.append(j) | ||||
| #                             if j["appliedRadios"].__contains__("6G"): | ||||
| #                                 lf_dut_data.append(j) | ||||
| #                             j["appliedRadios"] = list(set(j["appliedRadios"])) | ||||
| #                             j['security'] = 'wpa2' | ||||
| #                             # print("dut data", lf_dut_data) | ||||
| #                             test_cases["wpa_2g"] = True | ||||
| #                         except Exception as e: | ||||
| #                             print(e) | ||||
| #                             test_cases["wpa2_personal"] = False | ||||
| #             if mode == "wpa3_personal": | ||||
| #                 for j in profile_data["ssid"][mode]: | ||||
| #                     if mode in get_markers.keys() and get_markers[mode]: | ||||
| #                         print( profile_data["ssid"][mode]) | ||||
| #                         print(j) | ||||
| #                         try: | ||||
| #                             if j["appliedRadios"].__contains__("2G"): | ||||
| #                                 lf_dut_data.append(j) | ||||
| #                             if j["appliedRadios"].__contains__("5G"): | ||||
| #                                 lf_dut_data.append(j) | ||||
| #                             if j["appliedRadios"].__contains__("6G"): | ||||
| #                                 lf_dut_data.append(j) | ||||
| #                                 print(lf_dut_data) | ||||
| #                             j["appliedRadios"] = list(set(j["appliedRadios"])) | ||||
| #                             j['security'] = 'wpa3' | ||||
| #                             test_cases["wpa_2g"] = True | ||||
| #                         except Exception as e: | ||||
| #                             print(e) | ||||
| #                             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'}] | ||||
| #         print("lf dut data", lf_dut_data) | ||||
| #         allure.attach(name="wlan data passing", body=str(parameter)) | ||||
| #         ap = instantiate_profile_obj.show_ap_summary() | ||||
| #         print("show ap summ", ap) | ||||
| #         allure.attach(name="show ap summary", body=str(ap)) | ||||
| # | ||||
| #         print("create 3 wlans on slot1,2 and 3") | ||||
| #         for ap_name in range(len(self.lab_info['access_point'])): | ||||
| #             print("ap ", ap_name) | ||||
| #             # instantiate controller object | ||||
| # | ||||
| #             print("set channel and bandwidth") | ||||
| #             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) | ||||
| #             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"]) | ||||
| #             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"], | ||||
| #                                                 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"])) | ||||
| #             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"]) | ||||
| #             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"]) | ||||
| #             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)) | ||||
| # | ||||
| #             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)) | ||||
| # | ||||
| #             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)) | ||||
| # | ||||
| #             # table1.append(tab) | ||||
| # | ||||
| # | ||||
| #             if ap_name == 0: | ||||
| #                 for band in range(len(lf_dut_data)): | ||||
| #                     if lf_dut_data[band]["appliedRadios"] == ["2G"]: | ||||
| #                         instantiate_profile_obj.no_logging_console() | ||||
| #                         instantiate_profile_obj.line_console() | ||||
| #                         id_slot = instantiate_profile_obj.get_slot_id_wlan() | ||||
| #                         ssid_name = instantiate_profile_obj.get_ssid_name_on_id() | ||||
| #                         if id_slot[0] == "1": | ||||
| #                             instantiate_profile_obj.show_shutdown_2ghz_ap() | ||||
| #                             instantiate_profile_obj.disable_wlan(wlan=ssid_name[0]) | ||||
| #                             instantiate_profile_obj.ap_2ghz_shutdown() | ||||
| #                             instantiate_profile_obj.get_ssids() | ||||
| #                             instantiate_profile_obj.delete_wlan(ssid=ssid_name[0]) | ||||
| #                             instantiate_profile_obj.get_ssids() | ||||
| #                             instantiate_profile_obj.create_wlan_wpa2(id="1", wlan=lf_dut_data[0]['ssid_name'], | ||||
| #                                                                      wlanssid=lf_dut_data[0]['ssid_name'], | ||||
| #                                                                      key=lf_dut_data[0]['security_key']) | ||||
| #                         else: | ||||
| #                             print(lf_dut_data[0]['ssid_name']) | ||||
| #                             instantiate_profile_obj.get_ssids() | ||||
| #                             instantiate_profile_obj.show_shutdown_2ghz_ap() | ||||
| #                             instantiate_profile_obj.get_ssids() | ||||
| #                             instantiate_profile_obj.create_wlan_wpa2(id="1", wlan=lf_dut_data[0]['ssid_name'], | ||||
| #                                                                      wlanssid=lf_dut_data[0]['ssid_name'], | ||||
| #                                                                      key=lf_dut_data[0]['security_key']) | ||||
| #                             instantiate_profile_obj.get_ssids() | ||||
| # | ||||
| #                         if "roam_type" not in list_key: | ||||
| #                             # 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.enable_wlan( 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'], | ||||
| #                                                                    key=lf_dut_data[0]['security_key']) | ||||
| #                         instantiate_profile_obj.enable_ap_2ghz() | ||||
| #                         if parameter["ft+psk"] == True: | ||||
| #                             instantiate_profile_obj.enable_ft_psk(ssid=lf_dut_data[0]['ssid_name'], | ||||
| #                                                                   key=lf_dut_data[0]['security_key']) | ||||
| #                         if parameter["ft-otd"] == True: | ||||
| #                             instantiate_profile_obj.enable_ftotd_psk(ssid=lf_dut_data[0]['ssid_name'], | ||||
| #                                                                   key=lf_dut_data[0]['security_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.get_ssids() | ||||
| # | ||||
| #                     if lf_dut_data[band]["appliedRadios"] == ["5G"]: | ||||
| #                         instantiate_profile_obj.no_logging_console() | ||||
| #                         instantiate_profile_obj.line_console() | ||||
| #                         id_slot = instantiate_profile_obj.get_slot_id_wlan() | ||||
| #                         print(id_slot) | ||||
| #                         ssid_name = instantiate_profile_obj.get_ssid_name_on_id() | ||||
| #                         print(ssid_name) | ||||
| #                         if id_slot[1] == "2": | ||||
| #                             # if ssid present on slot 2 delete it and create new | ||||
| #                             instantiate_profile_obj.show_shutdown_5ghz_ap() | ||||
| #                             instantiate_profile_obj.disable_wlan(wlan=ssid_name[1]) | ||||
| #                             instantiate_profile_obj.ap_5ghz_shutdown() | ||||
| #                             instantiate_profile_obj.get_ssids() | ||||
| #                             instantiate_profile_obj.delete_wlan(ssid=ssid_name[1]) | ||||
| #                             instantiate_profile_obj.get_ssids() | ||||
| #                             instantiate_profile_obj.create_wlan_wpa2(id="2", wlan=lf_dut_data[1]['ssid_name'], | ||||
| #                                                                      wlanssid=lf_dut_data[1]['ssid_name'], | ||||
| #                                                                      key=lf_dut_data[1]['security_key']) | ||||
| #                         else: | ||||
| #                             print(lf_dut_data[1]['ssid_name']) | ||||
| #                             instantiate_profile_obj.get_ssids() | ||||
| #                             instantiate_profile_obj.show_shutdown_5ghz_ap() | ||||
| #                             instantiate_profile_obj.get_ssids() | ||||
| #                             instantiate_profile_obj.create_wlan_wpa2(id="2", wlan=lf_dut_data[1]['ssid_name'], | ||||
| #                                                                      wlanssid=lf_dut_data[1]['ssid_name'], | ||||
| #                                                                      key=lf_dut_data[1]['security_key']) | ||||
| #                             instantiate_profile_obj.get_ssids() | ||||
| # | ||||
| #                         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.enable_wlan(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'], | ||||
| #                                                                    key=lf_dut_data[1]['security_key']) | ||||
| #                         instantiate_profile_obj.enable_ap_5ghz() | ||||
| #                         if parameter["ft+psk"] == True: | ||||
| #                             instantiate_profile_obj.enable_ft_psk(ssid=lf_dut_data[1]['ssid_name'], | ||||
| #                                                                   key=lf_dut_data[1]['security_key']) | ||||
| #                         if parameter["ft-otd"] == True: | ||||
| #                             instantiate_profile_obj.enable_ftotd_psk(ssid=lf_dut_data[1]['ssid_name'], | ||||
| #                                                                   key=lf_dut_data[1]['security_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.get_ssids() | ||||
| #                     if lf_dut_data[band]["appliedRadios"] == ["6G"]: | ||||
| #                         instantiate_profile_obj.no_logging_console() | ||||
| #                         instantiate_profile_obj.line_console() | ||||
| #                         id_slot = instantiate_profile_obj.get_slot_id_wlan() | ||||
| #                         print(id_slot) | ||||
| #                         ssid_name = instantiate_profile_obj.get_ssid_name_on_id() | ||||
| #                         print(ssid_name) | ||||
| #                         if id_slot[2] == "3": | ||||
| #                             instantiate_profile_obj.show_shutdown_6ghz_ap() | ||||
| #                             # instantiate_profile_obj.show_shutdown_5ghz_ap() | ||||
| #                             # instantiate_profile_obj.show_shutdown_2ghz_ap() | ||||
| #                             instantiate_profile_obj.disable_wlan(wlan=ssid_name[2]) | ||||
| #                             instantiate_profile_obj.ap_6ghz_shutdown() | ||||
| #                             instantiate_profile_obj.get_ssids() | ||||
| #                             instantiate_profile_obj.delete_wlan(ssid=ssid_name[2]) | ||||
| #                             instantiate_profile_obj.get_ssids() | ||||
| #                             instantiate_profile_obj.create_wlan_wpa3(id="3", wlan=lf_dut_data[2]['ssid_name'], | ||||
| #                                                                               wlanssid=lf_dut_data[2]['ssid_name'], | ||||
| #                                                                               key=lf_dut_data[2]['security_key']) | ||||
| #                         else: | ||||
| #                             instantiate_profile_obj.get_ssids() | ||||
| #                             instantiate_profile_obj.show_shutdown_6ghz_ap() | ||||
| #                             instantiate_profile_obj.get_ssids() | ||||
| #                             instantiate_profile_obj.create_wlan_wpa3(id="3", wlan=lf_dut_data[2]['ssid_name'], | ||||
| #                                                                      wlanssid=lf_dut_data[2]['ssid_name'], | ||||
| #                                                                      key=lf_dut_data[2]['security_key']) | ||||
| #                             instantiate_profile_obj.get_ssids() | ||||
| # | ||||
| #                         if "roam_type" not in list_key: | ||||
| #                             instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile( | ||||
| #                                 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'], | ||||
| #                                                                    wlanssid=lf_dut_data[2]['ssid_name'], | ||||
| #                                                                    key=lf_dut_data[2]['security_key']) | ||||
| #                         instantiate_profile_obj.enable_ap_6ghz() | ||||
| #                         # 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']) | ||||
| #                         if parameter["ft-dot1x"] == True: | ||||
| #                             instantiate_profile_obj.enable_ft_dot1x_wpa3(ssid=lf_dut_data[2]['ssid_name']) | ||||
| #                         if parameter["ft-dot1x_sha256"] == True: | ||||
| #                             instantiate_profile_obj.enable_ft_dot1x_sha256_wpa3(ssid=lf_dut_data[2]['ssid_name'], | ||||
| #                                                                                 radius=get_configuration['controller']["radius"]) | ||||
| #                         instantiate_profile_obj.get_ssids() | ||||
| # | ||||
| #         twog_sum = instantiate_profile_obj.show_2ghz_summary() | ||||
| #         fiveg_sum = instantiate_profile_obj.show_5ghz_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 5ghz ", body=str(fiveg_sum)) | ||||
| #         allure.attach(name="ap admin state 6ghz", body=str(sixg_sum)) | ||||
| #         sumy = instantiate_profile_obj.get_ssids() | ||||
| #         allure.attach(name="wlan summary after creating test wlan", body=str(sumy)) | ||||
| #         if "roam_type" in list_key: | ||||
| #             print("after creating wlan's assign wlan to respective tag policy") | ||||
| #             for ap_name in range(len(self.lab_info['access_point'])): | ||||
| #                 print("ap ", ap_name) | ||||
| #                 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) | ||||
| #                 if parameter["roam_type"] == "fiveg_to_fiveg": | ||||
| #                     # add 5g wlan to both ap's | ||||
| #                     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 ap_name == 0: | ||||
| #                         # add 5g ssid to 5g ap | ||||
| #                         instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile(wlan=lf_dut_data[1]['ssid_name']) | ||||
| #                     if ap_name == 1: | ||||
| #                         # add 6g ssid to 6g ap | ||||
| #                         instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile(wlan=lf_dut_data[2]['ssid_name']) | ||||
| # | ||||
| #                 else: | ||||
| #                     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[1]['ssid_name']) | ||||
| #                     instantiate_profile_obj.config_wireless_tag_policy_and_policy_profile( | ||||
| #                         wlan=lf_dut_data[2]['ssid_name']) | ||||
| # | ||||
| # | ||||
| # | ||||
| # | ||||
| #         bssid_list_2g = [] | ||||
| #         bssid_list_5g = [] | ||||
| #         ssid_data_list = [] | ||||
| # | ||||
| #         for ap_name in range(len(self.lab_info['access_point'])): | ||||
| #             print("ap ", ap_name) | ||||
| #             # instantiate controller object | ||||
| #             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) | ||||
| #             bss2_info = instantiate_profile_obj.get_ap_bssid_2g() | ||||
| #             allure.attach(name="wlan 2g bssid info", body=str(bss2_info)) | ||||
| #             bss5_info = instantiate_profile_obj.get_ap_bssid_5g() | ||||
| #             allure.attach(name="wlan 5g bssid info", body=str(bss5_info)) | ||||
| #             bss6_info = instantiate_profile_obj.get_ap_bssid_6g() | ||||
| #             allure.attach(name="wlan 6g bssid info", body=str(bss6_info)) | ||||
| # | ||||
| #             bssid_2g = instantiate_profile_obj.cal_bssid_2g() | ||||
| #             print("bssid 2g", bssid_2g) | ||||
| #             lst_2g = bssid_list_2g.append(bssid_2g) | ||||
| # | ||||
| #             bssid_5g = instantiate_profile_obj.cal_bssid_5g() | ||||
| #             print("bssid 5g ", bssid_5g) | ||||
| #             lst_5g = bssid_list_5g.append(bssid_5g) | ||||
| #             # print(bssid_5g) | ||||
| #             # print(bssid_list_2g) | ||||
| #             # print(bssid_list_5g) | ||||
| #             ssid_data = [] | ||||
| #             try: | ||||
| #                 idx_mapping = {} | ||||
| #                 bssid = "" | ||||
| #                 for interface in range(len(lf_dut_data)): | ||||
| #                     if interface == 0: | ||||
| #                         bssid = bssid_2g | ||||
| #                     if interface == 1: | ||||
| #                         bssid = bssid_5g | ||||
| #                     if lf_dut_data[interface]['security'] == "psk2": | ||||
| #                         lf_dut_data[interface]['security'] = "WPA2" | ||||
| #                     ssid = ["ssid_idx=" + str(interface) + | ||||
| #                             " ssid=" + lf_dut_data[interface]['ssid_name'] + | ||||
| #                             " security=" + lf_dut_data[interface]['security'] + | ||||
| #                             " password=" + lf_dut_data[interface]['security_key'] + | ||||
| #                             " bssid=" + bssid | ||||
| #                             ] | ||||
| #                     ssid_data.append(ssid) | ||||
| # | ||||
| #             except Exception as e: | ||||
| #                 print(e) | ||||
| #                 pass | ||||
| #             # print("nikita",ssid_data) | ||||
| #             ssid_data_list.append(ssid_data) | ||||
| #         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_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=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) | ||||
| #         table1 = [["show ap summary", "done"], ["Configure wlan", "done"], ["configure channel/width", "done"], | ||||
| #                   ["ap admin state up", "done"], ["checking admin state of ap", "done"], | ||||
| #                   ["sniffer capture", "done"], | ||||
| #                   ["client connect", "don"], ["roam", "done"], ["sniffer verification", "done"], | ||||
| #                   ["iteration", "done"], | ||||
| #                   ["table display", "done"], ["check in controller client connected", "done"], | ||||
| #                   ["Bring down unused band before start of testcase", "done"]] | ||||
| #         tab1 = lf_reports.table2(table=table1) | ||||
| #         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" : { | ||||
|     "basic-01": { | ||||
|         "target": "tip_2x", | ||||
|         "controller": { | ||||
|             "url": "https://sec-qa01.cicd.lab.wlan.tip.build:16001", | ||||
|             "username": "tip@ucentral.com", | ||||
|             "password": "OpenWifi%123" | ||||
|         }, | ||||
|         "access_point": [ | ||||
|         "device_under_tests": [ | ||||
|             { | ||||
|                 "model": "wallys_dr40x9", | ||||
|                 "mode": "wifi5", | ||||
|   | ||||
| @@ -32,6 +32,6 @@ milestone=29 | ||||
|  | ||||
| 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="") | ||||
|             status.append(current_version_ap == data['firmware'].split()) | ||||
|         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