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