From 2fe4ec44ed8e442a31bc46ccf7ef4b4e82b0e28d Mon Sep 17 00:00:00 2001 From: Tibor Frank Date: Mon, 18 May 2020 08:16:52 +0200 Subject: Trending: CSIT-1717: Add links from dashboard to graphs + fix TB names in alerts Change-Id: Ia10e9b82b57e90f7ae4592bd6ecf8b71dea71cc8 Signed-off-by: Tibor Frank (cherry picked from commit dd36153562829ad84022cf5aa7746862c8f09156) --- resources/tools/presentation/generator_alerts.py | 29 ++++++--- resources/tools/presentation/generator_tables.py | 76 +++++++++++++++++++--- .../tools/presentation/specification_CPTA.yaml | 58 ++++++++++------- 3 files changed, 121 insertions(+), 42 deletions(-) (limited to 'resources') diff --git a/resources/tools/presentation/generator_alerts.py b/resources/tools/presentation/generator_alerts.py index b0606b6fd7..8e4f31e4cf 100644 --- a/resources/tools/presentation/generator_alerts.py +++ b/resources/tools/presentation/generator_alerts.py @@ -20,6 +20,7 @@ import smtplib import logging +import re from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart @@ -346,7 +347,18 @@ class Alerting: ) text = u"" - for idx, test_set in enumerate(alert.get(u"include", [])): + for idx, test_set in enumerate(alert.get(u"include", list())): + try: + test_set_short = re.search( + re.compile(r'(\dn-(skx|clx|hsw|tsh|dnv)-.*)'), + test_set + ).group(1) + except (AttributeError, IndexError): + logging.error( + f"The test set {test_set} does not include information " + f"about test bed. Using empty string instead." + ) + test_set_short = u"" build, version, passed, failed, failed_tests = \ self._get_compressed_failed_tests(alert, test_set) if build is None: @@ -356,16 +368,15 @@ class Alerting: if ret_code != 0: build_nr = u'' text += ( - f"\n\nNo input data available for " - f"{u'-'.join(test_set.split('-')[-2:])}. See CSIT build " - f"{alert[u'urls'][idx]}/{build_nr} for more information.\n" + f"\n\nNo input data available for {test_set_short}. " + f"See CSIT build {alert[u'urls'][idx]}/{build_nr} for more " + f"information.\n" ) continue text += ( - f"\n\n{test_set.split('-')[-2]}-{test_set.split('-')[-1]}, " - f"{failed} tests failed, " - f"{passed} tests passed, CSIT build: " - f"{alert[u'urls'][idx]}/{build}, VPP version: {version}\n\n" + f"\n\n{test_set_short}, {failed} tests failed, {passed} tests " + f"passed, CSIT build: {alert[u'urls'][idx]}/{build}, " + f"VPP version: {version}\n\n" ) class MaxLens(): @@ -414,7 +425,7 @@ class Alerting: ) gression_hdr = ( - f"\n\n{test_set.split(u'-')[-2]}-{test_set.split(u'-')[-1]}, " + f"\n\n{test_set_short}, " f"CSIT build: {alert[u'urls'][idx]}/{build}, " f"VPP version: {version}\n\n" ) diff --git a/resources/tools/presentation/generator_tables.py b/resources/tools/presentation/generator_tables.py index 739d0b7806..d36f9a9245 100644 --- a/resources/tools/presentation/generator_tables.py +++ b/resources/tools/presentation/generator_tables.py @@ -1007,11 +1007,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" @@ -1085,10 +1109,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: @@ -1153,8 +1192,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 @@ -1360,10 +1400,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: @@ -1405,13 +1460,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 diff --git a/resources/tools/presentation/specification_CPTA.yaml b/resources/tools/presentation/specification_CPTA.yaml index d28bcb73a9..fa41ab45f0 100644 --- a/resources/tools/presentation/specification_CPTA.yaml +++ b/resources/tools/presentation/specification_CPTA.yaml @@ -126,13 +126,13 @@ type: "failed-tests" way: "jenkins" include: - - "last-failed-tests-2n-skx" - - "last-failed-tests-3n-skx" - - "last-failed-tests-2n-clx" - - "last-failed-tests-3n-hsw" - - "last-failed-tests-3n-tsh" - - "last-failed-tests-2n-dnv" - - "last-failed-tests-3n-dnv" + - "last-failed-tests-2n-skx-mrr" + - "last-failed-tests-3n-skx-mrr" + - "last-failed-tests-2n-clx-mrr" + - "last-failed-tests-3n-hsw-mrr" + - "last-failed-tests-3n-tsh-mrr" + - "last-failed-tests-2n-dnv-mrr" + - "last-failed-tests-3n-dnv-mrr" - "last-failed-tests-2n-skx-ndrpdr" - "last-failed-tests-3n-skx-ndrpdr" - "last-failed-tests-2n-clx-ndrpdr" @@ -765,7 +765,7 @@ title: "Last failed tests (last builds) 3n-hsw" algorithm: "table_last_failed_tests" output-file-ext: ".txt" - output-file: "{DIR[STATIC,VPP]}/last-failed-tests-3n-hsw" + output-file: "{DIR[STATIC,VPP]}/last-failed-tests-3n-hsw-mrr" data: "table-last-failed-tests-3n-hsw" filter: "'MRR'" parameters: @@ -778,7 +778,7 @@ title: "Last failed tests (last builds) 3n-skx" algorithm: "table_last_failed_tests" output-file-ext: ".txt" - output-file: "{DIR[STATIC,VPP]}/last-failed-tests-3n-skx" + output-file: "{DIR[STATIC,VPP]}/last-failed-tests-3n-skx-mrr" data: "table-last-failed-tests-3n-skx" filter: "'MRR'" parameters: @@ -791,7 +791,7 @@ title: "Last failed tests (last builds) 2n-skx" algorithm: "table_last_failed_tests" output-file-ext: ".txt" - output-file: "{DIR[STATIC,VPP]}/last-failed-tests-2n-skx" + output-file: "{DIR[STATIC,VPP]}/last-failed-tests-2n-skx-mrr" data: "table-last-failed-tests-2n-skx" filter: "'MRR'" parameters: @@ -804,7 +804,7 @@ title: "Last failed tests (last builds) 2n-clx" algorithm: "table_last_failed_tests" output-file-ext: ".txt" - output-file: "{DIR[STATIC,VPP]}/last-failed-tests-2n-clx" + output-file: "{DIR[STATIC,VPP]}/last-failed-tests-2n-clx-mrr" data: "table-last-failed-tests-2n-clx" filter: "'MRR'" parameters: @@ -817,7 +817,7 @@ title: "Last failed tests (last builds) 3n-tsh" algorithm: "table_last_failed_tests" output-file-ext: ".txt" - output-file: "{DIR[STATIC,VPP]}/last-failed-tests-3n-tsh" + output-file: "{DIR[STATIC,VPP]}/last-failed-tests-3n-tsh-mrr" data: "table-last-failed-tests-3n-tsh" filter: "'MRR'" parameters: @@ -830,7 +830,7 @@ title: "Last failed tests (last builds) 3n-dnv" algorithm: "table_last_failed_tests" output-file-ext: ".txt" - output-file: "{DIR[STATIC,VPP]}/last-failed-tests-3n-dnv" + output-file: "{DIR[STATIC,VPP]}/last-failed-tests-3n-dnv-mrr" data: "table-last-failed-tests-3n-dnv" filter: "'MRR'" parameters: @@ -843,7 +843,7 @@ title: "Last failed tests (last builds) 2n-dnv" algorithm: "table_last_failed_tests" output-file-ext: ".txt" - output-file: "{DIR[STATIC,VPP]}/last-failed-tests-2n-dnv" + output-file: "{DIR[STATIC,VPP]}/last-failed-tests-2n-dnv-mrr" data: "table-last-failed-tests-2n-dnv" filter: "'MRR'" parameters: @@ -1013,7 +1013,8 @@ input-file: "{DIR[STATIC,VPP]}/performance-trending-dashboard-1t1c-3n-hsw-ndr.csv" output-file: "{DIR[STATIC,VPP]}/performance-trending-dashboard-1t1c-3n-hsw-ndr.rst" testbed: "3n-hsw" - add-links: False + test-type: "NDR" + add-links: True - type: "table" @@ -1022,7 +1023,8 @@ input-file: "{DIR[STATIC,VPP]}/performance-trending-dashboard-1t1c-3n-hsw-pdr.csv" output-file: "{DIR[STATIC,VPP]}/performance-trending-dashboard-1t1c-3n-hsw-pdr.rst" testbed: "3n-hsw" - add-links: False + test-type: "PDR" + add-links: True # 3n-skx - @@ -1064,7 +1066,8 @@ input-file: "{DIR[STATIC,VPP]}/performance-trending-dashboard-2t1c-3n-skx-ndr.csv" output-file: "{DIR[STATIC,VPP]}/performance-trending-dashboard-2t1c-3n-skx-ndr.rst" testbed: "3n-skx" - add-links: False + test-type: "NDR" + add-links: True - type: "table" @@ -1073,7 +1076,8 @@ input-file: "{DIR[STATIC,VPP]}/performance-trending-dashboard-2t1c-3n-skx-pdr.csv" output-file: "{DIR[STATIC,VPP]}/performance-trending-dashboard-2t1c-3n-skx-pdr.rst" testbed: "3n-skx" - add-links: False + test-type: "PDR" + add-links: True # 2n-skx - @@ -1115,7 +1119,8 @@ input-file: "{DIR[STATIC,VPP]}/performance-trending-dashboard-2t1c-2n-skx-ndr.csv" output-file: "{DIR[STATIC,VPP]}/performance-trending-dashboard-2t1c-2n-skx-ndr.rst" testbed: "2n-skx" - add-links: False + test-type: "NDR" + add-links: True - type: "table" @@ -1124,7 +1129,8 @@ input-file: "{DIR[STATIC,VPP]}/performance-trending-dashboard-2t1c-2n-skx-pdr.csv" output-file: "{DIR[STATIC,VPP]}/performance-trending-dashboard-2t1c-2n-skx-pdr.rst" testbed: "2n-skx" - add-links: False + test-type: "PDR" + add-links: True # 2n-clx - @@ -1166,7 +1172,8 @@ input-file: "{DIR[STATIC,VPP]}/performance-trending-dashboard-2t1c-2n-clx-ndr.csv" output-file: "{DIR[STATIC,VPP]}/performance-trending-dashboard-2t1c-2n-clx-ndr.rst" testbed: "2n-clx" - add-links: False + test-type: "NDR" + add-links: True - type: "table" @@ -1175,7 +1182,8 @@ input-file: "{DIR[STATIC,VPP]}/performance-trending-dashboard-2t1c-2n-clx-pdr.csv" output-file: "{DIR[STATIC,VPP]}/performance-trending-dashboard-2t1c-2n-clx-pdr.rst" testbed: "2n-clx" - add-links: False + test-type: "PDR" + add-links: True - type: "table" @@ -1220,8 +1228,9 @@ input-file: "{DIR[STATIC,VPP]}/failed-tests-3n-hsw-ndrpdr.csv" output-file: "{DIR[STATIC,VPP]}/failed-tests-3n-hsw-ndrpdr.rst" testbed: "3n-hsw" + test-type: "NDRPDR" -################################################################################ +############################################################################### # 3n-skx - type: "table" @@ -1335,6 +1344,7 @@ input-file: "{DIR[STATIC,VPP]}/failed-tests-3n-skx-ndrpdr.csv" output-file: "{DIR[STATIC,VPP]}/failed-tests-3n-skx-ndrpdr.rst" testbed: "3n-skx" + test-type: "NDRPDR" ################################################################################ # 2n-skx @@ -1450,6 +1460,7 @@ input-file: "{DIR[STATIC,VPP]}/failed-tests-2n-skx-ndrpdr.csv" output-file: "{DIR[STATIC,VPP]}/failed-tests-2n-skx-ndrpdr.rst" testbed: "2n-skx" + test-type: "NDRPDR" ################################################################################ # 2n-clx @@ -1565,6 +1576,7 @@ input-file: "{DIR[STATIC,VPP]}/failed-tests-2n-clx-ndrpdr.csv" output-file: "{DIR[STATIC,VPP]}/failed-tests-2n-clx-ndrpdr.rst" testbed: "2n-clx" + test-type: "NDRPDR" ################################################################################ # 3n-tsh -- cgit 1.2.3-korg