HC Test: bugfix for SLAAC and ODL tests
[csit.git] / resources / libraries / robot / honeycomb / honeycomb.robot
1 # Copyright (c) 2017 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 | Library | resources.libraries.python.honeycomb.HoneycombSetup
16 | Library | resources.libraries.python.honeycomb.HoneycombUtil
17 | Library | resources.libraries.python.honeycomb.HcPersistence
18 | Library | resources.libraries.python.DUTSetup
19 | Library | resources.libraries.python.InterfaceUtil
20
21 *** Keywords ***
22 | Configure Honeycomb service on DUTs
23 | | [Documentation] | *Setup environment for honeycomb testing.*
24 | | ...
25 | | ... | _Setup steps:_
26 | | ... | - 1. Login to each honeycomb node using ssh
27 | | ... | - 2. Startup honeycomb service
28 | | ... | - 3. Monitor service startup using HTTP GET request loop
29 | | ... | Expected sequence of HTTP replies:
30 | | ... | connection refused -> 404 -> 401 -> 503 or 500 -> 200 (pass)
31 | | ... | - 4. Configure honeycomb nodes using HTTP PUT request
32 | | ...
33 | | ... | _Arguments:_
34 | | ... | - duts - list of nodes to setup Honeycomb on
35 | | ...
36 | | ... | _Used global constants and variables:_
37 | | ... | - RESOURCES_TPL_HC - path to honeycomb templates directory
38 | | ... | - HTTPCodes - HTTP protocol status codes
39 | | ...
40 | | [Arguments] | @{duts}
41 | | Start honeycomb on DUTs | @{duts}
42 | | Wait until keyword succeeds | 4min | 16sec
43 | | ... | Check honeycomb startup state | @{duts}
44
45 | Stop Honeycomb service on DUTs
46 | | [Documentation] | *Cleanup environment after honeycomb testing.*
47 | | ...
48 | | ... | _Teardown steps:_
49 | | ... | - 1. Login to each honeycomb node using ssh
50 | | ... | - 2. Stop honeycomb service
51 | | ... | - 3. Monitor service shutdown using HTTP GET request loop
52 | | ... | Expected sequence of HTTP replies:
53 | | ... | 200 -> 404 -> connection refused (pass)
54 | | ...
55 | | ... | _Arguments:_
56 | | ... | - duts - list of nodes to stop Honeycomb on
57 | | ...
58 | | ... | _Used global constants and variables:_
59 | | ... | - RESOURCES_TPL_HC - path to honeycomb templates directory
60 | | ... | - HTTPCodes - HTTP protocol status codes
61 | | ...
62 | | [Arguments] | @{duts}
63 | | Stop honeycomb on DUTs | @{duts}
64 | | Wait until keyword succeeds | 60sec | 16sec
65 | | ... | Check honeycomb shutdown state | @{duts}
66
67 | Clear persisted Honeycomb configuration
68 | | [Documentation] | *Delete saved configuration.*
69 | | ...
70 | | ... | *Arguments:*
71 | | ... | - duts - one or more nodes to clear persistence on. Type: dictionary
72 | | ...
73 | | ... | *Example:*
74 | | ...
75 | | ... | \| Clear persisted Honeycomb configuration \| ${nodes['DUT1']} \|
76 | | [Arguments] | @{duts}
77 | | Clear persisted Honeycomb config | @{duts}
78
79 | Restart Honeycomb and VPP and clear persisted configuration
80 | | [Documentation] | Restarts Honeycomb and VPP with default configuration.
81 | | ...
82 | | ... | *Arguments:*
83 | | ... | - node - information about a DUT node. Type: dictionary
84 | | ...
85 | | ... | *Example:*
86 | | ...
87 | | ... | \| Restart Honeycomb and VPP and clear persisted configuration \
88 | | ... | \| ${nodes['DUT1']} \|
89 | | [Arguments] | ${node}
90 | | Stop Honeycomb service on DUTs | ${node}
91 | | Clear persisted Honeycomb configuration | ${node}
92 | | Setup DUT | ${node}
93 | | Configure Honeycomb service on DUTs | ${node}
94
95 | Restart Honeycomb and VPP
96 | | [Documentation] | Restarts Honeycomb service and wait until it starts up.
97 | | ...
98 | | ... | *Arguments:*
99 | | ... | - node - information about a DUT node. Type: dictionary
100 | | ...
101 | | ... | *Example:*
102 | | ...
103 | | ... | \| Restart Honeycomb and VPP \| ${nodes['DUT1']} \|
104 | | [Arguments] | ${node}
105 | | Stop Honeycomb service on DUTs | ${node}
106 | | Setup DUT | ${node}
107 | | Configure Honeycomb service on DUTs | ${node}
108
109 | Archive Honeycomb log file
110 | | [Documentation] | Copy honeycomb.log file from Honeycomb node\
111 | | ... | to test executor.
112 | | ...
113 | | ... | *Arguments:*
114 | | ... | - node - information about a DUT node. Type: dictionary
115 | | ...
116 | | ... | *Example:*
117 | | ...
118 | | ... | \| Archive Honeycomb log file \| ${nudes['DUT1']} \|
119 | | [Arguments] | ${node}
120 | | Archive Honeycomb log | ${node}
121
122 | Configure ODL Client Service On DUT
123 | | [Documentation] | Configure and start ODL client, then repeatedly check if
124 | | ... | it is running.
125 | | ...
126 | | ... | *Arguments:*
127 | | ... | - node - information about a DUT node. Type: dictionary
128 | | ... | - odl_name - Name of ODL client version. Type: string
129 | | ...
130 | | ... | *Example:*
131 | | ...
132 | | ... | \| Configure ODL Client Service on DUT \| ${nodes['DUT1']} \
133 | | ... | \| carbon-SR1 \|
134 | | [Arguments] | ${node} | ${odl_name}
135 | | Copy ODL Client | ${node} | ${odl_name} | /mnt/common | /tmp
136 | | Setup ODL Client | ${node} | /tmp
137 | | Wait until keyword succeeds | 2min | 30sec
138 | | ... | Install ODL Features | ${node} | /tmp
139 | | Wait until keyword succeeds | 4min | 16sec
140 | | ... | Mount Honeycomb on ODL | ${node}
141 | | Wait until keyword succeeds | 2min | 16sec
142 | | ... | Check ODL startup state | ${node}
143 | | Wait until keyword succeeds | 2min | 16sec
144 | | ... | Check honeycomb startup state | ${node}
145
146 | Configure Honeycomb for functional testing
147 | | [Documentation] | Configure Honeycomb with parameters for functional
148 | | ... | testing, then start Honeycomb and repeatedly check startup status.
149 | | ...
150 | | ... | *Arguments:*
151 | | ... | - node - information about a DUT node. Type: dictionary
152 | | ...
153 | | ... | *Example:*
154 | | ...
155 | | ... | \| Configure Honeycomb for functional testing \| ${nodes['DUT1']} \|
156 | | [Arguments] | ${node}
157 | | Configure Restconf binding address | ${node}
158 | | Configure Log Level | ${node} | TRACE
159 | | Configure Persistence | ${node} | disable
160 | | Configure jVPP timeout | ${node} | ${14}
161 | | Clear Persisted Honeycomb Configuration | ${node}
162 | | Configure Honeycomb service on DUTs | ${node}
163
164 | Configure ODL Client for functional testing
165 | | [Documentation] | Read external variable HC_ODL. Depending on its
166 | | ... | value either: do nothing, or setup ODL client for testing and
167 | | ... | create a global variable that modifies Restconf requests to use ODL.
168 | | ...
169 | | ... | *Arguments:*
170 | | ... | - node - information about a DUT node. Type: dictionary
171 | | ...
172 | | ... | *Example:*
173 | | ...
174 | | ... | \| Configure ODL Client for functional testing \| ${nodes['DUT1']} \|
175 | | [Arguments] | ${node}
176 | | ${use_odl_client}= | Get Variable Value | ${HC_ODL}
177 | | Run Keyword If | '${use_odl_client}' != '${NONE}'
178 | | ... | Run Keywords
179 | | ... | Set Global Variable | ${use_odl_client} | AND
180 | | ... | Configure ODL Client Service On DUT | ${node} | ${use_odl_client}
181 | | ... | ELSE | Log | Variable HC_ODL is not present. Not using ODL.
182 | | ... | level=INFO
183
184 | Set Up Honeycomb Functional Test Suite
185 | | [Documentation] | Generic test suite setup for Honeycomb functional tests.
186 | | ... | Restarts VPP, then enables Honeycomb and optionally ODL, based
187 | | ... | on external variable.
188 | | ...
189 | | ... | *Arguments:*
190 | | ... | - node - information about a DUT node. Type: dictionary
191 | | ...
192 | | ... | *Example:*
193 | | ...
194 | | ... | \| Set Up Honeycomb Functional Test Suite \| ${nodes['DUT1']} \|
195 | | [Arguments] | ${node}
196 | | Setup DUT | ${node}
197 | | Configure all TGs for traffic script
198 | | Configure Honeycomb for functional testing | ${node}
199 | | Configure ODL Client for functional testing | ${node}
200
201 | Tear Down Honeycomb Functional Test Suite
202 | | [Documentation] | Generic test suite teardown for Honeycomb functional
203 | | ... | tests. Stops ODL client (if used), then stops Honeycomb and verifies
204 | | ... | that they are both stopped.
205 | | ...
206 | | ... | *Arguments:*
207 | | ... | - node - information about a DUT node. Type: dictionary
208 | | ...
209 | | ... | *Example:*
210 | | ...
211 | | ... | \| Tear Down Honeycomb Functional Test Suite \| ${nodes['DUT1']} \|
212 | | [Arguments] | ${node}
213 | | ${use_odl_client}= | Get Variable Value | ${HC_ODL}
214 | | Run Keyword If | '${use_odl_client}' != '${NONE}'
215 | | ... | Run Keywords
216 | | ... | Stop ODL Client | ${node} | /tmp | AND
217 | | ... | Set Global Variable | ${use_odl_client} | ${NONE}
218 | | Stop Honeycomb service on DUTs | ${node}
219
220 | Enable Honeycomb Feature
221 | | [Documentation] | Enable the specified feature in Honeycomb configuration.
222 | | ... | Requires a restart of Honeycomb to take effect.
223 | | ...
224 | | ... | *Arguments:*
225 | | ... | - node - information about a DUT node. Type: dictionary
226 | | ...
227 | | ... | *Example:*
228 | | ...
229 | | ... | \| Enable Honeycomb Feature \| ${nodes['DUT1']} \| NSH \|
230 | | [arguments] | ${node} | ${feature}
231 | | Manage Honeycomb Features | ${node} | ${feature}
232
233 | Disable Honeycomb Feature
234 | | [Documentation] | Disable the specified feature in Honeycomb configuration.
235 | | ... | Requires a restart of Honeycomb to take effect.
236 | | ...
237 | | ... | *Arguments:*
238 | | ... | - node - information about a DUT node. Type: dictionary
239 | | ...
240 | | ... | *Example:*
241 | | ...
242 | | ... | \| Disable Honeycomb Feature \| ${nodes['DUT1']} \| NSH \|
243 | | [arguments] | ${node} | ${feature}
244 | | Manage Honeycomb Features | ${node} | ${feature} | disable=${True}