+| | ${mfs} = | Evaluate | ${bare_max_frame_size} + ${max_overhead}
+| | ${adfs} = | Evaluate | ${avg_dir_frame_size} + ${max_overhead}
+| | ${aafs} = | Evaluate | ${avg_agg_frame_size} + ${max_overhead}
+| | Set Test Variable | \${max_frame_size} | ${mfs}
+| | Set Test Variable | \${avg_directional_frame_size} | ${adfs}
+| | Set Test Variable | \${avg_aggregated_frame_size} | ${aafs}
+
+| Apply Tcp Cps Proto Overhead
+| | [Documentation]
+| | ... | Recompute average frame size for TCP CPS test cases.
+| |
+| | ... | This is contitionally called from Set Numeric Frame Sizes.
+| | ... | In Robot Framework it is more convenient to wrap such a block
+| | ... | as a standalone keyword to Run Keyword If.
+| |
+| | ... | *Test variables read:*
+| | ... | - ASTF_N_DATA_FRAMES - Number of data frames per transaction
+| | ... | and direction. Usually set globally. Type: integer
+| | ... | - packets_per_transaction_and_direction - May be unset.
+| | ... | See Get Packets Per Transaction And Direction keyword. Type: integer
+| | ... | - packets_per_transaction_aggregated - May be unset.
+| | ... | See Get Packets Per Transaction Aggregated keyword. Type: integer
+| |
+| | ... | *Arguments:*
+| | ... | - bare_avg_frame_size - Average numeric framesize without overheads.
+| |
+| | ... | *Returns:*
+| | ... | - avg_dir_frame_size - Average framesize for more loaded direction.
+| | ... | - avg_agg_frame_size - Average framesize across both directions.
+| |
+| | ... | *Example:*
+| |
+| | ... | \| \${adfs} \| \${aafs} = \| Apply Tcp Cps Proto Overhead \| \${bafs}
+| |
+| | [Arguments] | ${bare_avg_frame_size}
+| |
+| | # Increase max_frame_size for TCP tests if used for more than just jumbo.
+| | Run Keyword If | ${bare_avg_frame_size} != 64
+| | ... | Fail | TCP_CPS tests are only supported for (nominal) 64B frames.
+| | # TODO: Unify with packets_per_transaction_* variables when adding PCAP.
+| | ${pptad} = | Get Packets Per Transaction And Direction
+| | ${ppta} = | Get Packets Per Transaction Aggregated
+| | ${avg_dir_frame_size} = | Evaluate | (78.0 * 1 + 70.0 * 3) / (1 + 3)
+| | Run Keyword If | '${pptad}' != '4'
+| | ... | Fail | TCP CPS with pptad '${pptad}' != '4'.
+| | ${avg_agg_frame_size} = | Evaluate | (78.0 * 2 + 70.0 * 5) / (2 + 5)
+| | Run Keyword If | '${ppta}' != '7'
+| | ... | Fail | TCP CPS with ppta '${ppta}' != '7'.
+| | Return From Keyword | ${avg_dir_frame_size} | ${avg_agg_frame_size}
+
+| Apply Tcp Tput Proto Overhead
+| | [Documentation]
+| | ... | Recompute average frame size for TCP TPUT (or PPS) test cases.
+| |
+| | ... | This is contitionally called from Set Numeric Frame Sizes.
+| | ... | In Robot Framework it is more convenient to wrap such a block
+| | ... | as a standalone keyword to Run Keyword If.
+| |
+| | ... | *Test variables read:*
+| | ... | - ASTF_N_DATA_FRAMES - Number of data frames per transaction
+| | ... | and direction. Usually set globally. Type: integer
+| | ... | - packets_per_transaction_and_direction - May be unset.
+| | ... | See Get Packets Per Transaction And Direction keyword. Type: integer
+| | ... | - packets_per_transaction_aggregated - May be unset.
+| | ... | See Get Packets Per Transaction Aggregated keyword. Type: integer
+| |
+| | ... | *Arguments:*
+| | ... | - bare_framesize - Average numeric framesize without overheads.
+| |
+| | ... | *Returns:*
+| | ... | - avg_dir_frame_size - Average framesize for more loaded direction.
+| | ... | - avg_agg_frame_size - Average framesize across both directions.
+| |
+| | ... | *Example:*
+| |
+| | ... | \| \${adfs} \| \${aafs} = \| Apply Tcp Cps Proto Overhead \| \${bafs}
+| |
+| | [Arguments] | ${bare_framesize}
+| |
+| | # TODO: Unify with packets_per_transaction_* variables when adding PCAP.
+| | ${pptad} = | Get Packets Per Transaction And Direction
+| | ${ppta} = | Get Packets Per Transaction Aggregated
+| | # Long float formula in 4 lines.
+| | ${numerator} = | Evaluate | ${bare_framesize} * ${ASTF_N_DATA_FRAMES}
+| | ${numerator} = | Evaluate | 78.0 * 1 + 70.0 * 3 + ${numerator}
+| | ${denominator} = | Evaluate | 1 + 3 + ${ASTF_N_DATA_FRAMES}
+| | ${avg_dir_frame_size} = | Evaluate | ${numerator} / ${denominator}
+| | Run Keyword If | '${pptad}' != '${denominator}'
+| | ... | Fail | TCP TPUT with pptad '${pptad}' != '${denominator}'.
+| | # Long float formula in 4 lines.
+| | ${numerator} = | Evaluate | ${bare_framesize} * 2 * ${ASTF_N_DATA_FRAMES}
+| | ${numerator} = | Evaluate | 78.0 * 2 + 70.0 * 4 + ${numerator}
+| | ${denominator} = | Evaluate | 2 + 4 + 2 * ${ASTF_N_DATA_FRAMES}
+| | ${avg_agg_frame_size} = | Evaluate | ${numerator} / ${denominator}
+| | Run Keyword If | '${ppta}' != '${denominator}'
+| | ... | Fail | TCP TPUT with ppta '${ppta}' != '${denominator}'.
+| | Return From Keyword | ${avg_dir_frame_size} | ${avg_agg_frame_size}