Added dataplane_throughput_test method

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>
This commit is contained in:
jitendracandela
2022-09-02 12:04:54 +05:30
parent 1ac93e053c
commit 0d1fbf3786

View File

@@ -47,6 +47,8 @@ wificapacitytest = importlib.import_module("py-scripts.lf_wifi_capacity_test")
WiFiCapacityTest = wificapacitytest.WiFiCapacityTest WiFiCapacityTest = wificapacitytest.WiFiCapacityTest
csvtoinflux = importlib.import_module("py-scripts.csv_to_influx") csvtoinflux = importlib.import_module("py-scripts.csv_to_influx")
CSVtoInflux = csvtoinflux.CSVtoInflux CSVtoInflux = csvtoinflux.CSVtoInflux
lf_dataplane_test = importlib.import_module("py-scripts.lf_dataplane_test")
DataplaneTest = lf_dataplane_test.DataplaneTest
class lf_tests(lf_libs): class lf_tests(lf_libs):
@@ -297,9 +299,6 @@ class lf_tests(lf_libs):
def wifi_capacity_test(self): def wifi_capacity_test(self):
pass pass
def dataplane_throughput_test(self):
pass
def rate_vs_range_test(self): def rate_vs_range_test(self):
pass pass
@@ -337,7 +336,8 @@ class lf_tests(lf_libs):
station_data_all = {} station_data_all = {}
for radio in data[identifier]["station_data"]: for radio in data[identifier]["station_data"]:
client_connect = CreateStation(_host=self.manager_ip, _port=self.manager_http_port, client_connect = CreateStation(_host=self.manager_ip, _port=self.manager_http_port,
_sta_list=data[identifier]["station_data"][radio], _password=data[identifier]["passkey"], _sta_list=data[identifier]["station_data"][radio],
_password=data[identifier]["passkey"],
_ssid=data[identifier]["ssid"], _ssid=data[identifier]["ssid"],
_security=data[identifier]["encryption"]) _security=data[identifier]["encryption"])
client_connect.station_profile.sta_mode = sta_mode client_connect.station_profile.sta_mode = sta_mode
@@ -392,7 +392,8 @@ class lf_tests(lf_libs):
station_data = self.client_connect(ssid=ssid, security=security, passkey=passkey, mode=mode, station_data = self.client_connect(ssid=ssid, security=security, passkey=passkey, mode=mode,
band=band, num_sta=num_sta, vlan_id=vlan_id, band=band, num_sta=num_sta, vlan_id=vlan_id,
allure_name="Station data before simulate radar", identifier=identifier, allure_name="Station data before simulate radar", identifier=identifier,
station_data=["4way time (us)", "channel", "cx time (us)", "dhcp (ms)", "ip", "signal", "mode"]) station_data=["4way time (us)", "channel", "cx time (us)", "dhcp (ms)",
"ip", "signal", "mode"])
station_list = list(station_data.keys()) station_list = list(station_data.keys())
table_dict = {} table_dict = {}
sta_channel_before_dfs_list = [] sta_channel_before_dfs_list = []
@@ -414,7 +415,8 @@ class lf_tests(lf_libs):
else: else:
logging.error("Station not connected to applied channel") logging.error("Station not connected to applied channel")
pytest.fail("Station not connected to applied channel") pytest.fail("Station not connected to applied channel")
self.get_station_data(rows=["4way time (us)", "channel", "cx time (us)", "dhcp (ms)", "ip", "signal", "mode"], self.get_station_data(
rows=["4way time (us)", "channel", "cx time (us)", "dhcp (ms)", "ip", "signal", "mode"],
sta_name=station_list, allure_name="Station data after simulate radar") sta_name=station_list, allure_name="Station data after simulate radar")
for i in range(5): for i in range(5):
sta_channel_after_dfs = self.station_data_query(station_name=station_list[0], query="channel") sta_channel_after_dfs = self.station_data_query(station_name=station_list[0], query="channel")
@@ -446,12 +448,6 @@ class lf_tests(lf_libs):
logging.error("5 Ghz channel didn't changed after radar detected") logging.error("5 Ghz channel didn't changed after radar detected")
pytest.fail("5 Ghz channel didn't changed after radar detected") pytest.fail("5 Ghz channel didn't changed after radar detected")
def add_stations(self, band="2G", num_stations=9, ssid_name="", dut_data={}, identifier=None): def add_stations(self, band="2G", num_stations=9, ssid_name="", dut_data={}, identifier=None):
dut_name = [] dut_name = []
@@ -553,7 +549,6 @@ class lf_tests(lf_libs):
if band == dut_data[dut]["ssid_data"][idx_]["band"] and ssid_name == \ if band == dut_data[dut]["ssid_data"][idx_]["band"] and ssid_name == \
dut_data[dut]["ssid_data"][idx_]["ssid"]: dut_data[dut]["ssid_data"][idx_]["ssid"]:
idx = idx_ idx = idx_
print("*********idx***********", idx)
if band == "2G": if band == "2G":
stations = None stations = None
if num_stations != "max": if num_stations != "max":
@@ -720,7 +715,8 @@ class lf_tests(lf_libs):
if move_to_influx: if move_to_influx:
try: try:
report_name = "../reports/" + \ report_name = "../reports/" + \
wificapacity_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] + "/" wificapacity_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[
-1] + "/"
influx = CSVtoInflux(influx_host=self.influx_params["influx_host"], influx = CSVtoInflux(influx_host=self.influx_params["influx_host"],
influx_port=self.influx_params["influx_port"], influx_port=self.influx_params["influx_port"],
influx_org=self.influx_params["influx_org"], influx_org=self.influx_params["influx_org"],
@@ -739,182 +735,96 @@ class lf_tests(lf_libs):
wificapacity_obj_list.append(wificapacity_obj) wificapacity_obj_list.append(wificapacity_obj)
return wificapacity_obj_list return wificapacity_obj_list
# for dut in dut_name: def dataplane_throughput_test(self, ssid="[BLANK]", passkey="[BLANK]", security="wpa2", num_sta=1, mode="BRIDGE",
# logging.info("Adding Stations:" + band + " band, Number of Stations: " + str(num_stations) + vlan_id=[None],
# " DUT: " + str(dut) + " SSID: " + str(ssid_name) + " idx: " + str(idx)) download_rate="85%", band="twog", scan_ssid=True, sta_mode=0,
# idx = idx upload_rate="0", duration="15s", instance_name="test_demo", raw_lines=None,
# if self.run_lf or self.cc_1: influx_tags="",
# if band == "2G": move_to_influx=False,
# idx = 0 station_data=["4way time (us)", "channel", "cx time (us)", "dhcp (ms)", "ip",
# if band == "5G": "signal"],
# idx = 1 allure_attach=True, allure_name="station data"):
# if band == "6g": instance_name = ''.join(random.choices(string.ascii_uppercase + string.digits, k=12))
# idx = 2 dataplane_obj_list = []
# for dut in self.dut_data:
# for i in self.dut_idx_mapping: identifier = dut["identifier"]
# if self.dut_idx_mapping[i][0] == ssid_name and self.dut_idx_mapping[i][3] == band: station_data = self.client_connect(ssid=ssid, passkey=passkey, security=security, mode=mode, band=band,
# idx = i vlan_id=vlan_id, num_sta=num_sta, scan_ssid=scan_ssid, sta_mode=sta_mode,
# if band == "2G": station_data=station_data,
# all_radio_2g = self.wave2_2g_radios + self.wave1_radios + self.mtk_radios + self.ax200_radios + \ allure_attach=allure_attach, identifier=identifier,
# self.ax210_radios allure_name=allure_name)
# print("all_2g_rdio", all_radio_2g)
# if num_stations != "max": if mode == "BRIDGE":
# logging.info("Total 2G Radios Available in Testbed: " + str(len(all_radio_2g))) ret = self.get_wan_upstream_ports()
# total_sta = num_stations upstream_port = ret[identifier]
# max_possible = 0
# for radio in all_radio_2g: if mode == "NAT-WAN":
# max_possible = max_possible + int(self.get_max_sta(radio)) ret = self.get_wan_upstream_ports()
# if total_sta <= max_possible: upstream_port = ret[identifier]
# per_radio_sta = int(total_sta / len(all_radio_2g))
# rem = total_sta % len(all_radio_2g) if mode == "NAT-LAN":
# else: ret = self.get_lan_upstream_ports()
# total_sta = max_possible upstream_port = ret[identifier]
# per_radio_sta = int(total_sta / len(all_radio_2g)) if mode == "VLAN":
# rem = total_sta % len(all_radio_2g) if vlan_id is None:
# if rem != 0 and per_radio_sta == 0: logging.error("VLAN ID is Unspecified in the VLAN Case")
# per_radio_sta = rem / len(all_radio_2g) pytest.skip("VLAN ID is Unspecified in the VLAN Case")
# logging.info("Total stations per radio: " + str(per_radio_sta)) else:
# for radio in all_radio_2g: self.add_vlan(vlan_ids=[vlan_id])
# max_possible = int(self.get_max_sta(radio)) ret = self.get_wan_upstream_ports()
# if total_sta == 0: upstream_port = ret[identifier] + "." + str(vlan_id)
# return logging.info("Upstream data: " + str(upstream_port))
# num_stations = per_radio_sta
# if rem == 0 and num_stations == 0: if raw_lines is None:
# return raw_lines = [['pkts: 142;256;512;1024;MTU;4000'], ['directions: DUT Transmit;DUT Receive'],
# if max_possible - num_stations >= rem: ['traffic_types: UDP;TCP'],
# num_stations = num_stations + rem ["show_3s: 1"], ["show_ll_graphs: 1"], ["show_log: 1"]]
# rem = 0
# elif max_possible - rem >= num_stations: print("STATION NAME: ", list(station_data.keys())[0])
# num_stations = num_stations + rem
# rem = 0 dataplane_obj = DataplaneTest(lf_host=self.manager_ip,
# elif total_sta <= max_possible: lf_port=self.manager_http_port,
# num_stations = total_sta ssh_port=self.manager_ssh_port,
# if per_radio_sta < 1: local_lf_report_dir=self.local_report_path,
# num_stations = 1 lf_user="lanforge",
# total_sta = total_sta - num_stations lf_password="lanforge",
# logging.info("Adding " + str(num_stations) + " Stations on " + str(radio)) instance_name=instance_name,
# station_data = ["profile_link " + radio.split(".")[0] + "." + radio.split(".")[1] + config_name="dpt_config",
# " STA-AUTO " + str(num_stations) + " 'DUT: " + dut + " Radio-" + upstream=upstream_port,
# str(int(idx) + 1) + "'" + " NA " + radio.split(".")[2]] pull_report=True,
# self.temp_raw_lines.append(station_data) load_old_cfg=False,
# logging.debug("Raw Line : " + str(station_data)) download_speed=download_rate,
# upload_speed=upload_rate,
# if num_stations == "max": duration=duration,
# logging.info("Total 2G Radios Available in Testbed: " + str(len(all_radio_2g))) dut=identifier,
# for radio in all_radio_2g: station=list(station_data.keys())[0],
# num_stations = self.get_max_sta(radio) test_tag=influx_tags,
# logging.info("Total stations: " + str(num_stations) + " On Radio: " + str(radio)) raw_lines=raw_lines)
# station_data = ["profile_link " + radio.split(".")[0] + "." + radio.split(".")[1] +
# " STA-AUTO " + str(num_stations) + " 'DUT: " + dut + " Radio-" + dataplane_obj.setup()
# str(int(idx) + 1) + "'" + " NA " + radio.split(".")[2]] dataplane_obj.run()
# self.temp_raw_lines.append(station_data) if move_to_influx:
# logging.debug("Raw Line : " + str(station_data)) report_name = "../reports/" + \
# dataplane_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] + "/"
# if band == "5G": try:
# all_radio_5g = self.wave2_5g_radios + self.wave1_radios + self.mtk_radios + self.ax200_radios + self.ax210_radios influx = CSVtoInflux(influx_host=self.influx_params["influx_host"],
# if num_stations != "max": influx_port=self.influx_params["influx_port"],
# logging.info("Total 5G Radios Available in Testbed: " + str(len(all_radio_5g))) influx_org=self.influx_params["influx_org"],
# total_sta = num_stations influx_token=self.influx_params["influx_token"],
# max_possible = 0 influx_bucket=self.influx_params["influx_bucket"],
# for radio in all_radio_5g: path=report_name)
# max_possible = max_possible + int(self.get_max_sta(radio))
# if total_sta <= max_possible: influx.glob()
# per_radio_sta = int(total_sta / len(all_radio_5g)) except Exception as e:
# rem = total_sta % len(all_radio_5g) print(e)
# else: pass
# total_sta = max_possible report_name = dataplane_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] + "/"
# per_radio_sta = int(total_sta / len(all_radio_5g)) self.attach_report_graphs(report_name=report_name, pdf_name="Dataplane Throughput Test - TCP-UDP 5G")
# rem = total_sta % len(all_radio_5g) self.attach_report_kpi(report_name=report_name)
# if rem != 0 and per_radio_sta == 0: logging.info("Test Completed... Cleaning up Stations")
# per_radio_sta = rem / len(all_radio_5g) self.client_disconnect(station_name=list(station_data.keys()))
# logging.info("Total stations per radio: " + str(per_radio_sta)) dataplane_obj_list.append(dataplane_obj)
# for radio in all_radio_5g: return dataplane_obj_list
# max_possible = int(self.get_max_sta(radio))
# if total_sta == 0:
# return
# num_stations = per_radio_sta
# if rem == 0 and num_stations == 0:
# return
# if max_possible - num_stations >= rem:
# num_stations = num_stations + rem
# rem = 0
# elif max_possible - rem >= num_stations:
# num_stations = num_stations + rem
# rem = 0
# elif total_sta <= max_possible:
# num_stations = total_sta
# if per_radio_sta < 1:
# num_stations = 1
# total_sta = total_sta - num_stations
# logging.info("Adding " + str(num_stations) + " Stations on " + str(radio))
# station_data = ["profile_link " + radio.split(".")[0] + "." + radio.split(".")[1] +
# " STA-AUTO " + str(num_stations) + " 'DUT: " + dut + " Radio-" +
# str(int(idx) + 1) + "'" + " NA " + radio.split(".")[2]]
# self.temp_raw_lines.append(station_data)
# logging.debug("Raw Line : " + str(station_data))
#
# if num_stations == "max":
# logging.info("Total 5G Radios Available in Testbed: " + str(len(all_radio_5g)))
# for radio in all_radio_5g:
# num_stations = self.get_max_sta(radio)
# logging.info("Total stations: " + str(num_stations) + " On Radio: " + str(radio))
# station_data = ["profile_link " + radio.split(".")[0] + "." + radio.split(".")[1] +
# " STA-AUTO " + str(num_stations) + " 'DUT: " + dut + " Radio-" +
# str(int(idx) + 1) + "'" + " NA " + radio.split(".")[2]]
# self.temp_raw_lines.append(station_data)
# logging.debug("Raw Line : " + str(station_data))
# if band == "6g":
# all_radio_6g = self.ax210_radios
# if num_stations != "max":
# logging.info("Total 6G Radios Available in Testbed: " + str(len(all_radio_6g)))
# total_sta = num_stations
# max_possible = 0
# for radio in all_radio_6g:
# max_possible = max_possible + int(self.get_max_sta(radio))
# if total_sta <= max_possible:
# per_radio_sta = int(total_sta / len(all_radio_6g))
# rem = total_sta % len(all_radio_6g)
# else:
# total_sta = max_possible
# per_radio_sta = int(total_sta / len(all_radio_6g))
# rem = total_sta % len(all_radio_6g)
# if rem != 0 and per_radio_sta == 0:
# per_radio_sta = rem / len(all_radio_6g)
# logging.info("Total stations per radio: " + str(per_radio_sta))
# for radio in all_radio_6g:
# max_possible = int(self.get_max_sta(radio))
# if total_sta == 0:
# return
# num_stations = per_radio_sta
# if rem == 0 and num_stations == 0:
# return
# if max_possible - num_stations >= rem:
# num_stations = num_stations + rem
# rem = 0
# elif max_possible - rem >= num_stations:
# num_stations = num_stations + rem
# rem = 0
# elif total_sta <= max_possible:
# num_stations = total_sta
# if per_radio_sta < 1:
# num_stations = 1
# total_sta = total_sta - num_stations
# logging.info("Adding " + str(num_stations) + " Stations on " + str(radio))
# station_data = ["profile_link " + radio.split(".")[0] + "." + radio.split(".")[1] +
# " STA-AUTO " + str(num_stations) + " 'DUT: " + dut + " Radio-" +
# str(int(idx) + 1) + "'" + " NA " + radio.split(".")[2]]
# self.temp_raw_lines.append(station_data)
# logging.debug("Raw Line : " + str(station_data))
# if num_stations == "max":
# logging.info("Total AX Radios Available in Testbed: " + str(len(all_radio_6g)))
# for radio in all_radio_6g:
# num_stations = self.get_max_sta(radio)
# logging.info("Total stations: " + str(num_stations) + " On Radio: " + str(radio))
# station_data = ["profile_link " + radio.split(".")[0] + "." + radio.split(".")[1] +
# " STA-AUTO " + str(num_stations) + " 'DUT: " + dut + " Radio-" +
# str(int(idx) + 1) + "'" + " NA " + radio.split(".")[2]]
# self.temp_raw_lines.append(station_data)
# logging.debug("Raw Line : " + str(station_data))
if __name__ == '__main__': if __name__ == '__main__':