diff --git a/libs/apnos/apnos.py b/libs/apnos/apnos.py index 9d67448b4..645d8a466 100644 --- a/libs/apnos/apnos.py +++ b/libs/apnos/apnos.py @@ -354,6 +354,7 @@ class APNOS: def get_uc_latest_config(self): try: connected, latest, active = self.get_ucentral_status() + print() client = self.ssh_cli_connect() cmd = "cat /etc/ucentral/ucentral.cfg." + latest if self.mode: @@ -361,6 +362,7 @@ class APNOS: f"cmd --value \"{cmd}\" " stdin, stdout, stderr = client.exec_command(cmd) output = stdout.read().decode('utf-8').splitlines()[1] + print(output) json_output = json.loads(output) # , sort_keys=True) print(type(json_output)) client.close() @@ -411,7 +413,7 @@ class APNOS: for j in r[i]["interfaces"]: encryption = j["config"]["encryption"] if encryption == "psk" or encryption == "psk2" or encryption == "psk-mixed" or \ - encryption == "sae" or encryption == "sae-mixed": + encryption == "sae" or encryption == "sae-mixed": wifi_info[j["ifname"]] = [j["config"]["ssid"], j["config"]["encryption"], j["config"]["key"]] else: wifi_info[j["ifname"]] = [j["config"]["ssid"], j["config"]["encryption"], ""] @@ -490,6 +492,17 @@ class APNOS: logs = "" return logs + def get_ap_version_ucentral(self): + client = self.ssh_cli_connect() + cmd = "cat /tmp/ucentral.version" + if self.mode: + cmd = f"cd ~/cicd-git/ && ./openwrt_ctl.py {self.owrt_args} -t {self.tty} --action " \ + f"cmd --value \"{cmd}\" " + stdin, stdout, stderr = client.exec_command(cmd) + output = stdout.read().replace(b":~# cat /tmp/ucentral.version", b"").decode('utf-8') + client.close() + return output + def get_vifc(self): client = self.ssh_cli_connect() cmd = "vifC" @@ -543,5 +556,5 @@ if __name__ == '__main__': 'version': "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/edgecore_eap102/20210625-edgecore_eap102-uCentral-trunk-4225122-upgrade.bin" } var = APNOS(credentials=obj, sdk="2.x") - x = var.get_interface_details() + x = var.get_ap_version_ucentral() print(x) diff --git a/libs/lanforge/lf_tests.py b/libs/lanforge/lf_tests.py index 8b4a830db..40fa63976 100644 --- a/libs/lanforge/lf_tests.py +++ b/libs/lanforge/lf_tests.py @@ -26,6 +26,7 @@ from sta_connect2 import StaConnect2 import time import string import random + S = 12 # from eap_connect import EAPConnect from test_ipv4_ttls import TTLSTest @@ -118,6 +119,15 @@ class RunTest: print("test result: " + result) result = True print("Client Connectivity :", self.staConnect.passes) + endp_data = [] + for i in self.staConnect.resulting_endpoints: + endp_data.append(self.staConnect.resulting_endpoints[i]["endpoint"]) + cx_data = "" + for i in endp_data: + for j in i: + cx_data = cx_data + str(j) + " : " + str(i[j]) + "\n" + cx_data = cx_data + "\n" + allure.attach(name="cx_data", body=str(cx_data)) if self.staConnect.passes(): print("client connection to", self.staConnect.dut_ssid, "successful. Test Passed") else: @@ -380,9 +390,9 @@ class RunTest: # target_csv=self.local_report_path + report_name + "/kpi.csv") # influx.post_to_influx() return self.dualbandptest_obj - + def ratevsrange(self, station_name=None, mode="BRIDGE", vlan_id=100, download_rate="85%", dut_name="TIP", - upload_rate="0", duration="1m", instance_name="test_demo", raw_lines=None): + upload_rate="0", duration="1m", instance_name="test_demo", raw_lines=None): if mode == "BRIDGE": self.client_connect.upstream_port = self.upstream_port elif mode == "NAT": @@ -391,22 +401,22 @@ class RunTest: self.client_connect.upstream_port = self.upstream_port + "." + str(vlan_id) self.rvr_obj = RvrTest(lf_host=self.lanforge_ip, - lf_port=self.lanforge_port, - ssh_port=self.lf_ssh_port, - local_path=self.local_report_path, - lf_user="lanforge", - lf_password="lanforge", - instance_name=instance_name, - config_name="rvr_config", - upstream="1.1." + self.upstream_port, - pull_report=True, - load_old_cfg=False, - upload_speed=upload_rate, - download_speed=download_rate, - duration=duration, - station="1.1." + station_name[0], - dut=dut_name, - raw_lines=raw_lines) + lf_port=self.lanforge_port, + ssh_port=self.lf_ssh_port, + local_path=self.local_report_path, + lf_user="lanforge", + lf_password="lanforge", + instance_name=instance_name, + config_name="rvr_config", + upstream="1.1." + self.upstream_port, + pull_report=True, + load_old_cfg=False, + upload_speed=upload_rate, + download_speed=download_rate, + duration=duration, + station="1.1." + station_name[0], + dut=dut_name, + raw_lines=raw_lines) self.rvr_obj.setup() self.rvr_obj.run() report_name = self.rvr_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] @@ -415,6 +425,7 @@ class RunTest: influx.post_to_influx() return self.rvr_obj + if __name__ == '__main__': lanforge_data = { "ip": "localhost", diff --git a/tests/configuration.py b/tests/configuration.py index e183d0284..122af37af 100644 --- a/tests/configuration.py +++ b/tests/configuration.py @@ -255,7 +255,7 @@ CONFIGURATION = { 'password': "pumpkin77", 'port': 22, 'jumphost_tty': '/dev/ttyAP3', - 'version': "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/edgecore_eap102/20210625-edgecore_eap102-uCentral-trunk-4225122-upgrade.bin" + 'version': "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/tplink_ec420/20210728-tplink_ec420-uCentral-trunk-12ad0d5-upgrade.bin" } ], "traffic_generator": { @@ -264,14 +264,14 @@ CONFIGURATION = { "ip": "10.28.3.10", "port": 8080, "ssh_port": 22, - "2.4G-Radio": ["1.1.wiphy4"], - "5G-Radio": ["1.1.wiphy5"], + "2.4G-Radio": ["1.1.wiphy0", "1.1.wiphy4"], + "5G-Radio": ["1.1.wiphy1", "1.1.wiphy5"], "AX-Radio": ["1.1.wiphy0", "1.1.wiphy1", "1.1.wiphy2", "1.1.wiphy3"], "upstream": "1.1.eth2", "upstream_subnet": "10.28.2.1/24", "uplink": "1.1.eth3", - "2.4G-Station-Name": "wlan0", - "5G-Station-Name": "wlan1", + "2.4G-Station-Name": "sta00", + "5G-Station-Name": "sta10", "AX-Station-Name": "ax" } } diff --git a/tests/conftest.py b/tests/conftest.py index 16a18c5dc..99d8f1854 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,7 +6,6 @@ import sys import os import time - import allure import re import logging @@ -674,7 +673,17 @@ def add_allure_environment_property(request: SubRequest) -> Optional[Callable]: @fixture(scope='session') -def add_env_properties(get_configuration, add_allure_environment_property: Callable) -> None: +def get_uc_ap_version(get_apnos, get_configuration): + version_list = [] + for access_point_info in get_configuration['access_point']: + ap_ssh = get_apnos(access_point_info) + version = ap_ssh.get_ap_version_ucentral() + version_list.append(version) + yield version_list + + +@fixture(scope='session') +def add_env_properties(get_configuration, get_uc_ap_version, add_allure_environment_property: Callable) -> None: add_allure_environment_property('Access-Point-Model', get_configuration["access_point"][0]["model"]) - add_allure_environment_property('Access-Point-Firmware-Version', get_configuration["access_point"][0]["version"]) + add_allure_environment_property('Access-Point-Firmware-Version', "\n".join(get_uc_ap_version)) add_allure_environment_property('Cloud-Controller-SDK-URL', get_configuration["controller"]["url"]) diff --git a/tests/e2e/basic/conftest.py b/tests/e2e/basic/conftest.py index 06471d709..c9f39542d 100644 --- a/tests/e2e/basic/conftest.py +++ b/tests/e2e/basic/conftest.py @@ -813,7 +813,6 @@ def setup_profiles(request, setup_controller, testbed, setup_vlan, get_equipment ssid = ["ssid_idx=" + str(interface) + " ssid=" + ap_wifi_data[ap_interfaces[interface]][0] + " security=OPEN" + - " password=" + ap_wifi_data[ap_interfaces[interface]][2] + " bssid=" + ap_wifi_data[ap_interfaces[interface]][3][0] ] idx_mapping[str(interface)] = [ap_wifi_data[ap_interfaces[interface]][0], @@ -898,7 +897,6 @@ def setup_profiles(request, setup_controller, testbed, setup_vlan, get_equipment ssid = ["ssid_idx=" + str(interface) + " ssid=" + ap_wifi_data[ap_interfaces[interface]][0] + " security=EAP-TTLS" + - " password=" + ap_wifi_data[ap_interfaces[interface]][2] + " bssid=" + str(ap_wifi_data[ap_interfaces[interface]][3][0]).lower() ] diff --git a/tests/e2e/basic/validation_of_operating_modes/vlan_mode/client_connectivity/test_enterprise_ttls.py b/tests/e2e/basic/validation_of_operating_modes/vlan_mode/client_connectivity/test_enterprise_ttls.py index 0c5dc1cb5..b2d9542e1 100644 --- a/tests/e2e/basic/validation_of_operating_modes/vlan_mode/client_connectivity/test_enterprise_ttls.py +++ b/tests/e2e/basic/validation_of_operating_modes/vlan_mode/client_connectivity/test_enterprise_ttls.py @@ -2,7 +2,7 @@ import allure import pytest pytestmark = [pytest.mark.client_connectivity, pytest.mark.vlan, pytest.mark.enterprise, pytest.mark.ttls, - pytest.mark.ucentral, pytest.mark.sanity] # pytest.mark.usefixtures("setup_test_run") + pytest.mark.ucentral, pytest.mark.sanity] # pytest.mark.usefixtures("setup_test_run") setup_params_enterprise = { "mode": "VLAN", @@ -11,8 +11,8 @@ setup_params_enterprise = { {"ssid_name": "ssid_wpa_eap_2g", "appliedRadios": ["2G"]}, {"ssid_name": "ssid_wpa_eap_5g", "appliedRadios": ["5G"]}], "wpa2_enterprise": [ - {"ssid_name": "ssid_wpa2_eap_2g", "appliedRadios": ["2G"], "vlan":100}, - {"ssid_name": "ssid_wpa2_eap_5g", "appliedRadios": ["5G"], "vlan":100}], + {"ssid_name": "ssid_wpa2_eap_2g", "appliedRadios": ["2G"], "vlan": 100}, + {"ssid_name": "ssid_wpa2_eap_5g", "appliedRadios": ["5G"], "vlan": 100}], "wpa3_enterprise": [ {"ssid_name": "ssid_wpa3_eap_2g", "appliedRadios": ["2G"]}, {"ssid_name": "ssid_wpa3_eap_5g", "appliedRadios": ["5G"]}]}, @@ -28,14 +28,13 @@ setup_params_enterprise = { indirect=True, scope="class" ) - - @pytest.mark.usefixtures("setup_profiles") class TestVLANModeEnterpriseTTLSSuiteOne(object): @pytest.mark.wpa_enterprise @pytest.mark.twog - def test_wpa_enterprise_2g(self, get_vif_state,station_names_twog, setup_profiles, get_lanforge_data, lf_test, update_report, + def test_wpa_enterprise_2g(self, get_vif_state, station_names_twog, setup_profiles, get_lanforge_data, lf_test, + update_report, test_cases, radius_info, exit_on_fail): profile_data = setup_params_enterprise["ssid_modes"]["wpa_enterprise"][0] ssid_name = profile_data["ssid_name"] @@ -59,7 +58,8 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object): @pytest.mark.wpa_enterprise @pytest.mark.fiveg - def test_wpa_enterprise_5g(self, get_vif_state,station_names_fiveg, setup_profiles, get_lanforge_data, lf_test, update_report, + def test_wpa_enterprise_5g(self, get_vif_state, station_names_fiveg, setup_profiles, get_lanforge_data, lf_test, + update_report, test_cases, radius_info, exit_on_fail): profile_data = setup_params_enterprise["ssid_modes"]["wpa_enterprise"][1] ssid_name = profile_data["ssid_name"] @@ -85,7 +85,8 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object): @pytest.mark.sanity_light @pytest.mark.wpa2_enterprise @pytest.mark.twog - def test_wpa2_enterprise_2g(self, get_vif_state,station_names_twog, setup_profiles, get_lanforge_data, lf_test, update_report, + def test_wpa2_enterprise_2g(self, get_vif_state, station_names_twog, setup_profiles, get_lanforge_data, lf_test, + update_report, test_cases, radius_info, exit_on_fail): profile_data = setup_params_enterprise["ssid_modes"]["wpa2_enterprise"][0] ssid_name = profile_data["ssid_name"] @@ -111,7 +112,8 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object): @pytest.mark.sanity_light @pytest.mark.wpa2_enterprise @pytest.mark.fiveg - def test_wpa2_enterprise_5g(self, get_vif_state,station_names_fiveg, setup_profiles, get_lanforge_data, lf_test, update_report, + def test_wpa2_enterprise_5g(self, get_vif_state, station_names_fiveg, setup_profiles, get_lanforge_data, lf_test, + update_report, test_cases, radius_info, exit_on_fail): profile_data = setup_params_enterprise["ssid_modes"]["wpa2_enterprise"][1] ssid_name = profile_data["ssid_name"] @@ -135,7 +137,8 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object): @pytest.mark.wpa3_enterprise @pytest.mark.twog - def test_wpa3_enterprise_2g(self, get_vif_state,station_names_twog, setup_profiles, get_lanforge_data, lf_test, update_report, + def test_wpa3_enterprise_2g(self, get_vif_state, station_names_twog, setup_profiles, get_lanforge_data, lf_test, + update_report, test_cases, radius_info, exit_on_fail): profile_data = setup_params_enterprise["ssid_modes"]["wpa3_enterprise"][0] ssid_name = profile_data["ssid_name"] @@ -158,7 +161,8 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object): @pytest.mark.wpa3_enterprise @pytest.mark.fiveg - def test_wpa3_enterprise_5g(self, get_vif_state,station_names_fiveg, setup_profiles, get_lanforge_data, lf_test, update_report, + def test_wpa3_enterprise_5g(self, get_vif_state, station_names_fiveg, setup_profiles, get_lanforge_data, lf_test, + update_report, test_cases, radius_info, exit_on_fail): profile_data = setup_params_enterprise["ssid_modes"]["wpa3_enterprise"][1] ssid_name = profile_data["ssid_name"] @@ -207,7 +211,8 @@ class TestVLANModeEnterpriseTTLSSuiteTwo(object): @pytest.mark.wpa_wpa2_enterprise_mixed @pytest.mark.twog - def test_wpa_wpa2_enterprise_2g(self, get_vif_state,station_names_twog, setup_profiles, get_lanforge_data, lf_test, update_report, + def test_wpa_wpa2_enterprise_2g(self, get_vif_state, station_names_twog, setup_profiles, get_lanforge_data, lf_test, + update_report, test_cases, radius_info, exit_on_fail): profile_data = setup_params_enterprise_two["ssid_modes"]["wpa_wpa2_enterprise_mixed"][0] ssid_name = profile_data["ssid_name"] @@ -231,7 +236,8 @@ class TestVLANModeEnterpriseTTLSSuiteTwo(object): @pytest.mark.wpa_wpa2_enterprise_mixed @pytest.mark.fiveg - def test_wpa_wpa2_enterprise_5g(self, get_vif_state,station_names_fiveg, setup_profiles, get_lanforge_data, lf_test, + def test_wpa_wpa2_enterprise_5g(self, get_vif_state, station_names_fiveg, setup_profiles, get_lanforge_data, + lf_test, update_report, test_cases, radius_info, exit_on_fail): profile_data = setup_params_enterprise_two["ssid_modes"]["wpa_wpa2_enterprise_mixed"][1] ssid_name = profile_data["ssid_name"] @@ -255,7 +261,8 @@ class TestVLANModeEnterpriseTTLSSuiteTwo(object): @pytest.mark.wpa3_enterprise_mixed @pytest.mark.twog - def test_wpa3_enterprise_mixed_2g(self, get_vif_state,station_names_twog, setup_profiles, get_lanforge_data, lf_test, + def test_wpa3_enterprise_mixed_2g(self, get_vif_state, station_names_twog, setup_profiles, get_lanforge_data, + lf_test, update_report, test_cases, radius_info, exit_on_fail): profile_data = setup_params_enterprise_two["ssid_modes"]["wpa3_enterprise_mixed"][0] ssid_name = profile_data["ssid_name"] @@ -278,7 +285,8 @@ class TestVLANModeEnterpriseTTLSSuiteTwo(object): @pytest.mark.wpa3_enterprise_mixed @pytest.mark.fiveg - def test_wpa3_enterprise_mixed_5g(self, get_vif_state,station_names_fiveg, setup_profiles, get_lanforge_data, lf_test, + def test_wpa3_enterprise_mixed_5g(self, get_vif_state, station_names_fiveg, setup_profiles, get_lanforge_data, + lf_test, update_report, exit_on_fail, test_cases, radius_info): profile_data = setup_params_enterprise_two["ssid_modes"]["wpa3_enterprise_mixed"][1]