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