aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh <bs2796@att.com>2019-01-07 23:15:01 -0500
committerBrinda Santh Muthuramalingam <bs2796@att.com>2019-01-10 18:20:57 +0000
commit404a3c2babcf581806340e314b77379f7047f8f9 (patch)
tree54928fff561a7d1740473eaf305025803d11d41c
parentb78d581b9b9c661d39b510a233207f9b1e53ba08 (diff)
Add Java Capability resource assignment processor
Change-Id: I21cea850d8fbe1c9f0a01fdc72f7147a2827ae03 Issue-ID: CCSDK-665 Signed-off-by: Muthuramalingam, Brinda Santh <bs2796@att.com>
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/source-capability.json49
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt5
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt59
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceAssignmentProcessor.kt84
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DataBaseResourceAssignmentProcessor.kt (renamed from ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/DataBaseResourceAssignmentProcessor.kt)2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceAssignmentProcessor.kt (renamed from ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/DefaultResourceAssignmentProcessor.kt)78
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/InputResourceAssignmentProcessor.kt (renamed from ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/InputResourceAssignmentProcessor.kt)78
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt (renamed from ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/ResourceAssignmentProcessor.kt)6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/SimpleRestResourceAssignmentProcessor.kt (renamed from ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/SimpleRestResourceAssignmentProcessor.kt)2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/utils/ResourceResolutionUtils.kt32
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt8
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt8
-rwxr-xr-xms/controllerblueprints/application/opt/app/onap/config/application-dev.properties2
-rwxr-xr-xms/controllerblueprints/application/opt/app/onap/config/application.properties2
-rwxr-xr-xms/controllerblueprints/application/src/test/resources/application.properties2
-rwxr-xr-xms/controllerblueprints/modules/service/src/test/resources/application.properties2
17 files changed, 318 insertions, 103 deletions
diff --git a/components/model-catalog/definition-type/starter-type/node_type/source-capability.json b/components/model-catalog/definition-type/starter-type/node_type/source-capability.json
new file mode 100644
index 00000000..241b6995
--- /dev/null
+++ b/components/model-catalog/definition-type/starter-type/node_type/source-capability.json
@@ -0,0 +1,49 @@
+{
+ "description": "This is Component Resource Source Node Type",
+ "version": "1.0.0",
+ "properties": {
+ "type": {
+ "required": true,
+ "type": "string",
+ "default": "JAVA-COMPONENT",
+ "constraints": [
+ {
+ "valid_values": [
+ "JAVA-COMPONENT",
+ "JYTHON-COMPONENT"
+ ]
+ }
+ ]
+ },
+ "instance-name": {
+ "description": "Capability component instance reference name.",
+ "required": true,
+ "type": "string"
+ },
+ "input-key-mapping": {
+ "description": "Context name to input parameters name mapping.",
+ "required": false,
+ "type": "map",
+ "entry_schema": {
+ "type": "string"
+ }
+ },
+ "output-key-mapping": {
+ "description": "Context name to output parameters name mapping.",
+ "required": false,
+ "type": "map",
+ "entry_schema": {
+ "type": "string"
+ }
+ },
+ "key-dependencies": {
+ "description": "Resource Resolution dependency dictionary names.",
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.ResourceSource"
+} \ 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/ResourceResolutionComponent.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
index 0becc00c..53a2153a 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
@@ -21,9 +21,7 @@ import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractCompon
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.apps.controllerblueprints.core.asJsonNode
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.config.ConfigurableBeanFactory
-import org.springframework.context.ApplicationContext
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Component
@@ -31,9 +29,6 @@ import org.springframework.stereotype.Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class ResourceResolutionComponent(private val resourceResolutionService: ResourceResolutionService) : AbstractComponentFunction() {
- @Autowired
- private lateinit var applicationContext: ApplicationContext
-
override fun process(executionRequest: ExecutionServiceInput) {
val artifactPrefixNamesNode = getOperationInput(ResourceResolutionConstants.INPUT_ARTIFACT_PREFIX_NAMES)
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
index 16db9c96..5a7161da 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
@@ -17,7 +17,7 @@
package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolutionprocessor.ResourceAssignmentProcessor
+import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt
new file mode 100644
index 00000000..b141025d
--- /dev/null
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt
@@ -0,0 +1,59 @@
+/*
+ * 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
+
+open class ResourceSourceProperties {
+
+}
+
+open class InputResourceSource : ResourceSourceProperties() {
+ lateinit var key: String
+ lateinit var keyDependencies: MutableList<String>
+}
+
+open class DefaultResourceSource : ResourceSourceProperties() {
+ lateinit var key: String
+ lateinit var keyDependencies: MutableList<String>
+}
+
+open class DatabaseResourceSource : ResourceSourceProperties() {
+ lateinit var type: String
+ lateinit var query: String
+ var inputKeyMapping: MutableList<String>? = null
+ var outputKeyMapping: MutableList<String>? = null
+ lateinit var keyDependencies: MutableList<String>
+}
+
+open class RestResourceSource : ResourceSourceProperties() {
+ lateinit var type: String
+ lateinit var urlPath: String
+ lateinit var path: String
+ lateinit var expressionType: String
+ var inputKeyMapping: MutableList<String>? = null
+ var outputKeyMapping: MutableList<String>? = null
+ lateinit var keyDependencies: MutableList<String>
+}
+
+open class CapabilityResourceSource : ResourceSourceProperties() {
+ lateinit var type: String
+ lateinit var instanceName: String
+ lateinit var path: String
+ lateinit var expressionType: String
+ var inputKeyMapping: MutableList<String>? = null
+ var outputKeyMapping: MutableList<String>? = null
+ lateinit var keyDependencies: MutableList<String>
+} \ 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/processor/CapabilityResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceAssignmentProcessor.kt
new file mode 100644
index 00000000..f1de8f7d
--- /dev/null
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceAssignmentProcessor.kt
@@ -0,0 +1,84 @@
+/*
+ * 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.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.springframework.beans.factory.annotation.Autowired
+import org.springframework.context.ApplicationContext
+import org.springframework.stereotype.Service
+
+@Service("resource-assignment-processor-capability")
+open class CapabilityResourceAssignmentProcessor : ResourceAssignmentProcessor() {
+
+ companion object {
+ const val CAPABILITY_TYPE_JAVA_COMPONENT = "JAVA-COMPONENT"
+ const val CAPABILITY_TYPE_JYTHON_COMPONENT = "JYTHON-COMPONENT"
+ }
+
+ @Autowired
+ private lateinit var applicationContext: ApplicationContext
+
+ override fun getName(): String {
+ return "resource-assignment-processor-capability"
+ }
+
+ override fun process(executionRequest: ResourceAssignment) {
+
+ val resourceDefinition = resourceDictionaries[executionRequest.dictionaryName]
+ ?: throw BluePrintProcessorException("couldn't get resource definition for ${executionRequest.dictionaryName}")
+
+ val resourceSource = resourceDefinition.sources[executionRequest.dictionarySource]
+ ?: throw BluePrintProcessorException("couldn't get resource definition ${executionRequest.dictionaryName} source(${executionRequest.dictionarySource})")
+
+ checkNotNull(resourceSource.properties) { "failed to get ${executionRequest.dictionarySource} properties" }
+
+ val capabilityResourceSourceProperty = ResourceResolutionUtils.transformResourceSource(resourceSource.properties!!, CapabilityResourceSource::class.java)
+
+ val instanceType = capabilityResourceSourceProperty.type
+ val instanceName = capabilityResourceSourceProperty.instanceName
+
+
+ var componentResourceAssignmentProcessor: ResourceAssignmentProcessor? = null
+
+ when (instanceType) {
+ CAPABILITY_TYPE_JAVA_COMPONENT -> {
+ // Initialize Capability Resource Assignment Processor
+ componentResourceAssignmentProcessor = applicationContext.getBean(instanceName, ResourceAssignmentProcessor::class.java)
+ }
+ CAPABILITY_TYPE_JYTHON_COMPONENT -> {
+ TODO(" No implementation")
+ }
+ }
+
+ checkNotNull(componentResourceAssignmentProcessor) { "failed to get capability resource assignment processor($instanceName)" }
+
+ // Assign Current Blueprint runtime and ResourceDictionaries
+ componentResourceAssignmentProcessor.bluePrintRuntimeService = bluePrintRuntimeService
+ componentResourceAssignmentProcessor.resourceDictionaries = resourceDictionaries
+
+ // Invoke componentResourceAssignmentProcessor
+ componentResourceAssignmentProcessor.apply(executionRequest)
+ }
+
+ override fun recover(runtimeException: RuntimeException, executionRequest: ResourceAssignment) {
+
+ TODO("To Implement")
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/DataBaseResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DataBaseResourceAssignmentProcessor.kt
index 12120341..da77c273 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/DataBaseResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DataBaseResourceAssignmentProcessor.kt
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolutionprocessor
+package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
import org.springframework.stereotype.Service
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/DefaultResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceAssignmentProcessor.kt
index 58c9e1d8..1c5455fd 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/DefaultResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceAssignmentProcessor.kt
@@ -1,40 +1,40 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 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.apps.blueprintsprocessor.functions.resource.resolutionprocessor
-
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
-import org.springframework.stereotype.Service
-
-/**
- * DefaultResourceAssignmentProcessor
- *
- * @author Brinda Santh
- */
-@Service("resource-assignment-processor-default")
-open class DefaultResourceAssignmentProcessor : ResourceAssignmentProcessor() {
-
- override fun getName(): String {
- return "resource-assignment-processor-default"
- }
-
- override fun process(executionRequest: ResourceAssignment) {
- }
-
- override fun recover(runtimeException: RuntimeException, executionRequest: ResourceAssignment) {
- }
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 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.apps.blueprintsprocessor.functions.resource.resolution.processor
+
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
+import org.springframework.stereotype.Service
+
+/**
+ * DefaultResourceAssignmentProcessor
+ *
+ * @author Brinda Santh
+ */
+@Service("resource-assignment-processor-default")
+open class DefaultResourceAssignmentProcessor : ResourceAssignmentProcessor() {
+
+ override fun getName(): String {
+ return "resource-assignment-processor-default"
+ }
+
+ override fun process(executionRequest: ResourceAssignment) {
+ }
+
+ override fun recover(runtimeException: RuntimeException, executionRequest: ResourceAssignment) {
+ }
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/InputResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/InputResourceAssignmentProcessor.kt
index 10332484..9d476008 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/InputResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/InputResourceAssignmentProcessor.kt
@@ -1,40 +1,40 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 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.apps.blueprintsprocessor.functions.resource.resolutionprocessor
-
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
-import org.springframework.stereotype.Service
-
-/**
- * InputResourceAssignmentProcessor
- *
- * @author Brinda Santh
- */
-@Service("resource-assignment-processor-input")
-open class InputResourceAssignmentProcessor : ResourceAssignmentProcessor() {
-
- override fun getName(): String {
- return "resource-assignment-processor-input"
- }
-
- override fun process(executionRequest: ResourceAssignment) {
- }
-
- override fun recover(runtimeException: RuntimeException, executionRequest: ResourceAssignment) {
- }
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 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.apps.blueprintsprocessor.functions.resource.resolution.processor
+
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
+import org.springframework.stereotype.Service
+
+/**
+ * InputResourceAssignmentProcessor
+ *
+ * @author Brinda Santh
+ */
+@Service("resource-assignment-processor-input")
+open class InputResourceAssignmentProcessor : ResourceAssignmentProcessor() {
+
+ override fun getName(): String {
+ return "resource-assignment-processor-input"
+ }
+
+ override fun process(executionRequest: ResourceAssignment) {
+ }
+
+ override fun recover(runtimeException: RuntimeException, executionRequest: ResourceAssignment) {
+ }
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/ResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
index a55e615e..11cd3faa 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/ResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolutionprocessor
+package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
@@ -28,9 +28,9 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig
private val log = LoggerFactory.getLogger(ResourceAssignmentProcessor::class.java)
- var bluePrintRuntimeService: BluePrintRuntimeService<*>? = null
+ lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
- var resourceDictionaries: Map<String, ResourceDefinition> = hashMapOf()
+ lateinit var resourceDictionaries: Map<String, ResourceDefinition>
open fun resourceDefinition(name: String): ResourceDefinition {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/SimpleRestResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/SimpleRestResourceAssignmentProcessor.kt
index c6732627..e05261d8 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/SimpleRestResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/SimpleRestResourceAssignmentProcessor.kt
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolutionprocessor
+package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
import org.springframework.stereotype.Service
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
new file mode 100644
index 00000000..6bcd21ba
--- /dev/null
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/utils/ResourceResolutionUtils.kt
@@ -0,0 +1,32 @@
+/*
+ * 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 57217d0d..ef849605 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
@@ -21,10 +21,7 @@ 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.resolutionprocessor.DataBaseResourceAssignmentProcessor
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolutionprocessor.DefaultResourceAssignmentProcessor
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolutionprocessor.InputResourceAssignmentProcessor
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolutionprocessor.SimpleRestResourceAssignmentProcessor
+import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor.*
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.apps.controllerblueprints.core.asJsonNode
import org.onap.ccsdk.apps.controllerblueprints.core.putJsonElement
@@ -37,7 +34,8 @@ import org.springframework.test.context.junit4.SpringRunner
@RunWith(SpringRunner::class)
@ContextConfiguration(classes = [ResourceResolutionComponent::class, ResourceResolutionService::class,
InputResourceAssignmentProcessor::class, DefaultResourceAssignmentProcessor::class,
- DataBaseResourceAssignmentProcessor::class, SimpleRestResourceAssignmentProcessor::class])
+ DataBaseResourceAssignmentProcessor::class, SimpleRestResourceAssignmentProcessor::class,
+ CapabilityResourceAssignmentProcessor::class])
class ResourceResolutionComponentTest {
@Autowired
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 df560076..7f41ba12 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,10 +19,7 @@ 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.functions.resource.resolutionprocessor.DataBaseResourceAssignmentProcessor
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolutionprocessor.DefaultResourceAssignmentProcessor
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolutionprocessor.InputResourceAssignmentProcessor
-import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolutionprocessor.SimpleRestResourceAssignmentProcessor
+import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor.*
import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
@@ -39,7 +36,8 @@ import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@ContextConfiguration(classes = [ResourceResolutionService::class,
InputResourceAssignmentProcessor::class, DefaultResourceAssignmentProcessor::class,
- DataBaseResourceAssignmentProcessor::class, SimpleRestResourceAssignmentProcessor::class])
+ DataBaseResourceAssignmentProcessor::class, SimpleRestResourceAssignmentProcessor::class,
+ CapabilityResourceAssignmentProcessor::class])
class ResourceResolutionServiceTest {
private val log = LoggerFactory.getLogger(ResourceResolutionServiceTest::class.java)
diff --git a/ms/controllerblueprints/application/opt/app/onap/config/application-dev.properties b/ms/controllerblueprints/application/opt/app/onap/config/application-dev.properties
index 46d85307..e574778e 100755
--- a/ms/controllerblueprints/application/opt/app/onap/config/application-dev.properties
+++ b/ms/controllerblueprints/application/opt/app/onap/config/application-dev.properties
@@ -49,7 +49,7 @@ spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
# Load Resource Source Mappings
-resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest
+resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
controllerblueprints.blueprintDeployPath=/etc/blueprints/deploy
controllerblueprints.blueprintArchivePath=/etc/blueprints/archive
diff --git a/ms/controllerblueprints/application/opt/app/onap/config/application.properties b/ms/controllerblueprints/application/opt/app/onap/config/application.properties
index d618e015..91792394 100755
--- a/ms/controllerblueprints/application/opt/app/onap/config/application.properties
+++ b/ms/controllerblueprints/application/opt/app/onap/config/application.properties
@@ -51,7 +51,7 @@ spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
# Load Resource Source Mappings
-resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest
+resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
controllerblueprints.blueprintDeployPath=/etc/blueprints/deploy
diff --git a/ms/controllerblueprints/application/src/test/resources/application.properties b/ms/controllerblueprints/application/src/test/resources/application.properties
index 9c8a96cb..1fafd8bc 100755
--- a/ms/controllerblueprints/application/src/test/resources/application.properties
+++ b/ms/controllerblueprints/application/src/test/resources/application.properties
@@ -33,7 +33,7 @@ swagger.contact.url=www.onap.com
swagger.contact.email=brindasanth@onap.com
# Load Resource Source Mappings
-resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest
+resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
controllerblueprints.blueprintDeployPath=./target/blueprints/deploy
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/application.properties b/ms/controllerblueprints/modules/service/src/test/resources/application.properties
index 4e1bedf2..29bb2b90 100755
--- a/ms/controllerblueprints/modules/service/src/test/resources/application.properties
+++ b/ms/controllerblueprints/modules/service/src/test/resources/application.properties
@@ -20,7 +20,7 @@ logging.level.org.springframework.web=INFO
logging.level.org.hibernate.SQL=warn
logging.level.org.hibernate.type.descriptor.sql=debug
# Load Resource Source Mappings
-resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest
+resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
controllerblueprints.blueprintDeployPath=./target/blueprints/deploy
controllerblueprints.blueprintArchivePath=./target/blueprints/archive