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