diff options
Diffstat (limited to 'ms/blueprintsprocessor')
36 files changed, 304 insertions, 123 deletions
diff --git a/ms/blueprintsprocessor/application/pom.xml b/ms/blueprintsprocessor/application/pom.xml index 19208071..679a8b90 100644 --- a/ms/blueprintsprocessor/application/pom.xml +++ b/ms/blueprintsprocessor/application/pom.xml @@ -21,7 +21,7 @@ <parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> <artifactId>parent</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> <relativePath>../parent</relativePath> </parent> <artifactId>application</artifactId> diff --git a/ms/blueprintsprocessor/functions/netconf-executor/pom.xml b/ms/blueprintsprocessor/functions/netconf-executor/pom.xml index 3128b641..51c62502 100644 --- a/ms/blueprintsprocessor/functions/netconf-executor/pom.xml +++ b/ms/blueprintsprocessor/functions/netconf-executor/pom.xml @@ -18,7 +18,7 @@ <parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> <artifactId>functions</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>org.onap.ccsdk.apps.blueprintsprocessor.functions</groupId> diff --git a/ms/blueprintsprocessor/functions/pom.xml b/ms/blueprintsprocessor/functions/pom.xml index 4de42bee..2a952f88 100644 --- a/ms/blueprintsprocessor/functions/pom.xml +++ b/ms/blueprintsprocessor/functions/pom.xml @@ -18,7 +18,7 @@ <parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> <artifactId>parent</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> <relativePath>../parent</relativePath> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/ms/blueprintsprocessor/functions/python-executor/pom.xml b/ms/blueprintsprocessor/functions/python-executor/pom.xml index ba97d22b..120ded78 100644 --- a/ms/blueprintsprocessor/functions/python-executor/pom.xml +++ b/ms/blueprintsprocessor/functions/python-executor/pom.xml @@ -18,7 +18,7 @@ <parent> <artifactId>functions</artifactId> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/utils/PythonExecutorUtils.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/utils/PythonExecutorUtils.kt index 66c919d4..341ede58 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/utils/PythonExecutorUtils.kt +++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/utils/PythonExecutorUtils.kt @@ -20,6 +20,7 @@ import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractCompon import org.python.core.PyObject import org.python.util.PythonInterpreter import org.slf4j.LoggerFactory +import java.io.File import java.util.* class PythonExecutorUtils { @@ -61,9 +62,9 @@ class PythonExecutorUtils { sb.append(System.getProperty("java.class.path")) for (p in pythonPath) { - sb.append(":").append(p) + sb.append(File.pathSeparator).append(p) } - log.debug("Paths : $sb") + log.debug("Python Paths : $sb") props["python.import.site"] = "true" props.setProperty("python.path", sb.toString()) diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/utils/PythonExecutorUtilsTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/utils/PythonExecutorUtilsTest.kt index 431c6b82..c4fd5467 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/utils/PythonExecutorUtilsTest.kt +++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/utils/PythonExecutorUtilsTest.kt @@ -30,7 +30,7 @@ class PythonExecutorUtilsTest { @Test fun testGetPythonComponent() { - val pythonPath: MutableList<String> = arrayListOf() + val pythonPath: MutableList<String> = mutableListOf() pythonPath.add("./../../../../components/scripts/python/ccsdk_blueprints") val properties: MutableMap<String, Any> = hashMapOf() diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/resources/requests/sample-activate-request.json b/ms/blueprintsprocessor/functions/python-executor/src/test/resources/requests/sample-activate-request.json new file mode 100644 index 00000000..7142f045 --- /dev/null +++ b/ms/blueprintsprocessor/functions/python-executor/src/test/resources/requests/sample-activate-request.json @@ -0,0 +1,31 @@ +{
+ "actionIdentifiers": {
+ "actionName": "activate",
+ "blueprintName": "baseconfiguration",
+ "blueprintVersion": "1.0.0",
+ "mode": "sync"
+ },
+ "commonHeader": {
+ "flags": {
+ "force": true,
+ "ttl": 3600
+ },
+ "originatorId": "sdnc",
+ "requestId": "123456-1000",
+ "subRequestId": "sub-123456-1000",
+ "timestamp": "2012-04-23T18:25:43.511Z"
+ },
+ "payload": {
+ "resource-assignment-request": {
+ "resource-assignment-properties": {
+ "request-id": "1234",
+ "service-instance-id": "siid_1234",
+ "vnf-id": "vnf_1234",
+ "action-name": "assign-activate",
+ "scope-type": "vnf-type",
+ "hostname": "localhost",
+ "vnf_name": "temp_vnf"
+ }
+ }
+ }
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/pom.xml b/ms/blueprintsprocessor/functions/resource-resolution/pom.xml index 07ae44bd..2f08c580 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/pom.xml +++ b/ms/blueprintsprocessor/functions/resource-resolution/pom.xml @@ -19,7 +19,7 @@ <parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> <artifactId>functions</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor.functions</groupId> <artifactId>resource-resolution</artifactId> diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentProcessorScriptConfiguration.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentProcessorScriptConfiguration.kt new file mode 100644 index 00000000..ffe09e4d --- /dev/null +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentProcessorScriptConfiguration.kt @@ -0,0 +1,42 @@ +/* + * 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.blueprintsprocessor.functions.resource.resolution + +import org.jetbrains.kotlin.script.util.DependsOn +import org.jetbrains.kotlin.script.util.Repository +import kotlin.script.experimental.annotations.KotlinScript +import kotlin.script.experimental.api.ScriptCompilationConfiguration +import kotlin.script.experimental.api.defaultImports +import kotlin.script.experimental.jvm.dependenciesFromCurrentContext +import kotlin.script.experimental.jvm.jvm + +@KotlinScript(fileExtension = "resourceassignmentprocessor.kts", + compilationConfiguration = ResourceAssignmentProcessorScriptConfiguration::class) +abstract class ResourceAssignmentProcessorScript { + +} + +object ResourceAssignmentProcessorScriptConfiguration : ScriptCompilationConfiguration( + { + defaultImports(DependsOn::class, Repository::class) + jvm { + dependenciesFromCurrentContext( + wholeClasspath = true + ) + } + } +)
\ No newline at end of file diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentRuntimeService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentRuntimeService.kt new file mode 100644 index 00000000..9d6f4a6b --- /dev/null +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentRuntimeService.kt @@ -0,0 +1,58 @@ +package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution
+
+import com.fasterxml.jackson.databind.JsonNode
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.DefaultBluePrintRuntimeService
+
+class ResourceAssignmentRuntimeService(private var id: String, private var bluePrintContext: BluePrintContext)
+ : DefaultBluePrintRuntimeService(id, bluePrintContext){
+
+ private var resourceResolutionStore: MutableMap<String, JsonNode> = hashMapOf()
+
+ override fun getExecutionContext(): MutableMap<String, JsonNode> {
+ return resourceResolutionStore
+ }
+
+ @Suppress("UNCHECKED_CAST")
+ override fun setExecutionContext(executionContext: MutableMap<String, JsonNode>) {
+ this.resourceResolutionStore = executionContext
+ }
+
+ override fun put(key: String, value: JsonNode) {
+ resourceResolutionStore[key] = value
+ }
+
+ override fun get(key: String): JsonNode {
+ return resourceResolutionStore[key] ?: throw BluePrintProcessorException("failed to get execution property($key)")
+ }
+
+ override fun check(key: String): Boolean {
+ return resourceResolutionStore.containsKey(key)
+ }
+
+ override fun cleanRuntime() {
+ resourceResolutionStore.clear()
+ }
+
+ private fun getJsonNode(key: String): JsonNode {
+ return get(key)
+ }
+
+ override fun getAsString(key: String): String? {
+ return get(key).asText()
+ }
+
+ override fun getAsBoolean(key: String): Boolean? {
+ return get(key).asBoolean()
+ }
+
+ override fun getAsInt(key: String): Int? {
+ return get(key).asInt()
+ }
+
+ override fun getAsDouble(key: String): Double? {
+ return get(key).asDouble()
+ }
+
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceAssignmentProcessor.kt index f1de8f7d..99338498 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceAssignmentProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceAssignmentProcessor.kt @@ -17,9 +17,9 @@ package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.CapabilityResourceSource -import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils.ResourceResolutionUtils import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment +import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceAssignmentUtils import org.springframework.beans.factory.annotation.Autowired import org.springframework.context.ApplicationContext import org.springframework.stereotype.Service @@ -28,6 +28,7 @@ import org.springframework.stereotype.Service open class CapabilityResourceAssignmentProcessor : ResourceAssignmentProcessor() { companion object { + const val CAPABILITY_TYPE_KOTLIN_COMPONENT = "KOTLIN-COMPONENT" const val CAPABILITY_TYPE_JAVA_COMPONENT = "JAVA-COMPONENT" const val CAPABILITY_TYPE_JYTHON_COMPONENT = "JYTHON-COMPONENT" } @@ -49,7 +50,7 @@ open class CapabilityResourceAssignmentProcessor : ResourceAssignmentProcessor() checkNotNull(resourceSource.properties) { "failed to get ${executionRequest.dictionarySource} properties" } - val capabilityResourceSourceProperty = ResourceResolutionUtils.transformResourceSource(resourceSource.properties!!, CapabilityResourceSource::class.java) + val capabilityResourceSourceProperty = ResourceAssignmentUtils.transformResourceSource(resourceSource.properties!!, CapabilityResourceSource::class.java) val instanceType = capabilityResourceSourceProperty.type val instanceName = capabilityResourceSourceProperty.instanceName @@ -58,6 +59,9 @@ open class CapabilityResourceAssignmentProcessor : ResourceAssignmentProcessor() var componentResourceAssignmentProcessor: ResourceAssignmentProcessor? = null when (instanceType) { + CAPABILITY_TYPE_KOTLIN_COMPONENT ->{ + TODO("NO implementation") + } CAPABILITY_TYPE_JAVA_COMPONENT -> { // Initialize Capability Resource Assignment Processor componentResourceAssignmentProcessor = applicationContext.getBean(instanceName, ResourceAssignmentProcessor::class.java) diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/InputResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/InputResourceAssignmentProcessor.kt index 9d476008..bd9c188a 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/InputResourceAssignmentProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/InputResourceAssignmentProcessor.kt @@ -17,8 +17,11 @@ package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor +import org.onap.ccsdk.apps.controllerblueprints.core.* import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment import org.springframework.stereotype.Service +import com.fasterxml.jackson.databind.node.NullNode +import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceAssignmentUtils /** * InputResourceAssignmentProcessor @@ -33,6 +36,20 @@ open class InputResourceAssignmentProcessor : ResourceAssignmentProcessor() { } override fun process(executionRequest: ResourceAssignment) { + try { + if (checkNotEmpty(executionRequest.name)) { + val value = bluePrintRuntimeService!!.getInputValue(executionRequest.name) + // if value is null don't call setResourceDataValue to populate the value + if (value != null && value !is NullNode) { + ResourceAssignmentUtils.setResourceDataValue(executionRequest, value) + } + } + // Check the value has populated for mandatory case + ResourceAssignmentUtils.assertTemplateKeyValueNotNull(executionRequest) + } catch (e: Exception) { + ResourceAssignmentUtils.setFailedResourceDataValue(executionRequest, e.message) + throw BluePrintProcessorException("Failed in template key ($executionRequest) assignments with : (${e.message})", e) + } } override fun recover(runtimeException: RuntimeException, executionRequest: ResourceAssignment) { diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DataBaseResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/PrimaryDataResourceAssignmentProcessor.kt index da77c273..ec98d09e 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DataBaseResourceAssignmentProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/PrimaryDataResourceAssignmentProcessor.kt @@ -21,15 +21,15 @@ import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment import org.springframework.stereotype.Service /** - * DataBaseResourceAssignmentProcessor + * PrimaryDataResourceAssignmentProcessor * * @author Brinda Santh */ -@Service("resource-assignment-processor-db") -open class DataBaseResourceAssignmentProcessor : ResourceAssignmentProcessor(){ +@Service("resource-assignment-processor-primary-db") +open class PrimaryDataResourceAssignmentProcessor : ResourceAssignmentProcessor(){ override fun getName(): String { - return "resource-assignment-processor-db" + return "resource-assignment-processor-primary-db" } override fun process(executionRequest: ResourceAssignment) { diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/utils/ResourceResolutionUtils.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/utils/ResourceResolutionUtils.kt deleted file mode 100644 index 6bcd21ba..00000000 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/utils/ResourceResolutionUtils.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.blueprintsprocessor.functions.resource.resolution.utils - -import com.fasterxml.jackson.databind.JsonNode -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException -import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils - -class ResourceResolutionUtils { - companion object { - - fun <T> transformResourceSource(properties: MutableMap<String, JsonNode>, classType: Class<T>): T { - val content = JacksonUtils.getJson(properties) - return JacksonUtils.readValue(content, classType) - ?: throw BluePrintProcessorException("failed to transform content($content) to type($classType)") - } - } -}
\ No newline at end of file diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt index ef849605..8adde863 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt @@ -34,7 +34,7 @@ import org.springframework.test.context.junit4.SpringRunner @RunWith(SpringRunner::class) @ContextConfiguration(classes = [ResourceResolutionComponent::class, ResourceResolutionService::class, InputResourceAssignmentProcessor::class, DefaultResourceAssignmentProcessor::class, - DataBaseResourceAssignmentProcessor::class, SimpleRestResourceAssignmentProcessor::class, + PrimaryDataResourceAssignmentProcessor::class, SimpleRestResourceAssignmentProcessor::class, CapabilityResourceAssignmentProcessor::class]) class ResourceResolutionComponentTest { diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt index 7f41ba12..6c686753 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt @@ -19,8 +19,11 @@ package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith +import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.apps.blueprintsprocessor.core.utils.PayloadUtils import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor.* import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils +import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.context.ContextConfiguration @@ -36,7 +39,7 @@ import kotlin.test.assertTrue @RunWith(SpringRunner::class) @ContextConfiguration(classes = [ResourceResolutionService::class, InputResourceAssignmentProcessor::class, DefaultResourceAssignmentProcessor::class, - DataBaseResourceAssignmentProcessor::class, SimpleRestResourceAssignmentProcessor::class, + PrimaryDataResourceAssignmentProcessor::class, SimpleRestResourceAssignmentProcessor::class, CapabilityResourceAssignmentProcessor::class]) class ResourceResolutionServiceTest { @@ -50,7 +53,7 @@ class ResourceResolutionServiceTest { fun testRegisteredSource() { val sources = resourceResolutionService.registeredResourceSources() assertNotNull(sources, "failed to get registered sources") - assertTrue(sources.containsAll(arrayListOf("input", "default", "db", "mdsal")), "failed to get registered sources") + assertTrue(sources.containsAll(arrayListOf("input", "default", "primary-db", "mdsal")), "failed to get registered sources") } @Test @@ -62,6 +65,12 @@ class ResourceResolutionServiceTest { val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234", "./../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration") + val executionServiceInput = JacksonUtils.readValueFromClassPathFile("payload/requests/sample-resourceresolution-request.json", + ExecutionServiceInput::class.java)!! + + // Prepare Inputs + PayloadUtils.prepareInputsFromWorkflowPayload(bluePrintRuntimeService, executionServiceInput.payload, "resource-assignment") + resourceResolutionService.resolveResources(bluePrintRuntimeService, "resource-assignment", "baseconfig") } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/db/dt-location.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/dt-location.json index 52e0a796..52e0a796 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/db/dt-location.json +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/dt-location.json diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/db/db-array.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-array.json index 679b92db..7082a434 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/db/db-array.json +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-array.json @@ -4,7 +4,7 @@ "data-type": "list",
"entry-schema": "dt-location",
"source": {
- "db": {
+ "primary-db": {
"query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
"input-key-mapping": {
"profile_name": "profile_name"
@@ -16,7 +16,7 @@ }
},
"candidate-dependency": {
- "db": {
+ "primary-db": {
"names": [
"profile_name"
]
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/db/db-complex.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-complex.json index 32d04b69..53e2a11c 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/db/db-complex.json +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-complex.json @@ -3,7 +3,7 @@ "name": "location",
"data-type": "dt-location",
"source": {
- "db": {
+ "primary-db": {
"query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
"input-key-mapping": {
"profile_name": "profile_name"
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/db/db-simple.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-simple.json index 841404f2..fad08887 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/db/db-simple.json +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-simple.json @@ -3,7 +3,7 @@ "name": "country",
"data-type": "string",
"source": {
- "db": {
+ "primary-db": {
"query": "SELECT country FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
"input-key-mapping": {
"profile_name": "profile_name"
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/db/resource-assignments-simple.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/resource-assignments-simple.json index ddcf32ee..bb392d7b 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/db/resource-assignments-simple.json +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/resource-assignments-simple.json @@ -6,7 +6,7 @@ "type": "string"
},
"dictionary-name": "country",
- "dictionary-source": "db",
+ "dictionary-source": "primary-db",
"dependencies": ["state"]
},
{
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/payload/requests/sample-resourceresolution-request.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/payload/requests/sample-resourceresolution-request.json index 7889a7e4..c4fe4eab 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/payload/requests/sample-resourceresolution-request.json +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/payload/requests/sample-resourceresolution-request.json @@ -19,9 +19,12 @@ "resource-assignment-request": {
"resource-assignment-properties": {
"request-id": "1234",
+ "service-instance-id": "siid_1234",
+ "vnf-id": "vnf_1234",
"action-name": "assign-activate",
"scope-type": "vnf-type",
- "hostname": "localhost"
+ "hostname": "localhost",
+ "vnf_name": "temp_vnf"
}
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/core/pom.xml b/ms/blueprintsprocessor/modules/commons/core/pom.xml index bc6019da..42710b51 100644 --- a/ms/blueprintsprocessor/modules/commons/core/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/core/pom.xml @@ -21,7 +21,7 @@ <parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> <artifactId>commons</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> </parent> <artifactId>core</artifactId> diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml index cf265fc3..53c9b185 100644 --- a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml @@ -14,13 +14,12 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> <artifactId>commons</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> </parent> <artifactId>db-lib</artifactId> diff --git a/ms/blueprintsprocessor/modules/commons/pom.xml b/ms/blueprintsprocessor/modules/commons/pom.xml index 0c027d45..4df89857 100644 --- a/ms/blueprintsprocessor/modules/commons/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/pom.xml @@ -19,7 +19,7 @@ <parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> <artifactId>modules</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> </parent> <artifactId>commons</artifactId> diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml index 23000149..82e8cd73 100644 --- a/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml +++ b/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml @@ -19,7 +19,7 @@ <parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> <artifactId>commons</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> </parent> <artifactId>rest-lib</artifactId> diff --git a/ms/blueprintsprocessor/modules/inbounds/pom.xml b/ms/blueprintsprocessor/modules/inbounds/pom.xml index 695c54e2..1384b8a1 100644 --- a/ms/blueprintsprocessor/modules/inbounds/pom.xml +++ b/ms/blueprintsprocessor/modules/inbounds/pom.xml @@ -19,7 +19,7 @@ <parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> <artifactId>modules</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> </parent> <artifactId>inbounds</artifactId> diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml index ece51722..6395963b 100644 --- a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml +++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml @@ -19,7 +19,7 @@ <parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> <artifactId>inbounds</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> </parent> <artifactId>resource-api</artifactId> diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml index 2c6da2e7..db6fdd27 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml @@ -14,13 +14,12 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> <artifactId>inbounds</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> </parent> <artifactId>selfservice-api</artifactId> diff --git a/ms/blueprintsprocessor/modules/outbounds/pom.xml b/ms/blueprintsprocessor/modules/outbounds/pom.xml index e7e4d7c9..e957c881 100644 --- a/ms/blueprintsprocessor/modules/outbounds/pom.xml +++ b/ms/blueprintsprocessor/modules/outbounds/pom.xml @@ -19,7 +19,7 @@ <parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> <artifactId>modules</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> </parent> <artifactId>outbounds</artifactId> diff --git a/ms/blueprintsprocessor/modules/pom.xml b/ms/blueprintsprocessor/modules/pom.xml index 21032075..5cc31c46 100644 --- a/ms/blueprintsprocessor/modules/pom.xml +++ b/ms/blueprintsprocessor/modules/pom.xml @@ -21,7 +21,7 @@ <parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> <artifactId>parent</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> <relativePath>../parent</relativePath> </parent> diff --git a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml index 1b86fafd..035f14d9 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml +++ b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml @@ -19,7 +19,7 @@ <parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> <artifactId>services</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> </parent> <artifactId>execution-service</artifactId> diff --git a/ms/blueprintsprocessor/modules/services/pom.xml b/ms/blueprintsprocessor/modules/services/pom.xml index ae434fba..8cb3c6f1 100644 --- a/ms/blueprintsprocessor/modules/services/pom.xml +++ b/ms/blueprintsprocessor/modules/services/pom.xml @@ -19,7 +19,7 @@ <parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> <artifactId>modules</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> </parent> <artifactId>services</artifactId> diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml index f681ba57..6e3dade6 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml +++ b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml @@ -18,7 +18,7 @@ <parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> <artifactId>services</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/ms/blueprintsprocessor/parent/pom.xml b/ms/blueprintsprocessor/parent/pom.xml index 935ed64d..401fef0a 100644 --- a/ms/blueprintsprocessor/parent/pom.xml +++ b/ms/blueprintsprocessor/parent/pom.xml @@ -21,7 +21,7 @@ <parent> <groupId>org.onap.ccsdk.apps</groupId> <artifactId>blueprintsprocessor</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> </parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> <artifactId>parent</artifactId> @@ -31,14 +31,14 @@ <properties> <spring.boot.version>2.1.1.RELEASE</spring.boot.version> <spring.version>5.1.3.RELEASE</spring.version> - <kotlin.version>1.3.10</kotlin.version> - <kotlin.maven.version>1.3.10</kotlin.maven.version> - <kotlin.couroutines.version>1.0.1</kotlin.couroutines.version> - <grpc.version>1.16.1</grpc.version> + <kotlin.version>1.3.11</kotlin.version> + <kotlin.maven.version>1.3.11</kotlin.maven.version> + <kotlin.couroutines.version>1.1.0</kotlin.couroutines.version> + <grpc.version>1.17.1</grpc.version> <protobuff.java.utils.version>3.6.1</protobuff.java.utils.version> <eelf.version>1.0.0</eelf.version> - <sli.version>0.4.0-SNAPSHOT</sli.version> - <guava.version>26.0-jre</guava.version> + <sli.version>0.4.1-SNAPSHOT</sli.version> + <guava.version>27.0.1-jre</guava.version> <jython.version>2.7.1</jython.version> <springfox.swagger2.version>2.9.2</springfox.swagger2.version> <h2database.version>1.4.197</h2database.version> @@ -68,6 +68,55 @@ <version>${onap.logger.slf4j}</version> </dependency> + <!--Swagger Dependencies --> + <dependency> + <groupId>io.springfox</groupId> + <artifactId>springfox-swagger2</artifactId> + <version>${springfox.swagger2.version}</version> + </dependency> + <dependency> + <groupId>io.springfox</groupId> + <artifactId>springfox-swagger-ui</artifactId> + <version>${springfox.swagger2.version}</version> + </dependency> + + <!-- Common Utils Dependencies --> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.2.1</version> + </dependency> + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + <version>3.2.2</version> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>2.6</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-compress</artifactId> + <version>1.15</version> + </dependency> + <dependency> + <groupId>org.apache.velocity</groupId> + <artifactId>velocity</artifactId> + <version>1.7</version> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>${guava.version}</version> + </dependency> + <dependency> + <groupId>org.python</groupId> + <artifactId>jython-standalone</artifactId> + <version>${jython.version}</version> + </dependency> + <!-- Kotlin Dependencies --> <dependency> <groupId>org.jetbrains.kotlin</groupId> @@ -75,6 +124,27 @@ <version>${kotlin.version}</version> </dependency> <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-scripting-jvm-host</artifactId> + <version>${kotlin.version}</version> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-compiler-embeddable</artifactId> + <version>${kotlin.version}</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-script-util</artifactId> + <version>${kotlin.version}</version> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-script-runtime</artifactId> + <version>${kotlin.version}</version> + </dependency> + <dependency> <groupId>org.jetbrains.kotlinx</groupId> <artifactId>kotlinx-coroutines-core</artifactId> <version>${kotlin.couroutines.version}</version> @@ -234,50 +304,6 @@ <version>${project.version}</version> </dependency> - <!--Swagger Dependencies --> - <dependency> - <groupId>io.springfox</groupId> - <artifactId>springfox-swagger2</artifactId> - <version>${springfox.swagger2.version}</version> - </dependency> - <dependency> - <groupId>io.springfox</groupId> - <artifactId>springfox-swagger-ui</artifactId> - <version>${springfox.swagger2.version}</version> - </dependency> - - <!-- Common Libs --> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-lang3</artifactId> - <version>3.2.1</version> - </dependency> - <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - <version>3.2.2</version> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>2.6</version> - </dependency> - <dependency> - <groupId>org.apache.velocity</groupId> - <artifactId>velocity</artifactId> - <version>1.7</version> - </dependency> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - <version>${guava.version}</version> - </dependency> - <dependency> - <groupId>org.python</groupId> - <artifactId>jython-standalone</artifactId> - <version>${jython.version}</version> - </dependency> - <!-- Database --> <dependency> <groupId>com.h2database</groupId> @@ -329,10 +355,18 @@ <artifactId>commons-io</artifactId> </dependency> <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-compress</artifactId> + </dependency> + <dependency> <groupId>com.jayway.jsonpath</groupId> <artifactId>json-path</artifactId> </dependency> <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> </dependency> @@ -346,12 +380,28 @@ </dependency> <dependency> <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-script-util</artifactId> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-stdlib-jdk8</artifactId> </dependency> <dependency> + <groupId>org.jetbrains.kotlinx</groupId> + <artifactId>kotlinx-coroutines-core</artifactId> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlinx</groupId> + <artifactId>kotlinx-coroutines-reactor</artifactId> + </dependency> + <dependency> <groupId>com.fasterxml.jackson.module</groupId> <artifactId>jackson-module-kotlin</artifactId> </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-scripting-jvm-host</artifactId> + </dependency> <!-- GRPC Dependencies --> <dependency> <groupId>io.grpc</groupId> diff --git a/ms/blueprintsprocessor/pom.xml b/ms/blueprintsprocessor/pom.xml index 2020781e..df4932cd 100644 --- a/ms/blueprintsprocessor/pom.xml +++ b/ms/blueprintsprocessor/pom.xml @@ -19,7 +19,7 @@ <parent> <groupId>org.onap.ccsdk.apps</groupId> <artifactId>ccsdk-apps-ms</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> </parent> <artifactId>blueprintsprocessor</artifactId> <packaging>pom</packaging> |