C-Dash: Add hyperlinks to job/builds
[csit.git] / csit.infra.dash / app / cdash / utils / constants.py
1 # Copyright (c) 2023 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 """Constants used in CDash.
15
16 "Constant" means a value that keeps its value since initialization. The value
17 does not need to be hard coded here, but can be read from environment variables.
18 """
19
20 import logging
21
22 from dash import html
23
24
25 class Constants:
26     """Constants used in CDash.
27     """
28
29     ############################################################################
30     # General, application wide constants.
31
32     # Logging settings.
33     LOG_LEVEL = logging.INFO
34     LOG_FORMAT = "%(asctime)s: %(levelname)s: %(message)s"
35     LOG_DATE_FORMAT = "%Y/%m/%d %H:%M:%S"
36
37     # The application title.
38     TITLE = "FD.io CSIT"
39     BRAND = "CSIT-Dash"
40
41     # The application description.
42     DESCRIPTION = "Performance Dashboard"
43
44     # External stylesheets.
45     EXTERNAL_STYLESHEETS = ["/static/dist/css/bootstrap.css", ]
46
47     # URL to Jenkins
48     URL_JENKINS = "https://jenkins.fd.io/job/"
49
50     # URL to the documentation
51     URL_DOC_TRENDING = "https://csit.fd.io/cdocs/methodology/trending/analysis/"
52     URL_DOC_REL_NOTES = "https://csit.fd.io/cdocs/release_notes/csit_rls2306/"
53
54     # Path and name of the file specifying the HTML layout of the dash
55     # application.
56     MAIN_HTML_LAYOUT_FILE = "base_layout.jinja2"
57
58     # Path and name of the file specifying the HTML layout of the dash
59     # application.
60     HTML_LAYOUT_FILE = "cdash/templates/dash_layout.jinja2"
61
62     # Application root.
63     APPLICATIN_ROOT = "/"
64
65     # Data to be downloaded from the parquets specification file.
66     DATA_SPEC_FILE = "cdash/data/data.yaml"
67
68     # The file with tooltips.
69     TOOLTIP_FILE = "cdash/utils/tooltips.yaml"
70
71     # Maximal value of TIME_PERIOD for data read from the parquets in days.
72     # Do not change without a good reason.
73     MAX_TIME_PERIOD = 130
74
75     # It defines the time period for data read from the parquets in days from
76     # now back to the past.
77     # TIME_PERIOD = None - means all data (max MAX_TIME_PERIOD days) is read.
78     # TIME_PERIOD = MAX_TIME_PERIOD - is the default value
79     TIME_PERIOD = MAX_TIME_PERIOD  # [days]
80
81     ############################################################################
82     # General, application wide, layout affecting constants.
83
84     # Add a time delay (in ms) to the spinner being shown
85     SPINNER_DELAY = 500
86
87     # If True, clear all inputs in control panel when button "ADD SELECTED" is
88     # pressed.
89     CLEAR_ALL_INPUTS = False
90
91     # The element is disabled.
92     STYLE_DISABLED = {"visibility": "hidden"}
93
94     # The element is enabled and visible.
95     STYLE_ENABLED = {"visibility": "visible"}
96
97     # Checklist "All" is disabled.
98     CL_ALL_DISABLED = [
99         {
100             "label": "All",
101             "value": "all",
102             "disabled": True
103         }
104     ]
105
106     # Checklist "All" is enabled, visible and unchecked.
107     CL_ALL_ENABLED = [
108         {
109             "label": "All",
110             "value": "all",
111             "disabled": False
112         }
113     ]
114
115     # Placeholder for any element in the layout.
116     PLACEHOLDER = html.Nobr("")
117
118     # List of drivers used in CSIT.
119     DRIVERS = ("avf", "af-xdp", "rdma", "dpdk", "mlx5")
120
121     # Labels for input elements (dropdowns, ...).
122     LABELS = {
123         "dpdk": "DPDK",
124         "container_memif": "LXC/DRC Container Memif",
125         "crypto": "IPSec IPv4 Routing",
126         "ip4": "IPv4 Routing",
127         "ip4_tunnels": "IPv4 Tunnels",
128         "ip6": "IPv6 Routing",
129         "ip6_tunnels": "IPv6 Tunnels",
130         "l2": "L2 Ethernet Switching",
131         "lb": "Load Balancer",
132         "srv6": "SRv6 Routing",
133         "vm_vhost": "VMs vhost-user",
134         "nfv_density.dcr_memif.chain_ipsec": "CNF Service Chains Routing IPSec",
135         "nfv_density.vm_vhost.chain_dot1qip4vxlan":"VNF Service Chains Tunnels",
136         "nfv_density.vm_vhost.chain": "VNF Service Chains Routing",
137         "nfv_density.dcr_memif.pipeline": "CNF Service Pipelines Routing",
138         "nfv_density.dcr_memif.chain": "CNF Service Chains Routing",
139         "hoststack": "Hoststack",
140         "flow": "Flow",
141         "l2bd": "L2 Bridge Domain",
142         "crypto.ethip4": "IPSec IPv4 Routing",
143         "crypto.ethip6": "IPSec IPv6 Routing",
144         "interfaces": "Interfaces",
145         "ip4_tunnels.lisp": "IPv4 Tunnels LISP",
146         "ip6_tunnels.lisp": "IPv6 Tunnels LISP",
147         "l2patch": "L2 Patch",
148         "l2xc": "L2 Cross Connect",
149         "vm_vhost.ethip4": "VMs vhost-user IPv4 Routing",
150         "vm_vhost.ethip6": "VMs vhost-user IPv6 Routing"
151     }
152
153     # URL style.
154     URL_STYLE = {
155         "background-color": "#d2ebf5",
156         "border-color": "#bce1f1",
157         "color": "#135d7c"
158     }
159
160     ############################################################################
161     # General, normalization constants.
162
163     NORM_FREQUENCY = 2.0  # [GHz]
164     FREQUENCY = {  # [GHz]
165         "1n-aws": 1.000,
166         "2n-aws": 1.000,
167         "2n-dnv": 2.000,
168         "2n-clx": 2.300,
169         "2n-icx": 2.600,
170         "2n-skx": 2.500,
171         "2n-spr": 2.800,
172         "2n-tx2": 2.500,
173         "2n-zn2": 2.900,
174         "3n-alt": 3.000,
175         "3n-aws": 1.000,
176         "3n-dnv": 2.000,
177         "3n-icx": 2.600,
178         "3n-skx": 2.500,
179         "3n-tsh": 2.200,
180         "3n-snr": 2.200,
181         "3na-spr": 2.800,
182         "3nb-spr": 2.800
183     }
184
185     ############################################################################
186     # General, plots and tables constants.
187
188     PLOT_COLORS = (
189         "#1A1110", "#DA2647", "#214FC6", "#01786F", "#BD8260", "#FFD12A",
190         "#A6E7FF", "#738276", "#C95A49", "#FC5A8D", "#CEC8EF", "#391285",
191         "#6F2DA8", "#FF878D", "#45A27D", "#FFD0B9", "#FD5240", "#DB91EF",
192         "#44D7A8", "#4F86F7", "#84DE02", "#FFCFF1", "#614051"
193     )
194
195     # Trending, anomalies.
196     ANOMALY_COLOR = {
197         "regression": 0.0,
198         "normal": 0.5,
199         "progression": 1.0
200     }
201
202     COLORSCALE_TPUT = [
203         [0.00, "red"],
204         [0.33, "red"],
205         [0.33, "white"],
206         [0.66, "white"],
207         [0.66, "green"],
208         [1.00, "green"]
209     ]
210
211     TICK_TEXT_TPUT = ["Regression", "Normal", "Progression"]
212
213     COLORSCALE_LAT = [
214         [0.00, "green"],
215         [0.33, "green"],
216         [0.33, "white"],
217         [0.66, "white"],
218         [0.66, "red"],
219         [1.00, "red"]
220     ]
221
222     TICK_TEXT_LAT = ["Progression", "Normal", "Regression"]
223
224     # Access to the results.
225     VALUE = {
226         "mrr": "result_receive_rate_rate_avg",
227         "ndr": "result_ndr_lower_rate_value",
228         "pdr": "result_pdr_lower_rate_value",
229         "latency": "result_latency_forward_pdr_50_avg",
230         "hoststack-cps": "result_rate_value",
231         "hoststack-rps": "result_rate_value",
232         "hoststack-bps": "result_bandwidth_value",
233         "hoststack-latency": "result_latency_value"
234     }
235
236     VALUE_ITER = {
237         "mrr": "result_receive_rate_rate_values",
238         "ndr": "result_ndr_lower_rate_value",
239         "pdr": "result_pdr_lower_rate_value",
240         "latency": "result_latency_forward_pdr_50_avg",
241         "hoststack-cps": "result_rate_value",
242         "hoststack-rps": "result_rate_value",
243         "hoststack-bps": "result_bandwidth_value",
244         "hoststack-latency": "result_latency_value"
245     }
246
247     UNIT = {
248         "mrr": "result_receive_rate_rate_unit",
249         "ndr": "result_ndr_lower_rate_unit",
250         "pdr": "result_pdr_lower_rate_unit",
251         "latency": "result_latency_forward_pdr_50_unit",
252         "hoststack-cps": "result_rate_unit",
253         "hoststack-rps": "result_rate_unit",
254         "hoststack-bps": "result_bandwidth_unit",
255         "hoststack-latency": "result_latency_unit"
256     }
257
258     # Latencies.
259     LAT_HDRH = (  # Do not change the order
260         "result_latency_forward_pdr_0_hdrh",
261         "result_latency_reverse_pdr_0_hdrh",
262         "result_latency_forward_pdr_10_hdrh",
263         "result_latency_reverse_pdr_10_hdrh",
264         "result_latency_forward_pdr_50_hdrh",
265         "result_latency_reverse_pdr_50_hdrh",
266         "result_latency_forward_pdr_90_hdrh",
267         "result_latency_reverse_pdr_90_hdrh",
268     )
269
270     # This value depends on latency stream rate (9001 pps) and duration (5s).
271     # Keep it slightly higher to ensure rounding errors to not remove tick mark.
272     PERCENTILE_MAX = 99.999501
273
274     GRAPH_LAT_HDRH_DESC = {
275         "result_latency_forward_pdr_0_hdrh": "No-load.",
276         "result_latency_reverse_pdr_0_hdrh": "No-load.",
277         "result_latency_forward_pdr_10_hdrh": "Low-load, 10% PDR.",
278         "result_latency_reverse_pdr_10_hdrh": "Low-load, 10% PDR.",
279         "result_latency_forward_pdr_50_hdrh": "Mid-load, 50% PDR.",
280         "result_latency_reverse_pdr_50_hdrh": "Mid-load, 50% PDR.",
281         "result_latency_forward_pdr_90_hdrh": "High-load, 90% PDR.",
282         "result_latency_reverse_pdr_90_hdrh": "High-load, 90% PDR."
283     }
284
285     # Operators used to filter data in comparison tables.
286     OPERATORS = (
287         ("contains ", ),
288         ("lt ", "<"),
289         ("gt ", ">"),
290         ("eq ", "="),
291         ("ge ", ">="),
292         ("le ", "<="),
293         ("ne ", "!="),
294         ("datestartswith ", )
295     )
296
297     ############################################################################
298     # News.
299
300     # The title.
301     NEWS_TITLE = "Failures and Anomalies"
302
303     # The pathname prefix for the application.
304     NEWS_ROUTES_PATHNAME_PREFIX = "/news/"
305
306     # Time period for regressions and progressions.
307     NEWS_TIME_PERIOD = TIME_PERIOD  # [days]
308
309     # Time periods for summary tables.
310     NEWS_LAST = 1  # [days]
311     NEWS_SHORT = 7  # [days]
312     NEWS_LONG = NEWS_TIME_PERIOD  # [days]
313
314     ############################################################################
315     # Report.
316
317     # The title.
318     REPORT_TITLE = "Per Release Performance"
319
320     # The pathname prefix for the application.
321     REPORT_ROUTES_PATHNAME_PREFIX = "/report/"
322
323     # Layout of plot.ly graphs.
324     REPORT_GRAPH_LAYOUT_FILE = "cdash/report/layout.yaml"
325
326     # Default name of downloaded file with selected data.
327     REPORT_DOWNLOAD_FILE_NAME = "iterative_data.csv"
328
329     ############################################################################
330     # Comparisons.
331
332     # The title.
333     COMP_TITLE = "Per Release Performance Comparisons"
334
335     # The pathname prefix for the application.
336     COMP_ROUTES_PATHNAME_PREFIX = "/comparisons/"
337
338     # Default name of downloaded file with selected data.
339     COMP_DOWNLOAD_FILE_NAME = "comparison_data.csv"
340
341     ############################################################################
342     # Statistics.
343
344     # The title.
345     STATS_TITLE = "Test Job Statistics"
346
347     # The pathname prefix for the application.
348     STATS_ROUTES_PATHNAME_PREFIX = "/stats/"
349
350     # Layout of plot.ly graphs.
351     STATS_GRAPH_LAYOUT_FILE = "cdash/stats/layout.yaml"
352
353     # The default job displayed when the page is loaded first time.
354     STATS_DEFAULT_JOB = "csit-vpp-perf-mrr-daily-master-2n-icx"
355
356     # Default name of downloaded file with selected data.
357     STATS_DOWNLOAD_FILE_NAME = "stats.csv"
358
359     ############################################################################
360     # Trending.
361
362     # The title.
363     TREND_TITLE = "Performance Trending"
364
365     # The pathname prefix for the application.
366     TREND_ROUTES_PATHNAME_PREFIX = "/trending/"
367
368     # Layout of plot.ly graphs.
369     TREND_GRAPH_LAYOUT_FILE = "cdash/trending/layout.yaml"
370
371     # Default name of downloaded file with selected data.
372     TREND_DOWNLOAD_FILE_NAME = "trending_data.csv"
373     TELEMETRY_DOWNLOAD_FILE_NAME = "telemetry_data.csv"
374
375     ############################################################################
376     # Coverage data.
377
378     # The title.
379     COVERAGE_TITLE = "Per Release Coverage Data"
380
381     # The pathname prefix for the application.
382     COVERAGE_ROUTES_PATHNAME_PREFIX = "/coverage/"
383
384     # Default name of downloaded file with selected data.
385     COVERAGE_DOWNLOAD_FILE_NAME = "coverage_data.csv"
386
387     ############################################################################