mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-11-02 11:57:49 +00:00
2.x updates
setup_profiles for 2.x added functionality - bssid band ssid mapping for lf dut get_vif_state fixture adjustments for 2.x (posibbly changing the naming convention in next commit) lf_tests synced up with master branch lf_tools synced up with master added a ssid_list in lf_tools, it will be updated and used on a class level for verification of ssid availability in each test case Signed-off-by: shivamcandela <shivam.thakur@candelatech.com>
This commit is contained in:
@@ -24,6 +24,9 @@ sys.path.append(f'../libs')
|
||||
sys.path.append(f'../libs/lanforge/')
|
||||
from sta_connect2 import StaConnect2
|
||||
import time
|
||||
import string
|
||||
import random
|
||||
S = 12
|
||||
# from eap_connect import EAPConnect
|
||||
from test_ipv4_ttls import TTLSTest
|
||||
from lf_wifi_capacity_test import WiFiCapacityTest
|
||||
@@ -200,42 +203,44 @@ 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", stations=None):
|
||||
def wifi_capacity(self, mode="BRIDGE", vlan_id=100, 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":
|
||||
self.client_connect.upstream_port = self.upstream_port
|
||||
upstream_port = self.upstream_port
|
||||
elif mode == "NAT":
|
||||
self.client_connect.upstream_port = self.upstream_port
|
||||
upstream_port = self.upstream_port
|
||||
elif mode == "VLAN":
|
||||
self.client_connect.upstream_port = self.upstream_port + "." + str(vlan_id)
|
||||
upstream_port = self.upstream_port + "." + str(vlan_id)
|
||||
'''SINGLE WIFI CAPACITY using lf_wifi_capacity.py'''
|
||||
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,
|
||||
batch_size="1",
|
||||
loop_iter="1",
|
||||
protocol="UDP-IPv4",
|
||||
duration="3000",
|
||||
pull_report=True,
|
||||
load_old_cfg=False,
|
||||
upload_rate="10Mbps",
|
||||
download_rate="1Gbps",
|
||||
sort="interleave",
|
||||
stations=stations,
|
||||
create_stations=False,
|
||||
radio=None,
|
||||
security=None,
|
||||
paswd=None,
|
||||
ssid=None,
|
||||
enables=[],
|
||||
disables=[],
|
||||
raw_lines=[],
|
||||
raw_lines_file="",
|
||||
sets=[])
|
||||
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." + upstream_port,
|
||||
batch_size="1,5,10,20,40,64",
|
||||
loop_iter="1",
|
||||
protocol=protocol,
|
||||
duration=duration,
|
||||
pull_report=True,
|
||||
load_old_cfg=False,
|
||||
upload_rate=upload_rate,
|
||||
download_rate=download_rate,
|
||||
sort="interleave",
|
||||
# stations=stations,
|
||||
create_stations=True,
|
||||
radio=None,
|
||||
security=None,
|
||||
paswd=None,
|
||||
ssid=None,
|
||||
enables=[],
|
||||
disables=[],
|
||||
raw_lines=[],
|
||||
raw_lines_file="",
|
||||
sets=[])
|
||||
|
||||
wificapacity_obj.setup()
|
||||
wificapacity_obj.run()
|
||||
@@ -282,18 +287,25 @@ class RunTest:
|
||||
return True
|
||||
|
||||
def dataplane(self, station_name=None, mode="BRIDGE", vlan_id=100, download_rate="85%", dut_name="TIP",
|
||||
upload_rate="85%", duration="1m", instance_name="test_demo"):
|
||||
upload_rate="0", duration="15s", instance_name="test_demo", raw_lines=None):
|
||||
instance_name = ''.join(random.choices(string.ascii_uppercase + string.digits, k=S))
|
||||
|
||||
if mode == "BRIDGE":
|
||||
self.client_connect.upstream_port = self.upstream_port
|
||||
elif mode == "NAT":
|
||||
self.client_connect.upstream_port = self.upstream_port
|
||||
else:
|
||||
elif mode == "VLAN":
|
||||
self.client_connect.upstream_port = self.upstream_port + "." + str(vlan_id)
|
||||
|
||||
if raw_lines is None:
|
||||
raw_lines = [['pkts: 60;142;256;512;1024;MTU;4000'], ['directions: DUT Transmit;DUT Receive'],
|
||||
['traffic_types: UDP;TCP'],
|
||||
["show_3s: 1"], ["show_ll_graphs: 1"], ["show_log: 1"]]
|
||||
|
||||
self.dataplane_obj = DataplaneTest(lf_host=self.lanforge_ip,
|
||||
lf_port=self.lanforge_port,
|
||||
ssh_port=self.lf_ssh_port,
|
||||
local_path=self.local_report_path,
|
||||
local_lf_report_dir=self.local_report_path,
|
||||
lf_user="lanforge",
|
||||
lf_password="lanforge",
|
||||
instance_name=instance_name,
|
||||
@@ -306,61 +318,63 @@ class RunTest:
|
||||
duration=duration,
|
||||
dut=dut_name,
|
||||
station="1.1." + station_name[0],
|
||||
raw_lines=[['pkts: Custom;60;142;256;512;1024;MTU'],
|
||||
['directions: DUT Transmit;DUT Receive'],
|
||||
['traffic_types: UDP;TCP'], ["show_3s: 1"],
|
||||
["show_ll_graphs: 1"], ["show_log: 1"]],
|
||||
)
|
||||
raw_lines=raw_lines)
|
||||
|
||||
self.dataplane_obj.setup()
|
||||
self.dataplane_obj.run()
|
||||
report_name = self.dataplane_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1]
|
||||
influx = CSVtoInflux(influxdb=self.influxdb,
|
||||
_influx_tag=self.influx_params["influx_tag"],
|
||||
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 self.dataplane_obj
|
||||
|
||||
def dualbandperformancetest(self,ssid_5G="[BLANK]",ssid_2G="[BLANK]",mode="BRIDGE", vlan_id=100,dut_name="TIP",
|
||||
instance_name="test_demo"):
|
||||
def dualbandperformancetest(self, ssid_5G="[BLANK]", ssid_2G="[BLANK]", mode="BRIDGE", vlan_id=100, dut_name="TIP",
|
||||
instance_name="test_demo", dut_5g="", dut_2g=""):
|
||||
instance_name = ''.join(random.choices(string.ascii_uppercase + string.digits, k=S))
|
||||
|
||||
if mode == "BRIDGE":
|
||||
self.client_connect.upstream_port = self.upstream_port
|
||||
self.upstream_port = self.upstream_port
|
||||
elif mode == "NAT":
|
||||
self.client_connect.upstream_port = self.upstream_port
|
||||
self.upstream_port = self.upstream_port
|
||||
else:
|
||||
self.client_connect.upstream_port = self.upstream_port + "." + str(vlan_id)
|
||||
self.upstream_port = self.upstream_port + "." + str(vlan_id)
|
||||
|
||||
self.dualbandptest_obj = ApAutoTest(lf_host=self.lanforge_ip,
|
||||
lf_port=self.lanforge_port,
|
||||
lf_user="lanforge",
|
||||
lf_password="lanforge",
|
||||
instance_name=instance_name,
|
||||
config_name="dbp_config",
|
||||
upstream="1.1." + self.upstream_port,
|
||||
pull_report=True,
|
||||
dut5_0=dut_name + ' ' + ssid_5G,
|
||||
dut2_0=dut_name + ' ' + ssid_2G,
|
||||
load_old_cfg=False,
|
||||
max_stations_2=1,
|
||||
max_stations_5=1,
|
||||
max_stations_dual=2,
|
||||
radio2=[["1.1.wiphy0"]],
|
||||
radio5=[["1.1.wiphy1"]],
|
||||
sets=[['Basic Client Connectivity', '0'], ['Multi Band Performance', '1'],
|
||||
['Throughput vs Pkt Size', '0'], ['Capacity', '0'], ['Stability', '0'],
|
||||
['Band-Steering', '0'], ['Multi-Station Throughput vs Pkt Size', '0'],
|
||||
['Long-Term', '0']]
|
||||
)
|
||||
lf_port=self.lanforge_port,
|
||||
lf_user="lanforge",
|
||||
lf_password="lanforge",
|
||||
instance_name=instance_name,
|
||||
config_name="dbp_config",
|
||||
upstream="1.1." + self.upstream_port,
|
||||
pull_report=True,
|
||||
dut5_0=dut_5g,
|
||||
dut2_0=dut_2g,
|
||||
load_old_cfg=False,
|
||||
local_lf_report_dir=self.local_report_path,
|
||||
max_stations_2=64,
|
||||
max_stations_5=64,
|
||||
max_stations_dual=124,
|
||||
radio2=[self.twog_radios],
|
||||
radio5=[self.fiveg_radios],
|
||||
sets=[['Basic Client Connectivity', '0'], ['Multi Band Performance', '1'],
|
||||
['Throughput vs Pkt Size', '0'], ['Capacity', '0'],
|
||||
['Skip 2.4Ghz Tests', '1'],
|
||||
['Skip 5Ghz Tests', '1'],
|
||||
['Stability', '0'],
|
||||
['Band-Steering', '0'], ['Multi-Station Throughput vs Pkt Size', '0'],
|
||||
['Long-Term', '0']]
|
||||
)
|
||||
self.dualbandptest_obj.setup()
|
||||
self.dualbandptest_obj.run()
|
||||
report_name = self.dataplane_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()
|
||||
report_name = self.dualbandptest_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 self.dualbandptest_obj
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
lanforge_data = {
|
||||
"ip": "localhost",
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import re
|
||||
|
||||
import allure
|
||||
from create_chamberview import CreateChamberview
|
||||
from create_chamberview_dut import DUT
|
||||
import time
|
||||
@@ -6,6 +9,7 @@ import json
|
||||
import os
|
||||
import pandas as pd
|
||||
|
||||
|
||||
class ChamberView:
|
||||
|
||||
def __init__(self, lanforge_data=None, access_point_data=None, debug=True, testbed=None):
|
||||
@@ -28,7 +32,8 @@ class ChamberView:
|
||||
self.scenario_name = "TIP-" + self.testbed
|
||||
self.debug = debug
|
||||
self.exit_on_error = False
|
||||
|
||||
self.dut_idx_mapping = {}
|
||||
self.ssid_list = []
|
||||
self.raw_line = [
|
||||
["profile_link " + self.upstream_resources + " upstream-dhcp 1 NA NA " + self.upstream_port.split(".")
|
||||
[2] + ",AUTO -1 NA"],
|
||||
@@ -57,6 +62,15 @@ class ChamberView:
|
||||
)
|
||||
self.CreateDut.ssid = []
|
||||
|
||||
def reset_scenario(self):
|
||||
self.raw_line = [
|
||||
["profile_link " + self.upstream_resources + " upstream-dhcp 1 NA NA " + self.upstream_port.split(".")
|
||||
[2] + ",AUTO -1 NA"],
|
||||
["profile_link " + self.uplink_resources + " uplink-nat 1 'DUT: upstream LAN " + self.upstream_subnet
|
||||
+ "' NA " + self.uplink_port.split(".")[2] + "," + self.upstream_port.split(".")[2] + " -1 NA"]
|
||||
]
|
||||
self.Chamber_View()
|
||||
|
||||
def Chamber_View(self):
|
||||
if self.delete_old_scenario:
|
||||
self.CreateChamberview.clean_cv_scenario(type="Network-Connectivity", scenario_name=self.scenario_name)
|
||||
@@ -70,6 +84,38 @@ class ChamberView:
|
||||
self.CreateChamberview.sync_cv()
|
||||
return self.CreateChamberview, self.scenario_name
|
||||
|
||||
def add_stations(self, band="2G", num_stations="max", dut="NA", ssid_name=[]):
|
||||
idx = 0
|
||||
print(self.dut_idx_mapping)
|
||||
for i in self.dut_idx_mapping:
|
||||
if self.dut_idx_mapping[i][0] == ssid_name and self.dut_idx_mapping[i][3] == band:
|
||||
idx = i
|
||||
max_stations = 0
|
||||
print(idx)
|
||||
if band == "2G":
|
||||
max_stations = 64 * len(self.twog_radios)
|
||||
radio = ",".join(self.twog_radios)
|
||||
if len(self.twog_radios) == 1:
|
||||
radio = radio + ",AUTO"
|
||||
# self.eap_connect.sta_prefix = self.twog_prefix
|
||||
if band == "5G":
|
||||
max_stations = 64 * len(self.twog_radios)
|
||||
radio = ",".join(self.fiveg_radios)
|
||||
if len(self.fiveg_radios) == 1:
|
||||
radio = radio + ",AUTO"
|
||||
if band == "ax":
|
||||
max_stations = len(self.twog_radios)
|
||||
radio = ",".join(self.fiveg_radios)
|
||||
if len(self.fiveg_radios) == 1:
|
||||
radio = radio + ",AUTO"
|
||||
# self.eap_connect.sta_prefix = self.fiveg_prefix
|
||||
if num_stations != "max":
|
||||
max_stations = num_stations
|
||||
station_data = ["profile_link 1.1 STA-AUTO " + str(max_stations) + " 'DUT: " + dut + " Radio-" + str(int(idx)+1) + "'" + " NA " + radio]
|
||||
self.raw_line.append(station_data)
|
||||
|
||||
|
||||
|
||||
def Create_Dut(self):
|
||||
self.CreateDut.setup()
|
||||
self.CreateDut.add_ssids()
|
||||
@@ -95,12 +141,6 @@ class ChamberView:
|
||||
json_response = cli_base.json_get(_req_url=_req_url)
|
||||
return json_response
|
||||
|
||||
def add_stations(self, num_stations=5):
|
||||
self.CreateChamberview.setup(create_scenario=self.scenario_name,
|
||||
raw_line=self.raw_line)
|
||||
|
||||
return True
|
||||
|
||||
def json_post(self, req_url, shelf, resources, port, current, intrest):
|
||||
data = {
|
||||
"shelf": shelf,
|
||||
@@ -112,7 +152,7 @@ class ChamberView:
|
||||
cli_base = LFCliBase(_lfjson_host=self.lanforge_ip, _lfjson_port=self.lanforge_port, )
|
||||
return cli_base.json_post(req_url, data)
|
||||
|
||||
def read_kpi_file(self, column_name, dir_name ):
|
||||
def read_kpi_file(self, column_name, dir_name):
|
||||
if column_name == None:
|
||||
df = pd.read_csv("../reports/" + str(dir_name) + "/kpi.csv", sep=r'\t', engine='python')
|
||||
if df.empty == True:
|
||||
@@ -120,14 +160,36 @@ class ChamberView:
|
||||
else:
|
||||
return df
|
||||
else:
|
||||
df = pd.read_csv("../reports/" + str(dir_name) + "/kpi.csv", sep=r'\t', usecols=column_name, engine='python')
|
||||
df = pd.read_csv("../reports/" + str(dir_name) + "/kpi.csv", sep=r'\t', usecols=column_name,
|
||||
engine='python')
|
||||
if df.empty == True:
|
||||
return "empty"
|
||||
else:
|
||||
return df
|
||||
|
||||
def attach_report_graphs(self, report_name=None, pdf_name="WIFI Capacity Test PDF Report"):
|
||||
relevant_path = "../reports/" + report_name + "/"
|
||||
entries = os.listdir("../reports/" + report_name + '/')
|
||||
pdf = False
|
||||
for i in entries:
|
||||
if ".pdf" in i:
|
||||
pdf = i
|
||||
if pdf:
|
||||
allure.attach.file(source=relevant_path + pdf,
|
||||
name=pdf_name)
|
||||
|
||||
included_extensions = ['png']
|
||||
file_names = [fn for fn in os.listdir(relevant_path)
|
||||
if any(fn.endswith(ext) for ext in included_extensions)]
|
||||
|
||||
a = [item for item in file_names if 'print' not in item]
|
||||
a = [item for item in a if 'logo' not in item]
|
||||
a = [item for item in a if 'Logo' not in item]
|
||||
a = [item for item in a if 'candela' not in item]
|
||||
|
||||
|
||||
a.sort()
|
||||
for i in a:
|
||||
allure.attach.file(source=relevant_path + i,
|
||||
name=i,
|
||||
attachment_type="image/png", extension=None)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user