diff options
-rw-r--r-- | csit.infra.dash/app/cdash/stats/layout.py | 14 | ||||
-rw-r--r-- | csit.infra.dash/app/cdash/utils/utils.py | 46 | ||||
-rw-r--r-- | resources/libraries/python/VppConfigGenerator.py | 2 | ||||
-rw-r--r-- | resources/libraries/robot/shared/test_setup.robot | 3 | ||||
-rw-r--r-- | tests/vpp/perf/__init__.robot | 3 |
5 files changed, 55 insertions, 13 deletions
diff --git a/csit.infra.dash/app/cdash/stats/layout.py b/csit.infra.dash/app/cdash/stats/layout.py index 6f7031aedc..823e32659a 100644 --- a/csit.infra.dash/app/cdash/stats/layout.py +++ b/csit.infra.dash/app/cdash/stats/layout.py @@ -29,7 +29,8 @@ from yaml import load, FullLoader, YAMLError from ..utils.constants import Constants as C from ..utils.control_panel import ControlPanel from ..utils.utils import show_tooltip, gen_new_url, get_ttypes, get_cadences, \ - get_test_beds, get_job, generate_options, set_job_params, navbar_trending + get_test_beds, get_job, generate_options, set_job_params, navbar_trending, \ + get_url_job, get_url_logs from ..utils.url_processing import url_decode from .graphs import graph_statistics, select_data @@ -197,7 +198,7 @@ class Layout: "dd-tbeds-value": self._default["tbed"], "al-job-children": html.A( self._default["job"], - href=f"{C.URL_CICD}{self._default['job']}", + href=get_url_job(self._default["job"]), target="_blank" ) } @@ -631,10 +632,7 @@ class Layout: "dd-tbeds-value": job_params["tbed"], "al-job-children": html.A( self._default["job"], - href=( - f"{C.URL_CICD}" - f"{self._default['job']}" - ), + href=get_url_job(self._default["job"]), target="_blank" ) }, @@ -655,7 +653,7 @@ class Layout: { "al-job-children": html.A( job, - href=f"{C.URL_CICD}{job}", + href=get_url_job(job), target="_blank" ) } @@ -785,7 +783,7 @@ class Layout: dbc.Badge(lst_itm[0]), html.A( lst_itm[1], - href=f"{C.URL_LOGS}{lst_itm[1]}", + href=get_url_logs(lst_itm[1]), target="_blank" ) ]) diff --git a/csit.infra.dash/app/cdash/utils/utils.py b/csit.infra.dash/app/cdash/utils/utils.py index 27ecd1f763..62d4770937 100644 --- a/csit.infra.dash/app/cdash/utils/utils.py +++ b/csit.infra.dash/app/cdash/utils/utils.py @@ -721,7 +721,7 @@ def show_trending_graph_data( dbc.Badge(lst_itm[0]), html.A( lst_itm[1], - href=f"{C.URL_LOGS}{lst_itm[1]}", + href=get_url_logs(lst_itm[1]), target="_blank" ) ]) @@ -853,7 +853,7 @@ def show_iterative_graph_data( continue list_group_item = dbc.ListGroupItem([ dbc.Badge(k), - html.A(v, href=f"{C.URL_LOGS}{v}", target="_blank") + html.A(v, href=get_url_logs(v), target="_blank") ]) else: list_group_item = dbc.ListGroupItem([dbc.Badge(k), v]) @@ -904,3 +904,45 @@ def show_iterative_graph_data( ] return metadata, graph, True + + +def get_url_job(job: str) -> str: + """Generates a URL to CI/CD job. + + :param job: The name of job. + :type job: str + :raises KeyError: If the job name is not a valid job name. + :returns: The URL to CI/CD job. + """ + + if C.CICD_TYPE == "jenkins": + return f"{C.URL_CICD}{job}" + elif C.CICD_TYPE == "github": + l_j = job.split("-") + try: + return f"{C.URL_CICD}{l_j[0]}-{l_j[1]}-{l_j[2]}-{l_j[4]}.yml" + except KeyError: + return str() + else: + return str() + + +def get_url_logs(job_build: str) -> str: + """Generates a URL to CI/CD job and its build. + + :param job_build: The name of job and number of build. Its structure is: + "<job name>/<build number>". + :type job: str + :raises KeyError: If the job name is not a valid job name. + :returns: The URL to CI/CD build. + """ + + if C.CICD_TYPE == "jenkins": + return f"{C.URL_LOGS}{job_build}" + elif C.CICD_TYPE == "github": + try: + return f"{C.URL_LOGS}{job_build.split('/')[1]}" + except KeyError: + return str() + else: + return str() diff --git a/resources/libraries/python/VppConfigGenerator.py b/resources/libraries/python/VppConfigGenerator.py index fb3df2fc16..971b82606f 100644 --- a/resources/libraries/python/VppConfigGenerator.py +++ b/resources/libraries/python/VppConfigGenerator.py @@ -197,7 +197,7 @@ class VppConfigGenerator: path = ["node", "default", "variant"] self.add_config_item(self._nodeconfig, variant, path) - def add_api_segment_gid(self, value="vpp"): + def add_api_segment_gid(self, value="testuser"): """Add api-segment gid configuration. :param value: Gid. diff --git a/resources/libraries/robot/shared/test_setup.robot b/resources/libraries/robot/shared/test_setup.robot index 22e017fd6f..ae3cfa495f 100644 --- a/resources/libraries/robot/shared/test_setup.robot +++ b/resources/libraries/robot/shared/test_setup.robot @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Cisco and/or its affiliates. +# Copyright (c) 2024 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -50,3 +50,4 @@ | | | | ${trex_running}= | Is Trex Running | ${tg} | | Run Keyword If | not ${trex_running} | Startup Trex | ${tg} | ${osi_layer} +| | Stop Vpp Service on All Duts | ${nodes} diff --git a/tests/vpp/perf/__init__.robot b/tests/vpp/perf/__init__.robot index 04b47f9746..ef7c81980b 100644 --- a/tests/vpp/perf/__init__.robot +++ b/tests/vpp/perf/__init__.robot @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Cisco and/or its affiliates. +# Copyright (c) 2024 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -29,6 +29,7 @@ | ... | AND | Get CPU Info from All Nodes | ${nodes} | ... | AND | Update All Interface Data on All Nodes | ${nodes} | ... | skip_tg=${True} +| ... | AND | Stop Vpp Service on All Duts | ${nodes} | ... | AND | Finalize Suite Setup Export | | Suite Teardown | Run Keywords | Start Suite Teardown Export |