X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Fgenerator_tables.py;h=fbac776202060e71d4a3c869e3324aeedbbc6446;hb=cab556a47fee3858bd3ef9fc33eb84a563f0e82d;hp=2644eb03482492a91761f8b6ad2c3459a64f4b3a;hpb=e244fff23cc6d0ff85ab50632316b7bf9db2ea62;p=csit.git diff --git a/resources/tools/presentation/generator_tables.py b/resources/tools/presentation/generator_tables.py index 2644eb0348..fbac776202 100644 --- a/resources/tools/presentation/generator_tables.py +++ b/resources/tools/presentation/generator_tables.py @@ -908,13 +908,14 @@ def table_perf_trending_dash(table, input_data): classification_lst[-win_size+1:].count(u"progression")]) tbl_lst.sort(key=lambda rel: rel[0]) + tbl_lst.sort(key=lambda rel: rel[3]) + tbl_lst.sort(key=lambda rel: rel[2]) tbl_sorted = list() for nrr in range(table[u"window"], -1, -1): tbl_reg = [item for item in tbl_lst if item[4] == nrr] for nrp in range(table[u"window"], -1, -1): tbl_out = [item for item in tbl_reg if item[5] == nrp] - tbl_out.sort(key=lambda rel: rel[2]) tbl_sorted.extend(tbl_out) file_name = f"{table[u'output-file']}{table[u'output-file-ext']}" @@ -1015,11 +1016,35 @@ def _generate_url(testbed, test_name): else: driver = u"dpdk" - if u"acl" in test_name or \ - u"macip" in test_name or \ - u"nat" in test_name or \ - u"policer" in test_name or \ - u"cop" in test_name: + if u"macip-iacl1s" in test_name: + bsf = u"features-macip-iacl1" + elif u"macip-iacl10s" in test_name: + bsf = u"features-macip-iacl01" + elif u"macip-iacl50s" in test_name: + bsf = u"features-macip-iacl50" + elif u"iacl1s" in test_name: + bsf = u"features-iacl1" + elif u"iacl10s" in test_name: + bsf = u"features-iacl10" + elif u"iacl50s" in test_name: + bsf = u"features-iacl50" + elif u"oacl1s" in test_name: + bsf = u"features-oacl1" + elif u"oacl10s" in test_name: + bsf = u"features-oacl10" + elif u"oacl50s" in test_name: + bsf = u"features-oacl50" + elif u"udpsrcscale" in test_name: + bsf = u"features-udp" + elif u"iacl" in test_name: + bsf = u"features" + elif u"policer" in test_name: + bsf = u"features" + elif u"cop" in test_name: + bsf = u"features" + elif u"nat" in test_name: + bsf = u"features" + elif u"macip" in test_name: bsf = u"features" elif u"scale" in test_name: bsf = u"scale" @@ -1093,10 +1118,25 @@ def table_perf_trending_dash_html(table, input_data): if not table.get(u"testbed", None): logging.error( f"The testbed is not defined for the table " - f"{table.get(u'title', u'')}." + f"{table.get(u'title', u'')}. Skipping." ) return + test_type = table.get(u"test-type", u"MRR") + if test_type not in (u"MRR", u"NDR", u"PDR"): + logging.error( + f"Test type {table.get(u'test-type', u'MRR')} is not defined. " + f"Skipping." + ) + return + + if test_type in (u"NDR", u"PDR"): + lnk_dir = u"../ndrpdr_trending/" + lnk_sufix = f"-{test_type.lower()}" + else: + lnk_dir = u"../trending/" + lnk_sufix = u"" + logging.info(f" Generating the table {table.get(u'title', u'')} ...") try: @@ -1161,8 +1201,9 @@ def table_perf_trending_dash_html(table, input_data): tdata, u"a", attrib=dict( - href=f"../trending/" + href=f"{lnk_dir}" f"{_generate_url(table.get(u'testbed', ''), item)}" + f"{lnk_sufix}" ) ) ref.text = item @@ -1368,10 +1409,25 @@ def table_failed_tests_html(table, input_data): if not table.get(u"testbed", None): logging.error( f"The testbed is not defined for the table " - f"{table.get(u'title', u'')}." + f"{table.get(u'title', u'')}. Skipping." + ) + return + + test_type = table.get(u"test-type", u"MRR") + if test_type not in (u"MRR", u"NDR", u"PDR", u"NDRPDR"): + logging.error( + f"Test type {table.get(u'test-type', u'MRR')} is not defined. " + f"Skipping." ) return + if test_type in (u"NDRPDR", u"NDR", u"PDR"): + lnk_dir = u"../ndrpdr_trending/" + lnk_sufix = u"-pdr" + else: + lnk_dir = u"../trending/" + lnk_sufix = u"" + logging.info(f" Generating the table {table.get(u'title', u'')} ...") try: @@ -1413,13 +1469,14 @@ def table_failed_tests_html(table, input_data): attrib=dict(align=u"left" if c_idx == 0 else u"center") ) # Name: - if c_idx == 0: + if c_idx == 0 and table.get(u"add-links", True): ref = ET.SubElement( tdata, u"a", attrib=dict( - href=f"../trending/" + href=f"{lnk_dir}" f"{_generate_url(table.get(u'testbed', ''), item)}" + f"{lnk_sufix}" ) ) ref.text = item @@ -1647,7 +1704,9 @@ def table_comparison(table, input_data): for line in tbl_cmp_lst: row = [line[0], ] for idx, itm in enumerate(line[1:]): - if itm is None: + if itm is None or not isinstance(itm, dict) or\ + itm.get(u'mean', None) is None or \ + itm.get(u'stdev', None) is None: row.append(u"NT") row.append(u"NT") else: @@ -1875,12 +1934,13 @@ def table_weekly_comparison(table, in_data): ref_data = tst_data.get(idx_ref, None) cmp_data = tst_data.get(idx_cmp, None) if ref_data is None or cmp_data is None: - cmp_dict[tst_name].append(float('nan')) + cmp_dict[tst_name].append(float(u'nan')) else: cmp_dict[tst_name].append( relative_change(ref_data, cmp_data) ) + tbl_lst_none = list() tbl_lst = list() for tst_name, tst_data in tbl_dict.items(): itm_lst = [tst_data[u"name"], ] @@ -1896,13 +1956,19 @@ def table_weekly_comparison(table, in_data): for itm in cmp_dict[tst_name] ] ) - tbl_lst.append(itm_lst) + if str(itm_lst[-1]) == u"nan" or itm_lst[-1] is None: + tbl_lst_none.append(itm_lst) + else: + tbl_lst.append(itm_lst) + tbl_lst_none.sort(key=lambda rel: rel[0], reverse=False) tbl_lst.sort(key=lambda rel: rel[0], reverse=False) - tbl_lst.sort(key=lambda rel: rel[-1], reverse=True) + tbl_lst.sort(key=lambda rel: rel[-1], reverse=False) + tbl_lst.extend(tbl_lst_none) # Generate csv table: csv_file = f"{table[u'output-file']}.csv" + logging.info(f" Writing the file {csv_file}") with open(csv_file, u"wt", encoding='utf-8') as file_handler: for hdr in header: file_handler.write(u",".join(hdr) + u"\n") @@ -1915,6 +1981,7 @@ def table_weekly_comparison(table, in_data): ) + u"\n") txt_file = f"{table[u'output-file']}.txt" + logging.info(f" Writing the file {txt_file}") convert_csv_to_pretty_txt(csv_file, txt_file, delimiter=u",") # Reorganize header in txt table