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