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