9a1de5cc776b697ff1596707f6d852b85af4976f
[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 unidirectional, in transaction per second.
91 | | ... | Reported result may contain aggregate pps rates, depending on test.
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 unidirectional, in transaction per second.
147 | | ... | Reported result may contain aggregate pps rates, depending on test.
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 unidirectional 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 | | ... | throughput using MLRsearch algorithm.
240 | | ... | Input and output rates are understood as uni-directional, in tps.
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 unidirectional 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 uni-directional tps throughput at given PLR.
258 | | ... | Type: float
259 | |
260 | | ... | *Example:*
261 | |
262 | | ... | \| \${throughpt}= \| Find Throughput Using MLRsearch \|
263 | |
264 | | ${max_rate} = | Get Max Rate
265 | | ${min_rate} = | Get Min Rate
266 | | ${ppta} = | Get Packets Per Transaction Aggregated
267 | | ${resetter} = | Get Resetter
268 | | ${traffic_directions} = | Get Traffic Directions
269 | | ${transaction_duration} = | Get Transaction Duration
270 | | ${transaction_scale} = | Get Transaction Scale
271 | | ${transaction_type} = | Get Transaction Type
272 | | ${use_latency} = | Get Use Latency
273 | | ${result} = | Perform optimized ndrpdr search
274 | | ... | frame_size=${frame_size}
275 | | ... | traffic_profile=${traffic_profile}
276 | | ... | minimum_transmit_rate=${min_rate}
277 | | ... | maximum_transmit_rate=${max_rate}
278 | | ... | packet_loss_ratio=${0.0}
279 | | ... | final_relative_width=${0.001}
280 | | ... | final_trial_duration=${10.0}
281 | | ... | initial_trial_duration=${1.0}
282 | | ... | number_of_intermediate_phases=${1}
283 | | ... | timeout=${720}
284 | | ... | doublings=${2}
285 | | ... | ppta=${ppta}
286 | | ... | resetter=${resetter}
287 | | ... | traffic_directions=${traffic_directions}
288 | | ... | transaction_duration=${transaction_duration}
289 | | ... | transaction_scale=${transaction_scale}
290 | | ... | transaction_type=${transaction_type}
291 | | ... | use_latency=${use_latency}
292 | | Check NDRPDR interval validity | ${result.pdr_interval}
293 | | ... | ${0.0}
294 | | Return From Keyword | ${result.pdr_interval.measured_low.target_tr}
295
296 | Measure and show latency at specified rate
297 | | [Documentation]
298 | | ... | Send traffic at specified rate, single trial.
299 | | ... | Extract latency information and append it to text message.
300 | | ... | The rate argument is float, so should not include "pps".
301 | | ... | If the given rate is too low, a safe value is used instead.
302 | | ... | Call \${resetter} (if defined) to reset DUT state before each trial.
303 | |
304 | | ... | *Arguments:*
305 | | ... | - message_prefix - Preface to test message addition. Type: string
306 | | ... | - rate - Unidirectional rate [tps] for sending packets.
307 | | ... | Type: float
308 | |
309 | | ... | *Example:*
310 | |
311 | | ... | \| Measure and show latency at specified rate \| Latency at 90% NDR \
312 | | ... | \| ${10000000} \|
313 | |
314 | | [Arguments] | ${message_prefix} | ${rate}
315 | |
316 | | ${min_rate} = | Get Min Rate
317 | | ${ppta} = | Get Packets Per Transaction Aggregated
318 | | ${real_rate} = | Evaluate | max(${rate}, ${min_rate})
319 | | ${traffic_directions} = | Get Traffic Directions
320 | | ${transaction_duration} = | Get Transaction Duration
321 | | ${transaction_scale} = | Get Transaction Scale
322 | | ${transaction_type} = | Get Transaction Type
323 | | Call Resetter
324 | | Send traffic on tg
325 | | ... | duration=${PERF_TRIAL_LATENCY_DURATION}
326 | | ... | rate=${real_rate}
327 | | ... | frame_size=${frame_size}
328 | | ... | traffic_profile=${traffic_profile}
329 | | ... | async_call=${False}
330 | | ... | duration_limit=${PERF_TRIAL_LATENCY_DURATION}
331 | | ... | ppta=${ppta}
332 | | ... | traffic_directions=${traffic_directions}
333 | | ... | transaction_duration=${transaction_duration}
334 | | ... | transaction_scale=${transaction_scale}
335 | | ... | transaction_type=${transaction_type}
336 | | ... | use_latency=${True}
337 | | ${latency} = | Get Latency Int
338 | | Set Test Message | ${\n}${message_prefix} ${latency} | append=${True}
339
340 | Send ramp-up traffic
341 | | [Documentation]
342 | | ... | Do nothing unless positive ramp-up duration is specified.
343 | | ... | Else perform one trial with appropriate rate and duration.
344 | | ... | This is useful for tests that set DUT state via traffic.
345 | | ... | Rate has to bee low enough so packets are not lost,
346 | | ... | Duration has to be long enough to set all the state.
347 | | ... | The trial results are discarded.
348 | |
349 | | ... | *Test (or broader scope) variables read:*
350 | | ... | - traffic_profile - Name of module defining traffic for measurements.
351 | | ... | Type: string
352 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
353 | | ... | string
354 | | ... | - ramp_up_duration - Suitable traffic duration [s].
355 | | ... | Type: float
356 | | ... | - ramp_up_rate - Suitable unidirectional transmit rate [tps].
357 | | ... | Type: float
358 | | ... | - transaction_type - String identifier to determine how to count
359 | | ... | transactions. Default is "packet".
360 | |
361 | | ... | *Example:*
362 | |
363 | | ... | \| Send ramp-up traffic \|
364 | |
365 | | ${ramp_up_duration} = | Get Ramp Up Duration
366 | | Run Keyword Unless | ${ramp_up_duration} > 0.0 | Return From Keyword
367 | | ${ramp_up_rate} = | Get Ramp Up Rate
368 | | ${ppta} = | Get Packets Per Transaction Aggregated
369 | | ${traffic_directions} = | Get Traffic Directions
370 | | ${transaction_duration} = | Get Transaction Duration
371 | | ${transaction_scale} = | Get Transaction Scale
372 | | ${transaction_type} = | Get Transaction Type
373 | | ${use_latency} = | Get Use Latency
374 | | Send traffic on tg
375 | | ... | duration=${ramp_up_duration}
376 | | ... | rate=${ramp_up_rate}
377 | | ... | frame_size=${frame_size}
378 | | ... | traffic_profile=${traffic_profile}
379 | | ... | async_call=${False}
380 | | ... | duration_limit=${0.0}
381 | | ... | ppta=${ppta}
382 | | ... | use_latency=${use_latency}
383 | | ... | traffic_directions=${traffic_directions}
384 | | ... | transaction_duration=${transaction_duration}
385 | | ... | transaction_scale=${transaction_scale}
386 | | ... | transaction_type=${transaction_type}
387
388 | Send traffic at specified rate
389 | | [Documentation]
390 | | ... | Perform a warmup, show runtime counters during it.
391 | | ... | Then send traffic at specified rate, possibly multiple trials.
392 | | ... | Show various DUT stats, optionally also packet trace.
393 | | ... | Return list of measured receive rates.
394 | | ... | Call \${resetter} (if defined) to reset DUT state before each trial.
395 | |
396 | | ... | *Arguments:*
397 | | ... | - trial_duration - Duration of single trial [s]. Type: float
398 | | ... | - rate - Target unidirectional transmit rate [tps]. Type: float
399 | | ... | Type: string
400 | | ... | - trial_multiplicity - How many trials in this measurement.
401 | | ... | Type: boolean
402 | | ... | - use_latency - Use latency stream in search; default value: False.
403 | | ... | Type: boolean
404 | | ... | - duration_limit - Hard limit for trial duration, overriding duration
405 | | ... | computed from transaction_scale. Default 0.0 means no limit.
406 | |
407 | | ... | *Example:*
408 | |
409 | | ... | \| Send traffic at specified rate \| \${1.0} \| ${4000000.0} \
410 | | ... | \| \${10} \| ${False} \| ${1.0} \|
411 | |
412 | | [Arguments] | ${trial_duration} | ${rate} | ${trial_multiplicity}
413 | | ... | ${use_latency}=${False} | ${duration_limit}=${0.0}
414 | |
415 | | ${ppta} = | Get Packets Per Transaction Aggregated
416 | | ${traffic_directions} = | Get Traffic Directions
417 | | ${transaction_duration} = | Get Transaction Duration
418 | | ${transaction_scale} = | Get Transaction Scale
419 | | ${transaction_type} = | Get Transaction Type
420 | | Set Test Variable | \${rate_for_teardown} | ${rate}
421 | | FOR | ${action} | IN | @{pre_stats}
422 | | | Run Keyword | Additional Statistics Action For ${action}
423 | | END
424 | | ${results} = | Create List
425 | | FOR | ${i} | IN RANGE | ${trial_multiplicity}
426 | | | Call Resetter
427 | | | Send traffic on tg
428 | | | ... | duration=${trial_duration}
429 | | | ... | rate=${rate}
430 | | | ... | frame_size=${frame_size}
431 | | | ... | traffic_profile=${traffic_profile}
432 | | | ... | async_call=${False}
433 | | | ... | duration_limit=${duration_limit}
434 | | | ... | ppta=${ppta}
435 | | | ... | traffic_directions=${traffic_directions}
436 | | | ... | transaction_duration=${transaction_duration}
437 | | | ... | transaction_scale=${transaction_scale}
438 | | | ... | transaction_type=${transaction_type}
439 | | | ... | use_latency=${use_latency}
440 | | | ${result}= | Get Measurement Result
441 | | | # Out of several quantities for aborted traffic (duration stretching),
442 | | | # the approximated receive rate is the best estimate we have.
443 | | | Append To List | ${results} | ${result.approximated_receive_rate}
444 | | END
445 | | FOR | ${action} | IN | @{post_stats}
446 | | | Run Keyword | Additional Statistics Action For ${action}
447 | | END
448 | | Return From Keyword | ${results}
449
450 | Clear and show runtime counters with running iperf3
451 | | [Documentation]
452 | | ... | Start traffic at specified rate then clear runtime counters on all
453 | | ... | DUTs. Wait for specified amount of time and capture runtime counters
454 | | ... | on all DUTs. Finally stop traffic.
455 | |
456 | | ... | *Example:*
457 | |
458 | | ... | \| Clear and show runtime counters with running traffic \|
459 | |
460 | | ${runtime_duration} = | Get Runtime Duration
461 | | ${pids}= | iPerf Client Start Remote Exec
462 | | | ... | ${nodes['${iperf_client_node}']}
463 | | | ... | duration=${-1}
464 | | | ... | rate=${None}
465 | | | ... | frame_size=${None}
466 | | | ... | async_call=True
467 | | | ... | warmup_time=0
468 | | | ... | traffic_directions=${1}
469 | | | ... | namespace=${iperf_client_namespace}
470 | | | ... | udp=${iperf_client_udp}
471 | | | ... | host=${iperf_server_bind}
472 | | | ... | bind=${iperf_client_bind}
473 | | | ... | affinity=${iperf_client_affinity}
474 | | FOR | ${action} | IN | @{pre_run_stats}
475 | | | Run Keyword | Additional Statistics Action For ${action}
476 | | END
477 | | Sleep | ${runtime_duration}
478 | | FOR | ${action} | IN | @{post_run_stats}
479 | | | Run Keyword | Additional Statistics Action For ${action}
480 | | END
481 | | iPerf Client Stop Remote Exec | ${nodes['${iperf_client_node}']} | ${pids}
482
483 | Traffic should pass with maximum rate on iPerf3
484 | | [Documentation]
485 | | ... | Send traffic at maximum rate on iPerf3.
486 | |
487 | | ... | *Arguments:*
488 | | ... | - trial_duration - Duration of single trial [s].
489 | | ... | Type: float
490 | | ... | - trial_multiplicity - How many trials in this measurement.
491 | | ... | Type: integer
492 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic;
493 | | ... | Type: integer
494 | |
495 | | ... | *Example:*
496 | |
497 | | ... | \| Traffic should pass with maximum rate on iPerf3 \| \${1} \| \
498 | | ... | \| \${10.0} \| \${2} \|
499 | |
500 | | [Arguments] | ${trial_duration}=${trial_duration}
501 | | ... | ${trial_multiplicity}=${trial_multiplicity}
502 | | ... | ${traffic_directions}=${1}
503 | |
504 | | ${results}= | Send iPerf3 traffic at specified rate
505 | | ... | ${trial_duration} | ${None} | ${None}
506 | | ... | ${trial_multiplicity} | ${traffic_directions}
507 | | Set Test Message | ${\n}iPerf3 trial results
508 | | Set Test Message | in Gbits per second: ${results}
509 | | ... | append=yes
510
511 | Send iPerf3 traffic at specified rate
512 | | [Documentation]
513 | | ... | Perform a warmup, show runtime counters during it.
514 | | ... | Then send traffic at specified rate, possibly multiple trials.
515 | | ... | Show various DUT stats, optionally also packet trace.
516 | | ... | Return list of measured receive rates.
517 | |
518 | | ... | *Arguments:*
519 | | ... | - trial_duration - Duration of single trial [s].
520 | | ... | Type: float
521 | | ... | - rate - Target aggregate transmit rate [bps] / Bits per second
522 | | ... | Type: float
523 | | ... | - frame_size - L2 Frame Size [B].
524 | | ... | Type: integer or string
525 | | ... | - trial_multiplicity - How many trials in this measurement.
526 | | ... | Type: integer
527 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
528 | | ... | Type: integer
529 | | ... | - extended_debug - True to enable extended debug.
530 | | ... | Type: boolean
531 | |
532 | | ... | *Example:*
533 | |
534 | | ... | \| Send iPerf3 traffic at specified rate \| \${1.0} \| ${4000000.0} \
535 | | ... | \| \${64} \| \${10} \| \${1} \| ${False} \|
536 | |
537 | | [Arguments] | ${trial_duration} | ${rate} | ${frame_size}
538 | | ... | ${trial_multiplicity}=${trial_multiplicity}
539 | | ... | ${traffic_directions}=${1} | ${extended_debug}=${extended_debug}
540 | |
541 | | Set Test Variable | ${extended_debug}
542 | | Set Test Variable | ${rate}
543 | | Set Test Variable | ${traffic_directions}
544 | |
545 | | ${smt_used}= | Is SMT enabled | ${nodes['${iperf_server_node}']['cpuinfo']}
546 | | ${vm_status} | ${value}= | Run Keyword And Ignore Error
547 | | ... | Get Library Instance | vnf_manager
548 | | ${vth}= | Evaluate | (${thr_count_int} + 1)
549 | | ${cpu_skip_cnt}= | Set Variable If | '${vm_status}' == 'PASS'
550 | | ... | ${CPU_CNT_SYSTEM}
551 | | ... | ${${CPU_CNT_SYSTEM} + ${CPU_CNT_MAIN} + ${cpu_count_int} + ${vth}}
552 | |
553 | | Initialize iPerf Server
554 | | ... | ${nodes['${iperf_server_node}']}
555 | | ... | pf_key=${iperf_server_pf_key}
556 | | ... | interface=${iperf_server_interface}
557 | | ... | bind=${iperf_server_bind}
558 | | ... | bind_gw=${iperf_server_bind_gw}
559 | | ... | bind_mask=${iperf_server_bind_mask}
560 | | ... | namespace=${iperf_server_namespace}
561 | | ... | cpu_skip_cnt=${cpu_skip_cnt}
562 | | Run Keyword If | '${iperf_client_namespace}' is not '${None}'
563 | | ... | Set Linux Interface IP
564 | | ... | ${nodes['${iperf_client_node}']}
565 | | ... | interface=${iperf_client_interface}
566 | | ... | ip_addr=${iperf_client_bind}
567 | | ... | prefix=${iperf_client_bind_mask}
568 | | ... | namespace=${iperf_client_namespace}
569 | | Run Keyword If | '${iperf_client_namespace}' is not '${None}'
570 | | ... | Add Default Route To Namespace
571 | | ... | ${nodes['${iperf_client_node}']}
572 | | ... | namespace=${iperf_client_namespace}
573 | | ... | default_route=${iperf_client_bind_gw}
574 | | ${pre_stats}= | Create List
575 | | ... | clear-show-runtime-with-iperf3
576 | | ... | vpp-clear-stats | vpp-enable-packettrace | vpp-enable-elog
577 | | FOR | ${action} | IN | @{pre_stats}
578 | | | Run Keyword | Additional Statistics Action For ${action}
579 | | END
580 | | ${results} = | Create List
581 | | FOR | ${i} | IN RANGE | ${trial_multiplicity}
582 | | | ${rr} = | iPerf Client Start Remote Exec
583 | | | ... | ${nodes['${iperf_client_node}']}
584 | | | ... | duration=${trial_duration}
585 | | | ... | rate=${rate}
586 | | | ... | frame_size=${frame_size}
587 | | | ... | async_call=False
588 | | | ... | warmup_time=0
589 | | | ... | traffic_directions=${traffic_directions}
590 | | | ... | namespace=${iperf_client_namespace}
591 | | | ... | udp=${iperf_client_udp}
592 | | | ... | host=${iperf_server_bind}
593 | | | ... | bind=${iperf_client_bind}
594 | | | ... | affinity=${iperf_client_affinity}
595 | | | ${conv} = | Convert To Number | ${rr['sum_received']['bits_per_second']}
596 | | | ${conv} = | Evaluate | ${conv} / ${1000} / ${1000} / ${1000}
597 | | | ${conv} = | Evaluate | "{:.3f}".format(${conv})
598 | | | Append To List
599 | | | ... | ${results} | ${conv}
600 | | END
601 | | FOR | ${action} | IN | @{post_stats}
602 | | | Run Keyword | Additional Statistics Action For ${action}
603 | | END
604 | | Return From Keyword | ${results}
605
606 | Start Traffic on Background
607 | | [Documentation]
608 | | ... | Start traffic at specified rate then return control to Robot.
609 | | ... | This keyword is useful if the test needs to do something
610 | | ... | while traffic is running.
611 | |
612 | | ... | *Test (or broader scope) variables read:*
613 | | ... | - traffic_profile - Name of module defining traffc for measurements.
614 | | ... | Type: string
615 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
616 | | ... | string
617 | | ... | *Arguments:*
618 | | ... | - rate - Unidirectional rate [tps] for sending packets.
619 | | ... | Type: float
620 | |
621 | | ... | *Example:*
622 | |
623 | | ... | \| Start Traffic on Background \| ${4000000.0} \|
624 | |
625 | | [Arguments] | ${rate}
626 | |
627 | | ${ppta} = | Get Packets Per Transaction Aggregated
628 | | ${traffic_directions} = | Get Traffic Directions
629 | | ${transaction_duration} = | Get Transaction Duration
630 | | ${transaction_scale} = | Get Transaction Scale
631 | | ${transaction_type} = | Get Transaction Type
632 | | ${use_latency} = | Get Use Latency
633 | | Call Resetter
634 | | # Duration of -1 means we will stop traffic manually.
635 | | Send traffic on tg
636 | | ... | duration=${-1}
637 | | ... | rate=${rate}
638 | | ... | frame_size=${frame_size}
639 | | ... | traffic_profile=${traffic_profile}
640 | | ... | async_call=${True}
641 | | ... | duration_limit=${0.0}
642 | | ... | ppta=${ppta}
643 | | ... | traffic_directions=${traffic_directions}
644 | | ... | transaction_duration=${transaction_duration}
645 | | ... | transaction_scale=${transaction_scale}
646 | | ... | transaction_type=${transaction_type}
647 | | ... | use_latency=${use_latency}
648
649 | Stop Running Traffic
650 | | [Documentation]
651 | | ... | Stop the running traffic, return measurement result.
652 | | ... | For bidirectional traffic, the reported values are bi-directional.
653 | |
654 | | ... | *Returns:*
655 | | ... | - Measurement result. Type: ReceiveRateMeasurement
656 | |
657 | | ... | *Example:*
658 | |
659 | | ... | \${result}= \| Stop Running Traffic \|
660 | |
661 | | ${result}= | Stop traffic on tg
662 | | Return From Keyword | ${result}
663
664 | Traffic should pass with maximum rate
665 | | [Documentation]
666 | | ... | Send traffic at maximum rate.
667 | | ... | Call \${resetter} (if defined) to reset DUT state before each trial.
668 | | ... | Fail if no packets were forwarded.
669 | |
670 | | ... | *Test (or broader scope) variables read:*
671 | | ... | - traffic_profile - Name of module defining traffic for measurements.
672 | | ... | Type: string
673 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
674 | | ... | string
675 | | ... | - max_rate - Calculated maximal transmit rate [tps].
676 | | ... | Type: float
677 | | ... | - transaction_type - String identifier to determine how to count
678 | | ... | transactions. Default is "packet".
679 | |
680 | | ... | *Example:*
681 | |
682 | | ... | \| Traffic should pass with maximum rate \|
683 | |
684 | | ${max_rate} = | Get Max Rate
685 | | ${transaction_type} = | Get Transaction Type
686 | | ${trial_duration} = | Get Mrr Trial Duration
687 | | ${trial_multiplicity} = | Get Mrr Trial Multiplicity
688 | | ${use_latency} = | Get Use Latency
689 | | # The following also sets \${rate_for_teardown}
690 | | ${results} = | Send traffic at specified rate
691 | | ... | rate=${max_rate}
692 | | ... | trial_duration=${trial_duration}
693 | | ... | trial_multiplicity=${trial_multiplicity}
694 | | ... | use_latency=${use_latency}
695 | | ... | duration_limit=${0.0}
696 | | ${unit} = | Set Variable If | """_cps""" in """${transaction_type}"""
697 | | ... | estimated connections per second | packets per second
698 | | Set Test Message | ${\n}Maximum Receive Rate trial results
699 | | Set Test Message | in ${unit}: ${results}
700 | | ... | append=yes
701 | | Fail if no traffic forwarded