From 9d9510be4570e257e2a17ac2b0ea68910b154da5 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Mon, 12 Nov 2018 13:49:04 -0500 Subject: Controller Blueprints Component Core Define blueprint component or function Interface and Execution data.. Change-Id: I818096a65b750a0723dc14064a18d1b8b47fbaa1 Issue-ID: CCSDK-671 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../core/BluePrintConstants.kt | 8 +-- .../core/interfaces/BlueprintFunctionNode.kt | 37 ++++++++++++++ .../core/api/data/BlueprintProcessorData.kt | 59 ++++++++++++---------- 3 files changed, 72 insertions(+), 32 deletions(-) create mode 100644 components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt index 2590d6dc..84d2befc 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt @@ -143,15 +143,15 @@ object BluePrintConstants { const val METADATA_TEMPLATE_VERSION = "template_version" const val METADATA_TEMPLATE_AUTHOR = "template_author" const val METADATA_TEMPLATE_TAGS = "template_tags" + const val METADATA_WORKFLOW_NAME = "workflow_name" - const val PAYLOAD_CONTENT = "payload-content" const val PAYLOAD_DATA = "payload-data" - const val SELECTOR = "selector" + const val PROPERTY_CURRENT_STEP = "current-step" + const val PROPERTY_CURRENT_NODE_TEMPLATE = "current-node-template" const val PROPERTY_CURRENT_INTERFACE = "current-interface" const val PROPERTY_CURRENT_OPERATION = "current-operation" const val PROPERTY_CURRENT_IMPLEMENTATION = "current-implementation" - - const val PROPERTY_ACTION_NAME = "action" + const val PROPERTY_EXECUTION_REQUEST = "execution-request" const val OPERATION_PROCESS = "process" const val OPERATION_PREPARE = "prepare" diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt new file mode 100644 index 00000000..6add70e6 --- /dev/null +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt @@ -0,0 +1,37 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * 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.apps.controllerblueprints.core.interfaces + +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException +import java.util.function.Function + + +interface BlueprintFunctionNode : Function { + + @Throws(BluePrintProcessorException::class) + fun prepareRequest(executionRequest: T): T + + @Throws(BluePrintProcessorException::class) + fun process(executionRequest: T) + + @Throws(BluePrintProcessorException::class) + fun recover(runtimeException: RuntimeException, executionRequest: T) + + @Throws(BluePrintProcessorException::class) + fun prepareResponse(): R + +} \ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt index 6fed53e6..dc93825e 100644 --- a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt +++ b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt @@ -18,6 +18,7 @@ package org.onap.ccsdk.apps.blueprintsprocessor.core.api.data import com.fasterxml.jackson.annotation.JsonFormat +import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.node.ObjectNode import io.swagger.annotations.ApiModelProperty import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment @@ -29,69 +30,71 @@ import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment */ open class ResourceResolutionInput { - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) lateinit var commonHeader: CommonHeader - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) lateinit var actionIdentifiers: ActionIdentifiers - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) lateinit var resourceAssignments: MutableList - @get:ApiModelProperty(required=true ) + @get:ApiModelProperty(required = true) lateinit var payload: ObjectNode } open class ResourceResolutionOutput { - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) lateinit var commonHeader: CommonHeader - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) lateinit var actionIdentifiers: ActionIdentifiers - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) lateinit var status: Status - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) lateinit var resourceAssignments: MutableList } open class ExecutionServiceInput { - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) lateinit var commonHeader: CommonHeader - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) lateinit var actionIdentifiers: ActionIdentifiers - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) lateinit var payload: ObjectNode + var metadata: MutableMap = hashMapOf() } open class ExecutionServiceOutput { - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) lateinit var commonHeader: CommonHeader - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) lateinit var actionIdentifiers: ActionIdentifiers - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) lateinit var status: Status - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) lateinit var payload: ObjectNode + var metadata: MutableMap = hashMapOf() } open class ActionIdentifiers { - @get:ApiModelProperty(required=false) + @get:ApiModelProperty(required = false) lateinit var blueprintName: String - @get:ApiModelProperty(required=false) + @get:ApiModelProperty(required = false) lateinit var blueprintVersion: String - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) lateinit var actionName: String - @get:ApiModelProperty(required=true, allowableValues = "sync, async") + @get:ApiModelProperty(required = true, allowableValues = "sync, async") lateinit var mode: String } open class CommonHeader { - @get:ApiModelProperty(required=true, example = "2012-04-23T18:25:43.511Z") - @get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") + @get:ApiModelProperty(required = true, example = "2012-04-23T18:25:43.511Z") + @get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") lateinit var timestamp: String - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) lateinit var originatorId: String - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) lateinit var requestId: String - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) lateinit var subRequestId: String - @get:ApiModelProperty(required=false) + @get:ApiModelProperty(required = false) var flags: Flags? = null } @@ -102,11 +105,11 @@ open class Flags { } open class Status { - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) var code: Int = 200 - @get:ApiModelProperty(required=false) + @get:ApiModelProperty(required = false) var errorMessage: String? = null - @get:ApiModelProperty(required=true) + @get:ApiModelProperty(required = true) lateinit var message: String } -- cgit 1.2.3-korg