CBA
The Controller Blueprint Archived is the overall service design, fully model-driven, package needed to automate the instantiation and any config provisioning operation, such as day0 or day2 configuration.
The CBA is .zip file, comprised of the following structure:
Code Block |
---|
.
├── Definitions
│ ├── blueprint.json
│ ├── artifact_types.json
│ ├── data_types.json
│ ├── node_types.json
│ ├── policy_types.json
│ ├── relationship_types.json
│ ├── resources_definition_types.json
│ └── *-mapping.json
├── Plans
│ ├── ResourceAssignment.xml
│ ├── ConfigAssign.xml
│ └── ConfigDeploy.xml
├── Scripts
│ └── python
│ |
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
Code Block | ||||
---|---|---|---|---|
| ||||
helm serve &
helm repo add local http://127.0.0.1:8879 |
Get the chart
Make sure to checkout the release to use, by replacing $release-tag
in bellow command
Code Block | ||||
---|---|---|---|---|
| ||||
git clone https://gerrit.onap.org/r/oom
git checkout tags/$release-tag
cd oom/kubernetes
make cds |
Install CDS
Code Block | ||||
---|---|---|---|---|
| ||||
helm install --name cds cds |
Result
Code Block | ||||
---|---|---|---|---|
| ||||
$ kubectl get all --selector=release=cds NAME ├── ConfigDeployExample.py │ ├── ResourceResolutionExample.py │ └── __init__.py ├── TOSCA-Metadata │ └── TOSCA.meta └── Templates READY STATUS RESTARTS AGE pod/cds-blueprints-processor-54f758d69f-p98c2 0/1 Running 1 2m pod/cds-cds-6bd674dc77-4gtdf 1/1 Running 0 2m pod/cds-cds-db-0 1/1 Running 0 2m pod/cds-controller-blueprints-545bbf98cf-zwjfc 1/1 Running 0 2m NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/blueprints-processor ClusterIP 10.43.139.9 <none> 8080/TCP,9111/TCP 2m service/cds NodePort 10.43.254.69 <none> 3000:30397/TCP 2m service/cds-db ClusterIP None <none> 3306/TCP 2m service/controller-blueprints ClusterIP 10.43.207.152 <none> 8080/TCP 2m NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE deployment.apps/cds-blueprints-processor 1 1 1 0 2m deployment.apps/cds-cds 1 1 1 1 2m deployment.apps/cds-controller-blueprints 1 1 1 1 2m NAME DESIRED CURRENT READY AGE replicaset.apps/cds-blueprints-processor-54f758d69f 1 1 0 2m replicaset.apps/cds-cds-6bd674dc77 1 1 1 2m replicaset.apps/cds-controller-blueprints-545bbf98cf 1 1 1 2m NAME DESIRED CURRENT AGE statefulset.apps/cds-cds-db 1 1 2m |
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:
...
id | prerequisite |
---|
Card | ||
---|---|---|
| ||
Have the HEAT template along with the HEAT environment file. |
...
label | post-instantiation |
---|
Have the configuration template to apply on the VNF.
- XML for NETCONF
- JSON / XML for RESTCONF
- not supported yet - CLI
...
Create and fill-in the a table for all the dynamic values
└── *-template.vtl |
Data Dictionary
A data dictionary defines a specifc resource that can be resolved using the bellow the supported sources.
A data dictionary can support multiple resources.
The main goal of data dictionary is to define generic entity that could be shared accross the service catalog.
Resolution sources
Input
Default
SQL
Default (SDNC DB)
Generic
REST
Default (SDNC MDSAL)
Generic
Capability (scripts)
Python
Kotlin script
Netconf (through Python)
Workflow
A workflow defines an overall action to be taken for the service; it can be composed of a set of node to execute. Currently, workflows are backed by Directed Graph engine.
A CBA can have as many workflow as needed.
Required workflows
The following workflows are contracts being
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.
...
label | instantiation |
---|
Here are the information to capture for each dynamic cloud parameters
...
id | how to resolve |
---|
Card | ||
---|---|---|
| ||
Value will be given as input in the request. |
Card | ||
---|---|---|
| ||
Value will be defaulted in the model. |
...
label | REST |
---|
Value will be resolved by sending a query to the REST system
...
Supported Auth type
...
id | auth |
---|
Card | ||
---|---|---|
| ||
Use token based authentication
|
Card | ||
---|---|---|
| ||
Use basic authentication
|
Card | ||
---|---|---|
| ||
Use SSL basic authentication
|
...
label | SQL |
---|
Value will be resolved by sending a SQL statement to the DB system
...
...
These are all the required parameters to process the resolution of that particular resources.
...
id | input |
---|
Card | ||
---|---|---|
| ||
List of placeholders used for
|
Card | ||
---|---|---|
| ||
List of placeholders used for
|
...
This is the expected result from the system, and you should know what value out of the response is of interest for you.
If it's a JSON payload, then you should think about the json path to access to value of interest.
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
...
id | DD |
---|
...
label | input |
---|
Value will be pass as input.
Code Block | ||
---|---|---|
| ||
{
"tags": "unit-number",
"name": "unit-number",
"property": {
"description": "unit-number",
"type": "string"
},
"updated-by": "adetalhouet",
"sources": {
"input": {
"type": "source-input"
}
}
} |
...
label | default |
---|
Value will be defaulted.
Code Block | ||
---|---|---|
| ||
{
"tags": "prefix-id",
"name": "prefix-id",
"property" :{
"description": "prefix-id",
"type": "integer"
},
"updated-by": "adetalhouet",
"sources": {
"default": {
"type": "source-default"
}
}
} |
...
label | rest |
---|
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.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{
"id": 4,
"address": "192.168.10.2/32",
"vrf": null,
"tenant": null,
"status": 1,
"role": null,
"interface": null,
"description": "",
"nat_inside": null,
"created": "2018-08-30",
"last_updated": "2018-08-30T14:59:05.277820Z"
} |
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.
Code Block | ||||
---|---|---|---|---|
| ||||
{
"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" ]
}
}
}
} |
...
label | db |
---|
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.
Code Block | ||||
---|---|---|---|---|
| ||||
{
"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"
]
}
}
}
} |
...
label | capability |
---|
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.
Code Block | ||||
---|---|---|---|---|
| ||||
{
"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
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# Copyright (c) 2019 Bell Canada.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from abstract_ra_processor import AbstractRAProcessor
from blueprint_constants import *
from java.lang import Exception as JavaException
class DescriptionExample(AbstractRAProcessor):
def process(self, resource_assignment):
try:
# get dependencies result
value = self.raRuntimeService.getStringFromResolutionStore("vf-module-type")
# logic based on dependency outcome
result = ""
if value == "vfw":
result = "This is the Virtual Firewall entity"
elif value == "vsn":
result = "This is the Virtual Sink entity"
elif value == "vpg":
result = "This is the Virtual Packet Generator"
# set value for resource getting currently resolved
self.set_resource_data_value(resource_assignment, result)
except JavaException, err:
log.error("Java Exception in the script {}", err)
except Exception, err:
log.error("Python Exception in the script {}", err)
return None
def recover(self, runtime_exception, resource_assignment):
print self.addError(runtime_exception.getMessage())
return None
|
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 triggeredwhat to resolved, one input is required, that is the artifact prefix (see bellow for explanation).
...
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
...
${vnf-name}
and ${vf-module-label}
is what we call the artifact prefix, so the requirement could be seen as follow:
${artifact-prefix}-template
${artifact-prefix
...
}-mapping
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.
Code Block title RA resolved data collapse true "resource-accumulator-resolved-data": [ { "param-name": "service-instance-id", "param-value": "${service-instance-id}" }, { "param-name": "vnf_id", "param-value": "${vnf-id}" } ]
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.
Code Block title RA capability payload collapse true { "capability-name": "netbox-ip-assign", "key-mapping": [ { "payload": [ { "param-name": "service-instance-id", "param-value": "${service-instance-id}" }, { "param-name": "prefix-id", "param-value": "${private-prefix-id}" }, { "param-name": "vf-module-id", "param-value": "${vf-module-id}" }, { "param-name": "external_key", "param-value": "${vf-module-id}-vpg_private_ip_1" } ], "output-key-mapping": [ { "resource-name": "vpg_private_ip_1", "resource-value": "${vpg_private_ip_1}" " } ] } }] ] } ] }}
mapping
Defines the contract of each resource to be resolved. Each placeholder in the template must have a corresponding mapping definition.
A mapping is comprised of:
- name
- required / optional
- type (support complex type)
- dictionary-name
- dictionary-source
- dependencies: this allows to make sure given resources get resolved prior the resolution of the resources defining the dependency.
The dictionary fields reference to a specific data dictionary.
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.
...
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.
...
Scripts using Netconf or Restconf to push configure the network element.