Framework: Code aligments
[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.PerfUtil
19 | Library | resources.libraries.python.InterfaceUtil
20 | Library | resources.libraries.python.TrafficGenerator
21 | Library | resources.libraries.python.TrafficGenerator.OptimizedSearch
22 | Library | resources.libraries.python.TrafficGenerator.TGDropRateSearchImpl
23 | Library | resources.libraries.python.Trace
24 | Variables | resources/libraries/python/Constants.py
25 |
26 | Documentation
27 | ... | Performance suite keywords - utilities to find and verify NDR and PDR.
28
29 *** Variables ***
30 | ${trial_duration}= | ${PERF_TRIAL_DURATION}
31 | ${trial_multiplicity}= | ${PERF_TRIAL_MULTIPLICITY}
32 | ${extended_debug}= | ${EXTENDED_DEBUG}
33
34 *** Keywords ***
35 | Find NDR and PDR intervals using optimized search
36 | | [Documentation]
37 | | ... | Find boundaries for RFC2544 compatible NDR and PDR values
38 | | ... | using an optimized search algorithm.
39 | | ... | Display findings as a formatted test message.
40 | | ... | Fail if a resulting lower bound has too high loss fraction.
41 | | ... | Input rates are understood as uni-directional,
42 | | ... | reported result contains aggregate rates.
43 | | ... | Additional latency measurements are performed for smaller loads,
44 | | ... | their results are also displayed.
45 | | ... | Finally, two measurements for runtime stats are done (not displayed).
46 | | ... | Currently, the min_rate value is hardcoded to 90kpps,
47 | | ... | allowing measurement at 10% of the discovered rate
48 | | ... | without breaking latency streams.
49 | |
50 | | ... | *Test (or broader scope) variables read:*
51 | | ... | - traffic_profile - Name of module defining traffc for measurements.
52 | | ... | Type: string
53 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
54 | | ... | string
55 | | ... | - max_rate - Calculated unidirectional maximal transmit rate [pps].
56 | | ... | Type: float
57 | |
58 | | ... | *Arguments:*
59 | | ... | - packet_loss_ratio - Accepted loss during search. Type: float
60 | | ... | - final_relative_width - Maximal width multiple of upper. Type: float
61 | | ... | - final_trial_duration - Duration of final trials [s]. Type: float
62 | | ... | - initial_trial_duration - Duration of initial trials [s]. Type: float
63 | | ... | - intermediate phases - Number of intermediate phases [1].
64 | | ... | Type: integer
65 | | ... | - timeout - Fail if search duration is longer [s]. Type: float
66 | | ... | - doublings - How many doublings to do when expanding [1].
67 | | ... | Type: integer
68 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
69 | | ... | Type: integer
70 | | ... | - latency_duration - Duration for latency-specific trials. Type: float
71 | | ... | - latency - False to disable latency measurement; default value: True.
72 | | ... | Type: boolean
73 | |
74 | | ... | *Example:*
75 | |
76 | | ... | \| Find NDR and PDR intervals using optimized search \| \${0.005} \
77 | | ... | \| \${0.005} \| \${30.0} \| \${1.0} \| \${2} \| \${600.0} \| \${2} \
78 | | ... | \| \${2} \| ${5.0} \|
79 | |
80 | | [Arguments] | ${packet_loss_ratio}=${0.005}
81 | | ... | ${final_relative_width}=${0.005} | ${final_trial_duration}=${30.0}
82 | | ... | ${initial_trial_duration}=${1.0}
83 | | ... | ${number_of_intermediate_phases}=${2} | ${timeout}=${720.0}
84 | | ... | ${doublings}=${2} | ${traffic_directions}=${2}
85 | | ... | ${latency_duration}=${PERF_TRIAL_LATENCY_DURATION}
86 | | ... | ${latency}=${True}
87 | |
88 | | # Latency measurements will need more than 9000 pps.
89 | | ${result} = | Perform optimized ndrpdr search | ${frame_size}
90 | | ... | ${traffic_profile} | ${9001} | ${max_rate}
91 | | ... | ${packet_loss_ratio} | ${final_relative_width}
92 | | ... | ${final_trial_duration} | ${initial_trial_duration}
93 | | ... | ${number_of_intermediate_phases} | timeout=${timeout}
94 | | ... | doublings=${doublings} | traffic_directions=${traffic_directions}
95 | | ... | latency=${latency}
96 | | Display result of NDRPDR search | ${result}
97 | | Check NDRPDR interval validity | ${result.pdr_interval}
98 | | ... | ${packet_loss_ratio}
99 | | Check NDRPDR interval validity | ${result.ndr_interval}
100 | | ${pdr_sum}= | Set Variable | ${result.pdr_interval.measured_low.target_tr}
101 | | ${pdr_per_stream}= | Evaluate | ${pdr_sum} / float(${traffic_directions})
102 | | ${ndr_sum}= | Set Variable | ${result.ndr_interval.measured_low.target_tr}
103 | | ${ndr_per_stream}= | Evaluate | ${ndr_sum} / float(${traffic_directions})
104 | | ${rate}= | Evaluate | 0.9 * ${pdr_per_stream}
105 | | Run Keyword If | ${latency}
106 | | ... | Measure and show latency at specified rate | Latency at 90% PDR:
107 | | ... | ${latency_duration} | ${rate} | ${framesize}
108 | | ... | ${traffic_profile} | ${traffic_directions}
109 | | ${rate}= | Evaluate | 0.5 * ${pdr_per_stream}
110 | | Run Keyword If | ${latency}
111 | | ... | Measure and show latency at specified rate | Latency at 50% PDR:
112 | | ... | ${latency_duration} | ${rate} | ${framesize}
113 | | ... | ${traffic_profile} | ${traffic_directions}
114 | | ${rate}= | Evaluate | 0.1 * ${pdr_per_stream}
115 | | Run Keyword If | ${latency}
116 | | ... | Measure and show latency at specified rate | Latency at 10% PDR:
117 | | ... | ${latency_duration} | ${rate} | ${framesize}
118 | | ... | ${traffic_profile} | ${traffic_directions}
119 | | Run Keyword If | ${latency}
120 | | ... | Measure and show latency at specified rate | Latency at 0% PDR:
121 | | ... | ${latency_duration} | ${0} | ${framesize}
122 | | ... | ${traffic_profile} | ${traffic_directions}
123 | | # Finally, trials with runtime and other stats.
124 | | # We expect NDR and PDR to have different-looking stats.
125 | | Send traffic at specified rate
126 | | ... | ${1.0} | ${pdr_per_stream} | ${framesize} | ${traffic_profile}
127 | | ... | traffic_directions=${traffic_directions}
128 | | Send traffic at specified rate
129 | | ... | ${1.0} | ${ndr_per_stream} | ${framesize} | ${traffic_profile}
130 | | ... | traffic_directions=${traffic_directions}
131
132 | Find Throughput Using MLRsearch
133 | | [Documentation]
134 | | ... | Find and return lower bound PDR (zero PLR by default)
135 | | ... | aggregate throughput using MLRsearch algorithm.
136 | | ... | Input rates are understood as uni-directional.
137 | | ... | Currently, the min_rate value is hardcoded to match test teardowns.
138 | |
139 | | ... | *Test (or broader scope) variables read:*
140 | | ... | - traffic_profile - Name of module defining traffc for measurements.
141 | | ... | Type: string
142 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
143 | | ... | string
144 | | ... | - max_rate - Calculated unidirectional maximal transmit rate [pps].
145 | | ... | Type: float
146 | |
147 | | ... | *Arguments:*
148 | | ... | - packet_loss_ratio - Accepted loss during search. Type: float
149 | | ... | - final_relative_width - Maximal width multiple of upper. Type: float
150 | | ... | - final_trial_duration - Duration of final trials [s]. Type: float
151 | | ... | - initial_trial_duration - Duration of initial trials [s]. Type: float
152 | | ... | - intermediate phases - Number of intermediate phases [1].
153 | | ... | Type: integer
154 | | ... | - timeout - Fail if search duration is longer [s]. Type: float
155 | | ... | - doublings - How many doublings to do when expanding [1].
156 | | ... | Type: integer
157 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
158 | | ... | Type: integer
159 | | ... | - latency - True to enable latency measurement; default value: False.
160 | | ... | Type: boolean
161 | |
162 | | ... | *Returns:*
163 | | ... | - Lower bound for bi-directional throughput at given PLR. Type: float
164 | |
165 | | ... | *Example:*
166 | |
167 | | ... | \| \${throughpt}= \| Find Throughput Using MLRsearch \| \${0} \
168 | | ... | \| \${0.001} \| \${10.0}\| \${1.0} \| \${1} \| \${720.0} \| \${2} \
169 | | ... | \| \${2} \|
170 | |
171 | | [Arguments] | ${packet_loss_ratio}=${0.0}
172 | | ... | ${final_relative_width}=${0.001} | ${final_trial_duration}=${10.0}
173 | | ... | ${initial_trial_duration}=${1.0}
174 | | ... | ${number_of_intermediate_phases}=${1} | ${timeout}=${720.0}
175 | | ... | ${doublings}=${2} | ${traffic_directions}=${2} | ${latency}=${False}
176 | |
177 | | ${result} = | Perform optimized ndrpdr search | ${frame_size}
178 | | ... | ${traffic_profile} | ${10000} | ${max_rate}
179 | | ... | ${packet_loss_ratio} | ${final_relative_width}
180 | | ... | ${final_trial_duration} | ${initial_trial_duration}
181 | | ... | ${number_of_intermediate_phases} | timeout=${timeout}
182 | | ... | doublings=${doublings} | traffic_directions=${traffic_directions}
183 | | ... | latency=${latency}
184 | | Check NDRPDR interval validity | ${result.pdr_interval}
185 | | ... | ${packet_loss_ratio}
186 | | Return From Keyword | ${result.pdr_interval.measured_low.target_tr}
187
188 | Find critical load using PLRsearch
189 | | [Documentation]
190 | | ... | Find boundaries for troughput (of given target loss ratio)
191 | | ... | using PLRsearch algorithm.
192 | | ... | Display results as formatted test message.
193 | | ... | Fail if computed lower bound 110% of the minimal rate or less.
194 | | ... | Input rates are understood as uni-directional,
195 | | ... | reported result contains aggregate rates.
196 | | ... | Currently, the min_rate value is hardcoded to match test teardowns.
197 | |
198 | | ... | *Test (or broader scope) variables read:*
199 | | ... | - traffic_profile - Name of module defining traffc for measurements.
200 | | ... | Type: string
201 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
202 | | ... | string
203 | | ... | - max_rate - Calculated unidirectional maximal transmit rate [pps].
204 | | ... | Type: float
205 | |
206 | | ... | *Arguments:*
207 | | ... | - packet_loss_ratio - Accepted loss during search. Type: float
208 | | ... | - timeout - Stop when search duration is longer [s]. Type: float
209 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
210 | | ... | Type: integer
211 | | ... | - latency - True to enable latency measurement; default value: False.
212 | | ... | Type: boolean
213 | |
214 | | ... | *Example:*
215 | |
216 | | ... | \| Find critical load using PLR search \| \${1e-7} \| \${120} \
217 | | ... | \| \${2} \|
218 | |
219 | | [Arguments] | ${packet_loss_ratio}=${1e-7} | ${timeout}=${1800.0}
220 | | ... | ${traffic_directions}=${2} | ${latency}=${False}
221 | |
222 | | ${min_rate} = | Set Variable | ${10000}
223 | | ${average} | ${stdev} = | Perform soak search | ${frame_size}
224 | | ... | ${traffic_profile} | ${min_rate} | ${max_rate}
225 | | ... | ${packet_loss_ratio} | timeout=${timeout}
226 | | ... | traffic_directions=${traffic_directions} | latency=${latency}
227 | | ${lower} | ${upper} = | Display result of soak search
228 | | ... | ${average} | ${stdev}
229 | | Should Not Be True | 1.1 * ${traffic_directions} * ${min_rate} > ${lower}
230 | | ... | Lower bound ${lower} too small for unidirectional minimum ${min_rate}.
231
232 | Display single bound
233 | | [Documentation]
234 | | ... | Display one bound of NDR+PDR search,
235 | | ... | in packet per seconds (total and per stream)
236 | | ... | and Gbps total bandwidth (for initial packet size).
237 | | ... | Througput is calculated as:
238 | | ... | Sum of measured rates over streams
239 | | ... | Bandwidth is calculated as:
240 | | ... | (Throughput * (L2 Frame Size + IPG) * 8)
241 | | ... | The given result should contain latency data as well.
242 | |
243 | | ... | *Arguments:*
244 | | ... | - text - Flavor text describing which bound is this. Type: string
245 | | ... | - rate_total - Total (not per stream) measured Tr [pps]. Type: float
246 | | ... | - frame_size - L2 Frame Size [B]. Type: integer
247 | | ... | - latency - Latency data to display if non-empty. Type: string
248 | |
249 | | ... | *Example:*
250 | |
251 | | ... | \| Display single bound \| NDR lower bound \| \${12345.67} \
252 | | ... | \| \${64} \| latency=\${EMPTY} \|
253 | |
254 | | [Arguments] | ${text} | ${rate_total} | ${frame_size} | ${latency}=${EMPTY}
255 | |
256 | | ${bandwidth_total} = | Evaluate | ${rate_total} * (${frame_size}+20)*8 / 1e9
257 | | Set Test Message | ${\n}${text}: ${rate_total} pps, | append=yes
258 | | Set Test Message | ${bandwidth_total} Gbps (initial) | append=yes
259 | | Return From Keyword If | not """${latency}"""
260 | | Set Test Message | ${\n}LATENCY [min/avg/max/hdrh] per stream: ${latency}
261 | | ... | append=yes
262
263 | Display Reconfig Test Message
264 | | [Documentation]
265 | | ... | Display the number of packets lost (bidirectionally)
266 | | ... | due to reconfiguration under traffic.
267 | |
268 | | ... | *Arguments:*
269 | | ... | - result - Result of bidirectional measurtement.
270 | | ... | Type: ReceiveRateMeasurement
271 | |
272 | | ... | *Example:*
273 | |
274 | | ... | \| Display Reconfig Test Message \| \${result} \|
275 | |
276 | | [Arguments] | ${result}
277 | |
278 | | Set Test Message | Packets lost due to reconfig: ${result.loss_count}
279 | | ${time_lost} = | Evaluate | ${result.loss_count} / ${result.target_tr}
280 | | Set Test Message | ${\n}Implied time lost: ${time_lost} | append=yes
281
282 | Display result of NDRPDR search
283 | | [Documentation]
284 | | ... | Display result of NDR+PDR search, both quantities, both bounds,
285 | | ... | aggregate in packet per seconds
286 | | ... | and Gbps total bandwidth (for initial packet size).
287 | | ... | Througput is calculated as:
288 | | ... | Sum of measured rate over streams
289 | | ... | Bandwidth is calculated as:
290 | | ... | (Throughput * (L2 Frame Size + IPG) * 8)
291 | | ... | The given result should contain latency data as well.
292 | |
293 | | ... | *Test (or broader scope) variables read:*
294 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
295 | | ... | string
296 | | ... | *Arguments:*
297 | | ... | - result - Measured result data per stream [pps]. Type: NdrPdrResult
298 | |
299 | | ... | *Example:*
300 | |
301 | | ... | \| Display result of NDRPDR search \| \${result} \|
302 | |
303 | | [Arguments] | ${result}
304 | |
305 | | ${frame_size} = | Get Average Frame Size | ${frame_size}
306 | | Display single bound | NDR_LOWER
307 | | ... | ${result.ndr_interval.measured_low.target_tr} | ${frame_size}
308 | | ... | ${result.ndr_interval.measured_low.latency}
309 | | Display single bound | NDR_UPPER
310 | | ... | ${result.ndr_interval.measured_high.target_tr} | ${frame_size}
311 | | Display single bound | PDR_LOWER
312 | | ... | ${result.pdr_interval.measured_low.target_tr} | ${frame_size}
313 | | ... | ${result.pdr_interval.measured_low.latency}
314 | | Display single bound | PDR_UPPER
315 | | ... | ${result.pdr_interval.measured_high.target_tr} | ${frame_size}
316
317 | Display result of soak search
318 | | [Documentation]
319 | | ... | Display result of soak search, avg+-stdev, as upper/lower bounds,
320 | | ... | in aggregate packets per seconds
321 | | ... | and Gbps total bandwidth (for initial packet size).
322 | | ... | Througput is calculated as:
323 | | ... | Sum of measured rates over streams
324 | | ... | Bandwidth is calculated as:
325 | | ... | (Throughput * (L2 Frame Size + IPG) * 8)
326 | |
327 | | ... | *Test (or broader scope) variables read:*
328 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
329 | | ... | string
330 | | ... | *Arguments:*
331 | | ... | - avg - Estimated average critical load [pps]. Type: float
332 | | ... | - stdev - Standard deviation of critical load [pps]. Type: float
333 | |
334 | | ... | *Returns:*
335 | | ... | - Lower and upper bound of critical load [pps]. Type: 2-tuple of float
336 | |
337 | | ... | *Example:*
338 | |
339 | | ... | \| Display result of soak search \| \${100000} \| \${100} \|
340 | |
341 | | [Arguments] | ${avg} | ${stdev}
342 | |
343 | | ${frame_size} = | Get Average Frame Size | ${frame_size}
344 | | ${avg} = | Convert To Number | ${avg}
345 | | ${stdev} = | Convert To Number | ${stdev}
346 | | ${lower} = | Evaluate | ${avg} - ${stdev}
347 | | ${upper} = | Evaluate | ${avg} + ${stdev}
348 | | Display single bound | PLRsearch lower bound | ${lower} | ${frame_size}
349 | | Display single bound | PLRsearch upper bound | ${upper} | ${frame_size}
350 | | Return From Keyword | ${lower} | ${upper}
351
352 | Check NDRPDR interval validity
353 | | [Documentation]
354 | | ... | Extract loss ratio of lower bound of the interval.
355 | | ... | Fail if it does not reach the allowed value.
356 | |
357 | | ... | *Arguments:*
358 | | ... | - interval - Measured interval. Type: ReceiveRateInterval
359 | | ... | - packet_loss_ratio - Accepted loss (0.0 for NDR). Type: float
360 | |
361 | | ... | *Example:*
362 | |
363 | | ... | \| Check NDRPDR interval validity \| \${result.pdr_interval} \
364 | | ... | \| \${0.005} \|
365 | |
366 | | [Arguments] | ${interval} | ${packet_loss_ratio}=${0.0}
367 | |
368 | | ${lower_bound} = | Set Variable | ${interval.measured_low}
369 | | ${lower_bound_lf} = | Set Variable | ${lower_bound.loss_fraction}
370 | | Return From Keyword If | ${lower_bound_lf} <= ${packet_loss_ratio}
371 | | ${message}= | Catenate | SEPARATOR=${SPACE}
372 | | ... | Minimal rate loss fraction ${lower_bound_lf}
373 | | ... | does not reach target ${packet_loss_ratio}.
374 | | ${message_zero} = | Set Variable | Zero packets forwarded!
375 | | ${message_other} = | Set Variable | ${lower_bound.loss_count} packets lost.
376 | | ${message} = | Set Variable If | ${lower_bound_lf} >= 1.0
377 | | ... | ${message}${\n}${message_zero} | ${message}${\n}${message_other}
378 | | Fail | ${message}
379
380 | Traffic should pass with maximum rate
381 | | [Documentation]
382 | | ... | Send traffic at maximum rate.
383 | |
384 | | ... | *Test (or broader scope) variables read:*
385 | | ... | - traffic_profile - Name of module defining traffic for measurements.
386 | | ... | Type: string
387 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
388 | | ... | string
389 | | ... | - max_rate - Calculated unidirectional maximal transmit rate [pps].
390 | | ... | Type: float
391 | |
392 | | ... | *Arguments:*
393 | | ... | - trial_duration - Duration of single trial [s]. Type: float
394 | | ... | - fail_no_traffic - Whether to fail on zero receive count;
395 | | ... | default value: True. Type: boolean
396 | | ... | - trial_multiplicity - How many trials in this measurement.
397 | | ... | Type: integer
398 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic;
399 | | ... | default value: 2. Type: integer
400 | | ... | - tx_port - TX port of TG; default value: 0. Type: integer
401 | | ... | - rx_port - RX port of TG; default value: 1. Type: integer
402 | | ... | - latency - True to enable latency measurement; default value: False.
403 | | ... | Type: boolean
404 | |
405 | | ... | *Example:*
406 | |
407 | | ... | \| Traffic should pass with maximum rate \| \${1} \| \${False} \
408 | | ... | \| \${10.0} \| \${2} \| \${0} \| \${1} \| \${True} \|
409 | |
410 | | [Arguments] | ${trial_duration}=${trial_duration}
411 | | ... | ${fail_no_traffic}=${True}
412 | | ... | ${trial_multiplicity}=${trial_multiplicity}
413 | | ... | ${traffic_directions}=${2} | ${tx_port}=${0} | ${rx_port}=${1}
414 | | ... | ${latency}=${False}
415 | |
416 | | ${results}= | Send traffic at specified rate
417 | | ... | ${trial_duration} | ${max_rate} | ${frame_size}
418 | | ... | ${traffic_profile} | ${trial_multiplicity}
419 | | ... | ${traffic_directions} | ${tx_port} | ${rx_port} | latency=${latency}
420 | | Set Test Message | ${\n}Maximum Receive Rate trial results
421 | | Set Test Message | in packets per second: ${results}
422 | | ... | append=yes
423 | | Run Keyword If | ${fail_no_traffic} | Fail if no traffic forwarded
424
425 | Send traffic at specified rate
426 | | [Documentation]
427 | | ... | Perform a warmup, show runtime counters during it.
428 | | ... | Then send traffic at specified rate, possibly multiple trials.
429 | | ... | Show various DUT stats, optionally also packet trace.
430 | | ... | Return list of measured receive rates.
431 | |
432 | | ... | *Arguments:*
433 | | ... | - trial_duration - Duration of single trial [s]. Type: float
434 | | ... | - rate - Target aggregate transmit rate [pps] / Connections per second
435 | | ... | (CPS) for UDP/TCP flows. Type: float
436 | | ... | - frame_size - L2 Frame Size [B]. Type: integer or string
437 | | ... | - traffic_profile - Name of module defining traffc for measurements.
438 | | ... | Type: string
439 | | ... | - trial_multiplicity - How many trials in this measurement.
440 | | ... | Type: integer
441 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
442 | | ... | Type: integer
443 | | ... | - tx_port - TX port of TG; default value: 0. Type: integer
444 | | ... | - rx_port - RX port of TG; default value: 1. Type: integer
445 | | ... | - extended_debug - True to enable extended debug.
446 | | ... | Type: boolean
447 | | ... | - latency - True to enable latency measurement; default value: False.
448 | | ... | Type: boolean
449 | |
450 | | ... | *Example:*
451 | |
452 | | ... | \| Send traffic at specified rate \| \${1.0} \| ${4000000.0} \
453 | | ... | \| \${64} \| 3-node-IPv4 \| \${10} \| \${2} \| \${0} \| \${1} \
454 | | ... | \| ${False} \| ${True} \|
455 | |
456 | | [Arguments] | ${trial_duration} | ${rate} | ${frame_size}
457 | | ... | ${traffic_profile} | ${trial_multiplicity}=${trial_multiplicity}
458 | | ... | ${traffic_directions}=${2} | ${tx_port}=${0} | ${rx_port}=${1}
459 | | ... | ${extended_debug}=${extended_debug} | ${latency}=${False}
460 | |
461 | | Set Test Variable | ${extended_debug}
462 | | # Following setting of test variables is needed as
463 | | # "Clear and show runtime counters with running traffic" has been moved to
464 | | # pre_stats actions.
465 | | Set Test Variable | ${rate}
466 | | Set Test Variable | ${traffic_directions}
467 | | Set Test Variable | ${tx_port}
468 | | Set Test Variable | ${rx_port}
469 | | FOR | ${action} | IN | @{pre_stats}
470 | | | Run Keyword | Additional Statistics Action For ${action}
471 | | END
472 | | ${results} = | Create List
473 | | FOR | ${i} | IN RANGE | ${trial_multiplicity}
474 | | | # The following line is skipping some default arguments,
475 | | | # that is why subsequent arguments have to be named.
476 | | | Send traffic on tg | ${trial_duration} | ${rate} | ${frame_size}
477 | | | ... | ${traffic_profile} | warmup_time=${0}
478 | | | ... | traffic_directions=${traffic_directions} | tx_port=${tx_port}
479 | | | ... | rx_port=${rx_port} | latency=${latency}
480 | | | ${rx} = | Get Received
481 | | | ${rr} = | Evaluate | ${rx} / ${trial_duration}
482 | | | Append To List | ${results} | ${rr}
483 | | END
484 | | FOR | ${action} | IN | @{post_stats}
485 | | | Run Keyword | Additional Statistics Action For ${action}
486 | | END
487 | | Return From Keyword | ${results}
488
489 | Measure and show latency at specified rate
490 | | [Documentation]
491 | | ... | Send traffic at specified rate, single trial.
492 | | ... | Extract latency information and append it to text message.
493 | | ... | The rate argument is int, so should not include "pps".
494 | | ... | If the given rate is too low, a safe value is used instead.
495 | |
496 | | ... | *Arguments:*
497 | | ... | - message_prefix - Preface to test message addition. Type: string
498 | | ... | - trial_duration - Duration of single trial [s]. Type: float
499 | | ... | - rate - Rate [pps] for sending packets in case of T-Rex stateless
500 | | ... | mode or multiplier of profile CPS in case of T-Rex astf mode.
501 | | ... | Type: float
502 | | ... | - frame_size - L2 Frame Size [B]. Type: integer or string
503 | | ... | - traffic_profile - Name of module defining traffic for measurements.
504 | | ... | Type: string
505 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
506 | | ... | Type: integer
507 | | ... | - tx_port - TX port of TG; default value: 0. Type: integer
508 | | ... | - rx_port - RX port of TG; default value: 1. Type: integer
509 | | ... | - safe_rate - To apply if rate is below this, as latency pps is fixed.
510 | | ... | In pps. Type: integer.
511 | |
512 | | ... | *Example:*
513 | |
514 | | ... | \| Measure and show latency at specified rate \| Latency at 90% NDR \
515 | | ... | \| \${1.0} \| ${10000000} \| \${64} \| 3-node-IPv4 \| \${2} \
516 | | ... | \| \${0} \| \${1} \| ${9500} \|
517 | |
518 | | [Arguments] | ${message_prefix} | ${trial_duration} | ${rate}
519 | | ... | ${frame_size} | ${traffic_profile} | ${traffic_directions}=${2}
520 | | ... | ${tx_port}=${0} | ${rx_port}=${1} | ${safe_rate}=${9001}
521 | |
522 | | ${real_rate} = | Evaluate | max(${rate}, ${safe_rate})
523 | | # The following line is skipping some default arguments,
524 | | # that is why subsequent arguments have to be named.
525 | | Send traffic on tg | ${trial_duration} | ${real_rate} | ${frame_size}
526 | | ... | ${traffic_profile} | warmup_time=${0}
527 | | ... | traffic_directions=${traffic_directions} | tx_port=${tx_port}
528 | | ... | rx_port=${rx_port} | latency=${True}
529 | | ${latency} = | Get Latency Int
530 | | Set Test Message | ${\n}${message_prefix} ${latency} | append=${True}
531
532 | Clear and show runtime counters with running traffic
533 | | [Documentation]
534 | | ... | Start traffic at specified rate then clear runtime counters on all
535 | | ... | DUTs. Wait for specified amount of time and capture runtime counters
536 | | ... | on all DUTs. Finally stop traffic
537 | |
538 | | ... | *Arguments:*
539 | | ... | - duration - Duration of traffic run [s]. Type: integer
540 | | ... | - rate - Rate [pps] for sending packets in case of T-Rex stateless
541 | | ... | mode or multiplier of profile CPS in case of T-Rex astf mode.
542 | | ... | Type: float
543 | | ... | - frame_size - L2 Frame Size [B] or IMIX_v4_1. Type: integer or string
544 | | ... | - traffic_profile - Name of module defining traffc for measurements.
545 | | ... | Type: string
546 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
547 | | ... | Type: integer
548 | | ... | - tx_port - TX port of TG; default value: 0. Type: integer
549 | | ... | - rx_port - RX port of TG, default value: 1. Type: integer
550 | |
551 | | ... | *Example:*
552 | |
553 | | ... | \| Clear and show runtime counters with running traffic \| \${10} \
554 | | ... | \| ${4000000.0} \| \${64} \| 3-node-IPv4 \| \${2} \| \${0} \| \${1} \|
555 | |
556 | | [Arguments] | ${duration} | ${rate} | ${frame_size} | ${traffic_profile}
557 | | ... | ${traffic_directions}=${2} | ${tx_port}=${0} | ${rx_port}=${1}
558 | |
559 | | # Duration of -1 means we will stop traffic manually.
560 | | Send traffic on tg | ${-1} | ${rate} | ${frame_size} | ${traffic_profile}
561 | | ... | warmup_time=${0} | async_call=${True} | latency=${False}
562 | | ... | traffic_directions=${traffic_directions} | tx_port=${tx_port}
563 | | ... | rx_port=${rx_port}
564 | | FOR | ${action} | IN | @{pre_run_stats}
565 | | | Run Keyword | Additional Statistics Action For ${action}
566 | | END
567 | | Sleep | ${duration}
568 | | FOR | ${action} | IN | @{post_run_stats}
569 | | | Run Keyword | Additional Statistics Action For ${action}
570 | | END
571 | | Stop traffic on tg
572
573 | Start Traffic on Background
574 | | [Documentation]
575 | | ... | Start traffic at specified rate then return control to Robot.
576 | | ... | This keyword is useful if the test needs to do something
577 | | ... | while traffic is running.
578 | |
579 | | ... | *Test (or broader scope) variables read:*
580 | | ... | - traffic_profile - Name of module defining traffc for measurements.
581 | | ... | Type: string
582 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
583 | | ... | string
584 | | ... | *Arguments:*
585 | | ... | - rate - Rate [pps] for sending packets in case of T-Rex stateless
586 | | ... | mode or multiplier of profile CPS in case of T-Rex astf mode.
587 | | ... | Type: float
588 | | ... | - traffic_directions - Bi- (2) or uni- (1) directional traffic.
589 | | ... | Type: integer
590 | | ... | - tx_port - TX port of TG; default value: 0. Type: integer
591 | | ... | - rx_port - RX port of TG; default value: 1. Type: integer
592 | |
593 | | ... | *Example:*
594 | |
595 | | ... | \| Start Traffic on Background \| ${4000000.0} \| \${2} \| \${0} \
596 | | ... | \| \${1} \|
597 | |
598 | | [Arguments] | ${rate} | ${traffic_directions}=${2} | ${tx_port}=${0}
599 | | ... | ${rx_port}=${1}
600 | |
601 | | # Duration of -1 means we will stop traffic manually.
602 | | Send traffic on tg | ${-1} | ${rate} | ${frame_size} | ${traffic_profile}
603 | | ... | warmup_time=${0} | async_call=${True} | latency=${False}
604 | | ... | traffic_directions=${traffic_directions} | tx_port=${tx_port}
605 | | ... | rx_port=${rx_port}
606
607 | Stop Running Traffic
608 | | [Documentation]
609 | | ... | Stop the running traffic, return measurement result.
610 | | ... | For bidirectional traffic, the reported values are bi-directional.
611 | |
612 | | ... | *Returns:*
613 | | ... | - Measurement result. Type: ReceiveRateMeasurement
614 | |
615 | | ... | *Example:*
616 | |
617 | | ... | \${result}= \| Stop Running Traffic \|
618 | |
619 | | ${result}= | Stop traffic on tg
620 | | Return From Keyword | ${result}
621
622 | Additional Statistics Action For vpp-clear-stats
623 | | [Documentation]
624 | | ... | Additional Statistics Action for clear VPP statistics.
625 | |
626 | | Clear Statistics On All DUTs | ${nodes}
627
628 | Additional Statistics Action For vpp-show-stats
629 | | [Documentation]
630 | | ... | Additional Statistics Action for show VPP statistics.
631 | |
632 | | Show Statistics On All DUTs | ${nodes}
633
634 | Additional Statistics Action For vpp-clear-runtime
635 | | [Documentation]
636 | | ... | Additional Statistics Action for clear VPP runtime.
637 | |
638 | | VPP Clear Runtime On All DUTs | ${nodes}
639
640 | Additional Statistics Action For vpp-show-runtime
641 | | [Documentation]
642 | | ... | Additional Statistics Action for show VPP runtime.
643 | |
644 | | VPP Show Runtime On All DUTs | ${nodes}
645
646 | Additional Statistics Action For vpp-enable-packettrace
647 | | [Documentation]
648 | | ... | Additional Statistics Action for enable VPP packet trace.
649 | |
650 | | Run Keyword If | ${extended_debug}==${True}
651 | | ... | VPP Enable Traces On All DUTs | ${nodes} | fail_on_error=${False}
652
653 | Additional Statistics Action For vpp-show-packettrace
654 | | [Documentation]
655 | | ... | Additional Statistics Action for show VPP packet trace.
656 | |
657 | | Run Keyword If | ${extended_debug}==${True}
658 | | ... | Show Packet Trace On All Duts | ${nodes} | maximum=${100}
659
660 | Additional Statistics Action For vpp-enable-elog
661 | | [Documentation]
662 | | ... | Additional Statistics Action for enable VPP elog trace.
663 | |
664 | | VPP Enable Elog Traces On All DUTs | ${nodes}
665
666 | Additional Statistics Action For vpp-show-elog
667 | | [Documentation]
668 | | ... | Additional Statistics Action for show VPP elog trace.
669 | |
670 | | Show Event Logger On All DUTs | ${nodes}
671
672 | Additional Statistics Action For bash-perf-stat
673 | | [Documentation]
674 | | ... | Additional Statistics Action for bash command "perf stat".
675 | |
676 | | Run Keyword If | ${extended_debug}==${True}
677 | | ... | Perf Stat On All DUTs | ${nodes} | cpu_list=${cpu_alloc_str}
678
679 | Additional Statistics Action For clear-show-runtime-with-traffic
680 | | [Documentation]
681 | | ... | Additional Statistics Action for clear and show runtime counters with
682 | | ... | running traffic.
683 | |
684 | | Clear and show runtime counters with running traffic
685 | | ... | ${trial_duration} | ${rate} | ${frame_size} | ${traffic_profile}
686 | | ... | ${traffic_directions} | ${tx_port} | ${rx_port}
687
688 | Additional Statistics Action For noop
689 | | [Documentation]
690 | | ... | Additional Statistics Action for no operation.
691 | |
692 | | No operation