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