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