This is an example of an Open Source Mano (OSM) Network Service (ns) charm. This is an **experimental** feature, expected to be released with OSM R6 in the spring of 2019.
This allows a charm to coordinate the execution of [actions] across multiple charms within a model.
# Usage
# Application Names
Each deployed application is named using a set of runtime variables, such as the network service name, the vnf or vdu name, and the vnf-member-index. Because of that, we'll need to provide those values to the NS charm through its configuration.
# Configuration
The `config.yaml` file contains a mapping of properties that will be passed from OSM to your deployed charm. Some of those properties are automatically included by the underlying `osm-ns` layer:
- juju-username
- juju-password
You'll need to pass the name of the network service that you deployed. Even though your network service may be named `nscharm` in the descriptor, the operator provides a name at instantiation time, and `osm-ns` needs this name in order to resolve the application names. You can call it anything you like, as long as it's consistent between the NS charm and the NS Descriptor.
For each VNF or VDU with a charm you wish to interact with, you need to also pass it's id from the VNF Descriptor. Again, you can call this anything you like, as long as it's consistent between the NS charm and NS Descriptor.
`config.yaml`:
```yaml
options:
nsr-name:
default:
description:The runtime name of the Network Service, i.e., what its deployed name is.
type:string
user-member-index:
default:
description:The vnf-member-index of the user VNF.
type:string
user-vdu-id:
default:
description:The id of the VDU containing the charm.
type:string
policy-member-index:
default:
description:The vnf-member-index of the policy VNF.
type:string
policy-vdu-id:
default:
description:The id of the VDU containing the charm.
type:string
```
# NS Descriptor
The NS descriptor contains a new `ns-configuration` element, similar to that of `vnf-configuration` and `vdu-configuration` available in VNF descriptors.
The key here is to pass the juju credentials from your environment, available in `~/.local/share/juju/accounts.yaml`. This enables the charm to speak directly to Juju, via the `osm-ns` layer.
Next, you must map the runtime parameters of your Network Service so that the charm is aware of your topology.
Lastly, you can then define the primitives, under `config-primitive`, to be available to the operator for day-2 operation.
```yaml
ns-configuration:
juju:
charm:ns
initial-config-primitive:
-seq:'1'
name:config
parameter:
# Configure Juju credentials
-name:juju-username
value:'admin'
-name:juju-password
value:'50b4491a7a42d3542e317e3ae94c6c96'
# Set the runtime name of the network service
-name:nsr-name
value:'test'
# For each vnf, map the vnf-member-index and vdu-id
d="m 46.702703,898.22775 50.594594,0 C 138.16216,898.22775 144,904.06497 144,944.92583 l 0,50.73846 c 0,40.86071 -5.83784,46.69791 -46.702703,46.69791 l -50.594594,0 C 5.8378378,1042.3622 0,1036.525 0,995.66429 L 0,944.92583 C 0,904.06497 5.8378378,898.22775 46.702703,898.22775 Z"
d="m -268,700.15563 0,-33.72973 c 0,-27.24324 3.88785,-31.13513 31.10302,-31.13513 l 33.79408,0 c 27.21507,0 31.1029,3.89189 31.1029,31.13513 l 0,33.72973 c 0,27.24325 -3.88783,31.13514 -31.1029,31.13514 l -33.79408,0 C -264.11215,731.29077 -268,727.39888 -268,700.15563 Z"