1 # Copyright (c) 2020 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 NIC and TG limits.
16 | Library | Collections
17 | Variables | ${CURDIR}/../../python/Constants.py
20 | Get Average Frame Size
22 | | ... | Framesize can be either integer in case of a single packet
23 | | ... | in stream, or set of packets in case of IMIX type or simmilar.
25 | | ... | *Arguments:*
26 | | ... | - frame_size - Framesize. Type: integer or string
27 | | ... | - overhead - Overhead in bytes; default value: ${0}. Type: integer
30 | | ... | Average frame size including overhead. Type: float
34 | | ... | \| Get Average Frame Size \| IMIX_v4_1 \|
36 | | [Arguments] | ${frame_size} | ${overhead}=${0}
38 | | ${frame_size} = | Run Keyword If | '${frame_size}' == 'IMIX_v4_1'
39 | | ... | Set Variable | ${353.83333}
41 | | ... | Convert To Number | ${frame_size}
42 | | ${avg_frame_size} = | Evaluate | ${frame_size} + ${overhead}
43 | | Return From Keyword | ${avg_frame_size}
45 | Get Maximum Frame Size
47 | | ... | Framesize can be either integer in case of a single packet
48 | | ... | in stream, or set of packets in case of IMIX type or simmilar.
50 | | ... | *Arguments:*
51 | | ... | - frame_size - Framesize. Type: integer or string
52 | | ... | - overhead - Overhead in bytes; default value: ${0}. Type: integer
55 | | ... | Maximum frame size including overhead. Type: float
59 | | ... | \| Get Maximum Frame Size \| IMIX_v4_1 \|
61 | | [Arguments] | ${frame_size} | ${overhead}=${0}
63 | | ${frame_size} = | Run Keyword If | '${frame_size}' == 'IMIX_v4_1'
64 | | ... | Set Variable | ${1518}
66 | | ... | Convert To Number | ${frame_size}
67 | | ${max_frame_size} = | Evaluate | ${frame_size} + ${overhead}
68 | | Return From Keyword | ${max_frame_size}
70 | Set Max Rate And Jumbo
72 | | ... | Input framesize can be either integer in case of a single packet
73 | | ... | in stream, or IMIX string defining mix of packets.
74 | | ... | For jumbo frames detection, the maximal packet size is relevant.
75 | | ... | For maximal transmit rate, the average packet size is relevant.
76 | | ... | In both cases, encapsulation overhead (if any) has effect.
77 | | ... | The maximal rate is computed from NIC name.
78 | | ... | The implementation works by mapping from exact
79 | | ... | whitelisted NIC names.
80 | | ... | The mapping is hardcoded in nic_limits.yaml
81 | | ... | TODO: Make the mapping from NIC names case insensistive.
83 | | ... | TODO: Make pps limit also definable per NIC.
85 | | ... | This keyword computes maximal unidirectional transmit rate
86 | | ... | and jumbo boolean (some suites need that for configuration decisions).
87 | | ... | To streamline suite autogeneration, both input and output values
88 | | ... | are communicated as test (or broader scope) variables,
89 | | ... | instead of explicit arguments and return values.
91 | | ... | *Test (or broader scope) variables read:*
92 | | ... | - nic_name - Name of bottleneck NIC. Type: string
93 | | ... | - overhead - Overhead in bytes; default value: 0. Type: integer
94 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
97 | | ... | *Test variables set:*
98 | | ... | - max_rate - Calculated unidirectional maximal transmit rate [pps].
100 | | ... | - jumbo - Jumbo boolean, true if jumbo packet support has to be
101 | | ... | enabled. Type: boolean
105 | | ... | \| Set Test Variable \| \${frame_size} \| IMIX_v4_1 \|
106 | | ... | \| Set Max Rate And Jumbo \|
108 | | # Negative overhead is possible, if DUT-DUT traffic is less encapsulated
109 | | # than TG-DUT traffic.
110 | | # TODO: Re-check overhead values in suites with both traffics encapsulated.
111 | | # TODO: Improve layered setup to detect encap/decap and update overhead.
112 | | ${overhead} = | Set Variable If | ${overhead} >= 0 | ${overhead} | ${0}
113 | | ${pps_limit} = | Get From Dictionary
114 | | ... | ${NIC_NAME_TO_PPS_LIMIT} | ${nic_name}
115 | | ${bps_limit} = | Get From Dictionary
116 | | ... | ${NIC_NAME_TO_BPS_LIMIT} | ${nic_name}
117 | | # swo := size_with_overhead
118 | | ${avg_swo} = | Get Average Frame Size | ${frame_size} | ${overhead}
119 | | ${rate} = | Evaluate | ${bps_limit} / ((${avg_swo} + 20.0) * 8)
120 | | ${max_rate} = | Set Variable If | ${rate} > ${pps_limit}
121 | | ... | ${pps_limit} | ${rate}
122 | | Set Test Variable | \${max_rate}
127 | | ... | For jumbo frames detection, the maximal packet size is relevant,
128 | | ... | encapsulation overhead (if any) has effect.
130 | | ... | This keyword computes jumbo boolean (some suites need that for
131 | | ... | configuration decisions).
132 | | ... | To streamline suite autogeneration, both input and output values
133 | | ... | are communicated as test (or broader scope) variables,
134 | | ... | instead of explicit arguments and return values.
136 | | ... | *Test (or broader scope) variables read:*
137 | | ... | - overhead - Overhead in bytes; default value: 0. Type: integer
138 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
141 | | ... | *Test variables set:*
142 | | ... | - jumbo - Jumbo boolean, true if jumbo packet support has to be
143 | | ... | enabled. Type: boolean
147 | | ... | \| Set Jumnbo \|
149 | | ${overhead} = | Set Variable If | ${overhead} >= 0 | ${overhead} | ${0}
150 | | ${max_swo} = | Get Maximum Frame Size | ${frame_size} | ${overhead}
151 | | ${jumbo} = | Set Variable If | ${max_swo} < 1522
152 | | ... | ${False} | ${True}
153 | | Set Test Variable | \${jumbo}