lf_webpage.py: updated for generating kpi.csv, single band 5G and 2.4G works, graphing temporarily disabled(WIP)

This commit is contained in:
Logan Lipke
2021-12-09 12:48:33 -08:00
parent bfccba0f76
commit a68ebc8e9f

View File

@@ -26,6 +26,7 @@ Realm = realm.Realm
PortUtils = realm.PortUtils
lf_report = importlib.import_module("py-scripts.lf_report")
lf_graph = importlib.import_module("py-scripts.lf_graph")
lf_kpi_csv = importlib.import_module("py-scripts.lf_kpi_csv")
class HttpDownload(Realm):
@@ -473,59 +474,65 @@ class HttpDownload(Realm):
return graph_png
def generate_report(self, date, num_stations, duration, test_setup_info, dataset, lis, bands, threshold_2g,
threshold_5g, threshold_both, dataset2, summary_table_value, result_data, test_input_infor):
threshold_5g, threshold_both, dataset2, summary_table_value, result_data, test_rig,
test_tag, dut_hw_version, dut_sw_version, dut_model_num, dut_serial_num, test_id,
test_input_infor, csv_outfile):
report = lf_report.lf_report(_results_dir_name="webpage_test", _output_html="Webpage.html", _output_pdf="Webpage.pdf")
report.set_title("WEBPAGE DOWNLOAD TEST")
report.set_date(date)
report.build_banner()
report.set_table_title("Test Setup Information")
report.build_table_title()
report.test_setup_table(value="Device under test", test_setup_data=test_setup_info)
report.set_obj_html("Objective",
"The Webpage Download Test is designed to test the performance of the Access Point.The goal is to check whether the webpage loading time of all the " + str(
num_stations) + " clients which are downloading at the same time meets the expectation when clients connected on single radio as well as dual radio")
report.build_objective()
report.set_obj_html("Download Time Graph",
"The below graph provides information about the download time taken by each client to download webpage for test duration of " + str(
duration) + " min")
report.build_objective()
graph = self.generate_graph(dataset=dataset, lis=lis, bands=bands)
report.set_graph_image(graph)
report.set_csv_filename(graph)
report.move_csv_file()
report.move_graph_image()
report.build_graph()
report.set_obj_html("Download Rate Graph",
"The below graph provides information about the download rate in Mbps of each client to download the webpage for test duration of " + str(
duration) + " min")
report.build_objective()
graph2 = self.graph_2(dataset2, lis=lis, bands=bands)
print("graph name {}".format(graph2))
report.set_graph_image(graph2)
report.set_csv_filename(graph2)
report.move_csv_file()
report.move_graph_image()
report.build_graph()
report.set_obj_html("Summary Table Description",
"This Table shows you the summary result of Webpage Download Test as PASS or FAIL criteria. If the average time taken by " + str(
num_stations) + " clients to access the webpage is less than " + str(
threshold_2g) + "s it's a PASS criteria for 2.4 ghz clients, If the average time taken by " + "" + str(
num_stations) + " clients to access the webpage is less than " + str(
threshold_5g) + "s it's a PASS criteria for 5 ghz clients and If the average time taken by " + str(
num_stations) + " clients to access the webpage is less than " + str(
threshold_both) + "s it's a PASS criteria for 2.4 ghz and 5ghz clients")
report.build_objective()
test_setup1 = pd.DataFrame(summary_table_value)
report.set_table_dataframe(test_setup1)
report.build_table()
report.set_obj_html("Download Time Table Description",
"This Table will provide you information of the minimum, maximum and the average time taken by clients to download a webpage in seconds")
report.build_objective()
# Section commented because graphing breaks two band report generation
# TODO: Fix graphing bug with multiple bands being recorded
#
# report.set_title("WEBPAGE DOWNLOAD TEST")
# report.set_date(date)
# report.build_banner()
# report.set_table_title("Test Setup Information")
# report.build_table_title()
#
# report.test_setup_table(value="Device under test", test_setup_data=test_setup_info)
#
# report.set_obj_html("Objective",
# "The Webpage Download Test is designed to test the performance of the Access Point.The goal is to check whether the webpage loading time of all the " + str(
# num_stations) + " clients which are downloading at the same time meets the expectation when clients connected on single radio as well as dual radio")
# report.build_objective()
# report.set_obj_html("Download Time Graph",
# "The below graph provides information about the download time taken by each client to download webpage for test duration of " + str(
# duration) + " min")
# report.build_objective()
# graph = self.generate_graph(dataset=dataset, lis=lis, bands=bands)
# report.set_graph_image(graph)
# report.set_csv_filename(graph)
# report.move_csv_file()
# report.move_graph_image()
# report.build_graph()
# report.set_obj_html("Download Rate Graph",
# "The below graph provides information about the download rate in Mbps of each client to download the webpage for test duration of " + str(
# duration) + " min")
# report.build_objective()
# graph2 = self.graph_2(dataset2, lis=lis, bands=bands)
# print("graph name {}".format(graph2))
# report.set_graph_image(graph2)
# report.set_csv_filename(graph2)
# report.move_csv_file()
# report.move_graph_image()
# report.build_graph()
# report.set_obj_html("Summary Table Description",
# "This Table shows you the summary result of Webpage Download Test as PASS or FAIL criteria. If the average time taken by " + str(
# num_stations) + " clients to access the webpage is less than " + str(
# threshold_2g) + "s it's a PASS criteria for 2.4 ghz clients, If the average time taken by " + "" + str(
# num_stations) + " clients to access the webpage is less than " + str(
# threshold_5g) + "s it's a PASS criteria for 5 ghz clients and If the average time taken by " + str(
# num_stations) + " clients to access the webpage is less than " + str(
# threshold_both) + "s it's a PASS criteria for 2.4 ghz and 5ghz clients")
#
# report.build_objective()
# test_setup1 = pd.DataFrame(summary_table_value)
# report.set_table_dataframe(test_setup1)
# report.build_table()
#
# report.set_obj_html("Download Time Table Description",
# "This Table will provide you information of the minimum, maximum and the average time taken by clients to download a webpage in seconds")
#
# report.build_objective()
x = []
for fcc in list(result_data.keys()):
fcc_type = result_data[fcc]["min"]
@@ -577,12 +584,52 @@ class HttpDownload(Realm):
z2.append(i)
download_table_value = {
"": bands,
"Band": bands,
"Minimum": z,
"Maximum": z1,
"Average": z2
}
# Get the report path to create the kpi.csv path
kpi_path = report.get_report_path()
print("kpi_path :{kpi_path}".format(kpi_path=kpi_path))
kpi_csv = lf_kpi_csv.lf_kpi_csv(
_kpi_path=kpi_path,
_kpi_test_rig=test_rig,
_kpi_test_tag=test_tag,
_kpi_dut_hw_version=dut_hw_version,
_kpi_dut_sw_version=dut_sw_version,
_kpi_dut_model_num=dut_model_num,
_kpi_dut_serial_num=dut_serial_num,
_kpi_test_id=test_id)
kpi_csv.kpi_dict['Units'] = "Mbps"
for band in range(len(download_table_value["Band"])):
kpi_csv.kpi_csv_get_dict_update_time()
kpi_csv.kpi_dict['Graph-Group'] = "Webpage Download {band}".format(
band=download_table_value['Band'][band])
kpi_csv.kpi_dict['short-description'] = "Webpage download {band} Minimum".format(
band=download_table_value['Band'][band])
kpi_csv.kpi_dict['numeric-score'] = "{min}".format(min=download_table_value['Minimum'][band])
kpi_csv.kpi_csv_write_dict(kpi_csv.kpi_dict)
kpi_csv.kpi_dict['short-description'] = "Webpage download {band} Maximum".format(
band=download_table_value['Band'][band])
kpi_csv.kpi_dict['numeric-score'] = "{max}".format(max=download_table_value['Maximum'][band])
kpi_csv.kpi_csv_write_dict(kpi_csv.kpi_dict)
kpi_csv.kpi_dict['short-description'] = "Webpage download {band} Average".format(
band=download_table_value['Band'][band])
kpi_csv.kpi_dict['numeric-score'] = "{avg}".format(avg=download_table_value['Average'][band])
kpi_csv.kpi_csv_write_dict(kpi_csv.kpi_dict)
if csv_outfile is not None:
current_time = time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime())
csv_outfile = "{}_{}-test_l3_longevity.csv".format(
csv_outfile, current_time)
csv_outfile = report.file_add_path(csv_outfile)
print("csv output file : {}".format(csv_outfile))
exit()
test_setup = pd.DataFrame(download_table_value)
report.set_table_dataframe(test_setup)
report.build_table()
@@ -612,13 +659,29 @@ def main():
parser.add_argument('--passwd', help='WiFi passphrase/password/key')
parser.add_argument('--target_per_ten', help='number of request per 10 minutes', default=100)
parser.add_argument('--file_size', type=str, help='specify the size of file you want to download', default='5MB')
parser.add_argument('--bands', nargs="+", help='specify which band testing you want to run eg 5G OR 2.4G OR Both', default=["5G", "2.4G", "Both"])
parser.add_argument('--bands', nargs="+", help='specify which band testing you want to run eg 5G OR 2.4G OR Both',
default=["5G", "2.4G", "Both"])
parser.add_argument('--duration', type=int, help='time to run traffic')
parser.add_argument('--threshold_5g', help="Enter the threshold value for 5G Pass/Fail criteria", default="60")
parser.add_argument('--threshold_2g', help="Enter the threshold value for 2.4G Pass/Fail criteria", default="90")
parser.add_argument('--threshold_both', help="Enter the threshold value for Both Pass/Fail criteria", default="50")
parser.add_argument('--ap_name', help="specify the ap model ", default="TestAP")
parser.add_argument('--ssh_port', type=int, help="specify the ssh port eg 22", default=22)
parser.add_argument("--test_rig", default="", help="test rig for kpi.csv, testbed that the tests are run on")
parser.add_argument("--test_tag", default="",
help="test tag for kpi.csv, test specific information to differentiate the test")
parser.add_argument("--dut_hw_version", default="",
help="dut hw version for kpi.csv, hardware version of the device under test")
parser.add_argument("--dut_sw_version", default="",
help="dut sw version for kpi.csv, software version of the device under test")
parser.add_argument("--dut_model_num", default="",
help="dut model for kpi.csv, model number / name of the device under test")
parser.add_argument("--dut_serial_num", default="",
help="dut serial for kpi.csv, serial number / serial number of the device under test")
parser.add_argument("--test_priority", default="", help="dut model for kpi.csv, test-priority is arbitrary number")
parser.add_argument("--test_id", default="lf_webpage", help="test-id for kpi.csv, script or test name")
parser.add_argument('--csv_outfile', help="--csv_outfile <Output file for csv data>", default="")
args = parser.parse_args()
test_time = datetime.now()
@@ -783,7 +846,12 @@ def main():
duration=args.duration, test_setup_info=test_setup_info, dataset=dataset, lis=lis,
bands=args.bands, threshold_2g=args.threshold_2g, threshold_5g=args.threshold_5g,
threshold_both=args.threshold_both, dataset2=dataset2,
summary_table_value=summary_table_value, result_data=result_data, test_input_infor=test_input_infor)
summary_table_value=summary_table_value, result_data=result_data,
test_rig=args.test_rig, test_tag=args.test_tag, dut_hw_version=args.dut_hw_version,
dut_sw_version=args.dut_sw_version, dut_model_num=args.dut_model_num,
dut_serial_num=args.dut_serial_num, test_id=args.test_id,
test_input_infor=test_input_infor, csv_outfile=args.csv_outfile)
if __name__ == '__main__':