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