VNF Primitive Config
From OSM Public Wiki
The purpose of the Config primitive is to change the configuration your VNF application.
| Config | Required | ||
|---|---|---|---|
| Day 0 | Day 1 | Day 2 | |
| No | Yes | Yes | No |
The Config Primitive is handled differently than Service Primitives.
The configuration parameters you'd like to make available for modification are defined in the VNF Charm's config.yaml:
options:
target_latency:
default: 100000
description: Target request latency for overload control (microseconds)
type: int
The configuration is then exposed to the operator via the VNF Descriptor:
Example code:
@when('config.changed')
def apply_vnf_config():
"""Runs when the config-changed hook is executed."""
err = ''
try:
cfg = config()
"""
Run the command(s) necessary to perform a safe stop of your VNF
This could be a single command that encapsulates your stop process...
"""
result, err = charms.sshproxy._run("/srv/myvnf/config.sh target_latency={}".format(cfg['target_latency']))
except:
action_fail('Restart failed:' + err)
else:
action_set({'outout': result})
# Restart your VNF for the change to take affect, if necessary.
restart_vnf()
For a full example of creating a VNF charm, please see Creating your own VNF charm (Release FOUR).