mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-11-03 12:27:53 +00:00
rate limiting support in framework
Signed-off-by: shivamcandela <shivam.thakur@candelatech.com>
This commit is contained in:
@@ -282,6 +282,9 @@ class UProfileUtility:
|
||||
def add_ssid(self, ssid_data, radius=False, radius_auth_data={}, radius_accounting_data={}):
|
||||
print("ssid data : ", ssid_data)
|
||||
ssid_info = {'name': ssid_data["ssid_name"], "bss-mode": "ap", "wifi-bands": [], "services": ["wifi-frames"]}
|
||||
for options in ssid_data:
|
||||
if options == "rate-limit":
|
||||
ssid_info[options] = ssid_data[options]
|
||||
for i in ssid_data["appliedRadios"]:
|
||||
ssid_info["wifi-bands"].append(i)
|
||||
ssid_info['encryption'] = {}
|
||||
@@ -373,7 +376,7 @@ if __name__ == '__main__':
|
||||
# profile.set_mode(mode="BRIDGE")
|
||||
# profile.set_radio_config()
|
||||
# ssid = {"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security": "psk", "security_key": "something",
|
||||
# "vlan": 100}
|
||||
# "vlan": 100, "rate-limit": {"ingress-rate": 50, "egress-rate": 50}}
|
||||
# profile.add_ssid(ssid_data=ssid)
|
||||
# profile.push_config(serial_number="903cb39d6918")
|
||||
# print(obj.get_devices())
|
||||
|
||||
@@ -213,7 +213,8 @@ class RunTest:
|
||||
self.eap_connect.cleanup(station_name)
|
||||
return self.eap_connect.passes()
|
||||
|
||||
def wifi_capacity(self, mode="BRIDGE", vlan_id=100, instance_name="wct_instance", download_rate="1Gbps",
|
||||
def wifi_capacity(self, mode="BRIDGE", vlan_id=100, batch_size="1,5,10,20,40,64,128",
|
||||
instance_name="wct_instance", download_rate="1Gbps",
|
||||
upload_rate="1Gbps", protocol="TCP-IPv4", duration="60000"):
|
||||
instance_name = ''.join(random.choices(string.ascii_uppercase + string.digits, k=S))
|
||||
if mode == "BRIDGE":
|
||||
@@ -231,7 +232,7 @@ class RunTest:
|
||||
instance_name=instance_name,
|
||||
config_name="wifi_config",
|
||||
upstream="1.1." + upstream_port,
|
||||
batch_size="1,5,10,20,40,64,128",
|
||||
batch_size=batch_size,
|
||||
loop_iter="1",
|
||||
protocol=protocol,
|
||||
duration=duration,
|
||||
@@ -254,9 +255,9 @@ class RunTest:
|
||||
wificapacity_obj.setup()
|
||||
wificapacity_obj.run()
|
||||
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()
|
||||
# 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",
|
||||
|
||||
@@ -10,7 +10,6 @@ import allure
|
||||
import re
|
||||
import logging
|
||||
|
||||
|
||||
from _pytest.fixtures import SubRequest
|
||||
from pyparsing import Optional
|
||||
|
||||
|
||||
@@ -47,14 +47,9 @@ def create_lanforge_chamberview_dut(lf_tools):
|
||||
return dut_name
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def setup_vlan():
|
||||
vlan_id = [100]
|
||||
yield vlan_id[0]
|
||||
|
||||
|
||||
@pytest.fixture(scope="class")
|
||||
def setup_profiles(request, setup_controller, testbed, setup_vlan, get_equipment_id, fixtures_ver,
|
||||
def setup_profiles(request, setup_controller, testbed, get_equipment_id, fixtures_ver,
|
||||
instantiate_profile, get_markers, create_lanforge_chamberview_dut, lf_tools,
|
||||
get_security_flags, get_configuration, radius_info, get_apnos, radius_accounting_info):
|
||||
lf_tools.reset_scenario()
|
||||
@@ -82,12 +77,12 @@ def setup_profiles(request, setup_controller, testbed, setup_vlan, get_equipment
|
||||
lf_tools.add_vlan(vlan_ids=vlan_list)
|
||||
|
||||
# call this, if 1.x
|
||||
return_1x = fixtures_ver.setup_profiles(request, param, setup_controller, testbed, setup_vlan, get_equipment_id,
|
||||
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_1x
|
||||
yield return_var
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
"""
|
||||
Rate LImiting Bridge Mode Scenario
|
||||
"""
|
||||
|
||||
import allure
|
||||
import pytest
|
||||
|
||||
pytestmark = [pytest.mark.rate_limiting, pytest.mark.bridge, pytest.mark.general, pytest.mark.ucentral,
|
||||
pytest.mark.regression]
|
||||
|
||||
setup_params_general = {
|
||||
"mode": "BRIDGE",
|
||||
"ssid_modes": {
|
||||
"wpa2_personal": [
|
||||
{"ssid_name": "ssid_wpa2_2g_br",
|
||||
"appliedRadios": ["2G"],
|
||||
"security_key": "something",
|
||||
"rate-limit": {
|
||||
"ingress-rate": 20,
|
||||
"egress-rate": 20
|
||||
}
|
||||
},
|
||||
{"ssid_name": "ssid_wpa2_5g_br",
|
||||
"appliedRadios": ["5G"],
|
||||
"security_key": "something",
|
||||
"rate-limit": {
|
||||
"ingress-rate": 50,
|
||||
"egress-rate": 50
|
||||
}
|
||||
}]},
|
||||
"rf": {},
|
||||
"radius": False
|
||||
}
|
||||
|
||||
|
||||
@allure.feature("Bridge MODE Rate Limiting")
|
||||
@pytest.mark.parametrize(
|
||||
'setup_profiles',
|
||||
[setup_params_general],
|
||||
indirect=True,
|
||||
scope="class"
|
||||
)
|
||||
@pytest.mark.usefixtures("setup_profiles")
|
||||
class TestRateLimitingBridge(object):
|
||||
|
||||
@pytest.mark.wpa2_personal
|
||||
@pytest.mark.twog
|
||||
@allure.story('Rate Limiting Open SSID 2.4 GHZ Band')
|
||||
def test_open_ssid_5g(self, lf_test, get_vif_state, lf_tools):
|
||||
"""
|
||||
Test Rate Limiting Scenario
|
||||
"""
|
||||
# run wifi capacity test here
|
||||
profile_data = setup_params_general["ssid_modes"]["wpa2_personal"][0]
|
||||
ssid_name = profile_data["ssid_name"]
|
||||
mode = "BRIDGE"
|
||||
vlan = 1
|
||||
allure.attach(name="ssid-rates", body=str(profile_data["rate-limit"]))
|
||||
get_vif_state.append(ssid_name)
|
||||
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")
|
||||
lf_tools.add_stations(band="2G", num_stations=5, dut=lf_tools.dut_name, ssid_name=ssid_name)
|
||||
lf_tools.Chamber_View()
|
||||
wct_obj = lf_test.wifi_capacity(instance_name="test_client_wpa2_BRIDGE_tcp_dl", mode=mode, vlan_id=vlan,
|
||||
download_rate="1Gbps", batch_size="1,5",
|
||||
upload_rate="1Gbps", protocol="TCP-IPv4", duration="60000")
|
||||
|
||||
report_name = wct_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1]
|
||||
|
||||
lf_tools.attach_report_graphs(report_name=report_name)
|
||||
print("Test Completed... Cleaning up Stations")
|
||||
assert True
|
||||
@@ -68,7 +68,7 @@ class Fixtures_1x:
|
||||
version_list.append(version)
|
||||
return version_list
|
||||
|
||||
def setup_profiles(self, request, param, setup_controller, testbed, setup_vlan, get_equipment_id, instantiate_profile,
|
||||
def setup_profiles(self, 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):
|
||||
|
||||
@@ -92,7 +92,6 @@ class Fixtures_1x:
|
||||
vlan_id = 1
|
||||
if parameter['mode'] == "VLAN":
|
||||
mode = "BRIDGE"
|
||||
vlan_id = setup_vlan
|
||||
|
||||
instantiate_profile.delete_profile_by_name(profile_name=testbed + "-Equipment-AP-" + parameter['mode'])
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class Fixtures_2x:
|
||||
version_list.append(version)
|
||||
return version_list
|
||||
|
||||
def setup_profiles(self, request, param, setup_controller, testbed, setup_vlan, get_equipment_id,
|
||||
def setup_profiles(self, 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):
|
||||
print("inside conftest_2x")
|
||||
@@ -93,7 +93,6 @@ class Fixtures_2x:
|
||||
if parameter['mode'] == "VLAN":
|
||||
mode = "VLAN"
|
||||
instantiate_profile_obj.set_mode(mode=mode)
|
||||
vlan_id = setup_vlan
|
||||
profile_data["ssid"] = {}
|
||||
|
||||
for i in parameter["ssid_modes"]:
|
||||
@@ -256,12 +255,18 @@ class Fixtures_2x:
|
||||
break
|
||||
if x < 19:
|
||||
print("Config properly applied into AP", config)
|
||||
|
||||
time_2 = time.time()
|
||||
time_interval = time_2 - time_1
|
||||
allure.attach(name="Time Took to apply Config: " + str(time_interval), body="")
|
||||
|
||||
ap_config_latest = ap_ssh.get_uc_latest_config()
|
||||
ap_config_latest["uuid"] = 0
|
||||
|
||||
ap_config_active = ap_ssh.get_uc_active_config()
|
||||
ap_config_active["uuid"] = 0
|
||||
x = 1
|
||||
|
||||
while ap_config_active != ap_config_latest:
|
||||
time.sleep(5)
|
||||
x += 1
|
||||
@@ -274,30 +279,14 @@ class Fixtures_2x:
|
||||
ap_config_active["uuid"] = 0
|
||||
if x == 19:
|
||||
break
|
||||
allure_body = "AP config status: \n" + \
|
||||
"Active Config: " + str(ap_ssh.get_uc_active_config()) + "\n" \
|
||||
"Latest Config: ", str(
|
||||
ap_ssh.get_uc_latest_config()) + "\n" \
|
||||
"Applied Config: ", str(config)
|
||||
|
||||
if x < 19:
|
||||
print("AP is Broadcasting Applied Config")
|
||||
allure.attach(name="AP is Broadcasting Applied Config", body="")
|
||||
allure.attach(name="Config Info", body="Applied Config: " + str(ap_config_active))
|
||||
allure.attach(name="Config Info",
|
||||
body="AP is Broadc3asting Applied Config: " + str(ap_ssh.get_uc_active_config()))
|
||||
allure.attach(name="Config Info", body="AP is Broadcasting Applied Config: " + str(allure_body))
|
||||
allure.attach(name="Success : Active Config in AP: ", body=str(ap_config_active))
|
||||
|
||||
else:
|
||||
print("AP is Not Broadcasting Applied Config")
|
||||
allure.attach(name="AP is Not Broadcasting Applied Config", body="")
|
||||
allure.attach(name="Config Info", body="Applied Config: " + str(ap_config_active))
|
||||
allure.attach(name="Config Info",
|
||||
body="AP is Broadc3asting Applied Config: " + str(ap_ssh.get_uc_active_config()))
|
||||
allure.attach(name="Config Info", body="AP is Broadcasting Applied Config: " + str(allure_body))
|
||||
time_2 = time.time()
|
||||
time_interval = time_2 - time_1
|
||||
allure.attach(name="Time Took to apply Config: " + str(time_interval), body="")
|
||||
allure.attach(name="Failed to Apply Config : Active Config in AP : ", body=str(ap_config_active))
|
||||
|
||||
ap_logs = ap_ssh.logread()
|
||||
allure.attach(body=ap_logs, name="AP LOgs: ")
|
||||
ap_wifi_data = ap_ssh.get_interface_details()
|
||||
@@ -407,7 +396,6 @@ class Fixtures_2x:
|
||||
lf_tools.ssid_list.append(ap_wifi_data[ap_interfaces[interface]][0])
|
||||
lf_tools.dut_idx_mapping = idx_mapping
|
||||
print(ssid_data)
|
||||
lf_tools.reset_scenario()
|
||||
lf_tools.update_ssid(ssid_data=ssid_data)
|
||||
return test_cases
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user