VAT-to-PAPI: Fix HTTP/TCP tests
[csit.git] / resources / libraries / python / Constants.py
1 # Copyright (c) 2019 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 CSIT."""
15
16
17 class Constants(object):
18     """Constants used in CSIT.
19
20     TODO: Yaml files are easier for humans to edit.
21     Figure out how to set the attributes by parsing a file
22     that works regardless of current working directory.
23     """
24
25     # OpenVPP testing directory location at topology nodes
26     REMOTE_FW_DIR = '/tmp/openvpp-testing'
27
28     # shell scripts location
29     RESOURCES_LIB_SH = 'resources/libraries/bash'
30
31     # Python API provider location
32     RESOURCES_PAPI_PROVIDER = 'resources/tools/papi/vpp_papi_provider.py'
33
34     # vat templates location
35     RESOURCES_TPL_VAT = 'resources/templates/vat'
36
37     # Kubernetes templates location
38     RESOURCES_TPL_K8S = 'resources/templates/kubernetes'
39
40     # KernelVM templates location
41     RESOURCES_TPL_VM = 'resources/templates/vm'
42
43     # Container templates location
44     RESOURCES_TPL_CONTAINER = 'resources/templates/container'
45
46     # HTTP Server www root directory
47     RESOURCES_TP_WRK_WWW = 'resources/traffic_profiles/wrk/www'
48
49     # OpenVPP VAT binary name
50     VAT_BIN_NAME = 'vpp_api_test'
51
52     # VPP service unit name
53     VPP_UNIT = 'vpp'
54
55     # Number of system CPU cores.
56     CPU_CNT_SYSTEM = 1
57
58     # Number of vswitch main thread CPU cores.
59     CPU_CNT_MAIN = 1
60
61     # QEMU binary path
62     QEMU_BIN_PATH = '/usr/bin'
63
64     # QEMU VM kernel image path
65     QEMU_VM_KERNEL = '/opt/boot/vmlinuz'
66
67     # QEMU VM kernel initrd path
68     QEMU_VM_KERNEL_INITRD = '/opt/boot/initrd.img'
69
70     # QEMU VM nested image path
71     QEMU_VM_IMAGE = '/var/lib/vm/vhost-nested.img'
72
73     # QEMU VM DPDK path
74     QEMU_VM_DPDK = '/opt/dpdk-19.02'
75
76     # Docker container SUT image
77     DOCKER_SUT_IMAGE_UBUNTU = 'snergster/csit-sut:latest'
78
79     # Docker container arm SUT image
80     DOCKER_SUT_IMAGE_UBUNTU_ARM = 'snergster/csit-arm-sut:latest'
81
82     # TRex install version
83     TREX_INSTALL_VERSION = '2.54'
84
85     # TRex install directory
86     TREX_INSTALL_DIR = '/opt/trex-core-2.54'
87
88     # Honeycomb directory location at topology nodes:
89     REMOTE_HC_DIR = '/opt/honeycomb'
90
91     # Honeycomb persistence files location
92     REMOTE_HC_PERSIST = '/var/lib/honeycomb/persist'
93
94     # Honeycomb log file location
95     REMOTE_HC_LOG = '/var/log/honeycomb/honeycomb.log'
96
97     # Honeycomb templates location
98     RESOURCES_TPL_HC = 'resources/templates/honeycomb'
99
100     # ODL Client Restconf listener port
101     ODL_PORT = 8181
102
103     # Sysctl kernel.core_pattern
104     KERNEL_CORE_PATTERN = '/tmp/%p-%u-%g-%s-%t-%h-%e.core'
105
106     # Core dump directory
107     CORE_DUMP_DIR = '/tmp'
108
109     # Equivalent to ~0 used in vpp code
110     BITWISE_NON_ZERO = 0xffffffff
111
112     # Default path to VPP API socket.
113     SOCKSVR_PATH = "/run/vpp/api.sock"
114
115     # Global "kill switch" for CRC checking during runtime.
116     CRC_MISMATCH_FAILS_TEST = True
117
118     # Mapping from NIC name to its bps limit.
119     # TODO: Implement logic to lower limits to TG NIC or software. Or PCI.
120     NIC_NAME_TO_LIMIT = {
121         # TODO: Explain why ~40Gbps NICs are using ~25Gbps limit.
122         "Cisco-VIC-1227": 10000000000,
123         "Cisco-VIC-1385": 24500000000,
124         "Intel-X520-DA2": 10000000000,
125         "Intel-X553": 10000000000,
126         "Intel-X710": 10000000000,
127         "Intel-XL710": 24500000000,
128         "Intel-XXV710": 24500000000,
129         "virtual": 100000000,
130     }
131
132     # Suite file names use somewhat more rich (less readable) codes for NICs.
133     NIC_NAME_TO_CODE = {
134         "Cisco-VIC-1227": "10ge2p1vic1227",
135         "Cisco-VIC-1385": "40ge2p1vic1385",
136         "Intel-X520-DA2": "10ge2p1x520",
137         "Intel-X553": "10ge2p1x553",
138         "Intel-X710": "10ge2p1x710",
139         "Intel-XL710": "40ge2p1xl710",
140         "Intel-XXV710": "25ge2p1xxv710",
141     }
142
143     # TODO CSIT-1481: Crypto HW should be read from topology file instead.
144     NIC_NAME_TO_CRYPTO_HW = {
145         "Intel-X553": "HW_C3xxx",
146         "Intel-X710": "HW_DH895xcc",
147         "Intel-XL710": "HW_DH895xcc",
148     }
149
150     PERF_TYPE_TO_KEYWORD = {
151         "mrr": "Traffic should pass with maximum rate",
152         "ndrpdr": "Find NDR and PDR intervals using optimized search",
153         "soak": "Find critical load using PLRsearch",
154     }
155
156     PERF_TYPE_TO_SUITE_DOC_VER = {
157         "mrr" : '''fication:* In MaxReceivedRate tests TG sends traffic\\
158 | ... | at line rate and reports total received packets over trial period.\\''',
159         # TODO: Figure out how to include the full "*[Ver] TG verification:*"
160         # while keeping this readable and without breaking line length limit.
161         "ndrpdr": '''fication:* TG finds and reports throughput NDR (Non Drop\\
162 | ... | Rate) with zero packet loss tolerance and throughput PDR (Partial Drop\\
163 | ... | Rate) with non-zero packet loss tolerance (LT) expressed in percentage\\
164 | ... | of packets transmitted. NDR and PDR are discovered for different\\
165 | ... | Ethernet L2 frame sizes using MLRsearch library.\\''',
166         "soak": '''fication:* TG sends traffic at dynamically computed\\
167 | ... | rate as PLRsearch algorithm gathers data and improves its estimate\\
168 | ... | of a rate at which a prescribed small fraction of packets\\
169 | ... | would be lost. After set time, the serarch stops\\
170 | ... | and the algorithm reports its current estimate.\\''',
171     }
172
173     PERF_TYPE_TO_TEMPLATE_DOC_VER = {
174         "mrr": '''Measure MaxReceivedRate for ${frame_size}B frames\\
175 | | ... | using burst trials throughput test.\\''',
176         "ndrpdr": '''Measure NDR and PDR values using MLRsearch algorithm.\\''',
177         "soak": '''Estimate critical rate using PLRsearch algorithm.\\''',
178     }