Skip to content

Commit

Permalink
Wifi 6849 (#432)
Browse files Browse the repository at this point in the history
* downlink mu-mimo test for Bridge-Open added

* mu-mimo test cases for other security modes are added

* Country code with channel division: 2Ghz,20Mhz, US and channel 1

* change in testcase execution

* created country_code-US, with channel_width-20Mhz, channel_no-1 for 2G band

* missed git_configuration param

* checking from setup_params_general 'rf' to set radio config

* added country_code_channel_division funtion

* added radio config using radio_config

* corrected allure report

* marker name changes for security modes in mu-mimo test case

* changed function name

* check allure report

* Added comment

* allure report corrected

* Created testcase for channel 2 in 2G band

* checking allure report

* added channel mode VHT in AP configuration which is common for both wifi-5 and wifi-6 AP, without channel-mode always getting channel mode HE

* checking allure report

* corrected json_get url

* testcase for channel-2 in 20Mhz, US, 2G

* file name changes in mu-mimo and sniff method added for pcap

* corrected channel overwritten on second testcase

* testcases for channels from 3 to 13 with US, 20Mhz, 2G

* packet sniffing methods moved from lf_tools to lf_pcap

* US have 2G channels from 1 to 11

* added print statement to verify IP and channel no

* marker names and security key changed for all security modes

* Checking again if client not assigned with IP

* Testcases: US, 40Mhz, 2G, channels 1-11

* Testcases: US, 40Mhz, 5G, channels (36,44,52,60,100,108,132,140)

* removed wrong testcases

* Testcases: IN, (20Mhz, 40Mhz), 2G, channels 1-11

* Testcases: IN, 40Mhz, 5G, channels (36,44,52,60,100,108,132,140)

* Testcases: CA, 20Mhz,40Mhz, 2G,5G, channels (1-11) (36,44,52,60,100,108,132,140)

* Testcases: CA, 40Mhz, 5G, channels (36,44,52,60,100,108,132,140)

* twog test cases added for mu-mimo for all security modes

* radio assignment changed in raw line config

* Testcases: CA, 5G, 80Mhz, channel (36, 52, 100, 132)

* Testcases: IN, 5G, 80Mhz, channel (36, 52, 100, 132)

* Testcases: US, 5G, 80Mhz, channel (36, 52, 100, 132)

* Testcases: CA, 20Mhz, 5G, channel (36,40,44,48,52,56,60, 64, 100, 104, 108, 112, 116,132, 136, 140, 144)

* Testcases: IN, 20Mhz, 5G, channel (36,40,44,48,52,56,60, 64, 100, 104, 108, 112, 116,132, 136, 140, 144)

* Testcases: US, 20Mhz, 5G, channel (36,40,44,48,52,56,60, 64, 100, 104, 108, 112, 116,132, 136, 140, 144)

* Added rf config improvements

Signed-off-by: shivam <[email protected]>

* twog and fiveg markers removed from module level markers

* added rf channel configuration to bridge mode

Signed-off-by: anil-tegala <[email protected]>

* allow-dfs disabled in 5G rf configuration

Signed-off-by: anil-tegala <[email protected]>

* channels changed in rf setup profiles

Signed-off-by: anil-tegala <[email protected]>

* pcap capture thread disabled from execution

Signed-off-by: anil-tegala <[email protected]>

* pcap capture thread disabled from execution

Signed-off-by: anil-tegala <[email protected]>

* ssid name changes in setup profiles

Signed-off-by: anil-tegala <[email protected]>

Co-authored-by: karthikaeyetea <[email protected]>
Co-authored-by: karthika <[email protected]>
Co-authored-by: shivam <[email protected]>
  • Loading branch information
4 people authored Mar 21, 2022
1 parent 9ca2432 commit 8d86ef8
Show file tree
Hide file tree
Showing 22 changed files with 1,905 additions and 37 deletions.
163 changes: 127 additions & 36 deletions libs/lanforge/lf_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
# Used by Nightly_Sanity
# This has different types of old_pytest like Single client connectivity, Single_Client_EAP, testrail_retest
#########################################################################################################
import datetime
import sys
import os
import threading

import allure
import pytest
Expand Down Expand Up @@ -33,7 +35,6 @@
from pull_report import Report
from scp_util import SCP_File


S = 12
# from eap_connect import EAPConnect
from test_ipv4_ttls import TTLSTest
Expand All @@ -52,10 +53,13 @@
from lf_atten_mod_test import CreateAttenuator
from lf_mesh_test import MeshTest
from LANforge.lfcli_base import LFCliBase
from lf_tr398_test import TR398Test
from lf_pcap import LfPcap
from sta_scan_test import StaScan
realm = importlib.import_module("py-json.realm")
Realm = realm.Realm


class RunTest:

def __init__(self, configuration_data=None, local_report_path="../reports/", influx_params=None, run_lf=False, debug=False):
Expand Down Expand Up @@ -106,6 +110,8 @@ def __init__(self, configuration_data=None, local_report_path="../reports/", inf
self.rx_sensitivity_obj = None
self.dualbandptest_obj = None
self.msthpt_obj = None
self.cvtest_obj = None
self.pcap_obj = None
self.influx_params = influx_params
# self.influxdb = RecordInflux(_influx_host=influx_params["influx_host"],
# _influx_port=influx_params["influx_port"],
Expand Down Expand Up @@ -220,7 +226,7 @@ def EAP_Connect(self, ssid="[BLANK]", passkey="[BLANK]", security="wpa2", extra_
station_name=[], key_mgmt="WPA-EAP",
pairwise="NA", group="NA", wpa_psk="DEFAULT",
ttls_passwd="nolastart", ieee80211w=1,
wep_key="NA", ca_cert="NA", eap="TTLS", identity="nolaradius",d_vlan=False,cleanup=True):
wep_key="NA", ca_cert="NA", eap="TTLS", identity="nolaradius", d_vlan=False, cleanup=True):
self.eap_connect = TTLSTest(host=self.lanforge_ip, port=self.lanforge_port,
sta_list=station_name, vap=False, _debug_on=self.debug)

Expand Down Expand Up @@ -283,7 +289,7 @@ def EAP_Connect(self, ssid="[BLANK]", passkey="[BLANK]", security="wpa2", extra_
self.eap_connect.build(extra_securities=extra_securities)
self.eap_connect.start(station_name, True, True)
if d_vlan:
self.station_ip = {}
self.station_ip = {}
for sta_name in station_name:
# try:
station_data_str = ""
Expand Down Expand Up @@ -329,12 +335,13 @@ def EAP_Connect(self, ssid="[BLANK]", passkey="[BLANK]", security="wpa2", extra_
cx_data = cx_data + "\n"
allure.attach(name="cx_data", body=str(cx_data))
if cleanup:
self.eap_connect.cleanup(station_name)
self.eap_connect.cleanup(station_name)
return self.eap_connect.passes()

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", influx_tags=[],
upload_rate="1Gbps", protocol="TCP-IPv4", duration="60000", stations="", create_stations=True, sort="interleave", raw_lines=[]):
upload_rate="1Gbps", protocol="TCP-IPv4", duration="60000", stations="", create_stations=True,
sort="interleave", raw_lines=[]):
instance_name = ''.join(random.choices(string.ascii_uppercase + string.digits, k=S))
if mode == "BRIDGE":
upstream_port = self.upstream_port
Expand Down Expand Up @@ -940,35 +947,35 @@ def attenuator_modify(self, serno, idx, val):

def mesh_test(self, instance_name=None, raw_lines=None, duration="60s"):
self.mesh_obj = MeshTest(
lf_host=self.lanforge_ip,
lf_port=self.lanforge_port,
ssh_port=self.lf_ssh_port,
local_lf_report_dir=self.local_report_path,
lf_user="lanforge",
lf_password = "lanforge",
instance_name = instance_name,
duration = duration,
config_name = "mesh_config",
upstream = "1.2.2 eth2",
upload_speed="85%",
download_speed="85%",
pull_report = True,
load_old_cfg = False,
raw_lines = raw_lines,
)
lf_host=self.lanforge_ip,
lf_port=self.lanforge_port,
ssh_port=self.lf_ssh_port,
local_lf_report_dir=self.local_report_path,
lf_user="lanforge",
lf_password="lanforge",
instance_name=instance_name,
duration=duration,
config_name="mesh_config",
upstream="1.2.2 eth2",
upload_speed="85%",
download_speed="85%",
pull_report=True,
load_old_cfg=False,
raw_lines=raw_lines,
)
self.mesh_obj.setup()
self.mesh_obj.run()
return self.mesh_obj

