From 06bf0ac45889ffe00fc6e27e68ffa15c2f519e6f Mon Sep 17 00:00:00 2001 From: Lukasz Rajewski Date: Wed, 24 Mar 2021 19:15:31 +0100 Subject: Real vFW CNF config-assign and config-deploy Implementation of vFW CNF config-assign and config-deploy with utilization of CDS native components for configuration API Change-Id: I016b186e1fcad0bf1285292f2e93e12a1d96b63e Issue-ID: INT-1868 Signed-off-by: Lukasz Rajewski --- .../templates/cba/Definitions/artifact_types.json | 5 ++ .../templates/cba/Definitions/data_types.json | 19 ++++- .../templates/cba/Definitions/node_types.json | 15 ++-- .../Definitions/resources_definition_types.json | 96 ++++++++++++++++++++++ .../templates/cba/Definitions/vFW_CNF_CDS.json | 86 ++++++++++++++++++- 5 files changed, 211 insertions(+), 10 deletions(-) (limited to 'heat/vFW_CNF_CDS/templates/cba/Definitions') diff --git a/heat/vFW_CNF_CDS/templates/cba/Definitions/artifact_types.json b/heat/vFW_CNF_CDS/templates/cba/Definitions/artifact_types.json index 77d0eb19..4211156e 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Definitions/artifact_types.json +++ b/heat/vFW_CNF_CDS/templates/cba/Definitions/artifact_types.json @@ -20,6 +20,11 @@ "description": "K8s Profile Folder Artifact", "version": "1.0.0", "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-k8sconfig-content": { + "description": "K8s Config Folder Artifact", + "version": "1.0.0", + "derived_from": "tosca.artifacts.Implementation" } } } diff --git a/heat/vFW_CNF_CDS/templates/cba/Definitions/data_types.json b/heat/vFW_CNF_CDS/templates/cba/Definitions/data_types.json index 5fb59cf5..23ae1649 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Definitions/data_types.json +++ b/heat/vFW_CNF_CDS/templates/cba/Definitions/data_types.json @@ -57,17 +57,24 @@ }, "k8s-rb-profile-namespace": { "description": "K8s namespace to create helm chart for specified profile", - "type": "string", - "default": "default" + "type": "string" }, "k8s-rb-profile-name": { "description": "Profile name used in multicloud/k8s plugin to identify Helm chart(s) where this mapping is providing override values.", "type": "string" }, + "k8s-rb-instance-release-name": { + "description": "Name of the release for the helm package instance in k8s", + "type": "string" + }, "k8s-rb-profile-source": { "description": "The source folder or file relative to 'Templates/k8s-profiles' folder", "type": "string" }, + "k8s-rb-profile-k8s-version": { + "description": "Profile k8s version used in multicloud/k8s plugin", + "type": "string" + }, "k8s-rb-config-template-name": { "description": "The name of configuration template for config-assign operation", "type": "string" @@ -76,6 +83,14 @@ "description": "The source of configuration template for config-assign operation", "type": "string" }, + "k8s-rb-config-name": { + "description": "The source of configuration values for config-deploy operation", + "type": "string" + }, + "k8s-rb-config-value-source": { + "description": "The source of configuration values for config-deploy operation", + "type": "string" + }, "private1-prefix-id": { "description": "", "required": false, diff --git a/heat/vFW_CNF_CDS/templates/cba/Definitions/node_types.json b/heat/vFW_CNF_CDS/templates/cba/Definitions/node_types.json index 95db7aec..c191f164 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Definitions/node_types.json +++ b/heat/vFW_CNF_CDS/templates/cba/Definitions/node_types.json @@ -210,6 +210,11 @@ "required": false, "type": "string" }, + "k8s-rb-profile-k8s-version": { + "description": "a K8s cluster version for the profile", + "required": false, + "type": "string" + }, "k8s-rb-profile-source": { "description": "Source (tgz/folder) for the template in CBA", "required": false, @@ -325,12 +330,12 @@ "operations": { "process": { "inputs": { - "k8s-template-name": { + "k8s-rb-config-template-name": { "description": "K8s template name", "required": false, "type": "string" }, - "k8s-config-name": { + "k8s-rb-config-name": { "description": "K8s config name", "required": false, "type": "string" @@ -340,12 +345,12 @@ "required": false, "type": "string" }, - "k8s-rb-template-value-source": { + "k8s-rb-config-value-source": { "description": "Location of value source in CBA", "required": false, "type": "string" }, - "k8s-operation-type": { + "k8s-config-operation-type": { "required": false, "type": "string", "constraints": [ @@ -353,7 +358,7 @@ "valid_values": [ "create", "update", - "rollback" + "delete" ] } ], diff --git a/heat/vFW_CNF_CDS/templates/cba/Definitions/resources_definition_types.json b/heat/vFW_CNF_CDS/templates/cba/Definitions/resources_definition_types.json index 6277e01b..9975878b 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Definitions/resources_definition_types.json +++ b/heat/vFW_CNF_CDS/templates/cba/Definitions/resources_definition_types.json @@ -270,6 +270,25 @@ } } }, + "k8s-rb-instance-release-name": { + "tags": "k8s, cnf, profile, k8s-rb-instance-release-name", + "name": "k8s-rb-instance-release-name", + "property": { + "description": "Name of the release for the helm package instance in k8s", + "type": "string" + }, + "group": "default", + "updated-by": "Rajewski, Lukasz ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + }, "k8s-rb-profile-namespace": { "tags": "k8s, cnf, profile, namespace, k8s-rb-profile-namespace", "name": "k8s-rb-profile-namespace", @@ -309,6 +328,45 @@ } } }, + "k8s-rb-profile-k8s-version": { + "tags": "k8s, cnf, profile, k8s version, k8s-rb-profile-k8s-version", + "name": "k8s-rb-profile-k8s-version", + "property": { + "description": "Profile k8s version used in multicloud/k8s plugin", + "type": "string" + }, + "group": "default", + "updated-by": "Rajewski, Lukasz ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + }, + "sdnc": { + "type": "source-rest", + "properties": { + "verb": "GET", + "type": "JSON", + "url-path": "/restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/k8s-rb-profile-k8s-version", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "k8s-rb-profile-k8s-version": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + }, "k8s-rb-profile-source": { "tags": "k8s, cnf, profile, k8s-rb-profile-source", "name": "k8s-rb-profile-source", @@ -366,6 +424,44 @@ } } }, + "k8s-rb-config-value-source": { + "tags": "k8s, cnf, config, k8s-rb-config-value-source", + "name": "k8s-rb-config-value-source", + "property": { + "description": "The source of configuration values for config-deploy operation", + "type": "string" + }, + "group": "default", + "updated-by": "Rajewski, Lukasz ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + }, + "k8s-rb-config-name": { + "tags": "k8s, cnf, config, k8s-rb-config-name", + "name": "k8s-rb-config-name", + "property": { + "description": "The source of configuration values for config-deploy operation", + "type": "string" + }, + "group": "default", + "updated-by": "Rajewski, Lukasz ", + "sources": { + "input": { + "type": "source-input" + }, + "default": { + "type": "source-default", + "properties": {} + } + } + }, "management-prefix-id": { "tags": "management-prefix-id", "name": "management-prefix-id", diff --git a/heat/vFW_CNF_CDS/templates/cba/Definitions/vFW_CNF_CDS.json b/heat/vFW_CNF_CDS/templates/cba/Definitions/vFW_CNF_CDS.json index 6c71ca22..c17caca2 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Definitions/vFW_CNF_CDS.json +++ b/heat/vFW_CNF_CDS/templates/cba/Definitions/vFW_CNF_CDS.json @@ -5,7 +5,7 @@ "author-email": "lukasz.rajewski@orange.com", "user-groups": "ADMIN, OPERATION", "template_name": "vFW_CNF_CDS", - "template_version": "7.0.0", + "template_version": "8.0.0", "template_tags": "Samuli Silvius, Lukasz Rajewski, vFW_CNF_CDS", "template_type": "DEFAULT" }, @@ -164,6 +164,9 @@ ], "on_success": [ "config-apply" + ], + "on_failure": [ + "handle_error" ] }, "config-apply": { @@ -185,7 +188,29 @@ { "call_operation": "ComponentScriptExecutor.process" } + ], + "on_success": [ + "collect-results" + ], + "on_failure": [ + "handle_error" + ] + }, + "handle_error": { + "description": "Simple error verification script", + "target": "simple-error-check", + "activities": [ + { + "call_operation": "ComponentScriptExecutor.process" + } + ], + "on_success": [ + "collect-results" ] + }, + "collect-results": { + "description": "Final collection of results", + "target": "collect-results" } }, "inputs": { @@ -322,11 +347,11 @@ }, "artifacts": { "ssh-service-config": { - "type": "artifact-k8sprofile-content", + "type": "artifact-k8sconfig-content", "file": "Templates/k8s-configs/ssh-service.tar.gz" }, "ssh-service-config-customizable": { - "type": "artifact-k8sprofile-content", + "type": "artifact-k8sconfig-content", "file": "Templates/k8s-configs/ssh-service-config" }, "ssh-service-config-customizable-mapping": { @@ -345,6 +370,7 @@ "artifact-prefix-names": [ "helm_vpkg" ], + "k8s-config-operation-type": "create", "resource-assignment-map": { "get_attribute": [ "config-setup-process", @@ -358,6 +384,20 @@ } } } + }, + "artifacts": { + "ssh-service-default": { + "type": "artifact-k8sconfig-content", + "file": "Templates/k8s-configs/ssh-service-config/values.yaml" + }, + "ssh-service-config": { + "type": "artifact-k8sconfig-content", + "file": "Templates/k8s-configs/ssh-service-values/values.yaml.vtl" + }, + "ssh-service-config-mapping": { + "type": "artifact-mapping-resource", + "file": "Templates/k8s-configs/ssh-service-values/ssh-service-mapping.json" + } } }, "simple-status-check": { @@ -379,6 +419,25 @@ } } }, + "simple-error-check": { + "type": "component-script-executor", + "interfaces": { + "ComponentScriptExecutor": { + "operations": { + "process": { + "inputs": { + "script-type": "kotlin", + "script-class-reference": "org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts.SimpleErrorCheck", + "instance-dependencies": [ + "blueprintPropertiesService" + ], + "dynamic-properties": "*simple-status-properties" + } + } + } + } + } + }, "config-setup-process": { "type": "component-resource-resolution", "interfaces": { @@ -433,6 +492,27 @@ } } } + }, + "collect-results": { + "type": "component-script-executor", + "interfaces": { + "ComponentScriptExecutor": { + "operations": { + "process": { + "implementation": { + "primary": "component-script", + "timeout": 180, + "operation_host": "SELF" + }, + "inputs": { + "script-type": "kotlin", + "script-class-reference": "org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts.CollectorScript" + }, + "outputs": {} + } + } + } + } } } } -- cgit 1.2.3-korg