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