TOSCA CSAR on-boarding

This tutorial is more advanced and expects that you already know what TOSCA is and how a Virtual Network Function Descriptor or a Network Service Descriptor defined in the TOSCA format is structured. The Cloud Service Archive CSAR is a package defined by OASIS TOSCA standard. It is a compressed file that includes a TOSCA template of a Network Service, and all the scripts or files that a VNF needs for the lifecycle time from creation to termination. The CSAR is a zip file with this structure:

├── Definitions
|   └── testNSDiperf.yaml
├── Scripts
|   ├── install.sh   
|   └── (VNF TYPE)
|        └── script.sh 
└── TOSCA-Metadata
    ├── Metadata.yaml
    └── TOSCA.meta

The CSAR reader can read both NSDs and VNFDs written in TOSCA. The difference is, that when reading a NSD it will onboard all VNFs included in the NSD and after that the NSD itself.

The TOSCA.meta file contains a reference to the template in this case Entry-Definitions: Definitions/testNSDIperf.yaml and versions of the CSAR package and the Meta-File version .

TOSCA-Meta-File-Version: 1.0
CSAR-Version: 1.1
Created-By: Fokus
Entry-Definitions: Definitions/testNSDIperf.yaml

The Metadata.yaml defines essential properties for the VNF or VNFs and every CSAR has to include one. For more information on how to create such a file refer to the VNF Package tutorial. This is a simple example:

name: NSDExample
image:
    upload: false
    names:
        - ubuntu-14.04-server-cloudimg-amd64-disk1
vim_types:
    - openstack

The Scripts folder contains all the files required from the lifecycle interfaces of the VNFs. If the CSAR has a Network Service Template, then for every type of VNF included in the NS Template you have to include a folder with the scripts for that particular type. Example if one VNF is of type client, then the scripts for that VNF have to be put in Scripts/client folder.

In this example testNSDIperf.yaml is a template for a Network Service. In a CSAR the template can define either a Virtual Network Function or a Network Service that consists of multiple Virtual Network Functions. The VNF Tosca tutorial and NS Tosca tutorial provide more information on how to construct a template of each kind.

tosca_definitions_version: tosca_simple_profile_for_nfv_1_0
description: Example of NSD

metadata:
  ID: NSD-Iperf
  vendor: Fokus
  version: 1.0

topology_template:

  node_templates:

    iperf-server: #VNF1
        type: openbaton.type.VNF
        properties:
          vendor: Fokus
          version: 1.0
          endpoint: generic
          type: server
          vnfPackageLocation: https://github.com/openbaton/vnf-scripts.git
          deploymentFlavour:
            - flavour_key: m1.small
        requirements:
          - virtualLink: private
          - vdu: VDU2
        interfaces:
          lifecycle: # lifecycle
            instantiate:
              - install.sh
              - install-srv.sh

    iperf-client:
      type: openbaton.type.VNF
      properties:
        ID: x
        vendor: Fokus
        version: 1.0
        type: client
        vnfPackageLocation: https://github.com/openbaton/vnf-scripts.git
        deploymentFlavour:
          - flavour_key: m1.small
        endpoint: generic
      requirements:
         - virtualLink: private
         - vdu: VDU1
      interfaces:
          lifecycle: # lifecycle
            INSTANTIATE:
              - install.sh
            CONFIGURE:
              - server_configure.sh

    VDU1:
      type: tosca.nodes.nfv.VDU
      properties:
        scale_in_out: 1
      artifacts:
        VDU1Image:
          type: tosca.artifacts.Deployment.Image.VM
          file: ubuntu-14.04-server-cloudimg-amd64-disk1

    VDU2:
      type: tosca.nodes.nfv.VDU
      properties:
        scale_in_out: 3
      requirements:
        - virtual_link: CP2
      artifacts:
        VDU2Image:
          type: tosca.artifacts.Deployment.Image.VM
          file: ubuntu-14.04-server-cloudimg-amd64-disk1

    CP1:
      type: tosca.nodes.nfv.CP
      properties:
        floatingIP: random
      requirements:
        - virtualBinding: VDU1
        - virtualLink: private

    CP2: #endpoints of VNF2
      type: tosca.nodes.nfv.CP
      requirements:
        - virtualBinding: VDU2
        - virtualLink: private

    private:
      type: tosca.nodes.nfv.VL
      properties:
        vendor: Fokus

relationships_template:
  connection_server_client:
    type: tosca.nodes.relationships.ConnectsTo
    source: iperf-server
    target: iperf-client
    parameters:
        - private

Saving as CSAR

To save the three folders - Scripts, Definitions, TOSCA-Metadata as a CSAR go to the folder where you have saved them and run:

zip -r iperf.csar . -x ".*" -x "*/.*"

Onboarding VNF CSARs

Go to the Catalogue -> VNF Packages ->Upload VNF Package(s), check the "Use CSAR Parser" box and select the csar that you want to upload.

Drag&Drop modal

Onboard Network Service CSARs

Go to the Catalogue -> NS Descriptors and click on "On Board NSD -> Upload CSAR" and select the file.