480f7e1f33e3b8a9109535754f36daf75106c2d6
[csit.git] / resources / libraries / robot / performance / performance_utils.robot
1 # Copyright (c) 2019 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 *** Settings ***
15 | Library | Collections
16 | Library | resources.libraries.python.topology.Topology
17 | Library | resources.libraries.python.NodePath
18 | Library | resources.libraries.python.DpdkUtil
19 | Library | resources.libraries.python.InterfaceUtil
20 | Library | resources.libraries.python.KubernetesUtils
21 | Library | resources.libraries.python.VhostUser
22 | Library | resources.libraries.python.TrafficGenerator
23 | Library | resources.libraries.python.TrafficGenerator.OptimizedSearch
24 | Library | resources.libraries.python.TrafficGenerator.TGDropRateSearchImpl
25 | Library | resources.libraries.python.Trace
26 | Resource | resources/libraries/robot/shared/default.robot
27 | Resource | resources/libraries/robot/shared/interfaces.robot
28 | Resource | resources/libraries/robot/shared/counters.robot
29 | Resource | resources/libraries/robot/shared/container.robot
30 | Resource | resources/libraries/robot/shared/memif.robot
31 | Resource | resources/libraries/robot/l2/l2_bridge_domain.robot
32 | Resource | resources/libraries/robot/l2/l2_xconnect.robot
33 | Resource | resources/libraries/robot/ip/ip4.robot
34 | Resource | resources/libraries/robot/ip/ip6.robot
35 | Resource | resources/libraries/robot/vm/qemu.robot
36 | Resource | resources/libraries/robot/l2/tagging.robot
37 | Documentation | Performance suite keywords - utilities to find and verify NDR
38 | ... | and PDR.
39
40 *** Keywords ***
41 | Get Average Frame Size
42 | | [Documentation]
43 | | ... | Framesize can be either integer in case of a single packet
44 | | ... | in stream, or set of packets in case of IMIX type or simmilar.
45 | | ... | This keyword returns average framesize, as float or argument type.
46 | | ...
47 | | ... | *Arguments:*
48 | | ... | - framesize - Framesize. Type: integer or string
49 | | ...
50 | | ... | *Example:*
51 | | ...
52 | | ... | \| Get Average Frame Size \| IMIX_v4_1 \|
53 | | ...
54 | | [Arguments] | ${framesize}
55 | | ...
56 | | Return From Keyword If | '${framesize}' == 'IMIX_v4_1' | ${353.83333}
57 | | Return From Keyword | ${framesize}
58
59 | Get Max Rate And Jumbo
60 | | [Documentation]
61 | | ... | Argument framesize can be either integer in case of a single packet
62 | | ... | in stream, or IMIX string defining mix of packets.
63 | | ... | For jumbo frames detection, the maximal packet size is relevant.
64 | | ... | For maximal transmit rate, the average packet size is relevant.
65 | | ... | In both cases, encapsulation overhead (if any) has effect.
66 | | ... | The maximal rate is computed from line limit bandwidth,
67 | | ... | but NICs also have an independent limit in packet rate.
68 | | ... | For some NICs, the limit is not reachable (bps limit is stricter),
69 | | ... | in those cases None is used (meaning no limiting).
70 | | ...
71 | | ... | This keyword returns computed maximal unidirectional transmit rate
72 | | ... | and jumbo boolean (some suites need that).
73 | | ...
74 | | ... | *Arguments:*
75 | | ... | - bps_limit - Line rate limit in bps. Type: integer
76 | | ... | - framesize - Framesize in bytes or IMIX. Type: integer or string
77 | | ... | - overhead - Overhead in bytes. Default: 0. Type: integer
78 | | ... | - pps_limit - NIC limit rate value in pps. Type: integer or None
79 | | ...
80 | | ... | *Returns:*
81 | | ... | - 2-tuple, consisting of:
82 | | ... |   - Calculated unidirectional maximal transmit rate.
83 | | ... |     Type: integer or float
84 | | ... |   - Jumbo boolean, true if jumbo packet support has to be enabled.
85 | | ... |     Type: boolean
86 | | ...
87 | | ... | *Example:*
88 | | ...
89 | | ... | \| Get Max Rate And Jumbo | \${10000000} \| IMIX_v4_1 \
90 | | ... | \| overhead=\${40} \| pps_limit=\${18750000} \|
91 | | ...
92 | | [Arguments] | ${bps_limit} | ${framesize}
93 | | ... | ${overhead}=${0} | ${pps_limit}=${None}
94 | | ...
95 | | ${avg_size} = | Get Average Frame Size | ${framesize}
96 | | ${max_size} = | Set Variable If | '${framesize}' == 'IMIX_v4_1'
97 | | ... | ${1518} | ${framesize}
98 | | # swo := size_with_overhead
99 | | ${avg_swo} = | Evaluate | ${avg_size} + ${overhead}
100 | | ${max_swo} = | Evaluate | ${max_size} + ${overhead}
101 | | ${jumbo} = | Set Variable If | ${max_swo} < 1522
102 | | ... | ${False} | ${True}
103 | | # For testing None see: https://groups.google.com/\
104 | | #                       forum/#!topic/robotframework-users/XntFz0ocD9E
105 | | ${limit_set} = | Set Variable | ${pps_limit != None}
106 | | # TODO: Can our code handle float rate?
107 | | ${rate} = | Evaluate | (${bps_limit}/((${avg_swo}+20)*8)).__trunc__()
108 | | ${max_rate} = | Set Variable If | ${limit_set} and ${rate} > ${pps_limit}
109 | | ... | ${pps_limit} | ${rate}
110 | | Return From Keyword | ${max_rate} | ${jumbo}
111
112 | Get Max Rate And Jumbo And Handle Multi Seg
113 | | [Documentation]
114 | | ... | This keyword adds correct multi seg configuration,
115 | | ... | then returns the result of Get Max Rate And Jumbo keyword.
116 | | ...
117 | | ... | See Documentation of Get Max Rate And Jumbo for more details.
118 | | ...
119 | | ... | *Arguments:*
120 | | ... | - bps_limit - Line rate limit in bps. Type: integer
121 | | ... | - framesize - Framesize in bytes. Type: integer or string
122 | | ... | - overhead - Overhead in bytes. Default: 0. Type: integer
123 | | ... | - pps_limit - NIC limit rate value in pps. Type: integer or None
124 | | ...
125 | | ... | *Returns:*
126 | | ... | - 2-tuple, consisting of:
127 | | ... |   - Calculated unidirectional maximal transmit rate.
128 | | ... |     Type: integer or float
129 | | ... |   - Jumbo boolean, true if jumbo packet support has to be enabled.
130 | | ... |     Type: boolean
131 | | ...
132 | | ... | *Example:*
133 | | ...
134 | | ... | \| Get Max Rate And Jumbo And Handle Multi Seg | \${10000000} \
135 | | ... | \| IMIX_v4_1 \| overhead=\${40} \| pps_limit=\${18750000} \|
136 | | ...
137 | | [Arguments] | ${bps_limit} | ${framesize}
138 | | ... | ${overhead}=${0} | ${pps_limit}=${None}
139 | | ...
140 | | ${max_rate} | ${jumbo} = | Get Max Rate And Jumbo
141 | | ... | ${bps_limit} | ${framesize} | ${overhead} | ${pps_limit}
142 | | Run Keyword If | not ${jumbo} | Add no multi seg to all DUTs
143 | | Return From Keyword | ${max_rate} | ${jumbo}
144
145 | Find NDR and PDR intervals using optimized search
146 | | [Documentation]
147 | | ... | Find boundaries for RFC2544 compatible NDR and PDR values
148 | | ... | using an optimized search algorithm.
149 | | ... | Display results as formatted test message.
150 | | ... | Fail if a resulting lower bound has too high loss fraction.
151 | | ... | Proceed with Perform additional measurements based on NDRPDR result.
152 | | ... | Input rates are understood as uni-directional,
153 | | ... | reported result contains bi-directional rates.
154 | | ...
155 | | ... | TODO: Should the trial duration of the additional
156 | | ... | measurements be configurable?
157 | | ...
158 | | ... | *Arguments:*
159 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: int or str
160 | | ... | - topology_type - Topology type. Type: string
161 | | ... | - minimum_transmit_rate - Lower limit of search [pps]. Type: float
162 | | ... | - maximum_transmit_rate - Upper limit of search [pps]. Type: float
163 | | ... | - packet_loss_ratio - Accepted loss during search. Type: float
164 | | ... | - final_relative_width - Maximal width multiple of upper. Type: float
165 | | ... | - final_trial_duration - Duration of final trials [s]. Type: float
166 | | ... | - initial_trial_duration - Duration of initial trials [s]. Type: float
167 | | ... | - intermediate phases - Number of intermediate phases [1]. Type: int
168 | | ... | - timeout - Fail if search duration is longer [s]. Type: float
169 | | ... | - doublings - How many doublings to do when expanding [1]. Type: int
170 | | ...
171 | | ... | *Example:*
172 | | ...
173 | | ... | \| Find NDR and PDR intervals using optimized search \| \${64} \| \
174 | | ... | 3-node-IPv4 \| \${100000} \| \${14880952} \| \${0.005} \| \${0.005} \
175 | | ... | \| \${30.0} \| \${1.0} \| \${2} \| ${600.0} \| ${2} \|
176 | | ...
177 | | [Arguments] | ${frame_size} | ${topology_type} | ${minimum_transmit_rate}
178 | | ... | ${maximum_transmit_rate} | ${packet_loss_ratio}=${0.005}
179 | | ... | ${final_relative_width}=${0.005} | ${final_trial_duration}=${30.0}
180 | | ... | ${initial_trial_duration}=${1.0}
181 | | ... | ${number_of_intermediate_phases}=${2} | ${timeout}=${720.0}
182 | | ... | ${doublings}=${2}
183 | | ...
184 | | ${result} = | Perform optimized ndrpdr search | ${frame_size}
185 | | ... | ${topology_type} | ${minimum_transmit_rate*2}
186 | | ... | ${maximum_transmit_rate*2} | ${packet_loss_ratio}
187 | | ... | ${final_relative_width} | ${final_trial_duration}
188 | | ... | ${initial_trial_duration} | ${number_of_intermediate_phases}
189 | | ... | timeout=${timeout} | doublings=${doublings}
190 | | Display result of NDRPDR search | ${result} | ${frame_size}
191 | | Check NDRPDR interval validity | ${result.pdr_interval}
192 | | ... | ${packet_loss_ratio}
193 | | Check NDRPDR interval validity | ${result.ndr_interval}
194 | | Perform additional measurements based on NDRPDR result
195 | | ... | ${result} | ${frame_size} | ${topology_type}
196
197 | Find critical load using PLRsearch
198 | | [Documentation]
199 | | ... | Find boundaries for troughput (of given target loss ratio)
200 | | ... | using PLRsearch algorithm.
201 | | ... | Display results as formatted test message.
202 | | ... | Fail if computed lower bound is below minimal rate.
203 | | ... | Input rates are understood as uni-directional,
204 | | ... | reported result contains bi-directional rates.
205 | | ... | TODO: Any additional measurements for debug purposes?
206 | | ...
207 | | ... | *Arguments:*
208 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: int or str
209 | | ... | - topology_type - Topology type. Type: string
210 | | ... | - minimum_transmit_rate - Lower limit of search [pps]. Type: float
211 | | ... | - maximum_transmit_rate - Upper limit of search [pps]. Type: float
212 | | ... | - packet_loss_ratio - Accepted loss during search. Type: float
213 | | ... | - timeout - Stop when search duration is longer [s]. Type: float
214 | | ...
215 | | ... | *Example:*
216 | | ...
217 | | ... | \| Find critical load usingPLR search \| \${64} \| \
218 | | ... | 3-node-IPv4 \| \${100000} \| \${14880952} \| \${1e-7} \| \${1800} \
219 | | ...
220 | | [Arguments] | ${frame_size} | ${topology_type} | ${minimum_transmit_rate}
221 | | ... | ${maximum_transmit_rate} | ${packet_loss_ratio}=${1e-7}
222 | | ... | ${timeout}=${1800.0}
223 | | ...
224 | | ${min_rate} = | Set Variable | ${minimum_transmit_rate*2}
225 | | ${average} | ${stdev} = | Perform soak search | ${frame_size}
226 | | ... | ${topology_type} | ${min_rate} | ${maximum_transmit_rate*2}
227 | | ... | ${packet_loss_ratio} | timeout=${timeout}
228 | | ${lower} | ${upper} = | Display result of soak search
229 | | ... | ${average} | ${stdev} | ${frame_size}
230 | | Should Not Be True | ${lower} < ${min_rate}
231 | | ... | Lower bound ${lower} is below bidirectional minimum ${min_rate}.
232
233 | Display single bound
234 | | [Documentation]
235 | | ... | Display one bound of NDR+PDR search,
236 | | ... | in packet per seconds (total and per stream)
237 | | ... | and Gbps total bandwidth with untagged packet.
238 | | ... | Througput is calculated as:
239 | | ... | Measured rate per stream * Total number of streams
240 | | ... | Bandwidth is calculated as:
241 | | ... | (Throughput * (L2 Frame Size + IPG) * 8) / Max bitrate of NIC
242 | | ... | The given result should contain latency data as well.
243 | | ...
244 | | ... | *Arguments:*
245 | | ... | - text - Flavor text describing which bound is this. Type: string
246 | | ... | - rate_total - Total (not per stream) measured Tr [pps]. Type: float
247 | | ... | - framesize - L2 Frame Size [B]. Type: integer
248 | | ... | - latency - Latency data to display if non-empty. Type: string
249 | | ...
250 | | ... | *Example:*
251 | | ...
252 | | ... | \| Display single bound \| NDR lower bound \| \${12345.67} \
253 | | ... | \| \${64} \| show_latency=\${EMPTY} \|
254 | | ...
255 | | [Arguments] | ${text} | ${rate_total} | ${framesize} | ${latency}=${EMPTY}
256 | | ...
257 | | ${bandwidth_total} = | Evaluate | ${rate_total} * (${framesize}+20)*8 / 1e9
258 | | Set Test Message | ${\n}${text}: ${rate_total} pps, | append=yes
259 | | Set Test Message | ${bandwidth_total} Gbps (untagged) | append=yes
260 | | Return From Keyword If | not """${latency}"""
261 | | Set Test Message | ${\n}LATENCY usec [min/avg/max] per stream: ${latency}
262 | | ... | append=yes
263
264 | Display result of NDRPDR search
265 | | [Documentation]
266 | | ... | Display result of NDR+PDR search, both quantities, both bounds,
267 | | ... | in packet per seconds (total and per stream)
268 | | ... | and Gbps total bandwidth with untagged packet.
269 | | ... | Througput is calculated as:
270 | | ... | Measured rate per stream * Total number of streams
271 | | ... | Bandwidth is calculated as:
272 | | ... | (Throughput * (L2 Frame Size + IPG) * 8) / Max bitrate of NIC
273 | | ... | The given result should contain latency data as well.
274 | | ...
275 | | ... | *Arguments:*
276 | | ... | - result - Measured result data per stream [pps]. Type: NdrPdrResult
277 | | ... | - framesize - L2 Frame Size [B]. Type: integer
278 | | ...
279 | | ... | *Example:*
280 | | ...
281 | | ... | \| Display result of NDRPDR search \| \${result} \| \${64} \|
282 | | ...
283 | | [Arguments] | ${result} | ${framesize}
284 | | ...
285 | | ${framesize} = | Get Average Frame Size | ${framesize}
286 | | Display single bound | NDR_LOWER
287 | | ... | ${result.ndr_interval.measured_low.transmit_rate} | ${framesize}
288 | | ... | ${result.ndr_interval.measured_low.latency}
289 | | Display single bound | NDR_UPPER
290 | | ... | ${result.ndr_interval.measured_high.transmit_rate} | ${framesize}
291 | | Display single bound | PDR_LOWER
292 | | ... | ${result.pdr_interval.measured_low.transmit_rate} | ${framesize}
293 | | ... | ${result.pdr_interval.measured_low.latency}
294 | | Display single bound | PDR_UPPER
295 | | ... | ${result.pdr_interval.measured_high.transmit_rate} | ${framesize}
296
297 | Display result of soak search
298 | | [Documentation]
299 | | ... | Display result of soak search, avg+-stdev, as upper/lower bounds,
300 | | ... | in packet per seconds (total and per stream)
301 | | ... | and Gbps total bandwidth with untagged packet.
302 | | ... | Througput is calculated as:
303 | | ... | Measured rate per stream * Total number of streams
304 | | ... | Bandwidth is calculated as:
305 | | ... | (Throughput * (L2 Frame Size + IPG) * 8) / Max bitrate of NIC
306 | | ... | TODO: Do we want to report some latency data,
307 | | ... | even if not measured at the reported bounds?.
308 | | ...
309 | | ... | *Arguments:*
310 | | ... | - avg - Estimated average critical load [pps]. Type: float
311 | | ... | - stdev - Standard deviation of critical load [pps]. Type: float
312 | | ... | - framesize - L2 Frame Size [B]. Type: integer
313 | | ...
314 | | ... | *Returns:*
315 | | ... | - Lower and upper bound of critical load [pps]. Type: 2-tuple of float
316 | | ...
317 | | ... | *Example:*
318 | | ...
319 | | ... | \| Display result of soak search \| \${100000} \| \${100} \| \${64} \|
320 | | ...
321 | | [Arguments] | ${avg} | ${stdev} | ${framesize}
322 | | ...
323 | | ${framesize} = | Get Average Frame Size | ${framesize}
324 | | ${avg} = | Convert To Number | ${avg}
325 | | ${stdev} = | Convert To Number | ${stdev}
326 | | ${lower} = | Evaluate | ${avg} - ${stdev}
327 | | ${upper} = | Evaluate | ${avg} + ${stdev}
328 | | Display single bound | PLRsearch lower bound: | ${lower} | ${framesize}
329 | | Display single bound | PLRsearch upper bound: | ${upper} | ${framesize}
330 | | Return From Keyword | ${lower} | ${upper}
331
332 | Check NDRPDR interval validity
333 | | [Documentation]
334 | | ... | Extract loss ratio of lower bound of the interval.
335 | | ... | Fail if it does not reach the allowed value.
336 | | ...
337 | | ... | *Arguments:*
338 | | ... | - interval - Measured interval. Type: ReceiveRateInterval
339 | | ... | - packet_loss_ratio - Accepted loss (0.0 for NDR). Type: float
340 | | ...
341 | | ... | *Example:*
342 | | ...
343 | | ... | \| Check NDRPDR interval validity \| \${result.pdr_interval} \
344 | | ... | \| \${0.005} \|
345 | | ...
346 | | [Arguments] | ${interval} | ${packet_loss_ratio}=${0.0}
347 | | ...
348 | | ${lower_bound} = | Set Variable | ${interval.measured_low}
349 | | ${lower_bound_lf} = | Set Variable | ${lower_bound.loss_fraction}
350 | | Return From Keyword If | ${lower_bound_lf} <= ${packet_loss_ratio}
351 | | ${message}= | Catenate | SEPARATOR=${SPACE}
352 | | ... | Minimal rate loss fraction ${lower_bound_lf}
353 | | ... | does not reach target ${packet_loss_ratio}.
354 | | ${message_zero} = | Set Variable | Zero packets forwarded!
355 | | ${message_other} = | Set Variable | ${lower_bound.loss_count} packets lost.
356 | | ${message} = | Set Variable If | ${lower_bound_lf} >= 1.0
357 | | ... | ${message}${\n}${message_zero} | ${message}${\n}${message_other}
358 | | Fail | ${message}
359
360 | Perform additional measurements based on NDRPDR result
361 | | [Documentation]
362 | | ... | Perform any additional measurements which are not directly needed
363 | | ... | for determining NDR nor PDR, but which are needed for gathering
364 | | ... | additional data for debug purposes.
365 | | ... | Currently, just "Traffic should pass with no loss" is called.
366 | | ... | TODO: Move latency measurements from optimized search here.
367 | | ...
368 | | ... | *Arguments:*
369 | | ... | - result - Measured result data per stream [pps]. Type: NdrPdrResult
370 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: int or str
371 | | ... | - topology_type - Topology type. Type: string
372 | | ...
373 | | ... | *Example:*
374 | | ... | \| Perform additional measurements based on NDRPDR result \
375 | | ... | \| \${result} \| ${64} \| 3-node-IPv4 \|
376 | | ...
377 | | [Arguments] | ${result} | ${framesize} | ${topology_type}
378 | | ...
379 | | ${duration}= | Set Variable | 5.0
380 | | ${rate_per_stream}= | Evaluate
381 | | ... | ${result.ndr_interval.measured_low.target_tr} / 2.0
382 | | Traffic should pass with no loss | ${duration} | ${rate_per_stream}pps
383 | | ... | ${framesize} | ${topology_type} | fail_on_loss=${False}
384
385 | Traffic should pass with no loss
386 | | [Documentation]
387 | | ... | Send traffic at specified rate. No packet loss is accepted at loss
388 | | ... | evaluation.
389 | | ...
390 | | ... | *Arguments:*
391 | | ... | - duration - Duration of traffic run [s]. Type: integer
392 | | ... | - rate - Rate for sending packets. Type: string
393 | | ... | - framesize - L2 Frame Size [B] or IMIX_v4_1. Type: integer/string
394 | | ... | - topology_type - Topology type. Type: string
395 | | ... | - fail_on_loss - If True, the keyword fails if loss occurred.
396 | | ... | Type: boolean
397 | | ...
398 | | ... | *Example:*
399 | | ...
400 | | ... | \| Traffic should pass with no loss \| 10 \| 4.0mpps \| 64 \
401 | | ... | \| 3-node-IPv4 \|
402 | | ...
403 | | [Arguments] | ${duration} | ${rate} | ${framesize} | ${topology_type}
404 | | ... | ${fail_on_loss}=${True}
405 | | ...
406 | | Send traffic at specified rate | ${duration} | ${rate} | ${framesize}
407 | | ... | ${topology_type}
408 | | Run Keyword If | ${fail_on_loss} | No traffic loss occurred
409
410 | Traffic should pass with maximum rate
411 | | [Documentation]
412 | | ... | Send traffic at maximum rate.
413 | | ...
414 | | ... | *Arguments:*
415 | | ... | - rate - Rate for sending packets. Type: string
416 | | ... | - framesize - L2 Frame Size [B] or IMIX_v4_1. Type: integer/string
417 | | ... | - topology_type - Topology type. Type: string
418 | | ... | - subsamples - How many trials in this measurement. Type:int
419 | | ... | - trial_duration - Duration of single trial [s]. Type: float
420 | | ... | - fail_no_traffic - Whether to fail on zero receive count. Type: boolean
421 | | ... | - unidirection - False if traffic is bidirectional. Type: boolean
422 | | ... | - tx_port - TX port of TG, default 0. Type: integer
423 | | ... | - rx_port - RX port of TG, default 1. Type: integer
424 | | ...
425 | | ... | *Example:*
426 | | ...
427 | | ... | \| Traffic should pass with maximum rate \| 4.0mpps \| 64 \
428 | | ... | \| 3-node-IPv4 \| ${1} \| ${10.0} \| ${False}
429 | | ... | \| ${False} \| ${0} | ${1} \|
430 | | ...
431 | | [Arguments] | ${rate} | ${framesize} | ${topology_type}
432 | | ... | ${trial_duration}=${perf_trial_duration} | ${fail_no_traffic}=${True}
433 | | ... | ${subsamples}=${perf_trial_multiplicity}
434 | | ... | ${unidirection}=${False} | ${tx_port}=${0} | ${rx_port}=${1}
435 | | ...
436 | | ${results} = | Send traffic at specified rate | ${trial_duration} | ${rate}
437 | | ... | ${framesize} | ${topology_type} | ${subsamples} | ${unidirection}
438 | | ... | ${tx_port} | ${rx_port}
439 | | Set Test Message | ${\n}Maximum Receive Rate trial results
440 | | Set Test Message | in packets per second: ${results}
441 | | ... | append=yes
442 | | # TODO: Should we also report the percentage relative to transmit rate,
443 | | # so that people looking at console can decide how close to 100% it is?
444 | | Run Keyword If | ${fail_no_traffic} | Fail if no traffic forwarded
445
446 | Send traffic at specified rate
447 | | [Documentation]
448 | | ... | Send traffic at specified rate.
449 | | ... | Return list of measured receive rates.
450 | | ...
451 | | ... | *Arguments:*
452 | | ... | - trial_duration - Duration of single trial [s]. Type: float
453 | | ... | - rate - Rate for sending packets. Type: string
454 | | ... | - framesize - L2 Frame Size [B]. Type: integer/string
455 | | ... | - topology_type - Topology type. Type: string
456 | | ... | - subsamples - How many trials in this measurement. Type: int
457 | | ... | - unidirection - False if traffic is bidirectional. Type: boolean
458 | | ... | - tx_port - TX port of TG, default 0. Type: integer
459 | | ... | - rx_port - RX port of TG, default 1. Type: integer
460 | | ...
461 | | ... | *Example:*
462 | | ...
463 | | ... | \| Send traffic at specified rate \| ${1.0} \| 4.0mpps \| 64 \
464 | | ... | \| 3-node-IPv4 \| ${10} \| ${False} \| ${0} | ${1} \|
465 | | ...
466 | | [Arguments] | ${trial_duration} | ${rate} | ${framesize}
467 | | ... | ${topology_type} | ${subsamples}=${1} | ${unidirection}=${False}
468 | | ... | ${tx_port}=${0} | ${rx_port}=${1}
469 | | ...
470 | | Clear and show runtime counters with running traffic | ${trial_duration}
471 | | ... | ${rate} | ${framesize} | ${topology_type}
472 | | ... | ${unidirection} | ${tx_port} | ${rx_port}
473 | | Run Keyword If | ${dut_stats}==${True} | Clear all counters on all DUTs
474 | | Run Keyword If | ${dut_stats}==${True} and ${pkt_trace}==${True}
475 | | ... | VPP Enable Traces On All DUTs | ${nodes}
476 | | Run Keyword If | ${dut_stats}==${True}
477 | | ... | VPP enable elog traces on all DUTs | ${nodes}
478 | | ${results} = | Create List
479 | | :FOR | ${i} | IN RANGE | ${subsamples}
480 | | | # The following line is skipping some default arguments,
481 | | | # that is why subsequent arguments have to be named.
482 | | | Send traffic on tg | ${trial_duration} | ${rate} | ${framesize}
483 | | | ... | ${topology_type} | warmup_time=${0} | unidirection=${unidirection}
484 | | | ... | tx_port=${tx_port} | rx_port=${rx_port}
485 | | | ${rx} = | Get Received
486 | | | ${rr} = | Evaluate | ${rx} / ${trial_duration}
487 | | | Append To List | ${results} | ${rr}
488 | | Run Keyword If | ${dut_stats}==${True} | Show event logger on all DUTs
489 | | ... | ${nodes}
490 | | Run Keyword If | ${dut_stats}==${True} | Show statistics on all DUTs
491 | | ... | ${nodes}
492 | | Run Keyword If | ${dut_stats}==${True} and ${pkt_trace}==${True}
493 | | ... | Show Packet Trace On All Duts | ${nodes} | maximum=${100}
494 | | Return From Keyword | ${results}
495
496 | Clear and show runtime counters with running traffic
497 | | [Documentation]
498 | | ... | Start traffic at specified rate then clear runtime counters on all
499 | | ... | DUTs. Wait for specified amount of time and capture runtime counters
500 | | ... | on all DUTs. Finally stop traffic
501 | | ...
502 | | ... | *Arguments:*
503 | | ... | - duration - Duration of traffic run [s]. Type: integer
504 | | ... | - rate - Rate for sending packets. Type: string
505 | | ... | - framesize - L2 Frame Size [B] or IMIX_v4_1. Type: integer/string
506 | | ... | - topology_type - Topology type. Type: string
507 | | ... | - unidirection - False if traffic is bidirectional. Type: boolean
508 | | ... | - tx_port - TX port of TG, default 0. Type: integer
509 | | ... | - rx_port - RX port of TG, default 1. Type: integer
510 | | ...
511 | | ... | *Example:*
512 | | ...
513 | | ... | \| Clear and show runtime counters with running traffic \| 10 \
514 | | ... | \| 4.0mpps \| 64 \| 3-node-IPv4 \| ${False} \| ${0} | ${1} \|
515 | | ...
516 | | [Arguments] | ${duration} | ${rate} | ${framesize} | ${topology_type}
517 | | ... | ${unidirection}=${False} | ${tx_port}=${0} | ${rx_port}=${1}
518 | | ...
519 | | Send traffic on tg | ${-1} | ${rate} | ${framesize} | ${topology_type}
520 | | ... | warmup_time=${0} | async_call=${True} | latency=${False}
521 | | ... | unidirection=${unidirection} | tx_port=${tx_port} | rx_port=${rx_port}
522 | | Run Keyword If | ${dut_stats}==${True}
523 | | ... | Clear runtime counters on all DUTs | ${nodes}
524 | | Sleep | ${duration}
525 | | Run Keyword If | ${dut_stats}==${True}
526 | | ... | Show runtime counters on all DUTs | ${nodes}
527 | | Stop traffic on tg
528
529 | Create network function CPU list
530 | | # TODO: Is there a better place for this keyword?
531 | | # It is not exactly a performance utility.
532 | | [Documentation]
533 | | ... | Create list of CPUs allocated for network function base on SUT/DUT
534 | | ... | placement and other network functions placement.
535 | | ...
536 | | ... | *Arguments:*
537 | | ... | - dut - DUT node. Type: dictionary
538 | | ... | - chains: Total number of chains. Type: integer
539 | | ... | - nodeness: Total number of nodes per chain. Type: integer
540 | | ... | - chain_id - Network function chain ID. Type: integer
541 | | ... | - node_id - Network function node ID within chain. Type: integer
542 | | ... | - mtcr - Main thread to core ratio. Type: integer
543 | | ... | - dtcr - Dataplane thread to core ratio. Type: integer
544 | | ... | - auto_scale - If True, use same amount of Dataplane threads for
545 | | ... |   network function as DUT, otherwise use single physical core for
546 | | ... |   every network function. Type: boolean
547 | | ...
548 | | ... | *Note:*
549 | | ... | KW uses test variables \${cpu_count_int} set by
550 | | ... | "Add worker threads and rxqueues to all DUTs"
551 | | ...
552 | | ... | *Example:*
553 | | ...
554 | | ... | \| Create network function CPU list \| ${nodes['DUT1']} \
555 | | ... | \| 1 \| 1 \| 1 \| 1 \|
556 | | ...
557 | | [Arguments] | ${dut} | ${chains}=${1} | ${nodeness}=${1} | ${chain_id}=${1}
558 | | ... | ${node_id}=${1} | ${mtcr}=${2} | ${dtcr}=${1} | ${auto_scale}=${False}
559 | | ...
560 | | ${sut_sc}= | Set Variable | ${1}
561 | | ${dut_mc}= | Set Variable | ${1}
562 | | ${dut_dc}= | Set Variable | ${cpu_count_int}
563 | | ${skip}= | Evaluate | ${sut_sc} + ${dut_mc} + ${dut_dc}
564 | | ${dtc}= | Set Variable If | ${auto_scale} | ${cpu_count_int} | ${1}
565 | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
566 | | ... | Variable Should Exist | ${${dut}_if1}
567 | | @{if_list}= | Run Keyword If | '${if1_status}' == 'PASS'
568 | | ... | Create List | ${${dut}_if1}
569 | | ... | ELSE | Create List | ${${dut}_if1_1} | ${${dut}_if1_2}
570 | | ${if2_status} | ${value}= | Run Keyword And Ignore Error
571 | | ... | Variable Should Exist | ${${dut}_if2}
572 | | Run Keyword If | '${if2_status}' == 'PASS'
573 | | ... | Append To List | ${if_list} | ${${dut}_if2}
574 | | ... | ELSE | Append To List | ${if_list} | ${${dut}_if2_1} | ${${dut}_if2_2}
575 | | ${dut_numa}= | Get interfaces numa node | ${nodes['${dut}']} | @{if_list}
576 | | ${nf_cpus}= | Cpu slice of list for NF | node=${nodes['${dut}']}
577 | | ... | cpu_node=${dut_numa} | chains=${chains} | nodeness=${nodeness}
578 | | ... | chain_id=${chain_id} | node_id=${node_id} | mtcr=${mtcr}
579 | | ... | dtcr=${dtcr} | dtc=${dtc} | skip_cnt=${skip}
580 | | Return From Keyword | ${nf_cpus}