def attenuator_serial_2g_radio(self, ssid="[BLANK]", passkey="[BLANK]", security="wpa2", mode="BRIDGE",
vlan_id=100, sta_mode=0, station_name=[], lf_tools_obj=None):
radio = self.twog_radios[0]
#index 0 of atten_serial_radio will ser no of 1st 2g radio and index 1 will ser no of 2nd and 3rd 2g radio
# index 0 of atten_serial_radio will ser no of 1st 2g radio and index 1 will ser no of 2nd and 3rd 2g radio
atten_serial_radio = []
atten_serial = self.attenuator_serial()
self.Client_Connect_Using_Radio(ssid=ssid, passkey=passkey, security=security, mode=mode,
vlan_id=vlan_id, radio=radio, sta_mode=sta_mode,
station_name=station_name)
vlan_id=vlan_id, radio=radio, sta_mode=sta_mode,
station_name=station_name)
signal1 = lf_tools_obj.station_data_query(station_name=station_name[0], query="signal")
atten_sr = atten_serial[0].split(".")
for i in range(4):
Expand All @@ -985,12 +992,12 @@ def attenuator_serial_2g_radio(self, ssid="[BLANK]", passkey="[BLANK]", security
def attenuator_serial_5g_radio(self, ssid="[BLANK]", passkey="[BLANK]", security="wpa2", mode="BRIDGE",
vlan_id=100, sta_mode=0, station_name=[], lf_tools_obj=None):
radio = self.fiveg_radios[0]
#index 0 of atten_serial_radio will ser no of 1st 5g radio and index 1 will ser no of 2nd and 3rd 5g radio
# index 0 of atten_serial_radio will ser no of 1st 5g radio and index 1 will ser no of 2nd and 3rd 5g radio
atten_serial_radio = []
atten_serial = self.attenuator_serial()
self.Client_Connect_Using_Radio(ssid=ssid, passkey=passkey, security=security, mode=mode,
vlan_id=vlan_id, radio=radio, sta_mode=sta_mode,
station_name=station_name)
vlan_id=vlan_id, radio=radio, sta_mode=sta_mode,
station_name=station_name)
signal1 = lf_tools_obj.station_data_query(station_name=station_name[0], query="signal")
atten_sr = atten_serial[0].split(".")
for i in range(4):
Expand All @@ -1004,7 +1011,87 @@ def attenuator_serial_5g_radio(self, ssid="[BLANK]", passkey="[BLANK]", security
self.Client_disconnect(station_name=station_name)
return atten_serial_radio


def downlink_mu_mimo(self, radios_2g=[], radios_5g=[], radios_ax=[], dut_name="TIP", dut_5g="", dut_2g="", mode="BRIDGE", vlan_id=1, skip_2g=True, skip_5g=False):
raw_line = []
skip_twog = '1' if skip_2g else '0'
skip_fiveg = '1' if skip_5g else '0'
sniff_radio = 'wiphy6'
channel = 149 if skip_2g else 11
upstream_port = self.upstream_port

sets = [['Calibrate Attenuators', '0'], ['Receiver Sensitivity', '0'], ['Maximum Connection', '0'],
['Maximum Throughput', '0'], ['Airtime Fairness', '0'], ['Range Versus Rate', '0'],
['Spatial Consistency', '0'],
['Multiple STAs Performance', '0'], ['Multiple Assoc Stability', '0'], ['Downlink MU-MIMO', '1'],
['AP Coexistence', '0'], ['Long Term Stability', '0'], ['Skip 2.4Ghz Tests', f'{skip_twog}'],
['Skip 5Ghz Tests', f'{skip_fiveg}'], ['2.4Ghz Channel', 'AUTO'], ['5Ghz Channel', 'AUTO']]
for i in range(6):
if i == 0 or i == 2:
raw_line.append([f'radio-{i}: {radios_5g[0] if i == 0 else radios_5g[1]}'])
if i == 1 or i == 3:
raw_line.append([f'radio-{i}: {radios_2g[0] if i == 1 else radios_2g[1]}'])
if i == 4 or i == 5:
raw_line.append([f'radio-{i}: {radios_ax[0] if i == 4 else radios_ax[1]}'])

if len(raw_line) != 6:
raw_line = [['radio-0: 1.1.5 wiphy1'], ['radio-1: 1.1.4 wiphy0'], ['radio-2: 1.1.7 wiphy3'],
['radio-3: 1.1.6 wiphy2'], ['radio-4: 1.1.8 wiphy4'], ['radio-5: 1.1.9 wiphy5']]
instance_name = "tr398-instance-{}".format(str(random.randint(0, 100000)))

if not os.path.exists("mu-mimo-config.txt"):
with open("mu-mimo-config.txt", "wt") as f:
for i in raw_line:
f.write(str(i[0]) + "\n")
f.close()

if mode == "BRIDGE" or mode == "NAT":
upstream_port = self.upstream_port
else:
upstream_port = self.upstream_port + "." + str(vlan_id)
print("Upstream Port: ", self.upstream_port)

self.pcap_obj = LfPcap(host=self.lanforge_ip, port=self.lanforge_port)
self.cvtest_obj = TR398Test(lf_host=self.lanforge_ip,
lf_port=self.lanforge_port,
lf_user="lanforge",
lf_password="lanforge",
instance_name=instance_name,
config_name="cv_dflt_cfg",
upstream="1.1." + upstream_port,
pull_report=True,
local_lf_report_dir=self.local_report_path,
load_old_cfg=False,
dut2=dut_2g,
dut5=dut_5g,
raw_lines_file="mu-mimo-config.txt",
enables=[],
disables=[],
raw_lines=[],
sets=sets,
test_rig=dut_name
)
self.cvtest_obj.setup()
t1 = threading.Thread(target=self.cvtest_obj.run)
t1.start()
# t2 = threading.Thread(target=self.pcap_obj.sniff_packets, args=(sniff_radio, "mu-mimo", channel, 60))
# if t1.is_alive():
# time.sleep(180)
# t2.start()
while t1.is_alive():
time.sleep(1)
if os.path.exists("mu-mimo-config.txt"):
os.remove("mu-mimo-config.txt")

report_name = self.cvtest_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1]
influx = CSVtoInflux(influx_host=self.influx_params["influx_host"],
influx_port=self.influx_params["influx_port"],
influx_org=self.influx_params["influx_org"],
influx_token=self.influx_params["influx_token"],
influx_bucket=self.influx_params["influx_bucket"],
path=report_name)
influx.glob()
return self.cvtest_obj

