Framework: Add possibility to send ramp-up traffic
[csit.git] / resources / libraries / robot / performance / performance_utils.robot
1 # Copyright (c) 2020 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.TrafficGenerator
21 | Library | resources.libraries.python.TrafficGenerator.OptimizedSearch
22 | Library | resources.libraries.python.TrafficGenerator.TGDropRateSearchImpl
23 | Library | resources.libraries.python.Trace
24 | Variables | resources/libraries/python/Constants.py
25 |
26 | Documentation
27 | ... | Performance suite keywords - utilities to find and verify NDR and PDR.
28
29 *** Variables ***
30 | ${trial_duration}= | ${PERF_TRIAL_DURATION}
31 | ${trial_multiplicity}= | ${PERF_TRIAL_MULTIPLICITY}
32 | ${extended_debug}= | ${EXTENDED_DEBUG}
33 | # Variable holding multiplicator of main heap size. By default it is set to 1
34 | # that means the main heap size will be set to 2G. Some tests may require more
35 | # memory for IP FIB (e.g. nat44det tests with 4M or 16M sessions).
36 | ${heap_size_mult}= | ${1}
37
38 *** Keywords ***
39 | Find NDR and PDR intervals using optimized search
40 | | [Documentation]
41 | | ... | Find boundaries for RFC2544 compatible NDR and PDR values
42 | | ... | using an optimized search algorithm.
43 | | ... | Display findings as a formatted test message.
44 | | ... | Fail if a resulting lower bound has too high loss fraction.
45 | | ... | Input rates are understood as uni-directional,
46 | | ... | reported result contains aggregate rates.
47 | | ... | Additional latency measurements are performed for smaller loads,
48 | | ... | their results are also displayed.
49 | | ... | Finally, two measurements for runtime stats are done (not displayed).
50 | | ... | Currently, the min_rate value is hardcoded to 90kpps,
51 | | ... | allowing measurement at 10% of the discovered rate
52 | | ... | without breaking latency streams.
53 | |
54 | | ... | *Test (or broader scope) variables read:*
55 | | ... | - traffic_profile - Name of module defining traffc for measurements.
56 | | ... | Type: string
57 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
58 | | ... | string
59 | | ... | - max_rate - Calculated unidirectional maximal transmit rate [pps].
60 | | ... | Type: float
61 | |
62 | | ... | *Arguments:*
63 | | ... | - packet_loss_ratio - Accepted loss during search. Type: float
64 | | ... | - final_relative_width - Maximal width multiple of upper. Type: float
65 | | ... | - final_trial_duration - Duration of final trials [s]. Type: float
66 | | ... | - initial_trial_duration - Duration of initial trials [s]. Type: float
67 | | ... | - intermediate phases - Number of intermediate phases [1].
68 | | ... | Type: integer
69 | | ... | - timeout - Fail if search duration is longer [s]. Type: float
70 | | ... | - doublings - How many doublings to do when expanding [1].
71 | | ... | Type: integer
72 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
73 | | ... | Type: integer
74 | | ... | - latency_duration - Duration for latency-specific trials. Type: float
75 | | ... | - latency - False to disable latency measurement; default value: True.
76 | | ... | Type: boolean
77 | |
78 | | ... | *Example:*
79 | |
80 | | ... | \| Find NDR and PDR intervals using optimized search \| \${0.005} \
81 | | ... | \| \${0.005} \| \${30.0} \| \${1.0} \| \${2} \| \${600.0} \| \${2} \
82 | | ... | \| \${2} \| ${5.0} \|
83 | |
84 | | [Arguments] | ${packet_loss_ratio}=${0.005}
85 | | ... | ${final_relative_width}=${0.005} | ${final_trial_duration}=${30.0}
86 | | ... | ${initial_trial_duration}=${1.0}
87 | | ... | ${number_of_intermediate_phases}=${2} | ${timeout}=${720.0}
88 | | ... | ${doublings}=${2} | ${traffic_directions}=${2}
89 | | ... | ${latency_duration}=${PERF_TRIAL_LATENCY_DURATION}
90 | | ... | ${latency}=${True}
91 | |
92 | | # Latency measurements will need more than 9000 pps.
93 | | ${result} = | Perform optimized ndrpdr search | ${frame_size}
94 | | ... | ${traffic_profile} | ${9001} | ${max_rate}
95 | | ... | ${packet_loss_ratio} | ${final_relative_width}
96 | | ... | ${final_trial_duration} | ${initial_trial_duration}
97 | | ... | ${number_of_intermediate_phases} | timeout=${timeout}
98 | | ... | doublings=${doublings} | traffic_directions=${traffic_directions}
99 | | ... | latency=${latency}
100 | | Display result of NDRPDR search | ${result}
101 | | Check NDRPDR interval validity | ${result.pdr_interval}
102 | | ... | ${packet_loss_ratio}
103 | | Check NDRPDR interval validity | ${result.ndr_interval}
104 | | ${pdr_sum}= | Set Variable | ${result.pdr_interval.measured_low.target_tr}
105 | | ${pdr_per_stream}= | Evaluate | ${pdr_sum} / float(${traffic_directions})
106 | | ${ndr_sum}= | Set Variable | ${result.ndr_interval.measured_low.target_tr}
107 | | ${ndr_per_stream}= | Evaluate | ${ndr_sum} / float(${traffic_directions})
108 | | ${rate}= | Evaluate | 0.9 * ${pdr_per_stream}
109 | | Run Keyword If | ${latency}
110 | | ... | Measure and show latency at specified rate | Latency at 90% PDR:
111 | | ... | ${latency_duration} | ${rate} | ${framesize}
112 | | ... | ${traffic_profile} | ${traffic_directions}
113 | | ${rate}= | Evaluate | 0.5 * ${pdr_per_stream}
114 | | Run Keyword If | ${latency}
115 | | ... | Measure and show latency at specified rate | Latency at 50% PDR:
116 | | ... | ${latency_duration} | ${rate} | ${framesize}
117 | | ... | ${traffic_profile} | ${traffic_directions}
118 | | ${rate}= | Evaluate | 0.1 * ${pdr_per_stream}
119 | | Run Keyword If | ${latency}
120 | | ... | Measure and show latency at specified rate | Latency at 10% PDR:
121 | | ... | ${latency_duration} | ${rate} | ${framesize}
122 | | ... | ${traffic_profile} | ${traffic_directions}
123 | | Run Keyword If | ${latency}
124 | | ... | Measure and show latency at specified rate | Latency at 0% PDR:
125 | | ... | ${latency_duration} | ${0} | ${framesize}
126 | | ... | ${traffic_profile} | ${traffic_directions}
127 | | # Finally, trials with runtime and other stats.
128 | | # We expect NDR and PDR to have different-looking stats.
129 | | Send traffic at specified rate
130 | | ... | ${1.0} | ${pdr_per_stream} | ${framesize} | ${traffic_profile}
131 | | ... | traffic_directions=${traffic_directions}
132 | | Send traffic at specified rate
133 | | ... | ${1.0} | ${ndr_per_stream} | ${framesize} | ${traffic_profile}
134 | | ... | traffic_directions=${traffic_directions}
135
136 | Find Throughput Using MLRsearch
137 | | [Documentation]
138 | | ... | Find and return lower bound PDR (zero PLR by default)
139 | | ... | aggregate throughput using MLRsearch algorithm.
140 | | ... | Input rates are understood as uni-directional.
141 | | ... | Currently, the min_rate value is hardcoded to match test teardowns.
142 | |
143 | | ... | *Test (or broader scope) variables read:*
144 | | ... | - traffic_profile - Name of module defining traffc for measurements.
145 | | ... | Type: string
146 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
147 | | ... | string
148 | | ... | - max_rate - Calculated unidirectional maximal transmit rate [pps].
149 | | ... | Type: float
150 | |
151 | | ... | *Arguments:*
152 | | ... | - packet_loss_ratio - Accepted loss during search. Type: float
153 | | ... | - final_relative_width - Maximal width multiple of upper. Type: float
154 | | ... | - final_trial_duration - Duration of final trials [s]. Type: float
155 | | ... | - initial_trial_duration - Duration of initial trials [s]. Type: float
156 | | ... | - intermediate phases - Number of intermediate phases [1].
157 | | ... | Type: integer
158 | | ... | - timeout - Fail if search duration is longer [s]. Type: float
159 | | ... | - doublings - How many doublings to do when expanding [1].
160 | | ... | Type: integer
161 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
162 | | ... | Type: integer
163 | | ... | - latency - True to enable latency measurement; default value: False.
164 | | ... | Type: boolean
165 | |
166 | | ... | *Returns:*
167 | | ... | - Lower bound for bi-directional throughput at given PLR. Type: float
168 | |
169 | | ... | *Example:*
170 | |
171 | | ... | \| \${throughpt}= \| Find Throughput Using MLRsearch \| \${0} \
172 | | ... | \| \${0.001} \| \${10.0}\| \${1.0} \| \${1} \| \${720.0} \| \${2} \
173 | | ... | \| \${2} \|
174 | |
175 | | [Arguments] | ${packet_loss_ratio}=${0.0}
176 | | ... | ${final_relative_width}=${0.001} | ${final_trial_duration}=${10.0}
177 | | ... | ${initial_trial_duration}=${1.0}
178 | | ... | ${number_of_intermediate_phases}=${1} | ${timeout}=${720.0}
179 | | ... | ${doublings}=${2} | ${traffic_directions}=${2} | ${latency}=${False}
180 | |
181 | | ${result} = | Perform optimized ndrpdr search | ${frame_size}
182 | | ... | ${traffic_profile} | ${10000} | ${max_rate}
183 | | ... | ${packet_loss_ratio} | ${final_relative_width}
184 | | ... | ${final_trial_duration} | ${initial_trial_duration}
185 | | ... | ${number_of_intermediate_phases} | timeout=${timeout}
186 | | ... | doublings=${doublings} | traffic_directions=${traffic_directions}
187 | | ... | latency=${latency}
188 | | Check NDRPDR interval validity | ${result.pdr_interval}
189 | | ... | ${packet_loss_ratio}
190 | | Return From Keyword | ${result.pdr_interval.measured_low.target_tr}
191
192 | Find critical load using PLRsearch
193 | | [Documentation]
194 | | ... | Find boundaries for troughput (of given target loss ratio)
195 | | ... | using PLRsearch algorithm.
196 | | ... | Display results as formatted test message.
197 | | ... | Fail if computed lower bound 110% of the minimal rate or less.
198 | | ... | Input rates are understood as uni-directional,
199 | | ... | reported result contains aggregate rates.
200 | | ... | Currently, the min_rate value is hardcoded to match test teardowns.
201 | |
202 | | ... | *Test (or broader scope) variables read:*
203 | | ... | - traffic_profile - Name of module defining traffc for measurements.
204 | | ... | Type: string
205 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
206 | | ... | string
207 | | ... | - max_rate - Calculated unidirectional maximal transmit rate [pps].
208 | | ... | Type: float
209 | |
210 | | ... | *Arguments:*
211 | | ... | - packet_loss_ratio - Accepted loss during search. Type: float
212 | | ... | - timeout - Stop when search duration is longer [s]. Type: float
213 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
214 | | ... | Type: integer
215 | | ... | - latency - True to enable latency measurement; default value: False.
216 | | ... | Type: boolean
217 | |
218 | | ... | *Example:*
219 | |
220 | | ... | \| Find critical load using PLR search \| \${1e-7} \| \${120} \
221 | | ... | \| \${2} \|
222 | |
223 | | [Arguments] | ${packet_loss_ratio}=${1e-7} | ${timeout}=${1800.0}
224 | | ... | ${traffic_directions}=${2} | ${latency}=${False}
225 | |
226 | | ${min_rate} = | Set Variable | ${10000}
227 | | ${average} | ${stdev} = | Perform soak search | ${frame_size}
228 | | ... | ${traffic_profile} | ${min_rate} | ${max_rate}
229 | | ... | ${packet_loss_ratio} | timeout=${timeout}
230 | | ... | traffic_directions=${traffic_directions} | latency=${latency}
231 | | ${lower} | ${upper} = | Display result of soak search
232 | | ... | ${average} | ${stdev}
233 | | Should Not Be True | 1.1 * ${traffic_directions} * ${min_rate} > ${lower}
234 | | ... | Lower bound ${lower} too small for unidirectional minimum ${min_rate}.
235
236 | Display single bound
237 | | [Documentation]
238 | | ... | Display one bound of NDR+PDR search,
239 | | ... | in packet per seconds (total and per stream)
240 | | ... | and Gbps total bandwidth (for initial packet size).
241 | | ... | Througput is calculated as:
242 | | ... | Sum of measured rates over streams
243 | | ... | Bandwidth is calculated as:
244 | | ... | (Throughput * (L2 Frame Size + IPG) * 8)
245 | | ... | The given result should contain latency data as well.
246 | |
247 | | ... | *Arguments:*
248 | | ... | - text - Flavor text describing which bound is this. Type: string
249 | | ... | - rate_total - Total (not per stream) measured Tr [pps]. Type: float
250 | | ... | - frame_size - L2 Frame Size [B]. Type: integer
251 | | ... | - latency - Latency data to display if non-empty. Type: string
252 | |
253 | | ... | *Example:*
254 | |
255 | | ... | \| Display single bound \| NDR lower bound \| \${12345.67} \
256 | | ... | \| \${64} \| latency=\${EMPTY} \|
257 | |
258 | | [Arguments] | ${text} | ${rate_total} | ${frame_size} | ${latency}=${EMPTY}
259 | |
260 | | ${bandwidth_total} = | Evaluate | ${rate_total} * (${frame_size}+20)*8 / 1e9
261 | | Set Test Message | ${\n}${text}: ${rate_total} pps, | append=yes
262 | | Set Test Message | ${bandwidth_total} Gbps (initial) | append=yes
263 | | Return From Keyword If | not """${latency}"""
264 | | Set Test Message | ${\n}LATENCY [min/avg/max/hdrh] per stream: ${latency}
265 | | ... | append=yes
266
267 | Display Reconfig Test Message
268 | | [Documentation]
269 | | ... | Display the number of packets lost (bidirectionally)
270 | | ... | due to reconfiguration under traffic.
271 | |
272 | | ... | *Arguments:*
273 | | ... | - result - Result of bidirectional measurtement.
274 | | ... | Type: ReceiveRateMeasurement
275 | |
276 | | ... | *Example:*
277 | |
278 | | ... | \| Display Reconfig Test Message \| \${result} \|
279 | |
280 | | [Arguments] | ${result}
281 | |
282 | | Set Test Message | Packets lost due to reconfig: ${result.loss_count}
283 | | ${time_lost} = | Evaluate | ${result.loss_count} / ${result.target_tr}
284 | | Set Test Message | ${\n}Implied time lost: ${time_lost} | append=yes
285
286 | Display result of NDRPDR search
287 | | [Documentation]
288 | | ... | Display result of NDR+PDR search, both quantities, both bounds,
289 | | ... | aggregate in packet per seconds
290 | | ... | and Gbps total bandwidth (for initial packet size).
291 | | ... | Througput is calculated as:
292 | | ... | Sum of measured rate over streams
293 | | ... | Bandwidth is calculated as:
294 | | ... | (Throughput * (L2 Frame Size + IPG) * 8)
295 | | ... | The given result should contain latency data as well.
296 | |
297 | | ... | *Test (or broader scope) variables read:*
298 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
299 | | ... | string
300 | | ... | *Arguments:*
301 | | ... | - result - Measured result data per stream [pps]. Type: NdrPdrResult
302 | |
303 | | ... | *Example:*
304 | |
305 | | ... | \| Display result of NDRPDR search \| \${result} \|
306 | |
307 | | [Arguments] | ${result}
308 | |
309 | | ${frame_size} = | Get Average Frame Size | ${frame_size}
310 | | Display single bound | NDR_LOWER
311 | | ... | ${result.ndr_interval.measured_low.target_tr} | ${frame_size}
312 | | ... | ${result.ndr_interval.measured_low.latency}
313 | | Display single bound | NDR_UPPER
314 | | ... | ${result.ndr_interval.measured_high.target_tr} | ${frame_size}
315 | | Display single bound | PDR_LOWER
316 | | ... | ${result.pdr_interval.measured_low.target_tr} | ${frame_size}
317 | | ... | ${result.pdr_interval.measured_low.latency}
318 | | Display single bound | PDR_UPPER
319 | | ... | ${result.pdr_interval.measured_high.target_tr} | ${frame_size}
320
321 | Display result of soak search
322 | | [Documentation]
323 | | ... | Display result of soak search, avg+-stdev, as upper/lower bounds,
324 | | ... | in aggregate packets per seconds
325 | | ... | and Gbps total bandwidth (for initial packet size).
326 | | ... | Througput is calculated as:
327 | | ... | Sum of measured rates over streams
328 | | ... | Bandwidth is calculated as:
329 | | ... | (Throughput * (L2 Frame Size + IPG) * 8)
330 | |
331 | | ... | *Test (or broader scope) variables read:*
332 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
333 | | ... | string
334 | | ... | *Arguments:*
335 | | ... | - avg - Estimated average critical load [pps]. Type: float
336 | | ... | - stdev - Standard deviation of critical load [pps]. Type: float
337 | |
338 | | ... | *Returns:*
339 | | ... | - Lower and upper bound of critical load [pps]. Type: 2-tuple of float
340 | |
341 | | ... | *Example:*
342 | |
343 | | ... | \| Display result of soak search \| \${100000} \| \${100} \|
344 | |
345 | | [Arguments] | ${avg} | ${stdev}
346 | |
347 | | ${frame_size} = | Get Average Frame Size | ${frame_size}
348 | | ${avg} = | Convert To Number | ${avg}
349 | | ${stdev} = | Convert To Number | ${stdev}
350 | | ${lower} = | Evaluate | ${avg} - ${stdev}
351 | | ${upper} = | Evaluate | ${avg} + ${stdev}
352 | | Display single bound | PLRsearch lower bound | ${lower} | ${frame_size}
353 | | Display single bound | PLRsearch upper bound | ${upper} | ${frame_size}
354 | | Return From Keyword | ${lower} | ${upper}
355
356 | Check NDRPDR interval validity
357 | | [Documentation]
358 | | ... | Extract loss ratio of lower bound of the interval.
359 | | ... | Fail if it does not reach the allowed value.
360 | |
361 | | ... | *Arguments:*
362 | | ... | - interval - Measured interval. Type: ReceiveRateInterval
363 | | ... | - packet_loss_ratio - Accepted loss (0.0 for NDR). Type: float
364 | |
365 | | ... | *Example:*
366 | |
367 | | ... | \| Check NDRPDR interval validity \| \${result.pdr_interval} \
368 | | ... | \| \${0.005} \|
369 | |
370 | | [Arguments] | ${interval} | ${packet_loss_ratio}=${0.0}
371 | |
372 | | ${lower_bound} = | Set Variable | ${interval.measured_low}
373 | | ${lower_bound_lf} = | Set Variable | ${lower_bound.loss_fraction}
374 | | Return From Keyword If | ${lower_bound_lf} <= ${packet_loss_ratio}
375 | | ${message}= | Catenate | SEPARATOR=${SPACE}
376 | | ... | Minimal rate loss fraction ${lower_bound_lf}
377 | | ... | does not reach target ${packet_loss_ratio}.
378 | | ${message_zero} = | Set Variable | Zero packets forwarded!
379 | | ${message_other} = | Set Variable | ${lower_bound.loss_count} packets lost.
380 | | ${message} = | Set Variable If | ${lower_bound_lf} >= 1.0
381 | | ... | ${message}${\n}${message_zero} | ${message}${\n}${message_other}
382 | | Fail | ${message}
383
384 | Traffic should pass with maximum rate
385 | | [Documentation]
386 | | ... | Send traffic at maximum rate.
387 | |
388 | | ... | *Test (or broader scope) variables read:*
389 | | ... | - traffic_profile - Name of module defining traffic for measurements.
390 | | ... | Type: string
391 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
392 | | ... | string
393 | | ... | - max_rate - Calculated unidirectional maximal transmit rate [pps].
394 | | ... | Type: float
395 | |
396 | | ... | *Arguments:*
397 | | ... | - trial_duration - Duration of single trial [s]. Type: float
398 | | ... | - fail_no_traffic - Whether to fail on zero receive count;
399 | | ... | default value: True. Type: boolean
400 | | ... | - trial_multiplicity - How many trials in this measurement.
401 | | ... | Type: integer
402 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic;
403 | | ... | default value: 2. Type: integer
404 | | ... | - tx_port - TX port of TG; default value: 0. Type: integer
405 | | ... | - rx_port - RX port of TG; default value: 1. Type: integer
406 | | ... | - latency - True to enable latency measurement; default value: False.
407 | | ... | Type: boolean
408 | |
409 | | ... | *Example:*
410 | |
411 | | ... | \| Traffic should pass with maximum rate \| \${1} \| \${False} \
412 | | ... | \| \${10.0} \| \${2} \| \${0} \| \${1} \| \${True} \|
413 | |
414 | | [Arguments] | ${trial_duration}=${trial_duration}
415 | | ... | ${fail_no_traffic}=${True}
416 | | ... | ${trial_multiplicity}=${trial_multiplicity}
417 | | ... | ${traffic_directions}=${2} | ${tx_port}=${0} | ${rx_port}=${1}
418 | | ... | ${latency}=${False}
419 | |
420 | | ${results}= | Send traffic at specified rate
421 | | ... | ${trial_duration} | ${max_rate} | ${frame_size}
422 | | ... | ${traffic_profile} | ${trial_multiplicity}
423 | | ... | ${traffic_directions} | ${tx_port} | ${rx_port} | latency=${latency}
424 | | Set Test Message | ${\n}Maximum Receive Rate trial results
425 | | Set Test Message | in packets per second: ${results}
426 | | ... | append=yes
427 | | Run Keyword If | ${fail_no_traffic} | Fail if no traffic forwarded
428
429 | Send traffic at specified rate
430 | | [Documentation]
431 | | ... | Perform a warmup, show runtime counters during it.
432 | | ... | Then send traffic at specified rate, possibly multiple trials.
433 | | ... | Show various DUT stats, optionally also packet trace.
434 | | ... | Return list of measured receive rates.
435 | |
436 | | ... | *Arguments:*
437 | | ... | - trial_duration - Duration of single trial [s]. Type: float
438 | | ... | - rate - Target aggregate transmit rate [pps] / Connections per second
439 | | ... | (CPS) for UDP/TCP flows. Type: float
440 | | ... | - frame_size - L2 Frame Size [B]. Type: integer or string
441 | | ... | - traffic_profile - Name of module defining traffc for measurements.
442 | | ... | Type: string
443 | | ... | - trial_multiplicity - How many trials in this measurement.
444 | | ... | Type: integer
445 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
446 | | ... | Type: integer
447 | | ... | - tx_port - TX port of TG; default value: 0. Type: integer
448 | | ... | - rx_port - RX port of TG; default value: 1. Type: integer
449 | | ... | - extended_debug - True to enable extended debug.
450 | | ... | Type: boolean
451 | | ... | - latency - True to enable latency measurement; default value: False.
452 | | ... | Type: boolean
453 | |
454 | | ... | *Example:*
455 | |
456 | | ... | \| Send traffic at specified rate \| \${1.0} \| ${4000000.0} \
457 | | ... | \| \${64} \| 3-node-IPv4 \| \${10} \| \${2} \| \${0} \| \${1} \
458 | | ... | \| ${False} \| ${True} \|
459 | |
460 | | [Arguments] | ${trial_duration} | ${rate} | ${frame_size}
461 | | ... | ${traffic_profile} | ${trial_multiplicity}=${trial_multiplicity}
462 | | ... | ${traffic_directions}=${2} | ${tx_port}=${0} | ${rx_port}=${1}
463 | | ... | ${extended_debug}=${extended_debug} | ${latency}=${False}
464 | |
465 | | Set Test Variable | ${extended_debug}
466 | | # Following setting of test variables is needed for some pre_stats actions.
467 | | Set Test Variable | ${rate}
468 | | Set Test Variable | ${traffic_directions}
469 | | Set Test Variable | ${tx_port}
470 | | Set Test Variable | ${rx_port}
471 | |
472 | | FOR | ${action} | IN | @{pre_stats}
473 | | | Run Keyword | Additional Statistics Action For ${action}
474 | | END
475 | | ${results} = | Create List
476 | | FOR | ${i} | IN RANGE | ${trial_multiplicity}
477 | | | # The following line is skipping some default arguments,
478 | | | # that is why subsequent arguments have to be named.
479 | | | Send traffic on tg
480 | | | ... | ${trial_duration} | ${rate} | ${frame_size} | ${traffic_profile}
481 | | | ... | warmup_time=${0} | traffic_directions=${traffic_directions}
482 | | | ... | tx_port=${tx_port} | rx_port=${rx_port} | latency=${latency}
483 | | | ${rx} = | Get Received
484 | | | ${rr} = | Evaluate | ${rx} / ${trial_duration}
485 | | | Append To List | ${results} | ${rr}
486 | | END
487 | | FOR | ${action} | IN | @{post_stats}
488 | | | Run Keyword | Additional Statistics Action For ${action}
489 | | END
490 | | Return From Keyword | ${results}
491
492 | Measure and show latency at specified rate
493 | | [Documentation]
494 | | ... | Send traffic at specified rate, single trial.
495 | | ... | Extract latency information and append it to text message.
496 | | ... | The rate argument is int, so should not include "pps".
497 | | ... | If the given rate is too low, a safe value is used instead.
498 | |
499 | | ... | *Arguments:*
500 | | ... | - message_prefix - Preface to test message addition. Type: string
501 | | ... | - trial_duration - Duration of single trial [s]. Type: float
502 | | ... | - rate - Rate [pps] for sending packets in case of T-Rex stateless
503 | | ... | mode or multiplier of profile CPS in case of T-Rex astf mode.
504 | | ... | Type: float
505 | | ... | - frame_size - L2 Frame Size [B]. Type: integer or string
506 | | ... | - traffic_profile - Name of module defining traffic for measurements.
507 | | ... | Type: string
508 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
509 | | ... | Type: integer
510 | | ... | - tx_port - TX port of TG; default value: 0. Type: integer
511 | | ... | - rx_port - RX port of TG; default value: 1. Type: integer
512 | | ... | - safe_rate - To apply if rate is below this, as latency pps is fixed.
513 | | ... | In pps. Type: integer.
514 | |
515 | | ... | *Example:*
516 | |
517 | | ... | \| Measure and show latency at specified rate \| Latency at 90% NDR \
518 | | ... | \| \${1.0} \| ${10000000} \| \${64} \| 3-node-IPv4 \| \${2} \
519 | | ... | \| \${0} \| \${1} \| ${9500} \|
520 | |
521 | | [Arguments] | ${message_prefix} | ${trial_duration} | ${rate}
522 | | ... | ${frame_size} | ${traffic_profile} | ${traffic_directions}=${2}
523 | | ... | ${tx_port}=${0} | ${rx_port}=${1} | ${safe_rate}=${9001}
524 | |
525 | | ${real_rate} = | Evaluate | max(${rate}, ${safe_rate})
526 | | # The following line is skipping some default arguments,
527 | | # that is why subsequent arguments have to be named.
528 | | Send traffic on tg | ${trial_duration} | ${real_rate} | ${frame_size}
529 | | ... | ${traffic_profile} | warmup_time=${0}
530 | | ... | traffic_directions=${traffic_directions} | tx_port=${tx_port}
531 | | ... | rx_port=${rx_port} | latency=${True}
532 | | ${latency} = | Get Latency Int
533 | | Set Test Message | ${\n}${message_prefix} ${latency} | append=${True}
534
535 | Clear and show runtime counters with running traffic
536 | | [Documentation]
537 | | ... | Start traffic at specified rate then clear runtime counters on all
538 | | ... | DUTs. Wait for specified amount of time and capture runtime counters
539 | | ... | on all DUTs. Finally stop traffic
540 | |
541 | | ... | *Arguments:*
542 | | ... | - duration - Duration of traffic run [s]. Type: integer
543 | | ... | - rate - Rate [pps] for sending packets in case of T-Rex stateless
544 | | ... | mode or multiplier of profile CPS in case of T-Rex astf mode.
545 | | ... | Type: float
546 | | ... | - frame_size - L2 Frame Size [B] or IMIX_v4_1. Type: integer or string
547 | | ... | - traffic_profile - Name of module defining traffc for measurements.
548 | | ... | Type: string
549 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
550 | | ... | Type: integer
551 | | ... | - tx_port - TX port of TG; default value: 0. Type: integer
552 | | ... | - rx_port - RX port of TG, default value: 1. Type: integer
553 | |
554 | | ... | *Example:*
555 | |
556 | | ... | \| Clear and show runtime counters with running traffic \| \${10} \
557 | | ... | \| ${4000000.0} \| \${64} \| 3-node-IPv4 \| \${2} \| \${0} \| \${1} \|
558 | |
559 | | [Arguments] | ${duration} | ${rate} | ${frame_size} | ${traffic_profile}
560 | | ... | ${traffic_directions}=${2} | ${tx_port}=${0} | ${rx_port}=${1}
561 | |
562 | | # Duration of -1 means we will stop traffic manually.
563 | | Send traffic on tg | ${-1} | ${rate} | ${frame_size} | ${traffic_profile}
564 | | ... | warmup_time=${0} | async_call=${True} | latency=${False}
565 | | ... | traffic_directions=${traffic_directions} | tx_port=${tx_port}
566 | | ... | rx_port=${rx_port}
567 | | FOR | ${action} | IN | @{pre_run_stats}
568 | | | Run Keyword | Additional Statistics Action For ${action}
569 | | END
570 | | Sleep | ${duration}
571 | | FOR | ${action} | IN | @{post_run_stats}
572 | | | Run Keyword | Additional Statistics Action For ${action}
573 | | END
574 | | Stop traffic on tg
575
576 | Send ramp-up traffic
577 | | [Documentation]
578 | | ... | Start ramp-up traffic at specified rate for defined duration.
579 | |
580 | | ... | *Arguments:*
581 | | ... | - duration - Duration of traffic run [s]. Type: integer
582 | | ... | - rate - Rate [pps] for sending packets in case of T-Rex stateless
583 | | ... | mode or multiplier of profile CPS in case of T-Rex astf mode.
584 | | ... | Type: float
585 | | ... | - frame_size - L2 Frame Size [B] or IMIX_v4_1. Type: integer or string
586 | | ... | - traffic_profile - Name of module defining traffc for measurements.
587 | | ... | Type: string
588 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
589 | | ... | Type: integer
590 | | ... | - tx_port - TX port of TG; default value: 0. Type: integer
591 | | ... | - rx_port - RX port of TG, default value: 1. Type: integer
592 | |
593 | | ... | *Example:*
594 | |
595 | | ... | \| Send ramp-up traffic \| \${10} \| ${400000.0} \| ${64} \
596 | | ... | \| ${2} \| ${0} \| ${1} \|
597 | |
598 | | [Arguments] | ${duration}=${ramp_up_duration} | ${rate}=${ramp_up_rate}
599 | | ... | ${frame_size}=${frame_size} | ${traffic_profile}=${traffic_profile}
600 | | ... | ${traffic_directions}=${2} | ${tx_port}=${0} | ${rx_port}=${1}
601 | |
602 | | Send traffic on tg
603 | | ... | ${duration} | ${rate} | ${frame_size} | ${traffic_profile}
604 | | ... | warmup_time=${0} | traffic_directions=${traffic_directions}
605 | | ... | tx_port=${tx_port} | rx_port=${rx_port} | latency=${False}
606
607 | Start Traffic on Background
608 | | [Documentation]
609 | | ... | Start traffic at specified rate then return control to Robot.
610 | | ... | This keyword is useful if the test needs to do something
611 | | ... | while traffic is running.
612 | |
613 | | ... | *Test (or broader scope) variables read:*
614 | | ... | - traffic_profile - Name of module defining traffc for measurements.
615 | | ... | Type: string
616 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
617 | | ... | string
618 | | ... | *Arguments:*
619 | | ... | - rate - Rate [pps] for sending packets in case of T-Rex stateless
620 | | ... | mode or multiplier of profile CPS in case of T-Rex astf mode.
621 | | ... | Type: float
622 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
623 | | ... | Type: integer
624 | | ... | - tx_port - TX port of TG; default value: 0. Type: integer
625 | | ... | - rx_port - RX port of TG; default value: 1. Type: integer
626 | |
627 | | ... | *Example:*
628 | |
629 | | ... | \| Start Traffic on Background \| ${4000000.0} \| \${2} \| \${0} \
630 | | ... | \| \${1} \|
631 | |
632 | | [Arguments] | ${rate} | ${traffic_directions}=${2} | ${tx_port}=${0}
633 | | ... | ${rx_port}=${1}
634 | |
635 | | # Duration of -1 means we will stop traffic manually.
636 | | Send traffic on tg | ${-1} | ${rate} | ${frame_size} | ${traffic_profile}
637 | | ... | warmup_time=${0} | async_call=${True} | latency=${False}
638 | | ... | traffic_directions=${traffic_directions} | tx_port=${tx_port}
639 | | ... | rx_port=${rx_port}
640
641 | Stop Running Traffic
642 | | [Documentation]
643 | | ... | Stop the running traffic, return measurement result.
644 | | ... | For bidirectional traffic, the reported values are bi-directional.
645 | |
646 | | ... | *Returns:*
647 | | ... | - Measurement result. Type: ReceiveRateMeasurement
648 | |
649 | | ... | *Example:*
650 | |
651 | | ... | \${result}= \| Stop Running Traffic \|
652 | |
653 | | ${result}= | Stop traffic on tg
654 | | Return From Keyword | ${result}
655
656 | Additional Statistics Action For vpp-clear-stats
657 | | [Documentation]
658 | | ... | Additional Statistics Action for clear VPP statistics.
659 | |
660 | | Clear Statistics On All DUTs | ${nodes}
661
662 | Additional Statistics Action For vpp-show-stats
663 | | [Documentation]
664 | | ... | Additional Statistics Action for show VPP statistics.
665 | |
666 | | Show Statistics On All DUTs | ${nodes}
667
668 | Additional Statistics Action For vpp-clear-runtime
669 | | [Documentation]
670 | | ... | Additional Statistics Action for clear VPP runtime.
671 | |
672 | | VPP Clear Runtime On All DUTs | ${nodes}
673
674 | Additional Statistics Action For vpp-show-runtime
675 | | [Documentation]
676 | | ... | Additional Statistics Action for show VPP runtime.
677 | |
678 | | VPP Show Runtime On All DUTs | ${nodes}
679
680 | Additional Statistics Action For vpp-enable-packettrace
681 | | [Documentation]
682 | | ... | Additional Statistics Action for enable VPP packet trace.
683 | |
684 | | Run Keyword If | ${extended_debug}==${True}
685 | | ... | VPP Enable Traces On All DUTs | ${nodes} | fail_on_error=${False}
686
687 | Additional Statistics Action For vpp-show-packettrace
688 | | [Documentation]
689 | | ... | Additional Statistics Action for show VPP packet trace.
690 | |
691 | | Run Keyword If | ${extended_debug}==${True}
692 | | ... | Show Packet Trace On All Duts | ${nodes} | maximum=${100}
693
694 | Additional Statistics Action For vpp-enable-elog
695 | | [Documentation]
696 | | ... | Additional Statistics Action for enable VPP elog trace.
697 | |
698 | | VPP Enable Elog Traces On All DUTs | ${nodes}
699
700 | Additional Statistics Action For vpp-show-elog
701 | | [Documentation]
702 | | ... | Additional Statistics Action for show VPP elog trace.
703 | |
704 | | Show Event Logger On All DUTs | ${nodes}
705
706 | Additional Statistics Action For bash-perf-stat
707 | | [Documentation]
708 | | ... | Additional Statistics Action for bash command "perf stat".
709 | |
710 | | Run Keyword If | ${extended_debug}==${True}
711 | | ... | Perf Stat On All DUTs | ${nodes} | cpu_list=${cpu_alloc_str}
712
713 | Additional Statistics Action For clear-show-runtime-with-traffic
714 | | [Documentation]
715 | | ... | Additional Statistics Action for clear and show runtime counters with
716 | | ... | running traffic.
717 | |
718 | | Clear and show runtime counters with running traffic
719 | | ... | ${trial_duration} | ${rate}
720 | | ... | ${frame_size} | ${traffic_profile} | ${traffic_directions}
721 | | ... | ${tx_port} | ${rx_port}
722
723 | Additional Statistics Action For noop
724 | | [Documentation]
725 | | ... | Additional Statistics Action for no operation.
726 | |
727 | | No operation