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