feat(telemetry): Add telemetry export
[csit.git] / resources / libraries / robot / performance / performance_utils.robot
1 # Copyright (c) 2022 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 *** Settings ***
15 | Library | Collections
16 | Library | resources.libraries.python.model.ExportResult
17 | Library | resources.libraries.python.topology.Topology
18 | Library | resources.libraries.python.NodePath
19 | Library | resources.libraries.python.InterfaceUtil
20 | Library | resources.libraries.python.Iperf3
21 | Library | resources.libraries.python.TelemetryUtil
22 | Library | resources.libraries.python.TrafficGenerator
23 | Library | resources.libraries.python.TrafficGenerator.OptimizedSearch
24 | Library | resources.libraries.python.TrafficGenerator.TGDropRateSearchImpl
25 | Library | resources.libraries.python.Trace
26 | Variables | resources/libraries/python/Constants.py
27 | Resource | resources/libraries/robot/performance/performance_actions.robot
28 | Resource | resources/libraries/robot/performance/performance_display.robot
29 | Resource | resources/libraries/robot/performance/performance_vars.robot
30 |
31 | Documentation
32 | ... | Performance suite keywords - utilities to find and verify NDR and PDR.
33 | ... | See performance_vars.robot for values accessed via there.
34
35 *** Variables ***
36 | # Variable holding multiplicator of main heap size. By default it is set to 1
37 | # that means the main heap size will be set to 2G. Some tests may require more
38 | # memory for IP FIB (e.g. nat44det tests with 4M or 16M sessions).
39 | ${heap_size_mult}= | ${1}
40
41 *** Keywords ***
42 | Find critical load using PLRsearch
43 | | [Documentation]
44 | | ... | Find boundaries for troughput (of hardcoded target loss ratio)
45 | | ... | using PLRsearch algorithm.
46 | | ... | Display results as formatted test message.
47 | | ... | Fail if computed lower bound is 110% of the minimal rate or less.
48 | | ... | Input rates are unidirectional, in transaction per second.
49 | | ... | Reported result may contain aggregated pps rates, depending on test.
50 | | ... | Call \${resetter} (if defined) to reset DUT state before each trial.
51 | |
52 | | ... | *Test (or broader scope) variables read:*
53 | | ... | - traffic_profile - Name of module defining traffc for measurements.
54 | | ... | Type: string
55 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
56 | | ... | string
57 | | ... | - max_rate - Calculated unidirectional maximal transmit rate [pps].
58 | | ... | Type: float
59 | |
60 | | ... | *Example:*
61 | |
62 | | ... | \| Find critical load using PLR search \|
63 | |
64 | | # Get values via performance_vars.
65 | | ${max_rate} = | Get Max Rate
66 | | ${min_rate_soft} = | Get Min Rate Soft
67 | | ${ppta} = | Get Packets Per Transaction Aggregated
68 | | ${ramp_up_duration} = | Get Ramp Up Duration
69 | | ${ramp_up_rate} = | Get Ramp Up Rate
70 | | ${resetter} = | Get Resetter
71 | | ${traffic_directions} = | Get Traffic Directions
72 | | ${transaction_duration} = | Get Transaction Duration
73 | | ${transaction_scale} = | Get Transaction Scale
74 | | ${transaction_type} = | Get Transaction Type
75 | | ${use_latency} = | Get Use Latency
76 | | # TRex needs a warmup to avoid unsent packets at half-max rate.
77 | | Send traffic on tg
78 | | ... | duration=1.0
79 | | ... | rate=${max_rate}
80 | | ... | frame_size=${frame_size}
81 | | ... | traffic_profile=${traffic_profile}
82 | | ... | async_call=${False}
83 | | ... | duration_limit=${1.0}
84 | | ... | ppta=${ppta}
85 | | ... | traffic_directions=${traffic_directions}
86 | | ... | transaction_duration=${transaction_duration}
87 | | ... | transaction_scale=${transaction_scale}
88 | | ... | transaction_type=${transaction_type}
89 | | ... | use_latency=False
90 | | ... | ramp_up_duration=${0.0}
91 | | ... | ramp_up_rate=${0.0}
92 | | # Ready for main search.
93 | | ${average} | ${stdev} = | Perform soak search
94 | | ... | frame_size=${frame_size}
95 | | ... | traffic_profile=${traffic_profile}
96 | | ... | minimum_transmit_rate=${min_rate_soft}
97 | | ... | maximum_transmit_rate=${max_rate}
98 | | ... | plr_target=${1e-7}
99 | | ... | tdpt=${0.1}
100 | | ... | initial_count=${50}
101 | | ... | ppta=${ppta}
102 | | ... | resetter=${resetter}
103 | | ... | timeout=${1800.0}
104 | | ... | trace_enabled=${False}
105 | | ... | traffic_directions=${traffic_directions}
106 | | ... | transaction_scale=${transaction_scale}
107 | | ... | transaction_duration=${transaction_duration}
108 | | ... | transaction_type=${transaction_type}
109 | | ... | use_latency=${use_latency}
110 | | ... | ramp_up_duration=${ramp_up_duration}
111 | | ... | ramp_up_rate=${ramp_up_rate}
112 | | ${lower} | ${upper} = | Display result of soak search
113 | | ... | ${average} | ${stdev}
114 | | Set Test Variable | \${rate for teardown} | ${lower}
115 | | # Stats at the discovered critical rate.
116 | | Set Test Variable | ${telemetry_oload} | 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_oload} | 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_oload} | 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 | | ${results}= | Send iPerf3 traffic at specified rate
482 | | ... | ${trial_duration} | ${None} | ${None}
483 | | ... | ${trial_multiplicity} | ${traffic_directions}
484 | | Set Test Message | ${\n}iPerf3 trial results
485 | | Set Test Message | in Gbits per second: ${results}
486 | | ... | append=yes
487
488 | Send iPerf3 traffic at specified rate
489 | | [Documentation]
490 | | ... | Perform a warmup, show runtime counters during it.
491 | | ... | Then send traffic at specified rate, possibly multiple trials.
492 | | ... | Show various DUT stats, optionally also packet trace.
493 | | ... | Return list of measured receive rates.
494 | |
495 | | ... | *Arguments:*
496 | | ... | - trial_duration - Duration of single trial [s].
497 | | ... | Type: float
498 | | ... | - rate - Target aggregated transmit rate [bps] / Bits per second.
499 | | ... | Type: float
500 | | ... | - frame_size - L2 Frame Size [B].
501 | | ... | Type: integer or string
502 | | ... | - trial_multiplicity - How many trials in this measurement.
503 | | ... | Type: integer
504 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
505 | | ... | Type: integer
506 | | ... | - extended_debug - True to enable extended debug.
507 | | ... | Type: boolean
508 | |
509 | | ... | *Example:*
510 | |
511 | | ... | \| Send iPerf3 traffic at specified rate \| \${1.0} \| ${4000000.0} \
512 | | ... | \| \${64} \| \${10} \| \${1} \| ${False} \|
513 | |
514 | | [Arguments] | ${trial_duration} | ${rate} | ${frame_size}
515 | | ... | ${trial_multiplicity}=${trial_multiplicity}
516 | | ... | ${traffic_directions}=${1} | ${extended_debug}=${extended_debug}
517 | |
518 | | Set Test Variable | ${extended_debug}
519 | | Set Test Variable | ${rate}
520 | | Set Test Variable | ${traffic_directions}
521 | |
522 | | ${smt_used}= | Is SMT enabled | ${nodes['${iperf_server_node}']['cpuinfo']}
523 | | ${vm_status} | ${value}= | Run Keyword And Ignore Error
524 | | ... | Get Library Instance | vnf_manager
525 | | ${vth}= | Evaluate | (${dp_count_int} + 1)
526 | | ${cpu_skip_cnt}= | Set Variable If | '${vm_status}' == 'PASS'
527 | | ... | ${CPU_CNT_SYSTEM}
528 | | ... | ${${CPU_CNT_SYSTEM} + ${CPU_CNT_MAIN} + ${cpu_count_int} + ${vth}}
529 | |
530 | | Initialize iPerf Server
531 | | ... | ${nodes['${iperf_server_node}']}
532 | | ... | pf_key=${iperf_server_pf_key}
533 | | ... | interface=${iperf_server_interface}
534 | | ... | bind=${iperf_server_bind}
535 | | ... | bind_gw=${iperf_server_bind_gw}
536 | | ... | bind_mask=${iperf_server_bind_mask}
537 | | ... | namespace=${iperf_server_namespace}
538 | | ... | cpu_skip_cnt=${cpu_skip_cnt}
539 | | Run Keyword If | '${iperf_client_namespace}' != '${None}'
540 | | ... | Set Linux Interface IP
541 | | ... | ${nodes['${iperf_client_node}']}
542 | | ... | interface=${iperf_client_interface}
543 | | ... | ip_addr=${iperf_client_bind}
544 | | ... | prefix=${iperf_client_bind_mask}
545 | | ... | namespace=${iperf_client_namespace}
546 | | Run Keyword If | '${iperf_client_namespace}' != '${None}'
547 | | ... | Add Default Route To Namespace
548 | | ... | ${nodes['${iperf_client_node}']}
549 | | ... | namespace=${iperf_client_namespace}
550 | | ... | default_route=${iperf_client_bind_gw}
551 | | ${stat_runtime}= | Create List
552 | | ... | vpp-runtime-iperf3
553 | | ${stat_pre_trial}= | Create List
554 | | ... | vpp-runtime-iperf3 | vpp-clear-stats | vpp-enable-packettrace
555 | | FOR | ${action} | IN | @{stat_runtime}
556 | | | Run Keyword | Additional Statistics Action For ${action}
557 | | END
558 | | FOR | ${action} | IN | @{stat_pre_trial}
559 | | | Run Keyword | Additional Statistics Action For ${action}
560 | | END
561 | | ${results} = | Create List
562 | | FOR | ${i} | IN RANGE | ${trial_multiplicity}
563 | | | ${rr} = | iPerf Client Start Remote Exec
564 | | | ... | ${nodes['${iperf_client_node}']}
565 | | | ... | duration=${trial_duration}
566 | | | ... | rate=${rate}
567 | | | ... | frame_size=${frame_size}
568 | | | ... | async_call=False
569 | | | ... | warmup_time=0
570 | | | ... | traffic_directions=${traffic_directions}
571 | | | ... | namespace=${iperf_client_namespace}
572 | | | ... | udp=${iperf_client_udp}
573 | | | ... | host=${iperf_server_bind}
574 | | | ... | bind=${iperf_client_bind}
575 | | | ... | affinity=${iperf_client_affinity}
576 | | | ${conv} = | Convert To Number | ${rr['sum_received']['bits_per_second']}
577 | | | ${conv} = | Evaluate | ${conv} / ${1000} / ${1000} / ${1000}
578 | | | ${conv} = | Evaluate | "{:.3f}".format(${conv})
579 | | | Append To List
580 | | | ... | ${results} | ${conv}
581 | | END
582 | | FOR | ${action} | IN | @{stat_post_trial}
583 | | | Run Keyword | Additional Statistics Action For ${action}
584 | | END
585 | | Return From Keyword | ${results}
586
587 | Start Traffic on Background
588 | | [Documentation]
589 | | ... | Start traffic at specified rate then return control to Robot.
590 | | ... | This keyword is useful if the test needs to do something
591 | | ... | while traffic is running.
592 | |
593 | | ... | *Test (or broader scope) variables read:*
594 | | ... | - traffic_profile - Name of module defining traffc for measurements.
595 | | ... | Type: string
596 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
597 | | ... | string
598 | | ... | *Arguments:*
599 | | ... | - rate - Unidirectional rate [tps] for sending packets.
600 | | ... | Type: float
601 | |
602 | | ... | *Example:*
603 | |
604 | | ... | \| Start Traffic on Background \| ${4000000.0} \|
605 | |
606 | | [Arguments] | ${rate}
607 | |
608 | | ${ppta} = | Get Packets Per Transaction Aggregated
609 | | ${ramp_up_duration} = | Get Ramp Up Duration
610 | | ${ramp_up_rate} = | Get Ramp Up Rate
611 | | ${traffic_directions} = | Get Traffic Directions
612 | | ${transaction_duration} = | Get Transaction Duration
613 | | ${transaction_scale} = | Get Transaction Scale
614 | | ${transaction_type} = | Get Transaction Type
615 | | ${use_latency} = | Get Use Latency
616 | | Call Resetter
617 | | # Duration of -1 means we will stop traffic manually.
618 | | Send traffic on tg
619 | | ... | duration=${-1}
620 | | ... | rate=${rate}
621 | | ... | frame_size=${frame_size}
622 | | ... | traffic_profile=${traffic_profile}
623 | | ... | async_call=${True}
624 | | ... | duration_limit=${0.0}
625 | | ... | ppta=${ppta}
626 | | ... | ramp_up_duration=${ramp_up_duration}
627 | | ... | ramp_up_rate=${ramp_up_rate}
628 | | ... | traffic_directions=${traffic_directions}
629 | | ... | transaction_duration=${transaction_duration}
630 | | ... | transaction_scale=${transaction_scale}
631 | | ... | transaction_type=${transaction_type}
632 | | ... | use_latency=${use_latency}
633
634 | Stop Running Traffic
635 | | [Documentation]
636 | | ... | Stop the running traffic, return measurement result.
637 | | ... | For bidirectional traffic, the reported values are bi-directional.
638 | |
639 | | ... | *Returns:*
640 | | ... | - Measurement result. Type: ReceiveRateMeasurement
641 | |
642 | | ... | *Example:*
643 | |
644 | | ... | \${result}= \| Stop Running Traffic \|
645 | |
646 | | ${result}= | Stop traffic on tg
647 | | Return From Keyword | ${result}
648
649 | Traffic should pass with maximum rate
650 | | [Documentation]
651 | | ... | Send traffic at maximum rate.
652 | | ... | Call \${resetter} (if defined) to reset DUT state before each trial.
653 | | ... | Fail if no packets were forwarded.
654 | |
655 | | ... | *Test (or broader scope) variables read:*
656 | | ... | - traffic_profile - Name of module defining traffic for measurements.
657 | | ... | Type: string
658 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
659 | | ... | string
660 | | ... | - max_rate - Calculated maximal transmit rate [tps].
661 | | ... | Type: float
662 | | ... | - transaction_type - String identifier to determine how to count
663 | | ... | transactions. Default is "packet".
664 | |
665 | | ... | *Example:*
666 | |
667 | | ... | \| Traffic should pass with maximum rate \|
668 | |
669 | | ${max_rate} = | Get Max Rate
670 | | ${transaction_type} = | Get Transaction Type
671 | | ${trial_duration} = | Get Mrr Trial Duration
672 | | ${trial_multiplicity} = | Get Mrr Trial Multiplicity
673 | | ${use_latency} = | Get Use Latency
674 | | ${unit} = | Set Variable If | """_cps""" in """${transaction_type}"""
675 | | ... | cps | pps
676 | | # The following also sets \${rate_for_teardown}
677 | | Set Test Variable | ${telemetry_oload} | mrr
678 | | ${results} = | Send traffic at specified rate
679 | | ... | rate=${max_rate}
680 | | ... | trial_duration=${trial_duration}
681 | | ... | trial_multiplicity=${trial_multiplicity}
682 | | ... | use_latency=${use_latency}
683 | | ... | duration_limit=${0.0}
684 | | ... | export_mrr_unit=${unit}
685 | | ${unit_text} = | Set Variable If | """_cps""" in """${transaction_type}"""
686 | | ... | estimated connections per second | packets per second
687 | | Set Test Message | ${\n}Maximum Receive Rate trial results
688 | | Set Test Message | in ${unit_text}: ${results}
689 | | ... | append=yes
690 | | Fail if no traffic forwarded