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