Setting up a Project
The first step in developing a VNF is to create a VNF project and make available any software images for the target virtual environment.
Create VNF Project
On your development environment, you create a VNF project by running the following LMCTL command command in the folder you want the VNF to be created in:
lmctl project create --servicetype VNF --vnfc vnfcA --vnfc vnfcB ./myvnf
This creates a VNF directory structure for the VNF and includes the vnfcA and vnfcB subfolders.
The result of this is a VNF directory structure that is created that should look like this:
├── Descriptor │ └── assembly.yml ├── VNFCs │ └── vnfcA │ └── vnfcB └── lmproject.yml
In the example vnfcA folder, the following subfolders should be created (we will populate these in the next sections):
└── vnfcA ├── VDUs (if available) ├── descriptor ├── lifecycle
Project structure explanation
A top level project structure can have the following artifacts:
|Descriptor||Yes||This directory must contain a descriptor file called “assembly.yml”, representing the top level VNF or Network Service. The descriptor is pushed to Stratoss LM|
|Behaviour||optional||This optional directory contains the Assembly Templates and Scenarios used by Stratoss LM scenarios|
|Behaviour/Tests||optional||This optional directory contains the Test Scenarios. These are pushed to Stratoss LM automatically|
|Behaviour/Templates||optional||This optional directory contains the Assembly Templates. These are pushed to Stratoss LM automatically|
|Behaviour/Runtime||optional||This optional directory contains the Runtime Scenarios, such as Diagnostic tests. These are pushed to Stratoss LM automatically|
|VNFCs||optional||This optional directory can contain one or more VNFCs, each VNFC is packaged and automatically pushed to Ansible RM|
VNFC directory structure
A VNFC has a specific set of directory and file requirements in order to make it usable with the Ansible RM, they are as follows:
|descriptor||Yes||must contain a Resource descriptor file called
|lifecycle||Yes||must contain valid ansible playbooks for each supported lifecycle: Install.yml, Start.yml, Configure.yml, Stop.yml, Uninstall.yml|
|Meta-Inf||Yes||must contain a mainifest.MF file with details of the VNFC, see example below|
The manifest.MF file must contain the name of the VNFC, its version and the resource manager. The name must match the name of the VNFC resource descriptor name, and the VNFC directory
name: docker-network version: 1.0 resource-manager: docker
Every project should include a
lmproject.yml file at root. This file should include definitions of the VNFCs and their target RM package type (example below):
name: ippbx vnfcs: definitions: asterisk-vnfc: directory: asterisk-vnfc packages: ansible-rm-vnfcs: packaging-type: ansible-rm executions: - vnfc: asterisk-vnfc
This file will be auto-generated on first run, however you should remember to add new VNFCs to this file if created later
Create Image from VDU for each VNFC
The next step is to create an image from VDU for each VNFC. A VDU is responsible for creating images that contains the required software for the VNFC and the target virtual infrastructure. The first time an instance of a VDU is requested for a location the image will be pulled from the file repository, in our case Nexus. Subsequent instantiations will use the image that already exists.
Very often ready-made images are provided by the VNF vendors for specific target platforms and no VDU is available. In this case, you don’t use the VDU folder in the VNFC and simply specify the link to the image on Nexus in the VNFC descriptor as below.
image: type: string description: "the image name for target VIM" default: image location (in Nexus)
If the vendor does not provide ready-made images, tools such as Packer can be used to create Images from the VDU for different target VIMs. These images will contain the base software for the virtual machine to run and should be stored in Nexus. VDUs will need built images to be distributed to the various environments.
Uploading an image instructions can be found here
Commit, Create and Push Project to GIT
Commit the package
$ cd ./myvnf $ git init $ echo "_lmctl" > .gitignore $ git add . $ git commit -m 'initial project'
Create the project on Git Server (Gogs)
Go to Gogs on the CI/CD Hub
- log in as admin
- create “+ New Repository” named the same as your local project (e.g. “myvnf”)
- select the organisation (e.g. ‘marketplace’)
- Note the commands that Gogs gives you for ‘Push an existing repository from the command line’ and use them in the next step.
Push project to Gogs
On your local machine:
$ git remote add origin http://<gogs ip address>:8001/cicdhub-admin/myvnf.git $ git push -u origin master
Create git develop branch
$ git checkout -b develop
- On Gogs, goto the project, select settings and collaboration
- ‘Add New Collaborator’ for jenkins and any user you wish to be able the make changes. You are now ready to start developing and testing your new project.
Push Project to Dev Environment
The VNF project needs to be pushed to the development environment. Run the following command in the project directory (assuming “dev” is the name of the environment you want to push the VNF to):
$ cd <myvnf dir> $ lmctl project push dev
When you login to Stratoss™ Lifecycle Manager (LM) and go to the Assembly Designer section, you should see an assembly with the VNF name you created.