-------------------- To be finished --------------------
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/Helm variables, called cloud parameters.
For post-instantiation, the goal is to configure the VNF with initial configuration.
Prerequisite
Gather the cloud parameters:
Have the HEAT template along with the HEAT environment file.
or
Have the Helm chart along with the Values.yaml file
(CDS supports, but whether SO → Multicloud support for Helm/K8S is different story)
or
...
Have the configuration template to apply on the VNF.
XML for NETCONF
- JSON / XML for RESTCONF
- JSON for Ansible
- etc...
- Identify which template parameters 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: Modeling Concepts#resourceDefinition-modeling
Bellow are examples of data dictionary
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: Modeling Concepts#rest
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" : "string" }, "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" ] } } } }
primary-aai-data via type source-rest
TBD
{ "name" : "primary-aai-data", "tags" : "primary-aai-data", "updated-by" : "Steve, Siani <steve.djissitchi@bell.ca>", "property" : { "description" : "primary-aai-data", "type" : "string" }, "sources" : { "default": { "type": "source-default", "properties": { } }, "input": { "type": "source-input", "properties": { } }, "primary-aai-data" : { "type" : "source-rest", "properties": { "type": "JSON", "url-path": "$aai-port/aai/v14/network/generic-vnfs/generic-vnf/$vnf-id", "path": "", "input-key-mapping": { "aai-port": "port", "vnf-id": "vnf-id" }, "output-key-mapping": { }, "key-dependencies": [ "port", "vnf-id" ] } } } }
Value will be resolved through a database.
Modeling reference: Modeling Concepts#sql
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 the execution of a script.
Modeling reference: Modeling Concepts#Capability
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 bellow.
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.
If the resolution fail, the recover method will get called with the exception as parameter.
Value will be resolved through REST., and output will be a complex type.
Modeling reference: Modeling Concepts#rest
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
and id
fields. For the process to return these two values, we need to create a custom data-type, as bellow
The type of the data dictionary will be dt-netbox-ip
.
To tell the resolution framework what is of interest in the response, the output-key-mapping section is used. The process will map the output-key-mapping to the defined data-type.
{ "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" : "", "input-key-mapping" : { "prefixId" : "prefix-id" }, "output-key-mapping" : { "address" : "address", "id" : "id" }, "key-dependencies" : [ "prefix-id" ] } } } }
Workflows
The following workflows are contracts established between SO, SDNC and CDS to cover the instantiation and the post-instantiation use cases.
Please refer to the modeling guide to understand workflow concept: Modeling Concepts#workflow
resource-assignment
This action is meant to assign resources needed to instantiate the service, e.g. to resolve all the cloud parameters.
Also, this action has the ability to perform a dry-run, meaning that result from the resolution will be made visible to the user.
If user is fine with the result, he can proceed, else, (TDB) he will have opportunity to re-trigger the resolution.
Context
This action is triggered by Generic-Resource-API (GR-API) within SDNC as part of the AssignBB orchestrated by SO.
It will be triggered for the service, and each VNF(s) and VF-Module(s) (referred as entity bellow).
See SO Building blocks Assignment.
Steps
This is a single action type of workflow, hence the target will refer to a node_template of type component-resource-resolution
Inputs
Property | Description |
---|---|
artifact-name | This action will require resource accumulator templates for each VNF and VF-Module; this will be covered during the User Guide component explanation. These templates are identified using artifact prefix. See Modeling Concepts#template So in order to know for which entity the action is triggered, this is required as input is required. |
resolution-key | The dry-run functionality requires the ability to retrieve the resolution that has been made later point in time in the process. The combination of the artifact-name and the resolution-key will be used to uniquely identify the result. |
Output
In order to perform dry-run, it is necessary to provide the meshed resolved template as output. To do so, the use of Modeling Concepts#getAttribute expression is required.
Also, as mentioned here Modeling Concepts#resourceResolution, the resource resolution component node will populate an attribute named assignment-params with the result.
Finally, the name of the ouput has to be meshed-template so SDNC GR-API knows how to properly parse the response.
Example
Here is an example of the resource-assignment workflow:
{ "workflows": { "resource-assignment": { "steps": { "resource-assignment-process": { "description": "Resource Assign Workflow", "target": "resource-assignment-process" } }, "inputs": { "artifact-name": { "required": true, "type": "string" }, "resolution-key": { "required": true, "type": "string" }, "resource-assignment-properties": { "description": "Dynamic PropertyDefinition for workflow(resource-assignment).", "required": true, "type": "dt-resource-assignment-properties" } }, "outputs": { "meshed-template": { "type": "json", "value": { "get_attribute": [ "SELF", "assignment-params" ] } } } } } }
config-assign
This action is meant to assign all the resources and mesh the templates needed for the configuration to apply during post-instantiation (day0 config).
If user is fine with the result, he can proceed, else, (TDB) he will have opportunity to re-trigger the resolution.
Context
This action is triggered by SO after the AssignBB has been executed for Service, VNF and VF-Module. It corresponds to the ConfigAssignBB.
See SO Building blocks Assignment.
Steps
This is a single action type of workflow, hence the target will refer to a node_template of type component-resource-resolution
Inputs
Property | Description |
---|---|
resolution-key | The dry-run functionality requires the ability to retrieve the resolution that has been made later point in time in the process. The combination of the artifact-name and the resolution-key will be used to uniquely identify the result. |
Output
In order to perform dry-run, it is necessary to provide the meshed resolved template as output. To do so, the use of Modeling Concepts#getAttribute expression is required.
Also, as mentioned here Modeling Concepts#resourceResolution, the resource resolution component node will populate an attribute named assignment-params with the result.
Example
Here is an example of the config-assign workflow:
{ "workflows": { "config-assign": { "steps": { "config-assign-process": { "description": "Config Assign Workflow", "target": "config-assign-process" } }, "inputs": { "resolution-key": { "required": true, "type": "string" }, "config-assign-properties": { "description": "Dynamic PropertyDefinition for workflow(config-assign).", "required": true, "type": "dt-config-assign-properties" } }, "outputs": { "dry-run": { "type": "json", "value": { "get_attribute": [ "SELF", "assignment-params" ] } } } } } }
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.
Context
This action is triggered by SO after the CreateVnfBB has been executed. It corresponds to the ConfigDeployBB.
See SO Building blocks Assignment.
Steps
This is a single action type of workflow, hence the target will refer to a node_template of type component-netconf-executor or component-jython-executor or component-restconf-executor.
Inputs
Property | Description |
---|---|
resolution-key | Needed to retrieve the resolution that has been made earlier point in time in the process. The combination of the artifact-name and the resolution-key will be used to uniquely identify the result. |
Output
SUCCESS or FAILURE
Example
Here is an example of the config-deploy workflow:
{ "workflow": { "config-deploy": { "steps": { "config-deploy": { "description": "Config Deploy using Python (Netconf) script", "target": "config-deploy-process" } }, "inputs": { "resolution-key": { "required": true, "type": "string" }, "config-deploy-properties": { "description": "Dynamic PropertyDefinition for workflow(config-deploy).", "required": true, "type": "dt-config-deploy-properties" } } } } }
Starting from Dublin release, CDS offers a new package configuration to design the services provisioning. This section describes step by step the procedure of designing a new CBA from scratch.
The CBA package content is well described in CDS Modeling Concepts and also in Design Time section, it shows the structure of a CBA and the different definitions/artifacts. This section will be more focus on the creation of new CBA (The structure: required folder and files), and the enrichment procedure to generate the complete config file.
CBA directory and structure
├── CBA-archive-name # CBA Root Directory | └── Definitions/ │ └── CBA_configuration_file.json # CBA configuration file (Mandatory) | └── Environments/ # All environment files contained in this folder are loaded in Blueprint processor run-time │ └── env-prod.properties │ └── env-test.properties | └── Plans/ │ └── CONFIG_DirectedGraphExample.xml # Directed graph artifact | └── Scripts/ # Script used for capability resource resolution │ └── kotlin/ │ └── script_kotlin.cba.kts │ └── ansible/ │ └── ansible_file.yaml │ └── python/ │ └── SamplePython.py | └── TOSCA-Metadata/ │ └── TOSCA.meta # CBA entry point (Mandatory) | └── Templates/ │ └── example1-template.jinja # Template file that will dynamic represent a payload in some execution node (Extensions supported: .vtl and .jinja) │ └── example1-mapping.json # List of variables that will be resolved to fulfill the jinja template │ └── example2-template.vtl # Velocity Template file │ └── example2-mapping.json # Mapping file for velocity template
Fig. CBA config file structure
A. CBA configuration file sections description
The above diagram shows a simple CBA with one workflow and one node template. The following describes each section defined in CBA config file.
- CBA Metadata:
This section specify information about the CBA such as:
- The Author: Name and email
- User privileges for this self-service provisioning execution
- CBA identifier: Template name and Version (Ex. Template name: My-self-service-name, Version: 1.0.0)
- Template tags: Reference words that can be used to find this CBA.
- DSL Definition:
We define here all parameters, in JSON, needed in service provisioning.
Ex. Endpoint selector to provide remote Ansible server parameters.
"ansible-remote-endpoint" : { "type" : "token-auth", "url" : "http://ANSIBLE_IP_ADDRESS", "token" : "Bearer J9gEtMDqf7P4YsJ74fioY9VAhLDIs1" }
- Workflows execution:
- my-workflow1: This is a workflow to describe the action that will trigger the self-service provisioning in run-time. A workflow can take input and return output. It can also follow one or many steps. In this example, only one step is defined.
Each step points to a target which is the corresponding node template, and the target specified here is: my-workflow1-target-node-node-template.
- Node templates: This section provide the self-service execution plan, usually DG is used here to describe complex workflow. But, the above CBA contains a simple node template (my-workflow1-node-node-template) without DG:
The node template is defined by the node-template-execution-type. This type specifies the component function to use for this node template execution. The following shows the different components that can be executed as a node template:
├── component-resource-resolution # CBA Root Directory | └── Interface: │ ├── ResourceResolutionComponent # Component to resolve resources │ └── Resolution approaches: │ ├── rr-processor-source-capability # Resolve using Capability scripts such as jython or kotlin │ ├── rr-processor-source-processor-db # Resolve using database query │ ├── rr-processor-source-default # resolve by getting default value provided │ ├── rr-processor-source-rest # Resolve using REST API request ├── component-jython-executor # Component to execute Jython scripts | └── Interface: │ ├── ComponentJythonExecutor ├── component-remote-python-executor # Component to execute remote python scripts | └── Interface: │ ├── ComponentRemotePythonExecutor ├── component-restconf-executor # Component to execute Restconf operations | └── Interface: │ ├── ComponentRestconfExecutor ├── component-netconf-executor # Component to execute netconf operations | └── Interface: │ ├── ComponentNetconfExecutor ├── component-cli-executor # Cli component | └── Interface: │ ├── ComponentCliExecutor ├── component-remote-ansible-executor # Component to execute remote ansible playbook | └── Interface: │ ├── ComponentRemoteAnsibleExecutor
In the case the workflow point to a DG node template, this DG will describe all the execution sequence to run for the corresponding workflow step. In the following, the workflow point to a DG and the execute two node templates:
- Workflow with DG
- Node templates with DG
in the below DG, we define the following sequence: [target-node-template1] → [target-node-template2]
B. Optional artifacts in CBA
This section describes the different parts of the CBA, artifacts needed to have a model-driven package for self-service provisioning:
- CBA Entry point: TOSCA.meta file
TOSCA-Meta-File-Version: 1.0.0 CSAR-Version: 1.0 Created-By: Steve Siani <alphonse.steve.siani.djissitchi@ibm.com> Entry-Definitions: Definitions/CBA_configuration_file_name.json Template-Tags: Steve Siani, remote_ansible
- Environment files: Some parameters need to be resolved to fulfill the template. It is possible to provide in your CBA, additional variables in environment files. In this approach, the service will get some parameters from environment file. The designer could define 2 environments, for instance, and those 2 environments are loaded automatically in the running self-service:
- Template artifacts: Content the template file and the corresponding template mapping. This template provides a dynamic content to the self-service for configuration appliance.
In this template, some parameters are resolved using the input source and some are resolved using properties-capability-source.
B. Enrich the CBA to have complete package
Once CBA design is done, you need to perform the enrichment action to have a fully model-driven package to execute self-service provisioning in run-time execution. Please refer to this section "Enriching (or enhancing) a blueprint".