b0e8ed7caff6b6b21f901fa1f7a6e160c43de049
[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 = 250
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         "gso": "GSO",
130         "ip4": "IPv4 Routing",
131         "ip4_tunnels": "IPv4 Tunnels",
132         "ip6": "IPv6 Routing",
133         "ip6_tunnels": "IPv6 Tunnels",
134         "l2": "L2 Ethernet Switching",
135         "lb": "Load Balancer",
136         "srv6": "SRv6 Routing",
137         "vm_vhost": "VMs vhost-user",
138         "nfv_density.dcr_memif.chain_ipsec": "CNF Service Chains Routing IPSec",
139         "nfv_density.vm_vhost.chain_dot1qip4vxlan":"VNF Service Chains Tunnels",
140         "nfv_density.vm_vhost.chain": "VNF Service Chains Routing",
141         "nfv_density.dcr_memif.pipeline": "CNF Service Pipelines Routing",
142         "nfv_density.dcr_memif.chain": "CNF Service Chains Routing",
143         "hoststack": "Hoststack",
144         "flow": "Flow",
145         "l2bd": "L2 Bridge Domain",
146         "crypto.ethip4": "IPSec IPv4 Routing",
147         "crypto.ethip6": "IPSec IPv6 Routing",
148         "interfaces": "Interfaces",
149         "ip4_tunnels.lisp": "IPv4 Tunnels LISP",
150         "ip6_tunnels.lisp": "IPv6 Tunnels LISP",
151         "l2patch": "L2 Patch",
152         "l2xc": "L2 Cross Connect",
153         "vm_vhost.ethip4": "VMs vhost-user IPv4 Routing",
154         "vm_vhost.ethip6": "VMs vhost-user IPv6 Routing"
155     }
156
157     # URL style.
158     URL_STYLE = {
159         "background-color": "#d2ebf5",
160         "border-color": "#bce1f1",
161         "color": "#135d7c"
162     }
163
164     ############################################################################
165     # General, normalization constants.
166
167     NORM_FREQUENCY = 2.0  # [GHz]
168     FREQUENCY = {  # [GHz]
169         "1n-aws": 3.400,
170         "2n-aws": 3.400,
171         "2n-c6in": 3.500,
172         "2n-dnv": 2.000,
173         "2n-clx": 2.300,
174         "2n-icx": 2.600,
175         "2n-skx": 2.500,
176         "2n-spr": 2.800,
177         "2n-tx2": 2.500,
178         "2n-zn2": 2.900,
179         "3n-alt": 3.000,
180         "3n-aws": 1.000,
181         "3n-dnv": 2.000,
182         "3n-icx": 2.600,
183         "3n-icxd": 2.000,
184         "3n-skx": 2.500,
185         "3n-tsh": 2.200,
186         "3n-snr": 2.200,
187         "3na-spr": 2.800,
188         "3nb-spr": 2.800
189     }
190
191     ############################################################################
192     # General, plots and tables constants.
193
194     PLOT_COLORS = (
195         "#1A1110", "#DA2647", "#214FC6", "#01786F", "#BD8260", "#FFD12A",
196         "#A6E7FF", "#738276", "#C95A49", "#FC5A8D", "#CEC8EF", "#391285",
197         "#6F2DA8", "#FF878D", "#45A27D", "#FFD0B9", "#FD5240", "#DB91EF",
198         "#44D7A8", "#4F86F7", "#84DE02", "#FFCFF1", "#614051"
199     )
200
201     # Trending, anomalies.
202     ANOMALY_COLOR = {
203         "regression": 0.0,
204         "normal": 0.5,
205         "progression": 1.0
206     }
207
208     COLORSCALE_TPUT = [
209         [0.00, "red"],
210         [0.33, "red"],
211         [0.33, "white"],
212         [0.66, "white"],
213         [0.66, "green"],
214         [1.00, "green"]
215     ]
216
217     TICK_TEXT_TPUT = ["Regression", "Normal", "Progression"]
218
219     COLORSCALE_LAT = [
220         [0.00, "green"],
221         [0.33, "green"],
222         [0.33, "white"],
223         [0.66, "white"],
224         [0.66, "red"],
225         [1.00, "red"]
226     ]
227
228     TICK_TEXT_LAT = ["Progression", "Normal", "Regression"]
229
230     # Access to the results.
231     VALUE = {
232         "mrr": "result_receive_rate_rate_avg",
233         "ndr": "result_ndr_lower_rate_value",
234         "pdr": "result_pdr_lower_rate_value",
235         "mrr-bandwidth": "result_receive_rate_bandwidth_avg",
236         "ndr-bandwidth": "result_ndr_lower_bandwidth_value",
237         "pdr-bandwidth": "result_pdr_lower_bandwidth_value",
238         "latency": "result_latency_forward_pdr_50_avg",
239         "hoststack-cps": "result_rate_value",
240         "hoststack-rps": "result_rate_value",
241         "hoststack-cps-bandwidth": "result_bandwidth_value",
242         "hoststack-rps-bandwidth": "result_bandwidth_value",
243         "hoststack-bps": "result_bandwidth_value",
244         "hoststack-latency": "result_latency_value"
245     }
246
247     VALUE_ITER = {
248         "mrr": "result_receive_rate_rate_values",
249         "ndr": "result_ndr_lower_rate_value",
250         "pdr": "result_pdr_lower_rate_value",
251         "mrr-bandwidth": "result_receive_rate_bandwidth_avg",
252         "ndr-bandwidth": "result_ndr_lower_bandwidth_value",
253         "pdr-bandwidth": "result_pdr_lower_bandwidth_value",
254         "latency": "result_latency_forward_pdr_50_avg",
255         "hoststack-cps": "result_rate_value",
256         "hoststack-rps": "result_rate_value",
257         "hoststack-bps": "result_bandwidth_value",
258         "hoststack-latency": "result_latency_value"
259     }
260
261     UNIT = {
262         "mrr": "result_receive_rate_rate_unit",
263         "ndr": "result_ndr_lower_rate_unit",
264         "pdr": "result_pdr_lower_rate_unit",
265         "mrr-bandwidth": "result_receive_rate_bandwidth_unit",
266         "ndr-bandwidth": "result_ndr_lower_bandwidth_unit",
267         "pdr-bandwidth": "result_pdr_lower_bandwidth_unit",
268         "latency": "result_latency_forward_pdr_50_unit",
269         "hoststack-cps": "result_rate_unit",
270         "hoststack-rps": "result_rate_unit",
271         "hoststack-cps-bandwidth": "result_bandwidth_unit",
272         "hoststack-rps-bandwidth": "result_bandwidth_unit",
273         "hoststack-bps": "result_bandwidth_unit",
274         "hoststack-latency": "result_latency_unit"
275     }
276
277     # Latencies.
278     LAT_HDRH = (  # Do not change the order
279         "result_latency_forward_pdr_0_hdrh",
280         "result_latency_reverse_pdr_0_hdrh",
281         "result_latency_forward_pdr_10_hdrh",
282         "result_latency_reverse_pdr_10_hdrh",
283         "result_latency_forward_pdr_50_hdrh",
284         "result_latency_reverse_pdr_50_hdrh",
285         "result_latency_forward_pdr_90_hdrh",
286         "result_latency_reverse_pdr_90_hdrh",
287     )
288
289     # This value depends on latency stream rate (9001 pps) and duration (5s).
290     # Keep it slightly higher to ensure rounding errors to not remove tick mark.
291     PERCENTILE_MAX = 99.999501
292
293     GRAPH_LAT_HDRH_DESC = {
294         "result_latency_forward_pdr_0_hdrh": "No-load.",
295         "result_latency_reverse_pdr_0_hdrh": "No-load.",
296         "result_latency_forward_pdr_10_hdrh": "Low-load, 10% PDR.",
297         "result_latency_reverse_pdr_10_hdrh": "Low-load, 10% PDR.",
298         "result_latency_forward_pdr_50_hdrh": "Mid-load, 50% PDR.",
299         "result_latency_reverse_pdr_50_hdrh": "Mid-load, 50% PDR.",
300         "result_latency_forward_pdr_90_hdrh": "High-load, 90% PDR.",
301         "result_latency_reverse_pdr_90_hdrh": "High-load, 90% PDR."
302     }
303
304     # Operators used to filter data in comparison tables.
305     OPERATORS = (
306         ("contains ", ),
307         ("lt ", "<"),
308         ("gt ", ">"),
309         ("eq ", "="),
310         ("ge ", ">="),
311         ("le ", "<="),
312         ("ne ", "!="),
313         ("datestartswith ", )
314     )
315
316     ############################################################################
317     # News.
318
319     # The title.
320     NEWS_TITLE = "Failures and Anomalies"
321
322     # The pathname prefix for the application.
323     NEWS_ROUTES_PATHNAME_PREFIX = "/news/"
324
325     # Time period for regressions and progressions.
326     NEWS_TIME_PERIOD = TIME_PERIOD  # [days]
327
328     # Time periods for summary tables.
329     NEWS_LAST = 1  # [days]
330     NEWS_SHORT = 7  # [days]
331     NEWS_LONG = NEWS_TIME_PERIOD  # [days]
332
333     ############################################################################
334     # Report.
335
336     # The title.
337     REPORT_TITLE = "Per Release Performance"
338
339     # The pathname prefix for the application.
340     REPORT_ROUTES_PATHNAME_PREFIX = "/report/"
341
342     # Layout of plot.ly graphs.
343     REPORT_GRAPH_LAYOUT_FILE = "cdash/report/layout.yaml"
344
345     # Default name of downloaded file with selected data.
346     REPORT_DOWNLOAD_FILE_NAME = "iterative_data.csv"
347
348     ############################################################################
349     # Comparisons.
350
351     # The title.
352     COMP_TITLE = "Per Release Performance Comparisons"
353
354     # The pathname prefix for the application.
355     COMP_ROUTES_PATHNAME_PREFIX = "/comparisons/"
356
357     # Default name of downloaded file with selected data.
358     COMP_DOWNLOAD_FILE_NAME = "comparison_data.csv"
359
360     ############################################################################
361     # Statistics.
362
363     # The title.
364     STATS_TITLE = "Test Job Statistics"
365
366     # The pathname prefix for the application.
367     STATS_ROUTES_PATHNAME_PREFIX = "/stats/"
368
369     # Layout of plot.ly graphs.
370     STATS_GRAPH_LAYOUT_FILE = "cdash/stats/layout.yaml"
371
372     # The default job displayed when the page is loaded first time.
373     STATS_DEFAULT_JOB = "csit-vpp-perf-mrr-daily-master-2n-icx"
374
375     # Default name of downloaded file with selected data.
376     STATS_DOWNLOAD_FILE_NAME = "stats.csv"
377
378     # The width of the bar in the graph in miliseconds.
379     STATS_BAR_WIDTH_DAILY = 1000 * 3600 * 15
380     STATS_BAR_WIDTH_WEEKLY = 1000 * 3600 * 24
381
382     ############################################################################
383     # Trending.
384
385     # The title.
386     TREND_TITLE = "Performance Trending"
387
388     # The pathname prefix for the application.
389     TREND_ROUTES_PATHNAME_PREFIX = "/trending/"
390
391     # Layout of plot.ly graphs.
392     TREND_GRAPH_LAYOUT_FILE = "cdash/trending/layout.yaml"
393
394     # Default name of downloaded file with selected data.
395     TREND_DOWNLOAD_FILE_NAME = "trending_data.csv"
396     TELEMETRY_DOWNLOAD_FILE_NAME = "telemetry_data.csv"
397
398     ############################################################################
399     # Coverage data.
400
401     # The title.
402     COVERAGE_TITLE = "Per Release Coverage Data"
403
404     # The pathname prefix for the application.
405     COVERAGE_ROUTES_PATHNAME_PREFIX = "/coverage/"
406
407     # Default name of downloaded file with selected data.
408     COVERAGE_DOWNLOAD_FILE_NAME = "coverage_data.csv"
409
410     ############################################################################