T-Rex: Add advanced stateful mode
[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} | ${framesize} | ${traffic_profile}
116 | | ... | traffic_directions=${traffic_directions}
117 | | Send traffic at specified rate
118 | | ... | ${1.0} | ${ndr_per_stream} | ${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 | | ... | ${latency}=${True}
393 | |
394 | | ${results}= | Send traffic at specified rate
395 | | ... | ${trial_duration} | ${max_rate} | ${frame_size}
396 | | ... | ${traffic_profile} | ${trial_multiplicity}
397 | | ... | ${traffic_directions} | ${tx_port} | ${rx_port} | latency=${latency}
398 | | Set Test Message | ${\n}Maximum Receive Rate trial results
399 | | Set Test Message | in packets per second: ${results}
400 | | ... | append=yes
401 | | Run Keyword If | ${fail_no_traffic} | Fail if no traffic forwarded
402
403 | Send traffic at specified rate
404 | | [Documentation]
405 | | ... | Perform a warmup, show runtime counters during it.
406 | | ... | Then send traffic at specified rate, possibly multiple trials.
407 | | ... | Show various DUT stats, optionally also packet trace.
408 | | ... | Return list of measured receive rates.
409 | |
410 | | ... | *Arguments:*
411 | | ... | - trial_duration - Duration of single trial [s]. Type: float
412 | | ... | - rate - Target aggregate transmit rate [pps] / Connections per second
413 | | ... | (CPS) for UDP/TCP flows. Type: float
414 | | ... | - frame_size - L2 Frame Size [B]. Type: integer/string
415 | | ... | - traffic_profile - Name of module defining traffc for measurements.
416 | | ... | Type: string
417 | | ... | - trial_multiplicity - How many trials in this measurement.
418 | | ... | Type: int
419 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
420 | | ... | Type: int
421 | | ... | - tx_port - TX port of TG, default 0.
422 | | ... | Type: integer
423 | | ... | - rx_port - RX port of TG, default 1.
424 | | ... | Type: integer
425 | | ... | - extended_debug- True to enable extended debug.
426 | | ... | Type: boolean
427 | |
428 | | ... | *Example:*
429 | |
430 | | ... | \| Send traffic at specified rate \| \${1.0} \| ${4000000.0} \
431 | | ... | \| \${64} \| 3-node-IPv4 \| \${10} \| \${2} \| \${0} \| \${1} \
432 | | ... | \${False} \|
433 | |
434 | | [Arguments] | ${trial_duration} | ${rate} | ${frame_size}
435 | | ... | ${traffic_profile} | ${trial_multiplicity}=${trial_multiplicity}
436 | | ... | ${traffic_directions}=${2} | ${tx_port}=${0} | ${rx_port}=${1}
437 | | ... | ${extended_debug}=${extended_debug} | ${latency}=${True}
438 | |
439 | | Set Test Variable | ${extended_debug}
440 | | Clear and show runtime counters with running traffic | ${trial_duration}
441 | | ... | ${rate} | ${frame_size} | ${traffic_profile}
442 | | ... | ${traffic_directions} | ${tx_port} | ${rx_port}
443 | | FOR | ${action} | IN | @{pre_stats}
444 | | | Run Keyword | Additional Statistics Action For ${action}
445 | | END
446 | | ${results} = | Create List
447 | | FOR | ${i} | IN RANGE | ${trial_multiplicity}
448 | | | # The following line is skipping some default arguments,
449 | | | # that is why subsequent arguments have to be named.
450 | | | Send traffic on tg | ${trial_duration} | ${rate} | ${frame_size}
451 | | | ... | ${traffic_profile} | warmup_time=${0}
452 | | | ... | traffic_directions=${traffic_directions} | tx_port=${tx_port}
453 | | | ... | rx_port=${rx_port} | latency=${latency}
454 | | | ${rx} = | Get Received
455 | | | ${rr} = | Evaluate | ${rx} / ${trial_duration}
456 | | | Append To List | ${results} | ${rr}
457 | | END
458 | | FOR | ${action} | IN | @{post_stats}
459 | | | Run Keyword | Additional Statistics Action For ${action}
460 | | END
461 | | Return From Keyword | ${results}
462
463 | Measure and show latency at specified rate
464 | | [Documentation]
465 | | ... | Send traffic at specified rate, single trial.
466 | | ... | Extract latency information and append it to text message.
467 | | ... | The rate argument is int, so should not include "pps".
468 | | ... | If the given rate is too low, a safe value is used instead.
469 | |
470 | | ... | *Arguments:*
471 | | ... | - message_prefix - Preface to test message addition. Type: string
472 | | ... | - trial_duration - Duration of single trial [s]. Type: float
473 | | ... | - rate - Rate [pps] for sending packets in case of T-Rex stateless
474 | | ... | mode or multiplier of profile CPS in case of T-Rex astf mode.
475 | | ... | Type: float
476 | | ... | - frame_size - L2 Frame Size [B]. Type: integer/string
477 | | ... | - traffic_profile - Name of module defining traffic for measurements.
478 | | ... | Type: string
479 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
480 | | ... | Type: int
481 | | ... | - tx_port - TX port of TG, default 0. Type: integer
482 | | ... | - rx_port - RX port of TG, default 1. Type: integer
483 | | ... | - safe_rate - To apply if rate is below this, as latency pps is fixed.
484 | | ... | In pps, type int.
485 | |
486 | | ... | *Example:*
487 | |
488 | | ... | \| Measure and show latency at specified rate \| Latency at 90% NDR \
489 | | ... | \| \${1.0} \| ${10000000} \| \${64} \| 3-node-IPv4 \| \${2} \
490 | | ... | \| \${0} \| \${1} \| ${9500} \|
491 | |
492 | | [Arguments] | ${message_prefix} | ${trial_duration} | ${rate}
493 | | ... | ${frame_size} | ${traffic_profile} | ${traffic_directions}=${2}
494 | | ... | ${tx_port}=${0} | ${rx_port}=${1} | ${safe_rate}=${9001}
495 | |
496 | | ${real_rate} = | Evaluate | max(${rate}, ${safe_rate})
497 | | # The following line is skipping some default arguments,
498 | | # that is why subsequent arguments have to be named.
499 | | Send traffic on tg | ${trial_duration} | ${real_rate} | ${frame_size}
500 | | ... | ${traffic_profile} | warmup_time=${0}
501 | | ... | traffic_directions=${traffic_directions} | tx_port=${tx_port}
502 | | ... | rx_port=${rx_port}
503 | | ${latency} = | Get Latency Int
504 | | Set Test Message | ${\n}${message_prefix} ${latency} | append=${True}
505
506 | Clear and show runtime counters with running traffic
507 | | [Documentation]
508 | | ... | Start traffic at specified rate then clear runtime counters on all
509 | | ... | DUTs. Wait for specified amount of time and capture runtime counters
510 | | ... | on all DUTs. Finally stop traffic
511 | |
512 | | ... | *Arguments:*
513 | | ... | - duration - Duration of traffic run [s]. Type: integer
514 | | ... | - rate - Rate [pps] for sending packets in case of T-Rex stateless
515 | | ... | mode or multiplier of profile CPS in case of T-Rex astf mode.
516 | | ... | Type: float
517 | | ... | - frame_size - L2 Frame Size [B] or IMIX_v4_1. Type: integer/string
518 | | ... | - traffic_profile - Name of module defining traffc for measurements.
519 | | ... | Type: string
520 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
521 | | ... | Type: int
522 | | ... | - tx_port - TX port of TG, default 0. Type: integer
523 | | ... | - rx_port - RX port of TG, default 1. Type: integer
524 | |
525 | | ... | *Example:*
526 | |
527 | | ... | \| Clear and show runtime counters with running traffic \| \${10} \
528 | | ... | \| ${4000000.0} \| \${64} \| 3-node-IPv4 \| \${2} \| \${0} \| \${1} \|
529 | |
530 | | [Arguments] | ${duration} | ${rate} | ${frame_size} | ${traffic_profile}
531 | | ... | ${traffic_directions}=${2} | ${tx_port}=${0} | ${rx_port}=${1}
532 | |
533 | | # Duration of -1 means we will stop traffic manually.
534 | | Send traffic on tg | ${-1} | ${rate} | ${frame_size} | ${traffic_profile}
535 | | ... | warmup_time=${0} | async_call=${True} | latency=${False}
536 | | ... | traffic_directions=${traffic_directions} | tx_port=${tx_port}
537 | | ... | rx_port=${rx_port}
538 | | FOR | ${action} | IN | @{pre_run_stats}
539 | | | Run Keyword | Additional Statistics Action For ${action}
540 | | END
541 | | Sleep | ${duration}
542 | | FOR | ${action} | IN | @{post_run_stats}
543 | | | Run Keyword | Additional Statistics Action For ${action}
544 | | END
545 | | Stop traffic on tg
546
547 | Start Traffic on Background
548 | | [Documentation]
549 | | ... | Start traffic at specified rate then return control to Robot.
550 | | ... | This keyword is useful if the test needs to do something
551 | | ... | while traffic is running.
552 | |
553 | | ... | *Test (or broader scope) variables read:*
554 | | ... | - traffic_profile - Name of module defining traffc for measurements.
555 | | ... | Type: string
556 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: int or str
557 | | ... | *Arguments:*
558 | | ... | - rate - Rate [pps] for sending packets in case of T-Rex stateless
559 | | ... | mode or multiplier of profile CPS in case of T-Rex astf mode.
560 | | ... | Type: float
561 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
562 | | ... | Type: int
563 | | ... | - tx_port - TX port of TG, default 0. Type: integer
564 | | ... | - rx_port - RX port of TG, default 1. Type: integer
565 | |
566 | | ... | *Example:*
567 | |
568 | | ... | \| Start Traffic on Background \| ${4000000.0} \| \${2} \| \${0} \
569 | | ... | \| \${1} \|
570 | |
571 | | [Arguments] | ${rate} | ${traffic_directions}=${2} | ${tx_port}=${0}
572 | | ... | ${rx_port}=${1}
573 | |
574 | | # Duration of -1 means we will stop traffic manually.
575 | | Send traffic on tg | ${-1} | ${rate} | ${frame_size} | ${traffic_profile}
576 | | ... | warmup_time=${0} | async_call=${True} | latency=${False}
577 | | ... | traffic_directions=${traffic_directions} | tx_port=${tx_port}
578 | | ... | rx_port=${rx_port}
579
580 | Stop Running Traffic
581 | | [Documentation]
582 | | ... | Stop the running traffic, return measurement result.
583 | | ... | For bidirectional traffic, the reported values are bi-directional.
584 | |
585 | | ... | *Returns:*
586 | | ... | - Measurement result. Type: ReceiveRateMeasurement
587 | |
588 | | ... | *Example:*
589 | |
590 | | ... | \${result}= \| Stop Running Traffic \|
591 | |
592 | | ${result}= | Stop traffic on tg
593 | | Return From Keyword | ${result}
594
595 | Additional Statistics Action For vpp-clear-stats
596 | | [Documentation]
597 | | ... | Additional Statistics Action for clear VPP statistics.
598 | |
599 | | Clear Statistics On All DUTs | ${nodes}
600
601 | Additional Statistics Action For vpp-show-stats
602 | | [Documentation]
603 | | ... | Additional Statistics Action for show VPP statistics.
604 | |
605 | | Show Statistics On All DUTs | ${nodes}
606
607 | Additional Statistics Action For vpp-clear-runtime
608 | | [Documentation]
609 | | ... | Additional Statistics Action for clear VPP runtime.
610 | |
611 | | VPP Clear Runtime On All DUTs | ${nodes}
612
613 | Additional Statistics Action For vpp-show-runtime
614 | | [Documentation]
615 | | ... | Additional Statistics Action for show VPP runtime.
616 | |
617 | | VPP Show Runtime On All DUTs | ${nodes}
618
619 | Additional Statistics Action For vpp-enable-packettrace
620 | | [Documentation]
621 | | ... | Additional Statistics Action for enable VPP packet trace.
622 | |
623 | | Run Keyword If | ${extended_debug}==${True}
624 | | ... | VPP Enable Traces On All DUTs | ${nodes} | fail_on_error=${False}
625
626 | Additional Statistics Action For vpp-show-packettrace
627 | | [Documentation]
628 | | ... | Additional Statistics Action for show VPP packet trace.
629 | |
630 | | Run Keyword If | ${extended_debug}==${True}
631 | | ... | Show Packet Trace On All Duts | ${nodes} | maximum=${100}
632
633 | Additional Statistics Action For vpp-enable-elog
634 | | [Documentation]
635 | | ... | Additional Statistics Action for enable VPP elog trace.
636 | |
637 | | VPP Enable Elog Traces On All DUTs | ${nodes}
638
639 | Additional Statistics Action For vpp-show-elog
640 | | [Documentation]
641 | | ... | Additional Statistics Action for show VPP elog trace.
642 | |
643 | | Show Event Logger On All DUTs | ${nodes}
644
645 | Additional Statistics Action For bash-perf-stat
646 | | [Documentation]
647 | | ... | Additional Statistics Action for bash command "perf stat".
648 | |
649 | | Run Keyword If | ${extended_debug}==${True}
650 | | ... | Perf Stat On All DUTs | ${nodes}