d0fd9a2a958f59685060dfd8108e1d005ea3b7fe
[csit.git] / resources / libraries / robot / hoststack / hoststack.robot
1 # Copyright (c) 2020 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 *** Settings ***
15 | Library | resources.libraries.python.InterfaceUtil
16 | Library | resources.libraries.python.IPUtil
17 | Library | resources.libraries.python.HoststackUtil
18 | Library | resources.libraries.python.NsimUtil
19 | Variables | resources/libraries/python/Constants.py
20 | Resource | resources/libraries/robot/ip/ip4.robot
21 | Resource | resources/libraries/robot/nsim/nsim.robot
22 |
23 | Documentation | L2 keywords to set up VPP to test hoststack.
24
25 *** Variables ***
26 | ${quic_crypto_engine}= | nocrypto
27 | ${quic_fifo_size}= | 4M
28 | &{vpp_hoststack_attr}=
29 | ... | rxq=${None}
30 | ... | phy_cores=${1}
31 | ... | vpp_api_socket=${SOCKSVR_PATH}
32 | ... | api_seg_global_size=2G
33 | ... | api_seg_api_size=1G
34 | ... | sess_evt_q_seg_size=4G
35 | ... | sess_evt_q_length=4000000
36 | ... | sess_prealloc_sess=4000000
37 | ... | sess_v4_sess_tbl_buckets=2000000
38 | ... | sess_v4_sess_tbl_mem=2G
39 | ... | sess_v4_sess_halfopen_buckets=5000000
40 | ... | sess_v4_sess_halfopen_mem=3G
41 | ... | sess_lcl_endpt_tbl_buckets=5000000
42 | ... | sess_lcl_endpt_tbl_mem=3G
43 | &{vpp_echo_server_attr}=
44 | ... | role=server
45 | ... | cfg_vpp_feature=${None}
46 | ... | namespace=default
47 | ... | vpp_api_socket=${vpp_hoststack_attr}[vpp_api_socket]
48 | ... | json_output=json
49 | ... | uri_protocol=quic
50 | ... | uri_ip4_addr=${EMPTY}
51 | ... | uri_port=1234
52 | ... | nclients=1
53 | ... | quic_streams=1
54 | ... | time=sconnect:lastbyte
55 | ... | fifo_size=4M
56 | ... | rx_bytes=0
57 | ... | tx_bytes=0
58 | ... | rx_results_diff=${False}
59 | ... | tx_results_diff=${False}
60 | &{vpp_echo_client_attr}=
61 | ... | role=client
62 | ... | cfg_vpp_feature=${None}
63 | ... | namespace=default
64 | ... | vpp_api_socket=${vpp_hoststack_attr}[vpp_api_socket]
65 | ... | json_output=json
66 | ... | uri_protocol=quic
67 | ... | uri_ip4_addr=${EMPTY}
68 | ... | uri_port=1234
69 | ... | nclients=1
70 | ... | quic_streams=1
71 | ... | time=sconnect:lastbyte
72 | ... | fifo_size=4M
73 | ... | rx_bytes=0
74 | ... | tx_bytes=0
75 | ... | rx_results_diff=${False}
76 | ... | tx_results_diff=${False}
77
78 *** Keywords ***
79 | Set VPP Hoststack Attributes
80 | | [Documentation]
81 | | ... | Set the VPP HostStack attributes in the vpp_hoststack_attr dictionary.
82 | |
83 | | ... | *Arguments:*
84 | | ... | - ${rxq} - Type: int
85 | | ... | - ${phy_cores} - Number of cores for workers Type: int
86 | | ... | - ${vpp_api_socket} - Path to VPP api socket file Type: string
87 | | ... | - ${api_seg_global_size} - Global API segment size Type: string
88 | | ... | - ${api_seg_api_size} - API segment API fifo size Type: string
89 | | ... | - ${sess_evt_q_seg_size} - Session event queue segment size
90 | | ... | Type: string
91 | | ... | - ${sess_evt_q_length} - Session event queue length Type: string
92 | | ... | - ${sess_prealloc_sess} - Number of sessions to preallocate
93 | | ... | Type: string
94 | | ... | - ${sess_v4_sess_tbl_buckets} - Number of IPv4 session table buckets
95 | | ... | Type: string
96 | | ... | - ${sess_v4_sess_tbl_mem} - IPv4 session table memory size
97 | | ... | Type: string
98 | | ... | - ${sess_v4_sess_halfopen_buckets} - Number of IPv4 session
99 | | ... | half open table buckets Type: string
100 | | ... | - ${sess_v4_sess_halfopen_mem} - IPv4 session half open
101 | | ... | table memory size Type: string
102 | | ... | - ${sess_lcl_endpt_tbl_buckets} - Number of session local endpoint
103 | | ... | table buckets Type: string
104 | | ... | - ${sess_lcl_endpt_tbl_mem} - Session local endpoint
105 | | ... | table memory size Type: string
106 | |
107 | | ... | *Example:*
108 | |
109 | | ... | \| Set VPP Hoststack Attributes \| phy_cores=${phy_cores} \|
110 | |
111 | | [Arguments]
112 | | ... | ${rxq}=${vpp_hoststack_attr}[rxq]
113 | | ... | ${phy_cores}=${vpp_hoststack_attr}[phy_cores]
114 | | ... | ${vpp_api_socket}=${vpp_hoststack_attr}[vpp_api_socket]
115 | | ... | ${api_seg_global_size}=${vpp_hoststack_attr}[api_seg_global_size]
116 | | ... | ${api_seg_api_size}=${vpp_hoststack_attr}[api_seg_api_size]
117 | | ... | ${sess_evt_q_seg_size}=${vpp_hoststack_attr}[sess_evt_q_seg_size]
118 | | ... | ${sess_evt_q_length}=${vpp_hoststack_attr}[sess_evt_q_length]
119 | | ... | ${sess_prealloc_sess}=${vpp_hoststack_attr}[sess_prealloc_sess]
120 | | ... | ${sess_v4_sess_tbl_buckets}=${vpp_hoststack_attr}[sess_v4_sess_tbl_buckets]
121 | | ... | ${sess_v4_sess_tbl_mem}=${vpp_hoststack_attr}[sess_v4_sess_tbl_mem]
122 | | ... | ${sess_v4_sess_halfopen_buckets}=${vpp_hoststack_attr}[sess_v4_sess_halfopen_buckets]
123 | | ... | ${sess_v4_sess_halfopen_mem}=${vpp_hoststack_attr}[sess_v4_sess_halfopen_mem]
124 | | ... | ${sess_lcl_endpt_tbl_buckets}=${vpp_hoststack_attr}[sess_lcl_endpt_tbl_buckets]
125 | | ... | ${sess_lcl_endpt_tbl_mem}=${vpp_hoststack_attr}[sess_lcl_endpt_tbl_mem]
126 | |
127 | | Set To Dictionary | ${vpp_hoststack_attr} | rxq | ${rxq}
128 | | Set To Dictionary | ${vpp_hoststack_attr} | phy_cores | ${phy_cores}
129 | | Set To Dictionary | ${vpp_hoststack_attr}
130 | | ... | vpp_api_socket | ${vpp_api_socket}
131 | | Set To Dictionary | ${vpp_hoststack_attr}
132 | | ... | api_seg_global_size | ${api_seg_global_size}
133 | | Set To Dictionary | ${vpp_hoststack_attr}
134 | | ... | api_seg_api_size | ${api_seg_api_size}
135 | | Set To Dictionary | ${vpp_hoststack_attr}
136 | | ... | sess_evt_q_seg_size | ${sess_evt_q_seg_size}
137 | | Set To Dictionary | ${vpp_hoststack_attr}
138 | | ... | sess_evt_q_length | ${sess_evt_q_length}
139 | | Set To Dictionary | ${vpp_hoststack_attr}
140 | | ... | sess_prealloc_sess | ${sess_prealloc_sess}
141 | | Set To Dictionary | ${vpp_hoststack_attr}
142 | | ... | sess_v4_sess_tbl_buckets | ${sess_v4_sess_tbl_buckets}
143 | | Set To Dictionary | ${vpp_hoststack_attr}
144 | | ... | sess_v4_sess_tbl_mem | ${sess_v4_sess_tbl_mem}
145 | | Set To Dictionary | ${vpp_hoststack_attr}
146 | | ... | sess_v4_sess_halfopen_buckets | ${sess_v4_sess_halfopen_buckets}
147 | | Set To Dictionary | ${vpp_hoststack_attr}
148 | | ... | sess_v4_sess_halfopen_mem | ${sess_v4_sess_halfopen_mem}
149 | | Set To Dictionary | ${vpp_hoststack_attr}
150 | | ... | sess_lcl_endpt_tbl_buckets | ${sess_lcl_endpt_tbl_buckets}
151 | | Set To Dictionary | ${vpp_hoststack_attr}
152 | | ... | sess_lcl_endpt_tbl_mem | ${sess_lcl_endpt_tbl_mem}
153
154 | Set VPP Echo Server Attributes
155 | | [Documentation]
156 | | ... | Set the HostStack vpp_echo test program attributes
157 | | ... | in the vpp_echo_server_attr dictionary.
158 | |
159 | | ... | *Arguments:*
160 | | ... | - ${cfg_vpp_feature} - VPP Feature requiring config Type: string
161 | | ... | - ${namespace} - Namespace Type: string
162 | | ... | - ${nclients} - Number of clients Type: string
163 | | ... | - ${quic_streams} - Number of quic streams Type: string
164 | | ... | - ${fifo_size} - Session Fifo Size Type: integer
165 | | ... | - ${time} - Timing events (start:end) Type: string
166 | | ... | - ${rx_bytes} - Number of Bytes to receive Type: string
167 | | ... | - ${tx_bytes} - Number of Bytes to send Type: string
168 | | ... | - ${rx_results_diff} - Rx Results are different to pass Type: boolean
169 | | ... | - ${tx_results_diff} - Tx Results are different to pass Type: boolean
170 | |
171 | | ... | *Example:*
172 | |
173 | | ... | \| Set VPP Echo Server Attributes \| nclients=${nclients} \|
174 | | ... | \| tx_bytes=${tx_bytes} \|
175 | |
176 | | [Arguments]
177 | | ... | ${cfg_vpp_feature}=${vpp_echo_server_attr}[cfg_vpp_feature]
178 | | ... | ${namespace}=${vpp_echo_server_attr}[namespace]
179 | | ... | ${nclients}=${vpp_echo_server_attr}[nclients]
180 | | ... | ${quic_streams}=${vpp_echo_server_attr}[quic_streams]
181 | | ... | ${time}=${vpp_echo_server_attr}[time]
182 | | ... | ${fifo_size}=${vpp_echo_server_attr}[fifo_size]
183 | | ... | ${rx_bytes}=${vpp_echo_server_attr}[rx_bytes]
184 | | ... | ${tx_bytes}=${vpp_echo_server_attr}[tx_bytes]
185 | | ... | ${rx_results_diff}=${vpp_echo_server_attr}[rx_results_diff]
186 | | ... | ${tx_results_diff}=${vpp_echo_server_attr}[tx_results_diff]
187 | |
188 | | Set To Dictionary | ${vpp_echo_server_attr} | cfg_vpp_feature
189 | | ... | ${cfg_vpp_feature}
190 | | Set To Dictionary | ${vpp_echo_server_attr} | namespace | ${namespace}
191 | | Set To Dictionary | ${vpp_echo_server_attr} | nclients | ${nclients}
192 | | Set To Dictionary | ${vpp_echo_server_attr} | quic_streams | ${quic_streams}
193 | | Set To Dictionary | ${vpp_echo_server_attr} | time | ${time}
194 | | Set To Dictionary | ${vpp_echo_server_attr} | fifo_size | ${fifo_size}
195 | | Set To Dictionary | ${vpp_echo_server_attr} | rx_bytes | ${rx_bytes}
196 | | Set To Dictionary | ${vpp_echo_server_attr} | tx_bytes | ${tx_bytes}
197 | | Set To Dictionary
198 | | ... | ${vpp_echo_server_attr} | rx_results_diff | ${rx_results_diff}
199 | | Set To Dictionary
200 | | ... | ${vpp_echo_server_attr} | tx_results_diff | ${tx_results_diff}
201
202 | Set VPP Echo Client Attributes
203 | | [Documentation]
204 | | ... | Set the HostStack vpp_echo test program attributes
205 | | ... | in the vpp_echo_client_attr dictionary.
206 | |
207 | | ... | *Arguments:*
208 | | ... | - ${cfg_vpp_feature} - VPP Feature requiring config Type: string
209 | | ... | - ${namespace} - Namespace Type: string
210 | | ... | - ${nclients} - Number of clients Type: string
211 | | ... | - ${fifo_size} - Session Fifo Size Type: integer
212 | | ... | - ${time} - Timing events (start:end) Type: string
213 | | ... | - ${rx_bytes} - Number of Bytes to receive Type: string
214 | | ... | - ${tx_bytes} - Number of Bytes to send Type: string
215 | | ... | - ${rx_results_diff} - Rx Results are different to pass Type: boolean
216 | | ... | - ${tx_results_diff} - Tx Results are different to pass Type: boolean
217 | |
218 | | ... | *Example:*
219 | |
220 | | ... | \| Set VPP Echo Client Attributes \| nclients=${nclients} \|
221 | | ... | \| tx_bytes=${tx_bytes} \|
222 | |
223 | | [Arguments]
224 | | ... | ${cfg_vpp_feature}=${vpp_echo_client_attr}[cfg_vpp_feature]
225 | | ... | ${namespace}=${vpp_echo_client_attr}[namespace]
226 | | ... | ${nclients}=${vpp_echo_client_attr}[nclients]
227 | | ... | ${quic_streams}=${vpp_echo_server_attr}[quic_streams]
228 | | ... | ${time}=${vpp_echo_client_attr}[time]
229 | | ... | ${fifo_size}=${vpp_echo_client_attr}[fifo_size]
230 | | ... | ${rx_bytes}=${vpp_echo_client_attr}[rx_bytes]
231 | | ... | ${tx_bytes}=${vpp_echo_client_attr}[tx_bytes]
232 | | ... | ${rx_results_diff}=${vpp_echo_client_attr}[rx_results_diff]
233 | | ... | ${tx_results_diff}=${vpp_echo_client_attr}[tx_results_diff]
234 | |
235 | | Set To Dictionary | ${vpp_echo_client_attr} | cfg_vpp_feature
236 | | ... | ${cfg_vpp_feature}
237 | | Set To Dictionary | ${vpp_echo_client_attr} | namespace | ${namespace}
238 | | Set To Dictionary | ${vpp_echo_client_attr} | nclients | ${nclients}
239 | | Set To Dictionary | ${vpp_echo_client_attr} | quic_streams | ${quic_streams}
240 | | Set To Dictionary | ${vpp_echo_client_attr} | time | ${time}
241 | | Set To Dictionary | ${vpp_echo_client_attr} | fifo_size | ${fifo_size}
242 | | Set To Dictionary | ${vpp_echo_client_attr} | rx_bytes | ${rx_bytes}
243 | | Set To Dictionary | ${vpp_echo_client_attr} | tx_bytes | ${tx_bytes}
244 | | Set To Dictionary
245 | | ... | ${vpp_echo_client_attr} | rx_results_diff | ${rx_results_diff}
246 | | Set To Dictionary
247 | | ... | ${vpp_echo_client_attr} | tx_results_diff | ${tx_results_diff}
248
249 | Run hoststack test program on DUT
250 | | [Documentation]
251 | | ... | Configure IP address on the port, set it up and start the specified
252 | | ... | HostStack test program on the specified DUT.
253 | |
254 | | ... | *Arguments:*
255 | | ... | - ${node} - VPP DUT node Type: Node
256 | | ... | - ${intf} - VPP DUT node interface key Type: string
257 | | ... | - ${ip4_addr} - VPP DUT node interface ip4 address Type: string
258 | | ... | - ${ip4_mask} - VPP DUT node interface ip4 network mask Type: string
259 | | ... | - ${namespace} - Network namespace to run test program in Type: string
260 | | ... | - ${cfg_vpp_feature} - VPP hoststack feature requiring
261 | | ... | additional VPP configuration Type: string
262 | | ... | - ${test_program} - Host Stack test program Type: dict
263 | |
264 | | ... | *Example:*
265 | |
266 | | ... | \| Run hoststack test program on DUT \| ${dut1} \| ${dut1_if1} \|
267 | | ... | \| ${dut1_if1_ip4_addr} \| ${dut1_if1_ip4_mask} \| default \|
268 | | ... | \| quic \| ${vpp_echo_server} \|
269 | |
270 | | [Arguments] | ${node} | ${intf} | ${ip4_addr} | ${ip4_mask}
271 | | | ... | ${namespace} | ${cfg_vpp_feature} | ${test_program}
272 | |
273 | | Run Keyword If | ${vpp_nsim_attr}[output_feature_enable]
274 | | ... | Configure VPP NSIM | ${node} | ${vpp_nsim_attr} | ${intf}
275 | | Run Keyword If | '${cfg_vpp_feature}' != ''
276 | | ... | Additional VPP Config for Feature ${cfg_vpp_feature} | ${node}
277 | | VPP Get Interface Data | ${node}
278 | | Set Interface State | ${node} | ${intf} | up
279 | | VPP Interface Set IP Address | ${node} | ${intf} | ${ip4_addr}
280 | | ... | ${ip4_mask}
281 | | Vpp Node Interfaces Ready Wait | ${node}
282 | | ${hoststack_test_program_pid}= | Start Hoststack Test Program
283 | | ... | ${node} | ${namespace} | ${test_program}
284 | | Return From Keyword | ${hoststack_test_program_pid}
285
286 | Additional VPP Config For Feature quic
287 | | [Documentation]
288 | | ... | Configure VPP quic attributes on the specified DUT.
289 | |
290 | | ... | *Arguments:*
291 | | ... | - ${node} - VPP DUT node Type: Node
292 | |
293 | | [Arguments] | ${node}
294 | |
295 | | Set hoststack quic fifo size | ${node} | ${quic_fifo_size}
296 | | Set hoststack quic crypto engine | ${node} | ${quic_crypto_engine}
297
298 | Configure VPP hoststack attributes on all DUTs
299 | | [Documentation]
300 | | ... | Configure VPP HostStack attributes on all DUTs.
301 | |
302 | | Add worker threads to all DUTs
303 | | ... | ${vpp_hoststack_attr}[phy_cores] | ${vpp_hoststack_attr}[rxq]
304 | | Add DPDK PCI devices to all DUTs
305 | | ${duts}= | Get Matches | ${nodes} | DUT*
306 | | FOR | ${dut} | IN | @{duts}
307 | | | Import Library | resources.libraries.python.VppConfigGenerator
308 | | | ... | WITH NAME | ${dut}
309 | | | Run keyword | ${dut}.Add socksvr | ${vpp_hoststack_attr}[vpp_api_socket]
310 | | | Run keyword | ${dut}.Add api segment global size
311 | | | ... | ${vpp_hoststack_attr}[api_seg_global_size]
312 | | | Run keyword | ${dut}.Add api segment api size
313 | | | ... | ${vpp_hoststack_attr}[api_seg_api_size]
314 | | | Run keyword | ${dut}.Add api segment gid | testuser
315 | | | Run keyword | ${dut}.Add session enable
316 | | | Run keyword | ${dut}.Add session event queues memfd segment
317 | | | Run keyword | ${dut}.Add session event queues segment size
318 | | | ... | ${vpp_hoststack_attr}[sess_evt_q_seg_size]
319 | | | Run keyword | ${dut}.Add session event queue length
320 | | | ... | ${vpp_hoststack_attr}[sess_evt_q_length]
321 | | | Run keyword | ${dut}.Add session preallocated sessions
322 | | | ... | ${vpp_hoststack_attr}[sess_prealloc_sess]
323 | | | Run keyword | ${dut}.Add session v4 session table buckets
324 | | | ... | ${vpp_hoststack_attr}[sess_v4_sess_tbl_buckets]
325 | | | Run keyword | ${dut}.Add session v4 session table memory
326 | | | ... | ${vpp_hoststack_attr}[sess_v4_sess_tbl_mem]
327 | | | Run keyword | ${dut}.Add session v4 halfopen table buckets
328 | | | ... | ${vpp_hoststack_attr}[sess_v4_sess_halfopen_buckets]
329 | | | Run keyword | ${dut}.Add session v4 halfopen table memory
330 | | | ... | ${vpp_hoststack_attr}[sess_v4_sess_halfopen_mem]
331 | | | Run keyword | ${dut}.Add session local endpoints table buckets
332 | | | ... | ${vpp_hoststack_attr}[sess_lcl_endpt_tbl_buckets]
333 | | | Run keyword | ${dut}.Add session local endpoints table memory
334 | | | ... | ${vpp_hoststack_attr}[sess_lcl_endpt_tbl_mem]
335 | | END
336 | | Apply startup configuration on all VPP DUTs
337
338 | Get Test Results From Hoststack VPP Echo Test
339 | | [Documentation]
340 | | ... | Configure IP address on the port, set it up and start the specified
341 | | ... | HostStack test programs on the DUTs. Gather test program
342 | | ... | output and append test results in message.
343 | | ... | Return boolean indicating when no results were available from
344 | | ... | both the server and client test programs.
345 | |
346 | | Set To Dictionary | ${vpp_echo_server_attr} | uri_ip4_addr
347 | | ... | ${dut2_if1_ip4_addr}
348 | | Set To Dictionary | ${vpp_echo_client_attr} | uri_ip4_addr
349 | | ... | ${dut2_if1_ip4_addr}
350 | | Configure VPP Hoststack Attributes on all DUTs
351 | | ${vpp_echo_server}= | Get VPP Echo Command | ${vpp_echo_server_attr}
352 | | ${server_pid}= | Run hoststack test program on DUT
353 | | ... | ${dut2} | ${dut2_if1} | ${dut2_if1_ip4_addr} | ${dut2_if1_ip4_prefix}
354 | | ... | ${vpp_echo_server_attr}[namespace]
355 | | ... | ${vpp_echo_server_attr}[cfg_vpp_feature] | ${vpp_echo_server}
356 | | ${vpp_echo_client}= | Get VPP Echo Command | ${vpp_echo_client_attr}
357 | | ${client_pid}= | Run hoststack test program on DUT
358 | | ... | ${dut1} | ${dut1_if1} | ${dut1_if1_ip4_addr} | ${dut1_if1_ip4_prefix}
359 | | ... | ${vpp_echo_client_attr}[namespace]
360 | | ... | ${vpp_echo_client_attr}[cfg_vpp_feature] | ${vpp_echo_client}
361 | | When Hoststack Test Program Finished | ${dut1} | ${client_pid}
362 | | ${client_no_results} | ${client_output}=
363 | | ... | Analyze hoststack test program output | ${dut1} | Client
364 | | ... | ${vpp_nsim_attr} | ${vpp_echo_client}
365 | | Then Set test message | ${client_output}
366 | | And Hoststack Test Program Finished | ${dut2} | ${server_pid}
367 | | ${server_no_results} | ${server_output}=
368 | | ... | Analyze hoststack test program output | ${dut2} | Server
369 | | ... | ${vpp_nsim_attr} | ${vpp_echo_server}
370 | | Set test message | ${server_output} | append=True
371 | | Run Keyword And Return | No Hoststack Test Program Results
372 | | ... | ${server_no_results} | ${client_no_results}