How to develop your CNF and orchestrate it through OSM

Basic Architecture

  • Open Source MANO (OSM – version 10.0.3)
  • Existing Kubernetes cluster (or check More reading, at the end, on how to setup a new cluster)

OSM requirements

  • 2CPUs
  • 6GB RAM (8 recommended)
  • 40GB Disk space
  • Single interface with internet access
  • Ubuntu 20.04 (64-bit)

Installing OSM

$ wget https://osm-download.etsi.org/ftp/osm-10.0-ten/install_osm.sh
$ chmod +x install_osm.sh
$ ./install_osm.sh
$ ./install_osm.sh --k8s_monitor (install OSM with an add-on to monitor the Kubernetes cluster)

Check the installation in the browser by accessing your host IP (by default user and password are admin).

If you need to install the latest version of OSM, you can always find the updated page on OSM official Installing OSM page.

Adding a “dummy” VIM account

$ osm vim-create --name dummy_k8s_vim --user admin --password admin \
--auth_url http://127.0.0.1/dummy --tenant admin --account_type dummy

It is also possible to add the “dummy” VIM through the OSM GUI:

Dashboard > Project > VIM Accounts > New VIM

Creating the CNF

Create CNF package

$ mkdir tutorial_knf
$ cd tutorial_knf
$ touch tutorial_vnfd.yaml

These commands create the base package for our CNF. We are defining the directory and descriptor file. Since osm package-create vnf creates a lot of boilerplate specific to VNFs and doesn’t have the option to create a CNF, we will be creating it manually.

Inside the descriptor file you should paste the following:

vnfd:
  description: A basic KNF descriptor with one KDU
  df:
  - id: default-df
  ext-cpd:
  - id: mgmt-ext
    k8s-cluster-net: mgmtnet
  id: tutorial_knf
  k8s-cluster:
    nets:
    - id: mgmtnet
  kdu:
  - name: nginx
    helm-chart: nginx
  mgmt-cp: mgmt-ext
  product-name: tutorial_knf
  version: '1.0'

Change the CNF descriptor (VNFD)

You can find the descriptor in:

tutorial_knf/tutorial_vnfd.yaml

We will start by changing the basic info to our descriptor:

  description: A basic KNF descriptor with one KDU
  id: tutorial_knf
  product-name: tutorial_knf
  version: '1.0'

As you can see, we are defining an id, description, product name and version.

Next, we want to edit our kdu and helm chart:

  kdu:
  - name: nginx
    helm-chart: bitnami/nginx

The helm-chart includes the Helm chart repo name in its name, it is explained below (Add K8s Helm Chart Repository).

Validate and Upload the CNF package

$ osm nfpkg-create tutorial_knf

This command validates and uploads the package to OSM. Make sure you input the correct CNF directory.

Add K8s Helm Chart Repository

In order for the helm chart defined in the kdu to be found, the helm chart repository where the helm chart exists needs to be added to OSM. In this specific case, for NGINX, the Bitnami Helm chart repository will be added.

The name (bitnami in the following command) is also the repo name used in the kdu.

$ osm repo-add --type helm-chart --description "Bitnami Helm chart repository" bitnami https://charts.bitnami.com/bitnami

It is also possible to add the K8s Repository through the OSM GUI:

Dashboard > Project > K8s > K8s Repos > Add K8s Repository

Alternative – Add Helm chart to the CNF package

Although not very well documented, the Helm chart can also be added inside the CNF directory and packaged together.

Inside the tutorial_knf directory you need to create a new directory helm-chart-v3s and put the chart(s) inside this directory.

$ tree tutorial_knf
tutorial_knf
├── helm-chart-v3s
│   └── nginx
│       ├── Chart.yam
│       ├── README.md
│       ├── charts
│       ├── templates
│       └── values.yaml
└── tutorial_vnfd.yaml

Keep in mind that charts inside the helm-chart-v3s directory don’t need to specify the repo name in the kdu:

  kdu:
  - name: nginx
    helm-chart: nginx

Creating the NS

Create NS packages

$ osm package-create ns tutorial

This command creates the base package for our NS.

We are defining the directory, package type and package name.

Change the NS descriptor (NSD)

You can find the descriptor in:

tutorial_ns/tutorial_nsd.yaml

We will start by changing the basic info to our descriptor:

nsd:
  nsd:
  - id: tutorial_ns
    name: tutorial_ns
    description: A basic NS with a single KNF
    version: '1.0'

As you can see, we are defining an id, name, description and version.

Then, edit the Virtual Link. The id needs to be the same as the one created.

    virtual-link-desc:
    - id: mgmtnet
      mgmt-network: true

Next, we need to connect the NS to our CNF created before:

    vnfd-id:
    - tutorial_knf

Make sure that the id is the same as the CNF.

Next, we need to establish the connections between the CNF and the VIM:

    df:
    - id: default-df
      vnf-profile:
      - id: "1"
        vnfd-id: tutorial_knf
        virtual-link-connectivity:
        - virtual-link-profile-id: mgmtnet
          constituent-cpd-id:
          - constituent-base-element-id: "1"
            constituent-cpd-id: mgmt-ext

Notice that the constituent-cpd-id is the same as the external connection point (ext-cpd) defined in the CNF descriptor. Also, vnfd-id is being repeated in vnf-profile, be sure to change it.

Also, the virtual-link-profile-id has to be the same as the one created.Although it is not necessary to, the vnf-profileid and constituent-base-element-id can be changed to a more meaningful name. Just be sure to be the same.

Validate and Upload the NS package

$ osm nspkg-create tutorial_ns

This command validates and uploads the package to OSM. Make sure you input the correct NS directory.

NS instantiation

$ osm ns-create --ns_name tutorial_ns --nsd_name tutorial_ns --vim_account dummy_k8s_vim

This command creates the instance of the network service. Notice that the –nsd_name option has to be the name of the ns package. In our case, the VIM account is called dummy_k8s_vim. Make sure that you input your Dummy VIM account.

If all goes accordingly, you should be able to see in the OSM interface that your NS instance is running and active.

You can also check if your instance is running in the Kubernetes cluster.

More reading