summaryrefslogtreecommitdiffstats
path: root/docs/testing/user/userguide/vnf_test_guide.rst
blob: 63ed04bf510646bfe5ce15d5f5288eac4f65732f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
.. (c) OPNFV, Huawei Technologies Co.,Ltd and others.

=========================================
Conducting ONAP VNF Testing with Dovetail
=========================================

Overview
--------

As the LFN verification framework, Dovetail covers ONAP VNF tests by integrating
VNF SDK and VVP. This guide introduces only how to use Dovetail to run the tests.
For more details about VNF SDK and VVP, please refer to `ONAP VNF SDK Compliance Verification Program
<https://docs.onap.org/en/latest/submodules/vnfsdk/model.git/docs/files/VNFSDK-LFN-CVC.html>`_
and `ONAP VVP <https://docs.onap.org/en/latest/submodules/vvp/documentation.git/docs/index.html>`_.


Definitions and abbreviations
-----------------------------

- LFN - Linux Foundation Networking
- ONAP - Open Network Automation Platform
- VNF - Virtual Network Function
- SDK - Software Development Kit
- VVP - VNF Validation Program


Environment Preparation
-----------------------

Currently, there are only VNF package validation tests which do not rely on the
ONAP deployment. As a result, the preparation is very simple.


Install Docker
^^^^^^^^^^^^^^

The main prerequisite software for Dovetail is Docker. Please refer to `official
Docker installation guide <https://docs.docker.com/install/>`_ which is relevant
to your Test Host's operating system.


Install VNF SDK Backend (optional)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If it is TOSCA based VNF, then VNF SDK Backend must be installed before the
tests. There is a `docker-compose.yml` in VNFSDK repo which runs 2 docker containers. Use
the following commands to run the containers:

.. code-block:: bash

   $ export NEXUS_DOCKER_REPO=nexus3.onap.org:10001
   $ export REFREPO_TAG=1.2.1-STAGING-20181228T020411Z
   $ export POSTGRES_TAG=latest
   $ export MTU=1450
   $ wget https://raw.githubusercontent.com/onap/vnfsdk-refrepo/master/vnfmarket-be/deployment/install/docker-compose.yml
   $ sudo docker-compose up -d


The command `docker ps` can be used to check if the 2 containers named
'refrepo' and 'postgres' are running.

The VNF package to be tested should be copied to the container 'refrepo'.

.. code-block:: bash

   $ sudo docker cp /path/to/VNF/name.csar refrepo:/opt


Run Tests with Dovetail
^^^^^^^^^^^^^^^^^^^^^^^

For convenience and as a convention, we will create a home directory for storing
all Dovetail related config files and results files:

.. code-block:: bash

   $ mkdir -p ${HOME}/dovetail
   $ export DOVETAIL_HOME=${HOME}/dovetail


For example, here we set Dovetail home directory to be ``${HOME}/dovetail``.
Afterwards, we will create a directory named ``pre_config`` inside this directory
to store all Dovetail config related files and a directory named ``results``, where
test results are going to be saved:

.. code-block:: bash

   $ mkdir -p ${DOVETAIL_HOME}/pre_config
   $ mkdir -p ${DOVETAIL_HOME}/results


There should be a file `env_config.sh` inside this directory to provide some info.
For TOSCA based VNFs, it should look like this:

.. code-block:: bash

   $ cat ${DOVETAIL_HOME}/pre_config/env_config.sh
   export HOST_URL="http://<docker host ip>:8702"
   export CSAR_FILE="/path/to/VNF/copied/in/container/name.csar"


For HEAT based VNFs, the user should copy an archive of the HEAT template VNF
packages to `pre_config`. The archive must be in gzip tar (tar.gz) format.
In addition, the archive must contain only a directory with the same name
(e.g. vnf_a.tar.gz must only include a directory named vnf_a).

Configuration file `env_config.sh` should look like this for HEAT based VNFs:

.. code-block:: bash

   $ cat ${DOVETAIL_HOME}/pre_config/env_config.sh
   export VNF_ARCHIVE_NAME="vnf_archive_name"


Use the command below to create a Dovetail container and get access to its shell:

.. code-block:: bash

   $ sudo docker run --privileged=true -it \
             -e DOVETAIL_HOME=$DOVETAIL_HOME \
             -v $DOVETAIL_HOME:$DOVETAIL_HOME \
             -v /var/run/docker.sock:/var/run/docker.sock \
             opnfv/dovetail:<tag> /bin/bash


The ``-e`` option sets the DOVETAIL_HOME environment variable in the container
and the ``-v`` options mount files from the Test Host to the destination path
inside the container. The latter option allows the Dovetail container to read
the configuration files and write result files into DOVETAIL_HOME on the Test
Host. The user should be within the Dovetail container shell, once the command
above is executed. In order to run ONAP VNF tests 'latest' <tag> must be used.

Run VNF tests with the following command:

.. code-block:: bash

   $ dovetail run --testsuite <suite name> -d


For TOSCA based VNFs, `<suite name>` is `onap.tosca.2019.04` and for
HEAT based ones, it is `onap.heat.2019.04`.


NOTE: If Dovetail run fails when testing `onap-vtp.validate.csar`, then follow the
below guidelines to run the test again.

.. code-block:: bash

   $ sudo docker exec -it refrepo bash
   $ export OPEN_CLI_HOME=/opt/vtp
   $ cd $OPEN_CLI_HOME/bin
   $ ./oclip-grpc-server.sh
   $ #Exit docker by running CTRL+p+q