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 --- heat/vFW_CNF_CDS/automation/config.py | 17 ++-- heat/vFW_CNF_CDS/automation/create_k8s_region.py | 15 ++-- heat/vFW_CNF_CDS/automation/instantiate.py | 7 +- heat/vFW_CNF_CDS/templates/cba-dev/enrich.sh | 1 + .../templates/cba-dev/run-vf-base-ra.sh | 2 +- .../vFW_CNF_CDS/templates/cba-dev/run-vf-pkg-ra.sh | 3 +- .../templates/cba-dev/run-vnf-config.sh | 2 +- heat/vFW_CNF_CDS/templates/cba-dev/run-vnf-ra.sh | 3 +- .../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 ++++++++++++++++++- .../cba/Scripts/kotlin/CollectorScript.kt | 51 ++++++++++++ .../templates/cba/Scripts/kotlin/ConfigDeploy.kt | 6 +- .../cba/Scripts/kotlin/ConfigDeploySetup.kt | 38 +++++---- .../cba/Scripts/kotlin/SimpleErrorCheck.kt | 41 +++++++++ .../cba/Scripts/kotlin/SimpleStatusCheck.kt | 12 +-- .../templates/cba/TOSCA-Metadata/TOSCA.meta | 2 +- .../cba/Templates/base_template-mapping.json | 58 ++++++++++++- .../cba/Templates/base_template-template.vtl | 26 ++++++ .../ssh-service-config/ssh-service-mapping.json | 2 +- .../ssh-service-values/ssh-service-mapping.json | 14 ++++ .../k8s-configs/ssh-service-values/values.yaml.vtl | 3 + .../ssh-service-mapping.json | 2 +- .../templates/cba/Templates/vfw-mapping.json | 58 ++++++++++++- .../templates/cba/Templates/vfw-template.vtl | 28 ++++++- .../templates/cba/Templates/vnf-mapping.json | 13 +++ .../templates/cba/Templates/vnf-template.vtl | 8 ++ .../templates/cba/Templates/vpkg-mapping.json | 58 ++++++++++++- .../templates/cba/Templates/vpkg-template.vtl | 28 ++++++- .../templates/cba/Templates/vsn-mapping.json | 58 ++++++++++++- .../templates/cba/Templates/vsn-template.vtl | 28 ++++++- heat/vFW_CNF_CDS/templates/cba/pom.xml | 14 ++++ 34 files changed, 756 insertions(+), 63 deletions(-) mode change 100755 => 100644 heat/vFW_CNF_CDS/automation/create_k8s_region.py create mode 100644 heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/CollectorScript.kt create mode 100644 heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/SimpleErrorCheck.kt create mode 100644 heat/vFW_CNF_CDS/templates/cba/Templates/k8s-configs/ssh-service-values/ssh-service-mapping.json create mode 100755 heat/vFW_CNF_CDS/templates/cba/Templates/k8s-configs/ssh-service-values/values.yaml.vtl (limited to 'heat') diff --git a/heat/vFW_CNF_CDS/automation/config.py b/heat/vFW_CNF_CDS/automation/config.py index 96b098dd..a7aae02c 100755 --- a/heat/vFW_CNF_CDS/automation/config.py +++ b/heat/vFW_CNF_CDS/automation/config.py @@ -19,10 +19,10 @@ class Config: #### REGION DETAILS #### COMPLEX_ID = "complex" CLOUD_OWNER = "k8sCloudOwner" - CLOUD_REGION = "k8s-region-1" + CLOUD_REGION = "kud-1" AVAILABILITY_ZONE_NAME = "k8s-availability-zone" HYPERVISOR_TYPE = "k8s" - TENANT_NAME = "k8s-tenant-1" + TENANT_NAME = "kud-1" K8S_NAMESPACE = "vfirewall" CUSTOMER_RESOURCE_DEFINITIONS = [] # Uncomment, if you want to run on non KUD k8s cluster @@ -41,6 +41,7 @@ class Config: PROFILE_NAME = "vfw-cnf-cds-base-profile" PROFILE_SOURCE = PROFILE_NAME + RELEASE_NAME = "vfw-1" VENDOR = "vendor_cnf" SERVICENAME = "vfw_k8s_demo_CNF" @@ -50,7 +51,9 @@ class Config: SDNC_ARTIFACT_NAME = "vnf" # INSERT PARAMS FOR VNF HERE AS "name" : "value" PAIR - VNF_PARAM_LIST = {} + VNF_PARAM_LIST = { + "k8s-rb-profile-namespace": K8S_NAMESPACE + } VF_MODULE_PREFIX = "" if NATIVE: @@ -60,22 +63,22 @@ class Config: VF_MODULE_PREFIX + "base_template": { "k8s-rb-profile-name": PROFILE_NAME, "k8s-rb-profile-source": PROFILE_SOURCE, - "k8s-rb-profile-namespace": K8S_NAMESPACE + "k8s-rb-instance-release-name": RELEASE_NAME + "-base" }, VF_MODULE_PREFIX + "vfw": { "k8s-rb-profile-name": PROFILE_NAME, "k8s-rb-profile-source": PROFILE_SOURCE, - "k8s-rb-profile-namespace": K8S_NAMESPACE + "k8s-rb-instance-release-name": RELEASE_NAME + "-vfw" }, VF_MODULE_PREFIX + "vpkg": { "k8s-rb-profile-name": PROFILE_NAME, "k8s-rb-profile-source": PROFILE_SOURCE, - "k8s-rb-profile-namespace": K8S_NAMESPACE + "k8s-rb-instance-release-name": RELEASE_NAME + "-vpkg" }, VF_MODULE_PREFIX + "vsn": { "k8s-rb-profile-name": PROFILE_NAME, "k8s-rb-profile-source": PROFILE_SOURCE, - "k8s-rb-profile-namespace": K8S_NAMESPACE + "k8s-rb-instance-release-name": RELEASE_NAME + "-vsn" } } diff --git a/heat/vFW_CNF_CDS/automation/create_k8s_region.py b/heat/vFW_CNF_CDS/automation/create_k8s_region.py old mode 100755 new mode 100644 index cfbec8cc..ca680cf1 --- a/heat/vFW_CNF_CDS/automation/create_k8s_region.py +++ b/heat/vFW_CNF_CDS/automation/create_k8s_region.py @@ -21,7 +21,7 @@ from uuid import uuid4 from config import Config from k8s_client import K8sClient -from so_db_adapter import SoDBAdapter +from so_db_adapter import SoDBUpdate from onapsdk.aai.business import Customer from onapsdk.aai.cloud_infrastructure import Complex, CloudRegion from onapsdk.msb.k8s import ConnectivityInfo @@ -118,10 +118,9 @@ except: #### Add region to SO db #### logger.info("******** SO Database *******") -so_db_adapter = SoDBAdapter(cloud_region_id=Config.CLOUD_REGION, - complex_id=Config.COMPLEX_ID, - onap_kubeconfig_path=Config.ONAP_KUBECONFIG_PATH) -is_region_in_so = so_db_adapter.check_region_in_db() - -if not is_region_in_so: - so_db_adapter.add_region_to_so_db() +result = SoDBUpdate.add_region_to_so_db(cloud_region_id=Config.CLOUD_REGION, + complex_id=Config.COMPLEX_ID) +if result.status_code == 201: + logger.info("Region in SO db created successfully") +else: + logger.error("Creating region in SO db failed") diff --git a/heat/vFW_CNF_CDS/automation/instantiate.py b/heat/vFW_CNF_CDS/automation/instantiate.py index 7363c479..bfc68aa1 100755 --- a/heat/vFW_CNF_CDS/automation/instantiate.py +++ b/heat/vFW_CNF_CDS/automation/instantiate.py @@ -146,7 +146,12 @@ for vnf in service.vnfs: profile_name = Config.VF_MODULE_PARAM_LIST[vf_module_label]["k8s-rb-profile-name"] try: profile = definition.get_profile_by_name(profile_name) - if profile.namespace != Config.VF_MODULE_PARAM_LIST[vf_module_label]["k8s-rb-profile-namespace"]: + namespace = None + if "k8s-rb-profile-namespace" in Config.VNF_PARAM_LIST: + namespace = Config.VNF_PARAM_LIST["k8s-rb-profile-namespace"] + if "k8s-rb-profile-namespace" in Config.VF_MODULE_PARAM_LIST[vf_module_label]: + namespace = Config.VF_MODULE_PARAM_LIST[vf_module_label]["k8s-rb-profile-namespace"] + if namespace != None and profile.namespace != namespace: profile.delete() logger.info("Profile: " + profile_name + " for " + vf_module.name + " deleted") else: diff --git a/heat/vFW_CNF_CDS/templates/cba-dev/enrich.sh b/heat/vFW_CNF_CDS/templates/cba-dev/enrich.sh index 1db994b6..632cb89f 100755 --- a/heat/vFW_CNF_CDS/templates/cba-dev/enrich.sh +++ b/heat/vFW_CNF_CDS/templates/cba-dev/enrich.sh @@ -19,4 +19,5 @@ curl --location --request POST 'http://127.0.0.1:8081/api/v1/blueprint-model/enrich' \ --header 'Authorization: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==' \ +-o 'cba.zip' \ --form 'file=@../package_native/CBA.zip' | jq diff --git a/heat/vFW_CNF_CDS/templates/cba-dev/run-vf-base-ra.sh b/heat/vFW_CNF_CDS/templates/cba-dev/run-vf-base-ra.sh index f40760f2..3046cfd8 100755 --- a/heat/vFW_CNF_CDS/templates/cba-dev/run-vf-base-ra.sh +++ b/heat/vFW_CNF_CDS/templates/cba-dev/run-vf-base-ra.sh @@ -32,7 +32,7 @@ curl --location --request POST 'http://localhost:8081/api/v1/execution-service/p }, "actionIdentifiers": { "blueprintName": "vFW_CNF_CDS", - "blueprintVersion": "7.0.0", + "blueprintVersion": "8.0.0", "actionName": "resource-assignment", "mode": "sync" }, diff --git a/heat/vFW_CNF_CDS/templates/cba-dev/run-vf-pkg-ra.sh b/heat/vFW_CNF_CDS/templates/cba-dev/run-vf-pkg-ra.sh index 09283293..a80238db 100755 --- a/heat/vFW_CNF_CDS/templates/cba-dev/run-vf-pkg-ra.sh +++ b/heat/vFW_CNF_CDS/templates/cba-dev/run-vf-pkg-ra.sh @@ -32,7 +32,7 @@ curl --location --request POST 'http://localhost:8081/api/v1/execution-service/p }, "actionIdentifiers": { "blueprintName": "vFW_CNF_CDS", - "blueprintVersion": "7.0.0", + "blueprintVersion": "8.0.0", "actionName": "resource-assignment", "mode": "sync" }, @@ -60,6 +60,7 @@ curl --location --request POST 'http://localhost:8081/api/v1/execution-service/p "k8s-rb-profile-name": "vfw-cnf-cds-base-profile", "k8s-rb-profile-source": "vfw-cnf-cds-base-profile", "k8s-rb-profile-namespace": "vfirewall", + "k8s-rb-profile-k8s-version": "1.18.9", "k8s-rb-config-template-name": "ssh-service-config", "k8s-rb-config-template-source": "ssh-service-config", "management-prefix-id" : 3 diff --git a/heat/vFW_CNF_CDS/templates/cba-dev/run-vnf-config.sh b/heat/vFW_CNF_CDS/templates/cba-dev/run-vnf-config.sh index 1461475e..d8a7ca19 100755 --- a/heat/vFW_CNF_CDS/templates/cba-dev/run-vnf-config.sh +++ b/heat/vFW_CNF_CDS/templates/cba-dev/run-vnf-config.sh @@ -32,7 +32,7 @@ curl --location --request POST 'http://localhost:8081/api/v1/execution-service/p }, "actionIdentifiers": { "blueprintName": "vFW_CNF_CDS", - "blueprintVersion": "7.0.0", + "blueprintVersion": "8.0.0", "actionName": "'config-$ACTION'", "mode": "sync" }, diff --git a/heat/vFW_CNF_CDS/templates/cba-dev/run-vnf-ra.sh b/heat/vFW_CNF_CDS/templates/cba-dev/run-vnf-ra.sh index 1e24a7a2..2d64bac7 100755 --- a/heat/vFW_CNF_CDS/templates/cba-dev/run-vnf-ra.sh +++ b/heat/vFW_CNF_CDS/templates/cba-dev/run-vnf-ra.sh @@ -31,7 +31,7 @@ curl --location --request POST 'http://localhost:8081/api/v1/execution-service/p }, "actionIdentifiers": { "blueprintName": "vFW_CNF_CDS", - "blueprintVersion": "7.0.0", + "blueprintVersion": "8.0.0", "actionName": "resource-assignment", "mode": "sync" }, @@ -49,6 +49,7 @@ curl --location --request POST 'http://localhost:8081/api/v1/execution-service/p "vnf-id": "51274ece-55ca-4cbc-b7c4-0da0dcc65d38", "vnf_name": "sample-vnf-name", "k8s-rb-profile-namespace": "vfw-namespace", + "k8s-rb-profile-k8s-version": "1.18.9", "int_private1_net_cidr" : "192.168.10.0/24", "int_private2_net_cidr" : "192.168.20.0/24", "onap_private_net_cidr" : "10.0.0.0/16", 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": {} + } + } + } + } } } } diff --git a/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/CollectorScript.kt b/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/CollectorScript.kt new file mode 100644 index 00000000..a9de1972 --- /dev/null +++ b/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/CollectorScript.kt @@ -0,0 +1,51 @@ +/* + * Copyright © 2021 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. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts + +import com.fasterxml.jackson.databind.JsonNode +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.asJsonNode +import org.onap.ccsdk.cds.controllerblueprints.core.logger + +open class CollectorScript : AbstractScriptComponentFunction() { + + private val log = logger(CollectorScript::class) + + override suspend fun processNB(executionRequest: ExecutionServiceInput) { + bluePrintRuntimeService.bluePrintContext() + .serviceTemplate.topologyTemplate!!.nodeTemplates!! + .keys.filter { it.startsWith("execute-script") } + .associateWith { responseData(it) } + .let { it.asJsonNode() } + .also { log.info("Collected results: $it") } + .let { setAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, it) } + } + + private fun responseData(nodeTemplateName: String): JsonNode? { + return try { + bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName, + ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA) + } catch (exception: BlueprintProcessorException) { null } + } + + override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { + addError(runtimeException.message ?: "Failed without error message") + } +} diff --git a/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/ConfigDeploy.kt b/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/ConfigDeploy.kt index 861cdf66..96b3c515 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/ConfigDeploy.kt +++ b/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/ConfigDeploy.kt @@ -30,11 +30,11 @@ open class ConfigDeploy : AbstractScriptComponentFunction() { } override suspend fun processNB(executionRequest: ExecutionServiceInput) { - val resolution_key = getDynamicProperties("resolution-key").asText() - log.info("Got the resolution_key: $resolution_key from config-deploy going to retrieve the data from DB") + val resolutionKey = getDynamicProperties("resolution-key").asText() + log.info("Got the resolution_key: $resolutionKey from config-deploy going to retrieve the data from DB") val prefix = "config-deploy" // used in the config-assign resolution - val payload = storedContentFromResolvedArtifactNB(resolution_key, prefix) + val payload = storedContentFromResolvedArtifactNB(resolutionKey, prefix) log.info("cnf configuration data from DB : \n$payload\n") println("Run config-deploy") diff --git a/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/ConfigDeploySetup.kt b/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/ConfigDeploySetup.kt index 2e6ec816..f04813df 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/ConfigDeploySetup.kt +++ b/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/ConfigDeploySetup.kt @@ -19,6 +19,8 @@ package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.node.ObjectNode import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import org.onap.ccsdk.cds.blueprintsprocessor.functions.k8s.definition.template.K8sConfigTemplateComponent +import org.onap.ccsdk.cds.blueprintsprocessor.functions.k8s.definition.template.K8sConfigValueComponent import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException @@ -33,12 +35,12 @@ open class ConfigDeploySetup() : ResourceAssignmentProcessor() { return "ConfigDeploySetup" } - override suspend fun processNB(resourceAssignment: ResourceAssignment) { + override suspend fun processNB(executionRequest: ResourceAssignment) { var retValue: ObjectNode? = null try { - if (resourceAssignment.name == "config-deploy-setup") { + if (executionRequest.name == "config-deploy-setup") { val modulesSdnc = raRuntimeService.getResolutionStore("vf-modules-list-sdnc")["vf-modules"] val modulesAai = raRuntimeService.getResolutionStore("vf-modules-list-aai")["vf-modules"] val objectMapper = jacksonObjectMapper() @@ -46,22 +48,30 @@ open class ConfigDeploySetup() : ResourceAssignmentProcessor() { for (module in modulesSdnc) { val modelTopology = module.at("/vf-module-data/vf-module-topology") val moduleParameters = modelTopology.at("/vf-module-parameters/param") - val label: String? = getParamValueByName(moduleParameters,"vf_module_label") + val label: String? = getParamValueByName(moduleParameters, "vf_module_label") if (label != null) { val modelInfo = modelTopology["onap-model-information"] val moduleData: ObjectNode = objectMapper.createObjectNode() result.put(label, moduleData) - moduleData.put("k8s-rb-definition-name", modelInfo["model-invariant-uuid"].asText()) - moduleData.put("k8s-rb-definition-version", modelInfo["model-uuid"].asText()) - val templateName: String? = getParamValueByName(moduleParameters,"k8s-rb-config-template-name") - val templateSource: String? = getParamValueByName(moduleParameters,"k8s-rb-config-template-source") + moduleData.put(K8sConfigTemplateComponent.INPUT_K8S_DEFINITION_NAME, modelInfo["model-invariant-uuid"].asText()) + moduleData.put(K8sConfigTemplateComponent.INPUT_K8S_DEFINITION_VERSION, modelInfo["model-uuid"].asText()) + val templateName: String? = getParamValueByName(moduleParameters, K8sConfigTemplateComponent.INPUT_K8S_TEMPLATE_NAME) + val templateSource: String? = getParamValueByName(moduleParameters, K8sConfigTemplateComponent.INPUT_K8S_TEMPLATE_SOURCE) + val configValueSource: String? = getParamValueByName(moduleParameters, K8sConfigValueComponent.INPUT_K8S_CONFIG_VALUE_SOURCE) + val configName: String? = getParamValueByName(moduleParameters, K8sConfigValueComponent.INPUT_K8S_RB_CONFIG_NAME) + if (templateName != null) - moduleData.put("k8s-rb-config-template-name", templateName) + moduleData.put(K8sConfigTemplateComponent.INPUT_K8S_TEMPLATE_NAME, templateName) if (templateSource != null) - moduleData.put("k8s-rb-config-template-source", templateSource) + moduleData.put(K8sConfigTemplateComponent.INPUT_K8S_TEMPLATE_SOURCE, templateSource) + if (configValueSource != null) + moduleData.put(K8sConfigValueComponent.INPUT_K8S_CONFIG_VALUE_SOURCE, configValueSource) + if (configName != null) + moduleData.put(K8sConfigValueComponent.INPUT_K8S_RB_CONFIG_NAME, configName) + for (aaiModule in modulesAai) { if (aaiModule["vf-module-id"].asText() == module["vf-module-id"].asText()) { - moduleData.put("k8s-instance-id", aaiModule["heat-stack-id"].asText()) + moduleData.put(K8sConfigValueComponent.INPUT_K8S_INSTANCE_ID, aaiModule["heat-stack-id"].asText()) break } } @@ -69,12 +79,12 @@ open class ConfigDeploySetup() : ResourceAssignmentProcessor() { } retValue = result } - ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, retValue) + ResourceAssignmentUtils.setResourceDataValue(executionRequest, raRuntimeService, retValue) } catch (e: Exception) { log.error(e.message, e) - ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, "ERROR") + ResourceAssignmentUtils.setResourceDataValue(executionRequest, raRuntimeService, "ERROR") - throw BlueprintProcessorException("Failed in template key ($resourceAssignment) assignments, cause: ${e.message}", e) + throw BlueprintProcessorException("Failed in template key ($executionRequest) assignments, cause: ${e.message}", e) } } @@ -87,7 +97,7 @@ open class ConfigDeploySetup() : ResourceAssignmentProcessor() { return null } - override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { + override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ResourceAssignment) { this.addError("${runtimeException.message}") } } diff --git a/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/SimpleErrorCheck.kt b/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/SimpleErrorCheck.kt new file mode 100644 index 00000000..8e4a58ab --- /dev/null +++ b/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/SimpleErrorCheck.kt @@ -0,0 +1,41 @@ +/* + * Copyright © 2021 Orange + * + * 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. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts + +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction +import org.slf4j.LoggerFactory + +open class SimpleErrorCheck : AbstractScriptComponentFunction() { + + private val log = LoggerFactory.getLogger(SimpleErrorCheck::class.java)!! + + override fun getName(): String { + return "SimpleErrorCheck" + } + + override suspend fun processNB(executionRequest: ExecutionServiceInput) { + log.info("SIMPLE ERROR CHECK - START") + + log.info("SIMPLE ERROR CHECK - END") + } + + override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { + log.info("Executing Recovery") + this.addError("${runtimeException.message}") + } +} diff --git a/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt b/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt index c775bb19..90330644 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt +++ b/heat/vFW_CNF_CDS/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt @@ -44,16 +44,16 @@ open class SimpleStatusCheck : AbstractScriptComponentFunction() { val k8sConfiguration = K8sConnectionPluginConfiguration(bluePrintPropertiesService) - var instanceApi = K8sPluginInstanceApi(k8sConfiguration) + val instanceApi = K8sPluginInstanceApi(k8sConfiguration) var checkCount: Int = 30 // in the future to be read in from the input - while(checkCount > 0) { + while (checkCount > 0) { var continueCheck = false configValueSetup.fields().forEach { it -> val vfModuleName = it.key val instanceName = it.value.get("k8s-instance-id").asText() - var instanceStatus: K8sRbInstanceStatus? = instanceApi.getInstanceStatus(instanceName) + val instanceStatus: K8sRbInstanceStatus? = instanceApi.getInstanceStatus(instanceName) instanceStatus?.resourcesStatus?.forEach { if (it.gvk?.kind == "Pod") { var version = it.gvk?.version!! @@ -61,11 +61,11 @@ open class SimpleStatusCheck : AbstractScriptComponentFunction() { version = "${it.gvk?.group}/$version" // val podStatus = instanceApi.queryInstanceStatus(instanceName, it.gvk?.kind!!, version, it.name, null) // log.info(podStatus.toString()) - var podState = it.status?.get("status") as Map + val podState = it.status?.get("status") as Map - if ((podState?.get("phase") as String) != "Running") { + if ((podState["phase"] as String) != "Running") { continueCheck = true - log.info("Pod ${it?.name} [$vfModuleName] has invalid state ${(podState?.get("phase"))}") + log.info("Pod ${it.name} [$vfModuleName] has invalid state ${(podState["phase"])}") } } } diff --git a/heat/vFW_CNF_CDS/templates/cba/TOSCA-Metadata/TOSCA.meta b/heat/vFW_CNF_CDS/templates/cba/TOSCA-Metadata/TOSCA.meta index fd11bfbc..d9020e5e 100644 --- a/heat/vFW_CNF_CDS/templates/cba/TOSCA-Metadata/TOSCA.meta +++ b/heat/vFW_CNF_CDS/templates/cba/TOSCA-Metadata/TOSCA.meta @@ -3,6 +3,6 @@ CSAR-Version: 1.0 Created-By: Samuli Silvius Entry-Definitions: Definitions/vFW_CNF_CDS.json Template-Name: vFW_CNF_CDS -Template-Version: 7.0.0 +Template-Version: 8.0.0 Template-Type: DEFAULT Template-Tags: Samuli Silvius, Lukasz Rajewski, vFW_CNF_CDS diff --git a/heat/vFW_CNF_CDS/templates/cba/Templates/base_template-mapping.json b/heat/vFW_CNF_CDS/templates/cba/Templates/base_template-mapping.json index d25f7417..686f418f 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Templates/base_template-mapping.json +++ b/heat/vFW_CNF_CDS/templates/cba/Templates/base_template-mapping.json @@ -146,7 +146,26 @@ "input-param": false, "dictionary-name": "k8s-rb-profile-namespace", "dictionary-source": "sdnc", - "dependencies": [] + "dependencies": [ + "service-instance-id", + "vnf-id" + ] + }, + { + "name": "k8s-rb-profile-k8s-version", + "property": { + "description": "K8s cluster version to create helm chart for specified RB profile", + "type": "string", + "required": false, + "default": "1.18.9" + }, + "input-param": false, + "dictionary-name": "k8s-rb-profile-k8s-version", + "dictionary-source": "sdnc", + "dependencies": [ + "service-instance-id", + "vnf-id" + ] }, { "name": "k8s-rb-profile-name", @@ -161,6 +180,19 @@ "dictionary-source": "default", "dependencies": [] }, + { + "name": "k8s-rb-instance-release-name", + "property": { + "description": "Name of the release for the helm package instance in k8s", + "type": "string", + "required": false, + "default": "base" + }, + "input-param": false, + "dictionary-name": "k8s-rb-instance-release-name", + "dictionary-source": "default", + "dependencies": [] + }, { "name": "k8s-rb-definition-name", "property": { @@ -230,5 +262,29 @@ "dictionary-name": "k8s-rb-config-template-source", "dictionary-source": "default", "dependencies": [] + }, + { + "name": "k8s-rb-config-name", + "property": { + "description": "The source of configuration values for config-deploy operation", + "type": "string", + "required": false + }, + "input-param": false, + "dictionary-name": "k8s-rb-config-name", + "dictionary-source": "default", + "dependencies": [] + }, + { + "name": "k8s-rb-config-value-source", + "property": { + "description": "The source of configuration values for config-deploy operation", + "type": "string", + "required": false + }, + "input-param": false, + "dictionary-name": "k8s-rb-config-value-source", + "dictionary-source": "default", + "dependencies": [] } ] diff --git a/heat/vFW_CNF_CDS/templates/cba/Templates/base_template-template.vtl b/heat/vFW_CNF_CDS/templates/cba/Templates/base_template-template.vtl index a6bc57b5..4d1b46a0 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Templates/base_template-template.vtl +++ b/heat/vFW_CNF_CDS/templates/cba/Templates/base_template-template.vtl @@ -93,6 +93,10 @@ } ], "resource-accumulator-resolved-data": [ + { + "param-name": "vnf_name", + "param-value": "${vnf_name}" + }, ##RB name { "param-name": "vf-module-model-invariant-uuid", @@ -103,6 +107,12 @@ "param-name": "vf-module-model-version", "param-value": "${vf-module-model-version}" }, +##Release name + { + "param-name": "k8s-rb-instance-release-name", + "param-value": "${k8s-rb-instance-release-name}" + }, +##Profile name { "param-name": "k8s-rb-profile-name", "param-value": "${k8s-rb-profile-name}" @@ -118,6 +128,22 @@ { "param-name": "onap_private_subnet_id", "param-value": "management-network-subnet-1" + }, + { + "param-name": "k8s-rb-config-template-name", + "param-value": "${k8s-rb-config-template-name}" + }, + { + "param-name": "k8s-rb-config-template-source", + "param-value": "${k8s-rb-config-template-source}" + }, + { + "param-name": "k8s-rb-config-name", + "param-value": "${k8s-rb-config-name}" + }, + { + "param-name": "k8s-rb-config-value-source", + "param-value": "${k8s-rb-config-value-source}" } ] } diff --git a/heat/vFW_CNF_CDS/templates/cba/Templates/k8s-configs/ssh-service-config/ssh-service-mapping.json b/heat/vFW_CNF_CDS/templates/cba/Templates/k8s-configs/ssh-service-config/ssh-service-mapping.json index 47db31da..4fd287fc 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Templates/k8s-configs/ssh-service-config/ssh-service-mapping.json +++ b/heat/vFW_CNF_CDS/templates/cba/Templates/k8s-configs/ssh-service-config/ssh-service-mapping.json @@ -4,7 +4,7 @@ "property": { "description": "The number of node port for ssh service of vpg", "type": "integer", - "default": "0" + "default": 31922 }, "input-param": false, "dictionary-name": "vpg-management-port", diff --git a/heat/vFW_CNF_CDS/templates/cba/Templates/k8s-configs/ssh-service-values/ssh-service-mapping.json b/heat/vFW_CNF_CDS/templates/cba/Templates/k8s-configs/ssh-service-values/ssh-service-mapping.json new file mode 100644 index 00000000..4fd287fc --- /dev/null +++ b/heat/vFW_CNF_CDS/templates/cba/Templates/k8s-configs/ssh-service-values/ssh-service-mapping.json @@ -0,0 +1,14 @@ +[ + { + "name": "vpg-management-port", + "property": { + "description": "The number of node port for ssh service of vpg", + "type": "integer", + "default": 31922 + }, + "input-param": false, + "dictionary-name": "vpg-management-port", + "dictionary-source": "default", + "dependencies": [] + } +] diff --git a/heat/vFW_CNF_CDS/templates/cba/Templates/k8s-configs/ssh-service-values/values.yaml.vtl b/heat/vFW_CNF_CDS/templates/cba/Templates/k8s-configs/ssh-service-values/values.yaml.vtl new file mode 100755 index 00000000..f636e8f3 --- /dev/null +++ b/heat/vFW_CNF_CDS/templates/cba/Templates/k8s-configs/ssh-service-values/values.yaml.vtl @@ -0,0 +1,3 @@ +vnf_name: test-vnf +vpg_name_0: test-vnf-vpg +vpg_management_port: ${vpg-management-port} diff --git a/heat/vFW_CNF_CDS/templates/cba/Templates/k8s-profiles/vfw-cnf-cds-vpkg-profile/ssh-service-mapping.json b/heat/vFW_CNF_CDS/templates/cba/Templates/k8s-profiles/vfw-cnf-cds-vpkg-profile/ssh-service-mapping.json index 47db31da..d5ab945f 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Templates/k8s-profiles/vfw-cnf-cds-vpkg-profile/ssh-service-mapping.json +++ b/heat/vFW_CNF_CDS/templates/cba/Templates/k8s-profiles/vfw-cnf-cds-vpkg-profile/ssh-service-mapping.json @@ -4,7 +4,7 @@ "property": { "description": "The number of node port for ssh service of vpg", "type": "integer", - "default": "0" + "default": 0 }, "input-param": false, "dictionary-name": "vpg-management-port", diff --git a/heat/vFW_CNF_CDS/templates/cba/Templates/vfw-mapping.json b/heat/vFW_CNF_CDS/templates/cba/Templates/vfw-mapping.json index ac083882..f5d7ac05 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Templates/vfw-mapping.json +++ b/heat/vFW_CNF_CDS/templates/cba/Templates/vfw-mapping.json @@ -146,7 +146,26 @@ "input-param": false, "dictionary-name": "k8s-rb-profile-namespace", "dictionary-source": "sdnc", - "dependencies": [] + "dependencies": [ + "service-instance-id", + "vnf-id" + ] + }, + { + "name": "k8s-rb-profile-k8s-version", + "property": { + "description": "K8s cluster version to create helm chart for specified RB profile", + "type": "string", + "required": false, + "default": "1.18.9" + }, + "input-param": false, + "dictionary-name": "k8s-rb-profile-k8s-version", + "dictionary-source": "sdnc", + "dependencies": [ + "service-instance-id", + "vnf-id" + ] }, { "name": "k8s-rb-profile-name", @@ -161,6 +180,19 @@ "dictionary-source": "default", "dependencies": [] }, + { + "name": "k8s-rb-instance-release-name", + "property": { + "description": "Name of the release for the helm package instance in k8s", + "type": "string", + "required": false, + "default": "vfw" + }, + "input-param": false, + "dictionary-name": "k8s-rb-instance-release-name", + "dictionary-source": "default", + "dependencies": [] + }, { "name": "k8s-rb-definition-name", "property": { @@ -230,5 +262,29 @@ "dictionary-name": "k8s-rb-config-template-source", "dictionary-source": "default", "dependencies": [] + }, + { + "name": "k8s-rb-config-name", + "property": { + "description": "The source of configuration values for config-deploy operation", + "type": "string", + "required": false + }, + "input-param": false, + "dictionary-name": "k8s-rb-config-name", + "dictionary-source": "default", + "dependencies": [] + }, + { + "name": "k8s-rb-config-value-source", + "property": { + "description": "The source of configuration values for config-deploy operation", + "type": "string", + "required": false + }, + "input-param": false, + "dictionary-name": "k8s-rb-config-value-source", + "dictionary-source": "default", + "dependencies": [] } ] diff --git a/heat/vFW_CNF_CDS/templates/cba/Templates/vfw-template.vtl b/heat/vFW_CNF_CDS/templates/cba/Templates/vfw-template.vtl index 55f9451c..4702f15c 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Templates/vfw-template.vtl +++ b/heat/vFW_CNF_CDS/templates/cba/Templates/vfw-template.vtl @@ -98,7 +98,7 @@ "output-key-mapping": [ { "resource-name": "vfw_name_0", - "resource-value": "${vf_module_name}" + "resource-value": "${k8s-rb-instance-release-name}" } ] } @@ -106,6 +106,10 @@ } ], "resource-accumulator-resolved-data": [ + { + "param-name": "vnf_name", + "param-value": "${vnf_name}" + }, ##RB name { "param-name": "vf-module-model-invariant-uuid", @@ -116,9 +120,31 @@ "param-name": "vf-module-model-version", "param-value": "${vf-module-model-version}" }, +##Release name + { + "param-name": "k8s-rb-instance-release-name", + "param-value": "${k8s-rb-instance-release-name}" + }, +##Profile name { "param-name": "k8s-rb-profile-name", "param-value": "${k8s-rb-profile-name}" + }, + { + "param-name": "k8s-rb-config-template-name", + "param-value": "${k8s-rb-config-template-name}" + }, + { + "param-name": "k8s-rb-config-template-source", + "param-value": "${k8s-rb-config-template-source}" + }, + { + "param-name": "k8s-rb-config-name", + "param-value": "${k8s-rb-config-name}" + }, + { + "param-name": "k8s-rb-config-value-source", + "param-value": "${k8s-rb-config-value-source}" } ] } diff --git a/heat/vFW_CNF_CDS/templates/cba/Templates/vnf-mapping.json b/heat/vFW_CNF_CDS/templates/cba/Templates/vnf-mapping.json index c6411d71..b764a136 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Templates/vnf-mapping.json +++ b/heat/vFW_CNF_CDS/templates/cba/Templates/vnf-mapping.json @@ -170,5 +170,18 @@ "dictionary-name": "k8s-rb-profile-namespace", "dictionary-source": "default", "dependencies": [] + }, + { + "name": "k8s-rb-profile-k8s-version", + "property": { + "description": "K8s cluster version to create helm chart for specified RB profile", + "type": "string", + "required": false, + "default": "1.18.9" + }, + "input-param": false, + "dictionary-name": "k8s-rb-profile-k8s-version", + "dictionary-source": "default", + "dependencies": [] } ] diff --git a/heat/vFW_CNF_CDS/templates/cba/Templates/vnf-template.vtl b/heat/vFW_CNF_CDS/templates/cba/Templates/vnf-template.vtl index 9e23665f..9f6e96ae 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Templates/vnf-template.vtl +++ b/heat/vFW_CNF_CDS/templates/cba/Templates/vnf-template.vtl @@ -254,6 +254,14 @@ { "param-name": "demo_artifacts_version", "param-value": "${demo_artifacts_version}" + }, + { + "param-name": "k8s-rb-profile-namespace", + "param-value": "${k8s-rb-profile-namespace}" + }, + { + "param-name": "k8s-rb-profile-k8s-version", + "param-value": "${k8s-rb-profile-k8s-version}" } ] } diff --git a/heat/vFW_CNF_CDS/templates/cba/Templates/vpkg-mapping.json b/heat/vFW_CNF_CDS/templates/cba/Templates/vpkg-mapping.json index 5156be32..9008c88f 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Templates/vpkg-mapping.json +++ b/heat/vFW_CNF_CDS/templates/cba/Templates/vpkg-mapping.json @@ -146,7 +146,26 @@ "input-param": false, "dictionary-name": "k8s-rb-profile-namespace", "dictionary-source": "sdnc", - "dependencies": [] + "dependencies": [ + "service-instance-id", + "vnf-id" + ] + }, + { + "name": "k8s-rb-profile-k8s-version", + "property": { + "description": "K8s cluster version to create helm chart for specified RB profile", + "type": "string", + "required": false, + "default": "1.18.9" + }, + "input-param": false, + "dictionary-name": "k8s-rb-profile-k8s-version", + "dictionary-source": "sdnc", + "dependencies": [ + "service-instance-id", + "vnf-id" + ] }, { "name": "k8s-rb-profile-name", @@ -161,6 +180,19 @@ "dictionary-source": "default", "dependencies": [] }, + { + "name": "k8s-rb-instance-release-name", + "property": { + "description": "Name of the release for the helm package instance in k8s", + "type": "string", + "required": false, + "default": "vpkg" + }, + "input-param": false, + "dictionary-name": "k8s-rb-instance-release-name", + "dictionary-source": "default", + "dependencies": [] + }, { "name": "k8s-rb-definition-name", "property": { @@ -230,5 +262,29 @@ "dictionary-name": "k8s-rb-config-template-source", "dictionary-source": "default", "dependencies": [] + }, + { + "name": "k8s-rb-config-name", + "property": { + "description": "The source of configuration values for config-deploy operation", + "type": "string", + "required": false + }, + "input-param": false, + "dictionary-name": "k8s-rb-config-name", + "dictionary-source": "default", + "dependencies": [] + }, + { + "name": "k8s-rb-config-value-source", + "property": { + "description": "The source of configuration values for config-deploy operation", + "type": "string", + "required": false + }, + "input-param": false, + "dictionary-name": "k8s-rb-config-value-source", + "dictionary-source": "default", + "dependencies": [] } ] diff --git a/heat/vFW_CNF_CDS/templates/cba/Templates/vpkg-template.vtl b/heat/vFW_CNF_CDS/templates/cba/Templates/vpkg-template.vtl index 2a6b7985..da7b2718 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Templates/vpkg-template.vtl +++ b/heat/vFW_CNF_CDS/templates/cba/Templates/vpkg-template.vtl @@ -98,7 +98,7 @@ "output-key-mapping": [ { "resource-name": "vpg_name_0", - "resource-value": "${vf_module_name}" + "resource-value": "${k8s-rb-instance-release-name}" } ] } @@ -106,6 +106,10 @@ } ], "resource-accumulator-resolved-data": [ + { + "param-name": "vnf_name", + "param-value": "${vnf_name}" + }, ##RB name { "param-name": "vf-module-model-invariant-uuid", @@ -116,9 +120,31 @@ "param-name": "vf-module-model-version", "param-value": "${vf-module-model-version}" }, +##Release name + { + "param-name": "k8s-rb-instance-release-name", + "param-value": "${k8s-rb-instance-release-name}" + }, +##Profile name { "param-name": "k8s-rb-profile-name", "param-value": "${k8s-rb-profile-name}" + }, + { + "param-name": "k8s-rb-config-template-name", + "param-value": "${k8s-rb-config-template-name}" + }, + { + "param-name": "k8s-rb-config-template-source", + "param-value": "${k8s-rb-config-template-source}" + }, + { + "param-name": "k8s-rb-config-name", + "param-value": "${k8s-rb-config-name}" + }, + { + "param-name": "k8s-rb-config-value-source", + "param-value": "${k8s-rb-config-value-source}" } ] } diff --git a/heat/vFW_CNF_CDS/templates/cba/Templates/vsn-mapping.json b/heat/vFW_CNF_CDS/templates/cba/Templates/vsn-mapping.json index d8bb571d..ead5e29c 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Templates/vsn-mapping.json +++ b/heat/vFW_CNF_CDS/templates/cba/Templates/vsn-mapping.json @@ -146,7 +146,26 @@ "input-param": false, "dictionary-name": "k8s-rb-profile-namespace", "dictionary-source": "sdnc", - "dependencies": [] + "dependencies": [ + "service-instance-id", + "vnf-id" + ] + }, + { + "name": "k8s-rb-profile-k8s-version", + "property": { + "description": "K8s cluster version to create helm chart for specified RB profile", + "type": "string", + "required": false, + "default": "1.18.9" + }, + "input-param": false, + "dictionary-name": "k8s-rb-profile-k8s-version", + "dictionary-source": "sdnc", + "dependencies": [ + "service-instance-id", + "vnf-id" + ] }, { "name": "k8s-rb-profile-name", @@ -161,6 +180,19 @@ "dictionary-source": "default", "dependencies": [] }, + { + "name": "k8s-rb-instance-release-name", + "property": { + "description": "Name of the release for the helm package instance in k8s", + "type": "string", + "required": false, + "default": "vsn" + }, + "input-param": false, + "dictionary-name": "k8s-rb-instance-release-name", + "dictionary-source": "default", + "dependencies": [] + }, { "name": "k8s-rb-definition-name", "property": { @@ -230,5 +262,29 @@ "dictionary-name": "k8s-rb-config-template-source", "dictionary-source": "default", "dependencies": [] + }, + { + "name": "k8s-rb-config-name", + "property": { + "description": "The source of configuration values for config-deploy operation", + "type": "string", + "required": false + }, + "input-param": false, + "dictionary-name": "k8s-rb-config-name", + "dictionary-source": "default", + "dependencies": [] + }, + { + "name": "k8s-rb-config-value-source", + "property": { + "description": "The source of configuration values for config-deploy operation", + "type": "string", + "required": false + }, + "input-param": false, + "dictionary-name": "k8s-rb-config-value-source", + "dictionary-source": "default", + "dependencies": [] } ] diff --git a/heat/vFW_CNF_CDS/templates/cba/Templates/vsn-template.vtl b/heat/vFW_CNF_CDS/templates/cba/Templates/vsn-template.vtl index 4768ab80..61ba0935 100644 --- a/heat/vFW_CNF_CDS/templates/cba/Templates/vsn-template.vtl +++ b/heat/vFW_CNF_CDS/templates/cba/Templates/vsn-template.vtl @@ -98,7 +98,7 @@ "output-key-mapping": [ { "resource-name": "vsn_name_0", - "resource-value": "${vf_module_name}" + "resource-value": "${k8s-rb-instance-release-name}" } ] } @@ -106,6 +106,10 @@ } ], "resource-accumulator-resolved-data": [ + { + "param-name": "vnf_name", + "param-value": "${vnf_name}" + }, ##RB name { "param-name": "vf-module-model-invariant-uuid", @@ -116,9 +120,31 @@ "param-name": "vf-module-model-version", "param-value": "${vf-module-model-version}" }, +##Release name + { + "param-name": "k8s-rb-instance-release-name", + "param-value": "${k8s-rb-instance-release-name}" + }, +##Profile name { "param-name": "k8s-rb-profile-name", "param-value": "${k8s-rb-profile-name}" + }, + { + "param-name": "k8s-rb-config-template-name", + "param-value": "${k8s-rb-config-template-name}" + }, + { + "param-name": "k8s-rb-config-template-source", + "param-value": "${k8s-rb-config-template-source}" + }, + { + "param-name": "k8s-rb-config-name", + "param-value": "${k8s-rb-config-name}" + }, + { + "param-name": "k8s-rb-config-value-source", + "param-value": "${k8s-rb-config-value-source}" } ] } diff --git a/heat/vFW_CNF_CDS/templates/cba/pom.xml b/heat/vFW_CNF_CDS/templates/cba/pom.xml index 26bf93e1..fdb149ee 100644 --- a/heat/vFW_CNF_CDS/templates/cba/pom.xml +++ b/heat/vFW_CNF_CDS/templates/cba/pom.xml @@ -17,6 +17,20 @@ 4.0.0 + + + org.onap.ccsdk.cds.blueprintsprocessor.modules + processor-core + 1.1.1-SNAPSHOT + compile + + + org.onap.ccsdk.cds.blueprintsprocessor.functions + k8s-connection-plugin + 1.1.1-SNAPSHOT + compile + + org.onap.ccsdk.cds.blueprintsprocessor -- cgit 1.2.3-korg