Update Xtesting to 0.98
[functest.git] / docs / testing / user / userguide / troubleshooting.rst
1 .. SPDX-License-Identifier: CC-BY-4.0
2
3 Troubleshooting
4 ===============
5
6 This section gives some guidelines about how to troubleshoot the test cases
7 owned by Functest.
8
9 **IMPORTANT**: As in the previous section, the steps defined below must be
10 executed inside the Functest Docker container and after sourcing the OpenStack
11 credentials::
12
13     . $creds
14
15 or::
16
17     source /home/opnfv/functest/conf/env_file
18
19 VIM
20 ---
21
22 This section covers the test cases related to the VIM (healthcheck, vping_ssh,
23 vping_userdata, tempest_smoke, tempest_full, rally_sanity, rally_full).
24
25 vPing common
26 ^^^^^^^^^^^^
27 For both vPing test cases (**vPing_ssh**, and **vPing_userdata**), the first
28 steps are similar:
29
30     * Create Glance image
31     * Create Network
32     * Create Security Group
33     * Create Instances
34
35 After these actions, the test cases differ and will be explained in their
36 respective section.
37
38 These test cases can be run inside the container, using new Functest CLI as
39 follows::
40
41     $ run_tests -t vping_ssh
42     $ run_tests -t vping_userdata
43
44 The Functest CLI is designed to route a call to the corresponding internal
45 python scripts, located in paths::
46
47     /usr/lib/python3.8/site-packages/functest/opnfv_tests/openstack/vping/vping_ssh.py
48     /usr/lib/python3.8/site-packages/functest/opnfv_tests/openstack/vping/vping_userdata.py
49
50 Notes:
51
52   #. There is one difference, between the Functest CLI based test case
53      execution compared to the earlier used Bash shell script, which is
54      relevant to point out in troubleshooting scenarios:
55
56          The Functest CLI does **not yet** support the option to suppress
57          clean-up of the generated OpenStack resources, following the execution
58          of a test case.
59
60      Explanation: After finishing the test execution, the corresponding
61      script will remove, by default, all created resources in OpenStack
62      (image, instances, network and security group). When troubleshooting,
63      it is advisable sometimes to keep those resources in case the test
64      fails and a manual testing is needed.
65
66      It is actually still possible to invoke test execution, with suppression
67      of OpenStack resource cleanup, however this requires invocation of a
68      **specific Python script:** 'run_tests'.
69      The `OPNFV Functest Developer Guide`_ provides guidance on the use of that
70      Python script in such troubleshooting cases.
71
72 Some of the common errors that can appear in this test case are::
73
74     vPing_ssh- ERROR - There has been a problem when creating the neutron network....
75
76 This means that there has been some problems with Neutron, even before creating
77 the instances. Try to create manually a Neutron network and a Subnet to see if
78 that works. The debug messages will also help to see when it failed (subnet and
79 router creation). Example of Neutron commands (using 10.6.0.0/24 range for
80 example)::
81
82     neutron net-create net-test
83     neutron subnet-create --name subnet-test --allocation-pool start=10.6.0.2,end=10.6.0.100 \
84     --gateway 10.6.0.254 net-test 10.6.0.0/24
85     neutron router-create test_router
86     neutron router-interface-add <ROUTER_ID> test_subnet
87     neutron router-gateway-set <ROUTER_ID> <EXT_NET_NAME>
88
89 Another related error can occur while creating the Security Groups for the
90 instances::
91
92     vPing_ssh- ERROR - Failed to create the security group...
93
94 In this case, proceed to create it manually. These are some hints::
95
96     neutron security-group-create sg-test
97     neutron security-group-rule-create sg-test --direction ingress --protocol icmp \
98     --remote-ip-prefix 0.0.0.0/0
99     neutron security-group-rule-create sg-test --direction ingress --ethertype IPv4 \
100     --protocol tcp --port-range-min 80 --port-range-max 80 --remote-ip-prefix 0.0.0.0/0
101     neutron security-group-rule-create sg-test --direction egress --ethertype IPv4 \
102     --protocol tcp --port-range-min 80 --port-range-max 80 --remote-ip-prefix 0.0.0.0/0
103
104 The next step is to create the instances. The image used is located in
105 */home/opnfv/functest/data/cirros-0.5.1-x86_64-disk.img* and a Glance image is
106 created with the name **functest-vping**. If booting the instances fails (i.e.
107 the status is not **ACTIVE**), you can check why it failed by doing::
108
109     nova list
110     nova show <INSTANCE_ID>
111
112 It might show some messages about the booting failure. To try that manually::
113
114     nova boot --flavor m1.small --image functest-vping --nic net-id=<NET_ID> nova-test
115
116 This will spawn a VM using the network created previously manually.
117 In all the OPNFV tested scenarios from CI, it never has been a problem with the
118 previous actions. Further possible problems are explained in the following
119 sections.
120
121
122 vPing_SSH
123 ^^^^^^^^^
124 This test case creates a floating IP on the external network and assigns it to
125 the second instance **opnfv-vping-2**. The purpose of this is to establish
126 a SSH connection to that instance and SCP a script that will ping the first
127 instance. This script is located in the repository under
128 /usr/lib/python3.8/site-packages/functest/opnfv_tests/openstack/vping/ping.sh
129 and takes an IP as a parameter. When the SCP is completed, the test will do a
130 SSH call to that script inside the second instance. Some problems can happen
131 here::
132
133     vPing_ssh- ERROR - Cannot establish connection to IP xxx.xxx.xxx.xxx. Aborting
134
135 If this is displayed, stop the test or wait for it to finish, if you have used
136 the special method of test invocation with specific suppression of OpenStack
137 resource clean-up, as explained earlier. It means that the Container can not
138 reach the Public/External IP assigned to the instance **opnfv-vping-2**. There
139 are many possible reasons, and they really depend on the chosen scenario. For
140 most of the ODL-L3 and ONOS scenarios this has been noticed and it is a known
141 limitation.
142
143 First, make sure that the instance **opnfv-vping-2** succeeded to get an IP
144 from the DHCP agent. It can be checked by doing::
145
146     nova console-log opnfv-vping-2
147
148 If the message *Sending discover* and *No lease, failing* is shown, it probably
149 means that the Neutron dhcp-agent failed to assign an IP or even that it was
150 not responding. At this point it does not make sense to try to ping the
151 floating IP.
152
153 If the instance got an IP properly, try to ping manually the VM from the
154 container::
155
156     nova list
157     <grab the public IP>
158     ping <public IP>
159
160 If the ping does not return anything, try to ping from the Host where the
161 Docker container is running. If that solves the problem, check the iptables
162 rules because there might be some rules rejecting ICMP or TCP traffic
163 coming/going from/to the container.
164
165 At this point, if the ping does not work either, try to reproduce the test
166 manually with the steps described above in the vPing common section with the
167 addition::
168
169     neutron floatingip-create <EXT_NET_NAME>
170     nova floating-ip-associate nova-test <FLOATING_IP>
171
172
173 Further troubleshooting is out of scope of this document, as it might be due to
174 problems with the SDN controller. Contact the installer team members or send an
175 email to the corresponding OPNFV mailing list for more information.
176
177
178
179 vPing_userdata
180 ^^^^^^^^^^^^^^
181 This test case does not create any floating IP neither establishes an SSH
182 connection. Instead, it uses nova-metadata service when creating an instance
183 to pass the same script as before (ping.sh) but as 1-line text. This script
184 will be executed automatically when the second instance **opnfv-vping-2** is
185 booted.
186
187 The only known problem here for this test to fail is mainly the lack of support
188 of cloud-init (nova-metadata service). Check the console of the instance::
189
190     nova console-log opnfv-vping-2
191
192 If this text or similar is shown::
193
194     checking http://169.254.169.254/2009-04-04/instance-id
195     failed 1/20: up 1.13. request failed
196     failed 2/20: up 13.18. request failed
197     failed 3/20: up 25.20. request failed
198     failed 4/20: up 37.23. request failed
199     failed 5/20: up 49.25. request failed
200     failed 6/20: up 61.27. request failed
201     failed 7/20: up 73.29. request failed
202     failed 8/20: up 85.32. request failed
203     failed 9/20: up 97.34. request failed
204     failed 10/20: up 109.36. request failed
205     failed 11/20: up 121.38. request failed
206     failed 12/20: up 133.40. request failed
207     failed 13/20: up 145.43. request failed
208     failed 14/20: up 157.45. request failed
209     failed 15/20: up 169.48. request failed
210     failed 16/20: up 181.50. request failed
211     failed 17/20: up 193.52. request failed
212     failed 18/20: up 205.54. request failed
213     failed 19/20: up 217.56. request failed
214     failed 20/20: up 229.58. request failed
215     failed to read iid from metadata. tried 20
216
217 it means that the instance failed to read from the metadata service. Contact
218 the Functest or installer teams for more information.
219
220
221 Tempest
222 ^^^^^^^
223
224 In the upstream OpenStack CI all the Tempest test cases are supposed to pass.
225 If some test cases fail in an OPNFV deployment, the reason is very probably one
226 of the following
227
228 +----------------------------+------------------------------------------------+
229 | Error                      | Details                                        |
230 +============================+================================================+
231 | Resources required for     | Such resources could be e.g. an external       |
232 | testcase execution are     | network and access to the management subnet    |
233 | missing                    | (adminURL) from the Functest docker container. |
234 +----------------------------+------------------------------------------------+
235 | OpenStack components or    | Check running services in the controller and   |
236 | services are missing or    | compute nodes (e.g. with "systemctl" or        |
237 | not configured properly    | "service" commands).                           |
238 |                            | Configuration parameters can be verified from  |
239 |                            | the related .conf files located under          |
240 |                            | '/etc/<component>' directories.                |
241 +----------------------------+------------------------------------------------+
242 | Some resources required    | The tempest.conf file, automatically generated |
243 | for execution test cases   | by Rally in Functest, does not contain all the |
244 | are missing                | needed parameters or some parameters are not   |
245 |                            | set properly.                                  |
246 |                            | The tempest.conf file is located in directory  |
247 |                            | 'root/.rally/verification/verifier-<UUID>      |
248 |                            | /for-deployment-<UUID>'                        |
249 |                            | in the Functest Docker container. Use the      |
250 |                            | "rally deployment list" command in order to    |
251 |                            | check the UUID of the current deployment.      |
252 +----------------------------+------------------------------------------------+
253
254
255 When some Tempest test case fails, captured traceback and possibly also the
256 related REST API requests/responses are output to the console. More detailed
257 debug information can be found from tempest.log file stored into related Rally
258 deployment folder.
259
260 Functest offers a possibility to test a customized list of Tempest test cases.
261 To enable that, add a new entry in docker/smoke/testcases.yaml on the
262 "smoke" container with the following content::
263
264   -
265       case_name: tempest_custom
266       project_name: functest
267       criteria: 100
268       blocking: false
269       description: >-
270           The test case allows running a customized list of tempest
271           test cases
272       run:
273           name: tempest_common
274           args:
275               mode: "tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops|\
276                   tempest.scenario.test_network_basic_ops.TestNetworkBasicOps.test_network_basic_ops"
277
278 This is an example of running a customized list of Tempest tests in Functest::
279
280   sudo docker run --env-file env \
281       -v $(pwd)/openstack.creds:/home/opnfv/functest/conf/env_file \
282       -v $(pwd)/images:/home/opnfv/functest/images \
283       -v $(pwd)/my-custom-testcases.yaml:/usr/lib/python3.8/site-packages/xtesting/ci/testcases.yaml \
284       opnfv/functest-smoke run_tests -t tempest_custom
285
286 Rally
287 ^^^^^
288
289 The same error causes which were mentioned above for Tempest test cases, may
290 also lead to errors in Rally as well.
291
292 Possible scenarios are:
293  * authenticate
294  * glance
295  * cinder
296  * heat
297  * keystone
298  * neutron
299  * nova
300  * quotas
301  * vm
302
303 To know more about what those scenarios are doing, they are defined in
304 directory:
305 /usr/lib/python3.8/site-packages/functest/opnfv_tests/openstack/rally/scenario
306 For more info about Rally scenario definition please refer to the Rally
307 official documentation. `[3]`_
308
309 To check any possible problems with Rally, the logs are stored under
310 */home/opnfv/functest/results/rally/* in the Functest Docker container.
311
312 .. _`[3]`: https://rally.readthedocs.io/en/latest/index.html
313
314 Controllers
315 -----------
316
317 Opendaylight
318 ^^^^^^^^^^^^
319
320 If the Basic Restconf test suite fails, check that the ODL controller is
321 reachable and its Restconf module has been installed.
322
323 If the Neutron Reachability test fails, verify that the modules
324 implementing Neutron requirements have been properly installed.
325
326 If any of the other test cases fails, check that Neutron and ODL have
327 been correctly configured to work together. Check Neutron configuration
328 files, accounts, IP addresses etc.).
329
330
331 Features
332 --------
333
334 Please refer to the dedicated feature user guides for details.
335
336
337 VNF
338 ---
339
340 cloudify_ims
341 ^^^^^^^^^^^^
342 vIMS deployment may fail for several reasons, the most frequent ones are
343 described in the following table:
344
345 +-----------------------------------+------------------------------------+
346 | Error                             |  Comments                          |
347 +===================================+====================================+
348 | Keystone admin API  not reachable | Impossible to create vIMS user and |
349 |                                   | tenant                             |
350 +-----------------------------------+------------------------------------+
351 | Impossible to retrieve admin role | Impossible to create vIMS user and |
352 | id                                | tenant                             |
353 +-----------------------------------+------------------------------------+
354 | Error when uploading image from   | impossible to deploy VNF           |
355 | OpenStack to glance               |                                    |
356 +-----------------------------------+------------------------------------+
357 | Cinder quota cannot be updated    | Default quotas not sufficient, they|
358 |                                   | are adapted in the script          |
359 +-----------------------------------+------------------------------------+
360 | Impossible to create a volume     | VNF cannot be deployed             |
361 +-----------------------------------+------------------------------------+
362 | SSH connection issue between the  | if vPing test fails, vIMS test will|
363 | Test Docker container and the VM  | fail...                            |
364 +-----------------------------------+------------------------------------+
365 | No Internet access from the VM    | the VMs of the VNF must have an    |
366 |                                   | external access to Internet        |
367 +-----------------------------------+------------------------------------+
368 | No access to OpenStack API from   | Orchestrator can be installed but  |
369 | the VM                            | the vIMS VNF installation fails    |
370 +-----------------------------------+------------------------------------+
371
372 Please note that this test case requires resources (8 VM (2Go) + 1 VM (4Go)),
373 it is there fore not recommended to run it on a light configuration.
374
375 .. _`OPNFV Functest Developer Guide`:  http://artifacts.opnfv.org/functest/docs/testing_developer_devguide/index.html#