96b4b7c6588b6c5036d9d0e9d5605bcd3bed7ddc
[integration.git] / docs / docs_robot.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0
2    International License. http://creativecommons.org/licenses/by/4.0
3
4 .. _docs_robot:
5
6 Robot
7 -----
8
9 Introduction
10 ~~~~~~~~~~~~
11 Robot Framework is a generic open source automation framework for acceptance
12 testing, acceptance test driven development (ATDD), and robotic process
13 automation (RPA). This framework is widely used in ONAP.
14 The full documentation of robot can be found in https://robotframework.org/.
15
16 In ONAP, Robot scripts have been developed to validate the components, provision
17 and run end to end tests.
18
19 The robot scripts can be retrieved in the ONAP testsuite repository: https://git.onap.org/testsuite/
20
21 A Robot pod is part of the ONAP default installation.
22 This pod includes the robot framework and the needed scripts cloned from the
23 testsuite repository.
24 Additional scripts are created during the installation in order to simplify
25 the launch of the different tests and are loacted in /opt/oom/kubernetes/robots.
26
27 From one of the kubernetes controller, you shall see the pod as follows:
28
29 ::
30
31   $ kubectl get pods -n onap | grep robot
32   onap-robot-robot-7fc49977fd-6jblt    1/1     Running    0          9h
33
34 You can access the robot configuration through its configmap.
35
36 ::
37
38   $ kubectl describe cm onap-robot-robot-eteshare-configmap -n onap
39
40 You shall see a long list of variables set during the ONAP installation by OOM.
41 Please note that some of these variables are set thanks to the OOM
42 overide openstack.yaml file. See the examples described in https://git.onap.org/oom/tree/kubernetes/onap/resources/overrides/openstack.yaml
43
44 Verification of the ONAP components
45 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46 ONAP robot healthcheck tests have been created to give a quick feedback on the
47 status of the ONAP components.
48
49 You can run them from one of the kubernetes controller. You need to log on the
50 machine then perform the following commands:
51
52 ::
53
54   $ cd /opt/oom/kubernetes/robot
55   $ ./ete-k8s.sh onap health
56
57 You shall the execution of all the healthcheck launched from bash script hosted
58 on the kubernetes controller and executed on the robot pod.
59
60 At the end you shall see that logs and reporting are automatically generated
61 by robot and stored on the pod under /share/logs/.
62 You can retrieve the logs directly from the pods or through the web interface
63 integrated in the robot pod by typing
64 http://portal.api.simpledemo.onap.org:30209/logs/ (test/test)
65
66 .. figure:: files/robot/robot_logs.png
67    :align: center
68
69 You shall see 3 files:
70
71 * log.html
72 * output.xml
73 * report.html
74
75 A new directory will be created after each run.
76
77 log.html should look like
78
79 .. figure:: files/robot/robot_report_logs.png
80    :align: center
81
82 When the testsuite is passed, the reporting page is green.
83
84 .. figure:: files/robot/robot_report_ok.png
85    :align: center
86
87 You can click on the test case to get details.
88
89 .. figure:: files/robot/robot_report_details.png
90    :align: center
91
92 If one of the test is FAIL, the generated web reporting page will be red.
93
94 .. figure:: files/robot/robot_report_ko.png
95    :align: center
96
97 Lots of tags have been created for healthcheck tests. You may replace health by
98 core, small, medium, 3rdparty, health-sdc, health-multicloud,...
99
100 See https://git.onap.org/testsuite/tree/robot/testsuites/health-check.robot to
101 get all the tags.
102
103 As an illustration, healthcheck core traces should be displayed as follows.
104
105 ::
106
107   $ ./ete-k8s.sh onap core
108   ++ export NAMESPACE=onap
109   ++ NAMESPACE=onap
110   +++ kubectl --namespace onap get pods
111   +++ sed 's/ .*//'
112   +++ grep robot
113   ++ POD=onap-robot-robot-7c47659f7-tt9w4
114   ++ TAGS='-i core'
115   ++ ETEHOME=/var/opt/ONAP
116   +++ kubectl --namespace onap exec onap-robot-robot-7c47659f7-tt9w4 -- bash -c 'ls -1q /share/logs/ | wc -l'
117   ++ export GLOBAL_BUILD_NUMBER=2
118   ++ GLOBAL_BUILD_NUMBER=2
119   +++ printf %04d 2
120   ++ OUTPUT_FOLDER=0002_ete_core
121   ++ DISPLAY_NUM=92
122   ++ VARIABLEFILES='-V /share/config/vm_properties.py -V /share/config/integration_robot_properties.py -V /share/config/integration_preload_parameters.py'
123   ++ VARIABLES='-v GLOBAL_BUILD_NUMBER:17175'
124   ++ kubectl --namespace onap exec onap-robot-robot-7c47659f7-tt9w4 -- /var/opt/ONAP/runTags.sh -V /share/config/vm_properties.py -V /share/config/integration_robot_properties.py -V /share/config/integration_preload_parameters.py -v GLOBAL_BUILD_NUMBER:17175 -d /share/logs/0002_ete_core -i core --display 92
125   Starting Xvfb on display :92 with res 1280x1024x24
126   Executing robot tests at log level TRACE
127   ==============================================================================
128   Testsuites
129   ==============================================================================
130   Testsuites.Health-Check :: Testing ecomp components are available via calls.
131   ==============================================================================
132   Basic A&AI Health Check                                               | PASS |
133   ------------------------------------------------------------------------------
134   Basic DMAAP Message Router Health Check                               | PASS |
135   ------------------------------------------------------------------------------
136   Basic Portal Health Check                                             | PASS |
137   ------------------------------------------------------------------------------
138   Basic SDC Health Check                                                (DMaaP:UP)| PASS |
139   ------------------------------------------------------------------------------
140   Basic SDNC Health Check                                               | PASS |
141   ------------------------------------------------------------------------------
142   Basic SO Health Check                                                 | PASS |
143   ------------------------------------------------------------------------------
144   Testsuites.Health-Check :: Testing ecomp components are available ... | PASS |
145   6 critical tests, 6 passed, 0 failed
146   6 tests total, 6 passed, 0 failed
147   ==============================================================================
148   Testsuites                                                            | PASS |
149   6 critical tests, 6 passed, 0 failed
150   6 tests total, 6 passed, 0 failed
151   ==============================================================================
152   Output:  /share/logs/0002_ete_core/output.xml
153   Log:     /share/logs/0002_ete_core/log.html
154   Report:  /share/logs/0002_ete_core/report.html
155
156 Onboard and Instantiate VNF/PNF with Robot
157 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
158 Robot scripts have been also created to provision components and perform end
159 to end tests.
160 All the robot scripts are hosted on the tesuite repository and deal with various
161 test cases and/or components.
162
163 ::
164
165   robot/testsuites/
166   ├── aai
167   │   └── aai-regression-test-v14.robot
168   ├── cds.robot
169   ├── clamp.robot
170   ├── closed-loop.robot
171   ├── create-cloud-config.robot
172   ├── demo.robot
173   ├── health-check.robot
174   ├── hvves.robot
175   ├── model-distribution.robot
176   ├── model-distribution-vcpe.robot
177   ├── oof
178   │   ├── oof-cmso.robot
179   │   ├── oof-has.robot
180   │   └── oof-osdf.robot
181   ├── pnf-registration.robot
182   ├── portalApp.robot
183   ├── post-install-tests.robot
184   ├── update_onap_page.robot
185   ├── vnf-orchestration-direct-so.robot
186   └── vnf-orchestration.robot
187
188 It is, for instance possible to test the onboarding of the vFirewall model in
189 the SDC by running the command:
190
191 ::
192
193   $ ete-k8s.sh onap healthdist
194
195 If you consider the ete-k8s.sh script, the following testsuites are referenced:
196
197 * cds.robot: cds
198 * clamp.robot: clamp
199 * demo.robot: InitDemo, InitCustomer, APPCCDTPreloadDemo, APPCMountPointDemo, DistributeDemoVFWDT, DistributeVFWNG
200 * health-check.robot: health, core, small, medium, 3rdparty, api, datarouter, externalapi, health-aaf,...
201 * hvves.robot: HVVES, ete
202 * model-distribution-vcpe.robot: distributevCPEResCust
203 * model-distribution.robot: distribute, distributeVFWDT, distributeVLB
204 * oof-cmso.robot, oof-homing.robot, oof-has.robot: oof related tests
205 * pnf-registration.robot: ete, pnf_registrate
206 * post-install-tests.robot dmaapacl, postinstall
207 * update_onap_page.robot: UpdateWebPage
208 * vnf-orchestration-direct-so.robot: instantiateVFWdirectso
209 * vnf-orchestration.robot: instantiate, instantiateNoDelete, stability72hr
210
211 If you use the demo-k8s.s script, you may see the following options:
212
213 * init_robot
214 * init
215 * init_customer
216 * distribute
217 * preload
218 * appc
219 * instantiateVFW
220 * instantiateVFWdirectso
221 * deleteVNF
222 * heatbridge
223 * cds
224 * distributeVFWNG
225 * distributeDemoVFWDT
226 * instantiateDemoVFWDT
227 * vfwclosedloop
228
229 See :ref:`Verified Use Cases and Functional Requirements <docs_usecases>` to see
230 how to use these scripts. Some of them may need specific prerequisites on the
231 environment and may support specific versions and/or configurations.
232
233
234 Develop your own Robot scripts
235 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
236 A dedicated wiki page has been created to help people to design and write their
237 own robot scripts within ONAP context (https://wiki.onap.org/display/DW/Robot+Framework+Development+Guide)
238 It is also possible to contact the integration team to get support.