C-Dash: Comparison tables - add latency
[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 = {"display": "none"}
86
87     # The element is enabled and visible.
88     STYLE_ENABLED = {"display": "inherit"}
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         "ip6": "IPv6 Routing",
121         "ip4_tunnels": "IPv4 Tunnels",
122         "l2": "L2 Ethernet Switching",
123         "srv6": "SRv6 Routing",
124         "vm_vhost": "VMs vhost-user",
125         "nfv_density-dcr_memif-chain_ipsec": "CNF Service Chains Routing IPSec",
126         "nfv_density-vm_vhost-chain_dot1qip4vxlan":"VNF Service Chains Tunnels",
127         "nfv_density-vm_vhost-chain": "VNF Service Chains Routing",
128         "nfv_density-dcr_memif-pipeline": "CNF Service Pipelines Routing",
129         "nfv_density-dcr_memif-chain": "CNF Service Chains Routing",
130         "hoststack": "Hoststack"
131     }
132
133     # URL style.
134     URL_STYLE = {
135         "background-color": "#d2ebf5",
136         "border-color": "#bce1f1",
137         "color": "#135d7c"
138     }
139
140     ############################################################################
141     # General, normalization constants.
142
143     NORM_FREQUENCY = 2.0  # [GHz]
144     FREQUENCY = {  # [GHz]
145         "1n-aws": 1.000,
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-spr": 2.800,
152         "2n-tx2": 2.500,
153         "2n-zn2": 2.900,
154         "3n-alt": 3.000,
155         "3n-aws": 1.000,
156         "3n-dnv": 2.000,
157         "3n-icx": 2.600,
158         "3n-skx": 2.500,
159         "3n-tsh": 2.200,
160         "3n-snr": 2.200
161     }
162
163     ############################################################################
164     # General, plots constants.
165
166     PLOT_COLORS = (
167         "#1A1110", "#DA2647", "#214FC6", "#01786F", "#BD8260", "#FFD12A",
168         "#A6E7FF", "#738276", "#C95A49", "#FC5A8D", "#CEC8EF", "#391285",
169         "#6F2DA8", "#FF878D", "#45A27D", "#FFD0B9", "#FD5240", "#DB91EF",
170         "#44D7A8", "#4F86F7", "#84DE02", "#FFCFF1", "#614051"
171     )
172
173     # Trending, anomalies.
174     ANOMALY_COLOR = {
175         "regression": 0.0,
176         "normal": 0.5,
177         "progression": 1.0
178     }
179
180     COLORSCALE_TPUT = [
181         [0.00, "red"],
182         [0.33, "red"],
183         [0.33, "white"],
184         [0.66, "white"],
185         [0.66, "green"],
186         [1.00, "green"]
187     ]
188
189     TICK_TEXT_TPUT = ["Regression", "Normal", "Progression"]
190
191     COLORSCALE_LAT = [
192         [0.00, "green"],
193         [0.33, "green"],
194         [0.33, "white"],
195         [0.66, "white"],
196         [0.66, "red"],
197         [1.00, "red"]
198     ]
199
200     TICK_TEXT_LAT = ["Progression", "Normal", "Regression"]
201
202     # Access to the results.
203     VALUE = {
204         "mrr": "result_receive_rate_rate_avg",
205         "ndr": "result_ndr_lower_rate_value",
206         "pdr": "result_pdr_lower_rate_value",
207         "pdr-lat": "result_latency_forward_pdr_50_avg",
208         "hoststack-cps": "result_rate_value",
209         "hoststack-rps": "result_rate_value",
210         "hoststack-bps": "result_bandwidth_value",
211         "hoststack-lat": "result_latency_value"
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         "latency": "result_latency_forward_pdr_50_avg",
220         "hoststack-cps": "result_rate_value",
221         "hoststack-rps": "result_rate_value",
222         "hoststack-bps": "result_bandwidth_value",
223         "hoststack-lat": "result_latency_value"
224     }
225
226     UNIT = {
227         "mrr": "result_receive_rate_rate_unit",
228         "ndr": "result_ndr_lower_rate_unit",
229         "pdr": "result_pdr_lower_rate_unit",
230         "pdr-lat": "result_latency_forward_pdr_50_unit",
231         "latency": "result_latency_forward_pdr_50_unit",
232         "hoststack-cps": "result_rate_unit",
233         "hoststack-rps": "result_rate_unit",
234         "hoststack-bps": "result_bandwidth_unit",
235         "hoststack-lat": "result_latency_unit"
236     }
237
238     # Latencies.
239     LAT_HDRH = (  # Do not change the order
240         "result_latency_forward_pdr_0_hdrh",
241         "result_latency_reverse_pdr_0_hdrh",
242         "result_latency_forward_pdr_10_hdrh",
243         "result_latency_reverse_pdr_10_hdrh",
244         "result_latency_forward_pdr_50_hdrh",
245         "result_latency_reverse_pdr_50_hdrh",
246         "result_latency_forward_pdr_90_hdrh",
247         "result_latency_reverse_pdr_90_hdrh",
248     )
249
250     # This value depends on latency stream rate (9001 pps) and duration (5s).
251     # Keep it slightly higher to ensure rounding errors to not remove tick mark.
252     PERCENTILE_MAX = 99.999501
253
254     GRAPH_LAT_HDRH_DESC = {
255         "result_latency_forward_pdr_0_hdrh": "No-load.",
256         "result_latency_reverse_pdr_0_hdrh": "No-load.",
257         "result_latency_forward_pdr_10_hdrh": "Low-load, 10% PDR.",
258         "result_latency_reverse_pdr_10_hdrh": "Low-load, 10% PDR.",
259         "result_latency_forward_pdr_50_hdrh": "Mid-load, 50% PDR.",
260         "result_latency_reverse_pdr_50_hdrh": "Mid-load, 50% PDR.",
261         "result_latency_forward_pdr_90_hdrh": "High-load, 90% PDR.",
262         "result_latency_reverse_pdr_90_hdrh": "High-load, 90% PDR."
263     }
264
265     ############################################################################
266     # News.
267
268     # The title.
269     NEWS_TITLE = "Failures and Anomalies"
270
271     # The pathname prefix for the application.
272     NEWS_ROUTES_PATHNAME_PREFIX = "/news/"
273
274     # Time period for regressions and progressions.
275     NEWS_TIME_PERIOD = TIME_PERIOD  # [days]
276
277     # Time periods for summary tables.
278     NEWS_LAST = 1  # [days]
279     NEWS_SHORT = 7  # [days]
280     NEWS_LONG = NEWS_TIME_PERIOD  # [days]
281
282     ############################################################################
283     # Report.
284
285     # The title.
286     REPORT_TITLE = "Per Release Performance"
287
288     # The pathname prefix for the application.
289     REPORT_ROUTES_PATHNAME_PREFIX = "/report/"
290
291     # Layout of plot.ly graphs.
292     REPORT_GRAPH_LAYOUT_FILE = "cdash/report/layout.yaml"
293
294     # Default name of downloaded file with selected data.
295     REPORT_DOWNLOAD_FILE_NAME = "iterative_data.csv"
296
297     ############################################################################
298     # Comparisons.
299
300     # The title.
301     COMP_TITLE = "Per Release Performance Comparisons"
302
303     # The pathname prefix for the application.
304     COMP_ROUTES_PATHNAME_PREFIX = "/comparisons/"
305
306     # Default name of downloaded file with selected data.
307     COMP_DOWNLOAD_FILE_NAME = "comparison_data.csv"
308
309     ############################################################################
310     # Statistics.
311
312     # The title.
313     STATS_TITLE = "Test Job Statistics"
314
315     # The pathname prefix for the application.
316     STATS_ROUTES_PATHNAME_PREFIX = "/stats/"
317
318     # Layout of plot.ly graphs.
319     STATS_GRAPH_LAYOUT_FILE = "cdash/stats/layout.yaml"
320
321     # The default job displayed when the page is loaded first time.
322     STATS_DEFAULT_JOB = "csit-vpp-perf-mrr-daily-master-2n-icx"
323
324     # Default name of downloaded file with selected data.
325     STATS_DOWNLOAD_FILE_NAME = "stats.csv"
326
327     ############################################################################
328     # Trending.
329
330     # The title.
331     TREND_TITLE = "Performance Trending"
332
333     # The pathname prefix for the application.
334     TREND_ROUTES_PATHNAME_PREFIX = "/trending/"
335
336     # Layout of plot.ly graphs.
337     TREND_GRAPH_LAYOUT_FILE = "cdash/trending/layout.yaml"
338
339     # Default name of downloaded file with selected data.
340     TREND_DOWNLOAD_FILE_NAME = "trending_data.csv"