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