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