feat(astf): Support framesizes for ASTF
[csit.git] / resources / libraries / robot / performance / performance_vars.robot
1 # Copyright (c) 2022 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 | Documentation | Performance suite keywords - Handling of various values
16 | ... | to allow autodetection, computation and overriding by suite variables.
17 | Library | Collections
18 | Variables | ${CURDIR}/../../python/Constants.py
19
20 *** Variables ***
21 | ${extended_debug}= | ${EXTENDED_DEBUG}
22
23 *** Keywords ***
24 | Get Disable Latency
25 | | [Documentation]
26 | | ... | If Get Use Latency returns true, return false.
27 | | ... | Otherwise return value of \${disable_latency} variable,
28 | | ... | or \${False} if not defined.
29 | |
30 | | ... | The return value controls whether latency trials in NDRPDR tests
31 | | ... | are executed. For example, ASTF tests do not support latency
32 | | ... | measurements yet, so executing the trials just wastes time.
33 | | ... | Return type: bool.
34 | |
35 | | ... | *Example:*
36 | |
37 | | ... | \| \${disable_latency} = \| Get Disable Latency \|
38 | |
39 | | ${use_latency} = | Get Use Latency
40 | | Return From Keyword If | ${use_latency} | ${False}
41 | | ${disable_latency} = | Get Variable Value | \${disable_latency} | ${False}
42 | | Return From Keyword | ${disable_latency}
43
44 | Get Max Rate
45 | | [Documentation]
46 | | ... | Return value of \${max_rate} variable,
47 | | ... | fail if it is not defined.
48 | | ... | Call this just before calling a Python keyword,
49 | | ... | as those have restricted access to Robot variables.
50 | |
51 | | ... | The return value controls the maximal unidirectional packet rate.
52 | | ... | The value is also usable for minimal TPS value for ASTF tests.
53 | | ... | Return type: float.
54 | |
55 | | ... | *Example:*
56 | |
57 | | ... | \| \${max_rate} = \| Get Max Rate \|
58 | |
59 | | ${max_rate} = | Get Variable Value | \${max_rate} | ${0.0}
60 | | Return From Keyword If | ${max_rate} | ${max_rate}
61 | | Fail | \${max_rate} is not defined. Call Set Max Rate And Jumbo keyword.
62
63 | Get Min Rate Hard
64 | | [Documentation]
65 | | ... | Return a hardcoded value.
66 | | ... | The return value controls the minimal unidirectional packet rate,
67 | | ... | to be used anywhere, including latency measurements at 0% load.
68 | | ... | The current value is the smallest one permitted
69 | | ... | by STL profiles with latency streams.
70 | | ... | Return type: float.
71 | |
72 | | ... | *Example:*
73 | |
74 | | ... | \| \${min_rate_hard} = \| Get Min Rate Hard \|
75 | |
76 | | Return From Keyword | ${9001.0}
77
78 | Get Min Rate Soft
79 | | [Documentation]
80 | | ... | If ramp up rate is not defined, return the hard min value.
81 | | ... | If ramp up rate is defined (and larger than hard min), return that.
82 | | ... | The reason is, ramp up rate should already guarantee no loss.
83 | |
84 | | ... | The return value controls the minimal unidirectional packet rate,
85 | | ... | to be used in various search algorithms.
86 | | ... | Latency measurements may want even lower loads, use hard min for that.
87 | |
88 | | ... | The value is also usable for minimal TPS value for ASTF tests.
89 | | ... | Return type: float.
90 | |
91 | | ... | Currently, undefined ramp up rate is reported as zero,
92 | | ... | so we return the maximum of ramp up rate and the hard min rate.
93 | |
94 | | ... | *Example:*
95 | |
96 | | ... | \| \${min_rate_soft} = \| Get Min Rate Soft \|
97 | |
98 | | ${min_rate_hard} = | Get Min Rate Hard
99 | | ${ramp_up_rate} = | Get Ramp Up Rate
100 | | ${min_rate_soft} = | Evaluate | max(${ramp_up_rate}, ${min_rate_hard})
101 | | Return From Keyword | ${min_rate_soft}
102
103 | Get Mrr Trial Duration
104 | | [Documentation]
105 | | ... | Return value from Constants. This is an abstraction, useful in case
106 | | ... | we start allowing various other overrides or computations.
107 | | ... | Call this just before calling a Python keyword,
108 | | ... | as those have restricted access to Robot variables.
109 | |
110 | | ... | The return value controls the duration of main trial measurement
111 | | ... | for MRR type tests.
112 | | ... | Return type: float.
113 | |
114 | | ... | *Example:*
115 | |
116 | | ... | \| \${mrr_trial_duration} = \| Get Mrr Trial Duration \|
117 | |
118 | | Return From Keyword | ${PERF_TRIAL_DURATION}
119
120 | Get Mrr Trial Multiplicity
121 | | [Documentation]
122 | | ... | Return value from Constants. This is an abstraction, useful in case
123 | | ... | we start allowing various other overrides or computations.
124 | | ... | Call this just before calling a Python keyword,
125 | | ... | as those have restricted access to Robot variables.
126 | |
127 | | ... | The return value controls the number of main trial measurement
128 | | ... | for (B)MRR type tests.
129 | | ... | Return type: integer.
130 | |
131 | | ... | *Example:*
132 | |
133 | | ... | \| \${mrr_trial_multiplicity} = \| Get Mrr Trial Multiplicity \|
134 | |
135 | | Return From Keyword | ${PERF_TRIAL_MULTIPLICITY}
136
137 | Get Packet Loss Ratio
138 | | [Documentation]
139 | | ... | Return a hardcoded value. This is an abstraction, useful in case
140 | | ... | we start allowing various other overrides or computations.
141 | | ... | Call this just before calling a Python keyword,
142 | | ... | as those have restricted access to Robot variables.
143 | |
144 | | ... | The return value controls the default packet loss ration for PDR
145 | | ... | in NDRPDR tests. Some other usages of MLRsearch (e.g. reconf tests)
146 | | ... | may use a different value.
147 | | ... | Return type: float.
148 | |
149 | | ... | *Example:*
150 | |
151 | | ... | \| \${packet_loss_ratio} = \| Get Packet Loss Ratio \|
152 | |
153 | | Return From Keyword | ${0.005}
154
155 | Get Packets Per Transaction Aggregated
156 | | [Documentation]
157 | | ... | Return value of \${packets_per_transaction_aggregated};
158 | | ... | if not defined, assume traffic is symmetric (or unidirectional)
159 | | ... | and compute from unidirectional values.
160 | |
161 | | ... | The return value is used when reporting PPS (and bandwidth) values
162 | | ... | from TPS found by some search (e.g. NDRPDR).
163 | | ... | Return type: integer.
164 | |
165 | | ... | *Example:*
166 | |
167 | | ... | \| \${ppta} = \| Get Packets Per Transaction Aggregated \|
168 | |
169 | | ${ppta} = | Get Variable Value | \${packets_per_transaction_aggregated}
170 | | ... | ${0}
171 | | Return From Keyword If | "${ppta}" != "0" | ${ppta}
172 | | ${pptad} = | Get Packets Per Transaction And Direction
173 | | ${traffic_directions} = | Get Traffic Directions
174 | | # We do not support ASTF profiles with multiple transactions, yet.
175 | | ${ppta} = | Evaluate | ${pptad} * ${traffic_directions}
176 | | Return From Keyword | ${ppta}
177
178 | Get Packets Per Transaction And Direction
179 | | [Documentation]
180 | | ... | Return value of \${packets_per_transaction_and_direction},
181 | | ... | or ${1} if not defined.
182 | |
183 | | ... | The return value is used when computing max rate (TPS)
184 | | ... | from packet level (pps or bps) limits.
185 | | ... | For asymmetric transactions, use the more numerous direction.
186 | | ... | Return type: integer.
187 | |
188 | | ... | *Example:*
189 | |
190 | | ... | \| \${pptad} = \| Get Packets Per Transaction And Direction \|
191 | |
192 | | ${pptad} = | Get Variable Value | \${packets_per_transaction_and_direction}
193 | | ... | ${1}
194 | | Return From Keyword | ${pptad}
195
196 | Get Ramp Up Duration
197 | | [Documentation]
198 | | ... | Return value of \${ramp_up_duration},
199 | | ... | or ${0.0} if not defined.
200 | |
201 | | ... | The return value determines the required duration of ramp-up phase.
202 | | ... | Typically used to prepare a specific state on DUT.
203 | | ... | If the value is zero, ramp-up phase is either skipped or size-limited.
204 | | ... | Return type: float.
205 | |
206 | | ... | *Example:*
207 | |
208 | | ... | \| \${ramp_up_duration} = \| Get Ramp Up Duration \|
209 | |
210 | | ${ramp_up_duration} = | Get Variable Value | \${ramp_up_duration} | ${0.0}
211 | | Return From Keyword | ${ramp_up_duration}
212
213 | Get Ramp Up Rate
214 | | [Documentation]
215 | | ... | Return value of \${ramp_up_rate},
216 | | ... | if not defined, return zero.
217 | |
218 | | ... | The return value determines the rate for ramp-up phase.
219 | | ... | Typically used to limit the rate when max rate
220 | | ... | would lose packets in the ramp up phase, thus not setting
221 | | ... | the DUT state correctly.
222 | | ... | If the value is zero, ramp-up phase should be skipped.
223 | | ... | Return type: float.
224 | |
225 | | ... | *Example:*
226 | |
227 | | ... | \| \${ramp_up_rate} = \| Get Ramp Up Rate \|
228 | |
229 | | ${ramp_up_rate} = | Get Variable Value | \${ramp_up_rate} | ${0.0}
230 | | Return From Keyword | ${ramp_up_rate}
231
232 | Get Rate For Teardown
233 | | [Documentation]
234 | | ... | Return value of \${rate_for_teardown},
235 | | ... | if not defined (or zero) return the soft min rate.
236 | |
237 | | ... | The return value determines the rate for teardown trial,
238 | | ... | that is executed if a perf test fails.
239 | | ... | The \${rate_for_teardown} is usually not defined in suite,
240 | | ... | but search keywords set it in places where failure can occur,
241 | | ... | so the trial is done at the rate interesting for the failure.
242 | | ... | Return type: float.
243 | |
244 | | ... | *Example:*
245 | |
246 | | ... | \| \${rate_for_teardown} = \| Get Rate For Teardown \|
247 | |
248 | | ${rate_for_teardown} = | Get Variable Value | \${rate_for_teardown} | ${0.0}
249 | | Return From Keyword If | ${rate_for_teardown} | ${rate_for_teardown}
250 | | Run Keyword And Return | Get Min Rate Soft
251
252 | Get Resetter
253 | | [Documentation]
254 | | ... | Return value of \${resetter} variable,
255 | | ... | or \${None} if not defined.
256 | |
257 | | ... | If not \${None}, the returned value is callable.
258 | | ... | Its use is to reset DUT to initial conditions,
259 | | ... | for example to remove NAT sessions created in the previous trial.
260 | |
261 | | ... | *Example:*
262 | |
263 | | ... | \| \${resetter} = \| Get Resetter \|
264 | |
265 | | ${resetter} = | Get Variable Value | \${resetter} | ${None}
266 | | Return From Keyword | ${resetter}
267
268 | Get Runtime Duration
269 | | [Documentation]
270 | | ... | Return value of \${runtime_duration} variable,
271 | | ... | if not defined return ${1.0}.
272 | |
273 | | ... | The return value controls the duration of runtime trial,
274 | | ... | which also acts as a warmup. Usually one second is enough,
275 | | ... | but some suites need longer time to set up state on DUT.
276 | | ... | Return type: float.
277 | |
278 | | ... | *Example:*
279 | |
280 | | ... | \| \${runtime_duration} = \| Get Runtime Duration \|
281 | |
282 | | ${runtime_duration} = | Get Variable Value | \${runtime_duration} | ${1.0}
283 | | Return From Keyword | ${runtime_duration}
284
285 | Get Runtime Rate
286 | | [Documentation]
287 | | ... | Return value of \${runtime_rate} variable,
288 | | ... | if not defined return the max rate.
289 | |
290 | | ... | The return value controls the rate (TPS unidir) of runtime trial,
291 | | ... | which also acts as a warmup. No plans to ever use a different rate,
292 | | ... | but keywords look better if access to such values is uniform.
293 | | ... | Return type: float.
294 | |
295 | | ... | *Example:*
296 | |
297 | | ... | \| \${runtime_rate} = \| Get Runtime Rate \|
298 | |
299 | | ${runtime_rate} = | Get Variable Value | \${runtime_rate} | ${0.0}
300 | | Return From Keyword If | ${runtime_rate} | ${runtime_rate}
301 | | Run Keyword And Return | Get Max Rate
302
303 | Get Traffic Directions
304 | | [Documentation]
305 | | ... | Return value of \${traffic_directions},
306 | | ... | or ${2} if not defined.
307 | |
308 | | ... | The return value used when parsing for measurement results.
309 | | ... | This needs to be known already in profile driver,
310 | | ... | as bidirectional parsing may fail on unidirectional traffic.
311 | | ... | Return type: integer.
312 | |
313 | | ... | *Example:*
314 | |
315 | | ... | \| \${traffic_directions} = \| Get Traffic Directions \|
316 | |
317 | | ${traffic_directions} = | Get Variable Value | \${traffic_directions} | ${2}
318 | | Return From Keyword | ${traffic_directions}
319
320 | Get Transaction Duration
321 | | [Documentation]
322 | | ... | Return value of \${transaction_duration} variable,
323 | | ... | or \${0.0} if not defined.
324 | |
325 | | ... | The return value is the expected duration of single (ASTF) transaction
326 | | ... | if it is not negligible for overall trial duration computation.
327 | | ... | Most tests use very short transactions (without explicit delays),
328 | | ... | so the zero default works (and suite saves one line
329 | | ... | of Variables table).
330 | | ... | Return type: float.
331 | |
332 | | ... | *Example:*
333 | |
334 | | ... | \| \${transaction_duration} = \| Get Transaction Duration \|
335 | |
336 | | ${transaction_duration} = | Get Variable Value | \${transaction_duration}
337 | | ... | ${0.0}
338 | | Return From Keyword | ${transaction_duration}
339
340 | Get Transaction Scale
341 | | [Documentation]
342 | | ... | Return value of \${transaction_scale} variable,
343 | | ... | or \${0} if not defined.
344 | |
345 | | ... | Zero return value means the number of transactions is not limited,
346 | | ... | which is true for most STL TRex profiles (transaction is a packet).
347 | | ... | Nonzero return value means the number of transactions is fixed,
348 | | ... | for example in stateful NAT scale tests.
349 | | ... | Return type: integer.
350 | |
351 | | ... | *Example:*
352 | |
353 | | ... | \| \${transaction_scale} = \| Get Transaction Scale \|
354 | |
355 | | ${transaction_scale} = | Get Variable Value | \${transaction_scale} | ${0}
356 | | Return From Keyword | ${transaction_scale}
357
358 | Get Transaction Type
359 | | [Documentation]
360 | | ... | Return value of \${transaction_type} variable,
361 | | ... | or "packet" if not defined.
362 | |
363 | | ... | The return value describes the type of transaction
364 | | ... | the test is executed. For example "packet" means a transaction
365 | | ... | is just a single packet. For more sophisticated transactions,
366 | | ... | the logic to determine the number of passed transactions
367 | | ... | is different from merely counting the packets received from DUT.
368 | | ... | Return type: string.
369 | |
370 | | ... | *Example:*
371 | |
372 | | ... | \| \${transaction_type} = \| Get Transaction Type \|
373 | |
374 | | ${transaction_type} = | Get Variable Value | \${transaction_type} | packet
375 | | Return From Keyword | ${transaction_type}
376
377 | Get Use Latency
378 | | [Documentation]
379 | | ... | Return value of \${use_latency} variable,
380 | | ... | if not defined return the value from Constants.
381 | |
382 | | ... | The return value controls whether latency streams are active
383 | | ... | during the main search.
384 | | ... | Return type: bool.
385 | |
386 | | ... | *Example:*
387 | |
388 | | ... | \| \${use_latency} = \| Get Use Latency \|
389 | |
390 | | ${use_latency} = | Get Variable Value | ${use_latency} | ${PERF_USE_LATENCY}
391 | | Return From Keyword | ${use_latency}
392
393 | Set Jumbo
394 | | [Documentation]
395 | | ... | Call Set Numeric Frame Sizes and set jumbo based on max framesize.
396 | | ... | To streamline suite autogeneration, both input and output values
397 | | ... | are communicated as test (or broader scope) variables,
398 | | ... | instead of explicit arguments and return values.
399 | |
400 | | ... | *Test (or broader scope) variables read:*
401 | | ... | - overhead - Overhead in bytes; default value: 0. Type: integer
402 | | ... | - frame_size - Framesize. Type: integer or string
403 | |
404 | | ... | *Test variables set:*
405 | | ... | - jumbo - Jumbo boolean, true if jumbo packet support has to be
406 | | ... | enabled. Type: boolean
407 | |
408 | | ... | *Example:*
409 | |
410 | | ... | \| Set Jumbo \|
411 | |
412 | | # Some suites (e.g. device) are not calling Set Max Rate And Jumbo.
413 | | Set Numeric Frame Sizes
414 | | ${jumbo} = | Evaluate | ${max_frame_size} >= 1522
415 | | Set Test Variable | \${jumbo}
416
417 | Set Max Rate And Jumbo
418 | | [Documentation]
419 | | ... | This keyword computes maximal unidirectional transmit rate
420 | | ... | and jumbo boolean (some suites need that for configuration decisions).
421 | | ... | To streamline suite autogeneration, both input and output values
422 | | ... | are communicated as test (or broader scope) variables,
423 | | ... | instead of explicit arguments and return values.
424 | |
425 | | ... | For correctly applying bandwidth limit, average frame size is used,
426 | | ... | see Set Numeric Frame Sizes keyword documentation for details.
427 | |
428 | | ... | If this keyword detects the test is interested in (unidirectional)
429 | | ... | transactons per second maximal rate (tps), that is returned (not pps).
430 | |
431 | | ... | *Test (or broader scope) variables read:*
432 | | ... | - nic_name - Name of bottleneck NIC. Type: string
433 | | ... | - overhead - Overhead in bytes; default value: 0. Type: integer
434 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
435 | | ... | string
436 | | ... | - ASTF_N_DATA_FRAMES - Number of data frames per transaction
437 | | ... | and direction. Type: integer
438 | | ... | - packets_per_transaction_and_direction - May be unset.
439 | | ... | See Get Packets Per Transaction And Direction keyword. Type: integer
440 | | ... | - packets_per_transaction_aggregated - May be unset.
441 | | ... | See Get Packets Per Transaction Aggregated keyword. Type: integer
442 | | ... | - TEST_TAGS - Robot tags of this test. Type: list of string
443 | |
444 | | ... | *Test variables set:*
445 | | ... | - max_rate - Calculated unidirectional maximal transmit rate [pps].
446 | | ... | This never exceeds bandwidth on TG-DUT nor DUT-DUT links.
447 | | ... | Type: float
448 | | ... | - jumbo - Jumbo boolean, true if jumbo packet support has to be
449 | | ... | enabled. Type: boolean
450 | | ... | - max_frame_size - Maximal frame size including overhead. Type: float
451 | | ... | - avg_directional_frame_size - Average frame size including overhead
452 | | ... | for the more loaded direction. Type: float
453 | | ... | - avg_aggregated_frame_size - Average frame size including overhead
454 | | ... | across both traffic directions. Type: float
455 | |
456 | | ... | *Example:*
457 | |
458 | | ... | \| Set Max Rate And Jumbo \|
459 | |
460 | | # TODO: Re-check overhead values in suites with both traffics encapsulated.
461 | | # TODO: Improve layered setup to detect encap/decap and update overhead.
462 | | ${pps_limit} = | Get From Dictionary
463 | | ... | ${NIC_NAME_TO_PPS_LIMIT} | ${nic_name}
464 | | ${bps_limit} = | Get From Dictionary
465 | | ... | ${NIC_NAME_TO_BPS_LIMIT} | ${nic_name}
466 | | # Set Jumbo also calls Set Numeric Frame Sizes.
467 | | Set Jumbo
468 | | # We need to add 20B (Ethernet preamble and inter-frame gap).
469 | | ${adfs} = | Get Variable Value | \${avg_directional_frame_size}
470 | | ${rate} = | Evaluate | ${bps_limit} / ((${adfs} + 20.0) * 8)
471 | | ${max_rate} = | Set Variable If | ${rate} > ${pps_limit}
472 | | ... | ${pps_limit} | ${rate}
473 | | ${pptad} = | Get Packets Per Transaction And Direction
474 | | ${max_rate} = | Evaluate | ${max_rate} / ${pptad}
475 | | Set Test Variable | \${max_rate}
476
477 | Set Numeric Frame Sizes
478 | | [Documentation]
479 | | ... | Framesize can be either integer in case of a single packet
480 | | ... | in stream, or set of packets in case of IMIX type or simmilar.
481 | | ... | For jumbo decisions, we need a numeric size of the biggest packet.
482 | | ... | For bandwidth limit decisions, we need a numeric average packet size
483 | | ... | in the more bit intensive direction if traffic is non-symmetric.
484 | | ... | Computation of max_rate assumes it is also the more pps direction
485 | | ... | (so it can have smaller average frame size than the aggregated one).
486 | | ... | Average (across both directions) frame size is also used
487 | | ... | for displaying the bidirectional bandwidth forwarded.
488 | | ... | This keyword computes all three values (accounting for overheads)
489 | | ... | and sets them as test variables.
490 | |
491 | | ... | Each suite sets a value named \${overhead},
492 | | ... | which describes by how many bytes the frames on DUT-DUT link
493 | | ... | are larger (due to encapsulation) than those
494 | | ... | on the primary TG-DUT link. For some suites that value
495 | | ... | can be negaive (if TG-DUT is encapsulated more heavily).
496 | | ... | For calculations in this keyword, we need largest sizes
497 | | ... | across links, so zero is used if \${overhead} is negative.
498 | |
499 | | ... | The other overhead is from TCP control packets (only IPv4 supported).
500 | | ... | TCP_CPS tests have SYN frames of length 78B and other frames 70B.
501 | | ... | The more loaded is client-to-server direction with 1 SYN and 3 other,
502 | | ... | across both directions it is 2 SYN and 5 other.
503 | | ... | TCP_PPS and TCP_TPUT tests have one other control packet less
504 | | ... | (in the less loaded direction), but they do contain data frames.
505 | |
506 | | ... | *Test variables read:*
507 | | ... | - frame_size - Framesize. Type: integer or string
508 | | ... | - overhead - Overhead in bytes; default value: ${0}. Type: integer
509 | | ... | - ASTF_N_DATA_FRAMES - Number of data frames per transaction
510 | | ... | and direction. Type: integer
511 | | ... | - packets_per_transaction_and_direction - May be unset.
512 | | ... | See Get Packets Per Transaction And Direction keyword. Type: integer
513 | | ... | - packets_per_transaction_aggregated - May be unset.
514 | | ... | See Get Packets Per Transaction Aggregated keyword. Type: integer
515 | | ... | - TEST_TAGS - Robot tags of this test. Type: list of string
516 | |
517 | | ... | *Test variables set*
518 | | ... | - max_frame_size - Maximal frame size including overhead. Type: float
519 | | ... | - avg_directional_frame_size - Average frame size including overhead
520 | | ... | for the more loaded direction. Type: float
521 | | ... | - avg_aggregated_frame_size - Average frame size including overhead
522 | | ... | across both traffic directions. Type: float
523 | |
524 | | ... | *Example:*
525 | |
526 | | ... | \| Set Numeric Frame Sizes \|
527 | |
528 | | ${bare_max_frame_size} = | Run Keyword If
529 | | ... | '${frame_size}' == 'IMIX_v4_1' | Set Variable | ${1518.0}
530 | | ... | ELSE | Convert To Number | ${frame_size}
531 | | ${bafs} = | Run Keyword If
532 | | ... | '${frame_size}' == 'IMIX_v4_1' | Set Variable | ${353.8333333333333}
533 | | ... | ELSE | Convert To Number | ${frame_size}
534 | | # Long boolean formula in 2 lines.
535 | | ${is_tcp_pps} = | Evaluate | 'TCP_PPS' in ${TEST_TAGS}
536 | | ${is_tcp_tput} = | Evaluate | ${is_tcp_pps} or 'TCP_TPUT' in ${TEST_TAGS}
537 | | ${avg_dir_frame_size} | ${avg_agg_frame_size} = | Run Keyword If
538 | | ... | 'TCP_CPS' in ${TEST_TAGS} | Apply Tcp Cps Proto Overhead | ${bafs}
539 | | ... | ELSE IF | ${is_tcp_tput} | Apply Tcp Tput Proto Overhead | ${bafs}
540 | | ... | ELSE | Set Variable | ${bafs} | ${bafs}
541 | | ${max_overhead} = | Set Variable If | ${overhead} >= 0 | ${overhead} | ${0}
542 | | ${mfs} = | Evaluate | ${bare_max_frame_size} + ${max_overhead}
543 | | ${adfs} = | Evaluate | ${avg_dir_frame_size} + ${max_overhead}
544 | | ${aafs} = | Evaluate | ${avg_agg_frame_size} + ${max_overhead}
545 | | Set Test Variable | \${max_frame_size} | ${mfs}
546 | | Set Test Variable | \${avg_directional_frame_size} | ${adfs}
547 | | Set Test Variable | \${avg_aggregated_frame_size} | ${aafs}
548
549 | Apply Tcp Cps Proto Overhead
550 | | [Documentation]
551 | | ... | Recompute average frame size for TCP CPS test cases.
552 | |
553 | | ... | This is contitionally called from Set Numeric Frame Sizes.
554 | | ... | In Robot Framework it is more convenient to wrap such a block
555 | | ... | as a standalone keyword to Run Keyword If.
556 | |
557 | | ... | *Test variables read:*
558 | | ... | - ASTF_N_DATA_FRAMES - Number of data frames per transaction
559 | | ... | and direction. Usually set globally. Type: integer
560 | | ... | - packets_per_transaction_and_direction - May be unset.
561 | | ... | See Get Packets Per Transaction And Direction keyword. Type: integer
562 | | ... | - packets_per_transaction_aggregated - May be unset.
563 | | ... | See Get Packets Per Transaction Aggregated keyword. Type: integer
564 | |
565 | | ... | *Arguments:*
566 | | ... | - bare_avg_frame_size - Average numeric framesize without overheads.
567 | |
568 | | ... | *Returns:*
569 | | ... | - avg_dir_frame_size - Average framesize for more loaded direction.
570 | | ... | - avg_agg_frame_size - Average framesize across both directions.
571 | |
572 | | ... | *Example:*
573 | |
574 | | ... | \| \${adfs} \| \${aafs} = \| Apply Tcp Cps Proto Overhead \| \${bafs}
575 | |
576 | | [Arguments] | ${bare_avg_frame_size}
577 | |
578 | | # Increase max_frame_size for TCP tests if used for more than just jumbo.
579 | | Run Keyword If | ${bare_avg_frame_size} != 64
580 | | ... | Fail | TCP_CPS tests are only supported for (nominal) 64B frames.
581 | | # TODO: Unify with packets_per_transaction_* variables when adding PCAP.
582 | | ${pptad} = | Get Packets Per Transaction And Direction
583 | | ${ppta} = | Get Packets Per Transaction Aggregated
584 | | ${avg_dir_frame_size} = | Evaluate | (78.0 * 1 + 70.0 * 3) / (1 + 3)
585 | | Run Keyword If | '${pptad}' != '4'
586 | | ... | Fail | TCP CPS with pptad '${pptad}' != '4'.
587 | | ${avg_agg_frame_size} = | Evaluate | (78.0 * 2 + 70.0 * 5) / (2 + 5)
588 | | Run Keyword If | '${ppta}' != '7'
589 | | ... | Fail | TCP CPS with ppta '${ppta}' != '7'.
590 | | Return From Keyword | ${avg_dir_frame_size} | ${avg_agg_frame_size}
591
592 | Apply Tcp Tput Proto Overhead
593 | | [Documentation]
594 | | ... | Recompute average frame size for TCP TPUT (or PPS) test cases.
595 | |
596 | | ... | This is contitionally called from Set Numeric Frame Sizes.
597 | | ... | In Robot Framework it is more convenient to wrap such a block
598 | | ... | as a standalone keyword to Run Keyword If.
599 | |
600 | | ... | *Test variables read:*
601 | | ... | - ASTF_N_DATA_FRAMES - Number of data frames per transaction
602 | | ... | and direction. Usually set globally. Type: integer
603 | | ... | - packets_per_transaction_and_direction - May be unset.
604 | | ... | See Get Packets Per Transaction And Direction keyword. Type: integer
605 | | ... | - packets_per_transaction_aggregated - May be unset.
606 | | ... | See Get Packets Per Transaction Aggregated keyword. Type: integer
607 | |
608 | | ... | *Arguments:*
609 | | ... | - bare_framesize - Average numeric framesize without overheads.
610 | |
611 | | ... | *Returns:*
612 | | ... | - avg_dir_frame_size - Average framesize for more loaded direction.
613 | | ... | - avg_agg_frame_size - Average framesize across both directions.
614 | |
615 | | ... | *Example:*
616 | |
617 | | ... | \| \${adfs} \| \${aafs} = \| Apply Tcp Cps Proto Overhead \| \${bafs}
618 | |
619 | | [Arguments] | ${bare_framesize}
620 | |
621 | | # TODO: Unify with packets_per_transaction_* variables when adding PCAP.
622 | | ${pptad} = | Get Packets Per Transaction And Direction
623 | | ${ppta} = | Get Packets Per Transaction Aggregated
624 | | # Long float formula in 4 lines.
625 | | ${numerator} = | Evaluate | ${bare_framesize} * ${ASTF_N_DATA_FRAMES}
626 | | ${numerator} = | Evaluate | 78.0 * 1 + 70.0 * 3 + ${numerator}
627 | | ${denominator} = | Evaluate | 1 + 3 + ${ASTF_N_DATA_FRAMES}
628 | | ${avg_dir_frame_size} = | Evaluate | ${numerator} / ${denominator}
629 | | Run Keyword If | '${pptad}' != '${denominator}'
630 | | ... | Fail | TCP TPUT with pptad '${pptad}' != '${denominator}'.
631 | | # Long float formula in 4 lines.
632 | | ${numerator} = | Evaluate | ${bare_framesize} * 2 * ${ASTF_N_DATA_FRAMES}
633 | | ${numerator} = | Evaluate | 78.0 * 2 + 70.0 * 4 + ${numerator}
634 | | ${denominator} = | Evaluate | 2 + 4 + 2 * ${ASTF_N_DATA_FRAMES}
635 | | ${avg_agg_frame_size} = | Evaluate | ${numerator} / ${denominator}
636 | | Run Keyword If | '${ppta}' != '${denominator}'
637 | | ... | Fail | TCP TPUT with ppta '${ppta}' != '${denominator}'.
638 | | Return From Keyword | ${avg_dir_frame_size} | ${avg_agg_frame_size}
639
640 | Set Rates For Policer
641 | | [Documentation]
642 | | ... | Policer tests need these values,
643 | | ... | currently computed from \${avg_directional_frame_size}.
644 | | ... | TODO: Verify the units match and computation is correct.
645 | |
646 | | ... | *Test (or broader scope) variables read:*
647 | | ... | - avg_directional_frame_size - Average L2 Frame Size [B]. Type: float
648 | | ... | Set by Set Max Rate And Jumbo keyword.
649 | |
650 | | ... | *Test variables set:*
651 | | ... | - eb - Excess burst rate for policer. Type: float
652 | | ... | - cb - Committed burst rate for policer. Type: float
653 | |
654 | | ... | *Example:*
655 | |
656 | | ... | \| Set Rates For Policer \|
657 | |
658 | | Set Test Variable | \${eb} | ${avg_directional_frame_size}
659 | | Set Test Variable | \${cb} | ${avg_directional_frame_size}