osm ns bundle #8

Supports: None

Network Service Primitives (Experimental)

This bundle is composed of three charms:

  • ns, using the experimental osm-ns base layer, which allows a Network Service charm to orchestrate action execution across charms within a model.
  • vnf-user, which mimics a user database
  • vnf-policy, which mimics a policy management database


A complex VNF may be composed of many individual components. Relations are used to handle repeatable operations efficiently, but what about operator-driven operations?

This is the question what Network Service (NS) primitives aims to answer.

Consider that you have a VNF that contains two charms: user management and policy.

In order to add a subscriber, you need to add the user and then their policy. You could manually execute the Service Primitives (Juju Actions), but to do so in an automated fashion you need something that understands how to talk to both charms.

Enter the concept of a "Network Service" charm.


The ns charm exposes an action named add-user that accepts four parameters: - username - bw - qos - tariff

The vnf-user charm exposes an action named add-user that accepts two parameters: - username - tariff

The vnf-policy charm exposes an action named set-policy that accepts three parameters: - user_id - bw - qos

When ns.add-user is executed, it will first call vnf-user.add-user, passing username and tariff. If successful, this will return the ID of the user.

Next, the ns charm will execute vnf-policy.set-policy, passing user_id, bw, and qos.

If either action fails, ns.add-user will fail. Otherwise, it will return successfully.


Once this bundle is deployed to Juju, you can use the below commands to manually execute the NS primitive, which is contained in the ns charm.

juju add-model ns-demo
juju deploy cs:~aisrael/bundle/osm-ns-bundle

# Run the NS primitive
$ juju run-action ns/0 add-user username=adam tariff=1 bw=2 qos=3
Action queued with id: 691dbfd6-46c5-4d21-8a7c-fbd3849e33a5

# Check the status of the primitive. Once it's complete we can view its output.
$ juju show-action-status 691dbfd6-46c5-4d21-8a7c-fbd3849e33a5
- action: add-user
  completed at: "2019-02-05 09:50:56"
  id: 691dbfd6-46c5-4d21-8a7c-fbd3849e33a5
  status: completed
  unit: ns/1

# The output of the primitive contains information provided by the NS charm, which it received from the VNF charms.

$ juju show-action-output 691dbfd6-46c5-4d21-8a7c-fbd3849e33a5
  policy-set: '{''updated'': ''True''}'
  user-id: "63"
status: completed
    completed: 2019-02-05 09:50:56 +0000 UTC
    enqueued: 2019-02-05 09:50:26 +0000 UTC
    started: 2019-02-05 09:50:29 +0000 UTC

Known Limitations and Issues

Because the Network Service charm maps to specific actions within the other charms, the NS charm is not very robust. It knows how to execute specific actions, and does not currently support a way to dynamically learn or be informed of which actions to call for which function.