fix(cdash): Revert to data driven app
[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"
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 = 180
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     # List of releases used for iterative data processing.
75     # The releases MUST be in the order from the current (newest) to the last
76     # (oldest).
77     RELEASES = ["rls2210", "rls2206", "rls2202", ]
78
79     ############################################################################
80     # General, application wide, layout affecting constants.
81
82     # If True, clear all inputs in control panel when button "ADD SELECTED" is
83     # pressed.
84     CLEAR_ALL_INPUTS = False
85
86     # The element is disabled.
87     STYLE_DISABLED = {"display": "none"}
88
89     # The element is enabled and visible.
90     STYLE_ENABLED = {"display": "inherit"}
91
92     # Checklist "All" is disabled.
93     CL_ALL_DISABLED = [
94         {
95             "label": "All",
96             "value": "all",
97             "disabled": True
98         }
99     ]
100
101     # Checklist "All" is enabled, visible and unchecked.
102     CL_ALL_ENABLED = [
103         {
104             "label": "All",
105             "value": "all",
106             "disabled": False
107         }
108     ]
109
110     # Placeholder for any element in the layout.
111     PLACEHOLDER = html.Nobr("")
112
113     # List of drivers used in CSIT.
114     DRIVERS = ("avf", "af-xdp", "rdma", "dpdk")
115
116     # Labels for input elements (dropdowns, ...).
117     LABELS = {
118         "dpdk": "DPDK",
119         "container_memif": "LXC/DRC Container Memif",
120         "crypto": "IPSec IPv4 Routing",
121         "ip4": "IPv4 Routing",
122         "ip6": "IPv6 Routing",
123         "ip4_tunnels": "IPv4 Tunnels",
124         "l2": "L2 Ethernet Switching",
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     }
133
134     # URL style.
135     URL_STYLE = {
136         "background-color": "#d2ebf5",
137         "border-color": "#bce1f1",
138         "color": "#135d7c"
139     }
140
141     ############################################################################
142     # General, normalization constants.
143
144     NORM_FREQUENCY = 2.0  # [GHz]
145     FREQUENCY = {  # [GHz]
146         "2n-aws": 1.000,
147         "2n-dnv": 2.000,
148         "2n-clx": 2.300,
149         "2n-icx": 2.600,
150         "2n-skx": 2.500,
151         "2n-tx2": 2.500,
152         "2n-zn2": 2.900,
153         "3n-alt": 3.000,
154         "3n-aws": 1.000,
155         "3n-dnv": 2.000,
156         "3n-icx": 2.600,
157         "3n-skx": 2.500,
158         "3n-tsh": 2.200,
159         "3n-snr": 2.200
160     }
161
162     ############################################################################
163     # General, plots constants.
164
165     PLOT_COLORS = (
166         "#1A1110", "#DA2647", "#214FC6", "#01786F", "#BD8260", "#FFD12A",
167         "#A6E7FF", "#738276", "#C95A49", "#FC5A8D", "#CEC8EF", "#391285",
168         "#6F2DA8", "#FF878D", "#45A27D", "#FFD0B9", "#FD5240", "#DB91EF",
169         "#44D7A8", "#4F86F7", "#84DE02", "#FFCFF1", "#614051"
170     )
171
172     # Trending, anomalies.
173     ANOMALY_COLOR = {
174         "regression": 0.0,
175         "normal": 0.5,
176         "progression": 1.0
177     }
178
179     COLORSCALE_TPUT = [
180         [0.00, "red"],
181         [0.33, "red"],
182         [0.33, "white"],
183         [0.66, "white"],
184         [0.66, "green"],
185         [1.00, "green"]
186     ]
187
188     TICK_TEXT_TPUT = ["Regression", "Normal", "Progression"]
189
190     COLORSCALE_LAT = [
191         [0.00, "green"],
192         [0.33, "green"],
193         [0.33, "white"],
194         [0.66, "white"],
195         [0.66, "red"],
196         [1.00, "red"]
197     ]
198
199     TICK_TEXT_LAT = ["Progression", "Normal", "Regression"]
200
201     # Access to the results.
202     VALUE = {
203         "mrr": "result_receive_rate_rate_avg",
204         "ndr": "result_ndr_lower_rate_value",
205         "pdr": "result_pdr_lower_rate_value",
206         "pdr-lat": "result_latency_forward_pdr_50_avg"
207     }
208
209     VALUE_ITER = {
210         "mrr": "result_receive_rate_rate_values",
211         "ndr": "result_ndr_lower_rate_value",
212         "pdr": "result_pdr_lower_rate_value",
213         "pdr-lat": "result_latency_forward_pdr_50_avg"
214     }
215
216     UNIT = {
217         "mrr": "result_receive_rate_rate_unit",
218         "ndr": "result_ndr_lower_rate_unit",
219         "pdr": "result_pdr_lower_rate_unit",
220         "pdr-lat": "result_latency_forward_pdr_50_unit"
221     }
222
223     # Latencies.
224     LAT_HDRH = (  # Do not change the order
225         "result_latency_forward_pdr_0_hdrh",
226         "result_latency_reverse_pdr_0_hdrh",
227         "result_latency_forward_pdr_10_hdrh",
228         "result_latency_reverse_pdr_10_hdrh",
229         "result_latency_forward_pdr_50_hdrh",
230         "result_latency_reverse_pdr_50_hdrh",
231         "result_latency_forward_pdr_90_hdrh",
232         "result_latency_reverse_pdr_90_hdrh",
233     )
234
235     # This value depends on latency stream rate (9001 pps) and duration (5s).
236     # Keep it slightly higher to ensure rounding errors to not remove tick mark.
237     PERCENTILE_MAX = 99.999501
238
239     GRAPH_LAT_HDRH_DESC = {
240         "result_latency_forward_pdr_0_hdrh": "No-load.",
241         "result_latency_reverse_pdr_0_hdrh": "No-load.",
242         "result_latency_forward_pdr_10_hdrh": "Low-load, 10% PDR.",
243         "result_latency_reverse_pdr_10_hdrh": "Low-load, 10% PDR.",
244         "result_latency_forward_pdr_50_hdrh": "Mid-load, 50% PDR.",
245         "result_latency_reverse_pdr_50_hdrh": "Mid-load, 50% PDR.",
246         "result_latency_forward_pdr_90_hdrh": "High-load, 90% PDR.",
247         "result_latency_reverse_pdr_90_hdrh": "High-load, 90% PDR."
248     }
249
250     ############################################################################
251     # News.
252
253     # The title.
254     NEWS_TITLE = "Failures and Anomalies"
255
256     # The pathname prefix for the application.
257     NEWS_ROUTES_PATHNAME_PREFIX = "/news/"
258
259     # Time period for regressions and progressions.
260     NEWS_TIME_PERIOD = TIME_PERIOD  # [days]
261
262     # Time periods for summary tables.
263     NEWS_LAST = 1  # [days]
264     NEWS_SHORT = 7  # [days]
265     NEWS_LONG = NEWS_TIME_PERIOD  # [days]
266
267     ############################################################################
268     # Report.
269
270     # The title.
271     REPORT_TITLE = "Per Release Performance"
272
273     # The pathname prefix for the application.
274     REPORT_ROUTES_PATHNAME_PREFIX = "/report/"
275
276     # Layout of plot.ly graphs.
277     REPORT_GRAPH_LAYOUT_FILE = "cdash/report/layout.yaml"
278
279     # Default name of downloaded file with selected data.
280     REPORT_DOWNLOAD_FILE_NAME = "iterative_data.csv"
281
282     ############################################################################
283     # Statistics.
284
285     # The title.
286     STATS_TITLE = "Test Job Statistics"
287
288     # The pathname prefix for the application.
289     STATS_ROUTES_PATHNAME_PREFIX = "/stats/"
290
291     # Layout of plot.ly graphs.
292     STATS_GRAPH_LAYOUT_FILE = "cdash/stats/layout.yaml"
293
294     # The default job displayed when the page is loaded first time.
295     STATS_DEFAULT_JOB = "csit-vpp-perf-mrr-daily-master-2n-icx"
296
297     # Default name of downloaded file with selected data.
298     STATS_DOWNLOAD_FILE_NAME = "stats.csv"
299
300     ############################################################################
301     # Trending.
302
303     # The title.
304     TREND_TITLE = "Performance Trending"
305
306     # The pathname prefix for the application.
307     TREND_ROUTES_PATHNAME_PREFIX = "/trending/"
308
309     # Layout of plot.ly graphs.
310     TREND_GRAPH_LAYOUT_FILE = "cdash/trending/layout.yaml"
311
312     # Default name of downloaded file with selected data.
313     TREND_DOWNLOAD_FILE_NAME = "trending_data.csv"