Adding kubernetes tests
[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
62    # K8S config file
63    K8S_CREDENTIALS=<path_to_kubeconfig>
64
65    # The following set of environment variables will be used in host
66    # of the robot framework. Not needed for docker execution
67
68    # Folder where Robot tests are stored
69    ROBOT_DEVOPS_FOLDER=robot-systest
70
71    # Folder to save alternative DUT environments (optional)
72    ENVIRONMENTS_FOLDER=environments
73
74    # Folder where all required packages are stored
75    PACKAGES_FOLDER=osm-packages
76
77    # Folder where test results should be exported
78    ROBOT_REPORT_FOLDER=results
79 ```
80
81 ## Deployment
82
83 It is possible to run the tests directly from the repository or using a docker container with the tests
84
85 1. Docker container creation:
86
87 ```bash
88 docker build -t osmtests .
89 ```
90
91 Options:
92
93 * --env-file: It is the environmental file where is described the OSM target and VIM
94 * -o <osmclient_version> [OPTIONAL]: It is used to specify a particular osmclient version. Default: latest
95 * -p <package_branch> [OPTIONAL]: OSM packages repository branch. Default: master
96 * -t <testing_tags> [OPTIONAL]: Robot tests tags. [sanity, regression, particular_test]. Default: sanity
97
98 Volumes:
99
100 * <path_to_reports> [OPTIONAL]: It is the absolute path to reports location in the host
101 * <path_to_clouds.yaml> [OPTIONAL]: It is the absolute path to the clouds.yaml file in the host
102 * <path_to_kubeconfig> [OPTIONAL]: It is the kubeconfig file to be used for k8s clusters
103
104 ```bash
105    docker run --rm=true -t osmtests --env-file <env_file> \
106        -v <path_to_reports>:/reports osmtests \
107        -v <path_to_clouds.yaml>:/robot-systest/clouds.yaml \
108        -v <path_to_kubeconfig>:/root/.kube/config \
109        -o <osmclient_version> \
110        -p <package_branch> \
111        -t <testing_tags>
112 ```
113
114 1. Running the tests manually:
115
116 The way of executing the tests is via the following command:
117
118 ```bash
119    source envfile.rc
120    robot -d reports -i <testing_tags> testsuite/
121 ```
122
123 ## Built With
124
125 * [Python](www.python.org/) - The language used
126 * [Robot Framework](robotframework.org) - The testing framework
127
128 ## Contributing
129
130 Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
131
132 ## Versioning
133
134 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).
135
136 ## License
137
138 This project is licensed under the Apache2 License - see the [LICENSE.md](LICENSE) file for details
139
140 ## Acknowledgments