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