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