75cd68a3a524e493418670803a9158170333d7ed
[csit.git] / csit.infra.dash / app / cdash / utils / constants.py
1 # Copyright (c) 2022 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 "CSIT-Dash"'
43
44     # External stylesheets.
45     EXTERNAL_STYLESHEETS = ["/static/dist/css/bootstrap.css", ]
46
47     # Top level template for all pages.
48     TEMPLATE = "d-flex h-100 text-center text-white bg-dark"
49
50     # Path and name of the file specifying the HTML layout of the dash
51     # application.
52     MAIN_HTML_LAYOUT_FILE = "index_layout.jinja2"
53
54     # Path and name of the file specifying the HTML layout of the dash
55     # application.
56     HTML_LAYOUT_FILE = "cdash/templates/dash_layout.jinja2"
57
58     # Application root.
59     APPLICATIN_ROOT = "/"
60
61     # Data to be downloaded from the parquets specification file.
62     DATA_SPEC_FILE = "cdash/data/data.yaml"
63
64     # The file with tooltips.
65     TOOLTIP_FILE = "cdash/utils/tooltips.yaml"
66
67     # Maximal value of TIME_PERIOD for data read from the parquets in days.
68     # Do not change without a good reason.
69     MAX_TIME_PERIOD = 180
70
71     # It defines the time period for data read from the parquets in days from
72     # now back to the past.
73     # TIME_PERIOD = None - means all data (max MAX_TIME_PERIOD days) is read.
74     # TIME_PERIOD = MAX_TIME_PERIOD - is the default value
75     TIME_PERIOD = MAX_TIME_PERIOD  # [days]
76
77     # List of releases used for iterative data processing.
78     # The releases MUST be in the order from the current (newest) to the last
79     # (oldest).
80     RELEASES = ["csit2210", "csit2206", "csit2202", ]
81
82     ############################################################################
83     # General, application wide, layout affecting constants.
84
85     # If True, clear all inputs in control panel when button "ADD SELECTED" is
86     # pressed.
87     CLEAR_ALL_INPUTS = False
88
89     # The element is disabled.
90     STYLE_DISABLED = {"display": "none"}
91
92     # The element is enabled and visible.
93     STYLE_ENABLED = {"display": "inherit"}
94
95     # Checklist "All" is disabled.
96     CL_ALL_DISABLED = [
97         {
98             "label": "All",
99             "value": "all",
100             "disabled": True
101         }
102     ]
103
104     # Checklist "All" is enable, visible and unchecked.
105     CL_ALL_ENABLED = [
106         {
107             "label": "All",
108             "value": "all",
109             "disabled": False
110         }
111     ]
112
113     # Placeholder for any element in the layout.
114     PLACEHOLDER = html.Nobr("")
115
116     # List of drivers used in CSIT.
117     DRIVERS = ("avf", "af-xdp", "rdma", "dpdk")
118
119     # Labels for input elements (dropdowns, ...).
120     LABELS = {
121         "dpdk": "DPDK",
122         "container_memif": "LXC/DRC Container Memif",
123         "crypto": "IPSec IPv4 Routing",
124         "ip4": "IPv4 Routing",
125         "ip6": "IPv6 Routing",
126         "ip4_tunnels": "IPv4 Tunnels",
127         "l2": "L2 Ethernet Switching",
128         "srv6": "SRv6 Routing",
129         "vm_vhost": "VMs vhost-user",
130         "nfv_density-dcr_memif-chain_ipsec": "CNF Service Chains Routing IPSec",
131         "nfv_density-vm_vhost-chain_dot1qip4vxlan":"VNF Service Chains Tunnels",
132         "nfv_density-vm_vhost-chain": "VNF Service Chains Routing",
133         "nfv_density-dcr_memif-pipeline": "CNF Service Pipelines Routing",
134         "nfv_density-dcr_memif-chain": "CNF Service Chains Routing",
135     }
136
137     # URL style.
138     URL_STYLE = {
139         "background-color": "#d2ebf5",
140         "border-color": "#bce1f1",
141         "color": "#135d7c"
142     }
143
144     ############################################################################
145     # General, normalization constants.
146
147     NORM_FREQUENCY = 2.0  # [GHz]
148     FREQUENCY = {  # [GHz]
149         "2n-aws": 1.000,
150         "2n-dnv": 2.000,
151         "2n-clx": 2.300,
152         "2n-icx": 2.600,
153         "2n-skx": 2.500,
154         "2n-tx2": 2.500,
155         "2n-zn2": 2.900,
156         "3n-alt": 3.000,
157         "3n-aws": 1.000,
158         "3n-dnv": 2.000,
159         "3n-icx": 2.600,
160         "3n-skx": 2.500,
161         "3n-tsh": 2.200
162     }
163
164     ############################################################################
165     # General, plots constants.
166
167     PLOT_COLORS = (
168         "#1A1110", "#DA2647", "#214FC6", "#01786F", "#BD8260", "#FFD12A",
169         "#A6E7FF", "#738276", "#C95A49", "#FC5A8D", "#CEC8EF", "#391285",
170         "#6F2DA8", "#FF878D", "#45A27D", "#FFD0B9", "#FD5240", "#DB91EF",
171         "#44D7A8", "#4F86F7", "#84DE02", "#FFCFF1", "#614051"
172     )
173
174     # Trending, anomalies.
175     ANOMALY_COLOR = {
176         "regression": 0.0,
177         "normal": 0.5,
178         "progression": 1.0
179     }
180
181     COLORSCALE_TPUT = [
182         [0.00, "red"],
183         [0.33, "red"],
184         [0.33, "white"],
185         [0.66, "white"],
186         [0.66, "green"],
187         [1.00, "green"]
188     ]
189
190     TICK_TEXT_TPUT = ["Regression", "Normal", "Progression"]
191
192     COLORSCALE_LAT = [
193         [0.00, "green"],
194         [0.33, "green"],
195         [0.33, "white"],
196         [0.66, "white"],
197         [0.66, "red"],
198         [1.00, "red"]
199     ]
200
201     TICK_TEXT_LAT = ["Progression", "Normal", "Regression"]
202
203     # Access to the results.
204     VALUE = {
205         "mrr": "result_receive_rate_rate_avg",
206         "ndr": "result_ndr_lower_rate_value",
207         "pdr": "result_pdr_lower_rate_value",
208         "pdr-lat": "result_latency_forward_pdr_50_avg"
209     }
210
211     VALUE_ITER = {
212         "mrr": "result_receive_rate_rate_values",
213         "ndr": "result_ndr_lower_rate_value",
214         "pdr": "result_pdr_lower_rate_value",
215         "pdr-lat": "result_latency_forward_pdr_50_avg"
216     }
217
218     UNIT = {
219         "mrr": "result_receive_rate_rate_unit",
220         "ndr": "result_ndr_lower_rate_unit",
221         "pdr": "result_pdr_lower_rate_unit",
222         "pdr-lat": "result_latency_forward_pdr_50_unit"
223     }
224
225     # Latencies.
226     LAT_HDRH = (  # Do not change the order
227         "result_latency_forward_pdr_0_hdrh",
228         "result_latency_reverse_pdr_0_hdrh",
229         "result_latency_forward_pdr_10_hdrh",
230         "result_latency_reverse_pdr_10_hdrh",
231         "result_latency_forward_pdr_50_hdrh",
232         "result_latency_reverse_pdr_50_hdrh",
233         "result_latency_forward_pdr_90_hdrh",
234         "result_latency_reverse_pdr_90_hdrh",
235     )
236
237     # This value depends on latency stream rate (9001 pps) and duration (5s).
238     # Keep it slightly higher to ensure rounding errors to not remove tick mark.
239     PERCENTILE_MAX = 99.999501
240
241     GRAPH_LAT_HDRH_DESC = {
242         "result_latency_forward_pdr_0_hdrh": "No-load.",
243         "result_latency_reverse_pdr_0_hdrh": "No-load.",
244         "result_latency_forward_pdr_10_hdrh": "Low-load, 10% PDR.",
245         "result_latency_reverse_pdr_10_hdrh": "Low-load, 10% PDR.",
246         "result_latency_forward_pdr_50_hdrh": "Mid-load, 50% PDR.",
247         "result_latency_reverse_pdr_50_hdrh": "Mid-load, 50% PDR.",
248         "result_latency_forward_pdr_90_hdrh": "High-load, 90% PDR.",
249         "result_latency_reverse_pdr_90_hdrh": "High-load, 90% PDR."
250     }
251
252     ############################################################################
253     # News.
254
255     # The title.
256     NEWS_TITLE = "CI TEST FAILURE AND ANOMALY STATISTICS"
257
258     # The pathname prefix for the application.
259     NEWS_ROUTES_PATHNAME_PREFIX = "/news/"
260
261     # Time period for regressions and progressions.
262     NEWS_TIME_PERIOD = TIME_PERIOD  # [days]
263
264     # Time periods for summary tables.
265     NEWS_LAST = 1  # [days]
266     NEWS_SHORT = 7  # [days]
267     NEWS_LONG = NEWS_TIME_PERIOD  # [days]
268
269     ############################################################################
270     # Report.
271
272     # The title.
273     REPORT_TITLE = "PER RELEASE PERFORMANCE RESULTS"
274
275     # The pathname prefix for the application.
276     REPORT_ROUTES_PATHNAME_PREFIX = "/report/"
277
278     # Layout of plot.ly graphs.
279     REPORT_GRAPH_LAYOUT_FILE = "cdash/report/layout.yaml"
280
281     # Default name of downloaded file with selected data.
282     REPORT_DOWNLOAD_FILE_NAME = "iterative_data.csv"
283
284     ############################################################################
285     # Statistics.
286
287     # The title.
288     STATS_TITLE = "CI JOB EXECUTION STATISTICS"
289
290     # The pathname prefix for the application.
291     STATS_ROUTES_PATHNAME_PREFIX = "/stats/"
292
293     # Path and name of the file specifying the HTML layout of the dash
294     # application.
295     STATS_HTML_LAYOUT_FILE = "cdash/templates/stats_layout.jinja2"
296
297     # Layout of plot.ly graphs.
298     STATS_GRAPH_LAYOUT_FILE = "cdash/stats/layout.yaml"
299
300     # The default job displayed when the page is loaded first time.
301     STATS_DEFAULT_JOB = "csit-vpp-perf-mrr-daily-master-2n-icx"
302
303     # Default name of downloaded file with selected data.
304     STATS_DOWNLOAD_FILE_NAME = "stats.csv"
305
306     ############################################################################
307     # Trending.
308
309     # The title.
310     TREND_TITLE = "PERFORMANCE TRENDING (DAILY, WEEKLY)"
311
312     # The pathname prefix for the application.
313     TREND_ROUTES_PATHNAME_PREFIX = "/trending/"
314
315     # Path and name of the file specifying the HTML layout of the dash
316     # application.
317     TREND_HTML_LAYOUT_FILE = "cdash/templates/trending_layout.jinja2"
318
319     # Layout of plot.ly graphs.
320     TREND_GRAPH_LAYOUT_FILE = "cdash/trending/layout.yaml"
321
322     # Default name of downloaded file with selected data.
323     TREND_DOWNLOAD_FILE_NAME = "trending_data.csv"