From 13a13e62b4c01db42c7488f9b36d4667ad3e2321 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Tue, 26 Mar 2019 23:08:06 -0400 Subject: Add Restconf Kotlin script sample Change-Id: Ia6196c7e45b1f3d8a3598f858f0d8380a3463ae9 Issue-ID: CCSDK-1080 Signed-off-by: Muthuramalingam, Brinda Santh --- .../src/main/resources/application-dev.properties | 8 +++-- .../src/main/resources/application.properties | 2 +- .../application/src/main/resources/logback.xml | 2 +- .../kotlin/scripts/InternalRAProcessor.cba.kts | 36 ++++++++++++++++++++++ .../selfservice/api/ExecutionServiceHandler.kt | 2 +- .../execution/AbstractComponentFunction.kt | 2 +- .../services/workflow/BlueprintSvcLogicService.kt | 2 +- .../core/FileExtensionFunctionTest.kt | 34 ++++++++++++++++++++ .../BluePrintNodeTemplateValidatorImpl.kt | 10 +++--- 9 files changed, 86 insertions(+), 12 deletions(-) create mode 100644 ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kts create mode 100644 ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctionTest.kt (limited to 'ms') diff --git a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties index e64dee2ac..7ed4cc942 100755 --- a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties +++ b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties @@ -20,12 +20,14 @@ # Web server config server.port=8080 -blueprintsprocessor.grpcEnable=false +blueprintsprocessor.grpcEnable=true blueprintsprocessor.httpPort=8080 blueprintsprocessor.grpcPort=9111 + # Blueprint Processor File Execution and Handling Properties -blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy -blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive +blueprintsprocessor.blueprintDeployPath=blueprints/deploy +blueprintsprocessor.blueprintArchivePath=blueprints/archive +blueprintsprocessor.blueprintWorkingPath=blueprints/work # Primary Database Configuration blueprintsprocessor.db.primary.url=jdbc:mysql://localhost:3306/sdnctl blueprintsprocessor.db.primary.username=sdnctl diff --git a/ms/blueprintsprocessor/application/src/main/resources/application.properties b/ms/blueprintsprocessor/application/src/main/resources/application.properties index 3b97e672c..c51dda716 100755 --- a/ms/blueprintsprocessor/application/src/main/resources/application.properties +++ b/ms/blueprintsprocessor/application/src/main/resources/application.properties @@ -25,7 +25,7 @@ blueprintsprocessor.grpcPort=9111 # Blueprint Processor File Execution and Handling Properties blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive - +blueprintsprocessor.blueprintWorkingPath=/opt/app/onap/blueprints/work # Primary Database Configuration blueprintsprocessor.db.primary.url=jdbc:mysql://db:3306/sdnctl blueprintsprocessor.db.primary.username=sdnctl diff --git a/ms/blueprintsprocessor/application/src/main/resources/logback.xml b/ms/blueprintsprocessor/application/src/main/resources/logback.xml index 48fc057fe..a6caf92fd 100644 --- a/ms/blueprintsprocessor/application/src/main/resources/logback.xml +++ b/ms/blueprintsprocessor/application/src/main/resources/logback.xml @@ -19,7 +19,7 @@ - %d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n + %d{HH:mm:ss.SSS} %-5level %logger{50} - %msg%n diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kts b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kts new file mode 100644 index 000000000..e6fc2baf7 --- /dev/null +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kts @@ -0,0 +1,36 @@ +/* + * Copyright © 2019 IBM. + * + * 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. + */ + +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor +import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment +import org.slf4j.LoggerFactory + +open class SimpleRAProcessor : ResourceAssignmentProcessor() { + + private val log = LoggerFactory.getLogger(SimpleRAProcessor::class.java)!! + + override fun getName(): String { + return "ScriptResourceAssignmentProcessor" + } + + override fun process(executionRequest: ResourceAssignment) { + log.info("Processing input") + } + + override fun recover(runtimeException: RuntimeException, executionRequest: ResourceAssignment) { + log.info("Recovering input") + } +} diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt index bf0fb44d6..0120a8f33 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt @@ -59,7 +59,7 @@ class ExecutionServiceHandler(private val bluePrintPathConfiguration: BluePrintP // Copy the File Part to Local File copyFromFilePart(filePart, compressedFile) // Save the Copied file to Database - return bluePrintCatalogService.saveToDatabase(saveId, compressedFile, false) + return bluePrintCatalogService.saveToDatabase(saveId, compressedFile, true) } catch (e: IOException) { throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value, "Error in Upload CBA: ${e.message}", e) diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt index 35fef96fd..be4327bfe 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt @@ -22,7 +22,6 @@ import com.fasterxml.jackson.databind.JsonNode import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.Status -import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.asObjectNode @@ -120,6 +119,7 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode = arrayListOf() override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeTemplate: NodeTemplate) { - log.info("Validating NodeTemplate($name)") + log.debug("Validating NodeTemplate($name)") this.bluePrintRuntimeService = bluePrintRuntimeService this.bluePrintContext = bluePrintRuntimeService.bluePrintContext() @@ -132,7 +132,8 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator @Throws(BluePrintException::class) open fun validateRequirementAssignment(nodeTemplateName: String, requirementAssignmentName: String, requirementDefinition: RequirementDefinition, requirementAssignment: RequirementAssignment) { - log.info("Validating NodeTemplate({}) requirement assignment ({}) ", nodeTemplateName, requirementAssignmentName) + log.debug("Validating NodeTemplate({}) requirement assignment ({}) ", nodeTemplateName, + requirementAssignmentName) val requirementNodeTemplateName = requirementAssignment.node!! val capabilityName = requirementAssignment.capability val relationship = requirementAssignment.relationship!! @@ -197,7 +198,8 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator val operationDefinition = interfaceDefinition.operations?.get(operationAssignmentName) ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName)") - log.info("Validation NodeTemplate($nodeTemplateName) Interface($interfaceAssignmentName) Operation ($operationAssignmentName)") + log.debug("Validation NodeTemplate($nodeTemplateName) Interface($interfaceAssignmentName) Operation " + + "($operationAssignmentName)") val inputs = operationAssignments.inputs val outputs = operationAssignments.outputs -- cgit 1.2.3-korg