X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Fgenerator_tables.py;h=132d85c1eae78168622a60a0108ab4b38d0f0a6f;hb=22c5e184d7f8bde86653333f522b3c3e1229ffd4;hp=021744dd3784709ad96a62a2ebf2c3708668c96e;hpb=953d1310d2df574888cef2bd282843d186640628;p=csit.git diff --git a/resources/tools/presentation/generator_tables.py b/resources/tools/presentation/generator_tables.py index 021744dd37..132d85c1ea 100644 --- a/resources/tools/presentation/generator_tables.py +++ b/resources/tools/presentation/generator_tables.py @@ -611,6 +611,8 @@ def _tpc_generate_html_table(header, data, out_file_name, legend=u"", f'src="../..{out_file_name.replace(u"_build", u"")}_in.html">' f'\n\n' ) + + # TODO: Use html (rst) list for legend and footnote if legend: rst_file.write(legend[1:].replace(u"\n", u" |br| ")) if footnote: @@ -667,8 +669,7 @@ def table_soak_vs_ndr(table, input_data): f"Percentage change calculated for mean values.\n" u"Stdev(Diff): " u"Standard deviation of percentage change calculated for mean " - u"values.\n" - u":END" + u"values." ) except (AttributeError, KeyError) as err: logging.error(f"The model is invalid, missing parameter: {repr(err)}") @@ -829,6 +830,8 @@ def table_perf_trending_dash(table, input_data): ] header_str = u",".join(header) + u"\n" + incl_tests = table.get(u"include-tests", u"MRR") + # Prepare data to the table: tbl_dict = dict() for job, builds in table[u"data"].items(): @@ -846,8 +849,15 @@ def table_perf_trending_dash(table, input_data): u"data": OrderedDict() } try: - tbl_dict[tst_name][u"data"][str(build)] = \ - tst_data[u"result"][u"receive-rate"] + if incl_tests == u"MRR": + tbl_dict[tst_name][u"data"][str(build)] = \ + tst_data[u"result"][u"receive-rate"] + elif incl_tests == u"NDR": + tbl_dict[tst_name][u"data"][str(build)] = \ + tst_data[u"throughput"][u"NDR"][u"LOWER"] + elif incl_tests == u"PDR": + tbl_dict[tst_name][u"data"][str(build)] = \ + tst_data[u"throughput"][u"PDR"][u"LOWER"] except (TypeError, KeyError): pass # No data in output.xml for this test @@ -857,7 +867,7 @@ def table_perf_trending_dash(table, input_data): if len(data_t) < 2: continue - classification_lst, avgs = classify_anomalies(data_t) + classification_lst, avgs, _ = classify_anomalies(data_t) win_size = min(len(data_t), table[u"window"]) long_win_size = min(len(data_t), table[u"long-trend-window"]) @@ -894,17 +904,18 @@ def table_perf_trending_dash(table, input_data): round(last_avg / 1e6, 2), rel_change_last, rel_change_long, - classification_lst[-win_size:].count(u"regression"), - classification_lst[-win_size:].count(u"progression")]) + classification_lst[-win_size+1:].count(u"regression"), + 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']}" @@ -997,11 +1008,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" @@ -1075,10 +1110,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: @@ -1138,13 +1188,14 @@ def table_perf_trending_dash_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 @@ -1242,6 +1293,10 @@ def table_failed_tests(table, input_data): ) data = input_data.filter_data(table, continue_on_error=True) + test_type = u"MRR" + if u"NDRPDR" in table.get(u"filter", list()): + test_type = u"NDRPDR" + # Prepare the header of the tables header = [ u"Test Case", @@ -1305,15 +1360,14 @@ def table_failed_tests(table, input_data): fails_last_csit = val[3] if fails_nr: max_fails = fails_nr if fails_nr > max_fails else max_fails - tbl_lst.append( - [ - tst_data[u"name"], - fails_nr, - fails_last_date, - fails_last_vpp, - f"mrr-daily-build-{fails_last_csit}" - ] - ) + tbl_lst.append([ + tst_data[u"name"], + fails_nr, + fails_last_date, + fails_last_vpp, + f"{u'mrr-daily' if test_type == u'MRR' else u'ndrpdr-weekly'}" + f"-build-{fails_last_csit}" + ]) tbl_lst.sort(key=lambda rel: rel[2], reverse=True) tbl_sorted = list() @@ -1347,10 +1401,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: @@ -1392,13 +1461,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 @@ -1739,8 +1809,6 @@ def table_comparison(table, input_data): with open(txt_file_name, u'a', encoding='utf-8') as txt_file: txt_file.write(legend) txt_file.write(footnote) - if legend or footnote: - txt_file.write(u"\n:END") # Generate html table: _tpc_generate_html_table( @@ -1790,10 +1858,10 @@ def table_weekly_comparison(table, in_data): ) header = [ - [u"Version"], - [u"Date", ], - [u"Build", ], - [u"Testbed", ] + [u"VPP Version", ], + [u"Start Timestamp", ], + [u"CSIT Build", ], + [u"CSIT Testbed", ] ] tbl_dict = dict() idx = 0 @@ -1843,10 +1911,13 @@ def table_weekly_comparison(table, in_data): idx_cmp = cmp.get(u"compare", None) if idx_ref is None or idx_cmp is None: continue - header[0].append(f"Diff{idx + 1}") - header[1].append(header[0][idx_ref - idx - 1]) - header[2].append(u"vs") - header[3].append(header[0][idx_cmp - idx - 1]) + header[0].append( + f"Diff({header[0][idx_ref - idx].split(u'~')[-1]} vs " + f"{header[0][idx_cmp - idx].split(u'~')[-1]})" + ) + header[1].append(u"") + header[2].append(u"") + header[3].append(u"") for tst_name, tst_data in tbl_dict.items(): if not cmp_dict.get(tst_name, None): cmp_dict[tst_name] = list()