This guide is geared to provide information regarding how to do service design to automate instantiation and day0 configuration.
Installation
ONAP is meant to be deployed within a Kubernetes environment. Hence, the de-facto way to deploy CDS is through Kubernetes.
ONAP also package Kubernetes manifest as Chart, using Helm.
Prerequisite
https://docs.onap.org/en/latest/guides/onap-developer/settingup/index.html
Setup local Helm
Get the chart
Make sure to checkout the release to use, by replacing $release-tag
in bellow command
Install CDS
Result
Design time
Bellow are the requirements to enable automation for a service within ONAP.
For instantiation, the goal is to be able to automatically resolve all the HEAT environment variables, called cloud parameters.
For post-instantiation, the goal is to configure the VNF with initial configuration.
Prerequisite
Gather what you need:
- Identify which resources are static and dynamic
Create and fill-in the a table for all the dynamic values
While doing so, identify the resources using the same process to be resolved; for instance, if two IPs has to be resolved through the same IPAM, the process the resolve the IP is the same.
Here are the information to capture for each dynamic cloud parameters
Data dictionary
For each unique identified dynamic resource, along with all their ingredients, we need to create a data dictionary.
Here are the modeling guideline: CDS Modeling Concepts
FIX ME - add generic DD model
Bellow are examples of data dictionary for each resource source
Value will be pass as input.
{ "tags": "unit-number", "name": "unit-number", "property": { "description": "unit-number", "type": "string" }, "updated-by": "adetalhouet", "sources": { "input": { "type": "source-input" } } }
Value will be defaulted.
{ "tags": "prefix-id", "name": "prefix-id", "property" :{ "description": "prefix-id", "type": "integer" }, "updated-by": "adetalhouet", "sources": { "default": { "type": "source-default" } } }
Value will be resolved through REST.
Modeling reference: CDS Modeling Concepts
In this example, we're making a POST request to an IPAM system with no payload.
Some ingredients are required to perform the query, in this case, $prefixId
. Hence It is provided as an input-key-mapping
and defined as a key-dependencies.
Please refer to the modeling guideline for more in depth understanding.
As part of this request, the expected response will be as bellow. What is of interest is the address
field, as this is what we're trying to resolve.
To tell the resolution framework what is of interest in the response, the path
property can be used, which uses JSON_PATH, to get the value.
{ "tags" : "oam-local-ipv4-address", "name" : "create_netbox_ip", "property" : { "description" : "netbox ip", "type" : "dt-netbox-ip" }, "updated-by" : "adetalhouet", "sources" : { "primary-config-data" : { "type" : "source-rest", "properties" : { "type" : "JSON", "verb" : "POST", "endpoint-selector" : "ipam-1", "url-path" : "/api/ipam/prefixes/$prefixId/available-ips/", "path" : "/address", "input-key-mapping" : { "prefixId" : "prefix-id" }, "output-key-mapping" : { "address" : "address" }, "key-dependencies" : [ "prefix-id" ] } } } }
Value will be resolved through a database.
Modeling reference: CDS Modeling Concepts
In this example, we're making a SQL to the primary database.
Some ingredients are required to perform the query, in this case, $vfmoudleid
. Hence It is provided as an input-key-mapping
and defined as a key-dependencies.
Please refer to the modeling guideline for more in depth understanding.
As part of this request, the expected response will be as put in value
. In the output-key-mapping
section, that value will be mapped to the expected resource name to resolve.
{ "name": "vf-module-type", "tags": "vf-module-type", "property": { "description": "vf-module-type", "type": "string" }, "updated-by": "adetalhouet", "sources": { "primary-db": { "type": "source-primary-db", "properties": { "type": "SQL", "query": "select sdnctl.demo.value as value from sdnctl.demo where sdnctl.demo.id=:vfmoduleid", "input-key-mapping": { "vfmoduleid": "vf-module-number" }, "output-key-mapping": { "vf-module-type": "value" }, "key-dependencies": [ "vf-module-number" ] } } } }
Value will be resolved through a the execution of a script.
Modeling reference: CDS Modeling Concepts
In this example, we're making use of a Python script.
Some ingredients are required to perform the query, in this case, $vf-module-type
. Hence It is provided as a key-dependencies.
Please refer to the modeling guideline for more in depth understanding.
As part of this request, the expected response will set within the script itself.
{ "tags": "interface-description", "name": "interface-description", "property": { "description": "interface-description", "type": "string" }, "updated-by": "adetalhouet", "sources": { "capability": { "type": "source-capability", "properties": { "script-type": "jython", "script-class-reference": "Scripts/python/DescriptionExample.py", "instance-dependencies": [], "key-dependencies": [ "vf-module-type" ] } } } }
The script itself is as follow. The key is to have the script class derived from the framework standards.
In the case of resource resolution, the class to derive from is AbstractRAProcessor
It will give the required methods to implement: process
and recover
, along with some utility functions,
such as set_resource_data_value
or addError
.
These functions either come from the AbstractRAProcessor
class, or from the class it derived from.
FIX ME - give more information about scripting
Workflows
The following workflows are contracts established between SO, SDNC and CDS to cover the instantiation and the post-instantiation use cases.
resource-assignment
This action is meant to assign resources needed to instantiate the service. The goal is to resolved all the HEAT environment variables.
This action is triggered by Generic-Resource-API (GR-API) within SDNC as part of the AssignBB orchestrated by SO. Hence it will be triggered for each VNF(s) and VF-Module(s).
In order to know for which entity the action is triggered, one input is required, that is the artifact prefix (see bellow for explanation).
artifacts
For each VNF and VF-Module comprising the service, a combinaison of a template and mapping is needed.
The requirement is as follow for VNF:
${vnf-name}-template
${vnf-name}-mapping
and as follow for VF-Module, where the vf-module-label
is actually the name of the HEAT template file.
${vf-module-label}-template
${vf-module-label}-mapping
${vnf-name}
and ${vf-module-label}
is what we call the artifact prefix.
template
The template has to be a resource accumulator template; that be composed of the following sections:
resource-accumulator-resolved-data: defines all the resources that can be resolved directly from the context. It expresses a direct mapping between the name of the resource and its value.
capability-data: defines what capability to use to create a specific resource, along with the ingredients required to invoke the capability and the output mapping.
scripts
If any of the mapping uses a source capabbility to resolve a parameters.
config-assign
This action is meant to assign all the resources and mesh the templates needed for the configuration to apply post-instantiation.
This action is triggered by SO during after the AssignBB has been executed for Service, VNF and VF-Module.
artifacts
Combinaison of templates with respective mappings
Scripts if needed
config-deploy
This action is meant to push the configuration templates defined during the config-assign step for the post-instantiation.
This action is triggered by SO during after the CreateBB has been executed for all the VF-Modules.
artifacts
Combinaison of templates with respective mappings
Scripts using Netconf or Restconf to push configure the network element