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