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