Skip to content

sonata-nfv/tng-sdk-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Join the chat at https://gitter.im/sonata-nfv/Lobby Documentation Status Build Status

tng-sdk-test

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.

Requirements

  • Ubuntu 16.04+
  • python 2.7

Dependencies

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.

Installation

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

Usage

Documentation

Examples

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.

License

This 5GTANGO component is published under Apache 2.0 license. Please see the LICENSE file for more details.


Lead Developers

The following lead developers are responsible for this repository and have admin rights. They can, for example, merge pull requests.

Feedback-Channel