de515412a50d02c37c64e7d566b3cb60a62a5ece
[csit.git] / resources / libraries / robot / performance / performance_display.robot
1 # Copyright (c) 2021 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 | Display Reconfig Test Message
50 | | [Documentation]
51 | | ... | Display the number of packets lost (bidirectionally)
52 | | ... | due to reconfiguration under traffic.
53 | |
54 | | ... | *Arguments:*
55 | | ... | - result - Result of bidirectional measurement.
56 | | ... | Type: ReceiveRateMeasurement
57 | |
58 | | ... | *Example:*
59 | |
60 | | ... | \| Display Reconfig Test Message \| \${result} \|
61 | |
62 | | [Arguments] | ${result}
63 | |
64 | | ${ppta} = | Get Packets Per Transaction Aggregated
65 | | ${packet_rate} = | Evaluate | ${result.target_tr} * ${ppta}
66 | | ${packet_loss} = | Set Variable | ${result.loss_count}
67 | | ${time_loss} = | Evaluate | ${packet_loss} / ${packet_rate}
68 | | Set Test Message | Packets lost due to reconfig: ${packet_loss}
69 | | Set Test Message | ${\n}Implied time lost: ${time_loss} | append=yes
70
71 | Display result of NDRPDR search
72 | | [Documentation]
73 | | ... | Display result of NDR+PDR search, both quantities, both bounds,
74 | | ... | aggregate in units given by trasaction type, e.g. by default
75 | | ... | in packet per seconds and Gbps total bandwidth
76 | | ... | (for initial packet size).
77 | | ... |
78 | | ... | The bound to display is encoded as target rate, it is assumed
79 | | ... | it is in transactions per second. Bidirectional traffic
80 | | ... | transaction is understood as having 2 packets, for this purpose.
81 | | ... |
82 | | ... | Througput is calculated as:
83 | | ... | Sum of measured rate over streams
84 | | ... | Bandwidth is calculated as:
85 | | ... | (Throughput * (L2 Frame Size + IPG) * 8)
86 | | ... | If the results contain latency data, display them for lower bounds.
87 | |
88 | | ... | *Test (or broader scope) variables read:*
89 | | ... | - frame_size_num - L2 Frame Size [B]. Type: integer or float
90 | | ... | - transaction_type - String identifier to determine how to count
91 | | ... | transactions. Default is "packet".
92 | | ... | *Arguments:*
93 | | ... | - result - Measured result data. Aggregate rate, tps or pps.
94 | | ... | Type: NdrPdrResult
95 | |
96 | | ... | *Example:*
97 | |
98 | | ... | \| Display result of NDRPDR search \| \${result} \|
99 | |
100 | | [Arguments] | ${result}
101 | |
102 | | Display single bound | NDR_LOWER
103 | | ... | ${result[0].measured_low.target_tr}
104 | | ... | ${result[0].measured_low.latency}
105 | | Display single bound | NDR_UPPER
106 | | ... | ${result[0].measured_high.target_tr}
107 | | Display single bound | PDR_LOWER
108 | | ... | ${result[1].measured_low.target_tr}
109 | | ... | ${result[1].measured_low.latency}
110 | | Display single bound | PDR_UPPER
111 | | ... | ${result[1].measured_high.target_tr}
112
113 | Display result of soak search
114 | | [Documentation]
115 | | ... | Display result of soak search, avg+-stdev, as upper/lower bounds.
116 | | ... | See Display single bound for units used.
117 | |
118 | | ... | *Test (or broader scope) variables read:*
119 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
120 | | ... | string
121 | | ... | - transaction_type - String identifier to determine how to count
122 | | ... | transactions. Default is "packet".
123 | | ... | *Arguments:*
124 | | ... | - avg - Estimated average critical load [pps]. Type: float
125 | | ... | - stdev - Standard deviation of critical load [pps]. Type: float
126 | |
127 | | ... | *Returns:*
128 | | ... | - Lower and upper bound of critical load [pps]. Type: 2-tuple of float
129 | |
130 | | ... | *Example:*
131 | |
132 | | ... | \| Display result of soak search \| \${100000} \| \${100} \|
133 | |
134 | | [Arguments] | ${avg} | ${stdev}
135 | |
136 | | ${avg} = | Convert To Number | ${avg}
137 | | ${stdev} = | Convert To Number | ${stdev}
138 | | ${lower} = | Evaluate | ${avg} - ${stdev}
139 | | ${upper} = | Evaluate | ${avg} + ${stdev}
140 | | Display single bound | PLRsearch lower bound | ${lower}
141 | | Display single bound | PLRsearch upper bound | ${upper}
142 | | Return From Keyword | ${lower} | ${upper}
143
144 | Display single bound
145 | | [Documentation]
146 | | ... | Compute and display one bound of NDR+PDR (or soak) search result.
147 | | ... | If the latency string is present, it is displayed as well.
148 | | ... |
149 | | ... | The bound to display is given as target transfer rate, it is assumed
150 | | ... | it is in transactions per second. Bidirectional traffic
151 | | ... | transaction is understood as having 2 packets, for this purpose.
152 | | ... |
153 | | ... | Pps values are aggregate in packet per seconds,
154 | | ... | and Gbps total bandwidth (for initial packet size).
155 | | ... |
156 | | ... | Througput is calculated as:
157 | | ... | Sum of measured rate over streams
158 | | ... | Bandwidth is calculated as:
159 | | ... | (Throughput * (L2 Frame Size + IPG) * 8)
160 | | ... | If the results contain latency data, display them for lower bounds.
161 | |
162 | | ... | *Test (or broader scope) variables read:*
163 | | ... | - transaction_type - String identifier to determine how to count
164 | | ... | transactions. Default is "packet".
165 | | ... | *Arguments:*
166 | | ... | - text - Flavor text describing which bound is this. Type: string
167 | | ... | - tps - Transaction rate [tps]. Type: float
168 | | ... | - latency - Latency data to display if non-empty. Type: string
169 | |
170 | | ... | *Example:*
171 | |
172 | | ... | \| Display single bound \| NDR lower bound \| \${12345.67} \
173 | | ... | \| latency=\${EMPTY} \|
174 | |
175 | | [Arguments] | ${text} | ${tps} | ${latency}=${EMPTY}
176 | |
177 | | ${transaction_type} = | Get Transaction Type
178 | | Run Keyword And Return If | """_cps""" in """${transaction_type}"""
179 | | ... | Display single cps bound | ${text} | ${tps} | ${latency}
180 | | Display single pps bound | ${text} | ${tps} | ${latency}
181
182 | Display single cps bound
183 | | [Documentation]
184 | | ... | Display one bound of NDR+PDR search for CPS tests.
185 | | ... | The bounds are expressed as transactions per second.
186 | | ... | If the latency string is present, it is displayed as well.
187 | |
188 | | ... | *Arguments:*
189 | | ... | - text - Flavor text describing which bound is this. Type: string
190 | | ... | - tps - Transaction rate [tps]. Type: float
191 | | ... | - latency - Latency data to display if non-empty. Type: string
192 | |
193 | | ... | *Example:*
194 | |
195 | | ... | \| Display single cps bound \| NDR lower bound \| \${12345.67} \
196 | | ... | \| latency=\${EMPTY} \|
197 | |
198 | | [Arguments] | ${text} | ${tps} | ${latency}=${EMPTY}
199 | |
200 | | Set Test Message | ${\n}${text}: ${tps} CPS | append=yes
201 | | Return From Keyword If | not """${latency}"""
202 | | Set Test Message | ${\n}LATENCY [min/avg/max/hdrh] per stream: ${latency}
203 | | ... | append=yes
204
205 | Display single pps bound
206 | | [Documentation]
207 | | ... | Display one pps bound of NDR+PDR search,
208 | | ... | aggregate in packet per seconds and Gbps total bandwidth
209 | | ... | (for initial packet size).
210 | | ... |
211 | | ... | The bound to display is given as target transfer rate, it is assumed
212 | | ... | it is in transactions per second. Bidirectional traffic
213 | | ... | transaction is understood as having 2 packets, for this purpose.
214 | | ... |
215 | | ... | Througput is calculated as:
216 | | ... | Sum of measured rates over streams
217 | | ... | Bandwidth is calculated as:
218 | | ... | (Throughput * (L2 Frame Size + IPG) * 8)
219 | | ... | If the latency string is present, it is displayed as well.
220 | |
221 | | ... | *Arguments:*
222 | | ... | - text - Flavor text describing which bound is this. Type: string
223 | | ... | - tps - Transaction rate [tps]. Type: float
224 | | ... | - latency - Latency data to display if non-empty. Type: string
225 | |
226 | | ... | *Example:*
227 | |
228 | | ... | \| Display single pps bound \| NDR lower bound \| \${12345.67} \
229 | | ... | \| latency=\${EMPTY} \|
230 | |
231 | | [Arguments] | ${text} | ${tps} | ${latency}=${EMPTY}
232 | |
233 | | ${ppta} = | Get Packets Per Transaction Aggregated
234 | | ${pps} = | Evaluate | ${tps} * ${ppta}
235 | | ${bandwidth} = | Evaluate | ${pps} * (${avg_frame_size}+20)*8 / 1e9
236 | | Set Test Message | ${\n}${text}: ${pps} pps, | append=yes
237 | | Set Test Message | ${bandwidth} Gbps (initial) | append=yes
238 | | Return From Keyword If | not """${latency}"""
239 | | Set Test Message | ${\n}LATENCY [min/avg/max/hdrh] per stream: ${latency}
240 | | ... | append=yes