aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/inbounds
diff options
context:
space:
mode:
authorBrinda Santh <bs2796@att.com>2019-12-26 16:26:25 -0500
committerKAPIL SINGAL <ks220y@att.com>2019-12-30 18:18:38 +0000
commit41712e142c8d2b2bff9bc9e094f45306a60d7cb9 (patch)
tree1a6578a40b45235c8486a179b84b2e5932d164cf /ms/blueprintsprocessor/modules/inbounds
parent730c940a84b9056fed993ccef08dc5ec4053db21 (diff)
Relationship Type and Templates models
Enrichment Support for Relationship Types and Templates. Relationship DSL support for ConnectTo connections ( RestClient, SshClient, MessageProducer, MessageConsume, Nats) Moved datatype map from collection to complex type Issue-ID: CCSDK-1054 Signed-off-by: Brinda Santh <bs2796@att.com> Change-Id: I0f18db2cb52e1e93dfab04498b8298587cba2540
Diffstat (limited to 'ms/blueprintsprocessor/modules/inbounds')
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintRelationshipTemplateEnhancerImpl.kt69
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintRelationshipTypeEnhancerImpl.kt87
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt11
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTypeEnhancerServiceImpl.kt10
4 files changed, 177 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintRelationshipTemplateEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintRelationshipTemplateEnhancerImpl.kt
new file mode 100644
index 000000000..c208f68e5
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintRelationshipTemplateEnhancerImpl.kt
@@ -0,0 +1,69 @@
+/*
+ * Copyright © 2018-2019 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.cds.blueprintsprocessor.designer.api.enhancer
+
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRelationshipTemplateEnhancer
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRepoService
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
+import org.onap.ccsdk.cds.controllerblueprints.core.logger
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.springframework.beans.factory.config.ConfigurableBeanFactory
+import org.springframework.context.annotation.Scope
+import org.springframework.stereotype.Service
+
+@Service
+@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+open class BluePrintRelationshipTemplateEnhancerImpl(
+ private val bluePrintRepoService: BluePrintRepoService,
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService
+) :
+ BluePrintRelationshipTemplateEnhancer {
+
+ private val log = logger(BluePrintRelationshipTemplateEnhancerImpl::class)
+
+ lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
+ lateinit var bluePrintContext: BluePrintContext
+
+ override fun enhance(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ relationshipTemplate: RelationshipTemplate
+ ) {
+ log.info("***** Enhancing RelationshipTemplate($name)")
+ this.bluePrintRuntimeService = bluePrintRuntimeService
+ this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
+
+ val relationshipTypeName = relationshipTemplate.type
+ // Get RelationshipType from Repo and Update Service Template
+ val relationshipType =
+ BluePrintEnhancerUtils.populateRelationshipType(
+ bluePrintContext,
+ bluePrintRepoService,
+ relationshipTypeName
+ )
+
+ // Enrich NodeType
+ bluePrintTypeEnhancerService.enhanceRelationshipType(
+ bluePrintRuntimeService,
+ relationshipTypeName,
+ relationshipType
+ )
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintRelationshipTypeEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintRelationshipTypeEnhancerImpl.kt
new file mode 100644
index 000000000..b0e166090
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintRelationshipTypeEnhancerImpl.kt
@@ -0,0 +1,87 @@
+/*
+ * Copyright © 2018-2019 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.cds.blueprintsprocessor.designer.api.enhancer
+
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRelationshipTypeEnhancer
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRepoService
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
+import org.onap.ccsdk.cds.controllerblueprints.core.logger
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.springframework.beans.factory.config.ConfigurableBeanFactory
+import org.springframework.context.annotation.Scope
+import org.springframework.stereotype.Service
+
+@Service
+@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+open class BluePrintRelationshipTypeEnhancerImpl(
+ private val bluePrintRepoService: BluePrintRepoService,
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService
+) : BluePrintRelationshipTypeEnhancer {
+
+ private val log = logger(BluePrintRelationshipTypeEnhancerImpl::class)
+
+ lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
+ lateinit var bluePrintContext: BluePrintContext
+
+ override fun enhance(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ relationshipType: RelationshipType
+ ) {
+ this.bluePrintRuntimeService = bluePrintRuntimeService
+ this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
+
+ val derivedFrom = relationshipType.derivedFrom
+
+ if (!BluePrintTypes.rootRelationshipTypes().contains(derivedFrom)) {
+ val derivedFromRelationshipType =
+ BluePrintEnhancerUtils.populateRelationshipType(bluePrintContext, bluePrintRepoService, name)
+ // Enrich RelationshipType
+ enhance(bluePrintRuntimeService, derivedFrom, derivedFromRelationshipType)
+ }
+
+ // NodeType Attribute Definitions
+ enrichRelationshipTypeAttributes(name, relationshipType)
+
+ // NodeType Property Definitions
+ enrichRelationshipTypeProperties(name, relationshipType)
+
+ // TODO("Interface Enrichment, If needed")
+ }
+
+ open fun enrichRelationshipTypeAttributes(nodeTypeName: String, relationshipType: RelationshipType) {
+ relationshipType.attributes?.let {
+ bluePrintTypeEnhancerService.enhanceAttributeDefinitions(
+ bluePrintRuntimeService,
+ relationshipType.attributes!!
+ )
+ }
+ }
+
+ open fun enrichRelationshipTypeProperties(nodeTypeName: String, relationshipType: RelationshipType) {
+ relationshipType.properties?.let {
+ bluePrintTypeEnhancerService.enhancePropertyDefinitions(
+ bluePrintRuntimeService,
+ relationshipType.properties!!
+ )
+ }
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt
index c0100fbea..750cd0ff4 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt
@@ -40,6 +40,7 @@ open class BluePrintTopologyTemplateEnhancerImpl(
enhanceTopologyTemplateInputs(type)
enhanceTopologyTemplateNodeTemplates(type)
+ enhanceTopologyTemplateRelationshipTemplates(type)
enhanceTopologyTemplateWorkflows(type)
}
@@ -55,6 +56,16 @@ open class BluePrintTopologyTemplateEnhancerImpl(
}
}
+ open fun enhanceTopologyTemplateRelationshipTemplates(topologyTemplate: TopologyTemplate) {
+ topologyTemplate.relationshipTemplates?.forEach { relationshipTemplateName, relationshipTemplate ->
+ bluePrintTypeEnhancerService.enhanceRelationshipTemplate(
+ bluePrintRuntimeService,
+ relationshipTemplateName,
+ relationshipTemplate
+ )
+ }
+ }
+
open fun enhanceTopologyTemplateWorkflows(topologyTemplate: TopologyTemplate) {
topologyTemplate.workflows?.forEach { workflowName, workflow ->
bluePrintTypeEnhancerService.enhanceWorkflow(bluePrintRuntimeService, workflowName, workflow)
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTypeEnhancerServiceImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTypeEnhancerServiceImpl.kt
index 5b7c6b2d0..c27c206fa 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTypeEnhancerServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTypeEnhancerServiceImpl.kt
@@ -22,6 +22,8 @@ import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTemp
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTypeEnhancer
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintPolicyTypeEnhancer
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintPropertyDefinitionEnhancer
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRelationshipTemplateEnhancer
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRelationshipTypeEnhancer
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintServiceTemplateEnhancer
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTopologyTemplateEnhancer
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
@@ -56,6 +58,14 @@ open class BluePrintTypeEnhancerServiceImpl : BluePrintTypeEnhancerService {
return context.getBeansOfType(BluePrintNodeTypeEnhancer::class.java).map { it.value }
}
+ override fun getRelationshipTemplateEnhancers(): List<BluePrintRelationshipTemplateEnhancer> {
+ return context.getBeansOfType(BluePrintRelationshipTemplateEnhancer::class.java).map { it.value }
+ }
+
+ override fun getRelationshipTypeEnhancers(): List<BluePrintRelationshipTypeEnhancer> {
+ return context.getBeansOfType(BluePrintRelationshipTypeEnhancer::class.java).map { it.value }
+ }
+
override fun getArtifactDefinitionEnhancers(): List<BluePrintArtifactDefinitionEnhancer> {
return context.getBeansOfType(BluePrintArtifactDefinitionEnhancer::class.java).map { it.value }
}