This repository contains a Python library tangotest
for automated functional testing of VNFs.
The library helps test developers to write functional tests in Python and run locally or in CI/CD environments. Using the library, test developers choose which infrastructure to use, which network services and test VNFs to launch, how to interconnect them, how to trigger the test process and inspect, verify and validate the output against the expected values and conditions. Test developers can use network service packages to deploy services or can compose them directly in a test code.
- Ubuntu 16.04+
- python 2.7
VIM-EMU is a light-weight emulation platform that is used by the library to run tests locally. Detailed describtion and installation instructions can be found on the project page: https://osm.etsi.org/wikipub/index.php/VIM_emulator.
git clone https://github.com/sonata-nfv/tng-sdk-test.git
cd tng-sdk-test
python2 setup.py install
or
pip2 install git+https://github.com/sonata-nfv/tng-sdk-test
A simple example of library usage:
from tangotest.vim.emulator import Emulator
with Emulator() as vim:
client = vim.add_instance_from_source('client', './client_vnf', ['emu0'])
server = vim.add_instance_from_source('server', './server_vnf', ['emu0'])
vim.add_link('client', 'emu0', 'server', 'emu0')
cmd = 'curl {}'.format(server.get_ip('emu0'))
exec_code, output = client.execute(cmd)
assert exec_code == 0
assert output == 'Hello World!'
You can use UnitTest or pytest to manage your test cases.
Note: Tests need to be run with sudo
.
See examples folder of this repository for more examples.
This 5GTANGO component is published under Apache 2.0 license. Please see the LICENSE file for more details.
The following lead developers are responsible for this repository and have admin rights. They can, for example, merge pull requests.
- Askhat Nuriddinov (@askmyhat)
- Mailing list sonata-dev-list
- Gitter room