d45adc6cf958b9dac9af2dd2055c3038c8356419
[csit.git] / resources / libraries / robot / performance / performance_utils.robot
1 # Copyright (c) 2021 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 | Collections
16 | Library | resources.libraries.python.topology.Topology
17 | Library | resources.libraries.python.NodePath
18 | Library | resources.libraries.python.PerfUtil
19 | Library | resources.libraries.python.InterfaceUtil
20 | Library | resources.libraries.python.Iperf3
21 | Library | resources.libraries.python.TrafficGenerator
22 | Library | resources.libraries.python.TrafficGenerator.OptimizedSearch
23 | Library | resources.libraries.python.TrafficGenerator.TGDropRateSearchImpl
24 | Library | resources.libraries.python.Trace
25 | Variables | resources/libraries/python/Constants.py
26 | Resource | resources/libraries/robot/performance/performance_actions.robot
27 | Resource | resources/libraries/robot/performance/performance_display.robot
28 | Resource | resources/libraries/robot/performance/performance_vars.robot
29 |
30 | Documentation
31 | ... | Performance suite keywords - utilities to find and verify NDR and PDR.
32 | ... | See performance_vars.robot for values accessed via there.
33
34 *** Variables ***
35 | # Variable holding multiplicator of main heap size. By default it is set to 1
36 | # that means the main heap size will be set to 2G. Some tests may require more
37 | # memory for IP FIB (e.g. nat44det tests with 4M or 16M sessions).
38 | ${heap_size_mult}= | ${1}
39
40 *** Keywords ***
41 | Clear and show runtime counters with running traffic
42 | | [Documentation]
43 | | ... | Start traffic at specified rate then clear runtime counters on all
44 | | ... | DUTs. Wait for specified amount of time and capture runtime counters
45 | | ... | on all DUTs. Finally stop traffic.
46 | |
47 | | ... | TODO: Support resetter if this is not the first trial-ish action?
48 | |
49 | | ... | *Example:*
50 | |
51 | | ... | \| Clear and show runtime counters with running traffic \|
52 | |
53 | | ${ppta} = | Get Packets Per Transaction Aggregated
54 | | ${runtime_duration} = | Get Runtime Duration
55 | | ${runtime_rate} = | Get Runtime Rate
56 | | ${traffic_directions} = | Get Traffic Directions
57 | | ${transaction_duration} = | Get Transaction Duration
58 | | ${transaction_scale} = | Get Transaction Scale
59 | | ${transaction_type} = | Get Transaction Type
60 | | ${use_latency} = | Get Use Latency
61 | | # Duration of -1 means we will stop traffic manually.
62 | | Send traffic on tg
63 | | ... | duration=${-1}
64 | | ... | rate=${runtime_rate}
65 | | ... | frame_size=${frame_size}
66 | | ... | traffic_profile=${traffic_profile}
67 | | ... | async_call=${True}
68 | | ... | ppta=${ppta}
69 | | ... | use_latency=${use_latency}
70 | | ... | traffic_directions=${traffic_directions}
71 | | ... | transaction_duration=${transaction_duration}
72 | | ... | transaction_scale=${transaction_scale}
73 | | ... | transaction_type=${transaction_type}
74 | | ... | duration_limit=${0.0}
75 | | FOR | ${action} | IN | @{pre_run_stats}
76 | | | Run Keyword | Additional Statistics Action For ${action}
77 | | END
78 | | Sleep | ${runtime_duration}
79 | | FOR | ${action} | IN | @{post_run_stats}
80 | | | Run Keyword | Additional Statistics Action For ${action}
81 | | END
82 | | Stop traffic on tg
83
84 | Find critical load using PLRsearch
85 | | [Documentation]
86 | | ... | Find boundaries for troughput (of hardcoded target loss ratio)
87 | | ... | using PLRsearch algorithm.
88 | | ... | Display results as formatted test message.
89 | | ... | Fail if computed lower bound is 110% of the minimal rate or less.
90 | | ... | Input rates are understood as uni-directional,
91 | | ... | reported result contains aggregate rates.
92 | | ... | Currently, the min_rate value is hardcoded to match test teardowns.
93 | | ... | Call \${resetter} (if defined) to reset DUT state before each trial.
94 | |
95 | | ... | *Test (or broader scope) variables read:*
96 | | ... | - traffic_profile - Name of module defining traffc for measurements.
97 | | ... | Type: string
98 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
99 | | ... | string
100 | | ... | - max_rate - Calculated unidirectional maximal transmit rate [pps].
101 | | ... | Type: float
102 | |
103 | | ... | *Example:*
104 | |
105 | | ... | \| Find critical load using PLR search \|
106 | |
107 | | # Get values via performance_vars.
108 | | ${max_rate} = | Get Max Rate
109 | | ${min_rate} = | Get Min Rate
110 | | ${ppta} = | Get Packets Per Transaction Aggregated
111 | | ${resetter} = | Get Resetter
112 | | ${traffic_directions} = | Get Traffic Directions
113 | | ${transaction_duration} = | Get Transaction Duration
114 | | ${transaction_scale} = | Get Transaction Scale
115 | | ${transaction_type} = | Get Transaction Type
116 | | ${use_latency} = | Get Use Latency
117 | | ${average} | ${stdev} = | Perform soak search
118 | | ... | frame_size=${frame_size}
119 | | ... | traffic_profile=${traffic_profile}
120 | | ... | minimum_transmit_rate=${min_rate}
121 | | ... | maximum_transmit_rate=${max_rate}
122 | | ... | plr_target=${1e-7}
123 | | ... | tdpt=${0.1}
124 | | ... | initial_count=${50}
125 | | ... | ppta=${ppta}
126 | | ... | resetter=${resetter}
127 | | ... | timeout=${1800.0}
128 | | ... | trace_enabled=${False}
129 | | ... | traffic_directions=${traffic_directions}
130 | | ... | transaction_scale=${transaction_scale}
131 | | ... | transaction_duration=${transaction_duration}
132 | | ... | transaction_type=${transaction_type}
133 | | ... | use_latency=${use_latency}
134 | | ${lower} | ${upper} = | Display result of soak search
135 | | ... | ${average} | ${stdev}
136 | | Set Test Variable | \${rate for teardown} | ${lower}
137 | | Should Not Be True | 1.1 * ${min_rate} > ${lower}
138 | | ... | Lower bound ${lower} too small for unidirectional minimum ${min_rate}.
139
140 | Find NDR and PDR intervals using optimized search
141 | | [Documentation]
142 | | ... | Find boundaries for RFC2544 compatible NDR and PDR values
143 | | ... | using an optimized search algorithm.
144 | | ... | Display findings as a formatted test message.
145 | | ... | Fail if a resulting lower bound has too high loss fraction.
146 | | ... | Input rates are understood as uni-directional,
147 | | ... | reported result contains aggregate rates.
148 | | ... | Additional latency measurements are performed for smaller loads,
149 | | ... | even if latency stream is disabled in search. Their results
150 | | ... | are also displayed.
151 | | ... | Finally, two measurements for runtime stats are done (not displayed).
152 | | ... | Currently, the min_rate value is hardcoded to 90kpps,
153 | | ... | allowing measurement at 10% of the discovered rate
154 | | ... | without breaking latency streams.
155 | | ... | Call \${resetter} (if defined) to reset DUT state before each trial.
156 | |
157 | | ... | *Test (or broader scope) variables read:*
158 | | ... | - traffic_profile - Name of module defining traffc for measurements.
159 | | ... | Type: string
160 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
161 | | ... | string
162 | | ... | - max_rate - Calculated maximal transmit rate [tps].
163 | | ... | Type: float
164 | | ... | - resetter - Callable to reset DUT state before each trial.
165 | | ... | - transaction_scale - Number of ASTF transaction (zero if unlimited).
166 | | ... | - transaction_type - String identifier to determine how to count
167 | | ... | transactions. Default is "packet".
168 | | ... | - disable_latency - If true, skip anything related to latency.
169 | | ... | Useful if transaction_scale is high and TPS is low. Default: false.
170 | |
171 | | ... | *Example:*
172 | |
173 | | ... | \| Find NDR and PDR intervals using optimized search \|
174 | |
175 | | # Get values via performance_vars.
176 | | ${disable_latency} = | Get Disable Latency
177 | | ${max_rate} = | Get Max Rate
178 | | ${min_rate} = | Get Min Rate
179 | | # \${packet_loss_ratio} is used twice so it is worth a variable.
180 | | ${packet_loss_ratio} = | Get Packet Loss Ratio
181 | | ${ppta} = | Get Packets Per Transaction Aggregated
182 | | ${resetter} = | Get Resetter
183 | | ${traffic_directions} = | Get Traffic Directions
184 | | ${transaction_duration} = | Get Transaction Duration
185 | | ${transaction_scale} = | Get Transaction Scale
186 | | ${transaction_type} = | Get Transaction Type
187 | | ${use_latency} = | Get Use Latency
188 | | ${result} = | Perform optimized ndrpdr search
189 | | ... | frame_size=${frame_size}
190 | | ... | traffic_profile=${traffic_profile}
191 | | ... | minimum_transmit_rate=${min_rate}
192 | | ... | maximum_transmit_rate=${max_rate}
193 | | ... | packet_loss_ratio=${packet_loss_ratio}
194 | | ... | final_relative_width=${0.005}
195 | | ... | final_trial_duration=${30.0}
196 | | ... | initial_trial_duration=${1.0}
197 | | ... | number_of_intermediate_phases=${2}
198 | | ... | timeout=${720.0}
199 | | ... | doublings=${2}
200 | | ... | ppta=${ppta}
201 | | ... | resetter=${resetter}
202 | | ... | traffic_directions=${traffic_directions}
203 | | ... | transaction_duration=${transaction_duration}
204 | | ... | transaction_scale=${transaction_scale}
205 | | ... | transaction_type=${transaction_type}
206 | | ... | use_latency=${use_latency}
207 | | Display result of NDRPDR search | ${result}
208 | | Check NDRPDR interval validity | ${result.pdr_interval}
209 | | ... | ${packet_loss_ratio}
210 | | Check NDRPDR interval validity | ${result.ndr_interval}
211 | | ${pdr} = | Set Variable | ${result.pdr_interval.measured_low.target_tr}
212 | | ${ndr} = | Set Variable | ${result.ndr_interval.measured_low.target_tr}
213 | | # We expect NDR and PDR to have different-looking stats.
214 | | Send traffic at specified rate
215 | | ... | rate=${pdr}
216 | | ... | trial_duration=${1.0}
217 | | ... | trial_multiplicity=${1}
218 | | ... | use_latency=${use_latency}
219 | | ... | duration_limit=${1.0}
220 | | Run Keyword If | ${ndr} != ${pdr}
221 | | ... | Send traffic at specified rate
222 | | ... | rate=${ndr}
223 | | ... | trial_duration=${1.0}
224 | | ... | trial_multiplicity=${1}
225 | | ... | use_latency=${use_latency}
226 | | ... | duration_limit=${1.0}
227 | | Return From Keyword If | ${disable_latency}
228 | | ${rate} = | Evaluate | 0.9 * ${pdr}
229 | | Measure and show latency at specified rate | Latency at 90% PDR: | ${rate}
230 | | ${rate} = | Evaluate | 0.5 * ${pdr}
231 | | Measure and show latency at specified rate | Latency at 50% PDR: | ${rate}
232 | | ${rate} = | Evaluate | 0.1 * ${pdr}
233 | | Measure and show latency at specified rate | Latency at 10% PDR: | ${rate}
234 | | Measure and show latency at specified rate | Latency at 0% PDR: | ${0.0}
235
236 | Find Throughput Using MLRsearch
237 | | [Documentation]
238 | | ... | Find and return lower bound NDR (zero PLR)
239 | | ... | aggregate throughput using MLRsearch algorithm.
240 | | ... | Input rates are understood as uni-directional.
241 | | ... | Currently, the min_rate value is hardcoded to match test teardowns.
242 | | ... | Call \${resetter} (if defined) to reset DUT state before each trial.
243 | |
244 | | ... | *Test (or broader scope) variables read:*
245 | | ... | - traffic_profile - Name of module defining traffc for measurements.
246 | | ... | Type: string
247 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
248 | | ... | string
249 | | ... | - max_rate - Calculated maximal transmit rate [tps].
250 | | ... | Type: float
251 | | ... | - resetter - Callable to reset DUT state before each trial.
252 | | ... | - transaction_scale - Number of ASTF transaction (zero if unlimited).
253 | | ... | - transaction_type - String identifier to determine how to count
254 | | ... | transactions. Default is "packet".
255 | |
256 | | ... | *Returns:*
257 | | ... | - Lower bound for bi-directional throughput at given PLR. Type: float
258 | |
259 | | ... | *Example:*
260 | |
261 | | ... | \| \${throughpt}= \| Find Throughput Using MLRsearch \|
262 | |
263 | | ${max_rate} = | Get Max Rate
264 | | ${min_rate} = | Get Min Rate
265 | | ${ppta} = | Get Packets Per Transaction Aggregated
266 | | ${resetter} = | Get Resetter
267 | | ${traffic_directions} = | Get Traffic Directions
268 | | ${transaction_duration} = | Get Transaction Duration
269 | | ${transaction_scale} = | Get Transaction Scale
270 | | ${transaction_type} = | Get Transaction Type
271 | | ${use_latency} = | Get Use Latency
272 | | ${result} = | Perform optimized ndrpdr search
273 | | ... | frame_size=${frame_size}
274 | | ... | traffic_profile=${traffic_profile}
275 | | ... | minimum_transmit_rate=${min_rate}
276 | | ... | maximum_transmit_rate=${max_rate}
277 | | ... | packet_loss_ratio=${0.0}
278 | | ... | final_relative_width=${0.001}
279 | | ... | final_trial_duration=${10.0}
280 | | ... | initial_trial_duration=${1.0}
281 | | ... | number_of_intermediate_phases=${1}
282 | | ... | timeout=${720}
283 | | ... | doublings=${2}
284 | | ... | ppta=${ppta}
285 | | ... | resetter=${resetter}
286 | | ... | traffic_directions=${traffic_directions}
287 | | ... | transaction_duration=${transaction_duration}
288 | | ... | transaction_scale=${transaction_scale}
289 | | ... | transaction_type=${transaction_type}
290 | | ... | use_latency=${use_latency}
291 | | Check NDRPDR interval validity | ${result.pdr_interval}
292 | | ... | ${0.0}
293 | | Return From Keyword | ${result.pdr_interval.measured_low.target_tr}
294
295 | Measure and show latency at specified rate
296 | | [Documentation]
297 | | ... | Send traffic at specified rate, single trial.
298 | | ... | Extract latency information and append it to text message.
299 | | ... | The rate argument is int, so should not include "pps".
300 | | ... | If the given rate is too low, a safe value is used instead.
301 | | ... | Call \${resetter} (if defined) to reset DUT state before each trial.
302 | |
303 | | ... | *Arguments:*
304 | | ... | - message_prefix - Preface to test message addition. Type: string
305 | | ... | - rate - Rate [tps] for sending packets.
306 | | ... | Type: float
307 | |
308 | | ... | *Example:*
309 | |
310 | | ... | \| Measure and show latency at specified rate \| Latency at 90% NDR \
311 | | ... | \| ${10000000} \|
312 | |
313 | | [Arguments] | ${message_prefix} | ${rate}
314 | |
315 | | ${min_rate} = | Get Min Rate
316 | | ${ppta} = | Get Packets Per Transaction Aggregated
317 | | ${real_rate} = | Evaluate | max(${rate}, ${min_rate})
318 | | ${traffic_directions} = | Get Traffic Directions
319 | | ${transaction_duration} = | Get Transaction Duration
320 | | ${transaction_scale} = | Get Transaction Scale
321 | | ${transaction_type} = | Get Transaction Type
322 | | Call Resetter
323 | | Send traffic on tg
324 | | ... | duration=${PERF_TRIAL_LATENCY_DURATION}
325 | | ... | rate=${real_rate}
326 | | ... | frame_size=${frame_size}
327 | | ... | traffic_profile=${traffic_profile}
328 | | ... | async_call=${False}
329 | | ... | duration_limit=${PERF_TRIAL_LATENCY_DURATION}
330 | | ... | ppta=${ppta}
331 | | ... | traffic_directions=${traffic_directions}
332 | | ... | transaction_duration=${transaction_duration}
333 | | ... | transaction_scale=${transaction_scale}
334 | | ... | transaction_type=${transaction_type}
335 | | ... | use_latency=${True}
336 | | ${latency} = | Get Latency Int
337 | | Set Test Message | ${\n}${message_prefix} ${latency} | append=${True}
338
339 | Send ramp-up traffic
340 | | [Documentation]
341 | | ... | Do nothing unless positive ramp-up duration is specified.
342 | | ... | Else perform one trial with appropriate rate and duration.
343 | | ... | This is useful for tests that set DUT state via traffic.
344 | | ... | Rate has to bee low enough so packets are not lost,
345 | | ... | Duration has to be long enough to set all the state.
346 | | ... | The trial results are discarded.
347 | |
348 | | ... | *Test (or broader scope) variables read:*
349 | | ... | - traffic_profile - Name of module defining traffic for measurements.
350 | | ... | Type: string
351 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
352 | | ... | string
353 | | ... | - ramp_up_duration - Suitable traffic duration [s].
354 | | ... | Type: float
355 | | ... | - ramp_up_rate - Suitable transmit rate [tps].
356 | | ... | Type: float
357 | | ... | - transaction_type - String identifier to determine how to count
358 | | ... | transactions. Default is "packet".
359 | |
360 | | ... | *Example:*
361 | |
362 | | ... | \| Send ramp-up traffic \|
363 | |
364 | | ${ramp_up_duration} = | Get Ramp Up Duration
365 | | Run Keyword Unless | ${ramp_up_duration} > 0.0 | Return From Keyword
366 | | ${ramp_up_rate} = | Get Ramp Up Rate
367 | | ${ppta} = | Get Packets Per Transaction Aggregated
368 | | ${traffic_directions} = | Get Traffic Directions
369 | | ${transaction_duration} = | Get Transaction Duration
370 | | ${transaction_scale} = | Get Transaction Scale
371 | | ${transaction_type} = | Get Transaction Type
372 | | ${use_latency} = | Get Use Latency
373 | | Send traffic on tg
374 | | ... | duration=${ramp_up_duration}
375 | | ... | rate=${ramp_up_rate}
376 | | ... | frame_size=${frame_size}
377 | | ... | traffic_profile=${traffic_profile}
378 | | ... | async_call=${False}
379 | | ... | duration_limit=${0.0}
380 | | ... | ppta=${ppta}
381 | | ... | use_latency=${use_latency}
382 | | ... | traffic_directions=${traffic_directions}
383 | | ... | transaction_duration=${transaction_duration}
384 | | ... | transaction_scale=${transaction_scale}
385 | | ... | transaction_type=${transaction_type}
386
387 | Send traffic at specified rate
388 | | [Documentation]
389 | | ... | Perform a warmup, show runtime counters during it.
390 | | ... | Then send traffic at specified rate, possibly multiple trials.
391 | | ... | Show various DUT stats, optionally also packet trace.
392 | | ... | Return list of measured receive rates.
393 | | ... | Call \${resetter} (if defined) to reset DUT state before each trial.
394 | |
395 | | ... | *Arguments:*
396 | | ... | - trial_duration - Duration of single trial [s]. Type: float
397 | | ... | - rate - Target transmit rate [tps]. Type: float
398 | | ... | Type: string
399 | | ... | - trial_multiplicity - How many trials in this measurement.
400 | | ... | Type: boolean
401 | | ... | - use_latency - Use latency stream in search; default value: False.
402 | | ... | Type: boolean
403 | | ... | - duration_limit - Hard limit for trial duration, overriding duration
404 | | ... | computed from transaction_scale. Default 0.0 means no limit.
405 | |
406 | | ... | *Example:*
407 | |
408 | | ... | \| Send traffic at specified rate \| \${1.0} \| ${4000000.0} \
409 | | ... | \| \${10} \| ${False} \| ${1.0} \|
410 | |
411 | | [Arguments] | ${trial_duration} | ${rate} | ${trial_multiplicity}
412 | | ... | ${use_latency}=${False} | ${duration_limit}=${0.0}
413 | |
414 | | ${ppta} = | Get Packets Per Transaction Aggregated
415 | | ${traffic_directions} = | Get Traffic Directions
416 | | ${transaction_duration} = | Get Transaction Duration
417 | | ${transaction_scale} = | Get Transaction Scale
418 | | ${transaction_type} = | Get Transaction Type
419 | | Set Test Variable | \${rate_for_teardown} | ${rate}
420 | | FOR | ${action} | IN | @{pre_stats}
421 | | | Run Keyword | Additional Statistics Action For ${action}
422 | | END
423 | | ${results} = | Create List
424 | | FOR | ${i} | IN RANGE | ${trial_multiplicity}
425 | | | Call Resetter
426 | | | Send traffic on tg
427 | | | ... | duration=${trial_duration}
428 | | | ... | rate=${rate}
429 | | | ... | frame_size=${frame_size}
430 | | | ... | traffic_profile=${traffic_profile}
431 | | | ... | async_call=${False}
432 | | | ... | duration_limit=${duration_limit}
433 | | | ... | ppta=${ppta}
434 | | | ... | traffic_directions=${traffic_directions}
435 | | | ... | transaction_duration=${transaction_duration}
436 | | | ... | transaction_scale=${transaction_scale}
437 | | | ... | transaction_type=${transaction_type}
438 | | | ... | use_latency=${use_latency}
439 | | | ${result}= | Get Measurement Result
440 | | | # Out of several quantities for aborted traffic (duration stretching),
441 | | | # the approximated receive rate is the best estimate we have.
442 | | | Append To List | ${results} | ${result.approximated_receive_rate}
443 | | END
444 | | FOR | ${action} | IN | @{post_stats}
445 | | | Run Keyword | Additional Statistics Action For ${action}
446 | | END
447 | | Return From Keyword | ${results}
448
449 | Clear and show runtime counters with running iperf3
450 | | [Documentation]
451 | | ... | Start traffic at specified rate then clear runtime counters on all
452 | | ... | DUTs. Wait for specified amount of time and capture runtime counters
453 | | ... | on all DUTs. Finally stop traffic.
454 | |
455 | | ... | *Example:*
456 | |
457 | | ... | \| Clear and show runtime counters with running traffic \|
458 | |
459 | | ${runtime_duration} = | Get Runtime Duration
460 | | ${pids}= | iPerf Client Start Remote Exec
461 | | | ... | ${nodes['${iperf_client_node}']}
462 | | | ... | duration=${-1}
463 | | | ... | rate=${None}
464 | | | ... | frame_size=${None}
465 | | | ... | async_call=True
466 | | | ... | warmup_time=0
467 | | | ... | traffic_directions=${1}
468 | | | ... | namespace=${iperf_client_namespace}
469 | | | ... | udp=${iperf_client_udp}
470 | | | ... | host=${iperf_server_bind}
471 | | | ... | bind=${iperf_client_bind}
472 | | | ... | affinity=${iperf_client_affinity}
473 | | FOR | ${action} | IN | @{pre_run_stats}
474 | | | Run Keyword | Additional Statistics Action For ${action}
475 | | END
476 | | Sleep | ${runtime_duration}
477 | | FOR | ${action} | IN | @{post_run_stats}
478 | | | Run Keyword | Additional Statistics Action For ${action}
479 | | END
480 | | iPerf Client Stop Remote Exec | ${nodes['${iperf_client_node}']} | ${pids}
481
482 | Traffic should pass with maximum rate on iPerf3
483 | | [Documentation]
484 | | ... | Send traffic at maximum rate on iPerf3.
485 | |
486 | | ... | *Arguments:*
487 | | ... | - trial_duration - Duration of single trial [s].
488 | | ... | Type: float
489 | | ... | - trial_multiplicity - How many trials in this measurement.
490 | | ... | Type: integer
491 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic;
492 | | ... | Type: integer
493 | |
494 | | ... | *Example:*
495 | |
496 | | ... | \| Traffic should pass with maximum rate on iPerf3 \| \${1} \| \
497 | | ... | \| \${10.0} \| \${2} \|
498 | |
499 | | [Arguments] | ${trial_duration}=${trial_duration}
500 | | ... | ${trial_multiplicity}=${trial_multiplicity}
501 | | ... | ${traffic_directions}=${1}
502 | |
503 | | ${results}= | Send iPerf3 traffic at specified rate
504 | | ... | ${trial_duration} | ${None} | ${None}
505 | | ... | ${trial_multiplicity} | ${traffic_directions}
506 | | Set Test Message | ${\n}iPerf3 trial results
507 | | Set Test Message | in Gbits per second: ${results}
508 | | ... | append=yes
509
510 | Send iPerf3 traffic at specified rate
511 | | [Documentation]
512 | | ... | Perform a warmup, show runtime counters during it.
513 | | ... | Then send traffic at specified rate, possibly multiple trials.
514 | | ... | Show various DUT stats, optionally also packet trace.
515 | | ... | Return list of measured receive rates.
516 | |
517 | | ... | *Arguments:*
518 | | ... | - trial_duration - Duration of single trial [s].
519 | | ... | Type: float
520 | | ... | - rate - Target aggregate transmit rate [bps] / Bits per second
521 | | ... | Type: float
522 | | ... | - frame_size - L2 Frame Size [B].
523 | | ... | Type: integer or string
524 | | ... | - trial_multiplicity - How many trials in this measurement.
525 | | ... | Type: integer
526 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
527 | | ... | Type: integer
528 | | ... | - extended_debug - True to enable extended debug.
529 | | ... | Type: boolean
530 | |
531 | | ... | *Example:*
532 | |
533 | | ... | \| Send iPerf3 traffic at specified rate \| \${1.0} \| ${4000000.0} \
534 | | ... | \| \${64} \| \${10} \| \${1} \| ${False} \|
535 | |
536 | | [Arguments] | ${trial_duration} | ${rate} | ${frame_size}
537 | | ... | ${trial_multiplicity}=${trial_multiplicity}
538 | | ... | ${traffic_directions}=${1} | ${extended_debug}=${extended_debug}
539 | |
540 | | Set Test Variable | ${extended_debug}
541 | | Set Test Variable | ${rate}
542 | | Set Test Variable | ${traffic_directions}
543 | |
544 | | ${smt_used}= | Is SMT enabled | ${nodes['${iperf_server_node}']['cpuinfo']}
545 | | ${vm_status} | ${value}= | Run Keyword And Ignore Error
546 | | ... | Get Library Instance | vnf_manager
547 | | ${vth}= | Evaluate | (${thr_count_int} + 1)
548 | | ${cpu_skip_cnt}= | Set Variable If | '${vm_status}' == 'PASS'
549 | | ... | ${CPU_CNT_SYSTEM}
550 | | ... | ${${CPU_CNT_SYSTEM} + ${CPU_CNT_MAIN} + ${cpu_count_int} + ${vth}}
551 | |
552 | | Initialize iPerf Server
553 | | ... | ${nodes['${iperf_server_node}']}
554 | | ... | pf_key=${iperf_server_pf_key}
555 | | ... | interface=${iperf_server_interface}
556 | | ... | bind=${iperf_server_bind}
557 | | ... | bind_gw=${iperf_server_bind_gw}
558 | | ... | bind_mask=${iperf_server_bind_mask}
559 | | ... | namespace=${iperf_server_namespace}
560 | | ... | cpu_skip_cnt=${cpu_skip_cnt}
561 | | Run Keyword If | '${iperf_client_namespace}' is not '${None}'
562 | | ... | Set Linux Interface IP
563 | | ... | ${nodes['${iperf_client_node}']}
564 | | ... | interface=${iperf_client_interface}
565 | | ... | ip_addr=${iperf_client_bind}
566 | | ... | prefix=${iperf_client_bind_mask}
567 | | ... | namespace=${iperf_client_namespace}
568 | | Run Keyword If | '${iperf_client_namespace}' is not '${None}'
569 | | ... | Add Default Route To Namespace
570 | | ... | ${nodes['${iperf_client_node}']}
571 | | ... | namespace=${iperf_client_namespace}
572 | | ... | default_route=${iperf_client_bind_gw}
573 | | ${pre_stats}= | Create List
574 | | ... | clear-show-runtime-with-iperf3
575 | | ... | vpp-clear-stats | vpp-enable-packettrace | vpp-enable-elog
576 | | FOR | ${action} | IN | @{pre_stats}
577 | | | Run Keyword | Additional Statistics Action For ${action}
578 | | END
579 | | ${results} = | Create List
580 | | FOR | ${i} | IN RANGE | ${trial_multiplicity}
581 | | | ${rr} = | iPerf Client Start Remote Exec
582 | | | ... | ${nodes['${iperf_client_node}']}
583 | | | ... | duration=${trial_duration}
584 | | | ... | rate=${rate}
585 | | | ... | frame_size=${frame_size}
586 | | | ... | async_call=False
587 | | | ... | warmup_time=0
588 | | | ... | traffic_directions=${traffic_directions}
589 | | | ... | namespace=${iperf_client_namespace}
590 | | | ... | udp=${iperf_client_udp}
591 | | | ... | host=${iperf_server_bind}
592 | | | ... | bind=${iperf_client_bind}
593 | | | ... | affinity=${iperf_client_affinity}
594 | | | ${conv} = | Convert To Number | ${rr['sum_received']['bits_per_second']}
595 | | | ${conv} = | Evaluate | ${conv} / ${1000} / ${1000} / ${1000}
596 | | | ${conv} = | Evaluate | "{:.3f}".format(${conv})
597 | | | Append To List
598 | | | ... | ${results} | ${conv}
599 | | END
600 | | FOR | ${action} | IN | @{post_stats}
601 | | | Run Keyword | Additional Statistics Action For ${action}
602 | | END
603 | | Return From Keyword | ${results}
604
605 | Start Traffic on Background
606 | | [Documentation]
607 | | ... | Start traffic at specified rate then return control to Robot.
608 | | ... | This keyword is useful if the test needs to do something
609 | | ... | while traffic is running.
610 | |
611 | | ... | *Test (or broader scope) variables read:*
612 | | ... | - traffic_profile - Name of module defining traffc for measurements.
613 | | ... | Type: string
614 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
615 | | ... | string
616 | | ... | *Arguments:*
617 | | ... | - rate - Rate [tps] for sending packets.
618 | | ... | Type: float
619 | |
620 | | ... | *Example:*
621 | |
622 | | ... | \| Start Traffic on Background \| ${4000000.0} \|
623 | |
624 | | [Arguments] | ${rate}
625 | |
626 | | ${ppta} = | Get Packets Per Transaction Aggregated
627 | | ${traffic_directions} = | Get Traffic Directions
628 | | ${transaction_duration} = | Get Transaction Duration
629 | | ${transaction_scale} = | Get Transaction Scale
630 | | ${transaction_type} = | Get Transaction Type
631 | | ${use_latency} = | Get Use Latency
632 | | Call Resetter
633 | | # Duration of -1 means we will stop traffic manually.
634 | | Send traffic on tg
635 | | ... | duration=${-1}
636 | | ... | rate=${rate}
637 | | ... | frame_size=${frame_size}
638 | | ... | traffic_profile=${traffic_profile}
639 | | ... | async_call=${True}
640 | | ... | duration_limit=${0.0}
641 | | ... | ppta=${ppta}
642 | | ... | traffic_directions=${traffic_directions}
643 | | ... | transaction_duration=${transaction_duration}
644 | | ... | transaction_scale=${transaction_scale}
645 | | ... | transaction_type=${transaction_type}
646 | | ... | use_latency=${use_latency}
647
648 | Stop Running Traffic
649 | | [Documentation]
650 | | ... | Stop the running traffic, return measurement result.
651 | | ... | For bidirectional traffic, the reported values are bi-directional.
652 | |
653 | | ... | *Returns:*
654 | | ... | - Measurement result. Type: ReceiveRateMeasurement
655 | |
656 | | ... | *Example:*
657 | |
658 | | ... | \${result}= \| Stop Running Traffic \|
659 | |
660 | | ${result}= | Stop traffic on tg
661 | | Return From Keyword | ${result}
662
663 | Traffic should pass with maximum rate
664 | | [Documentation]
665 | | ... | Send traffic at maximum rate.
666 | | ... | Call \${resetter} (if defined) to reset DUT state before each trial.
667 | | ... | Fail if no packets were forwarded.
668 | |
669 | | ... | *Test (or broader scope) variables read:*
670 | | ... | - traffic_profile - Name of module defining traffic for measurements.
671 | | ... | Type: string
672 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
673 | | ... | string
674 | | ... | - max_rate - Calculated maximal transmit rate [tps].
675 | | ... | Type: float
676 | | ... | - transaction_type - String identifier to determine how to count
677 | | ... | transactions. Default is "packet".
678 | |
679 | | ... | *Example:*
680 | |
681 | | ... | \| Traffic should pass with maximum rate \|
682 | |
683 | | ${max_rate} = | Get Max Rate
684 | | ${transaction_type} = | Get Transaction Type
685 | | ${trial_duration} = | Get Mrr Trial Duration
686 | | ${trial_multiplicity} = | Get Mrr Trial Multiplicity
687 | | ${use_latency} = | Get Use Latency
688 | | # The following also sets \${rate_for_teardown}
689 | | ${results} = | Send traffic at specified rate
690 | | ... | rate=${max_rate}
691 | | ... | trial_duration=${trial_duration}
692 | | ... | trial_multiplicity=${trial_multiplicity}
693 | | ... | use_latency=${use_latency}
694 | | ... | duration_limit=${0.0}
695 | | ${unit} = | Set Variable If | """_cps""" in """${transaction_type}"""
696 | | ... | estimated connections per second | packets per second
697 | | Set Test Message | ${\n}Maximum Receive Rate trial results
698 | | Set Test Message | in ${unit}: ${results}
699 | | ... | append=yes
700 | | Fail if no traffic forwarded