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