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