commit | 3f79a1fdc38bdd45829d92c9f2672411bf3a5647 | [log] [tgz] |
---|---|---|
author | Zack Williams <zdw@opennetworking.org> | Fri Feb 14 19:07:18 2020 -0700 |
committer | Zack Williams <zdw@opennetworking.org> | Wed Feb 19 10:20:48 2020 -0700 |
tree | bf6167351d969c3ca5bf27a70f36f692c23c9c30 | |
parent | ee67555401a1070416283f8e13a9282bba839211 [diff] |
[VOL-2234] Cleaned up documentation, and described workarounds for line lenght of lint target Change-Id: I8dd569a1d67dd510692e67874e26d9e50b378403
Automated test-suites to validate the stability/functionality of VOLTHA. Tests that reside in here should be written in Robot Framework and Python.
Intended use includes:
Learn more about VOLTHA System Test in Test Automation Brigade.
Python 3.5 or later and virtualenv
voltctl
- a command line tool to access VOLTHA. Reference - voltctl
kubectl
- a command line tool to access your Kubernetes Clusters. Reference: kubectl
voltctl
and kubectl
must be properly configured on your system prior to any test executions. The kind-voltha
environment will install and configure these tools for you; see below.
Directory is structured as follows:
├── tests └── functional/ // feature/functionality tests that should be implemented as new features get developed └── libraries // shared test keywords (functions) across various test suites └── variables // shared variables across various test suites
An easy way to bring up VOLTHA + BBSim for testing is by using kind-voltha. To set up a minimal environment, first install Docker and the Go programming language. Then run the following commands:
NOTE: Please make sure you are able to run the docker command (your user is in the
docker
group)
The testing environment will be setup in the kubernetes cluster and you can use your own one or use the one provided by kind-voltha.
If you doesn't have a kubernetes cluster, please use the following command to set up the kubernetes cluster and install required packages.
git clone https://github.com/ciena/kind-voltha cd kind-voltha EXTRA_HELM_FLAGS="--set defaults.image_tag=master" TYPE=minimal WITH_RADIUS=y WITH_BBSIM=y INSTALL_ONOS_APPS=y CONFIG_SADIS=y ./voltha up source minimal-env.sh
If you prefer to use your own kubernetes cluster, please read the document kind-voltha configuration options first to see how to configure the kind-voltha
installation behavior.
Helm: v2.14.3 Kubernetes: v1.15.0 KIND: v0.4.0
You can skip the installation of kubernetes cluster and helm server/client by setting environment variables.
For example, using the following command to install VOLTHA required packages only.
git clone https://github.com/ciena/kind-voltha cd kind-voltha EXTRA_HELM_FLAGS="--set defaults.image_tag=master" TYPE=minimal WITH_RADIUS=y WITH_BBSIM=y INSTALL_ONOS_APPS=y CONFIG_SADIS=y DEPLOY_K8S=no INSTALL_KUBECTL=no INSTALL_HELM=no ./voltha up source minimal-env.sh
The defaults.image_tag
value above is used to specify which VOLTHA branch images to pull from Docker Hub.
See all available versions in Docker voltha.
If you meet any issues when you set up the VOLTHA testing environment by running voltha up
.
You can see the installation logs from the file kind-voltha/install-$TYPE.log
.
The $TYPE should be full
or minimal
, depending on the variable you used in voltah up
, e.g, install-minimal.
Assuming that you have brought up VOLTHA as described above, to run the sanity tests run:
git clone https://github.com/opencord/voltha-system-tests make -C voltha-system-tests sanity-kind
This test execution will generate three report files in voltha-system-tests/tests/sanity
(output.xml
, report.html
, log.html
). View the report.html
page in a browser to analyze the results.
If you're running on a remote system, you can start a web server with python3 -m http.server
.
The make sanity-kind
target is equivalent to the following:
ROBOT_PORT_ARGS="-v ONOS_REST_PORT:8181 -v ONOS_SSH_PORT:8101" \ ROBOT_TEST_ARGS="--exclude notready --critical sanity" \ ROBOT_MISC_ARGS="-v num_onus:1" \ make sanity
If you are running the tests in another environment, you can run make sanity
with the arguments appropriate for your environment. Look at variables.robot for a list of variables that you may need to override.
Assuming that a POD is available with all the required hardware and connections, we can deploy the POD by following the procedure in this section below.
Deploying POD can be either manual or automated using Jenkins job.
You can install it manually by following these steps below.
git clone https://github.com/ciena/kind-voltha.git cd kind-voltha/ EXTRA_HELM_FLAGS='-f <PATH_TO_YOUR_K8S_CONFIG_FILE>' WITH_RADIUS=yes WITH_TP=yes DEPLOY_K8S=no INSTALL_KUBECTL=no INSTALL_HELM=no ONOS_TAG=voltha-2.1 ./voltha up
Note: replace PATH_TO_YOUR_K8S_CONFIG_FILE
with your Kubernetes configuration file. To create one please check this example. For more information on various environment variables with ./voltha up
please check the link here
All functional test cases are placed under functional
folder.
Voltha_PODTests.robot
consists of functional testcases that can be run on a physical POD.
Each robot testcase has a description in the Documentation
section.
The same suite of tests can be run on any POD because parameters needed for the test are written in .yaml file. Instead of hardcoding the POD specific variables in the test case, tests rely on a separate configuration file which describes the POD setup. This .yaml
file contains details like the ONUs, OLT, nodes etc.
To create a configuration file for your POD, check this example
Input data are stored in the data
folder. Few examples of input data could be, test specific SADIS configurations, tech profiles etc. Please give appropriate file names to the input files.
To trigger tests on the physical POD
git clone https://github.com/opencord/voltha-system-tests git clone https://github.com/opencord/cord-tester git clone https://github.com/opencord/voltha cd voltha-system-tests/tests/functional robot -V <PATH_TO_YOUR_POD_CONFIGURATION_FILE> Voltha_PODTests.robot
Note: PATH_TO_YOUR_POD_CONFIGURATION_FILE
should point to the YAML file that describes your POD setup.
Scenarios in each test suite can be associated with a Tag
, using which a particular scenario can be invoked during test execution. As an example to execute only one testcase from the test suite you can do something like here:
cd voltha-system-tests/tests/functional robot -i test1 -V <PATH_TO_YOUR_POD_CONFIGURATION_FILE> Voltha_PODTests.robot
Most additions should be done by adding keywords to the libraries, then calling these keywords from the tests. Consult a guide on how to write good Robot framework tests.
When writing new functions, make sure there is proper documentation for it. Also, follow a good naming convention for any new functions. There are also many keywords/functions available as part of the SEBA test framework which can be found here
Tests should be written in RobotFramework as they need to be integrated with Jenkins test jobs. Libraries can be written in python or RobotFramework.
Make sure that make lint
check passes, which runs robotframework-lint on any new code that is created. The goal of the linter is to ensure that code is well formatted and structured, and that test suites are of a reasonable size. Lint can fail for a variety of reasons, usually related to formatting.
If you have trouble with the line length check, try the following:
If you get a Line Length related problem, you can continue lines between keywords with the ...
operator - see the robot documentation for more information.
If it's an issue with a long shell invocation that uses a pipeline to filter output, try to see if you could use built-in Robot functionality for string or JSON manipulation, rather than using shell tools like sed
, awk
, or jq
.
If you absolutely must use a long shell command, it can be stored in a string that is split over multiple lines with the Catenate Keyword before it's run.