Python3: resources and libraries
[csit.git] / resources / libraries / robot / performance / performance_utils.robot
1 # Copyright (c) 2019 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.DpdkUtil
19 | Library | resources.libraries.python.InterfaceUtil
20 | Library | resources.libraries.python.KubernetesUtils
21 | Library | resources.libraries.python.VhostUser
22 | Library | resources.libraries.python.TrafficGenerator
23 | Library | resources.libraries.python.TrafficGenerator.OptimizedSearch
24 | Library | resources.libraries.python.TrafficGenerator.TGDropRateSearchImpl
25 | Library | resources.libraries.python.Trace
26 | Variables | resources/libraries/python/Constants.py
27 |
28 | Documentation
29 | ... | Performance suite keywords - utilities to find and verify NDR and PDR.
30
31 *** Keywords ***
32 | Find NDR and PDR intervals using optimized search
33 | | [Documentation]
34 | | ... | Find boundaries for RFC2544 compatible NDR and PDR values
35 | | ... | using an optimized search algorithm.
36 | | ... | Display findings as a formatted test message.
37 | | ... | Fail if a resulting lower bound has too high loss fraction.
38 | | ... | Input rates are understood as uni-directional,
39 | | ... | reported result contains aggregate rates.
40 | | ... | Currently, the min_rate value is hardcoded to match test teardowns.
41 | |
42 | | ... | TODO: Should the trial duration of the additional
43 | | ... | measurements be configurable?
44 | |
45 | | ... | Some inputs are read from variables to streamline suites.
46 | |
47 | | ... | *Test (or broader scope) variables read:*
48 | | ... | - traffic_profile - Name of module defining traffc for measurements.
49 | | ... | Type: string
50 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: int or str
51 | | ... | - max_rate - Calculated unidirectional maximal transmit rate [pps].
52 | | ... | Type: float
53 | |
54 | | ... | *Arguments:*
55 | | ... | - packet_loss_ratio - Accepted loss during search. Type: float
56 | | ... | - final_relative_width - Maximal width multiple of upper. Type: float
57 | | ... | - final_trial_duration - Duration of final trials [s]. Type: float
58 | | ... | - initial_trial_duration - Duration of initial trials [s]. Type: float
59 | | ... | - intermediate phases - Number of intermediate phases [1]. Type: int
60 | | ... | - timeout - Fail if search duration is longer [s]. Type: float
61 | | ... | - doublings - How many doublings to do when expanding [1]. Type: int
62 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
63 | | ... | Type: int
64 | |
65 | | ... | *Example:*
66 | |
67 | | ... | \| Find NDR and PDR intervals using optimized search \| \${0.005} \
68 | | ... | \| \${0.005} \| \${30.0} \| \${1.0} \| \${2} \| \${600.0} \| \${2} \
69 | | ... | \| \${2} \|
70 | |
71 | | [Arguments] | ${packet_loss_ratio}=${0.005}
72 | | ... | ${final_relative_width}=${0.005} | ${final_trial_duration}=${30.0}
73 | | ... | ${initial_trial_duration}=${1.0}
74 | | ... | ${number_of_intermediate_phases}=${2} | ${timeout}=${720.0}
75 | | ... | ${doublings}=${2} | ${traffic_directions}=${2}
76 | |
77 | | ${result} = | Perform optimized ndrpdr search | ${frame_size}
78 | | ... | ${traffic_profile} | ${10000} | ${max_rate}
79 | | ... | ${packet_loss_ratio} | ${final_relative_width}
80 | | ... | ${final_trial_duration} | ${initial_trial_duration}
81 | | ... | ${number_of_intermediate_phases} | timeout=${timeout}
82 | | ... | doublings=${doublings} | traffic_directions=${traffic_directions}
83 | | Display result of NDRPDR search | ${result}
84 | | Check NDRPDR interval validity | ${result.pdr_interval}
85 | | ... | ${packet_loss_ratio}
86 | | Check NDRPDR interval validity | ${result.ndr_interval}
87 | | Perform additional measurements based on NDRPDR result
88 | | ... | ${result} | ${frame_size} | ${traffic_profile}
89
90 | Display Reconfig Test Message
91 | | [Documentation]
92 | | ... | Display the number of packets lost (bidirectionally)
93 | | ... | due to reconfiguration under traffic.
94 | |
95 | | ... | *Arguments:*
96 | | ... | - result - Result of bidirectional measurtement.
97 | | ... | Type: ReceiveRateMeasurement
98 | |
99 | | ... | *Example:*
100 | |
101 | | ... | \| Display Reconfig Test Message \| \${result} \|
102 | |
103 | | [Arguments] | ${result}
104 | |
105 | | Set Test Message | Packets lost due to reconfig: ${result.loss_count}
106 | | ${time_lost} = | Evaluate | ${result.loss_count} / ${result.target_tr}
107 | | Set Test Message | ${\n}Implied time lost: ${time_lost} | append=yes
108
109 | Find Throughput Using MLRsearch
110 | | [Documentation]
111 | | ... | Find and return lower bound PDR (zero PLR by default)
112 | | ... | aggregate throughput using MLRsearch algorithm.
113 | | ... | Input rates are understood as uni-directional.
114 | | ... | Currently, the min_rate value is hardcoded to match test teardowns.
115 | |
116 | | ... | TODO: Should the trial duration of the additional
117 | | ... | measurements be configurable?
118 | |
119 | | ... | Some inputs are read from variables to streamline suites.
120 | |
121 | | ... | *Test (or broader scope) variables read:*
122 | | ... | - traffic_profile - Name of module defining traffc for measurements.
123 | | ... | Type: string
124 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: int or str
125 | | ... | - max_rate - Calculated unidirectional maximal transmit rate [pps].
126 | | ... | Type: float
127 | |
128 | | ... | *Arguments:*
129 | | ... | - packet_loss_ratio - Accepted loss during search. Type: float
130 | | ... | - final_relative_width - Maximal width multiple of upper. Type: float
131 | | ... | - final_trial_duration - Duration of final trials [s]. Type: float
132 | | ... | - initial_trial_duration - Duration of initial trials [s]. Type: float
133 | | ... | - intermediate phases - Number of intermediate phases [1]. Type: int
134 | | ... | - timeout - Fail if search duration is longer [s]. Type: float
135 | | ... | - doublings - How many doublings to do when expanding [1]. Type: int
136 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
137 | | ... | Type: int
138 | |
139 | | ... | *Returns:*
140 | | ... | - Lower bound for bi-directional throughput at given PLR. Type: float
141 | |
142 | | ... | *Example:*
143 | |
144 | | ... | \| \${throughpt}= \| Find Throughput Using MLRsearch \| \${0} \
145 | | ... | \| \${0.001} \| \${10.0}\| \${1.0} \| \${1} \| \${720.0} \| \${2} \
146 | | ... | \| \${2} \|
147 | |
148 | | [Arguments] | ${packet_loss_ratio}=${0.0}
149 | | ... | ${final_relative_width}=${0.001} | ${final_trial_duration}=${10.0}
150 | | ... | ${initial_trial_duration}=${1.0}
151 | | ... | ${number_of_intermediate_phases}=${1} | ${timeout}=${720.0}
152 | | ... | ${doublings}=${2} | ${traffic_directions}=${2}
153 | |
154 | | ${result} = | Perform optimized ndrpdr search | ${frame_size}
155 | | ... | ${traffic_profile} | ${10000} | ${max_rate}
156 | | ... | ${packet_loss_ratio} | ${final_relative_width}
157 | | ... | ${final_trial_duration} | ${initial_trial_duration}
158 | | ... | ${number_of_intermediate_phases} | timeout=${timeout}
159 | | ... | doublings=${doublings} | traffic_directions=${traffic_directions}
160 | | Return From Keyword | ${result.pdr_interval.measured_low.transmit_rate}
161
162 | Find critical load using PLRsearch
163 | | [Documentation]
164 | | ... | Find boundaries for troughput (of given target loss ratio)
165 | | ... | using PLRsearch algorithm.
166 | | ... | Display results as formatted test message.
167 | | ... | Fail if computed lower bound is below minimal rate.
168 | | ... | Input rates are understood as uni-directional,
169 | | ... | reported result contains aggregate rates.
170 | | ... | Currently, the min_rate value is hardcoded to match test teardowns.
171 | | ... | Some inputs are read from variables to streamline suites.
172 | |
173 | | ... | *Test (or broader scope) variables read:*
174 | | ... | - traffic_profile - Name of module defining traffc for measurements.
175 | | ... | Type: string
176 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: int or str
177 | | ... | - max_rate - Calculated unidirectional maximal transmit rate [pps].
178 | | ... | Type: float
179 | |
180 | | ... | *Arguments:*
181 | | ... | - packet_loss_ratio - Accepted loss during search. Type: float
182 | | ... | - timeout - Stop when search duration is longer [s]. Type: float
183 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
184 | | ... | Type: int
185 | |
186 | | ... | *Example:*
187 | |
188 | | ... | \| Find critical load using PLR search \| \${1e-7} \| \${120} \
189 | | ... | \| \${2} \|
190 | |
191 | | [Arguments] | ${packet_loss_ratio}=${1e-7} | ${timeout}=${1800.0}
192 | | ... | ${traffic_directions}=${2}
193 | |
194 | | ${min_rate} = | Set Variable | ${10000}
195 | | ${average} | ${stdev} = | Perform soak search | ${frame_size}
196 | | ... | ${traffic_profile} | ${min_rate} | ${max_rate}
197 | | ... | ${packet_loss_ratio} | timeout=${timeout}
198 | | ... | traffic_directions=${traffic_directions}
199 | | ${lower} | ${upper} = | Display result of soak search
200 | | ... | ${average} | ${stdev}
201 | | Should Not Be True | ${lower} < ${min_rate}
202 | | ... | Lower bound ${lower} is below unidirectional minimum ${min_rate}.
203
204 | Display single bound
205 | | [Documentation]
206 | | ... | Display one bound of NDR+PDR search,
207 | | ... | in packet per seconds (total and per stream)
208 | | ... | and Gbps total bandwidth (for initial packet size).
209 | | ... | Througput is calculated as:
210 | | ... | Sum of measured rates over streams
211 | | ... | Bandwidth is calculated as:
212 | | ... | (Throughput * (L2 Frame Size + IPG) * 8)
213 | | ... | The given result should contain latency data as well.
214 | |
215 | | ... | *Arguments:*
216 | | ... | - text - Flavor text describing which bound is this. Type: string
217 | | ... | - rate_total - Total (not per stream) measured Tr [pps]. Type: float
218 | | ... | - frame_size - L2 Frame Size [B]. Type: integer
219 | | ... | - latency - Latency data to display if non-empty. Type: string
220 | |
221 | | ... | *Example:*
222 | |
223 | | ... | \| Display single bound \| NDR lower bound \| \${12345.67} \
224 | | ... | \| \${64} \| show_latency=\${EMPTY} \|
225 | |
226 | | [Arguments] | ${text} | ${rate_total} | ${frame_size} | ${latency}=${EMPTY}
227 | |
228 | | ${bandwidth_total} = | Evaluate | ${rate_total} * (${frame_size}+20)*8 / 1e9
229 | | Set Test Message | ${\n}${text}: ${rate_total} pps, | append=yes
230 | | Set Test Message | ${bandwidth_total} Gbps (initial) | append=yes
231 | | Return From Keyword If | not """${latency}"""
232 | | Set Test Message | ${\n}LATENCY [min/avg/max/hdrh] per stream: ${latency}
233 | | ... | append=yes
234
235 | Display result of NDRPDR search
236 | | [Documentation]
237 | | ... | Display result of NDR+PDR search, both quantities, both bounds,
238 | | ... | aggregate in packet per seconds
239 | | ... | and Gbps total bandwidth (for initial packet size).
240 | | ... | Througput is calculated as:
241 | | ... | Sum of measured rate over streams
242 | | ... | Bandwidth is calculated as:
243 | | ... | (Throughput * (L2 Frame Size + IPG) * 8)
244 | | ... | The given result should contain latency data as well.
245 | |
246 | | ... | *Test (or broader scope) variables read:*
247 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: int or str
248 | | ... | *Arguments:*
249 | | ... | - result - Measured result data per stream [pps]. Type: NdrPdrResult
250 | |
251 | | ... | *Example:*
252 | |
253 | | ... | \| Display result of NDRPDR search \| \${result} \|
254 | |
255 | | [Arguments] | ${result}
256 | |
257 | | ${frame_size} = | Get Average Frame Size | ${frame_size}
258 | | Display single bound | NDR_LOWER
259 | | ... | ${result.ndr_interval.measured_low.transmit_rate} | ${frame_size}
260 | | ... | ${result.ndr_interval.measured_low.latency}
261 | | Display single bound | NDR_UPPER
262 | | ... | ${result.ndr_interval.measured_high.transmit_rate} | ${frame_size}
263 | | Display single bound | PDR_LOWER
264 | | ... | ${result.pdr_interval.measured_low.transmit_rate} | ${frame_size}
265 | | ... | ${result.pdr_interval.measured_low.latency}
266 | | Display single bound | PDR_UPPER
267 | | ... | ${result.pdr_interval.measured_high.transmit_rate} | ${frame_size}
268
269 | Display result of soak search
270 | | [Documentation]
271 | | ... | Display result of soak search, avg+-stdev, as upper/lower bounds,
272 | | ... | in aggregate packets per seconds
273 | | ... | and Gbps total bandwidth (for initial packet size).
274 | | ... | Througput is calculated as:
275 | | ... | Sum of measured rates over streams
276 | | ... | Bandwidth is calculated as:
277 | | ... | (Throughput * (L2 Frame Size + IPG) * 8)
278 | | ... | TODO: Do we want to report some latency data,
279 | | ... | even if not measured at the reported bounds?.
280 | |
281 | | ... | *Test (or broader scope) variables read:*
282 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: int or str
283 | | ... | *Arguments:*
284 | | ... | - avg - Estimated average critical load [pps]. Type: float
285 | | ... | - stdev - Standard deviation of critical load [pps]. Type: float
286 | |
287 | | ... | *Returns:*
288 | | ... | - Lower and upper bound of critical load [pps]. Type: 2-tuple of float
289 | |
290 | | ... | *Example:*
291 | |
292 | | ... | \| Display result of soak search \| \${100000} \| \${100} \|
293 | |
294 | | [Arguments] | ${avg} | ${stdev}
295 | |
296 | | ${frame_size} = | Get Average Frame Size | ${frame_size}
297 | | ${avg} = | Convert To Number | ${avg}
298 | | ${stdev} = | Convert To Number | ${stdev}
299 | | ${lower} = | Evaluate | ${avg} - ${stdev}
300 | | ${upper} = | Evaluate | ${avg} + ${stdev}
301 | | Display single bound | PLRsearch lower bound | ${lower} | ${frame_size}
302 | | Display single bound | PLRsearch upper bound | ${upper} | ${frame_size}
303 | | Return From Keyword | ${lower} | ${upper}
304
305 | Check NDRPDR interval validity
306 | | [Documentation]
307 | | ... | Extract loss ratio of lower bound of the interval.
308 | | ... | Fail if it does not reach the allowed value.
309 | |
310 | | ... | *Arguments:*
311 | | ... | - interval - Measured interval. Type: ReceiveRateInterval
312 | | ... | - packet_loss_ratio - Accepted loss (0.0 for NDR). Type: float
313 | |
314 | | ... | *Example:*
315 | |
316 | | ... | \| Check NDRPDR interval validity \| \${result.pdr_interval} \
317 | | ... | \| \${0.005} \|
318 | |
319 | | [Arguments] | ${interval} | ${packet_loss_ratio}=${0.0}
320 | |
321 | | ${lower_bound} = | Set Variable | ${interval.measured_low}
322 | | ${lower_bound_lf} = | Set Variable | ${lower_bound.loss_fraction}
323 | | Return From Keyword If | ${lower_bound_lf} <= ${packet_loss_ratio}
324 | | ${message}= | Catenate | SEPARATOR=${SPACE}
325 | | ... | Minimal rate loss fraction ${lower_bound_lf}
326 | | ... | does not reach target ${packet_loss_ratio}.
327 | | ${message_zero} = | Set Variable | Zero packets forwarded!
328 | | ${message_other} = | Set Variable | ${lower_bound.loss_count} packets lost.
329 | | ${message} = | Set Variable If | ${lower_bound_lf} >= 1.0
330 | | ... | ${message}${\n}${message_zero} | ${message}${\n}${message_other}
331 | | Fail | ${message}
332
333 | Perform additional measurements based on NDRPDR result
334 | | [Documentation]
335 | | ... | Perform any additional measurements which are not directly needed
336 | | ... | for determining NDR nor PDR, but which are needed for gathering
337 | | ... | additional data for debug purposes.
338 | | ... | Currently, just "Traffic should pass with no loss" is called.
339 | | ... | TODO: Move latency measurements from optimized search here.
340 | |
341 | | ... | *Arguments:*
342 | | ... | - result - Measured result data per stream [pps]. Type: NdrPdrResult
343 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: int or str
344 | | ... | - traffic_profile - Topology profile. Type: string
345 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
346 | | ... | Type: int
347 | |
348 | | ... | *Example:*
349 | | ... | \| Perform additional measurements based on NDRPDR result \
350 | | ... | \| \${result} \| \${64} \| 3-node-IPv4 \| \${2} \|
351 | |
352 | | [Arguments] | ${result} | ${framesize} | ${traffic_profile}
353 | | ... | ${traffic_directions}=${2}
354 | |
355 | | ${duration}= | Set Variable | ${2.0}
356 | | ${rate_sum}= | Set Variable | ${result.ndr_interval.measured_low.target_tr}
357 | | ${rate_per_stream}= | Evaluate | ${rate_sum} / float(${traffic_directions})
358 | | Traffic should pass with no loss | ${duration} | ${rate_per_stream}pps
359 | | ... | ${framesize} | ${traffic_profile} | fail_on_loss=${False}
360 | | ... | traffic_directions=${traffic_directions}
361
362 | Traffic should pass with no loss
363 | | [Documentation]
364 | | ... | Send traffic at specified rate. No packet loss is accepted at loss
365 | | ... | evaluation.
366 | |
367 | | ... | *Arguments:*
368 | | ... | - duration - Duration of traffic run [s]. Type: integer
369 | | ... | - rate - Rate for sending packets. Type: string
370 | | ... | - frame_size - L2 Frame Size [B] or IMIX_v4_1. Type: integer/string
371 | | ... | - traffic_profile - Name of module defining traffc for measurements.
372 | | ... | Type: string
373 | | ... | - fail_on_loss - If True, the keyword fails if loss occurred.
374 | | ... | Type: boolean
375 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
376 | | ... | Type: int
377 | |
378 | | ... | *Example:*
379 | |
380 | | ... | \| Traffic should pass with no loss \| \${10} \| 4.0mpps \| \${64} \
381 | | ... | \| 3-node-IPv4 \| \${2} \|
382 | |
383 | | [Arguments] | ${duration} | ${rate} | ${frame_size} | ${traffic_profile}
384 | | ... | ${fail_on_loss}=${True} | ${traffic_directions}=${2}
385 | |
386 | | Send traffic at specified rate | ${duration} | ${rate} | ${frame_size}
387 | | ... | ${traffic_profile} | traffic_directions=${traffic_directions}
388 | | Run Keyword If | ${fail_on_loss} | No traffic loss occurred
389
390 | Traffic should pass with maximum rate
391 | | [Documentation]
392 | | ... | Send traffic at maximum rate.
393 | |
394 | | ... | Some inputs are read from variables to streamline suites.
395 | |
396 | | ... | *Test (or broader scope) variables read:*
397 | | ... | - traffic_profile - Name of module defining traffc for measurements.
398 | | ... | Type: string
399 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: int or str
400 | | ... | - max_rate - Calculated unidirectional maximal transmit rate [pps].
401 | | ... | Type: float
402 | |
403 | | ... | *Arguments:*
404 | | ... | - subsamples - How many trials in this measurement. Type: int
405 | | ... | - trial_duration - Duration of single trial [s]. Type: float
406 | | ... | - fail_no_traffic - Whether to fail on zero receive count. Type: boolean
407 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
408 | | ... | Type: int
409 | | ... | - tx_port - TX port of TG, default 0. Type: integer
410 | | ... | - rx_port - RX port of TG, default 1. Type: integer
411 | |
412 | | ... | *Example:*
413 | |
414 | | ... | \| Traffic should pass with maximum rate \| \${1} \| \${10.0} \
415 | | ... | \| \${False} \| \${2} \| \${0} \| \${1} \|
416 | |
417 | | [Arguments] | ${trial_duration}=${PERF_TRIAL_DURATION}
418 | | ... | ${fail_no_traffic}=${True} | ${subsamples}=${PERF_TRIAL_MULTIPLICITY}
419 | | ... | ${traffic_directions}=${2} | ${tx_port}=${0} | ${rx_port}=${1}
420 | |
421 | | ${results} = | Send traffic at specified rate | ${trial_duration}
422 | | ... | ${max_rate}pps | ${frame_size} | ${traffic_profile} | ${subsamples}
423 | | ... | ${traffic_directions} | ${tx_port} | ${rx_port}
424 | | Set Test Message | ${\n}Maximum Receive Rate trial results
425 | | Set Test Message | in packets per second: ${results}
426 | | ... | append=yes
427 | | # TODO: Should we also report the percentage relative to transmit rate,
428 | | # so that people looking at console can decide how close to 100% it is?
429 | | Run Keyword If | ${fail_no_traffic} | Fail if no traffic forwarded
430
431 | Send traffic at specified rate
432 | | [Documentation]
433 | | ... | Send traffic at specified rate.
434 | | ... | Return list of measured receive rates.
435 | | ... | The rate argument should be TRex friendly, so it should include "pps".
436 | |
437 | | ... | *Arguments:*
438 | | ... | - trial_duration - Duration of single trial [s]. Type: float
439 | | ... | - rate - Rate for sending packets. Type: string
440 | | ... | - frame_size - L2 Frame Size [B]. Type: integer/string
441 | | ... | - traffic_profile - Name of module defining traffc for measurements.
442 | | ... | Type: string
443 | | ... | - subsamples - How many trials in this measurement. Type: int
444 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
445 | | ... | Type: int
446 | | ... | - tx_port - TX port of TG, default 0. Type: integer
447 | | ... | - rx_port - RX port of TG, default 1. Type: integer
448 | | ... | - pkt_trace - True to enable packet trace. Type: boolean
449 | |
450 | | ... | *Example:*
451 | |
452 | | ... | \| Send traffic at specified rate \| \${1.0} \| 4.0mpps \| \${64} \
453 | | ... | \| 3-node-IPv4 \| \${10} \| \${2} \| \${0} | \${1} \| \${False}
454 | |
455 | | [Arguments] | ${trial_duration} | ${rate} | ${frame_size}
456 | | ... | ${traffic_profile} | ${subsamples}=${1} | ${traffic_directions}=${2}
457 | | ... | ${tx_port}=${0} | ${rx_port}=${1} | ${pkt_trace}=${False}
458 | |
459 | | Clear and show runtime counters with running traffic | ${trial_duration}
460 | | ... | ${rate} | ${frame_size} | ${traffic_profile}
461 | | ... | ${traffic_directions} | ${tx_port} | ${rx_port}
462 | | Run Keyword If | ${dut_stats}==${True}
463 | | ... | Clear statistics on all DUTs | ${nodes}
464 | | Run Keyword If | ${dut_stats}==${True} and ${pkt_trace}==${True}
465 | | ... | VPP Enable Traces On All DUTs | ${nodes} | fail_on_error=${False}
466 | | Run Keyword If | ${dut_stats}==${True}
467 | | ... | VPP enable elog traces on all DUTs | ${nodes}
468 | | ${results} = | Create List
469 | | FOR | ${i} | IN RANGE | ${subsamples}
470 | | | # The following line is skipping some default arguments,
471 | | | # that is why subsequent arguments have to be named.
472 | | | Send traffic on tg | ${trial_duration} | ${rate} | ${frame_size}
473 | | | ... | ${traffic_profile} | warmup_time=${0}
474 | | | ... | traffic_directions=${traffic_directions} | tx_port=${tx_port}
475 | | | ... | rx_port=${rx_port}
476 | | | ${rx} = | Get Received
477 | | | ${rr} = | Evaluate | ${rx} / ${trial_duration}
478 | | | Append To List | ${results} | ${rr}
479 | | END
480 | | Run Keyword If | ${dut_stats}==${True} | Show event logger on all DUTs
481 | | ... | ${nodes}
482 | | Run Keyword If | ${dut_stats}==${True} | Show statistics on all DUTs
483 | | ... | ${nodes}
484 | | Run Keyword If | ${dut_stats}==${True} and ${pkt_trace}==${True}
485 | | ... | Show Packet Trace On All Duts | ${nodes} | maximum=${100}
486 | | Return From Keyword | ${results}
487
488 | Clear and show runtime counters with running traffic
489 | | [Documentation]
490 | | ... | Start traffic at specified rate then clear runtime counters on all
491 | | ... | DUTs. Wait for specified amount of time and capture runtime counters
492 | | ... | on all DUTs. Finally stop traffic
493 | |
494 | | ... | *Arguments:*
495 | | ... | - duration - Duration of traffic run [s]. Type: integer
496 | | ... | - rate - Unidirectional rate for sending packets. Type: string
497 | | ... | - frame_size - L2 Frame Size [B] or IMIX_v4_1. Type: integer/string
498 | | ... | - traffic_profile - Name of module defining traffc for measurements.
499 | | ... | Type: string
500 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
501 | | ... | Type: int
502 | | ... | - tx_port - TX port of TG, default 0. Type: integer
503 | | ... | - rx_port - RX port of TG, default 1. Type: integer
504 | |
505 | | ... | *Example:*
506 | |
507 | | ... | \| Clear and show runtime counters with running traffic \| \${10} \
508 | | ... | \| 4.0mpps \| \${64} \| 3-node-IPv4 \| \${2} \| \${0} \| \${1} \|
509 | |
510 | | [Arguments] | ${duration} | ${rate} | ${frame_size} | ${traffic_profile}
511 | | ... | ${traffic_directions}=${2} | ${tx_port}=${0} | ${rx_port}=${1}
512 | |
513 | | # Duration of -1 means we will stop traffic manually.
514 | | Send traffic on tg | ${-1} | ${rate} | ${frame_size} | ${traffic_profile}
515 | | ... | warmup_time=${0} | async_call=${True} | latency=${False}
516 | | ... | traffic_directions=${traffic_directions} | tx_port=${tx_port}
517 | | ... | rx_port=${rx_port}
518 | | Run Keyword If | ${dut_stats}==${True}
519 | | ... | VPP clear runtime counters on all DUTs | ${nodes}
520 | | Sleep | ${duration}
521 | | Run Keyword If | ${dut_stats}==${True}
522 | | ... | VPP show runtime counters on all DUTs | ${nodes}
523 | | Stop traffic on tg
524
525 | Start Traffic on Background
526 | | [Documentation]
527 | | ... | Start traffic at specified rate then return control to Robot.
528 | |
529 | | ... | This keyword is useful if the test needs to do something
530 | | ... | while traffic is running.
531 | | ... | Just a wrapper around L1 keyword.
532 | | ... |
533 | | ... | TODO: How to make sure the traffic is stopped on any failure?
534 | |
535 | | ... | *Test (or broader scope) variables read:*
536 | | ... | - traffic_profile - Name of module defining traffc for measurements.
537 | | ... | Type: string
538 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: int or str
539 | | ... | *Arguments:*
540 | | ... | - rate - Unidirectional rate for sending packets. Type: string
541 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
542 | | ... | Type: int
543 | | ... | - tx_port - TX port of TG, default 0. Type: integer
544 | | ... | - rx_port - RX port of TG, default 1. Type: integer
545 | |
546 | | ... | *Example:*
547 | |
548 | | ... | \| Start Traffic on Background \| 4.0mpps \| \${2} \| \${0} \
549 | | ... | \| \${1} \|
550 | |
551 | | [Arguments] | ${rate} | ${traffic_directions}=${2} | ${tx_port}=${0}
552 | | ... | ${rx_port}=${1}
553 | |
554 | | # Duration of -1 means we will stop traffic manually.
555 | | Send traffic on tg | ${-1} | ${rate} | ${frame_size} | ${traffic_profile}
556 | | ... | warmup_time=${0} | async_call=${True} | latency=${False}
557 | | ... | traffic_directions=${traffic_directions} | tx_port=${tx_port}
558 | | ... | rx_port=${rx_port}
559
560 | Stop Running Traffic
561 | | [Documentation]
562 | | ... | Stop the running traffic, return measurement result.
563 | | ... | For bidirectional traffic, the reported values are bi-directional.
564 | |
565 | | ... | Just a wrapper around L1 keyword.
566 | | ... |
567 | | ... | TODO: Tolerate if traffic was not started.
568 | |
569 | | ... | *Returns:*
570 | | ... | - Measurement result. Type: ReceiveRateMeasurement
571 | |
572 | | ... | *Example:*
573 | |
574 | | ... | \${result}= \| Stop Running Traffic \|
575 | |
576 | | ${result}= | Stop traffic on tg
577 | | Return From Keyword | ${result}