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