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