Feature 10509 manual scaling for native K8s charm
[osm/tests.git] / README.md
1 <!--
2 Copyright 2020 ETSI
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8    http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 implied.
14 See the License for the specific language governing permissions and
15 limitations under the License
16 -->
17
18 # OSM test automation project - osm/tests
19
20 This repository contains tools and configuration files for testing and automation needs of OSM projet
21
22 ## Prerequisites
23
24 * **Robot Framework**
25 * **Packages**: ssh ping yq git
26 * **Python3 packages**: haikunator requests robotframework robotframework-seleniumlibrary robotframework-requests robotframework-jsonlibrary robotframework-sshlibrary
27 * Clone **osm-packages** from gitlab
28 * Environment config file for your infrastructure [envfile.rc]
29
30 ## Installing
31
32 This bash script can be used to setup your environment to execute the tests.
33
34 ```bash
35 PACKAGES_FOLDER=osm-packages
36 add-apt-repository -y ppa:rmescandon/yq && apt update && apt install yq git iputils-ping ssh -y
37 pip install haikunator requests robotframework robotframework-seleniumlibrary robotframework-requests robotframework-jsonlibrary \
38     robotframework-sshlibrary
39 snap install charm
40 # Download community packages
41 git clone https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages.git ${PACKAGES_FOLDER}
42 ```
43
44 envfile.rc
45
46 ```bash
47 # VIM Setup
48 OS_USERNAME=<openstack_username>
49 OS_PASSWORD=<openstack_password>
50 OS_TENANT_NAME=<openstack_tenant_name>
51 OS_AUTH_URL=<openstack_authorization_url>
52 OS_TENANT_ID=<openstack_tenant_id>
53
54 # OSM Setup
55 OSM_HOSTNAME=<osm_ip_address>
56 VIM_TARGET=<osm_vim_name>
57 VIM_MGMT_NET=<osm_vim_mgmt_name>
58
59 # Clouds file datacenter
60 OS_CLOUD=<datacenter_in_clouds_file>
61 # SDNCs file
62 OS_SDNC=<SDN_controller_in_sdncs_file>
63
64 # K8S config file
65 K8S_CREDENTIALS=<path_to_kubeconfig>
66
67 # Juju data file
68 JUJU_DATA=<path_to_jujudata>
69
70 # The following set of environment variables will be used in host
71 # of the robot framework. Not needed for docker execution
72
73 # Folder where Robot tests are stored
74 ROBOT_DEVOPS_FOLDER=robot-systest
75
76 # Folder to save alternative DUT environments (optional)
77 ENVIRONMENTS_FOLDER=environments
78
79 # Folder where all required packages are stored
80 PACKAGES_FOLDER=osm-packages
81
82 # Folder where test results should be exported
83 ROBOT_REPORT_FOLDER=results
84 ```
85
86 ## Deployment
87
88 It is possible to run the tests directly from the repository or using a docker container with the tests
89
90 1. Docker container creation:
91
92 ```bash
93 docker build -f docker/Dockerfile -t osmtests .
94 ```
95
96 Options:
97
98 * --env-file: It is the environmental file where is described the OSM target and VIM
99 * -o <osmclient_version> [OPTIONAL]: It is used to specify a particular osmclient version. Default: latest
100 * -p <package_branch> [OPTIONAL]: OSM packages repository branch. Default: master
101 * -t <testing_tags> [OPTIONAL]: Robot tests tags. [sanity, regression, particular_test]. Default: sanity
102
103 Volumes:
104
105 * <path_to_reports> [OPTIONAL]: It is the absolute path to reports location in the host
106 * <path_to_clouds.yaml> [OPTIONAL]: It is the absolute path to the clouds.yaml file in the host
107 * <path_to_sdncs.yaml> [OPTIONAL]: It is the absolute path to the sdncs.yaml file in the host
108 * <path_to_kubeconfig> [OPTIONAL]: It is the kubeconfig file to be used for k8s clusters
109 * <path_to_jujudata> [OPTIONAL]: It is the jujudata file to be used for juju cli
110
111 ```bash
112 docker run --rm=true -t osmtests --env-file <env_file> \
113        -v <path_to_reports>:/reports osmtests \
114        -v <path_to_clouds.yaml>:/robot-systest/clouds.yaml \
115        -v <path_to_sdncs.yaml>:/robot-systest/sdncs.yaml \
116        -v <path_to_kubeconfig>:/root/.kube/config \
117        -v <path_to_jujudata>:/root/.local/share/juju \
118        -o <osmclient_version> \
119        -p <package_branch> \
120        -t <testing_tags>
121 ```
122
123 1. Running the tests manually:
124
125 The way of executing the tests is via the following command:
126
127 ```bash
128 source envfile.rc
129 robot -d reports -i <testing_tags> testsuite/
130 ```
131
132 ## Test tags
133
134 All tests in the testsuites have tags. Tags allow to run only a set of tests
135 identified by a tag. Several tags can be specified when running robot in the
136 following way:
137
138 ```bash
139 robot -i <tag_01> -i <tag_02> testsuite/
140 ```
141
142 The following tags exist for each testsuite:
143
144 - A tag per testsuite using its mnemonic (e.g. `basic_01`)
145 - Cluster tag for each of the statistically similar tests:
146   - `cluster_main`: `basic_01`, `basic_05`, `basic_08`, `basic_09`, `basic_15`,
147     `basic_16`, basic_17`, `hackfest_basic`, `hackfest_multivdu`,
148     `hackfest_cloudinit`, `quotas_01`
149   - `cluster_ee_config`: `basic_06`, `basic_07`, `basic_11`, `basic_12`,
150     `basic_13`, `basic_14`, `k8s_05`, `k8s_06`
151   - `cluster_relations`: `basic_11`, `basic_13`, `basic_14`
152   - `cluster_epa`: `epa_01`, `epa_02`, `epa_03`, `epa_04`, `epa_05`
153   - `cluster_k8s`: `k8s_01`, `k8s_02`, `k8s_03`, `k8s_04`, `k8s_07`, `k8s_08`, `sa_08`
154   - `cluster_k8s_charms`: `k8s_05`, `k8s_06`
155   - `cluster_sa`: `sa_01`, `sa_02`, `sa_07`
156   - `cluster_slices`: `slice_01`, `slice_02`
157 - daily: for all testsuites that will run in the daily job
158 - regression: for all testsuites that should pass in the current stable branch
159 - sanity: for all testsuites that should be passed by each commit in the
160   stage3 to be successfully verified by Jenkins, currently `basic_07`,
161   `basic_11`, `k8s_03`, `k8s_04`, `sa_02`
162
163 In addition, the tag "cleanup" exists in those tests that perform
164 any deletion. In that way, it can be invoked to retry the deletion if
165 the tests were forcefully stopped.
166
167 ## Built With
168
169 * [Python](www.python.org/) - The language used
170 * [Robot Framework](robotframework.org) - The testing framework
171
172 ## Contributing
173
174 Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
175
176 ## Versioning
177
178 We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://osm.etsi.org/gitweb/?p=osm/tests.git;a=tags).
179
180 ## License
181
182 This project is licensed under the Apache2 License - see the [LICENSE.md](LICENSE) file for details
183
184 ## Acknowledgments