From 7850624e5dc49c94f091abab2ecdeccd0bde0676 Mon Sep 17 00:00:00 2001 From: shivamcandela Date: Thu, 15 Jul 2021 21:22:55 +0530 Subject: [PATCH] wct fixes local_path added, removed multiple classes Signed-off-by: shivamcandela --- libs/lanforge/lf_tests.py | 14 +- .../wifi_capacity_test/test_bridge_mode.py | 31 +-- .../wifi_capacity_test/test_nat_mode.py | 64 ++----- .../wifi_capacity_test/test_vlan_mode.py | 181 +++++++++++------- 4 files changed, 143 insertions(+), 147 deletions(-) diff --git a/libs/lanforge/lf_tests.py b/libs/lanforge/lf_tests.py index 64b6dcce1..432f4b89c 100644 --- a/libs/lanforge/lf_tests.py +++ b/libs/lanforge/lf_tests.py @@ -54,9 +54,7 @@ class RunTest: self.dataplane_obj = None self.dualbandptest_obj = None self.influx_params = influx_params - self.influxdb = RecordInflux(_lfjson_host=self.lanforge_ip, - _lfjson_port=self.lanforge_port, - _influx_host=influx_params["influx_host"], + self.influxdb = RecordInflux(_influx_host=influx_params["influx_host"], _influx_port=influx_params["influx_port"], _influx_org=influx_params["influx_org"], _influx_token=influx_params["influx_token"], @@ -210,10 +208,11 @@ class RunTest: elif mode == "VLAN": self.client_connect.upstream_port = self.upstream_port + "." + str(vlan_id) '''SINGLE WIFI CAPACITY using lf_wifi_capacity.py''' - self.wificapacity_obj = WiFiCapacityTest(lfclient_host=self.lanforge_ip, + wificapacity_obj = WiFiCapacityTest(lfclient_host=self.lanforge_ip, lf_port=self.lanforge_port, lf_user="lanforge", lf_password="lanforge", + local_lf_report_dir=self.local_report_path, instance_name=instance_name, config_name="wifi_config", upstream="1.1." + self.upstream_port, @@ -238,13 +237,14 @@ class RunTest: raw_lines_file="", sets=[]) - self.wificapacity_obj.setup() - self.wificapacity_obj.run() + wificapacity_obj.setup() + wificapacity_obj.run() - report_name = self.wificapacity_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] + report_name = wificapacity_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] influx = CSVtoInflux(influxdb=self.influxdb, _influx_tag=self.influx_params["influx_tag"], target_csv=self.local_report_path + report_name + "/kpi.csv") influx.post_to_influx() + return wificapacity_obj def Client_Connect(self, ssid="[BLANK]", passkey="[BLANK]", security="wpa2", mode="BRIDGE", band="twog", vlan_id=100, diff --git a/tests/e2e/basic/performance_tests/wifi_capacity_test/test_bridge_mode.py b/tests/e2e/basic/performance_tests/wifi_capacity_test/test_bridge_mode.py index e84997118..429f1e5d4 100644 --- a/tests/e2e/basic/performance_tests/wifi_capacity_test/test_bridge_mode.py +++ b/tests/e2e/basic/performance_tests/wifi_capacity_test/test_bridge_mode.py @@ -68,38 +68,13 @@ class TestWifiCapacityBridgeMode(object): pdf = i if pdf: allure.attach.file(source="../reports/" + report_name + "/" + pdf, - name=get_configuration["access_point"][0]["model"] + "_dataplane") + name=get_configuration["access_point"][0]["model"] + "_wifi_capacity_test") print("Test Completed... Cleaning up Stations") lf_test.Client_disconnect(station_name=station_names_twog) assert station else: assert False -setup_params_general_5g = { - "mode": "BRIDGE", - "ssid_modes": { - "wpa2_personal": [ - {"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"], - "security_key": "something"}]}, - "rf": {}, - "radius": False -} - - -@allure.feature("BRIDGE MODE CLIENT CONNECTIVITY") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general_5g], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestWifiCapacityBridgeMode5g(object): - """ Wifi Capacity Test Bridge mode - pytest -m "wifi_capacity_test and bridge" - """ - @pytest.mark.wpa2_personal @pytest.mark.fiveg def test_client_wpa2_bridge_5gg(self, get_vif_state, @@ -108,7 +83,7 @@ class TestWifiCapacityBridgeMode5g(object): """ Wifi Capacity Test Bridge mode pytest -m "wifi_capacity_test and bridge and wpa2_personal and fiveg" """ - profile_data = setup_params_general_5g["ssid_modes"]["wpa2_personal"][1] + profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][1] ssid_name = profile_data["ssid_name"] security = "wpa2" mode = "BRIDGE" @@ -132,7 +107,7 @@ class TestWifiCapacityBridgeMode5g(object): pdf = i if pdf: allure.attach.file(source="../reports/" + report_name + "/" + pdf, - name=get_configuration["access_point"][0]["model"] + "_dataplane") + name=get_configuration["access_point"][0]["model"] + "_wifi_capacity_test") print("Test Completed... Cleaning up Stations") lf_test.Client_disconnect(station_name=station_names_fiveg) assert station diff --git a/tests/e2e/basic/performance_tests/wifi_capacity_test/test_nat_mode.py b/tests/e2e/basic/performance_tests/wifi_capacity_test/test_nat_mode.py index 08a494373..f9189d280 100644 --- a/tests/e2e/basic/performance_tests/wifi_capacity_test/test_nat_mode.py +++ b/tests/e2e/basic/performance_tests/wifi_capacity_test/test_nat_mode.py @@ -1,7 +1,7 @@ """ - Performance Test: Wifi Capacity Test : Nat Mode - pytest -m "wifi_capacity_test and nat" + Performance Test: Wifi Capacity Test : Bridge Mode + pytest -m "wifi_capacity_test and bridge" """ import os @@ -31,23 +31,23 @@ setup_params_general = { scope="class" ) @pytest.mark.usefixtures("setup_profiles") -class TestWifiCapacityNatMode(object): - """ Wifi Capacity Test Nat mode - pytest -m "wifi_capacity_test and nat" +class TestWifiCapacityNATMode(object): + """ Wifi Capacity Test NAT mode + pytest -m "wifi_capacity_test and NAT" """ @pytest.mark.wpa2_personal @pytest.mark.twog - def test_client_open_pkt_60_2g(self, get_vif_state, + def test_client_wpa2_NAT_2g(self, get_vif_state, lf_test, station_names_twog, create_lanforge_chamberview_dut, get_configuration): - """ Wifi Capacity Test Nat mode - pytest -m "wifi_capacity_test and bridge and wpa2_personal and twog" + """ Wifi Capacity Test NAT mode + pytest -m "wifi_capacity_test and NAT and wpa2_personal and twog" """ profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][0] ssid_name = profile_data["ssid_name"] security = "wpa2" - mode = "BRIDGE" + mode = "NAT" security_key = profile_data["security_key"] band = "twog" vlan = 1 @@ -59,7 +59,7 @@ class TestWifiCapacityNatMode(object): station_name=station_names_twog, vlan_id=vlan) if station: wct_obj = lf_test.wifi_capacity(stations="1.1.%s" % station_names_twog[0], - instance_name="test_wct_wpa2_bridge", mode=mode, vlan_id=vlan) + instance_name="test_wct_wpa2_NAT", mode=mode, vlan_id=vlan) report_name = wct_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] entries = os.listdir("../reports/" + report_name + '/') pdf = False @@ -68,51 +68,25 @@ class TestWifiCapacityNatMode(object): pdf = i if pdf: allure.attach.file(source="../reports/" + report_name + "/" + pdf, - name=get_configuration["access_point"][0]["model"] + "_dataplane") + name=get_configuration["access_point"][0]["model"] + "_wifi_capacity_test") print("Test Completed... Cleaning up Stations") lf_test.Client_disconnect(station_name=station_names_twog) assert station else: assert False - -setup_params_general_5g = { - "mode": "NAT", - "ssid_modes": { - "wpa2_personal": [ - {"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"}, - {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"], - "security_key": "something"}]}, - "rf": {}, - "radius": False -} - - -@allure.feature("NAT MODE CLIENT CONNECTIVITY") -@pytest.mark.parametrize( - 'setup_profiles', - [setup_params_general_5g], - indirect=True, - scope="class" -) -@pytest.mark.usefixtures("setup_profiles") -class TestWifiCapacityNatMode5g(object): - """ Wifi Capacity Test Nat mode - pytest -m "wifi_capacity_test and bridge" - """ - @pytest.mark.wpa2_personal @pytest.mark.fiveg - def test_client_open_pkt_60_5g(self, get_vif_state, + def test_client_wpa2_NAT_5gg(self, get_vif_state, lf_test, station_names_fiveg, create_lanforge_chamberview_dut, get_configuration): - """ Wifi Capacity Test Nat mode - pytest -m "wifi_capacity_test and bridge and wpa2_personal and twog" + """ Wifi Capacity Test NAT mode + pytest -m "wifi_capacity_test and NAT and wpa2_personal and fiveg" """ - profile_data = setup_params_general_5g["ssid_modes"]["wpa2_personal"][1] + profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][1] ssid_name = profile_data["ssid_name"] security = "wpa2" - mode = "BRIDGE" + mode = "NAT" security_key = profile_data["security_key"] band = "fiveg" vlan = 1 @@ -124,7 +98,7 @@ class TestWifiCapacityNatMode5g(object): station_name=station_names_fiveg, vlan_id=vlan) if station: wct_obj = lf_test.wifi_capacity(stations="1.1.%s" % station_names_fiveg[0], - instance_name="test_wct_wpa2_bridge", mode=mode, vlan_id=vlan) + instance_name="test_wct_wpa2_NAT", mode=mode, vlan_id=vlan) report_name = wct_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] entries = os.listdir("../reports/" + report_name + '/') pdf = False @@ -133,11 +107,9 @@ class TestWifiCapacityNatMode5g(object): pdf = i if pdf: allure.attach.file(source="../reports/" + report_name + "/" + pdf, - name=get_configuration["access_point"][0]["model"] + "_dataplane") + name=get_configuration["access_point"][0]["model"] + "_wifi_capacity_test") print("Test Completed... Cleaning up Stations") lf_test.Client_disconnect(station_name=station_names_fiveg) assert station else: assert False - - diff --git a/tests/e2e/basic/performance_tests/wifi_capacity_test/test_vlan_mode.py b/tests/e2e/basic/performance_tests/wifi_capacity_test/test_vlan_mode.py index 80d16f653..3fec9b77d 100644 --- a/tests/e2e/basic/performance_tests/wifi_capacity_test/test_vlan_mode.py +++ b/tests/e2e/basic/performance_tests/wifi_capacity_test/test_vlan_mode.py @@ -1,66 +1,115 @@ -# """ -# Performance : Wifi Capacity Test : VLAN Mode -# -# """ -# -# import pytest -# import allure -# -# pytestmark = [pytest.mark.wifi_capacity_test, pytest.mark.vlan] -# -# setup_params_general = { -# "mode": "VLAN", -# "ssid_modes": { -# "wpa2_personal": [ -# {"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"}, -# {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"], -# "security_key": "something"}]}, -# "rf": {}, -# "radius": False -# } -# -# -# @pytest.mark.basic -# @allure.feature("VLAN MODE CLIENT CONNECTIVITY") -# @pytest.mark.parametrize( -# 'setup_profiles', -# [setup_params_general], -# indirect=True, -# scope="class" -# ) -# @pytest.mark.usefixtures("setup_profiles") -# class TestWifiCapacityVLANMode(object): -# -# @pytest.mark.wpa2_personal -# @pytest.mark.twog -# def test_client_wpa2_personal_2g(self, lf_test, station_names_twog, create_lanforge_chamberview_dut, -# get_configuration): -# profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][0] -# ssid_name = profile_data["ssid_name"] -# security_key = profile_data["security_key"] -# security = "wpa2" -# mode = "VLAN" -# band = "twog" -# vlan = 1 -# dut_name = create_lanforge_chamberview_dut -# PASS = lf_test.wifi_capacity(ssid=profile_data["ssid_name"], paswd=profile_data["security_key"], -# security="wpa2", mode="VLAN", band="twog", -# instance_name="wct_instance", ) -# assert PASS -# -# @pytest.mark.wpa2_personal -# @pytest.mark.fiveg -# def test_client_wpa2_personal_2g(self, lf_test, station_names_twog, create_lanforge_chamberview_dut, -# get_configuration): -# profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][0] -# ssid_name = profile_data["ssid_name"] -# security_key = profile_data["security_key"] -# security = "wpa2" -# mode = "VLAN" -# band = "fiveg" -# vlan = 1 -# dut_name = create_lanforge_chamberview_dut -# PASS = lf_test.wifi_capacity(ssid=profile_data["ssid_name"], paswd=profile_data["security_key"], -# security=security, mode=mode, band=band, -# instance_name="wct_instance", ) -# assert PASS +""" + + Performance Test: Wifi Capacity Test : VLAN Mode + pytest -m "wifi_capacity_test and VLAN" + +""" +import os +import pytest +import allure + +pytestmark = [pytest.mark.wifi_capacity_test, pytest.mark.vlan, + pytest.mark.usefixtures("setup_test_run")] + +setup_params_general = { + "mode": "VLAN", + "ssid_modes": { + "wpa2_personal": [ + {"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["is2dot4GHz"], "security_key": "something"}, + {"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["is5GHzU", "is5GHz", "is5GHzL"], + "security_key": "something"}]}, + "rf": {}, + "radius": False +} + + +@allure.feature("VLAN MODE CLIENT CONNECTIVITY") +@pytest.mark.parametrize( + 'setup_profiles', + [setup_params_general], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +class TestWifiCapacityVLANMode(object): + """ Wifi Capacity Test vlan mode + pytest -m "wifi_capacity_test and vlan" + """ + + @pytest.mark.wpa2_personal + @pytest.mark.twog + def test_client_wpa2_VLAN_2g(self, get_vif_state, + lf_test, station_names_twog, create_lanforge_chamberview_dut, + get_configuration): + """ Wifi Capacity Test vlan mode + pytest -m "wifi_capacity_test and vlan and wpa2_personal and twog" + """ + profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][0] + ssid_name = profile_data["ssid_name"] + security = "wpa2" + mode = "VLAN" + security_key = profile_data["security_key"] + band = "twog" + vlan = 1 + if ssid_name not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + station = lf_test.Client_Connect(ssid=ssid_name, security=security, passkey=security_key, + mode=mode, band=band, + station_name=station_names_twog, vlan_id=vlan) + if station: + wct_obj = lf_test.wifi_capacity(stations="1.1.%s" % station_names_twog[0], + instance_name="test_wct_wpa2_vlan", mode=mode, vlan_id=vlan) + report_name = wct_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] + entries = os.listdir("../reports/" + report_name + '/') + pdf = False + for i in entries: + if ".pdf" in i: + pdf = i + if pdf: + allure.attach.file(source="../reports/" + report_name + "/" + pdf, + name=get_configuration["access_point"][0]["model"] + "_wifi_capacity_test") + print("Test Completed... Cleaning up Stations") + lf_test.Client_disconnect(station_name=station_names_twog) + assert station + else: + assert False + + @pytest.mark.wpa2_personal + @pytest.mark.fiveg + def test_client_wpa2_vlan_5gg(self, get_vif_state, + lf_test, station_names_fiveg, create_lanforge_chamberview_dut, + get_configuration): + """ Wifi Capacity Test vlan mode + pytest -m "wifi_capacity_test and vlan and wpa2_personal and fiveg" + """ + profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][1] + ssid_name = profile_data["ssid_name"] + security = "wpa2" + mode = "VLAN" + security_key = profile_data["security_key"] + band = "fiveg" + vlan = 1 + if ssid_name not in get_vif_state: + allure.attach(name="retest,vif state ssid not available:", body=str(get_vif_state)) + pytest.xfail("SSID NOT AVAILABLE IN VIF STATE") + station = lf_test.Client_Connect(ssid=ssid_name, security=security, passkey=security_key, + mode=mode, band=band, + station_name=station_names_fiveg, vlan_id=vlan) + if station: + wct_obj = lf_test.wifi_capacity(stations="1.1.%s" % station_names_fiveg[0], + instance_name="test_wct_wpa2_vlan", mode=mode, vlan_id=vlan) + report_name = wct_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] + entries = os.listdir("../reports/" + report_name + '/') + pdf = False + for i in entries: + if ".pdf" in i: + pdf = i + if pdf: + allure.attach.file(source="../reports/" + report_name + "/" + pdf, + name=get_configuration["access_point"][0]["model"] + "_wifi_capacity_test") + print("Test Completed... Cleaning up Stations") + lf_test.Client_disconnect(station_name=station_names_fiveg) + assert station + else: + assert False