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