summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/CapabilityCliDefinitions.kt24
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt2
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt17
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt189
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt60
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockDatabaseConfiguration.kt11
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt4
-rwxr-xr-xms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt12
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt29
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/mock/MockBlueprintProcessorCatalogServiceImpl.kt12
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt137
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientPropertiesDSLTest.kt59
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt9
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorService.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt160
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutorDSL.kt123
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt6
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateImplBuilder.kt26
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt101
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt54
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt4
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/handler/BluePrintModelHandler.kt6
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/BluePrintCatalogLoadService.kt5
-rwxr-xr-xms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt6
29 files changed, 832 insertions, 243 deletions
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/CapabilityCliDefinitions.kt b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/CapabilityCliDefinitions.kt
index 3bf07e79d..27f9cddcf 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/CapabilityCliDefinitions.kt
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/CapabilityCliDefinitions.kt
@@ -16,10 +16,12 @@
package cba.scripts.capability.cli
-import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.componentScriptExecutor
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.nodeTemplateComponentScriptExecutor
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.nodeTypeComponentScriptExecutor
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.artifactTypeTemplateVelocity
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.getAttribute
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.nodeTypeComponent
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.serviceTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.AbstractBluePrintDefinitions
@@ -61,14 +63,16 @@ fun CapabilityCliDefinitions.defaultServiceTemplate() =
step(id = "check", target = "check", description = "Calling check script node")
}
- val checkComponent = componentScriptExecutor(id = "check", description = "") {
- inputs {
- type("kotlin")
- scriptClassReference("cba.scripts.capability.cli.Check")
- }
- outputs {
- status("success")
- responseData("""{ "data" : "Here I am "}""")
+ val checkComponent = BluePrintTypes.nodeTemplateComponentScriptExecutor(id = "check", description = "") {
+ operation(description = "") {
+ inputs {
+ type("kotlin")
+ scriptClassReference("cba.scripts.capability.cli.Check")
+ }
+ outputs {
+ status(getAttribute("status"))
+ responseData("""{ "data" : "Here I am "}""")
+ }
}
artifact(id = "command-template", type = "artifact-template-velocity",
file = "Templates/check-command-template.vtl")
@@ -78,6 +82,6 @@ fun CapabilityCliDefinitions.defaultServiceTemplate() =
artifactType(BluePrintTypes.artifactTypeTemplateVelocity())
nodeType(BluePrintTypes.nodeTypeComponent())
- nodeType(BluePrintTypes.componentScriptExecutor())
+ nodeType(BluePrintTypes.nodeTypeComponentScriptExecutor())
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt
index 4c1d92ae6..cf27cc2de 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt
+++ b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt
@@ -71,7 +71,7 @@ open class Check : AbstractScriptComponentFunction() {
sshClientService.closeSessionNB()
// Set the Response Data
- setAttribute(ComponentScriptExecutor.RESPONSE_DATA, responseLog.asJsonPrimitive())
+ setAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, responseLog.asJsonPrimitive())
log.info("Executing process")
}
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt b/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt
index 30e7c8906..9c0258db0 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt
@@ -34,11 +34,11 @@ import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ExecutionServic
import org.onap.ccsdk.cds.blueprintsprocessor.ssh.BluePrintSshLibConfiguration
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintScriptsServiceImpl
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintScriptsServiceImpl
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.annotation.DirtiesContext
import org.springframework.test.context.ContextConfiguration
@@ -79,8 +79,8 @@ class ComponentCliExecutorTest {
operationInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] = "activate-cli".asJsonPrimitive()
operationInputs[BluePrintConstants.PROPERTY_CURRENT_INTERFACE] = "interfaceName".asJsonPrimitive()
operationInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] = "operationName".asJsonPrimitive()
- operationInputs[ComponentScriptExecutor.SCRIPT_TYPE] = BluePrintConstants.SCRIPT_INTERNAL.asJsonPrimitive()
- operationInputs[ComponentScriptExecutor.SCRIPT_CLASS_REFERENCE] =
+ operationInputs[ComponentScriptExecutor.INPUT_SCRIPT_TYPE] = BluePrintConstants.SCRIPT_INTERNAL.asJsonPrimitive()
+ operationInputs[ComponentScriptExecutor.INPUT_SCRIPT_CLASS_REFERENCE] =
"internal.scripts.TestCliScriptFunction".asJsonPrimitive()
val stepInputData = StepData().apply {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
index df7e0482c..875b9ae32 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
@@ -33,6 +33,23 @@ import org.springframework.stereotype.Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class ResourceResolutionComponent(private val resourceResolutionService: ResourceResolutionService) :
AbstractComponentFunction() {
+ companion object{
+ const val INPUT_REQUEST_ID = "request-id"
+ const val INPUT_RESOURCE_ID = "resource-id"
+ const val INPUT_ACTION_NAME = "action-name"
+ const val INPUT_DYNAMIC_PROPERTIES = "dynamic-properties"
+ const val INPUT_RESOURCE_TYPE = "resource-type"
+ const val INPUT_ARTIFACT_PREFIX_NAMES = "artifact-prefix-names"
+ const val INPUT_RESOLUTION_KEY = "resolution-key"
+ const val INPUT_STORE_RESULT = "store-result"
+ const val INPUT_OCCURRENCE = "occurrence"
+
+ const val ATTRIBUTE_ASSIGNMENT_PARAM = "assignment-params"
+ const val ATTRIBUTE_STATUS = "status"
+
+ const val OUTPUT_RESOURCE_ASSIGNMENT_PARAMS = "resource-assignment-params"
+ const val OUTPUT_STATUS = "status"
+ }
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
new file mode 100644
index 000000000..c71541efd
--- /dev/null
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
@@ -0,0 +1,189 @@
+/*
+ * 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.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution
+
+import com.fasterxml.jackson.databind.JsonNode
+import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.AbstractNodeTemplateImplBuilder
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.PropertiesAssignmentBuilder
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.nodeType
+
+/** Component Extensions **/
+fun BluePrintTypes.nodeTypeComponentResourceResolution(): NodeType {
+ return nodeType(id = "component-resource-resolution", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
+ description = "Resource Assignment Component") {
+
+ attribute(ResourceResolutionComponent.ATTRIBUTE_ASSIGNMENT_PARAM, BluePrintConstants.DATA_TYPE_STRING,
+ true)
+ attribute(ResourceResolutionComponent.ATTRIBUTE_STATUS, BluePrintConstants.DATA_TYPE_STRING,
+ true)
+
+ operation("ResourceResolutionComponent", "ResourceResolutionComponent Operation") {
+ inputs {
+ property(ResourceResolutionComponent.INPUT_REQUEST_ID, BluePrintConstants.DATA_TYPE_STRING,
+ true, "Request Id, Unique Id for the request.")
+
+ property(ResourceResolutionComponent.INPUT_RESOURCE_ID, BluePrintConstants.DATA_TYPE_STRING,
+ false, "Resource Id.")
+
+ property(ResourceResolutionComponent.INPUT_ACTION_NAME, BluePrintConstants.DATA_TYPE_STRING,
+ false, "Action Name of the process")
+
+ property(ResourceResolutionComponent.INPUT_DYNAMIC_PROPERTIES, BluePrintConstants.DATA_TYPE_JSON,
+ false, "Dynamic Json Content or DSL Json reference.")
+
+ property(ResourceResolutionComponent.INPUT_RESOLUTION_KEY, BluePrintConstants.DATA_TYPE_STRING,
+ false, "Key for service instance related correlation.")
+
+ property(ResourceResolutionComponent.INPUT_OCCURRENCE, BluePrintConstants.DATA_TYPE_INTEGER,
+ false, "Number of time to perform the resolution.") {
+ defaultValue(1)
+ }
+
+ property(ResourceResolutionComponent.INPUT_STORE_RESULT, BluePrintConstants.DATA_TYPE_BOOLEAN,
+ false, "Whether or not to store the output.")
+
+ property(ResourceResolutionComponent.INPUT_RESOURCE_TYPE, BluePrintConstants.DATA_TYPE_STRING,
+ false, "Request type.")
+
+ property(ResourceResolutionComponent.INPUT_ARTIFACT_PREFIX_NAMES, BluePrintConstants.DATA_TYPE_LIST,
+ true, "Template , Resource Assignment Artifact Prefix names") {
+ entrySchema(BluePrintConstants.DATA_TYPE_STRING)
+ }
+ }
+ outputs {
+ property(ResourceResolutionComponent.OUTPUT_RESOURCE_ASSIGNMENT_PARAMS, BluePrintConstants.DATA_TYPE_STRING,
+ true, "Output Response")
+ property(ResourceResolutionComponent.OUTPUT_STATUS, BluePrintConstants.DATA_TYPE_STRING,
+ true, "Status of the Component Execution ( success or failure )")
+ }
+ }
+ }
+}
+
+/** Component Builder */
+fun BluePrintTypes.nodeTemplateComponentResourceResolution(id: String,
+ description: String,
+ block: ComponentResourceResolutionNodeTemplateImplBuilder.() -> Unit)
+ : NodeTemplate {
+ return ComponentResourceResolutionNodeTemplateImplBuilder(id, description).apply(block).build()
+}
+
+class ComponentResourceResolutionNodeTemplateImplBuilder(id: String, description: String) :
+ AbstractNodeTemplateImplBuilder<ComponentResourceResolutionInputAssignmentBuilder,
+ ComponentResourceResolutionOutputAssignmentBuilder>(id, "component-script-executor",
+ "ComponentResourceResolution",
+ description)
+
+class ComponentResourceResolutionInputAssignmentBuilder : PropertiesAssignmentBuilder() {
+
+ fun requestId(requestId: String) {
+ requestId(requestId.asJsonPrimitive())
+ }
+
+ fun requestId(requestId: JsonNode) {
+ property(ResourceResolutionComponent.INPUT_REQUEST_ID, requestId)
+ }
+
+ fun resourceId(resourceId: String) {
+ resourceId(resourceId.asJsonPrimitive())
+ }
+
+ fun resourceId(resourceId: JsonNode) {
+ property(ResourceResolutionComponent.INPUT_RESOURCE_ID, resourceId)
+ }
+
+ fun actionName(actionName: String) {
+ actionName(actionName.asJsonPrimitive())
+ }
+
+ fun actionName(actionName: JsonNode) {
+ property(ResourceResolutionComponent.INPUT_ACTION_NAME, actionName)
+ }
+
+ fun resolutionKey(resolutionKey: String) {
+ resolutionKey(resolutionKey.asJsonPrimitive())
+ }
+
+ fun resolutionKey(resolutionKey: JsonNode) {
+ property(ResourceResolutionComponent.INPUT_RESOLUTION_KEY, resolutionKey)
+ }
+
+ fun dynamicProperty(dynamicProperty: String) {
+ dynamicProperty(dynamicProperty.asJsonType())
+ }
+
+ fun dynamicProperty(dynamicProperty: JsonNode) {
+ property(ResourceResolutionComponent.INPUT_DYNAMIC_PROPERTIES, dynamicProperty)
+ }
+
+ fun occurrence(occurrence: Int) {
+ occurrence(occurrence.asJsonPrimitive())
+ }
+
+ fun occurrence(resolutionKey: JsonNode) {
+ property(ResourceResolutionComponent.INPUT_OCCURRENCE, resolutionKey)
+ }
+
+ fun storeResult(storeResult: Boolean) {
+ storeResult(storeResult.asJsonPrimitive())
+ }
+
+ fun storeResult(storeResult: JsonNode) {
+ property(ResourceResolutionComponent.INPUT_STORE_RESULT, storeResult)
+ }
+
+ fun resourceType(resourceType: String) {
+ resourceType(resourceType.asJsonPrimitive())
+ }
+
+ fun resourceType(resourceType: JsonNode) {
+ property(ResourceResolutionComponent.INPUT_RESOURCE_TYPE, resourceType)
+ }
+
+ fun artifactPrefixNames(artifactPrefixNames: String) = artifactPrefixNames(artifactPrefixNames.jsonAsJsonType())
+
+ fun artifactPrefixNames(artifactPrefixNameList: List<String>) {
+ artifactPrefixNames(artifactPrefixNameList.asJsonString())
+ }
+
+ fun artifactPrefixNames(artifactPrefixNames: JsonNode) {
+ property(ResourceResolutionComponent.INPUT_ARTIFACT_PREFIX_NAMES, artifactPrefixNames)
+ }
+}
+
+class ComponentResourceResolutionOutputAssignmentBuilder : PropertiesAssignmentBuilder() {
+
+ fun status(status: String) {
+ status(status.asJsonPrimitive())
+ }
+
+ fun status(status: JsonNode) {
+ property(ResourceResolutionComponent.OUTPUT_STATUS, status)
+ }
+
+ fun resourceAssignmentParams(resourceAssignmentParams: String) {
+ resourceAssignmentParams(resourceAssignmentParams.asJsonType())
+ }
+
+ fun resourceAssignmentParams(resourceAssignmentParams: JsonNode) {
+ property(ResourceResolutionComponent.OUTPUT_RESOURCE_ASSIGNMENT_PARAMS, resourceAssignmentParams)
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt
new file mode 100644
index 000000000..16052ae74
--- /dev/null
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution
+
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.getAttribute
+import kotlin.test.Test
+import kotlin.test.assertNotNull
+
+class ResourceResolutionComponentDSLTest {
+
+ @Test
+ fun testNodeTypeComponentResourceResolution() {
+ val nodeType = BluePrintTypes.nodeTypeComponentResourceResolution()
+ //println(nodeType.asJsonString(true))
+ assertNotNull(nodeType, "failed to generate nodeTypeComponentResourceResolution")
+ }
+
+ @Test
+ fun testNodeTemplateComponentResourceResolution() {
+ val nodeTemplate = BluePrintTypes.nodeTemplateComponentResourceResolution("resource-resolve", "") {
+ operation("Resolve resources") {
+ inputs {
+ actionName("resolve")
+ requestId("1234")
+ resolutionKey("vnf-1234")
+ occurrence(2)
+ resourceType("vnf")
+ storeResult(false)
+ artifactPrefixNames(arrayListOf("template1", "template2"))
+ dynamicProperty("""{
+ "prop1" : "1234",
+ "prop2" : true,
+ "prop3" : 23
+ }""".trimIndent())
+ }
+ outputs {
+ resourceAssignmentParams(getAttribute("assignment-params"))
+ status("success")
+ }
+ }
+ }
+ //println(nodeTemplate.asJsonString(true))
+ assertNotNull(nodeTemplate, "failed to generate nodeTemplateComponentResourceResolution")
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockDatabaseConfiguration.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockDatabaseConfiguration.kt
index 22e043b11..7644df37a 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockDatabaseConfiguration.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockDatabaseConfiguration.kt
@@ -15,9 +15,11 @@
*/
package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock
+import io.mockk.every
import io.mockk.mockk
import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibGenericService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@@ -33,9 +35,12 @@ open class MockDatabaseConfiguration {
@Configuration
open class MockBlueprintProcessorCatalogServiceImpl {
- @Bean(name = ["blueprintProcessorCatalogServiceImpl"])
- open fun createBlueprintProcessorCatalogServiceImpl(): BluePrintValidatorService {
- return mockk<BluePrintValidatorService>()
+ @Bean(name = ["bluePrintRuntimeValidatorService"])
+ open fun bluePrintRuntimeValidatorService(): BluePrintValidatorService {
+ val bluePrintValidatorService = mockk<BluePrintValidatorService>()
+ every { bluePrintValidatorService.validateBluePrints(any<String>()) } returns true
+ every { bluePrintValidatorService.validateBluePrints(any<BluePrintRuntimeService<*>>()) } returns true
+ return bluePrintValidatorService
}
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt
index fb47b6ad1..2b2b83e4c 100644
--- a/ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt
@@ -79,8 +79,8 @@ class ComponentRestconfExecutorTest {
operationInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] = "activate-restconf".asJsonPrimitive()
operationInputs[BluePrintConstants.PROPERTY_CURRENT_INTERFACE] = "interfaceName".asJsonPrimitive()
operationInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] = "operationName".asJsonPrimitive()
- operationInputs[ComponentScriptExecutor.SCRIPT_TYPE] = BluePrintConstants.SCRIPT_INTERNAL.asJsonPrimitive()
- operationInputs[ComponentScriptExecutor.SCRIPT_CLASS_REFERENCE] =
+ operationInputs[ComponentScriptExecutor.INPUT_SCRIPT_TYPE] = BluePrintConstants.SCRIPT_INTERNAL.asJsonPrimitive()
+ operationInputs[ComponentScriptExecutor.INPUT_SCRIPT_CLASS_REFERENCE] =
"internal.scripts.TestRestconfConfigure".asJsonPrimitive()
val stepInputData = StepData().apply {
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt
index 9faf879f0..9d5d630de 100755
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt
@@ -39,7 +39,7 @@ import java.util.*
/**
* Similar/Duplicate implementation in [org.onap.ccsdk.cds.controllerblueprints.service.load.ControllerBlueprintCatalogServiceImpl]
*/
-@Service
+@Service("blueprintsProcessorCatalogService")
class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: BluePrintValidatorService,
private val bluePrintPathConfiguration: BluePrintPathConfiguration,
private val blueprintModelRepository: BlueprintProcessorModelRepository)
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt
index 4ea407ada..a62867053 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt
@@ -21,6 +21,7 @@ import org.slf4j.LoggerFactory
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Primary
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing
import org.springframework.data.jpa.repository.config.EnableJpaRepositories
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
import org.springframework.jdbc.datasource.DriverManagerDataSource
@@ -33,10 +34,12 @@ import javax.sql.DataSource
@Configuration
@EnableJpaRepositories(
- basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.*"],
- entityManagerFactoryRef = "primaryEntityManager",
- transactionManagerRef = "primaryTransactionManager"
+ basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.*",
+ "org.onap.ccsdk.cds.controllerblueprints.*"],
+ entityManagerFactoryRef = "primaryEntityManager",
+ transactionManagerRef = "primaryTransactionManager"
)
+@EnableJpaAuditing
open class PrimaryDatabaseConfiguration(private val primaryDataSourceProperties: PrimaryDataSourceProperties) {
val log = LoggerFactory.getLogger(PrimaryDatabaseConfiguration::class.java)!!
@@ -45,7 +48,8 @@ open class PrimaryDatabaseConfiguration(private val primaryDataSourceProperties:
open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
val em = LocalContainerEntityManagerFactoryBean()
em.dataSource = primaryDataSource()
- em.setPackagesToScan("org.onap.ccsdk.cds.blueprintsprocessor.*")
+ em.setPackagesToScan("org.onap.ccsdk.cds.blueprintsprocessor.*",
+ "org.onap.ccsdk.cds.controllerblueprints.*")
em.jpaVendorAdapter = HibernateJpaVendorAdapter()
val properties = HashMap<String, Any>()
properties["hibernate.hbm2ddl.auto"] = primaryDataSourceProperties.hibernateHbm2ddlAuto
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
index e40efd0c4..fe8172b85 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
@@ -20,14 +20,14 @@ package org.onap.ccsdk.cds.blueprintsprocessor.db
import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.junit.runner.RunWith
-import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
-import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.db.mock.MockBlueprintProcessorCatalogServiceImpl
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
+import org.onap.ccsdk.cds.controllerblueprints.db.resources.BlueprintCatalogServiceImpl
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.context.annotation.ComponentScan
@@ -41,17 +41,14 @@ import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@EnableAutoConfiguration
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
+@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor"])
@ContextConfiguration(classes = [BlueprintProcessorCatalogServiceImpl::class, BluePrintCoreConfiguration::class,
MockBlueprintProcessorCatalogServiceImpl::class])
@TestPropertySource(locations = ["classpath:application-test.properties"])
class BlueprintProcessorCatalogServiceImplTest {
@Autowired
- lateinit var blueprintCatalog: BluePrintCatalogService
-
- @Autowired
- lateinit var blueprintProcessorCatalogServiceImpl: BlueprintProcessorCatalogServiceImpl
+ lateinit var blueprintsProcessorCatalogService: BlueprintCatalogServiceImpl
@Autowired
lateinit var blueprintCoreConfiguration: BluePrintCoreConfiguration
@@ -64,7 +61,7 @@ class BlueprintProcessorCatalogServiceImplTest {
fun setup() {
deleteDir("target", "blueprints")
bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(blueprintId,
- "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
}
@AfterTest
@@ -81,10 +78,10 @@ class BlueprintProcessorCatalogServiceImplTest {
val file = normalizedFile("./src/test/resources/test-cba.zip")
assertTrue(file.exists(), "couldn't get file ${file.absolutePath}")
- blueprintCatalog.saveToDatabase("1234", file)
- blueprintCatalog.getFromDatabase("baseconfiguration", "1.0.0")
+ blueprintsProcessorCatalogService.saveToDatabase("1234", file)
+ blueprintsProcessorCatalogService.getFromDatabase("baseconfiguration", "1.0.0")
- blueprintCatalog.deleteFromDatabase("baseconfiguration", "1.0.0")
+ blueprintsProcessorCatalogService.deleteFromDatabase("baseconfiguration", "1.0.0")
}
}
@@ -96,7 +93,7 @@ class BlueprintProcessorCatalogServiceImplTest {
val metadata = bluePrintRuntimeService.bluePrintContext().metadata!!
metadata[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID] = blueprintId
- blueprintProcessorCatalogServiceImpl.save(metadata, file)
+ blueprintsProcessorCatalogService.save(metadata, file)
}
}
@@ -108,8 +105,8 @@ class BlueprintProcessorCatalogServiceImplTest {
val metadata = bluePrintRuntimeService.bluePrintContext().metadata!!
metadata[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID] = blueprintId
- blueprintProcessorCatalogServiceImpl.save(metadata, file)
- blueprintProcessorCatalogServiceImpl.get("baseconfiguration", "1.0.0", true)
+ blueprintsProcessorCatalogService.save(metadata, file)
+ blueprintsProcessorCatalogService.get("baseconfiguration", "1.0.0", true)
}
assertTrue(File(blueprintCoreConfiguration.bluePrintPathConfiguration().blueprintArchivePath +
@@ -121,7 +118,7 @@ class BlueprintProcessorCatalogServiceImplTest {
@Test
fun `test delete function`() {
runBlocking {
- blueprintProcessorCatalogServiceImpl.delete("baseconfiguration", "1.0.0")
+ blueprintsProcessorCatalogService.delete("baseconfiguration", "1.0.0")
}
}
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/mock/MockBlueprintProcessorCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/mock/MockBlueprintProcessorCatalogServiceImpl.kt
index 08de33270..b98fc0c44 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/mock/MockBlueprintProcessorCatalogServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/mock/MockBlueprintProcessorCatalogServiceImpl.kt
@@ -15,15 +15,21 @@
*/
package org.onap.ccsdk.cds.blueprintsprocessor.db.mock
+import io.mockk.every
import io.mockk.mockk
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
+
@Configuration
open class MockBlueprintProcessorCatalogServiceImpl {
- @Bean(name = ["blueprintProcessorCatalogServiceImpl"])
- open fun createBlueprintProcessorCatalogServiceImpl(): BluePrintValidatorService {
- return mockk<BluePrintValidatorService>()
+ @Bean(name = ["bluePrintRuntimeValidatorService"])
+ open fun bluePrintRuntimeValidatorService(): BluePrintValidatorService {
+ val bluePrintValidatorService = mockk<BluePrintValidatorService>()
+ every { bluePrintValidatorService.validateBluePrints(any<String>()) } returns true
+ every { bluePrintValidatorService.validateBluePrints(any<BluePrintRuntimeService<*>>()) } returns true
+ return bluePrintValidatorService
}
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt
index 25d1de881..b68627fec 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt
@@ -51,6 +51,7 @@ fun BluePrintDependencyService.restClientService(jsonNode: JsonNode): BlueprintW
class RestLibConstants {
companion object {
const val SERVICE_BLUEPRINT_REST_LIB_PROPERTY = "blueprint-rest-lib-property-service"
+ const val PROPERTY_TYPE = "type"
const val TYPE_TOKEN_AUTH = "token-auth"
const val TYPE_BASIC_AUTH = "basic-auth"
const val TYPE_SSL_BASIC_AUTH = "ssl-basic-auth"
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt
index 70ec9501a..75a9409fd 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt
@@ -30,10 +30,12 @@ open class SSLRestClientProperties : RestClientProperties() {
var sslKeyPassword: String? = null
}
+// FIXME("Define basic auth userName and password properties")
open class SSLBasicAuthRestClientProperties : SSLRestClientProperties() {
var basicAuth: BasicAuthRestClientProperties? = null
}
+// FIXME("Define token properties")
open class SSLTokenAuthRestClientProperties : SSLRestClientProperties() {
var tokenAuth: TokenAuthRestClientProperties? = null
}
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt
new file mode 100644
index 000000000..a3da44f61
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt
@@ -0,0 +1,137 @@
+/*
+ * 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.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.rest
+
+import com.fasterxml.jackson.databind.JsonNode
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.PropertiesAssignmentBuilder
+
+fun BluePrintTypes.dslBasicAuthRestClientProperties(block: BasicAuthRestClientPropertiesBuilder.() -> Unit): JsonNode {
+ val assignments = BasicAuthRestClientPropertiesBuilder().apply(block).build()
+ assignments[RestLibConstants.PROPERTY_TYPE] = RestLibConstants.TYPE_BASIC_AUTH.asJsonPrimitive()
+ return assignments.asJsonType()
+}
+
+fun BluePrintTypes.dslTokenAuthRestClientProperties(block: TokenAuthRestClientPropertiesBuilder.() -> Unit): JsonNode {
+ val assignments = TokenAuthRestClientPropertiesBuilder().apply(block).build()
+ assignments[RestLibConstants.PROPERTY_TYPE] = RestLibConstants.TYPE_TOKEN_AUTH.asJsonPrimitive()
+ return assignments.asJsonType()
+}
+
+fun BluePrintTypes.dslSSLRestClientProperties(block: SSLRestClientPropertiesBuilder.() -> Unit): JsonNode {
+ val assignments = SSLRestClientPropertiesBuilder().apply(block).build()
+ assignments[RestLibConstants.PROPERTY_TYPE] = RestLibConstants.TYPE_SSL_NO_AUTH.asJsonPrimitive()
+ return assignments.asJsonType()
+}
+
+open class RestClientPropertiesBuilder : PropertiesAssignmentBuilder() {
+ fun type(type: String) {
+ type(type.asJsonPrimitive())
+ }
+
+ fun type(type: JsonNode) {
+ property(RestLibConstants.PROPERTY_TYPE, type)
+ }
+
+ open fun url(url: String) {
+ url(url.asJsonPrimitive())
+ }
+
+ open fun url(url: JsonNode) {
+ property("url", url)
+ }
+}
+
+open class BasicAuthRestClientPropertiesBuilder : RestClientPropertiesBuilder() {
+ open fun password(password: String) {
+ password(password.asJsonPrimitive())
+ }
+
+ open fun password(password: JsonNode) {
+ property("password", password)
+ }
+
+ open fun username(username: String) {
+ username(username.asJsonPrimitive())
+ }
+
+ open fun username(username: JsonNode) {
+ property("username", username)
+ }
+}
+
+open class TokenAuthRestClientPropertiesBuilder : RestClientPropertiesBuilder() {
+ open fun token(token: String) {
+ token(token.asJsonPrimitive())
+ }
+
+ open fun token(token: JsonNode) {
+ property("token", token)
+ }
+}
+
+open class SSLRestClientPropertiesBuilder : RestClientPropertiesBuilder() {
+ open fun keyStoreInstance(keyStoreInstance: String) {
+ keyStoreInstance(keyStoreInstance.asJsonPrimitive())
+ }
+
+ open fun keyStoreInstance(keyStoreInstance: JsonNode) {
+ property("keyStoreInstance", keyStoreInstance)
+ }
+
+ open fun sslTrust(sslTrust: String) {
+ sslTrust(sslTrust.asJsonPrimitive())
+ }
+
+ open fun sslTrust(sslTrust: JsonNode) {
+ property("sslTrust", sslTrust)
+ }
+
+ open fun sslTrustPassword(sslTrustPassword: String) {
+ sslTrustPassword(sslTrustPassword.asJsonPrimitive())
+ }
+
+ open fun sslTrustPassword(sslTrustPassword: JsonNode) {
+ property("sslTrustPassword", sslTrustPassword)
+ }
+
+ open fun sslKey(sslKey: String) {
+ sslKey(sslKey.asJsonPrimitive())
+ }
+
+ open fun sslKey(sslKey: JsonNode) {
+ property("sslKey", sslKey)
+ }
+
+ open fun sslKeyPassword(sslKeyPassword: String) {
+ sslKeyPassword(sslKeyPassword.asJsonPrimitive())
+ }
+
+ open fun sslKeyPassword(sslKeyPassword: JsonNode) {
+ property("sslKeyPassword", sslKeyPassword)
+ }
+}
+
+open class SSLBasicAuthRestClientPropertiesBuilder : SSLRestClientPropertiesBuilder() {
+ //TODO()
+}
+
+open class SSLTokenAuthRestClientPropertiesBuilder : SSLRestClientPropertiesBuilder() {
+ //TODO()
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientPropertiesDSLTest.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientPropertiesDSLTest.kt
new file mode 100644
index 000000000..15133fa8a
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientPropertiesDSLTest.kt
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.rest.service
+
+import org.junit.Test
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.dslBasicAuthRestClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.dslSSLRestClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.dslTokenAuthRestClientProperties
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import kotlin.test.assertNotNull
+
+class RestClientPropertiesDSLTest {
+
+ @Test
+ fun testBasicAuthRestClientProperties() {
+ val properties = BluePrintTypes.dslBasicAuthRestClientProperties {
+ url("http://localhost:8080")
+ username("xxxxx")
+ password("******")
+ }
+ assertNotNull(properties, "failed to get dslBasicAuthRestClientProperties")
+ }
+
+ @Test
+ fun testBasicTokenAuthRestClientProperties() {
+ val properties = BluePrintTypes.dslTokenAuthRestClientProperties {
+ url("http://localhost:8080")
+ token("sdfgfsadgsgf")
+ }
+ assertNotNull(properties, "failed to get dslTokenAuthRestClientProperties")
+ }
+
+ @Test
+ fun testDslSSLRestClientProperties() {
+ val properties = BluePrintTypes.dslSSLRestClientProperties {
+ url("http://localhost:8080")
+ keyStoreInstance("instance")
+ sslTrust("sample-trust")
+ sslTrustPassword("sample-trust-password")
+ sslKey("sample-sslkey")
+ sslKeyPassword("sample-key-password")
+ }
+ assertNotNull(properties, "failed to get dslSSLRestClientProperties")
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt
index 549d6cd9f..81f3ec309 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt
@@ -41,7 +41,7 @@ import java.util.*
@Service
open class BluePrintManagementGRPCHandler(private val bluePrintPathConfiguration: BluePrintPathConfiguration,
- private val bluePrintCatalogService: BluePrintCatalogService)
+ private val blueprintsProcessorCatalogService: BluePrintCatalogService)
: BluePrintManagementServiceGrpc.BluePrintManagementServiceImplBase() {
private val log = LoggerFactory.getLogger(BluePrintManagementGRPCHandler::class.java)
@@ -58,7 +58,7 @@ open class BluePrintManagementGRPCHandler(private val bluePrintPathConfiguration
saveToDisk(request, cbaFile)
- val blueprintId = bluePrintCatalogService.saveToDatabase(uploadId, cbaFile)
+ val blueprintId = blueprintsProcessorCatalogService.saveToDatabase(uploadId, cbaFile)
responseObserver.onNext(successStatus("Successfully uploaded CBA($blueprintId)...", request.commonHeader))
responseObserver.onCompleted()
} catch (e: Exception) {
@@ -83,7 +83,7 @@ open class BluePrintManagementGRPCHandler(private val bluePrintPathConfiguration
try {
- bluePrintCatalogService.deleteFromDatabase(blueprintName, blueprintVersion)
+ blueprintsProcessorCatalogService.deleteFromDatabase(blueprintName, blueprintVersion)
responseObserver.onNext(successStatus("Successfully deleted $blueprint", request.commonHeader))
responseObserver.onCompleted()
} catch (e: Exception) {
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 347e5eac4..094fb68da 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
@@ -17,7 +17,6 @@
package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api
-import com.fasterxml.jackson.databind.node.JsonNodeFactory
import io.grpc.stub.StreamObserver
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
@@ -42,7 +41,7 @@ import java.util.stream.Collectors
@Service
class ExecutionServiceHandler(private val bluePrintPathConfiguration: BluePrintPathConfiguration,
- private val bluePrintCatalogService: BluePrintCatalogService,
+ private val blueprintsProcessorCatalogService: BluePrintCatalogService,
private val bluePrintWorkflowExecutionService
: BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput>) {
@@ -59,7 +58,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, true)
+ return blueprintsProcessorCatalogService.saveToDatabase(saveId, compressedFile, true)
} catch (e: IOException) {
throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value,
"Error in Upload CBA: ${e.message}", e)
@@ -70,7 +69,7 @@ class ExecutionServiceHandler(private val bluePrintPathConfiguration: BluePrintP
}
suspend fun remove(name: String, version: String) {
- bluePrintCatalogService.deleteFromDatabase(name, version)
+ blueprintsProcessorCatalogService.deleteFromDatabase(name, version)
}
suspend fun process(executionServiceInput: ExecutionServiceInput,
@@ -102,7 +101,7 @@ class ExecutionServiceHandler(private val bluePrintPathConfiguration: BluePrintP
val blueprintName = actionIdentifiers.blueprintName
val blueprintVersion = actionIdentifiers.blueprintVersion
try {
- val basePath = bluePrintCatalogService.getFromDatabase(blueprintName, blueprintVersion)
+ val basePath = blueprintsProcessorCatalogService.getFromDatabase(blueprintName, blueprintVersion)
log.info("blueprint base path $basePath")
val blueprintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(requestId, basePath.toString())
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorService.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorService.kt
index 707439ddb..ab0d4256c 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorService.kt
@@ -21,7 +21,7 @@ import org.onap.ccsdk.cds.controllerblueprints.validation.BluePrintDesignTimeVal
import org.onap.ccsdk.cds.controllerblueprints.validation.extension.ResourceDefinitionValidator
import org.springframework.stereotype.Service
-@Service
+@Service("bluePrintRuntimeValidatorService")
open class BluePrintRuntimeValidatorService(bluePrintTypeValidatorService: BluePrintTypeValidatorService,
resourceDefinitionValidator: ResourceDefinitionValidator)
: BluePrintDesignTimeValidatorService(bluePrintTypeValidatorService, resourceDefinitionValidator)
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
index 95b2afc4c..c66c3e913 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
@@ -16,16 +16,8 @@
package org.onap.ccsdk.cds.blueprintsprocessor.services.execution
-import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.cds.controllerblueprints.core.*
-import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
-import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
-import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
-import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
-import org.onap.ccsdk.cds.controllerblueprints.core.dsl.ArtifactDefinitionBuilder
-import org.onap.ccsdk.cds.controllerblueprints.core.dsl.nodeTemplate
-import org.onap.ccsdk.cds.controllerblueprints.core.dsl.nodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.getAsString
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Component
@@ -40,19 +32,23 @@ open class ComponentScriptExecutor(private var componentFunctionScriptingService
: AbstractComponentFunction() {
companion object {
- const val SCRIPT_TYPE = "script-type"
- const val SCRIPT_CLASS_REFERENCE = "script-class-reference"
- const val DYNAMIC_PROPERTIES = "dynamic-properties"
- const val RESPONSE_DATA = "response-data"
- const val STATUS = "status"
+ const val INPUT_SCRIPT_TYPE = "script-type"
+ const val INPUT_SCRIPT_CLASS_REFERENCE = "script-class-reference"
+ const val INPUT_DYNAMIC_PROPERTIES = "dynamic-properties"
+
+ const val ATTRIBUTE_RESPONSE_DATA = "response-data"
+ const val ATTRIBUTE_STATUS = "status"
+
+ const val OUTPUT_RESPONSE_DATA = "response-data"
+ const val OUTPUT_STATUS = "status"
}
lateinit var scriptComponentFunction: AbstractScriptComponentFunction
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
- val scriptType = operationInputs.getAsString(SCRIPT_TYPE)
- val scriptClassReference = operationInputs.getAsString(SCRIPT_CLASS_REFERENCE)
+ val scriptType = operationInputs.getAsString(INPUT_SCRIPT_TYPE)
+ val scriptClassReference = operationInputs.getAsString(INPUT_SCRIPT_CLASS_REFERENCE)
val scriptDependencies: MutableList<String> = arrayListOf()
populateScriptDependencies(scriptDependencies)
@@ -73,136 +69,4 @@ open class ComponentScriptExecutor(private var componentFunctionScriptingService
open fun populateScriptDependencies(scriptDependencies: MutableList<String>) {
/** Place holder for Child to add extra dependencies */
}
-}
-
-/** Component Extensions **/
-
-fun BluePrintTypes.componentScriptExecutor(): NodeType {
- return nodeType(id = "component-script-executor", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
- description = "Generic Script Component Executor") {
- attribute(ComponentScriptExecutor.RESPONSE_DATA, BluePrintConstants.DATA_TYPE_JSON, false)
- attribute(ComponentScriptExecutor.STATUS, BluePrintConstants.DATA_TYPE_STRING, true)
-
- operation("ComponentScriptExecutor", "ComponentScriptExecutor Operation") {
- inputs {
- property(ComponentScriptExecutor.SCRIPT_TYPE, BluePrintConstants.DATA_TYPE_STRING, true,
- "Script Type") {
- defaultValue(BluePrintConstants.SCRIPT_INTERNAL)
- constrain {
- validValues(listOf(BluePrintConstants.SCRIPT_INTERNAL.asJsonPrimitive(),
- BluePrintConstants.SCRIPT_JYTHON.asJsonPrimitive(),
- BluePrintConstants.SCRIPT_KOTLIN.asJsonPrimitive()))
- }
- }
- property(ComponentScriptExecutor.SCRIPT_CLASS_REFERENCE, BluePrintConstants.DATA_TYPE_STRING,
- true, "Kotlin Script class name or jython script name.")
- property(ComponentScriptExecutor.DYNAMIC_PROPERTIES, BluePrintConstants.DATA_TYPE_JSON, false,
- "Dynamic Json Content or DSL Json reference.")
- }
- outputs {
- property(ComponentScriptExecutor.RESPONSE_DATA, BluePrintConstants.DATA_TYPE_JSON, false,
- "Output Response")
- property(ComponentScriptExecutor.STATUS, BluePrintConstants.DATA_TYPE_STRING, true,
- "Status of the Component Execution ( success or failure )")
- }
- }
- }
-}
-
-/** Component Builder */
-
-fun componentScriptExecutor(id: String, description: String,
- block: ComponentScriptExecutorBuilder.() -> Unit): NodeTemplate {
- return ComponentScriptExecutorBuilder(id, description).apply(block).build()
-}
-
-class ComponentScriptExecutorBuilder(private val id: String, private val description: String) {
- private var implementation: Implementation? = null
- private var inputs: MutableMap<String, JsonNode>? = null
- private var outputs: MutableMap<String, JsonNode>? = null
- private var artifacts: MutableMap<String, ArtifactDefinition>? = null
-
- fun implementation(timeout: Int, operationHost: String? = BluePrintConstants.PROPERTY_SELF) {
- val implementation = Implementation().apply {
- this.operationHost = operationHost!!
- this.timeout = timeout
- }
- this.implementation = implementation
- }
-
- fun inputs(block: InputAssignmentBuilder.() -> Unit) {
- this.inputs = InputAssignmentBuilder().apply(block).build()
- }
-
- fun outputs(block: OutputAssignmentBuilder.() -> Unit) {
- this.outputs = OutputAssignmentBuilder().apply(block).build()
- }
-
- fun artifact(id: String, type: String, file: String) {
- if (artifacts == null)
- artifacts = hashMapOf()
- artifacts!![id] = ArtifactDefinitionBuilder(id, type, file).build()
- }
-
- fun artifact(id: String, type: String, file: String, block: ArtifactDefinitionBuilder.() -> Unit) {
- if (artifacts == null)
- artifacts = hashMapOf()
- artifacts!![id] = ArtifactDefinitionBuilder(id, type, file).apply(block).build()
- }
-
- fun build(): NodeTemplate {
- return nodeTemplate(id, "component-script-executor", description) {
- operation("ComponentScriptExecutor") {
- implementation(implementation)
- inputs(inputs)
- outputs(outputs)
- }
- artifacts(artifacts)
- }
- }
-
- class InputAssignmentBuilder {
- val properties: MutableMap<String, JsonNode> = hashMapOf()
-
- fun type(type: String) {
- properties[ComponentScriptExecutor.SCRIPT_TYPE] = type.asJsonPrimitive()
- }
-
- fun scriptClassReference(scriptClassReference: String) {
- properties[ComponentScriptExecutor.SCRIPT_CLASS_REFERENCE] = scriptClassReference.asJsonPrimitive()
- }
-
- fun dynamicProperty(dynamicProperty: Any) {
- dynamicProperty(dynamicProperty.asJsonType())
- }
-
- fun dynamicProperty(dynamicProperty: JsonNode) {
- properties[ComponentScriptExecutor.DYNAMIC_PROPERTIES] = dynamicProperty
- }
-
- fun build(): MutableMap<String, JsonNode> {
- return properties
- }
- }
-
- class OutputAssignmentBuilder {
- val properties: MutableMap<String, JsonNode> = hashMapOf()
-
- fun status(status: String) {
- properties[ComponentScriptExecutor.STATUS] = status.asJsonPrimitive()
- }
-
- fun responseData(responseData: Any) {
- responseData(responseData.asJsonType())
- }
-
- fun responseData(responseData: JsonNode) {
- properties[ComponentScriptExecutor.RESPONSE_DATA] = responseData
- }
-
- fun build(): MutableMap<String, JsonNode> {
- return properties
- }
- }
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutorDSL.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutorDSL.kt
new file mode 100644
index 000000000..1b905fa60
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutorDSL.kt
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor.services.execution
+
+import com.fasterxml.jackson.databind.JsonNode
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.AbstractNodeTemplateImplBuilder
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.PropertiesAssignmentBuilder
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.nodeType
+
+/** Component Extensions **/
+
+fun BluePrintTypes.nodeTypeComponentScriptExecutor(): NodeType {
+ return nodeType(id = "component-script-executor", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
+ description = "Generic Script Component Executor") {
+ attribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, BluePrintConstants.DATA_TYPE_JSON, false)
+ attribute(ComponentScriptExecutor.ATTRIBUTE_STATUS, BluePrintConstants.DATA_TYPE_STRING, true)
+
+ operation("ComponentScriptExecutor", "ComponentScriptExecutor Operation") {
+ inputs {
+ property(ComponentScriptExecutor.INPUT_SCRIPT_TYPE, BluePrintConstants.DATA_TYPE_STRING,
+ true, "Script Type") {
+ defaultValue(BluePrintConstants.SCRIPT_INTERNAL)
+ constrain {
+ validValues(listOf(BluePrintConstants.SCRIPT_INTERNAL.asJsonPrimitive(),
+ BluePrintConstants.SCRIPT_JYTHON.asJsonPrimitive(),
+ BluePrintConstants.SCRIPT_KOTLIN.asJsonPrimitive()))
+ }
+ }
+ property(ComponentScriptExecutor.INPUT_SCRIPT_CLASS_REFERENCE, BluePrintConstants.DATA_TYPE_STRING,
+ true, "Kotlin Script class name or jython script name.")
+ property(ComponentScriptExecutor.INPUT_DYNAMIC_PROPERTIES, BluePrintConstants.DATA_TYPE_JSON,
+ false, "Dynamic Json Content or DSL Json reference.")
+ }
+ outputs {
+ property(ComponentScriptExecutor.OUTPUT_RESPONSE_DATA, BluePrintConstants.DATA_TYPE_JSON,
+ false, "Output Response")
+ property(ComponentScriptExecutor.OUTPUT_STATUS, BluePrintConstants.DATA_TYPE_STRING,
+ true, "Status of the Component Execution ( success or failure )")
+ }
+ }
+ }
+}
+
+/** Component Builder */
+fun BluePrintTypes.nodeTemplateComponentScriptExecutor(id: String,
+ description: String,
+ block: ComponentScriptExecutorNodeTemplateImplBuilder.() -> Unit)
+ : NodeTemplate {
+ return ComponentScriptExecutorNodeTemplateImplBuilder(id, description).apply(block).build()
+}
+
+class ComponentScriptExecutorNodeTemplateImplBuilder(id: String, description: String) :
+ AbstractNodeTemplateImplBuilder<ComponentScriptExecutorInputAssignmentBuilder,
+ ComponentScriptExecutorOutputAssignmentBuilder>(id, "component-script-executor",
+ "ComponentScriptExecutor",
+ description)
+
+class ComponentScriptExecutorInputAssignmentBuilder : PropertiesAssignmentBuilder() {
+
+ fun type(type: String) {
+ type(type.asJsonPrimitive())
+ }
+
+ fun type(type: JsonNode) {
+ property(ComponentScriptExecutor.INPUT_SCRIPT_TYPE, type)
+ }
+
+ fun scriptClassReference(scriptClassReference: String) {
+ scriptClassReference(scriptClassReference.asJsonPrimitive())
+ }
+
+ fun scriptClassReference(scriptClassReference: JsonNode) {
+ property(ComponentScriptExecutor.INPUT_SCRIPT_CLASS_REFERENCE, scriptClassReference)
+ }
+
+ fun dynamicProperty(dynamicProperty: String) {
+ dynamicProperty(dynamicProperty.asJsonType())
+ }
+
+ fun dynamicProperty(dynamicProperty: JsonNode) {
+ property(ComponentScriptExecutor.INPUT_DYNAMIC_PROPERTIES, dynamicProperty)
+ }
+}
+
+class ComponentScriptExecutorOutputAssignmentBuilder : PropertiesAssignmentBuilder() {
+
+ fun status(status: String) {
+ status(status.asJsonPrimitive())
+ }
+
+ fun status(status: JsonNode) {
+ property(ComponentScriptExecutor.OUTPUT_STATUS, status)
+ }
+
+ fun responseData(responseData: String) {
+ responseData(responseData.asJsonType())
+ }
+
+ fun responseData(responseData: JsonNode) {
+ property(ComponentScriptExecutor.OUTPUT_RESPONSE_DATA, responseData)
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt
index 309db9df4..07be8c809 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt
@@ -34,15 +34,15 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInpu
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService
-import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.componentScriptExecutor
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.nodeTypeComponentScriptExecutor
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
+import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintScriptsServiceImpl
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintScriptsServiceImpl
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.junit4.SpringRunner
@@ -187,7 +187,7 @@ class AbstractComponentFunctionTest {
@Test
fun testComponentScriptExecutorNodeType() {
- val componentScriptExecutor = BluePrintTypes.componentScriptExecutor()
+ val componentScriptExecutor = BluePrintTypes.nodeTypeComponentScriptExecutor()
assertNotNull(componentScriptExecutor.interfaces, "failed to get interface operations")
}
}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateImplBuilder.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateImplBuilder.kt
new file mode 100644
index 000000000..7ab139070
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateImplBuilder.kt
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+package org.onap.ccsdk.cds.controllerblueprints.core.dsl
+
+abstract class AbstractNodeTemplateImplBuilder<In : PropertiesAssignmentBuilder, Out : PropertiesAssignmentBuilder>(
+ id: String, type: String, private val interfaceName: String, description: String
+) : NodeTemplateBuilder(id, type, description) {
+
+ open fun operation(description: String, block: OperationAssignmentBuilder<In, Out>.() -> Unit) {
+ typedOperation<In, Out>(interfaceName, description, block)
+ }
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt
index 93b6f4e4e..b3aaabe38 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt
@@ -20,6 +20,9 @@ import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import kotlin.reflect.KClass
+import kotlin.reflect.full.createInstance
+import kotlin.reflect.jvm.reflect
class TopologyTemplateBuilder {
private var topologyTemplate = TopologyTemplate()
@@ -39,7 +42,8 @@ class TopologyTemplateBuilder {
}
fun nodeTemplateOperation(nodeTemplateName: String, type: String, interfaceName: String, description: String,
- operationBlock: OperationAssignmentBuilder.() -> Unit) {
+ operationBlock: OperationAssignmentBuilder<PropertiesAssignmentBuilder,
+ PropertiesAssignmentBuilder>.() -> Unit) {
if (nodeTemplates == null)
nodeTemplates = hashMapOf()
@@ -84,9 +88,9 @@ class TopologyTemplateBuilder {
}
}
-class NodeTemplateBuilder(private val id: String,
- private val type: String,
- private val description: String? = "") {
+open class NodeTemplateBuilder(private val id: String,
+ private val type: String,
+ private val description: String? = "") {
private var nodeTemplate: NodeTemplate = NodeTemplate()
private var properties: MutableMap<String, JsonNode>? = null
private var interfaces: MutableMap<String, InterfaceAssignment>? = null
@@ -94,14 +98,19 @@ class NodeTemplateBuilder(private val id: String,
private var capabilities: MutableMap<String, CapabilityAssignment>? = null
private var requirements: MutableMap<String, RequirementAssignment>? = null
+ fun properties(properties: MutableMap<String, JsonNode>?) {
+ this.properties = properties
+ }
+
fun properties(block: PropertiesAssignmentBuilder.() -> Unit) {
if (properties == null)
properties = hashMapOf()
properties = PropertiesAssignmentBuilder().apply(block).build()
}
- fun operation(interfaceName: String, description: String? = "",
- block: OperationAssignmentBuilder.() -> Unit) {
+ open fun <In : PropertiesAssignmentBuilder, Out : PropertiesAssignmentBuilder> typedOperation(
+ interfaceName: String, description: String = "",
+ block: OperationAssignmentBuilder<In, Out>.() -> Unit) {
if (interfaces == null)
interfaces = hashMapOf()
@@ -109,10 +118,15 @@ class NodeTemplateBuilder(private val id: String,
val defaultOperationName = BluePrintConstants.DEFAULT_STEP_OPERATION
interfaceAssignment.operations = hashMapOf()
interfaceAssignment.operations!![defaultOperationName] =
- OperationAssignmentBuilder(defaultOperationName, description).apply(block).build()
+ OperationAssignmentBuilder<In, Out>(defaultOperationName, description).apply(block).build()
interfaces!![interfaceName] = interfaceAssignment
}
+ fun operation(interfaceName: String, description: String,
+ block: OperationAssignmentBuilder<PropertiesAssignmentBuilder, PropertiesAssignmentBuilder>.() -> Unit) {
+ typedOperation<PropertiesAssignmentBuilder, PropertiesAssignmentBuilder>(interfaceName, description, block)
+ }
+
fun artifact(id: String, type: String, file: String) {
if (artifacts == null)
artifacts = hashMapOf()
@@ -190,10 +204,10 @@ class ArtifactDefinitionBuilder(private val id: String, private val type: String
}
}
-class CapabilityAssignmentBuilder(private val id: String) {
- private var capabilityAssignment: CapabilityAssignment = CapabilityAssignment()
- private var attributes: MutableMap<String, JsonNode>? = null
- private var properties: MutableMap<String, JsonNode>? = null
+open class CapabilityAssignmentBuilder(private val id: String) {
+ var capabilityAssignment: CapabilityAssignment = CapabilityAssignment()
+ var attributes: MutableMap<String, JsonNode>? = null
+ var properties: MutableMap<String, JsonNode>? = null
fun attributes(block: AttributesAssignmentBuilder.() -> Unit) {
if (attributes == null)
@@ -214,9 +228,9 @@ class CapabilityAssignmentBuilder(private val id: String) {
}
}
-class RequirementAssignmentBuilder(private val id: String, private val capability: String,
- private val node: String,
- private val relationship: String) {
+open class RequirementAssignmentBuilder(private val id: String, private val capability: String,
+ private val node: String,
+ private val relationship: String) {
private var requirementAssignment: RequirementAssignment = RequirementAssignment()
fun build(): RequirementAssignment {
@@ -233,10 +247,12 @@ class InterfaceAssignmentBuilder(private val id: String) {
private var interfaceAssignment: InterfaceAssignment = InterfaceAssignment()
private var operations: MutableMap<String, OperationAssignment>? = null
- fun operation(id: String, description: String? = "", block: OperationAssignmentBuilder.() -> Unit) {
+ fun operation(id: String, description: String? = "",
+ block: OperationAssignmentBuilder<PropertiesAssignmentBuilder, PropertiesAssignmentBuilder>.() -> Unit) {
if (operations == null)
operations = hashMapOf()
- operations!![id] = OperationAssignmentBuilder(id, description).apply(block).build()
+ operations!![id] = OperationAssignmentBuilder<PropertiesAssignmentBuilder, PropertiesAssignmentBuilder>(
+ id, description).apply(block).build()
}
fun build(): InterfaceAssignment {
@@ -246,8 +262,9 @@ class InterfaceAssignmentBuilder(private val id: String) {
}
}
-class OperationAssignmentBuilder(private val id: String,
- private val description: String? = "") {
+class OperationAssignmentBuilder<In : PropertiesAssignmentBuilder, Out : PropertiesAssignmentBuilder>(
+ private val id: String,
+ private val description: String? = "") {
private var operationAssignment: OperationAssignment = OperationAssignment()
@@ -256,27 +273,33 @@ class OperationAssignmentBuilder(private val id: String,
}
fun implementation(timeout: Int, operationHost: String? = BluePrintConstants.PROPERTY_SELF) {
- val implementation = Implementation().apply {
+ operationAssignment.implementation = Implementation().apply {
this.operationHost = operationHost!!
this.timeout = timeout
}
- operationAssignment.implementation = implementation
+ }
+
+ fun implementation(timeout: Int, operationHost: String? = BluePrintConstants.PROPERTY_SELF,
+ block: ImplementationBuilder.() -> Unit) {
+ operationAssignment.implementation = ImplementationBuilder(timeout, operationHost!!).apply(block).build()
}
fun inputs(inputs: MutableMap<String, JsonNode>?) {
operationAssignment.inputs = inputs
}
- fun inputs(block: PropertiesAssignmentBuilder.() -> Unit) {
- operationAssignment.inputs = PropertiesAssignmentBuilder().apply(block).build()
+ fun inputs(block: In.() -> Unit) {
+ val instance: In = (block.reflect()?.parameters?.get(0)?.type?.classifier as KClass<In>).createInstance()
+ operationAssignment.inputs = instance.apply(block).build()
}
fun outputs(outputs: MutableMap<String, JsonNode>?) {
operationAssignment.outputs = outputs
}
- fun outputs(block: PropertiesAssignmentBuilder.() -> Unit) {
- operationAssignment.outputs = PropertiesAssignmentBuilder().apply(block).build()
+ fun outputs(block: Out.() -> Unit) {
+ val instance: Out = (block.reflect()?.parameters?.get(0)?.type?.classifier as KClass<Out>).createInstance()
+ operationAssignment.outputs = instance.apply(block).build()
}
fun build(): OperationAssignment {
@@ -286,8 +309,30 @@ class OperationAssignmentBuilder(private val id: String,
}
}
-class PropertiesAssignmentBuilder {
- private var properties: MutableMap<String, JsonNode> = hashMapOf()
+class ImplementationBuilder(private val timeout: Int, private val operationHost: String) {
+ private val implementation = Implementation()
+
+ fun primary(primary: String) {
+ implementation.primary = primary
+ }
+
+ fun dependencies(vararg dependencies: String) {
+ if (implementation.dependencies == null)
+ implementation.dependencies = arrayListOf()
+ dependencies.forEach {
+ implementation.dependencies!!.add(it)
+ }
+ }
+
+ fun build(): Implementation {
+ implementation.timeout = timeout
+ implementation.operationHost = operationHost
+ return implementation
+ }
+}
+
+open class PropertiesAssignmentBuilder {
+ var properties: MutableMap<String, JsonNode> = hashMapOf()
fun property(id: String, value: Any) {
property(id, value.asJsonType())
@@ -302,8 +347,8 @@ class PropertiesAssignmentBuilder {
}
}
-class AttributesAssignmentBuilder {
- private var attributes: MutableMap<String, JsonNode> = hashMapOf()
+open class AttributesAssignmentBuilder {
+ var attributes: MutableMap<String, JsonNode> = hashMapOf()
fun attribute(id: String, value: String) {
attribute(id, value.asJsonType())
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt
index c0641be69..ba2f07072 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt
@@ -16,9 +16,11 @@
package org.onap.ccsdk.cds.controllerblueprints.core.dsl
+import com.fasterxml.jackson.databind.JsonNode
import org.junit.Test
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsJsonType
import kotlin.test.assertNotNull
@@ -94,6 +96,10 @@ class BluePrintDSLTest {
topologyTemplate {
nodeTemplateOperation(nodeTemplateName = "activate", type = "sample-node-type", interfaceName = "RestconfExecutor",
description = "sample activation") {
+ implementation(360, "SELF") {
+ primary("Scripts/sample.py")
+ dependencies("one", "two")
+ }
inputs {
property("json-content", """{ "name" : "cds"}""")
property("array-content", """["controller", "blueprints"]""")
@@ -185,7 +191,7 @@ class BluePrintDSLTest {
}
}
assertNotNull(nodeType, "failed to get nodeType")
- // println(nodeType.asJsonString(true))
+ // println(nodeType.asJsonString(true))
}
@Test
@@ -207,4 +213,50 @@ class BluePrintDSLTest {
//println(serviceTemplate.asJsonString(true))
}
+ @Test
+ fun testNodeTemplateOperationTypes() {
+
+ val testNodeTemplateInstance = BluePrintTypes.nodeTemplateComponentTestExecutor(id = "test-node-template",
+ description = "") {
+ operation("") {
+ implementation(360)
+ inputs {
+ request("i am request")
+ }
+ outputs {
+ response(getAttribute("attribute1"))
+ }
+ }
+ }
+ assertNotNull(testNodeTemplateInstance, "failed to get test node template")
+ //println(testNodeTemplateInstance.asJsonString(true))
+ }
+}
+
+fun BluePrintTypes.nodeTemplateComponentTestExecutor(id: String,
+ description: String,
+ block: TestNodeTemplateImplBuilder.() -> Unit)
+ : NodeTemplate {
+ return TestNodeTemplateImplBuilder(id, description).apply(block).build()
+}
+
+class TestNodeTemplateImplBuilder(id: String, description: String) :
+ AbstractNodeTemplateImplBuilder<TestInput, TestOutput>(id, "component-test-executor",
+ "ComponentTestExecutor",
+ description)
+
+class TestInput : PropertiesAssignmentBuilder() {
+ fun request(request: String) {
+ property("request", request.asJsonPrimitive())
+ }
+}
+
+class TestOutput : PropertiesAssignmentBuilder() {
+ fun response(response: String) {
+ response(response.asJsonPrimitive())
+ }
+
+ fun response(response: JsonNode) {
+ property("response", response)
+ }
}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt
index c67a9bc0c..9ffd78f9e 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt
@@ -17,7 +17,6 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
@@ -28,12 +27,13 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDictionaryConstants
import org.onap.ccsdk.cds.controllerblueprints.validation.extension.ResourceDefinitionValidator
+import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.io.File
import java.util.*
-@Service
+@Service("bluePrintDesignTimeValidatorService")
open class BluePrintDesignTimeValidatorService(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService,
private val resourceDefinitionValidator: ResourceDefinitionValidator)
: BluePrintValidatorService {
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/handler/BluePrintModelHandler.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/handler/BluePrintModelHandler.kt
index c54bf87fe..f40da68f6 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/handler/BluePrintModelHandler.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/handler/BluePrintModelHandler.kt
@@ -50,7 +50,7 @@ import java.util.*
*/
@Service
-open class BluePrintModelHandler(private val bluePrintCatalogService: BluePrintCatalogService,
+open class BluePrintModelHandler(private val controllerBlueprintsCatalogService: BluePrintCatalogService,
private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
private val blueprintModelSearchRepository: ControllerBlueprintModelSearchRepository,
private val blueprintModelRepository: ControllerBlueprintModelRepository,
@@ -86,7 +86,7 @@ open class BluePrintModelHandler(private val bluePrintCatalogService: BluePrintC
// Copy the File Part to Local File
BluePrintEnhancerUtils.copyFromFilePart(filePart, deCompressedFile)
// Save the Copied file to Database
- val blueprintId = bluePrintCatalogService.saveToDatabase(saveId, deCompressedFile, false)
+ val blueprintId = controllerBlueprintsCatalogService.saveToDatabase(saveId, deCompressedFile, false)
// Check and Return the Saved File
val blueprintModelSearch = blueprintModelSearchRepository.findById(blueprintId).get()
log.info("Save($saveId) successful for blueprint(${blueprintModelSearch.artifactName}) " +
@@ -315,7 +315,7 @@ open class BluePrintModelHandler(private val bluePrintCatalogService: BluePrintC
val compressedFilePart = BluePrintEnhancerUtils
.extractCompressFilePart(filePart, blueprintArchive, blueprintWorkingDir)
- val blueprintId = bluePrintCatalogService.saveToDatabase(publishId, compressedFilePart, true)
+ val blueprintId = controllerBlueprintsCatalogService.saveToDatabase(publishId, compressedFilePart, true)
return blueprintModelSearchRepository.findById(blueprintId).get()
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/BluePrintCatalogLoadService.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/BluePrintCatalogLoadService.kt
index 58e89d8d2..9e456c7f9 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/BluePrintCatalogLoadService.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/BluePrintCatalogLoadService.kt
@@ -22,14 +22,13 @@ import kotlinx.coroutines.async
import kotlinx.coroutines.runBlocking
import org.apache.commons.lang.text.StrBuilder
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
-import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.io.File
import java.util.*
@Service
-open class BluePrintCatalogLoadService(private val bluePrintCatalogService: BluePrintCatalogService) {
+open class BluePrintCatalogLoadService(private val controllerBlueprintsCatalogService: BluePrintCatalogService) {
private val log = LoggerFactory.getLogger(BluePrintCatalogLoadService::class.java)
@@ -62,7 +61,7 @@ open class BluePrintCatalogLoadService(private val bluePrintCatalogService: Blue
open suspend fun loadBluePrintModelCatalog(errorBuilder: StrBuilder, file: File) {
try {
- bluePrintCatalogService.saveToDatabase(UUID.randomUUID().toString(), file)
+ controllerBlueprintsCatalogService.saveToDatabase(UUID.randomUUID().toString(), file)
} catch (e: Exception) {
errorBuilder.appendln("Couldn't load BlueprintModel(${file.name}: ${e.message}")
}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt
index 3d6e134d4..0e7a7d94a 100755
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt
@@ -41,11 +41,11 @@ import java.util.*
/**
* Similar implementation in [org.onap.ccsdk.cds.blueprintsprocessor.db.BlueprintProcessorCatalogServiceImpl]
*/
-@Service
-class ControllerBlueprintCatalogServiceImpl(bluePrintValidatorService: BluePrintValidatorService,
+@Service("controllerBlueprintsCatalogService")
+class ControllerBlueprintCatalogServiceImpl(bluePrintDesignTimeValidatorService: BluePrintValidatorService,
private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
private val blueprintModelRepository: ControllerBlueprintModelRepository)
- : BlueprintCatalogServiceImpl(bluePrintLoadConfiguration, bluePrintValidatorService) {
+ : BlueprintCatalogServiceImpl(bluePrintLoadConfiguration, bluePrintDesignTimeValidatorService) {
private val log = LoggerFactory.getLogger(ControllerBlueprintCatalogServiceImpl::class.toString())