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