Card |
---|
default | true |
---|
label | Installation |
---|
| InstallationONAP 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. Prerequisitehttps://docs.onap.org/en/latest/guides/onap-developer/settingup/index.html Setup local Helm Code Block |
---|
title | helm repo |
---|
collapse | true |
---|
| 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 |
---|
title | git clone |
---|
collapse | true |
---|
| git clone https://gerrit.onap.org/r/oom
git checkout tags/$release-tag
cd oom/kubernetes
make cds |
Install CDS Code Block |
---|
title | helm install |
---|
collapse | true |
---|
| helm install --name cds cds |
Result Edit Code Block |
---|
title | kubectl output |
---|
collapse | true |
---|
| $ kubectl get all --selector=release=cds
NAME 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 |
|
Card |
---|
| Design timeBellow 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.
Deck of Cards |
---|
|
Card |
---|
default | true |
---|
label | Prerequisite |
---|
| PrerequisiteGather the cloud parameters: Deck of Cards |
---|
|
Card |
---|
| 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 ... |
Card |
---|
| 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. Card |
---|
| Here are the information to capture for each dynamic cloud parameters Parameter Name | Data Dictionary Resource source | Data Dictionary Ingredients for resolution | Output of resolution |
---|
Either the cloud parameters name or the placeholder given for the dynamic property. |
Deck of Cards |
---|
|
Card |
---|
| Value will be given as input in the request. |
Card |
---|
| Value will be defaulted in the model. |
Card |
---|
| Value will be resolved by sending a query to the REST system
Auth | URL | URI | Payload | VERB |
---|
Supported Auth type Deck of Cards |
---|
|
Card |
---|
| Use token based authentication |
Card |
---|
| Use basic authentication |
Card |
---|
| Use SSL basic authentication - keystore type
- truststore
- truststore password
- keystore
- keystore password
|
|
| http(s)://<host>:<port> | /xyz | JSON formatted payload | HTTP method |
|
Card |
---|
| Value will be resolved by sending a SQL statement to the DB system
|
Card |
---|
| Value will be resolved through the execution of a script. |
|
| These are all the required parameters to process the resolution of that particular resources. Deck of Cards |
---|
|
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. |
|
|
Card |
---|
| Data dictionaryWhat is a 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
Deck of Cards |
---|
|
Card |
---|
| Value will be pass as input. Code Block |
---|
theme | Eclipse |
---|
title | unit-number |
---|
| {
"tags": "unit-number",
"name": "unit-number",
"property": {
"description": "unit-number",
"type": "string"
},
"updated-by": "adetalhouet",
"sources": {
"input": {
"type": "source-input"
}
}
} |
|
Card |
---|
| Value will be defaulted. Code Block |
---|
theme | Eclipse |
---|
title | prefix-id |
---|
| {
"tags": "prefix-id",
"name": "prefix-id",
"property" :{
"description": "prefix-id",
"type": "integer"
},
"updated-by": "adetalhouet",
"sources": {
"default": {
"type": "source-default"
}
}
} |
|
Card |
---|
| Value will be resolved through REST. Modeling reference: Modeling Concepts#rest
Panel |
---|
title | primary-config-data via rest source type |
---|
| 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 |
---|
theme | Eclipse |
---|
title | response |
---|
collapse | true |
---|
| {
"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 |
---|
theme | Eclipse |
---|
title | create_netbox_ip_address |
---|
| {
"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" ]
}
}
}
} |
|
Panel |
---|
title | primary-aai-data via rest source type |
---|
| primary-aai-data via type source-rest
TBD
Code Block |
---|
title | primary-aai-data sample |
---|
| {
"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"
]
}
}
}
} |
|
|
Card |
---|
| 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. Code Block |
---|
theme | Eclipse |
---|
title | vf-module-type |
---|
| {
"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"
]
}
}
}
} |
|
Card |
---|
| 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. Code Block |
---|
theme | Eclipse |
---|
title | interface-description |
---|
| {
"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. Code Block |
---|
theme | Eclipse |
---|
title | Scripts/python/DescriptionExample.py |
---|
collapse | true |
---|
| # 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 key-dependencies value
value = self.raRuntimeService.getStringFromResolutionStore("vf-module-type")
# logic based on key-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 the value of 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
|
|
Card |
---|
| 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. Code Block |
---|
theme | Eclipse |
---|
title | response |
---|
collapse | true |
---|
| {
"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"
} |
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 Code Block |
---|
title | dt-netbox-ip |
---|
collapse | true |
---|
| {
"version": "1.0.0",
"description": "This is Netbox IP Data Type",
"properties": {
"address": {
"required": true,
"type": "string"
},
"id": {
"required": true,
"type": "integer"
}
},
"derived_from": "tosca.datatypes.Root"
} |
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. Code Block |
---|
theme | Eclipse |
---|
title | create_netbox_ip_address |
---|
| {
"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" ]
}
}
}
} |
|
|
|
Card |
---|
| WorkflowsThe 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
Deck of Cards |
---|
|
Card |
---|
| resource-assignmentThis 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. ContextThis 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. StepsThis is a single action type of workflow, hence the target will refer to a node_template of type component-resource-resolution Property | Description |
---|
artifact-name | This action will require resource accumulator templates for each VNF and VF-Module; this will be covered during the User Guidecomponent 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. |
OutputIn 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. ExampleHere is an example of the resource-assignment workflow: Code Block |
---|
theme | Eclipse |
---|
title | resource-assignment |
---|
| {
"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"
]
}
}
}
}
}
} |
|
Card |
---|
| config-assignThis 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. ContextThis 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. StepsThis is a single action type of workflow, hence the target will refer to a node_template of type component-resource-resolution 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. |
OutputIn 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. ExampleHere is an example of the config-assign workflow: Code Block |
---|
theme | Eclipse |
---|
title | config-assign |
---|
| {
"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"
]
}
}
}
}
}
} |
|
Card |
---|
| config-deployThis 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. ContextThis action is triggered by SO after the CreateVnfBB has been executed. It corresponds to the ConfigDeployBB. See SO Building blocks Assignment. StepsThis 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.
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. |
OutputSUCCESS or FAILURE ExampleHere is an example of the config-deploy workflow: Code Block |
---|
theme | Eclipse |
---|
title | config-deploy |
---|
| {
"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"
}
}
}
}
} |
|
|
|
Card |
---|
|
Deck of Cards |
---|
|
Card |
---|
label | resource-assignment-process |
---|
| resource-assignment-process |
Card |
---|
label | config-assign-process |
---|
| config-assign-process |
Card |
---|
label | config-deploy-process |
---|
| config-deploy-process |
|
|
|
|
Card |
---|
label | Design a new CBA |
---|
title | How to create a new CBA from scratch. |
---|
| 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
Code Block |
---|
title | CBA directory 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_ExecAnsiblePlaybook.xml # Directed graph artifact
| └── Scripts/ # Script used for capability resource resolution
│ └── kotlin/
│ └── script_kotlin.cba.kts
│ └── ansible/
│ └── ansible_file.yaml
│ └── python/
│ └── script_python.py
| └── TOSCA-Metadata/
│ └── TOSCA.meta meta # CBA entry point (Mandatory)
| └── Templates/
│ └── example-template.jinja # Template file that will dynamic represent a payload in some execution node (Extensions supported: .vtl and .jinja)
│ └── example-mapping.json # List of variables that will be resolved to fulfill the template
|
The example of execute Ansible playbook will be illustrated here to describe all the design process. 1. Description before self-service provisioning in CDS: To create or delete an EVPN using Ansible playbook, a request is sent to Ansible with the following parameters and configurations. 2. Create the CBA directory and structure: Code Block |
---|
theme | Eclipse |
---|
title | Required Parameters |
---|
collapse | true |
---|
| - job-template-name (Required): Primary key or name of the job template to launch new job.
- Ansible server parameters (required): Remote AWX Server selector parameters.
- limit: Specify host limit for job template to run.
- inventory: Specify inventory for job template to run.
- extra-vars: Action content to run
├── Example config file (yaml format):
├── interface_groups:
├── - <interface group 1>
├── - <interface group 2>
├── ansible_ssh_user: <username>
├── ansible_ssh_pass: <password>
├── netconf_operation: <action> # "remove" to delete an EVPN or "merge" to create EVPN
├── tenant_name: <tenant name>
├── evi_id: <EVI ID> # Required only for delete EVPN
├── site_id: <Site ID>
├── service_db_url: <Service DB URL>
├── topology_url: <TOPOLOGY URL>
├── resource_allocator_url: <Resource allocator URL>
├── evi_description: <EVI Description> |
3. Design the Model-driven CBA for this Ansible service: This section describe the different parts of the CBA, actions and artifacts needed to have a model-driven CBA for Ansible playbook service: - CBA Entry point: TOSCA.meta file
Code Block |
---|
language | css |
---|
title | TOSCA.meta |
---|
linenumbers | true |
---|
| TOSCA-Meta-File-Version: 1.0.0
CSAR-Version: 1.0
Created-By: Steve Siani <alphonse.steve.siani.djissitchi@ibm.com>
Entry-Definitions: Definitions/remote_ansible.json
Template-Tags: Steve Siani, remote_ansible_steve |
We define here all parameters in JSON needed in service provisioning. Ex. Endpoint selector to provide remote Ansible server parameters. Code Block |
---|
language | actionscript3 |
---|
title | ansible-remote-endpoint |
---|
linenumbers | true |
---|
| "ansible-remote-endpoint" : {
"type" : "token-auth",
"url" : "http://ANSIBLE_IP_ADDRESS",
"token" : "Bearer J9gEtMDqf7P4YsJ74fioY9VAhLDIs1"
} |
- create-evpn: This is a workflow to describe the action that create an EVPN, it defines the input and output needed in this case. - remove-evpn: This workflow describes the action that delete EVPN, it defines the input and output needed. In this approach, the two workflows will target the same node template: evpn-executor-process Code Block |
---|
language | perl |
---|
title | Workflow: create-evpn |
---|
linenumbers | true |
---|
collapse | true |
---|
| "create-evpn" : {
"steps" : {
"process" : {
"description" : "Execute remote ansible to create an eVPN",
"target" : "evpn-executor-process",
"activities" : [ {
"call_operation" : ""
} ]
}
},
"inputs" : {
"environment" : {
"required" : true,
"type" : "string"
},
"netconf_operation" : {
"required" : false,
"type" : "string",
"default": "merge"
},
"inventory" : {
"required" : true,
"type" : "string"
}
},
"outputs" : {
"ansible-command-status" : {
"type" : "string",
"value" : {
"get_attribute" : [ "create-evpn", "ansible-command-status" ]
}
},
"ansible-command-logs" : {
"type" : "string",
"value" : {
"get_attribute" : [ "create-evpn", "ansible-command-logs" ]
}
}
}
} |
Code Block |
---|
language | perl |
---|
title | Workflow: remove-evpn |
---|
linenumbers | true |
---|
collapse | true |
---|
| "remove-evpn" : {
"steps" : {
"process" : {
"description" : "Execute remote ansible to remove an eVPN",
"target" : "evpn-executor-process",
"activities" : [ {
"call_operation" : ""
} ]
}
},
"inputs" : {
"environment" : {
"required" : true,
"type" : "string"
},
"netconf_operation" : {
"required" : false,
"type" : "string",
"default": "remove"
},
"inventory" : {
"required" : true,
"type" : "string"
}
},
"outputs" : {
"ansible-command-status" : {
"type" : "string",
"value" : {
"get_attribute" : [ "remove-evpn", "ansible-command-status" ]
}
},
"ansible-command-logs" : {
"type" : "string",
"value" : {
"get_attribute" : [ "remove-evpn", "ansible-command-logs" ]
}
}
}
} |
- Node templates: This section will describe each execution node described in the DG.
→ The first node template is the workflow target, the DG node template evpn-executor-process: Code Block |
---|
language | perl |
---|
title | evpn-executor-process |
---|
linenumbers | true |
---|
collapse | true |
---|
| "evpn-executor-process": {
"type": "dg-generic",
"properties": {
"content": {
"get_artifact": [
"SELF",
"dg-evpn-executor-process"
]
},
"dependency-node-templates": [
"resolve-ansible-vars",
"evpn-executor"
]
},
"artifacts": {
"dg-evpn-executor-process": {
"type": "artifact-directed-graph",
"file": "Plans/CONFIG_ExecAnsiblePlaybook.xml"
}
}
} |
→ The next node template is a capability resource resolution that will resolve ansible parameters: resolve-ansible-vars Code Block |
---|
language | perl |
---|
title | resolve-ansible-vars |
---|
linenumbers | true |
---|
collapse | true |
---|
| "resolve-ansible-vars": {
"type": "component-resource-resolution",
"interfaces": {
"ResourceResolutionComponent": {
"operations": {
"process": {
"implementation": {
"primary": "component-script"
},
"inputs": {
"dynamic-properties": "extra-properties",
"artifact-prefix-names" : [ "resolve-evpn-vars" ]
}
}
}
}
},
"artifacts": {
"component-script": {
"type": "artifact-script-jython",
"file": "Scripts/python/ResolvProperties.py"
},
"resolve-evpn-vars-template": {
"type": "artifact-template-jinja",
"file": "Templates/resolve-evpn-vars-template.jinja"
},
"resolve-evpn-vars-mapping": {
"type": "artifact-mapping-resource",
"file": "Templates/resolve-evpn-vars-mapping.json"
}
}
} |
→ The last node template is the remote Ansible playbook execution node: evpn-executor Code Block |
---|
language | perl |
---|
title | evpn-executor |
---|
linenumbers | true |
---|
collapse | true |
---|
| "evpn-executor": {
"type": "component-remote-ansible-executor",
"interfaces": {
"ComponentRemoteAnsibleExecutor": {
"operations": {
"process": {
"inputs": {
"endpoint-selector": "*ansible-remote-endpoint",
"job-template-name": "evpn_job_template",
"extra-vars": {
"get_attribute": [
"resolve-ansible-vars",
"assignment-params",
"resolve-evpn-vars"
]
}
}
}
}
}
}
} |
- Resource resolution: Some parameters need to be resolved to fulfill the template. In this approach, the service will get some parameters from environment file. The designer could define 2 Ansible environments:
Code Block |
---|
language | xml |
---|
theme | Emacs |
---|
title | env-prod.properties |
---|
linenumbers | true |
---|
collapse | true |
---|
| env-prod.ansible_ssh_user=<username>
env-prod.ansible_ssh_pass=<password>
env-prod.evi_id=<id>
env-prod.service_db_url=<service_db_url>
env-prod.topology_url=<topology_url>
env-prod.resource_allocator_url=<resource_allocator> |
Code Block |
---|
language | xml |
---|
theme | Emacs |
---|
title | env-test.properties |
---|
linenumbers | true |
---|
collapse | true |
---|
| env-test.ansible_ssh_user=<username>
env-test.ansible_ssh_pass=<password>
env-test.evi_id=<id>
env-test.service_db_url=<service_db_url>
env-test.topology_url=<topology_url>
env-test.resource_allocator_url=<resource_allocator> |
To resolve these parameters, one way to do that could be to use a capability resource resolution with a python script.
- Directed graph: Describes the sequence flow to complete this Ansible playbook execution.
The above DG set the following sequence: [Resource resolution] → [Component Ansible Execution] Code Block |
---|
language | xml |
---|
title | CONFIG_ExecAnsiblePlaybook.xml |
---|
linenumbers | true |
---|
collapse | true |
---|
| <service-logic
xmlns='http://www.onap.org/sdnc/svclogic'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='CONFIG' version='1.0.0'>
<method rpc='ResolveAnsibleVar' mode='sync'>
<block atomic="true">
<execute plugin="resolve-ansible-vars" method="process">
<outcome value='failure'>
<return status="failure">
</return>
</outcome>
<outcome value='success'>
<execute plugin="evpn-executor" method="process">
<outcome value='failure'>
<return status="failure">
</return>
</outcome>
<outcome value='success'>
<return status='success'>
</return>
</outcome>
</execute>
</outcome>
</execute>
</block>
</method>
</service-logic> |
- Template artifacts: Content the template file and the corresponding template mapping provided in Ansible.
Code Block |
---|
language | yml |
---|
title | resolve-evpn-vars-template.jinja |
---|
linenumbers | true |
---|
collapse | true |
---|
| {
"site_id": "{{ site_id }}",
"evi_id": "{{ evi_id }}",
"evi_description": "{{ evi_description }}",
"tenant_name": "{{ tenant_name }}",
"interface_groups": {{ interface_groups }},
"netconf_operation": "{{ netconf_operation }}",
"ansible_ssh_user": "{{ ansible_ssh_user }}",
"ansible_ssh_pass": "{{ ansible_ssh_pass }}",
"service_db_url": "{{ service_db_url }}",
"topology_url": "{{ topology_url }}",
"resource_allocator_url": "{{ resource_allocator_url }}"
} |
Code Block |
---|
language | yml |
---|
title | resolve-evpn-vars-mapping.json |
---|
linenumbers | true |
---|
collapse | true |
---|
| [
{
"name": "interface_groups",
"input-param": true,
"property": {
"type": "list",
"entry_schema": {
"type": "string"
}
},
"dictionary-name": "input-source",
"dictionary-source": "input",
"dependencies": []
},
{
"name": "site_id",
"input-param": true,
"property": {
"type": "string"
},
"dictionary-name": "input-source",
"dictionary-source": "input",
"dependencies": []
},
{
"name": "tenant_name",
"input-param": true,
"property": {
"type": "string"
},
"dictionary-name": "input-source",
"dictionary-source": "input",
"dependencies": []
},
{
"name": "evi_description",
"input-param": true,
"property": {
"type": "string"
},
"dictionary-name": "input-source",
"dictionary-source": "input",
"dependencies": []
},
{
"name": "environment",
"input-param": true,
"property": {
"type": "string"
},
"dictionary-name": "input-source",
"dictionary-source": "input",
"dependencies": []
},
{
"name": "ansible_ssh_user",
"input-param": true,
"property": {
"type": "string"
},
"dictionary-name": "properties-capability-source",
"dictionary-source": "capability",
"dependencies": ["environment"]
},
{
"name": "ansible_ssh_pass",
"input-param": true,
"property": {
"type": "string"
},
"dictionary-name": "properties-capability-source",
"dictionary-source": "capability",
"dependencies": ["environment"]
},
{
"name": "netconf_operation",
"input-param": true,
"property": {
"type": "string"
},
"dictionary-name": "input-source",
"dictionary-source": "input",
"dependencies": []
},
{
"name": "service_db_url",
"input-param": true,
"property": {
"type": "string"
},
"dictionary-name": "properties-capability-source",
"dictionary-source": "capability",
"dependencies": ["environment"]
},
{
"name": "topology_url",
"input-param": true,
"property": {
"type": "string"
},
"dictionary-name": "properties-capability-source",
"dictionary-source": "capability",
"dependencies": ["environment"]
},
{
"name": "resource_allocator_url",
"input-param": true,
"property": {
"type": "string"
},
"dictionary-name": "properties-capability-source",
"dictionary-source": "capability",
"dependencies": ["environment"]
}
] |
In this template, some parameters are resolved using the input source and some are resolved using properties-capability-source
Find attached the CBA designed through documentation. This CBA need to be enriched to include generated configuration file like node_type.json, data_type.json etc. |
|