style(robot): capitalize two keywords properly
[csit.git] / resources / libraries / robot / performance / performance_display.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
16 | ... | Performance suite keywords - Displaying results as test messages.
17 | ... | This includes checks to fail test.
18
19 *** Keywords ***
20 | Check NDRPDR interval validity
21 | | [Documentation]
22 | | ... | Extract loss ratio of lower bound of the interval.
23 | | ... | Fail if it does not reach the allowed value.
24 | |
25 | | ... | *Arguments:*
26 | | ... | - interval - Measured interval. Type: ReceiveRateInterval
27 | | ... | - packet_loss_ratio - Accepted loss (0.0 for NDR). Type: float
28 | |
29 | | ... | *Example:*
30 | |
31 | | ... | \| Check NDRPDR interval validity \| \${result.pdr_interval} \
32 | | ... | \| \${0.005} \|
33 | |
34 | | [Arguments] | ${interval} | ${packet_loss_ratio}=${0.0}
35 | |
36 | | ${lower_bound} = | Set Variable | ${interval.measured_low}
37 | | ${lower_bound_lr} = | Set Variable | ${lower_bound.loss_ratio}
38 | | Return From Keyword If | ${lower_bound_lr} <= ${packet_loss_ratio}
39 | | Set Test Variable | \${rate_for_teardown} | ${lower_bound.target_tr}
40 | | ${message}= | Catenate | SEPARATOR=${SPACE}
41 | | ... | Minimal rate loss ratio ${lower_bound_lr}
42 | | ... | does not reach target ${packet_loss_ratio}.
43 | | ${message_zero} = | Set Variable | Zero packets forwarded!
44 | | ${message_other} = | Set Variable | ${lower_bound.loss_count} packets lost.
45 | | ${message} = | Set Variable If | ${lower_bound_lr} >= 1.0
46 | | ... | ${message}${\n}${message_zero} | ${message}${\n}${message_other}
47 | | Fail | ${message}
48
49 | Compute Bandwidth
50 | | [Documentation]
51 | | ... | Compute (bidir) bandwidth from given (unidir) transaction rate.
52 | | ...
53 | | ... | This keyword reads \${ppta} and \${avg_aggregated_frame_size} set
54 | | ... | elsewhere. The implementation should work for both pps and cps rates.
55 | | ... |
56 | | ... | *Arguments:*
57 | | ... | - tps - Transaction rate (unidirectional) [tps]. Type: float
58 | | ...
59 | | ... | *Returns:*
60 | | ... | - Computed bandwidth in Gbps.
61 | | ... | - Computed aggregated packet rate in pps.
62 | |
63 | | ... | *Example:*
64 | |
65 | | ... | |\ \${bandwidth} \| \${pps} = \| Compute Bandwidth \| \${12345.67} \|
66 | |
67 | | [Arguments] | ${tps}
68 | |
69 | | ${ppta} = | Get Packets Per Transaction Aggregated
70 | | ${pps} = | Evaluate | ${tps} * ${ppta}
71 | | ${bandwidth} = | Evaluate | ${pps} * (${avg_aggregated_frame_size}+20)*8/1e9
72 | | Return From Keyword | ${bandwidth} | ${pps}
73
74 | Display Reconfig Test Message
75 | | [Documentation]
76 | | ... | Display the number of packets lost (bidirectionally)
77 | | ... | due to reconfiguration under traffic.
78 | |
79 | | ... | *Arguments:*
80 | | ... | - result - Result of bidirectional measurement.
81 | | ... | Type: ReceiveRateMeasurement
82 | |
83 | | ... | *Example:*
84 | |
85 | | ... | \| Display Reconfig Test Message \| \${result} \|
86 | |
87 | | [Arguments] | ${result}
88 | |
89 | | ${ppta} = | Get Packets Per Transaction Aggregated
90 | | ${packet_rate} = | Evaluate | ${result.target_tr} * ${ppta}
91 | | ${packet_loss} = | Set Variable | ${result.loss_count}
92 | | ${time_loss} = | Evaluate | ${packet_loss} / ${packet_rate}
93 | | Set Test Message | Packets lost due to reconfig: ${packet_loss}
94 | | Set Test Message | ${\n}Implied time lost: ${time_loss} | append=yes
95
96 | Display result of NDRPDR search
97 | | [Documentation]
98 | | ... | Display result of NDR+PDR search, both quantities, both bounds,
99 | | ... | aggregated, in units given by trasaction type, e.g. by default
100 | | ... | in packet per seconds and Gbps total bandwidth
101 | | ... | (for initial packet size).
102 | | ... |
103 | | ... | The bound to display is encoded as target rate, it is assumed
104 | | ... | it is in transactions per second. Bidirectional traffic
105 | | ... | transaction is understood as having 2 packets, for this purpose.
106 | | ... |
107 | | ... | Througput is calculated as:
108 | | ... | Sum of measured rate over streams
109 | | ... | Bandwidth is calculated as:
110 | | ... | (Throughput * (L2 Frame Size + IPG) * 8)
111 | | ... | If the results contain latency data, display them for lower bounds.
112 | |
113 | | ... | *Test (or broader scope) variables read:*
114 | | ... | - frame_size_num - L2 Frame Size [B]. Type: integer or float
115 | | ... | - transaction_type - String identifier to determine how to count
116 | | ... | transactions. Default is "packet".
117 | | ... | *Arguments:*
118 | | ... | - result - Measured result data. Aggregated rate, tps or pps.
119 | | ... | Type: NdrPdrResult
120 | |
121 | | ... | *Example:*
122 | |
123 | | ... | \| Display result of NDRPDR search \| \${result} \|
124 | |
125 | | [Arguments] | ${result}
126 | |
127 | | Display single bound | NDR_LOWER
128 | | ... | ${result[0].measured_low.target_tr}
129 | | ... | ${result[0].measured_low.latency}
130 | | Display single bound | NDR_UPPER
131 | | ... | ${result[0].measured_high.target_tr}
132 | | Display single bound | PDR_LOWER
133 | | ... | ${result[1].measured_low.target_tr}
134 | | ... | ${result[1].measured_low.latency}
135 | | Display single bound | PDR_UPPER
136 | | ... | ${result[1].measured_high.target_tr}
137
138 | Display result of soak search
139 | | [Documentation]
140 | | ... | Display result of soak search, avg+-stdev, as upper/lower bounds.
141 | | ... | See Display single bound for units used.
142 | |
143 | | ... | *Test (or broader scope) variables read:*
144 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
145 | | ... | string
146 | | ... | - transaction_type - String identifier to determine how to count
147 | | ... | transactions. Default is "packet".
148 | | ... | *Arguments:*
149 | | ... | - avg - Estimated average critical load [pps]. Type: float
150 | | ... | - stdev - Standard deviation of critical load [pps]. Type: float
151 | |
152 | | ... | *Returns:*
153 | | ... | - Lower and upper bound of critical load [pps]. Type: 2-tuple of float
154 | |
155 | | ... | *Example:*
156 | |
157 | | ... | \| Display result of soak search \| \${100000} \| \${100} \|
158 | |
159 | | [Arguments] | ${avg} | ${stdev}
160 | |
161 | | ${avg} = | Convert To Number | ${avg}
162 | | ${stdev} = | Convert To Number | ${stdev}
163 | | ${lower} = | Evaluate | ${avg} - ${stdev}
164 | | ${upper} = | Evaluate | ${avg} + ${stdev}
165 | | Display single bound | PLRsearch lower bound | ${lower}
166 | | Display single bound | PLRsearch upper bound | ${upper}
167 | | Return From Keyword | ${lower} | ${upper}
168
169 | Display single bound
170 | | [Documentation]
171 | | ... | Compute and display one bound of NDR+PDR (or soak) search result.
172 | | ... | If the latency string is present, it is displayed as well.
173 | | ... |
174 | | ... | The bound to display is given as target transfer rate, it is assumed
175 | | ... | it is in transactions per second. Bidirectional traffic
176 | | ... | transaction is understood as having 2 packets, for this purpose.
177 | | ... |
178 | | ... | Pps values are aggregated, in packet per seconds
179 | | ... | and Gbps total bandwidth (for initial packet size).
180 | | ... |
181 | | ... | Througput is calculated as:
182 | | ... | Sum of measured rate over streams
183 | | ... | Bandwidth is calculated as:
184 | | ... | (Throughput * (L2 Frame Size + IPG) * 8)
185 | | ... | If the results contain latency data, display them for lower bounds.
186 | |
187 | | ... | *Test (or broader scope) variables read:*
188 | | ... | - transaction_type - String identifier to determine how to count
189 | | ... | transactions. Default is "packet".
190 | | ... | *Arguments:*
191 | | ... | - text - Flavor text describing which bound is this. Type: string
192 | | ... | - tps - Transaction rate [tps]. Type: float
193 | | ... | - latency - Latency data to display if non-empty. Type: string
194 | |
195 | | ... | *Example:*
196 | |
197 | | ... | \| Display single bound \| NDR lower bound \| \${12345.67} \
198 | | ... | \| latency=\${EMPTY} \|
199 | |
200 | | [Arguments] | ${text} | ${tps} | ${latency}=${EMPTY}
201 | |
202 | | ${transaction_type} = | Get Transaction Type
203 | | Run Keyword And Return If | """_cps""" in """${transaction_type}"""
204 | | ... | Display Single CPS Bound | ${text} | ${tps} | ${latency}
205 | | Display Single PPS Bound | ${text} | ${tps} | ${latency}
206
207 | Display Single CPS Bound
208 | | [Documentation]
209 | | ... | Display one bound of NDR+PDR search for CPS tests.
210 | | ... | The bounds are expressed as transactions per second.
211 | | ... | If the latency string is present, it is displayed as well.
212 | |
213 | | ... | *Arguments:*
214 | | ... | - text - Flavor text describing which bound is this. Type: string
215 | | ... | - tps - Transaction rate [tps]. Type: float
216 | | ... | - latency - Latency data to display if non-empty. Type: string
217 | |
218 | | ... | *Example:*
219 | |
220 | | ... | \| Display Single CPS Bound \| NDR lower bound \| \${12345.67} \
221 | | ... | \| latency=\${EMPTY} \|
222 | |
223 | | [Arguments] | ${text} | ${tps} | ${latency}=${EMPTY}
224 | |
225 | | Set Test Message | ${\n}${text}: ${tps} CPS | append=yes
226 | | ${bandwidth} | ${pps} = | Compute Bandwidth | ${tps}
227 | | Export Search Bound | ${text} | ${tps} | cps | ${bandwidth}
228 | | Return From Keyword If | not """${latency}"""
229 | | Set Test Message | ${\n}LATENCY [min/avg/max/hdrh] per stream: ${latency}
230 | | ... | append=yes
231
232 | Display Single PPS Bound
233 | | [Documentation]
234 | | ... | Display one pps bound of NDR+PDR search, aggregated,
235 | | ... | in packet per seconds and Gbps total bandwidth
236 | | ... | (for initial packet size).
237 | | ... |
238 | | ... | The bound to display is given as target transfer rate, it is assumed
239 | | ... | it is in transactions per second. Bidirectional traffic
240 | | ... | transaction is understood as having 2 packets, for this purpose.
241 | | ... |
242 | | ... | Througput is calculated as:
243 | | ... | Sum of measured rates over streams
244 | | ... | Bandwidth is calculated as:
245 | | ... | (Throughput * (L2 Frame Size + IPG) * 8)
246 | | ... | If the latency string is present, it is displayed as well.
247 | |
248 | | ... | *Arguments:*
249 | | ... | - text - Flavor text describing which bound is this. Type: string
250 | | ... | - tps - Transaction rate [tps]. Type: float
251 | | ... | - latency - Latency data to display if non-empty. Type: string
252 | |
253 | | ... | *Example:*
254 | |
255 | | ... | \| Display Single PPS Bound \| NDR lower bound \| \${12345.67} \
256 | | ... | \| latency=\${EMPTY} \|
257 | |
258 | | [Arguments] | ${text} | ${tps} | ${latency}=${EMPTY}
259 | |
260 | | ${bandwidth} | ${pps} = | Compute Bandwidth | ${tps}
261 | | Set Test Message | ${\n}${text}: ${pps} pps, | append=yes
262 | | Set Test Message | ${bandwidth} Gbps (initial) | append=yes
263 | | Export Search Bound | ${text} | ${pps} | pps | ${bandwidth * 1e9}
264 | | Return From Keyword If | not """${latency}"""
265 | | Set Test Message | ${\n}LATENCY [min/avg/max/hdrh] per stream: ${latency}
266 | | ... | append=yes