2cb8d07cb4c5048c2bd73013c64a9f1eff13f6e9
[csit.git] / resources / libraries / robot / performance / performance_utils.robot
1 # Copyright (c) 2018 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 | Calculate pps
42 | | [Documentation]
43 | | ... | Calculate pps for given rate and L2 frame size,
44 | | ... | additional 20B are added to L2 frame size as padding.
45 | | ...
46 | | ... | *Arguments*
47 | | ... | - bps - Rate in bps. Type: integer
48 | | ... | - framesize - L2 frame size in Bytes. Type: integer
49 | | ...
50 | | ... | *Return*
51 | | ... | - Calculated pps. Type: integer
52 | | ...
53 | | ... | *Example:*
54 | | ...
55 | | ... | \| Calculate pps \| 10000000000 \| 64 \|
56 | | ...
57 | | [Arguments] | ${bps} | ${framesize}
58 | | ...
59 | | ${framesize}= | Get Frame Size | ${framesize}
60 | | ${ret}= | Evaluate | (${bps}/((${framesize}+20)*8)).__trunc__()
61 | | Return From Keyword | ${ret}
62
63 | Get Frame Size
64 | | [Documentation]
65 | | ... | Framesize can be either integer in case of a single packet
66 | | ... | in stream, or set of packets in case of IMIX type or simmilar.
67 | | ... | This keyword returns average framesize.
68 | | ...
69 | | ... | *Arguments:*
70 | | ... | - framesize - Framesize. Type: integer or string
71 | | ...
72 | | ... | *Example:*
73 | | ...
74 | | ... | \| Get Frame Size \| IMIX_v4_1 \|
75 | | ...
76 | | [Arguments] | ${framesize}
77 | | ...
78 | | Return From Keyword If | '${framesize}' == 'IMIX_v4_1' | ${353.83333}
79 | | Return From Keyword | ${framesize}
80
81 | Find NDR using linear search and pps
82 | | [Documentation]
83 | | ... | Find throughput by using RFC2544 linear search with non drop rate.
84 | | ...
85 | | ... | *Arguments:*
86 | | ... | - framesize - L2 Frame Size [B]. Type: integer
87 | | ... | - start_rate - Initial start rate [pps]. Type: float
88 | | ... | - step_rate - Step of linear search [pps]. Type: float
89 | | ... | - topology_type - Topology type. Type: string
90 | | ... | - min_rate - Lower limit of search [pps]. Type: float
91 | | ... | - max_rate - Upper limit of search [pps]. Type: float
92 | | ...
93 | | ... | *Return:*
94 | | ... | - No value returned
95 | | ...
96 | | ... | *Example:*
97 | | ...
98 | | ... | \| Find NDR using linear search and pps \| 64 \| 5000000 \
99 | | ... | \| 100000 \| 3-node-IPv4 \| 100000 \| 14880952 \|
100 | | ...
101 | | [Arguments] | ${framesize} | ${start_rate} | ${step_rate}
102 | | ... | ${topology_type} | ${min_rate} | ${max_rate}
103 | | ...
104 | | ${duration}= | Set Variable | ${perf_trial_duration}
105 | | Set Duration | ${duration}
106 | | Set Search Rate Boundaries | ${max_rate} | ${min_rate}
107 | | Set Search Linear Step | ${step_rate}
108 | | Set Search Frame Size | ${framesize}
109 | | Set Search Rate Type pps
110 | | Linear Search | ${start_rate} | ${topology_type}
111 | | ${rate_per_stream} | ${lat}= | Verify Search Result
112 | | ${tmp}= | Create List | 100%NDR | ${lat}
113 | | ${latency}= | Create List | ${tmp}
114 | | ${rate_50p}= | Evaluate | int(${rate_per_stream}*0.5)
115 | | ${lat_50p}= | Measure latency pps | ${duration} | ${rate_50p}
116 | | ... | ${framesize} | ${topology_type}
117 | | ${tmp}= | Create List | 50%NDR | ${lat_50p}
118 | | Append To List | ${latency} | ${tmp}
119 | | ${rate_10p}= | Evaluate | int(${rate_per_stream}*0.1)
120 | | ${lat_10p}= | Measure latency pps | ${duration} | ${rate_10p}
121 | | ... | ${framesize} | ${topology_type}
122 | | ${tmp}= | Create List | 10%NDR | ${lat_10p}
123 | | Append To List | ${latency} | ${tmp}
124 | | Display result of NDR search | ${rate_per_stream} | ${framesize} | 2
125 | | ... | ${latency}
126 | | Traffic should pass with no loss | ${duration} | ${rate_per_stream}pps
127 | | ... | ${framesize} | ${topology_type} | fail_on_loss=${False}
128
129 | Find PDR using linear search and pps
130 | | [Documentation]
131 | | ... | Find throughput by using RFC2544 linear search with partial drop rate
132 | | ... | with PDR threshold and type specified by parameter.
133 | | ...
134 | | ... | *Arguments:*
135 | | ... | - framesize - L2 Frame Size [B]. Type: integer
136 | | ... | - start_rate - Initial start rate [pps]. Type: float
137 | | ... | - step_rate - Step of linear search [pps]. Type: float
138 | | ... | - topology_type - Topology type. Type: string
139 | | ... | - min_rate - Lower limit of search [pps]. Type: float
140 | | ... | - max_rate - Upper limit of search [pps]. Type: float
141 | | ... | - loss_acceptance - Accepted loss during search. Type: float
142 | | ... | - loss_acceptance_type - Percentage or frames. Type: string
143 | | ...
144 | | ... | *Example:*
145 | | ...
146 | | ... | \| Find PDR using linear search and pps \| 64 \| 5000000 \
147 | | ... | \| 100000 \| 3-node-IPv4 \| 100000 \| 14880952 \| 0.5 \| percentage \|
148 | | ...
149 | | [Arguments] | ${framesize} | ${start_rate} | ${step_rate}
150 | | ... | ${topology_type} | ${min_rate} | ${max_rate}
151 | | ... | ${loss_acceptance}=0 | ${loss_acceptance_type}='frames'
152 | | ...
153 | | ${duration}= | Set Variable | ${perf_trial_duration}
154 | | Set Duration | ${duration}
155 | | Set Search Rate Boundaries | ${max_rate} | ${min_rate}
156 | | Set Search Linear Step | ${step_rate}
157 | | Set Search Frame Size | ${framesize}
158 | | Set Search Rate Type pps
159 | | Set Loss Acceptance | ${loss_acceptance}
160 | | Run Keyword If | '${loss_acceptance_type}' == 'percentage'
161 | | ... | Set Loss Acceptance Type Percentage
162 | | Linear Search | ${start_rate} | ${topology_type}
163 | | ${rate_per_stream} | ${lat}= | Verify Search Result
164 | | ${tmp}= | Create List | 100%PDR | ${lat}
165 | | ${latency}= | Create List | ${tmp}
166 | | Display result of PDR search | ${rate_per_stream} | ${framesize} | 2
167 | | ... | ${loss_acceptance} | ${loss_acceptance_type} | ${latency}
168 | | Traffic should pass with partial loss | ${duration} | ${rate_per_stream}pps
169 | | ... | ${framesize} | ${topology_type} | ${loss_acceptance}
170 | | ... | ${loss_acceptance_type} | fail_on_loss=${False}
171
172 | Find NDR using binary search and pps
173 | | [Documentation]
174 | | ... | Find throughput by using RFC2544 binary search with non drop rate.
175 | | ...
176 | | ... | *Arguments:*
177 | | ... | - framesize - L2 Frame Size [B]. Type: integer
178 | | ... | - binary_min - Lower boundary of search [pps]. Type: float
179 | | ... | - binary_max - Upper boundary of search [pps]. Type: float
180 | | ... | - topology_type - Topology type. Type: string
181 | | ... | - min_rate - Lower limit of search [pps]. Type: float
182 | | ... | - max_rate - Upper limit of search [pps]. Type: float
183 | | ... | - threshold - Threshold to stop search [pps]. Type: integer
184 | | ...
185 | | ... | *Example:*
186 | | ...
187 | | ... | \| Find NDR using binary search and pps \| 64 \| 6000000 \
188 | | ... | \| 12000000 \| 3-node-IPv4 \| 100000 \| 14880952 \| 50000 \|
189 | | ...
190 | | [Arguments] | ${framesize} | ${binary_min} | ${binary_max}
191 | | ... | ${topology_type} | ${min_rate} | ${max_rate} | ${threshold}
192 | | ...
193 | | ${duration}= | Set Variable | ${perf_trial_duration}
194 | | Set Duration | ${duration}
195 | | Set Search Rate Boundaries | ${max_rate} | ${min_rate}
196 | | Set Search Frame Size | ${framesize}
197 | | Set Search Rate Type pps
198 | | Set Binary Convergence Threshold | ${threshold}
199 | | Binary Search | ${binary_min} | ${binary_max} | ${topology_type}
200 | | ${rate_per_stream} | ${lat}= | Verify Search Result
201 | | ${tmp}= | Create List | 100%NDR | ${lat}
202 | | ${latency}= | Create List | ${tmp}
203 | | ${rate_50p}= | Evaluate | int(${rate_per_stream}*0.5)
204 | | ${lat_50p}= | Measure latency pps | ${duration} | ${rate_50p}
205 | | ... | ${framesize} | ${topology_type}
206 | | ${tmp}= | Create List | 50%NDR | ${lat_50p}
207 | | Append To List | ${latency} | ${tmp}
208 | | ${rate_10p}= | Evaluate | int(${rate_per_stream}*0.1)
209 | | ${lat_10p}= | Measure latency pps | ${duration} | ${rate_10p}
210 | | ... | ${framesize} | ${topology_type}
211 | | ${tmp}= | Create List | 10%NDR | ${lat_10p}
212 | | Append To List | ${latency} | ${tmp}
213 | | Display result of NDR search | ${rate_per_stream} | ${framesize} | 2
214 | | ... | ${latency}
215 | | Traffic should pass with no loss | ${duration} | ${rate_per_stream}pps
216 | | ... | ${framesize} | ${topology_type} | fail_on_loss=${False}
217
218 | Find PDR using binary search and pps
219 | | [Documentation]
220 | | ... | Find throughput by using RFC2544 binary search with partial drop rate
221 | | ... | with PDR threshold and type specified by parameter.
222 | | ...
223 | | ... | *Arguments:*
224 | | ... | - framesize - L2 Frame Size [B]. Type: integer
225 | | ... | - binary_min - Lower boundary of search [pps]. Type: float
226 | | ... | - binary_max - Upper boundary of search [pps]. Type: float
227 | | ... | - topology_type - Topology type. Type: string
228 | | ... | - min_rate - Lower limit of search [pps]. Type: float
229 | | ... | - max_rate - Upper limit of search [pps]. Type: float
230 | | ... | - threshold - Threshold to stop search [pps]. Type: integer
231 | | ... | - loss_acceptance - Accepted loss during search. Type: float
232 | | ... | - loss_acceptance_type - Percentage or frames. Type: string
233 | | ...
234 | | ... | *Example:*
235 | | ...
236 | | ... | \| Find PDR using binary search and pps \| 64 \| 6000000 \
237 | | ... | \| 12000000 \| 3-node-IPv4 \| 100000 \| 14880952 \| 50000 \| 0.5 \
238 | | ... | \| percentage \|
239 | | ...
240 | | [Arguments] | ${framesize} | ${binary_min} | ${binary_max}
241 | | ... | ${topology_type} | ${min_rate} | ${max_rate} | ${threshold}
242 | | ... | ${loss_acceptance}=0 | ${loss_acceptance_type}='frames'
243 | | ...
244 | | ${duration}= | Set Variable | ${perf_trial_duration}
245 | | Set Duration | ${duration}
246 | | Set Search Rate Boundaries | ${max_rate} | ${min_rate}
247 | | Set Search Frame Size | ${framesize}
248 | | Set Search Rate Type pps
249 | | Set Loss Acceptance | ${loss_acceptance}
250 | | Run Keyword If | '${loss_acceptance_type}' == 'percentage'
251 | | ... | Set Loss Acceptance Type Percentage
252 | | Set Binary Convergence Threshold | ${threshold}
253 | | Binary Search | ${binary_min} | ${binary_max} | ${topology_type}
254 | | ${rate_per_stream} | ${lat}= | Verify Search Result
255 | | ${tmp}= | Create List | 100%PDR | ${lat}
256 | | ${latency}= | Create List | ${tmp}
257 | | Display result of PDR search | ${rate_per_stream} | ${framesize} | 2
258 | | ... | ${loss_acceptance} | ${loss_acceptance_type} | ${latency}
259 | | Traffic should pass with partial loss | ${duration} | ${rate_per_stream}pps
260 | | ... | ${framesize} | ${topology_type} | ${loss_acceptance}
261 | | ... | ${loss_acceptance_type} | fail_on_loss=${False}
262
263 | Find NDR using combined search and pps
264 | | [Documentation]
265 | | ... | Find throughput by using RFC2544 combined search (linear+binary) with
266 | | ... | non drop rate.
267 | | ...
268 | | ... | *Arguments:*
269 | | ... | - framesize - L2 Frame Size [B]. Type: integer
270 | | ... | - start_rate - Initial start rate [pps]. Type: float
271 | | ... | - step_rate - Step of linear search [pps]. Type: float
272 | | ... | - topology_type - Topology type. Type: string
273 | | ... | - min_rate - Lower limit of search [pps]. Type: float
274 | | ... | - max_rate - Upper limit of search [pps]. Type: float
275 | | ... | - threshold - Threshold to stop search [pps]. Type: integer
276 | | ...
277 | | ... | *Example:*
278 | | ...
279 | | ... | \| Find NDR using combined search and pps \| 64 \| 5000000 \
280 | | ... | \| 100000 \| 3-node-IPv4 \| 100000 \| 14880952 \| 5000 \|
281 | | ...
282 | | [Arguments] | ${framesize} | ${start_rate} | ${step_rate}
283 | | ... | ${topology_type} | ${min_rate} | ${max_rate} | ${threshold}
284 | | ...
285 | | ${duration}= | Set Variable | ${perf_trial_duration}
286 | | Set Duration | ${duration}
287 | | Set Search Rate Boundaries | ${max_rate} | ${min_rate}
288 | | Set Search Linear Step | ${step_rate}
289 | | Set Search Frame Size | ${framesize}
290 | | Set Search Rate Type pps
291 | | Set Binary Convergence Threshold | ${threshold}
292 | | Combined Search | ${start_rate} | ${topology_type}
293 | | ${rate_per_stream} | ${lat}= | Verify Search Result
294 | | ${tmp}= | Create List | 100%NDR | ${lat}
295 | | ${latency}= | Create List | ${tmp}
296 | | ${rate_50p}= | Evaluate | int(${rate_per_stream}*0.5)
297 | | ${lat_50p}= | Measure latency pps | ${duration} | ${rate_50p}
298 | | ... | ${framesize} | ${topology_type}
299 | | ${tmp}= | Create List | 50%NDR | ${lat_50p}
300 | | Append To List | ${latency} | ${tmp}
301 | | ${rate_10p}= | Evaluate | int(${rate_per_stream}*0.1)
302 | | ${lat_10p}= | Measure latency pps | ${duration} | ${rate_10p}
303 | | ... | ${framesize} | ${topology_type}
304 | | ${tmp}= | Create List | 10%NDR | ${lat_10p}
305 | | Append To List | ${latency} | ${tmp}
306 | | Display result of NDR search | ${rate_per_stream} | ${framesize} | 2
307 | | ... | ${latency}
308 | | Traffic should pass with no loss | ${duration} | ${rate_per_stream}pps
309 | | ... | ${framesize} | ${topology_type}
310 | | ... | fail_on_loss=${False}
311
312 | Find PDR using combined search and pps
313 | | [Documentation]
314 | | ... | Find throughput by using RFC2544 combined search (linear+binary) with
315 | | ... | partial drop rate with PDR threshold and type specified by parameter.
316 | | ...
317 | | ... | *Arguments:*
318 | | ... | - framesize - L2 Frame Size [B]. Type: integer
319 | | ... | - start_rate - Initial start rate [pps]. Type: float
320 | | ... | - step_rate - Step of linear search [pps]. Type: float
321 | | ... | - topology_type - Topology type. Type: string
322 | | ... | - min_rate - Lower limit of search [pps]. Type: float
323 | | ... | - max_rate - Upper limit of search [pps]. Type: float
324 | | ... | - threshold - Threshold to stop search [pps]. Type: integer
325 | | ... | - loss_acceptance - Accepted loss during search. Type: float
326 | | ... | - loss_acceptance_type - Percentage or frames. Type: string
327 | | ...
328 | | ... | *Example:*
329 | | ...
330 | | ... | \| Find PDR using combined search and pps \| 64 \| 5000000 \
331 | | ... | \| 100000 \| 3-node-IPv4 \| 100000 \| 14880952 \| 5000 \| 0.5 \
332 | | ... | \| percentage \|
333 | | ...
334 | | [Arguments] | ${framesize} | ${start_rate} | ${step_rate}
335 | | ... | ${topology_type} | ${min_rate} | ${max_rate} | ${threshold}
336 | | ... | ${loss_acceptance}=0 | ${loss_acceptance_type}='frames'
337 | | ...
338 | | ${duration}= | Set Variable | ${perf_trial_duration}
339 | | Set Duration | ${duration}
340 | | Set Search Rate Boundaries | ${max_rate} | ${min_rate}
341 | | Set Search Linear Step | ${step_rate}
342 | | Set Search Frame Size | ${framesize}
343 | | Set Search Rate Type pps
344 | | Set Loss Acceptance | ${loss_acceptance}
345 | | Run Keyword If | '${loss_acceptance_type}' == 'percentage'
346 | | ... | Set Loss Acceptance Type Percentage
347 | | Set Binary Convergence Threshold | ${threshold}
348 | | Combined Search | ${start_rate} | ${topology_type}
349 | | ${rate_per_stream} | ${lat}= | Verify Search Result
350 | | ${tmp}= | Create List | 100%PDR | ${lat}
351 | | ${latency}= | Create List | ${tmp}
352 | | Display result of PDR search | ${rate_per_stream} | ${framesize} | 2
353 | | ... | ${loss_acceptance} | ${loss_acceptance_type} | ${latency}
354 | | Traffic should pass with partial loss | ${duration} | ${rate_per_stream}pps
355 | | ... | ${framesize} | ${topology_type} | ${loss_acceptance}
356 | | ... | ${loss_acceptance_type} | fail_on_loss=${False}
357
358 | Find NDR and PDR intervals using optimized search
359 | | [Documentation]
360 | | ... | Find boundaries for RFC2544 compatible NDR and PDR values
361 | | ... | using an optimized search algorithm.
362 | | ... | Display results as formatted test message.
363 | | ... | Fail if a resulting lower bound has too high loss fraction.
364 | | ... | Proceed with Perform additional measurements based on NDRPDR result.
365 | | ... | TODO: Should the trial duration of the additional
366 | | ... | measurements be configurable?
367 | | ...
368 | | ... | *Arguments:*
369 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: int or str
370 | | ... | - topology_type - Topology type. Type: string
371 | | ... | - minimum_transmit_rate - Lower limit of search [pps]. Type: float
372 | | ... | - maximum_transmit_rate - Upper limit of search [pps]. Type: float
373 | | ... | - packet_loss_ratio - Accepted loss during search. Type: float
374 | | ... | - final_relative_width - Maximal width multiple of upper. Type: float
375 | | ... | - final_trial_duration - Duration of final trials [s]. Type: float
376 | | ... | - initial_trial_duration - Duration of initial trials [s]. Type: float
377 | | ... | - intermediate phases - Number of intermediate phases [1]. Type: int
378 | | ... | - timeout - Fail if search duration is longer [s]. Type: float
379 | | ...
380 | | ... | *Example:*
381 | | ...
382 | | ... | \| Find NDR and PDR intervals using optimized search \| \${64} \| \
383 | | ... | 3-node-IPv4 \| \${100000} \| \${14880952} \| \${0.005} \| \${0.005} \
384 | | ... | \| \${30.0} \| \${1.0} \| \${2} \| ${600.0}
385 | | ...
386 | | [Arguments] | ${frame_size} | ${topology_type} | ${minimum_transmit_rate}
387 | | ... | ${maximum_transmit_rate} | ${packet_loss_ratio}=${0.005}
388 | | ... | ${final_relative_width}=${0.005} | ${final_trial_duration}=${30.0}
389 | | ... | ${initial_trial_duration}=${1.0}
390 | | ... | ${number_of_intermediate_phases}=${2} | ${timeout}=${600.0}
391 | | ...
392 | | ${result}= | Perform optimized ndrpdr search | ${frame_size}
393 | | ... | ${topology_type} | ${minimum_transmit_rate} | ${maximum_transmit_rate}
394 | | ... | ${packet_loss_ratio} | ${final_relative_width}
395 | | ... | ${final_trial_duration} | ${initial_trial_duration}
396 | | ... | ${number_of_intermediate_phases} | timeout=${timeout}
397 | | Display result of NDRPDR search | ${result} | ${frame_size}
398 | | Check NDRPDR interval validity | ${result.pdr_interval}
399 | | ... | ${packet_loss_ratio}
400 | | Check NDRPDR interval validity | ${result.ndr_interval}
401 | | Perform additional measurements based on NDRPDR result
402 | | ... | ${result} | ${frame_size} | ${topology_type}
403
404 | Display single bound
405 | | [Documentation]
406 | | ... | Display one bound of NDR+PDR search,
407 | | ... | in packet per seconds (total and per stream)
408 | | ... | and Gbps total bandwidth with untagged packet.
409 | | ... | Througput is calculated as:
410 | | ... | Measured rate per stream * Total number of streams
411 | | ... | Bandwidth is calculated as:
412 | | ... | (Throughput * (L2 Frame Size + IPG) * 8) / Max bitrate of NIC
413 | | ... | The given result should contain latency data as well.
414 | | ...
415 | | ... | *Arguments:*
416 | | ... | - text - Flavor text describing which bound is this. Type: string
417 | | ... | - rate_total - Total (not per stream) measured Tr [pps]. Type: float
418 | | ... | - framesize - L2 Frame Size [B]. Type: integer
419 | | ... | - latency - Latency data to display if non-empty. Type: string
420 | | ...
421 | | ... | *Example:*
422 | | ...
423 | | ... | \| Display single bound \| NDR lower bound \| \${12345.67} \
424 | | ... | \| \${64} \| show_latency=\${EMPTY}
425 | | ...
426 | | [Arguments] | ${text} | ${rate_total} | ${framesize} | ${latency}=${EMPTY}
427 | | ...
428 | | ${bandwidth_total}= | Evaluate | ${rate_total}*(${framesize}+20)*8/(10**9)
429 | | Set Test Message | ${\n}${text}: ${rate_total} pps, | append=yes
430 | | Set Test Message | ${bandwidth_total} Gbps (untagged) | append=yes
431 | | Return From Keyword If | not """${latency}"""
432 | | Set Test Message | ${\n}LATENCY usec [min/avg/max] per stream: ${latency}
433 | | ... | append=yes
434
435 | Display result of NDRPDR search
436 | | [Documentation]
437 | | ... | Display result of NDR+PDR search, both quantities, both bounds,
438 | | ... | in packet per seconds (total and per stream)
439 | | ... | and Gbps total bandwidth with untagged packet.
440 | | ... | Througput is calculated as:
441 | | ... | Measured rate per stream * Total number of streams
442 | | ... | Bandwidth is calculated as:
443 | | ... | (Throughput * (L2 Frame Size + IPG) * 8) / Max bitrate of NIC
444 | | ... | The given result should contain latency data as well.
445 | | ...
446 | | ... | *Arguments:*
447 | | ... | - result - Measured result data per stream [pps]. Type: NdrPdrResult
448 | | ... | - framesize - L2 Frame Size [B]. Type: integer
449 | | ...
450 | | ... | *Example:*
451 | | ...
452 | | ... | \| Display result of NDRPDR search \| \${result} \| \${64}
453 | | ...
454 | | [Arguments] | ${result} | ${framesize}
455 | | ...
456 | | ${framesize}= | Get Frame Size | ${framesize}
457 | | Display single bound | NDR_LOWER
458 | | ... | ${result.ndr_interval.measured_low.transmit_rate} | ${framesize}
459 | | ... | ${result.ndr_interval.measured_low.latency}
460 | | Display single bound | NDR_UPPER
461 | | ... | ${result.ndr_interval.measured_high.transmit_rate} | ${framesize}
462 | | Display single bound | PDR_LOWER
463 | | ... | ${result.pdr_interval.measured_low.transmit_rate} | ${framesize}
464 | | ... | ${result.pdr_interval.measured_low.latency}
465 | | Display single bound | PDR_UPPER
466 | | ... | ${result.pdr_interval.measured_high.transmit_rate} | ${framesize}
467
468 | Check NDRPDR interval validity
469 | | [Documentation]
470 | | ... | Extract loss ratio of lower bound of the interval.
471 | | ... | Fail if it does not reach the allowed value.
472 | | ...
473 | | ... | *Arguments:*
474 | | ... | - interval - Measured interval. Type: ReceiveRateInterval
475 | | ... | - packet_loss_ratio - Accepted loss (0.0 for NDR). Type: float
476 | | ...
477 | | ... | *Example:*
478 | | ...
479 | | ... | \| Check NDRPDR interval validity \| \${result.pdr_interval} \
480 | | ... | \| \${0.005}
481 | | ...
482 | | [Arguments] | ${interval} | ${packet_loss_ratio}=${0.0}
483 | | ...
484 | | ${lower_bound_lf}= | Set Variable | ${interval.measured_low.loss_fraction}
485 | | Return From Keyword If | ${lower_bound_lf} <= ${packet_loss_ratio}
486 | | ${messagge}= | Catenate | SEPARATOR=${SPACE}
487 | | ... | Lower bound fraction ${lower_bound_lf}
488 | | ... | does not reach ${packet_loss_ratio}.
489 | | Fail | ${message}
490
491 | Perform additional measurements based on NDRPDR result
492 | | [Documentation]
493 | | ... | Perform any additional measurements which are not directly needed
494 | | ... | for determining NDR nor PDR, but which are needed for gathering
495 | | ... | additional data for debug purposes.
496 | | ... | Currently, just "Traffic should pass with no loss" is called.
497 | | ... | TODO: Move latency measurements from optimized search here.
498 | | ...
499 | | ... | *Arguments:*
500 | | ... | - result - Measured result data per stream [pps]. Type: NdrPdrResult
501 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: int or str
502 | | ... | - topology_type - Topology type. Type: string
503 | | ...
504 | | ... | *Example:*
505 | | ... | \| Perform additional measurements based on NDRPDR result \
506 | | ... | \| \${result} \| ${64} \| 3-node-IPv4
507 | | ...
508 | | [Arguments] | ${result} | ${framesize} | ${topology_type}
509 | | ...
510 | | ${duration}= | Set Variable | 5.0
511 | | ${rate_per_stream}= | Evaluate
512 | | ... | ${result.ndr_interval.measured_low.target_tr} / 2.0
513 | | Traffic should pass with no loss | ${duration} | ${rate_per_stream}pps
514 | | ... | ${framesize} | ${topology_type} | fail_on_loss=${False}
515
516 | Display result of NDR search
517 | | [Documentation]
518 | | ... | Display result of NDR search in packet per seconds (total and per
519 | | ... | stream) and Gbps total bandwidth with untagged packet.
520 | | ... | Througput is calculated as:
521 | | ... | Measured rate per stream * Total number of streams
522 | | ... | Bandwidth is calculated as:
523 | | ... | (Throughput * (L2 Frame Size + IPG) * 8) / Max bitrate of NIC
524 | | ...
525 | | ... | *Arguments:*
526 | | ... | - rate_per_stream - Measured rate per stream [pps]. Type: string
527 | | ... | - framesize - L2 Frame Size [B]. Type: integer
528 | | ... | - nr_streams - Total number of streams. Type: integer
529 | | ... | - latency - Latency stats. Type: dictionary
530 | | ...
531 | | ... | *Example:*
532 | | ...
533 | | ... | \| Display result of NDR search \| 4400000 \| 64 \| 2 \
534 | | ... | \| [100%NDR, [10/10/10, 1/2/3]] \|
535 | | ...
536 | | [Arguments] | ${rate_per_stream} | ${framesize} | ${nr_streams} | ${latency}
537 | | ...
538 | | ${framesize}= | Get Frame Size | ${framesize}
539 | | ${rate_total}= | Evaluate | ${rate_per_stream}*${nr_streams}
540 | | ${bandwidth_total}= | Evaluate | ${rate_total}*(${framesize}+20)*8/(10**9)
541 | | Set Test Message | FINAL_RATE: ${rate_total} pps
542 | | Set Test Message | (${nr_streams}x ${rate_per_stream} pps) | append=yes
543 | | Set Test Message | ${\n}FINAL_BANDWIDTH: ${bandwidth_total} Gbps (untagged)
544 | | ... | append=yes
545 | | Set Test Message | ${\n}LATENCY usec [min/avg/max] | append=yes
546 | | :FOR | ${lat} | IN | @{latency}
547 | | | Set Test Message | ${\n}LAT_${lat[0]}: ${lat[1]} | append=yes
548
549 | Display result of PDR search
550 | | [Documentation]
551 | | ... | Display result of PDR search in packet per seconds (total and per
552 | | ... | stream) and Gbps total bandwidth with untagged packet.
553 | | ... | Througput is calculated as:
554 | | ... | Measured rate per stream * Total number of streams
555 | | ... | Bandwidth is calculated as:
556 | | ... | (Throughput * (L2 Frame Size + IPG) * 8) / Max bitrate of NIC
557 | | ...
558 | | ... | *Arguments:*
559 | | ... | - rate_per_stream - Measured rate per stream [pps]. Type: string
560 | | ... | - framesize - L2 Frame Size [B]. Type: integer
561 | | ... | - nr_streams - Total number of streams. Type: integer
562 | | ... | - loss_acceptance - Accepted loss during search. Type: float
563 | | ... | - loss_acceptance_type - Percentage or frames. Type: string
564 | | ... | - latency - Latency stats. Type: dictionary
565 | | ...
566 | | ... | *Example:*
567 | | ...
568 | | ... | \| Display result of PDR search \| 4400000 \| 64 \| 2 \| 0.5 \
569 | | ... | \| percentage \| [100%NDR, [10/10/10, 1/2/3]] \|
570 | | ...
571 | | [Arguments] | ${rate_per_stream} | ${framesize} | ${nr_streams}
572 | | ... | ${loss_acceptance} | ${loss_acceptance_type} | ${latency}
573 | | ...
574 | | ${framesize}= | Get Frame Size | ${framesize}
575 | | ${rate_total}= | Evaluate | ${rate_per_stream}*${nr_streams}
576 | | ${bandwidth_total}= | Evaluate | ${rate_total}*(${framesize}+20)*8/(10**9)
577 | | Set Test Message | FINAL_RATE: ${rate_total} pps
578 | | Set Test Message | (${nr_streams}x ${rate_per_stream} pps) | append=yes
579 | | Set Test Message | ${\n}FINAL_BANDWIDTH: ${bandwidth_total} Gbps (untagged)
580 | | ... | append=yes
581 | | Set Test Message | ${\n}LATENCY usec [min/avg/max] | append=yes
582 | | :FOR | ${lat} | IN | @{latency}
583 | | | Set Test Message | ${\n}LAT_${lat[0]}: ${lat[1]} | append=yes
584 | | Set Test Message
585 | | ... | ${\n}LOSS_ACCEPTANCE: ${loss_acceptance} ${loss_acceptance_type}
586 | | ... | append=yes
587
588 | Measure latency pps
589 | | [Documentation]
590 | | ... | Send traffic at specified rate. Measure min/avg/max latency
591 | | ...
592 | | ... | *Arguments:*
593 | | ... | - duration - Duration of traffic run [s]. Type: integer
594 | | ... | - rate - Rate for sending packets. Type: integer
595 | | ... | - framesize - L2 Frame Size [B] or IMIX_v4_1. Type: integer/string
596 | | ... | - topology_type - Topology type. Type: string
597 | | ...
598 | | ... | *Example:*
599 | | ...
600 | | ... | \| Measure latency \| 10 \| 4.0 \| 64 \| 3-node-IPv4 \|
601 | | ...
602 | | [Arguments] | ${duration} | ${rate} | ${framesize} | ${topology_type}
603 | | ...
604 | | Return From Keyword If | ${rate} <= 10000 | ${-1}
605 | | Send traffic on tg | ${duration} | ${rate}pps | ${framesize}
606 | | ... | ${topology_type} | warmup_time=0
607 | | Run keyword and return | Get latency
608
609 | Traffic should pass with no loss
610 | | [Documentation]
611 | | ... | Send traffic at specified rate. No packet loss is accepted at loss
612 | | ... | evaluation.
613 | | ...
614 | | ... | *Arguments:*
615 | | ... | - duration - Duration of traffic run [s]. Type: integer
616 | | ... | - rate - Rate for sending packets. Type: string
617 | | ... | - framesize - L2 Frame Size [B] or IMIX_v4_1. Type: integer/string
618 | | ... | - topology_type - Topology type. Type: string
619 | | ... | - fail_on_loss - If True, the keyword fails if loss occurred.
620 | | ... | Type: boolean
621 | | ...
622 | | ... | *Example:*
623 | | ...
624 | | ... | \| Traffic should pass with no loss \| 10 \| 4.0mpps \| 64 \
625 | | ... | \| 3-node-IPv4 \|
626 | | ...
627 | | [Arguments] | ${duration} | ${rate} | ${framesize} | ${topology_type}
628 | | ... | ${fail_on_loss}=${True}
629 | | ...
630 | | Send traffic at specified rate | ${duration} | ${rate} | ${framesize}
631 | | ... | ${topology_type}
632 | | Run Keyword If | ${fail_on_loss} | No traffic loss occurred
633
634 | Traffic should pass with partial loss
635 | | [Documentation]
636 | | ... | Send traffic at specified rate. Partial packet loss is accepted
637 | | ... | within loss acceptance value specified as argument.
638 | | ...
639 | | ... | *Arguments:*
640 | | ... | - duration - Duration of traffic run [s]. Type: integer
641 | | ... | - rate - Rate for sending packets. Type: string
642 | | ... | - framesize - L2 Frame Size [B] or IMIX_v4_1. Type: integer/string
643 | | ... | - topology_type - Topology type. Type: string
644 | | ... | - loss_acceptance - Accepted loss during search. Type: float
645 | | ... | - loss_acceptance_type - Percentage or frames. Type: string
646 | | ...
647 | | ... | *Example:*
648 | | ...
649 | | ... | \| Traffic should pass with partial loss \| 10 \| 4.0mpps \| 64 \
650 | | ... | \| 3-node-IPv4 \| 0.5 \| percentage \|
651 | | ...
652 | | [Arguments] | ${duration} | ${rate} | ${framesize} | ${topology_type}
653 | | ... | ${loss_acceptance} | ${loss_acceptance_type}
654 | | ... | ${fail_on_loss}=${True}
655 | | ...
656 | | Send traffic at specified rate | ${duration} | ${rate} | ${framesize}
657 | | ... | ${topology_type}
658 | | Run Keyword If | ${fail_on_loss} | Partial traffic loss accepted
659 | | ... | ${loss_acceptance} | ${loss_acceptance_type}
660
661 | Traffic should pass with maximum rate
662 | | [Documentation]
663 | | ... | Send traffic at maximum rate.
664 | | ...
665 | | ... | *Arguments:*
666 | | ... | - rate - Rate for sending packets. Type: string
667 | | ... | - framesize - L2 Frame Size [B] or IMIX_v4_1. Type: integer/string
668 | | ... | - topology_type - Topology type. Type: string
669 | | ... | - subsamples - How many trials in this measurement. Type:int
670 | | ... | - trial_duration - Duration of single trial [s]. Type: float
671 | | ... | - fail_no_traffic - Whether to fail on zero receive count. Type: boolean
672 | | ...
673 | | ... | *Example:*
674 | | ...
675 | | ... | \| Traffic should pass with maximum rate \| 4.0mpps \| 64 \
676 | | ... | \| 3-node-IPv4 \| ${1} \| ${10.0} | ${False}
677 | | ...
678 | | [Arguments] | ${rate} | ${framesize} | ${topology_type}
679 | | ... | ${trial_duration}=${perf_trial_duration} | ${fail_no_traffic}=${True}
680 | | ... | ${subsamples}=${perf_trial_multiplicity}
681 | | ...
682 | | ${results} = | Send traffic at specified rate | ${trial_duration} | ${rate}
683 | | ... | ${framesize} | ${topology_type} | ${subsamples}
684 | | Set Test Message | ${\n}Maximum Receive Rate trial results
685 | | Set Test Message | in packets per second: ${results}
686 | | ... | append=yes
687 | | # TODO: Should we also report the percentage relative to transmit rate,
688 | | # so that people looking at console can decide how close to 100% it is?
689 | | Run Keyword If | ${fail_no_traffic} | Fail if no traffic forwarded
690
691 | Send traffic at specified rate
692 | | [Documentation]
693 | | ... | Send traffic at specified rate.
694 | | ... | Return list of measured receive rates.
695 | | ...
696 | | ... | *Arguments:*
697 | | ... | - trial_duration - Duration of single trial [s]. Type: float
698 | | ... | - rate - Rate for sending packets. Type: string
699 | | ... | - framesize - L2 Frame Size [B]. Type: integer/string
700 | | ... | - topology_type - Topology type. Type: string
701 | | ... | - subsamples - How many trials in this measurement. Type: int
702 | | ...
703 | | ... | *Example:*
704 | | ...
705 | | ... | \| Send traffic at specified rate \| ${1.0} \| 4.0mpps \| 64 \
706 | | ... | \| 3-node-IPv4 \| ${10}
707 | | ...
708 | | [Arguments] | ${trial_duration} | ${rate} | ${framesize}
709 | | ... | ${topology_type} | ${subsamples}=${1}
710 | | ...
711 | | Clear and show runtime counters with running traffic | ${trial_duration}
712 | | ... | ${rate} | ${framesize} | ${topology_type}
713 | | Run Keyword If | ${dut_stats}==${True} | Clear all counters on all DUTs
714 | | Run Keyword If | ${dut_stats}==${True} and ${pkt_trace}==${True}
715 | | ... | VPP Enable Traces On All DUTs | ${nodes}
716 | | ${results} = | Create List
717 | | :FOR | ${i} | IN RANGE | ${subsamples}
718 | | | Send traffic on tg | ${trial_duration} | ${rate} | ${framesize}
719 | | | ... | ${topology_type} | warmup_time=0
720 | | | ${rx} = | Get Received
721 | | | ${rr} = | Evaluate | ${rx} / ${trial_duration}
722 | | | Append To List | ${results} | ${rr}
723 | | Run Keyword If | ${dut_stats}==${True} | Show statistics on all DUTs
724 | | ... | ${nodes}
725 | | Run Keyword If | ${dut_stats}==${True} and ${pkt_trace}==${True}
726 | | ... | Show Packet Trace On All Duts | ${nodes} | maximum=${100}
727 | | Return From Keyword | ${results}
728
729 | Clear and show runtime counters with running traffic
730 | | [Documentation]
731 | | ... | Start traffic at specified rate then clear runtime counters on all
732 | | ... | DUTs. Wait for specified amount of time and capture runtime counters
733 | | ... | on all DUTs. Finally stop traffic
734 | | ...
735 | | ... | *Arguments:*
736 | | ... | - duration - Duration of traffic run [s]. Type: integer
737 | | ... | - rate - Rate for sending packets. Type: string
738 | | ... | - framesize - L2 Frame Size [B] or IMIX_v4_1. Type: integer/string
739 | | ... | - topology_type - Topology type. Type: string
740 | | ...
741 | | ... | *Example:*
742 | | ...
743 | | ... | \| Traffic should pass with partial loss \| 10 \| 4.0mpps \| 64 \
744 | | ... | \| 3-node-IPv4 \| 0.5 \| percentage \|
745 | | ...
746 | | [Arguments] | ${duration} | ${rate} | ${framesize} | ${topology_type}
747 | | ...
748 | | Send traffic on tg | -1 | ${rate} | ${framesize} | ${topology_type}
749 | | ... | warmup_time=0 | async_call=${True} | latency=${False}
750 | | Run Keyword If | ${dut_stats}==${True}
751 | | ... | Clear runtime counters on all DUTs | ${nodes}
752 | | Sleep | ${duration}
753 | | Run Keyword If | ${dut_stats}==${True}
754 | | ... | Show runtime counters on all DUTs | ${nodes}
755 | | Stop traffic on tg