def scan_ssid(self, radio=""):
'''This method for scan ssid data'''
obj_scan = StaScan(host=self.lanforge_ip, port=self.lanforge_port, ssid="fake ssid", security="open", password="[BLANK]", radio=radio, sta_list=["sta0000"], csv_output="scan_ssid.csv")
Expand Down Expand Up @@ -1078,17 +1165,17 @@ def country_code_channel_division(self, ssid = "[BLANK]", passkey='[BLANK]', sec
"influx_tag": ["basic-03", "ec420"],
}
lanforge_data = {
"ip": "192.168.200.10",
"ip": "10.28.3.6",
"port": 8080,
"ssh_port": 22,
"2.4G-Radio": ["wiphy0"],
"5G-Radio": ["wiphy1"],
"AX-Radio": [],
"upstream": "1.1.eth1",
"upstream_subnet": "192.168.200.1/24",
"uplink": "1.1.eth2",
"2.4G-Radio": ["1.1.wiphy4"],
"5G-Radio": ["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": "wlan0",
"5G-Station-Name": "wlan1",
"AX-Station-Name": "ax"
}
obj = RunTest(lanforge_data=lanforge_data, debug=False, influx_params=influx_params)
Expand All @@ -1109,3 +1196,7 @@ def country_code_channel_division(self, ssid = "[BLANK]", passkey='[BLANK]', sec
# print(a)
# print(obj.eap_connect.json_get("port/1/1/sta0000?fields=ap,ip"))
# obj.EAP_Connect(station_name=["sta0000", "sta0001"], eap="TTLS", ssid="testing_radius")


# TODO: create new funtion
# --> attach details to allure (ref:client_connectivity)
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ influxdb-client
pandas
paramiko
perfecto-py37
pyshark
pytest==6.2.2
requests
scp
Expand Down
Empty file.
Empty file.
Loading

0 comments on commit 8d86ef8

Please sign in to comment.