diff options
author | 2022-11-14 14:48:24 +0100 | |
---|---|---|
committer | 2022-11-14 14:51:20 +0100 | |
commit | 4193053d0fc30b688f991e2356e2c0cd6c446a57 (patch) | |
tree | 055282cd6c49447a7e56a0c7504728cb0dae4adb /tutorials/ApacheCNF/templates/cba/Scripts/kotlin | |
parent | 5dcd47bfc76ab8257fcc3b8927b78295a4376c8b (diff) |
[APACHECNF] CDS workflows for upgrade scenario
Issue-ID: INT-2164
Signed-off-by: Lukasz Rajewski <lukasz.rajewski@t-mobile.pl>
Change-Id: Icfa9dd7d90abb3da2b0cf388cfb1e3a27e8edd6d
Diffstat (limited to 'tutorials/ApacheCNF/templates/cba/Scripts/kotlin')
-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 |
3 files changed, 22 insertions, 9 deletions
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) { |