diff options
Diffstat (limited to 'tutorials/ApacheCNF/templates/cba')
-rw-r--r-- | tutorials/ApacheCNF/templates/cba/Definitions/CNF.json | 128 | ||||
-rw-r--r-- | tutorials/ApacheCNF/templates/cba/Definitions/data_types.json | 64 | ||||
-rw-r--r-- | tutorials/ApacheCNF/templates/cba/Scripts/kotlin/ConfigDeploySetup.kt | 17 | ||||
-rw-r--r-- | tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleScript.kt (renamed from tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleErrorCheck.kt) | 10 | ||||
-rw-r--r-- | tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt | 4 | ||||
-rw-r--r-- | tutorials/ApacheCNF/templates/cba/Templates/cnf-template.vtl | 12 |
6 files changed, 218 insertions, 17 deletions
diff --git a/tutorials/ApacheCNF/templates/cba/Definitions/CNF.json b/tutorials/ApacheCNF/templates/cba/Definitions/CNF.json index 4f44e8a1..f273bfb8 100644 --- a/tutorials/ApacheCNF/templates/cba/Definitions/CNF.json +++ b/tutorials/ApacheCNF/templates/cba/Definitions/CNF.json @@ -167,6 +167,46 @@ } } }, + "config-upgrade-assign": { + "steps": { + "config-setup": { + "description": "Gather necessary input for profile upload", + "target": "config-setup-process", + "activities": [ + { + "call_operation": "ResourceResolutionComponent.process" + } + ], + "on_success": [ + "profile-upload" + ] + }, + "profile-upload": { + "description": "Generate and upload K8s Profile before upgrade", + "target": "k8s-profile-upgrade-upload", + "activities": [ + { + "call_operation": "ComponentScriptExecutor.process" + } + ] + } + }, + "inputs": { + "resolution-key": { + "required": true, + "type": "string" + }, + "store-result": { + "required": true, + "type": "boolean" + }, + "config-upgrade-assign-properties": { + "description": "Dynamic PropertyDefinition for workflow(config-upgrade-assign).", + "required": true, + "type": "dt-config-upgrade-assign-properties" + } + } + }, "config-deploy": { "steps": { "config-setup": { @@ -234,6 +274,46 @@ } } }, + "config-upgrade-deploy": { + "steps": { + "config-setup": { + "description": "Gather necessary input for profile upload", + "target": "config-setup-process", + "activities": [ + { + "call_operation": "ResourceResolutionComponent.process" + } + ], + "on_success": [ + "status-verification-script" + ] + }, + "status-verification-script": { + "description": "Simple status verification script", + "target": "simple-status-check", + "activities": [ + { + "call_operation": "ComponentScriptExecutor.process" + } + ] + } + }, + "inputs": { + "resolution-key": { + "required": true, + "type": "string" + }, + "store-result": { + "required": true, + "type": "boolean" + }, + "config-upgrade-deploy-properties": { + "description": "Dynamic PropertyDefinition for workflow(config-upgrade-deploy).", + "required": true, + "type": "dt-config-upgrade-deploy-properties" + } + } + }, "scale-out": { "steps": { "config-setup": { @@ -449,7 +529,7 @@ "status-verification-script" ], "on_failure": [ - "handle_error" + "handle-error" ] }, "status-verification-script": { @@ -476,9 +556,9 @@ "collect-results" ] }, - "handle_error": { + "handle-error": { "description": "Simple error verification script", - "target": "simple-error-check", + "target": "simple-script", "activities": [ { "call_operation": "ComponentScriptExecutor.process" @@ -573,6 +653,41 @@ } } }, + "k8s-profile-upgrade-upload": { + "type": "component-k8s-profile-upload", + "interfaces": { + "K8sProfileUploadComponent": { + "operations": { + "process": { + "inputs": { + "artifact-prefix-names": [ + "helm_apache" + ], + "resource-assignment-map": { + "get_attribute": [ + "config-setup-process", + "", + "assignment-map", + "config-deploy", + "config-deploy-setup" + ] + } + } + } + } + } + }, + "artifacts": { + "cnf-cds-base-profile": { + "type": "artifact-k8sprofile-content", + "file": "Templates/k8s-profiles/cnf-cds-base-profile.tar.gz" + }, + "node-port-profile": { + "type": "artifact-k8sprofile-content", + "file": "Templates/k8s-profiles/node-port-profile.tar.gz" + } + } + }, "k8s-config-template": { "type": "component-k8s-config-template", "interfaces": { @@ -731,7 +846,7 @@ } } }, - "simple-error-check": { + "simple-script": { "type": "component-script-executor", "interfaces": { "ComponentScriptExecutor": { @@ -739,10 +854,7 @@ "process": { "inputs": { "script-type": "kotlin", - "script-class-reference": "org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts.SimpleErrorCheck", - "instance-dependencies": [ - "bluePrintPropertiesService" - ], + "script-class-reference": "org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts.SimpleScript", "dynamic-properties": "*simple-status-properties" } } diff --git a/tutorials/ApacheCNF/templates/cba/Definitions/data_types.json b/tutorials/ApacheCNF/templates/cba/Definitions/data_types.json index 1573c81c..5a3b9d2d 100644 --- a/tutorials/ApacheCNF/templates/cba/Definitions/data_types.json +++ b/tutorials/ApacheCNF/templates/cba/Definitions/data_types.json @@ -17,6 +17,38 @@ }, "derived_from": "tosca.datatypes.Dynamic" }, + "dt-config-upgrade-assign-properties": { + "description": "Dynamic DataType definition for workflow(config-upgrade-assign).", + "version": "1.0.0", + "properties": { + "service-instance-id": { + "description": "", + "required": false, + "type": "string" + }, + "service-model-uuid": { + "description": "", + "required": false, + "type": "string" + }, + "vnf-id": { + "description": "", + "required": false, + "type": "string" + }, + "vnf-name": { + "description": "", + "required": false, + "type": "string" + }, + "vnf-customization-uuid": { + "description": "", + "required": false, + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Dynamic" + }, "dt-config-deploy-properties": { "description": "Dynamic DataType definition for workflow(config-deploy).", "version": "1.0.0", @@ -45,6 +77,38 @@ }, "derived_from": "tosca.datatypes.Dynamic" }, + "dt-config-upgrade-deploy-properties": { + "description": "Dynamic DataType definition for workflow(config-upgrade-deploy).", + "version": "1.0.0", + "properties": { + "service-instance-id": { + "description": "", + "required": false, + "type": "string" + }, + "service-model-uuid": { + "description": "", + "required": false, + "type": "string" + }, + "vnf-id": { + "description": "", + "required": false, + "type": "string" + }, + "vnf-name": { + "description": "", + "required": false, + "type": "string" + }, + "vnf-customization-uuid": { + "description": "", + "required": false, + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Dynamic" + }, "dt-health-check-properties": { "description": "Dynamic DataType definition for workflow(health-check).", "version": "1.0.0", diff --git a/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/ConfigDeploySetup.kt b/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/ConfigDeploySetup.kt index f925be06..c57ca758 100644 --- a/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/ConfigDeploySetup.kt +++ b/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/ConfigDeploySetup.kt @@ -21,6 +21,7 @@ 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.k8s.definition.profile.K8sProfileUploadComponent 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 @@ -100,13 +101,23 @@ open class ConfigDeploySetup() : ResourceAssignmentProcessor() { val modelInfo = modelTopology["onap-model-information"] val moduleData: ObjectNode = objectMapper.createObjectNode() result.put(label, moduleData) - moduleData.put(K8sConfigTemplateComponent.INPUT_K8S_DEFINITION_NAME, modelInfo["model-invariant-uuid"].asText()) - moduleData.put(K8sConfigTemplateComponent.INPUT_K8S_DEFINITION_VERSION, modelInfo["model-customization-uuid"].asText()) + val profileName: String? = getParamValueByName(moduleParameters, K8sProfileUploadComponent.INPUT_K8S_PROFILE_NAME) + val profileSource: String? = getParamValueByName(moduleParameters, K8sProfileUploadComponent.INPUT_K8S_PROFILE_SOURCE) + val profileNamespace: String? = getParamValueByName(moduleParameters, K8sProfileUploadComponent.INPUT_K8S_PROFILE_NAMESPACE) + val profileK8sVersion: String? = getParamValueByName(moduleParameters, K8sProfileUploadComponent.INPUT_K8S_PROFILE_K8S_VERSION) 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 (profileName != null) + moduleData.put(K8sProfileUploadComponent.INPUT_K8S_PROFILE_NAME, profileName) + if (profileSource != null) + moduleData.put(K8sProfileUploadComponent.INPUT_K8S_PROFILE_SOURCE, profileSource) + if (profileNamespace != null) + moduleData.put(K8sProfileUploadComponent.INPUT_K8S_PROFILE_NAMESPACE, profileNamespace) + if (profileK8sVersion != null) + moduleData.put(K8sProfileUploadComponent.INPUT_K8S_PROFILE_K8S_VERSION, profileK8sVersion) if (templateName != null) moduleData.put(K8sConfigTemplateComponent.INPUT_K8S_TEMPLATE_NAME, templateName) if (templateSource != null) @@ -119,6 +130,8 @@ open class ConfigDeploySetup() : ResourceAssignmentProcessor() { for (aaiModule in modulesAai) { if (aaiModule["vf-module-id"].asText() == module["vf-module-id"].asText() && aaiModule["heat-stack-id"] != null) { moduleData.put(K8sConfigValueComponent.INPUT_K8S_INSTANCE_ID, aaiModule["heat-stack-id"].asText()) + moduleData.put(K8sConfigTemplateComponent.INPUT_K8S_DEFINITION_NAME, aaiModule["model-invariant-id"].asText()) + moduleData.put(K8sConfigTemplateComponent.INPUT_K8S_DEFINITION_VERSION, aaiModule["model-customization-id"].asText()) break } } diff --git a/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleErrorCheck.kt b/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleScript.kt index 8e4a58ab..6849654d 100644 --- a/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleErrorCheck.kt +++ b/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleScript.kt @@ -20,18 +20,18 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInpu import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction import org.slf4j.LoggerFactory -open class SimpleErrorCheck : AbstractScriptComponentFunction() { +open class SimpleScript : AbstractScriptComponentFunction() { - private val log = LoggerFactory.getLogger(SimpleErrorCheck::class.java)!! + private val log = LoggerFactory.getLogger(SimpleScript::class.java)!! override fun getName(): String { - return "SimpleErrorCheck" + return "SimpleScript" } override suspend fun processNB(executionRequest: ExecutionServiceInput) { - log.info("SIMPLE ERROR CHECK - START") + log.info("STEP ${executionRequest.stepData?.name} - START") - log.info("SIMPLE ERROR CHECK - END") + log.info("STEP ${executionRequest.stepData?.name} - STOP") } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { diff --git a/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt b/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt index c1f59d98..4cef7f66 100644 --- a/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt +++ b/tutorials/ApacheCNF/templates/cba/Scripts/kotlin/SimpleStatusCheck.kt @@ -35,7 +35,7 @@ open class SimpleStatusCheck : AbstractScriptComponentFunction() { } override suspend fun processNB(executionRequest: ExecutionServiceInput) { - log.info("SIMPLE STATUS CHECK - START") + log.info("STEP ${executionRequest.stepData?.name} - START") val configValueSetup: ObjectNode = getDynamicProperties("config-deploy-setup") as ObjectNode var checkCount: Int = getDynamicProperties("status-check-max-count").asInt() @@ -71,7 +71,7 @@ open class SimpleStatusCheck : AbstractScriptComponentFunction() { checkCount = 0 } - log.info("SIMPLE STATUS CHECK - END") + log.info("STEP ${executionRequest.stepData?.name} - STOP") } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { diff --git a/tutorials/ApacheCNF/templates/cba/Templates/cnf-template.vtl b/tutorials/ApacheCNF/templates/cba/Templates/cnf-template.vtl index 1bebcaa0..99199824 100644 --- a/tutorials/ApacheCNF/templates/cba/Templates/cnf-template.vtl +++ b/tutorials/ApacheCNF/templates/cba/Templates/cnf-template.vtl @@ -44,6 +44,18 @@ "param-value": "${k8s-rb-profile-name}" }, { + "param-name": "k8s-rb-profile-source", + "param-value": "${k8s-rb-profile-source}" + }, + { + "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}" + }, + { "param-name": "k8s-rb-config-template-name", "param-value": "${k8s-rb-config-template-name}" }, |