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:
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
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
21 | ${extended_debug}= | ${EXTENDED_DEBUG}
26 | | ... | If Get Use Latency returns true, return false.
27 | | ... | Otherwise return value of \${disable_latency} variable,
28 | | ... | or \${False} if not defined.
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.
37 | | ... | \| \${disable_latency} = \| Get Disable Latency \|
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}
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.
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.
57 | | ... | \| \${max_rate} = \| Get Max Rate \|
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.
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.
74 | | ... | \| \${min_rate_hard} = \| Get Min Rate Hard \|
76 | | Return From Keyword | ${9001.0}
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.
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.
88 | | ... | The value is also usable for minimal TPS value for ASTF tests.
89 | | ... | Return type: float.
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.
96 | | ... | \| \${min_rate_soft} = \| Get Min Rate Soft \|
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}
103 | Get Mrr Trial Duration
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.
110 | | ... | The return value controls the duration of main trial measurement
111 | | ... | for MRR type tests.
112 | | ... | Return type: float.
116 | | ... | \| \${mrr_trial_duration} = \| Get Mrr Trial Duration \|
118 | | Return From Keyword | ${PERF_TRIAL_DURATION}
120 | Get Mrr Trial Multiplicity
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.
127 | | ... | The return value controls the number of main trial measurement
128 | | ... | for (B)MRR type tests.
129 | | ... | Return type: integer.
133 | | ... | \| \${mrr_trial_multiplicity} = \| Get Mrr Trial Multiplicity \|
135 | | Return From Keyword | ${PERF_TRIAL_MULTIPLICITY}
137 | Get Packet Loss Ratio
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.
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.
151 | | ... | \| \${packet_loss_ratio} = \| Get Packet Loss Ratio \|
153 | | Return From Keyword | ${0.005}
155 | Get Packets Per Transaction Aggregated
157 | | ... | Return value of \${packets_per_transaction_aggregated};
158 | | ... | if not defined, assume traffic is symmetric (or unidirectional)
159 | | ... | and compute from unidirectional values.
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.
167 | | ... | \| \${ppta} = \| Get Packets Per Transaction Aggregated \|
169 | | ${ppta} = | Get Variable Value | \${packets_per_transaction_aggregated}
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}
178 | Get Packets Per Transaction And Direction
180 | | ... | Return value of \${packets_per_transaction_and_direction},
181 | | ... | or ${1} if not defined.
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.
190 | | ... | \| \${pptad} = \| Get Packets Per Transaction And Direction \|
192 | | ${pptad} = | Get Variable Value | \${packets_per_transaction_and_direction}
194 | | Return From Keyword | ${pptad}
196 | Get Ramp Up Duration
198 | | ... | Return value of \${ramp_up_duration},
199 | | ... | or ${0.0} if not defined.
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.
208 | | ... | \| \${ramp_up_duration} = \| Get Ramp Up Duration \|
210 | | ${ramp_up_duration} = | Get Variable Value | \${ramp_up_duration} | ${0.0}
211 | | Return From Keyword | ${ramp_up_duration}
215 | | ... | Return value of \${ramp_up_rate},
216 | | ... | if not defined, return zero.
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.
227 | | ... | \| \${ramp_up_rate} = \| Get Ramp Up Rate \|
229 | | ${ramp_up_rate} = | Get Variable Value | \${ramp_up_rate} | ${0.0}
230 | | Return From Keyword | ${ramp_up_rate}
232 | Get Rate For Teardown
234 | | ... | Return value of \${rate_for_teardown},
235 | | ... | if not defined (or zero) return the soft min rate.
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.
246 | | ... | \| \${rate_for_teardown} = \| Get Rate For Teardown \|
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
254 | | ... | Return value of \${resetter} variable,
255 | | ... | or \${None} if not defined.
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.
263 | | ... | \| \${resetter} = \| Get Resetter \|
265 | | ${resetter} = | Get Variable Value | \${resetter} | ${None}
266 | | Return From Keyword | ${resetter}
268 | Get Runtime Duration
270 | | ... | Return value of \${runtime_duration} variable,
271 | | ... | if not defined return ${1.0}.
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.
280 | | ... | \| \${runtime_duration} = \| Get Runtime Duration \|
282 | | ${runtime_duration} = | Get Variable Value | \${runtime_duration} | ${1.0}
283 | | Return From Keyword | ${runtime_duration}
287 | | ... | Return value of \${runtime_rate} variable,
288 | | ... | if not defined return the max rate.
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.
297 | | ... | \| \${runtime_rate} = \| Get Runtime Rate \|
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
303 | Get Traffic Directions
305 | | ... | Return value of \${traffic_directions},
306 | | ... | or ${2} if not defined.
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.
315 | | ... | \| \${traffic_directions} = \| Get Traffic Directions \|
317 | | ${traffic_directions} = | Get Variable Value | \${traffic_directions} | ${2}
318 | | Return From Keyword | ${traffic_directions}
320 | Get Transaction Duration
322 | | ... | Return value of \${transaction_duration} variable,
323 | | ... | or \${0.0} if not defined.
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.
334 | | ... | \| \${transaction_duration} = \| Get Transaction Duration \|
336 | | ${transaction_duration} = | Get Variable Value | \${transaction_duration}
338 | | Return From Keyword | ${transaction_duration}
340 | Get Transaction Scale
342 | | ... | Return value of \${transaction_scale} variable,
343 | | ... | or \${0} if not defined.
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.
353 | | ... | \| \${transaction_scale} = \| Get Transaction Scale \|
355 | | ${transaction_scale} = | Get Variable Value | \${transaction_scale} | ${0}
356 | | Return From Keyword | ${transaction_scale}
358 | Get Transaction Type
360 | | ... | Return value of \${transaction_type} variable,
361 | | ... | or "packet" if not defined.
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.
372 | | ... | \| \${transaction_type} = \| Get Transaction Type \|
374 | | ${transaction_type} = | Get Variable Value | \${transaction_type} | packet
375 | | Return From Keyword | ${transaction_type}
379 | | ... | Return value of \${use_latency} variable,
380 | | ... | if not defined return the value from Constants.
382 | | ... | The return value controls whether latency streams are active
383 | | ... | during the main search.
384 | | ... | Return type: bool.
388 | | ... | \| \${use_latency} = \| Get Use Latency \|
390 | | ${use_latency} = | Get Variable Value | ${use_latency} | ${PERF_USE_LATENCY}
391 | | Return From Keyword | ${use_latency}
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.
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
404 | | ... | *Test variables set:*
405 | | ... | - jumbo - Jumbo boolean, true if jumbo packet support has to be
406 | | ... | enabled. Type: boolean
410 | | ... | \| Set Jumbo \|
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}
417 | Set Max Rate And Jumbo
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.
425 | | ... | For correctly applying bandwidth limit, average frame size is used,
426 | | ... | see Set Numeric Frame Sizes keyword documentation for details.
428 | | ... | If this keyword detects the test is interested in (unidirectional)
429 | | ... | transactons per second maximal rate (tps), that is returned (not pps).
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
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
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
458 | | ... | \| Set Max Rate And Jumbo \|
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.
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}
477 | Set Numeric Frame Sizes
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.
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.
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.
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
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
526 | | ... | \| Set Numeric Frame Sizes \|
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}
549 | Apply Tcp Cps Proto Overhead
551 | | ... | Recompute average frame size for TCP CPS test cases.
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.
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
565 | | ... | *Arguments:*
566 | | ... | - bare_avg_frame_size - Average numeric framesize without overheads.
569 | | ... | - avg_dir_frame_size - Average framesize for more loaded direction.
570 | | ... | - avg_agg_frame_size - Average framesize across both directions.
574 | | ... | \| \${adfs} \| \${aafs} = \| Apply Tcp Cps Proto Overhead \| \${bafs}
576 | | [Arguments] | ${bare_avg_frame_size}
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}
592 | Apply Tcp Tput Proto Overhead
594 | | ... | Recompute average frame size for TCP TPUT (or PPS) test cases.
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.
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
608 | | ... | *Arguments:*
609 | | ... | - bare_framesize - Average numeric framesize without overheads.
612 | | ... | - avg_dir_frame_size - Average framesize for more loaded direction.
613 | | ... | - avg_agg_frame_size - Average framesize across both directions.
617 | | ... | \| \${adfs} \| \${aafs} = \| Apply Tcp Cps Proto Overhead \| \${bafs}
619 | | [Arguments] | ${bare_framesize}
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}
640 | Set Rates For Policer
642 | | ... | Policer tests need these values,
643 | | ... | currently computed from \${avg_directional_frame_size}.
644 | | ... | TODO: Verify the units match and computation is correct.
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.
650 | | ... | *Test variables set:*
651 | | ... | - eb - Excess burst rate for policer. Type: float
652 | | ... | - cb - Committed burst rate for policer. Type: float
656 | | ... | \| Set Rates For Policer \|
658 | | Set Test Variable | \${eb} | ${avg_directional_frame_size}
659 | | Set Test Variable | \${cb} | ${avg_directional_frame_size}