Day-1 and Day-2 VNF Operations

Day-1 vs Day-2

  • Day-1 is when you provide the guidelines to include all necessary elements in the VNF package to allow the services to be automatically initialized.
  • Day-2 operations are designed to provide maintenance, like reconfiguration of services and monitoring.

Code Used

This tutorial uses code from previous tutorials:

  • VNF developed in “Build your VNF from scratch”
  • Juju Charm developed in “Introducing OSM primitives and Juju Charms”

Both are available here.

Code modifications

Basic structure

The first step is to download the resources from the previous tutorials.

Notice that you are recreating the content of mod/operator and mod/charms.osm. This is not entirely mandatory, but if you don`t do this you might encounter some problems later, since the content of theses two directories was added via a git submodule.

After running these commands, you should have the following structure (using the tree command):

VNF Descriptor

file: tutorial_vnf/tutorial_vnfd.yaml

Add the following content:

  • Day 1 and day 2 operations are configured inside the tag lcm-operations-configuration.
  • You need to map the primitives inside the config-primitive tag, as well as reference the vnf id.
  • You also need to add the execution environment, with the reference to the connection point.
  • After that, you need to define that this will be a proxy charm and add the ssh configurations.
  • Notice that the ssh-hostname value (<rw_mgmt_ip>) is the tag that the OSM uses to get the vnf ip.

Actions

file: tutorial_vnf/charms/prometheus_node_exporter/actions.yaml

Add the following actions:

This actions will be defined laterin the charm file.

Charm

file: tutorial_vnf/charms/prometheus_node_exporter/src/charm.py

Add the following content inside the __init__ function:

This maps the actions to a python function.

Now, we need to add the functions:

You will need to replace the event calls with a logger, because OSM doesn’t support it when calling an action on boot.

For that, import the logging module:

Then,replace the event calls:

Next, you will need to install the python packages manually, through a function that runs ssh commands.

This is because OSM doesn’t do it automatically.

Notice that we are calling the function before importing the SSHProxyCharm class, otherwise it will fail.

After that, and since we want to automatically start the prometheus exporter once the VNF starts, we need to call it inside the VNF on_start function:

Deployment

Onboarding VNF and NSpackages

Don’t forget to replace the --hostname option with your OSM IP.

Deploying the Network Service

Debug your charm

You can check your charm deployment, inside your OSM machine, to make sure it is working:

If everything goes accordingly, you should have this:

Now, you can test if the charm performed the desired operations:

You can try to execute the primitives via the OSM UI, just go to Action > Exec primitive:

After stopping the prometheus, you shloud have this:

Now, you can invoke the start primitive and run the curl command again to make sure it starts again successfully.

Materials

For a better description of the tutorial, you can check our video here.

You can also check a PDF version of this tutorial here.