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