summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints
diff options
context:
space:
mode:
Diffstat (limited to 'ms/controllerblueprints')
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerService.java47
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java6
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintAttributeDefinitionEnhancerImpl.kt33
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImpl.kt213
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintNodeTemplateEnhancerImpl.kt87
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintNodeTypeEnhancerImpl.kt137
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintPolicyTypeEnhancerImpl.kt38
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintPropertyDefinitionEnhancerImpl.kt70
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintServiceTemplateEnhancerImpl.kt63
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt56
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintWorkflowEnhancerImpl.kt96
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerService.kt3
12 files changed, 598 insertions, 251 deletions
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerService.java
index 91df3331..930c88d8 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerService.java
@@ -29,12 +29,7 @@ import org.onap.ccsdk.apps.controllerblueprints.core.ConfigModelConstant;
import org.onap.ccsdk.apps.controllerblueprints.core.data.*;
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionRepoService;
-import org.onap.ccsdk.apps.controllerblueprints.service.enhancer.BluePrintEnhancerServiceImpl;
import org.onap.ccsdk.apps.controllerblueprints.service.enhancer.ResourceAssignmentEnhancerService;
-import org.springframework.beans.factory.config.ConfigurableBeanFactory;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
@@ -47,9 +42,7 @@ import java.util.Map;
*/
@Deprecated
-@Service
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-public class BluePrintEnhancerService extends BluePrintEnhancerServiceImpl {
+public class BluePrintEnhancerService {
private static EELFLogger log = EELFManager.getInstance().getLogger(BluePrintEnhancerService.class);
@@ -57,44 +50,6 @@ public class BluePrintEnhancerService extends BluePrintEnhancerServiceImpl {
private Map<String, DataType> recipeDataTypes = new HashMap<>();
- public BluePrintEnhancerService(ResourceDefinitionRepoService resourceDefinitionRepoService,
- ResourceAssignmentEnhancerService resourceAssignmentEnhancerService) {
- super(resourceDefinitionRepoService);
- this.resourceAssignmentEnhancerService = resourceAssignmentEnhancerService;
- }
-
- @Override
- public void enrichTopologyTemplate(@NotNull ServiceTemplate serviceTemplate) throws BluePrintException {
- super.enrichTopologyTemplate(serviceTemplate);
-
- // Update the Recipe Inputs and DataTypes
- populateRecipeInputs(serviceTemplate);
- }
-
-
- @Override
- public void enrichNodeTemplate(@NotNull String nodeTemplateName, @NotNull NodeTemplate nodeTemplate) throws BluePrintException {
- super.enrichNodeTemplate(nodeTemplateName, nodeTemplate);
-
- String nodeTypeName = nodeTemplate.getType();
- log.info("*** Enriching NodeType: {}", nodeTypeName);
- // Get NodeType from Repo and Update Service Template
- NodeType nodeType = super.populateNodeType(nodeTypeName);
-
- // Enrich NodeType
- super.enrichNodeType(nodeTypeName, nodeType);
-
- // Custom for Artifact Population
- if (StringUtils.isNotBlank(nodeType.getDerivedFrom())
- && ConfigModelConstant.MODEL_TYPE_NODE_ARTIFACT.equalsIgnoreCase(nodeType.getDerivedFrom())) {
- populateArtifactTemplateMappingDataType(nodeTemplateName, nodeTemplate);
- }
-
- //Enrich Node Template Artifacts
- super.enrichNodeTemplateArtifactDefinition(nodeTemplateName, nodeTemplate);
-
- }
-
private void populateArtifactTemplateMappingDataType(@NotNull String nodeTemplateName, @NotNull NodeTemplate nodeTemplate)
throws BluePrintException {
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java
index 898647ea..57096c7f 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java
@@ -43,7 +43,6 @@ public class ServiceTemplateService {
private ResourceDictionaryRepository dataDictionaryRepository;
private ConfigModelCreateService configModelCreateService;
- private BluePrintEnhancerService bluePrintEnhancerService;
private ResourceAssignmentValidationService resourceAssignmentValidationService;
/**
@@ -51,16 +50,13 @@ public class ServiceTemplateService {
*
* @param dataDictionaryRepository dataDictionaryRepository
* @param configModelCreateService configModelCreateService
- * @param bluePrintEnhancerService bluePrintEnhancerService
* @param resourceAssignmentValidationService resourceAssignmentValidationService
*/
public ServiceTemplateService(ResourceDictionaryRepository dataDictionaryRepository,
ConfigModelCreateService configModelCreateService,
- BluePrintEnhancerService bluePrintEnhancerService,
ResourceAssignmentValidationService resourceAssignmentValidationService) {
this.dataDictionaryRepository = dataDictionaryRepository;
this.configModelCreateService = configModelCreateService;
- this.bluePrintEnhancerService = bluePrintEnhancerService;
this.resourceAssignmentValidationService = resourceAssignmentValidationService;
}
@@ -82,7 +78,7 @@ public class ServiceTemplateService {
* @return ServiceTemplate
*/
public ServiceTemplate enrichServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {
- this.bluePrintEnhancerService.enhance(serviceTemplate);
+ //FIXME("Connect New Enrichment service")
return serviceTemplate;
}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintAttributeDefinitionEnhancerImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintAttributeDefinitionEnhancerImpl.kt
new file mode 100644
index 00000000..cdb905aa
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintAttributeDefinitionEnhancerImpl.kt
@@ -0,0 +1,33 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
+import org.onap.ccsdk.apps.controllerblueprints.core.data.AttributeDefinition
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintAttributeDefinitionEnhancer
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService
+
+class BluePrintAttributeDefinitionEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService)
+ : BluePrintAttributeDefinitionEnhancer {
+
+ override fun enhance(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, type: AttributeDefinition) {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImpl.kt
index d2a7d226..213c5c05 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImpl.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImpl.kt
@@ -19,22 +19,21 @@ package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
import com.att.eelf.configuration.EELFLogger
import com.att.eelf.configuration.EELFManager
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.apps.controllerblueprints.core.data.*
-import org.onap.ccsdk.apps.controllerblueprints.core.format
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintEnhancerService
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService
import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintFileUtils
import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
-open class BluePrintEnhancerServiceImpl(val bluePrintRepoService: BluePrintRepoService) : BluePrintEnhancerService {
+open class BluePrintEnhancerServiceImpl(private val bluePrintRepoService: BluePrintRepoService,
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService) : BluePrintEnhancerService {
private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintEnhancerServiceImpl::class.toString())
- lateinit var serviceTemplate: ServiceTemplate
-
override fun enhance(basePath: String, enrichedBasePath: String): BluePrintContext {
BluePrintFileUtils.copyBluePrint(basePath, enrichedBasePath)
BluePrintFileUtils.deleteBluePrintTypes(enrichedBasePath)
@@ -46,205 +45,19 @@ open class BluePrintEnhancerServiceImpl(val bluePrintRepoService: BluePrintRepoS
@Throws(BluePrintException::class)
override fun enhance(basePath: String): BluePrintContext {
val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(basePath)
- enhance(bluePrintContext.serviceTemplate)
+ val error = BluePrintError()
+ bluePrintTypeEnhancerService.enhanceServiceTemplate(bluePrintContext, error, "service_template",
+ bluePrintContext.serviceTemplate)
return bluePrintContext
}
@Throws(BluePrintException::class)
override fun enhance(serviceTemplate: ServiceTemplate): ServiceTemplate {
- this.serviceTemplate = serviceTemplate
- initialCleanUp()
- enrichTopologyTemplate(serviceTemplate)
-
- // log.info("Enriched Blueprint :\n {}", JacksonUtils.getJson(serviceTemplate, true))
- return this.serviceTemplate
- }
-
- open fun initialCleanUp() {
- serviceTemplate.artifactTypes?.clear()
- serviceTemplate.nodeTypes?.clear()
- serviceTemplate.dataTypes?.clear()
- serviceTemplate.policyTypes?.clear()
-
- serviceTemplate.artifactTypes = mutableMapOf()
- serviceTemplate.nodeTypes = mutableMapOf()
- serviceTemplate.dataTypes = mutableMapOf()
- serviceTemplate.policyTypes = mutableMapOf()
-
- }
-
- @Throws(BluePrintException::class)
- open fun enrichTopologyTemplate(serviceTemplate: ServiceTemplate) {
- serviceTemplate.topologyTemplate?.let { topologyTemplate ->
- enrichTopologyTemplateInputs(topologyTemplate)
- enrichTopologyTemplateNodeTemplates(topologyTemplate)
- }
- }
-
- @Throws(BluePrintException::class)
- open fun enrichTopologyTemplateInputs(topologyTemplate: TopologyTemplate) {
- topologyTemplate.inputs?.let { inputs ->
- enrichPropertyDefinitions(inputs)
- }
- }
-
- open fun enrichTopologyTemplateNodeTemplates(topologyTemplate: TopologyTemplate) {
- topologyTemplate.nodeTemplates?.forEach { nodeTemplateName, nodeTemplate ->
- enrichNodeTemplate(nodeTemplateName, nodeTemplate)
- }
- }
-
- @Throws(BluePrintException::class)
- open fun enrichNodeTemplate(nodeTemplateName: String, nodeTemplate: NodeTemplate) {
- val nodeTypeName = nodeTemplate.type
- // Get NodeType from Repo and Update Service Template
- val nodeType = populateNodeType(nodeTypeName)
-
- // Enrich NodeType
- enrichNodeType(nodeTypeName, nodeType)
-
- //Enrich Node Template Artifacts
- enrichNodeTemplateArtifactDefinition(nodeTemplateName, nodeTemplate)
- }
-
- @Throws(BluePrintException::class)
- fun enrichNodeType(nodeTypeName: String, nodeType: NodeType) {
- log.debug("Enriching NodeType({})", nodeTypeName)
- val derivedFrom = nodeType.derivedFrom
-
- if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) {
- val derivedFromNodeType = populateNodeType(nodeTypeName)
- // Enrich NodeType
- enrichNodeType(derivedFrom, derivedFromNodeType)
- }
-
- // NodeType Property Definitions
- enrichNodeTypeProperties(nodeTypeName, nodeType)
-
- //NodeType Requirement
- enrichNodeTypeRequirements(nodeTypeName, nodeType)
-
- //NodeType Capability
- enrichNodeTypeCapabilityProperties(nodeTypeName, nodeType)
-
- //NodeType Interface
- enrichNodeTypeInterfaces(nodeTypeName, nodeType)
- }
-
- open fun enrichNodeTypeProperties(nodeTypeName: String, nodeType: NodeType) {
- nodeType.properties?.let { enrichPropertyDefinitions(nodeType.properties!!) }
- }
-
- open fun enrichNodeTypeRequirements(nodeTypeName: String, nodeType: NodeType) {
-
- nodeType.requirements?.forEach { _, requirementDefinition ->
- // Populate Requirement Node
- requirementDefinition.node?.let { requirementNodeTypeName ->
- // Get Requirement NodeType from Repo and Update Service Template
- val requirementNodeType = populateNodeType(requirementNodeTypeName)
-
- enrichNodeType(requirementNodeTypeName, requirementNodeType)
- }
- }
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+ val error = BluePrintError()
+ bluePrintTypeEnhancerService.enhanceServiceTemplate(bluePrintContext, error, "service_template",
+ bluePrintContext.serviceTemplate)
+ return bluePrintContext.serviceTemplate
}
-
- open fun enrichNodeTypeCapabilityProperties(nodeTypeName: String, nodeType: NodeType) {
- nodeType.capabilities?.forEach { _, capabilityDefinition ->
- capabilityDefinition.properties?.let { properties ->
- enrichPropertyDefinitions(properties)
- }
- }
- }
-
- open fun enrichNodeTypeInterfaces(nodeTypeName: String, nodeType: NodeType) {
- nodeType.interfaces?.forEach { interfaceName, interfaceObj ->
- // Populate Node type Interface Operation
- log.debug("Enriching NodeType({}) Interface({})", nodeTypeName, interfaceName)
- populateNodeTypeInterfaceOperation(nodeTypeName, interfaceName, interfaceObj)
-
- }
- }
-
- open fun populateNodeTypeInterfaceOperation(nodeTypeName: String, interfaceName: String, interfaceObj: InterfaceDefinition) {
-
- interfaceObj.operations?.forEach { operationName, operation ->
- enrichNodeTypeInterfaceOperationInputs(nodeTypeName, operationName, operation)
- enrichNodeTypeInterfaceOperationOputputs(nodeTypeName, operationName, operation)
- }
- }
-
- open fun enrichNodeTypeInterfaceOperationInputs(nodeTypeName: String, operationName: String, operation: OperationDefinition) {
- operation.inputs?.let { inputs ->
- enrichPropertyDefinitions(inputs)
- }
- }
-
- open fun enrichNodeTypeInterfaceOperationOputputs(nodeTypeName: String, operationName: String, operation: OperationDefinition) {
- operation.outputs?.let { inputs ->
- enrichPropertyDefinitions(inputs)
- }
- }
-
- open fun enrichPropertyDefinitions(properties: MutableMap<String, PropertyDefinition>) {
-
- properties.forEach { propertyName, propertyDefinition ->
- enrichPropertyDefinition(propertyName, propertyDefinition)
- }
- }
-
- @Throws(BluePrintException::class)
- fun enrichPropertyDefinition(propertyName: String, propertyDefinition: PropertyDefinition) {
- val propertyType = propertyDefinition.type
- if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) {
-
- } else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) {
- val entrySchema = propertyDefinition.entrySchema
- ?: throw BluePrintException(format("Entry Schema is missing for collection property : {}", propertyName))
-
- if (!BluePrintTypes.validPrimitiveTypes().contains(entrySchema.type)) {
- populateDataTypes(entrySchema.type)
- }
- } else {
- populateDataTypes(propertyType)
- }
-
- }
-
- open fun enrichNodeTemplateArtifactDefinition(nodeTemplateName: String, nodeTemplate: NodeTemplate) {
-
- nodeTemplate.artifacts?.forEach { artifactDefinitionName, artifactDefinition ->
- val artifactTypeName = artifactDefinition.type
- ?: throw BluePrintException(format("Artifact type is missing for NodeTemplate({}) artifact({})", nodeTemplateName, artifactDefinitionName))
-
- // Populate Artifact Type
- populateArtifactType(artifactTypeName)
- }
- }
-
- open fun populateNodeType(nodeTypeName: String): NodeType {
-
- val nodeType = serviceTemplate.nodeTypes?.get(nodeTypeName)
- ?: bluePrintRepoService.getNodeType(nodeTypeName)
- ?: throw BluePrintException(format("Couldn't get NodeType({}) from repo.", nodeTypeName))
- serviceTemplate.nodeTypes?.put(nodeTypeName, nodeType)
- return nodeType
- }
-
- open fun populateArtifactType(artifactTypeName: String): ArtifactType {
- val artifactType = serviceTemplate.artifactTypes?.get(artifactTypeName)
- ?: bluePrintRepoService.getArtifactType(artifactTypeName)
- ?: throw BluePrintException(format("Couldn't get ArtifactType({}) from repo.", artifactTypeName))
- serviceTemplate.artifactTypes?.put(artifactTypeName, artifactType)
- return artifactType
- }
-
- open fun populateDataTypes(dataTypeName: String): DataType {
- val dataType = serviceTemplate.dataTypes?.get(dataTypeName)
- ?: bluePrintRepoService.getDataType(dataTypeName)
- ?: throw BluePrintException(format("Couldn't get DataType({}) from repo.", dataTypeName))
- serviceTemplate.dataTypes?.put(dataTypeName, dataType)
- return dataType
- }
-
}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintNodeTemplateEnhancerImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintNodeTemplateEnhancerImpl.kt
new file mode 100644
index 00000000..fd1f7a85
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintNodeTemplateEnhancerImpl.kt
@@ -0,0 +1,87 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.apps.controllerblueprints.core.format
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintNodeTemplateEnhancer
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService
+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 BluePrintNodeTemplateEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService)
+ : BluePrintNodeTemplateEnhancer {
+
+
+ lateinit var bluePrintContext: BluePrintContext
+ lateinit var error: BluePrintError
+
+ override fun enhance(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, nodeTemplate: NodeTemplate) {
+ this.bluePrintContext = bluePrintContext
+ this.error = error
+
+ val nodeTypeName = nodeTemplate.type
+ // Get NodeType from Repo and Update Service Template
+ val nodeType = populateNodeType(nodeTypeName)
+
+ // Enrich NodeType
+ bluePrintTypeEnhancerService.enhanceNodeType(bluePrintContext, error, nodeTypeName, nodeType)
+
+ //Enrich Node Template Artifacts
+ enhanceNodeTemplateArtifactDefinition(name, nodeTemplate)
+ }
+
+
+ open fun populateNodeType(nodeTypeName: String): NodeType {
+
+ val nodeType = bluePrintContext.serviceTemplate.nodeTypes?.get(nodeTypeName)
+ ?: bluePrintRepoService.getNodeType(nodeTypeName)
+ ?: throw BluePrintException(format("Couldn't get NodeType({}) from repo.", nodeTypeName))
+ bluePrintContext.serviceTemplate.nodeTypes?.put(nodeTypeName, nodeType)
+ return nodeType
+ }
+
+ open fun enhanceNodeTemplateArtifactDefinition(nodeTemplateName: String, nodeTemplate: NodeTemplate) {
+
+ nodeTemplate.artifacts?.forEach { artifactDefinitionName, artifactDefinition ->
+ val artifactTypeName = artifactDefinition.type
+ ?: throw BluePrintException(format("Artifact type is missing for NodeTemplate({}) artifact({})", nodeTemplateName, artifactDefinitionName))
+
+ // Populate Artifact Type
+ populateArtifactType(artifactTypeName)
+ }
+ }
+
+ open fun populateArtifactType(artifactTypeName: String): ArtifactType {
+ val artifactType = bluePrintContext.serviceTemplate.artifactTypes?.get(artifactTypeName)
+ ?: bluePrintRepoService.getArtifactType(artifactTypeName)
+ ?: throw BluePrintException(format("Couldn't get ArtifactType({}) from repo.", artifactTypeName))
+ bluePrintContext.serviceTemplate.artifactTypes?.put(artifactTypeName, artifactType)
+ return artifactType
+ }
+
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintNodeTypeEnhancerImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintNodeTypeEnhancerImpl.kt
new file mode 100644
index 00000000..da85618d
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintNodeTypeEnhancerImpl.kt
@@ -0,0 +1,137 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
+
+import com.att.eelf.configuration.EELFLogger
+import com.att.eelf.configuration.EELFManager
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.apps.controllerblueprints.core.data.InterfaceDefinition
+import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.apps.controllerblueprints.core.data.OperationDefinition
+import org.onap.ccsdk.apps.controllerblueprints.core.format
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintNodeTypeEnhancer
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService
+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 BluePrintNodeTypeEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService) : BluePrintNodeTypeEnhancer {
+
+ private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintNodeTypeEnhancerImpl::class.toString())
+
+ lateinit var bluePrintContext: BluePrintContext
+ lateinit var error: BluePrintError
+
+ override fun enhance(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, nodeType: NodeType) {
+ this.bluePrintContext = bluePrintContext
+ this.error = error
+
+ val derivedFrom = nodeType.derivedFrom
+
+ if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) {
+ val derivedFromNodeType = populateNodeType(name)
+ // Enrich NodeType
+ enhance(bluePrintContext, error, derivedFrom, derivedFromNodeType)
+ }
+
+ // NodeType Property Definitions
+ enrichNodeTypeProperties(name, nodeType)
+
+ //NodeType Requirement
+ enrichNodeTypeRequirements(name, nodeType)
+
+ //NodeType Capability
+ enrichNodeTypeCapabilityProperties(name, nodeType)
+
+ //NodeType Interface
+ enrichNodeTypeInterfaces(name, nodeType)
+
+ }
+
+ open fun enrichNodeTypeProperties(nodeTypeName: String, nodeType: NodeType) {
+ nodeType.properties?.let {
+ bluePrintTypeEnhancerService.enhancePropertyDefinitions(bluePrintContext, error, nodeType.properties!!)
+ }
+ }
+
+ open fun enrichNodeTypeRequirements(nodeTypeName: String, nodeType: NodeType) {
+
+ nodeType.requirements?.forEach { _, requirementDefinition ->
+ // Populate Requirement Node
+ requirementDefinition.node?.let { requirementNodeTypeName ->
+ // Get Requirement NodeType from Repo and Update Service Template
+ val requirementNodeType = populateNodeType(requirementNodeTypeName)
+ // Enhanypece Node T
+ enhance(bluePrintContext, error, requirementNodeTypeName, requirementNodeType)
+ }
+ }
+ }
+
+ open fun enrichNodeTypeCapabilityProperties(nodeTypeName: String, nodeType: NodeType) {
+ nodeType.capabilities?.forEach { _, capabilityDefinition ->
+ capabilityDefinition.properties?.let { properties ->
+ bluePrintTypeEnhancerService.enhancePropertyDefinitions(bluePrintContext, error, properties)
+ }
+ }
+ }
+
+ open fun enrichNodeTypeInterfaces(nodeTypeName: String, nodeType: NodeType) {
+ nodeType.interfaces?.forEach { interfaceName, interfaceObj ->
+ // Populate Node type Interface Operation
+ log.debug("Enriching NodeType({}) Interface({})", nodeTypeName, interfaceName)
+ populateNodeTypeInterfaceOperation(nodeTypeName, interfaceName, interfaceObj)
+
+ }
+ }
+
+ open fun populateNodeTypeInterfaceOperation(nodeTypeName: String, interfaceName: String, interfaceObj: InterfaceDefinition) {
+
+ interfaceObj.operations?.forEach { operationName, operation ->
+ enrichNodeTypeInterfaceOperationInputs(nodeTypeName, operationName, operation)
+ enrichNodeTypeInterfaceOperationOputputs(nodeTypeName, operationName, operation)
+ }
+ }
+
+ open fun enrichNodeTypeInterfaceOperationInputs(nodeTypeName: String, operationName: String, operation: OperationDefinition) {
+ operation.inputs?.let { inputs ->
+ bluePrintTypeEnhancerService.enhancePropertyDefinitions(bluePrintContext, error, inputs)
+ }
+ }
+
+ open fun enrichNodeTypeInterfaceOperationOputputs(nodeTypeName: String, operationName: String, operation: OperationDefinition) {
+ operation.outputs?.let { inputs ->
+ bluePrintTypeEnhancerService.enhancePropertyDefinitions(bluePrintContext, error, inputs)
+ }
+ }
+
+ open fun populateNodeType(nodeTypeName: String): NodeType {
+
+ val nodeType = bluePrintContext.serviceTemplate.nodeTypes?.get(nodeTypeName)
+ ?: bluePrintRepoService.getNodeType(nodeTypeName)
+ ?: throw BluePrintException(format("Couldn't get NodeType({}) from repo.", nodeTypeName))
+ bluePrintContext.serviceTemplate.nodeTypes?.put(nodeTypeName, nodeType)
+ return nodeType
+ }
+
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintPolicyTypeEnhancerImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintPolicyTypeEnhancerImpl.kt
new file mode 100644
index 00000000..640c33c4
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintPolicyTypeEnhancerImpl.kt
@@ -0,0 +1,38 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
+import org.onap.ccsdk.apps.controllerblueprints.core.data.PolicyType
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintPolicyTypeEnhancer
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService
+import org.springframework.beans.factory.config.ConfigurableBeanFactory
+import org.springframework.context.annotation.Scope
+import org.springframework.stereotype.Service
+
+@Service
+@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+class BluePrintPolicyTypeEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService)
+ : BluePrintPolicyTypeEnhancer {
+
+ override fun enhance(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, type: PolicyType) {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintPropertyDefinitionEnhancerImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintPropertyDefinitionEnhancerImpl.kt
new file mode 100644
index 00000000..1484e109
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintPropertyDefinitionEnhancerImpl.kt
@@ -0,0 +1,70 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.apps.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.apps.controllerblueprints.core.format
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintPropertyDefinitionEnhancer
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService
+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 BluePrintPropertyDefinitionEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService)
+ : BluePrintPropertyDefinitionEnhancer {
+
+
+ lateinit var bluePrintContext: BluePrintContext
+ lateinit var error: BluePrintError
+
+ override fun enhance(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, propertyDefinition: PropertyDefinition) {
+ this.bluePrintContext = bluePrintContext
+ this.error = error
+
+ val propertyType = propertyDefinition.type
+ if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) {
+
+ } else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) {
+ val entrySchema = propertyDefinition.entrySchema
+ ?: throw BluePrintException("Entry Schema is missing for collection property($name)")
+
+ if (!BluePrintTypes.validPrimitiveTypes().contains(entrySchema.type)) {
+ populateDataTypes(entrySchema.type)
+ }
+ } else {
+ populateDataTypes(propertyType)
+ }
+ }
+
+ open fun populateDataTypes(dataTypeName: String): DataType {
+ val dataType = bluePrintContext.serviceTemplate.dataTypes?.get(dataTypeName)
+ ?: bluePrintRepoService.getDataType(dataTypeName)
+ ?: throw BluePrintException(format("Couldn't get DataType({}) from repo.", dataTypeName))
+ bluePrintContext.serviceTemplate.dataTypes?.put(dataTypeName, dataType)
+ return dataType
+ }
+
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintServiceTemplateEnhancerImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintServiceTemplateEnhancerImpl.kt
new file mode 100644
index 00000000..f724dae6
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintServiceTemplateEnhancerImpl.kt
@@ -0,0 +1,63 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintServiceTemplateEnhancer
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService
+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 BluePrintServiceTemplateEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService)
+ : BluePrintServiceTemplateEnhancer {
+
+ lateinit var bluePrintContext: BluePrintContext
+ lateinit var error: BluePrintError
+
+ override fun enhance(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, type: ServiceTemplate) {
+ this.bluePrintContext = bluePrintContext
+ this.error = error
+ initialCleanUp()
+ enhanceTopologyTemplate()
+ }
+
+ open fun initialCleanUp() {
+ bluePrintContext.serviceTemplate.artifactTypes?.clear()
+ bluePrintContext.serviceTemplate.nodeTypes?.clear()
+ bluePrintContext.serviceTemplate.dataTypes?.clear()
+ bluePrintContext.serviceTemplate.policyTypes?.clear()
+
+ bluePrintContext.serviceTemplate.artifactTypes = mutableMapOf()
+ bluePrintContext.serviceTemplate.nodeTypes = mutableMapOf()
+ bluePrintContext.serviceTemplate.dataTypes = mutableMapOf()
+ bluePrintContext.serviceTemplate.policyTypes = mutableMapOf()
+
+ }
+
+ open fun enhanceTopologyTemplate() {
+ bluePrintContext.serviceTemplate.topologyTemplate?.let { topologyTemplate ->
+ bluePrintTypeEnhancerService.enhanceTopologyTemplate(bluePrintContext, error, "default", topologyTemplate)
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt
new file mode 100644
index 00000000..e3c16123
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt
@@ -0,0 +1,56 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
+import org.onap.ccsdk.apps.controllerblueprints.core.data.TopologyTemplate
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTopologyTemplateEnhancer
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService
+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 BluePrintTopologyTemplateEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService) : BluePrintTopologyTemplateEnhancer {
+
+ lateinit var bluePrintContext: BluePrintContext
+ lateinit var error: BluePrintError
+
+ override fun enhance(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, type: TopologyTemplate) {
+ this.bluePrintContext = bluePrintContext
+ this.error = error
+
+ enhanceTopologyTemplateInputs(type)
+ enhanceTopologyTemplateNodeTemplates(type)
+ }
+
+ open fun enhanceTopologyTemplateInputs(topologyTemplate: TopologyTemplate) {
+ topologyTemplate.inputs?.let { inputs ->
+ bluePrintTypeEnhancerService.enhancePropertyDefinitions(bluePrintContext, error, inputs)
+ }
+ }
+
+ open fun enhanceTopologyTemplateNodeTemplates(topologyTemplate: TopologyTemplate) {
+ topologyTemplate.nodeTemplates?.forEach { nodeTemplateName, nodeTemplate ->
+ bluePrintTypeEnhancerService.enhanceNodeTemplate(bluePrintContext, error, nodeTemplateName, nodeTemplate)
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintWorkflowEnhancerImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintWorkflowEnhancerImpl.kt
new file mode 100644
index 00000000..cffcab7f
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintWorkflowEnhancerImpl.kt
@@ -0,0 +1,96 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.apps.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintWorkflowEnhancer
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
+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 BluePrintWorkflowEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
+ private val resourceAssignmentEnhancerService: ResourceAssignmentEnhancerService)
+ : BluePrintWorkflowEnhancer {
+
+ lateinit var bluePrintContext: BluePrintContext
+ lateinit var error: BluePrintError
+
+ private val workflowDataTypes: MutableMap<String, DataType> = hashMapOf()
+
+ override fun enhance(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, workflow: Workflow) {
+ this.bluePrintContext = bluePrintContext
+ this.error = error
+
+ // Enrich Only for Resource Assignment and Dynamic Input Properties if any
+ enhanceStepTargets(workflow)
+
+ // Enrich Workflow Inputs
+ enhanceWorkflowInputs(name, workflow)
+ }
+
+ open fun enhanceWorkflowInputs(name: String, workflow: Workflow) {
+ val dynamicPropertyName = "$name-properties"
+ workflow.inputs?.let { inputs ->
+ // TODO("Filter Dynamic Properties")
+ bluePrintTypeEnhancerService.enhancePropertyDefinitions(bluePrintContext, error, inputs)
+ }
+ }
+
+ private fun enhanceStepTargets(workflow: Workflow) {
+
+ val workflowNodeTemplates = workflowTargets(workflow)
+
+ workflowNodeTemplates.forEach { nodeTemplate ->
+ val artifactFiles = bluePrintContext.nodeTemplateByName(nodeTemplate).artifacts?.filter {
+ it.value.type == "artifact-mapping-resource"
+ }?.map {
+ it.value.file
+ }
+
+ artifactFiles?.let { fileName ->
+ val absoluteFilePath = "${bluePrintContext.rootPath}/$fileName"
+ // Enhance Resource Assignment File
+ enhanceResourceAssignmentFile(absoluteFilePath)
+
+ }
+ }
+ }
+
+ private fun workflowTargets(workflow: Workflow): List<String> {
+ return workflow.steps?.map {
+ it.value.target
+ }?.filterNotNull() ?: arrayListOf()
+ }
+
+ open fun enhanceResourceAssignmentFile(filePath: String) {
+ val resourceAssignments: MutableList<ResourceAssignment> = JacksonUtils.getListFromFile(filePath, ResourceAssignment::class.java)
+ as? MutableList<ResourceAssignment>
+ ?: throw BluePrintProcessorException("couldn't get ResourceAssignment definitions for the file($filePath)")
+ resourceAssignmentEnhancerService.enhanceBluePrint(bluePrintTypeEnhancerService, bluePrintContext, error, resourceAssignments)
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerService.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerService.kt
index d3bc636b..c9d8a833 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerService.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerService.kt
@@ -29,6 +29,8 @@ import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionRepoService
+import org.springframework.beans.factory.config.ConfigurableBeanFactory
+import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
/**
@@ -50,6 +52,7 @@ interface ResourceAssignmentEnhancerService {
* @author Brinda Santh
*/
@Service
+@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class ResourceAssignmentEnhancerServiceImpl(private val resourceDefinitionRepoService: ResourceDefinitionRepoService)
: ResourceAssignmentEnhancerService {
private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceAssignmentEnhancerServiceImpl::class.java)