This is not published to gerrit yet.
About
This page contains instructions for executing the VNF Lifecycle Validation automation flow for heat-based VNFs. The result will be a .tar.gz file that can be used to submit to the OVP Portal to obtain a certification badge for a VNF. The execution is very similar to running the other ONAP demo VNFs, however there are some additional steps detailed below.
Prerequisites
- ONAP deployed via OOM.
- An OpenStack deployment.
- kubectl
- bash
- VNF Heat Templates
- Preload json files
After deploying ONAP, you need to configure ONAP with:
- A cloud owner
- A cloud region
- A subscriber
- A service type
- A project name
- An owning entity
- A platform
- A line of business
- A cloud site
If you're not familiar with how to configure ONAP, there are guides that use robot or direct api requests available to help, as well as a guide for adding a new OpenStack site to ONAP.
Preparing the VNF
The vnf lifecycle validation testsuite requires the VNF to be packaged into a specific directory hierarchy, shown below.
vnf_folder ├── /templates | ├── base.yaml | ├── base.env | └── incremental_0.yaml | └── incremental_0.env | └── ... ├── /preloads | ├── base_preload.json | └── incremental_0_preload.json | └── ... └── vnf-details.json
- The name for vnf_folder is free-form, and can be located anywhere on your computer. The path to this folder will be passed to the testsuite as an argument.
- /templates should contain your VVP-compliant VNF heat templates.
- /preloads should contain a preload file for each VNF module (TODO: add link to preload documentation).
- For a VNF-API preload: vnf-name, vnf-type, generic-vnf-type, and generic-vnf-name should be empty strings.
- For a GR-API preload: vnf-name, vnf-type, vf-module-type, and vf-module-name should be empty strings.
- This information will be populated at runtime by the testsuite.
- vnf-details should be a json file with the information that will be used by ONAP to instantiate the VNF. The structure of vnf-details is shown below.
vnf-details.json
{ "vnf_name": "The Vnf Name", "description": "Description of the VNF", "modules": [ { "filename": "base.yaml", "isBase": "true", "preload": "base_preload.json" }, { "filename": "incremental_0.yaml", "isBase": "false", "preload": "incremental_0.json" }, ... ], "api_type": "[gr_api] or [vnf_api]", "subscriber": "<subscriber name>", "service_type": "<service type>", "tenant_name": "<name of tenant>", "region_id": "<name of region>", "cloud_owner": "<name of cloud owner>", "project_name": "<name of project>", "owning_entity": "<name of owning entity>", "platform": "<name of platform>", "line_of_business": "<name of line of business>", "os_password": "<openstack password>" }
- modules must contain an entry for each module of the VNF. Only one module can be a base module.
- api_type should match the format of the preloads that are provided in the package.
- The other information should match what was used to configure ONAP during the pre-requisite section of this guide.
Running the testsuite
The script to execute the testsuite is located in the OOM project. Clone the OOM repository and cd to the robot folder.
$ git clone https://github.com/onap/oom.git $ cd oom/kubernetes/robot $ ./instantiate-k8s.sh --help ./instantiate-k8s.sh [options] required: -n, --namespace <namespace> namespace that robot pod is running under. -f, --folder <folder> path to folder containing heat templates, preloads, and vnf-details.json. additional options: -p, --poll some cloud environments (like azure) have a short time out value when executing kubectl. If your shell exits before the testsuite finishes, using this option will poll the testsuite logs every 30 seconds until the test finishes. -t, --tag <tag> robot testcase tag to execute (default is instantiate_vnf). This script executes the VNF instantiation robot testsuite. - It copies the VNF folder to the robot container that is part of the ONAP deployment. - It models, distributes, and instantiates a heat-based VNF. - It copies the logs to an output directory, and creates a tarball for upload to the OVP portal. $ ./instantiate-k8s.sh --namespace onap --folder /tmp/vnf-instantiation/examples/VNF_API/pass/multi_module/ --poll ... ... ... ... ------------------------------------------------------------------------------ Testsuites.Vnf Instantiation :: The main driver for instantiating ... | PASS | 1 critical test, 1 passed, 0 failed 1 test total, 1 passed, 0 failed ============================================================================== Testsuites | PASS | 1 critical test, 1 passed, 0 failed 1 test total, 1 passed, 0 failed ============================================================================== Output: /share/logs/0003_ete_instantiate_vnf/output.xml + set +x testsuite has finished Copying Results from pod... /tmp/vnf-instantiation /tmp/vnf-instantiation a log.html a results.json a stack_report.json a validation-scripts.json /tmp/vnf-instantiation VNF test results: /tmp/vnfdata.46749/vnf_heat_results.tar.gz
The testsuite takes about 10-15 minutes for a simple VNF, and will take longer for a more complicated VNF.
Once the testsuite is finished, it will create a directory and tarball in /tmp (the name of the directory is shown at the end of the stdout of the script). There will be a results.json in that directory that has the ultimate outcome of the test, in the structure shown below.
results.json
This structure is not finalized, and may change.
{ "vnf_checksum": "xxxx", "build_tag": "vnf-validation-46749", "version": "2019.09", "test_date": "2019-08-26 22:38:47.884", "duration": 867.973, "vnf_type": "heat", "testcases_list": [ { "mandatory": "true", "name": "onap-vvp.validate.heat", "result": "PASS", "objective": "onap heat template validation", "sub_testcase": [], "log_file": "validation-scripts.json" }, { "objective": "onap vnf lifecycle validation", "sub_testcase": [ { "log_file": "log.html", "name": "model-and-distribute", "result": "PASS" }, { "log_file": "log.html", "name": "instantiation", "result": "PASS" }, { "log_file": "stack_report.json", "name": "stack_validation", "result": "PASS" } ], "mandatory": "true", "name": "onap-vvp.lifecycle_validate.heat", "result": "PASS" } ] }
If the result is "PASS", that means the testsuite was successful and the tarball is ready for submission to the OVP portal.