Revert "fix(jobspec): Delete ipsec nfv density tests"
[csit.git] / resources / libraries / robot / performance / performance_display.robot
1 # Copyright (c) 2023 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 | Compute Bandwidth
21 | | [Documentation]
22 | | ... | Compute (bidir) bandwidth from given (unidir) transaction rate.
23 | | ...
24 | | ... | This keyword reads \${ppta} and \${avg_aggregated_frame_size} set
25 | | ... | elsewhere. The implementation should work for both pps and cps rates.
26 | | ... |
27 | | ... | *Arguments:*
28 | | ... | - tps - Transaction rate (unidirectional) [tps]. Type: float
29 | | ...
30 | | ... | *Returns:*
31 | | ... | - Computed bandwidth in Gbps.
32 | | ... | - Computed aggregated packet rate in pps.
33 | |
34 | | ... | *Example:*
35 | |
36 | | ... | |\ \${bandwidth} \| \${pps} = \| Compute Bandwidth \| \${12345.67} \|
37 | |
38 | | [Arguments] | ${tps}
39 | |
40 | | ${ppta} = | Get Packets Per Transaction Aggregated
41 | | ${pps} = | Evaluate | ${tps} * ${ppta}
42 | | ${bandwidth} = | Evaluate | ${pps} * (${avg_aggregated_frame_size}+20)*8/1e9
43 | | Return From Keyword | ${bandwidth} | ${pps}
44
45 | Display Reconfig Test Message
46 | | [Documentation]
47 | | ... | Display the number of packets lost (bidirectionally)
48 | | ... | due to reconfiguration under traffic.
49 | |
50 | | ... | *Arguments:*
51 | | ... | - result - Result of MLRsearch invocation for one search goal.
52 | | ... | Type: StatInterval
53 | |
54 | | ... | *Example:*
55 | |
56 | | ... | \| Display Reconfig Test Message \| \${result} \|
57 | |
58 | | [Arguments] | ${result}
59 | |
60 | | ${bandwidth} | ${packet_rate}= | Compute Bandwidth | ${result.intended_load}
61 | | ${packet_loss} = | Set Variable | ${result.loss_count}
62 | | ${time_loss} = | Evaluate | ${packet_loss} / ${packet_rate}
63 | | Set Test Message | Packets lost due to reconfig: ${packet_loss}
64 | | Set Test Message | ${\n}Implied time lost: ${time_loss} | append=yes
65 | | Export Reconf Result | ${packet_rate} | ${packet_loss} | ${bandwidth * 1e9}
66
67 | Display result of NDRPDR search
68 | | [Documentation]
69 | | ... | Display result of NDR+PDR search, both quantities, aggregated,
70 | | ... | conditional throughput only, in units given by trasaction type,
71 | | ... | e.g. by default in packet per seconds and Gbps total bandwidth
72 | | ... | (for initial packet size).
73 | | ... | The lower bounds in the result are assumed to be valid.
74 | | ... |
75 | | ... | Througput is calculated as:
76 | | ... | Sum of measured rate over streams
77 | | ... | Bandwidth is calculated as:
78 | | ... | (Throughput * (L2 Frame Size + IPG) * 8)
79 | | ... | If the results contain latency data, display them for lower bounds.
80 | |
81 | | ... | *Test (or broader scope) variables read:*
82 | | ... | - frame_size_num - L2 Frame Size [B]. Type: integer or float
83 | | ... | - transaction_type - String identifier to determine how to count
84 | | ... | transactions. Default is "packet".
85 | | ... | *Arguments:*
86 | | ... | - result - Measured result data Tps. Type: List[TrimmedStat]
87 | | ... | *Returns:* NDR and PDR: Unidirectional intended load as tps float.
88 | |
89 | | ... | *Example:*
90 | |
91 | | ... | \| Display result of NDRPDR search \| \${result} \|
92 | |
93 | | [Arguments] | ${result}
94 | |
95 | | ${ndr} = | Convert To Number | ${result[0].relevant_lower_bound}
96 | | ${pdr} = | Convert To Number | ${result[1].relevant_lower_bound}
97 | | Display single bound | NDR | ${result[0].conditional_throughput}
98 | | Display single bound | PDR | ${result[1].conditional_throughput}
99 | | Return From Keyword | ${ndr} | ${pdr}
100
101 | Display result of soak search
102 | | [Documentation]
103 | | ... | Display result of soak search, avg+-stdev, as upper/lower bounds.
104 | | ... | See Display single bound for units used.
105 | | ... | The displayed values are bidirectional, based on conditional
106 | | ... | throughput. The returned
107 | |
108 | | ... | *Test (or broader scope) variables read:*
109 | | ... | - frame_size - L2 Frame Size [B] or IMIX string. Type: integer or
110 | | ... | string
111 | | ... | - transaction_type - String identifier to determine how to count
112 | | ... | transactions. Default is "packet".
113 | | ... | *Arguments:*
114 | | ... | - avg - Estimated average critical load [pps]. Type: float
115 | | ... | - stdev - Standard deviation of critical load [pps]. Type: float
116 | | ... | *Returns:*
117 | | ... | - Lower and upper bound of critical load [pps]. Type: 2-tuple of float
118 | |
119 | | ... | *Example:*
120 | |
121 | | ... | \| Display result of soak search \| \${100000} \| \${100} \|
122 | |
123 | | [Arguments] | ${avg} | ${stdev}
124 | |
125 | | ${avg} = | Convert To Number | ${avg}
126 | | ${stdev} = | Convert To Number | ${stdev}
127 | | ${lower} = | Evaluate | ${avg} - ${stdev}
128 | | ${upper} = | Evaluate | ${avg} + ${stdev}
129 | | Display single bound | PLRsearch lower bound | ${lower}
130 | | Display single bound | PLRsearch upper bound | ${upper}
131 | | Return From Keyword | ${lower} | ${upper}
132
133 | Display single bound
134 | | [Documentation]
135 | | ... | Compute and display one bound of NDR+PDR (or soak) search result.
136 | | ... |
137 | | ... | The bound to display is given as target transfer rate, it is assumed
138 | | ... | valid and in transactions per second. Bidirectional traffic
139 | | ... | transaction is understood as having 2 packets, for this purpose.
140 | | ... |
141 | | ... | Pps values are aggregated, in packet per seconds
142 | | ... | and Gbps total bandwidth (for initial packet size).
143 | | ... | If the latency string is present, it is displayed as well.
144 | | ... |
145 | | ... | Througput is calculated as:
146 | | ... | Sum of measured rate over streams
147 | | ... | Bandwidth is calculated as:
148 | | ... | (Throughput * (L2 Frame Size + IPG) * 8)
149 | | ... | If the results contain latency data, display them for lower bounds.
150 | |
151 | | ... | *Test (or broader scope) variables read:*
152 | | ... | - transaction_type - String identifier to determine how to count
153 | | ... | transactions. Default is "packet".
154 | | ... | *Arguments:*
155 | | ... | - text - Flavor text describing which bound is this. Type: string
156 | | ... | - tps - Conditional throughput [tps]. Type: Union[float, DiscreteLoad]
157 | | ... | - latency - Latency data to display if non-empty. Type: string
158 | |
159 | | ... | *Example:*
160 | |
161 | | ... | \| Display single bound \| NDR \| \${12345.67} \
162 | | ... | \| latency=\${EMPTY} \|
163 | |
164 | | [Arguments] | ${text} | ${tps} | ${latency}=${EMPTY}
165 | |
166 | | ${tps} = | Convert To Number | ${tps}
167 | | ${transaction_type} = | Get Transaction Type
168 | | Run Keyword And Return If | """_cps""" in """${transaction_type}"""
169 | | ... | Display Single CPS Bound | ${text} | ${tps} | ${latency}
170 | | Run Keyword And Return
171 | | ... | Display Single PPS Bound | ${text} | ${tps} | ${latency}
172
173 | Display Single CPS Bound
174 | | [Documentation]
175 | | ... | Display one bound of NDR+PDR search for CPS tests.
176 | | ... | The bounds are expressed as transactions per second.
177 | | ... | If the latency string is present, it is displayed as well.
178 | |
179 | | ... | *Arguments:*
180 | | ... | - text - Flavor text describing which bound is this. Type: string
181 | | ... | - tps - Transaction rate [tps]. Type: float
182 | | ... | - latency - Latency data to display if non-empty. Type: string
183 | |
184 | | ... | *Example:*
185 | |
186 | | ... | \| Display Single CPS Bound \| NDR lower bound \| \${12345.67} \
187 | | ... | \| latency=\${EMPTY} \|
188 | |
189 | | [Arguments] | ${text} | ${tps} | ${latency}=${EMPTY}
190 | |
191 | | Set Test Message | ${\n}${text}: ${tps} CPS | append=yes
192 | | ${bandwidth} | ${pps} = | Compute Bandwidth | ${tps}
193 | | Export Search Bound | ${text} | ${tps} | cps | ${bandwidth * 1e9}
194 | | Run Keyword If | """${latency}""" | Set Test Message
195 | | ... | ${\n}LATENCY [min/avg/max/hdrh] per stream: ${latency} | append=yes
196
197 | Display Single PPS Bound
198 | | [Documentation]
199 | | ... | Display one pps bound of NDR+PDR search, aggregated,
200 | | ... | in packet per seconds and Gbps total bandwidth
201 | | ... | (for initial packet size).
202 | | ... |
203 | | ... | The bound to display is given as target transfer rate, it is assumed
204 | | ... | it is in transactions per second. Bidirectional traffic
205 | | ... | transaction is understood as having 2 packets, for this purpose.
206 | | ... |
207 | | ... | Througput is calculated as:
208 | | ... | Sum of measured rates over streams
209 | | ... | Bandwidth is calculated as:
210 | | ... | (Throughput * (L2 Frame Size + IPG) * 8)
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 PPS Bound \| NDR lower bound \| \${12345.67} \
221 | | ... | \| latency=\${EMPTY} \|
222 | |
223 | | [Arguments] | ${text} | ${tps} | ${latency}=${EMPTY}
224 | |
225 | | ${bandwidth} | ${pps} = | Compute Bandwidth | ${tps}
226 | | Set Test Message | ${\n}${text}: ${pps} pps, | append=yes
227 | | Set Test Message | ${bandwidth} Gbps (initial) | append=yes
228 | | Export Search Bound | ${text} | ${pps} | pps | ${bandwidth * 1e9}
229 | | Run Keyword If | """${latency}""" | Set Test Message
230 | | ... | ${\n}LATENCY [min/avg/max/hdrh] per stream: ${latency} | append=yes