2 * Copyright © 2020 Aarna Networks, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts
19 import com.fasterxml.jackson.databind.node.ObjectNode
20 import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
21 import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedContentFromResolvedArtifactNB
22 import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties
23 import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestClientProperties
24 import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BasicAuthRestClientService
25 import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
26 import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
27 import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
28 import org.slf4j.LoggerFactory
29 import org.springframework.http.HttpMethod
30 import org.springframework.web.client.RestTemplate
32 open class ConfigDeploy : AbstractScriptComponentFunction() {
34 private val log = LoggerFactory.getLogger(ConfigDeploy::class.java)!!
36 override suspend fun processNB(executionRequest: ExecutionServiceInput) {
39 * Resolution key will come as part of config-deploy request payload.
42 val resolution_key = getDynamicProperties("resolution-key").asText()
43 log.info("Got the resolution_key: $resolution_key from config-deploy going to retrive the data from DB")
45 // Read the config-assing data using the resolution key + prefix name for the template
46 // We can select the given configuration using the resolution_key
48 val payload = storedContentFromResolvedArtifactNB(resolution_key, prefix)
49 log.info("cnf configuration data from DB : \n$payload\n")
51 println("Run config-deploy")
56 override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
57 log.info("Executing Recovery")