Controller Blueprints Microservice
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Thu, 13 Sep 2018 00:20:34 +0000 (00:20 +0000)
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Thu, 13 Sep 2018 00:47:05 +0000 (00:47 +0000)
Add resource assignment enhancement and validation to blueprint validation and enhancement.

Change-Id: I547760012e7014cfbb7a1e3a1d8ffb77edc9b6a2
Issue-ID: CCSDK-562
Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
23 files changed:
ms/controllerblueprints/application/load/resource_dictionary/sample-db-source.json [moved from ms/controllerblueprints/application/load/resource_dictionary/db-source.json with 91% similarity]
ms/controllerblueprints/application/load/resource_dictionary/sample-default-source.json [moved from ms/controllerblueprints/application/load/resource_dictionary/default-source.json with 64% similarity]
ms/controllerblueprints/application/load/resource_dictionary/sample-input-source.json [moved from ms/controllerblueprints/application/load/resource_dictionary/input-source.json with 64% similarity]
ms/controllerblueprints/application/load/resource_dictionary/sample-licenses.json [new file with mode: 0644]
ms/controllerblueprints/application/load/resource_dictionary/sample-mdsal-source.json [new file with mode: 0644]
ms/controllerblueprints/application/load/resource_dictionary/sample-v4-ip-type.json [moved from ms/controllerblueprints/application/load/resource_dictionary/v4-ip-type.json with 54% similarity]
ms/controllerblueprints/application/src/test/resources/application.properties
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerService.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDefinitionRepoDBService.java [moved from ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintRepoDBService.java with 71% similarity]
ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerService.kt [new file with mode: 0644]
ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerService.kt
ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerServiceTest.java
ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepositoryTest.java
ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java
ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestTest.java
ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java
ms/controllerblueprints/modules/service/src/test/resources/application.properties
ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json [new file with mode: 0644]
ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json
ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json
ms/controllerblueprints/modules/service/src/test/resources/enhance/simple-enrich.json [deleted file]
ms/controllerblueprints/modules/service/src/test/resources/logback.xml
ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/automap.json

@@ -1,6 +1,6 @@
 {\r
-  "tags": "v4-ip-type, tosca.datatypes.Root, data_type, brindasanth@onap.com",\r
-  "name": "default-source",\r
+  "tags": "sample-default-source",\r
+  "name": "sample-default-source",\r
   "property" :{\r
     "description": "name of the ",\r
     "type": "string"\r
@@ -1,16 +1,16 @@
 {\r
-       "name": "input-source",\r
+       "name": "sample-input-source",\r
        "property" :{\r
                "description": "name of the ",\r
                "type": "string"\r
        },\r
        "updated-by": "brindasanth@onap.com",\r
-       "tags": "action-name, brindasanth",\r
+       "tags": "sample-input-source",\r
        "sources": {\r
                "input": {\r
                        "type": "source-input",\r
                        "properties": {\r
-                               "key": "action-name"\r
+                               "key": "input-source"\r
                        }\r
                }\r
        }\r
diff --git a/ms/controllerblueprints/application/load/resource_dictionary/sample-licenses.json b/ms/controllerblueprints/application/load/resource_dictionary/sample-licenses.json
new file mode 100644 (file)
index 0000000..5834dd4
--- /dev/null
@@ -0,0 +1,29 @@
+{\r
+  "tags": "sample-licenses",\r
+  "name": "sample-licenses",\r
+  "property": {\r
+    "description" : " Sample Data for licences",\r
+    "required": true,\r
+    "type": "list",\r
+    "entry_schema": {\r
+      "type": "dt-license-key"\r
+    }\r
+  },\r
+  "updated-by": "brindasanth@onap.com",\r
+  "sources": {\r
+    "mdsal": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "url-path": "config/L3VNF-API:services/service-list/",\r
+        "path": "/licenses",\r
+        "input-key-mapping": {\r
+        },\r
+        "output-key-mapping": {\r
+          "licenses": "licenses"\r
+        },\r
+        "key-dependencies": []\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
diff --git a/ms/controllerblueprints/application/load/resource_dictionary/sample-mdsal-source.json b/ms/controllerblueprints/application/load/resource_dictionary/sample-mdsal-source.json
new file mode 100644 (file)
index 0000000..25464d3
--- /dev/null
@@ -0,0 +1,25 @@
+{\r
+  "tags": "sample-mdsal-source",\r
+  "name": "sample-mdsal-source",\r
+  "property": {\r
+    "description": "Sample sample-mdsal-source",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "brindasanth@onap.com",\r
+  "sources": {\r
+    "mdsal": {\r
+      "type": "source-rest",\r
+      "properties": {\r
+        "type": "JSON",\r
+        "url-path": "config/L3VNF-API:services/service-list/$service-instance-id/service-data/vnf-topology-information/vnf-assignments/vnf-vms/$vm-type/vm-networks/$network-role/v4-assigned-ip-list/$v4-ip-type",\r
+        "path": "/v4-assigned-ip-list/0/v4-ip-prefix",\r
+        "input-key-mapping": {\r
+        },\r
+        "output-key-mapping": {\r
+          "mdsal-source": "v4-ip-prefix"\r
+        },\r
+        "key-dependencies": []\r
+      }\r
+    }\r
+  }\r
+}
\ No newline at end of file
@@ -1,16 +1,16 @@
 {\r
-  "name": "v4-ip-type",\r
+  "name": "sample-v4-ip-type",\r
   "property": {\r
-    "description": "name of the ",\r
+    "description": "sample-v4-ip-type",\r
     "type": "string"\r
   },\r
   "updated-by": "brindasanth@onap.com",\r
-  "tags": "v4-ip-type, source-input, brindasanth",\r
+  "tags": "sample-v4-ip-type",\r
   "sources": {\r
     "input": {\r
       "type": "source-input",\r
       "properties": {\r
-        "key": "v4-ip-type"\r
+        "key": "sample-v4-ip-type"\r
       }\r
     }\r
   }\r
index e2d040c..5c6acf9 100644 (file)
@@ -14,6 +14,8 @@
 # See the License for the specific language governing permissions and\r
 # limitations under the License.\r
 #\r
+spring.main.banner-mode=off\r
+\r
 appName=ControllerBluePrints\r
 ms_name=org.onap.ccsdk.apps.controllerblueprints\r
 appVersion=1.0.0\r
index 8e98f94..ef3b4a4 100644 (file)
@@ -25,12 +25,13 @@ import org.jetbrains.annotations.NotNull;
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.ConfigModelConstant;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.*;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintEnhancerDefaultService;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionRepoService;\r
+import org.onap.ccsdk.apps.controllerblueprints.service.enhancer.BluePrintEnhancerDefaultService;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;\r
 import com.att.eelf.configuration.EELFLogger;\r
 import com.att.eelf.configuration.EELFManager;\r
+import org.onap.ccsdk.apps.controllerblueprints.service.enhancer.ResourceAssignmentEnhancerService;\r
 import org.springframework.stereotype.Service;\r
 \r
 import java.util.HashMap;\r
@@ -48,14 +49,18 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
 \r
     private static EELFLogger log = EELFManager.getInstance().getLogger(BluePrintEnhancerService.class);\r
 \r
+    private ResourceAssignmentEnhancerService resourceAssignmentEnhancerService;\r
+\r
     private Map<String, DataType> recipeDataTypes = new HashMap<>();\r
 \r
-    public BluePrintEnhancerService(BluePrintRepoService bluePrintEnhancerRepoDBService) {\r
-        super(bluePrintEnhancerRepoDBService);\r
+    public BluePrintEnhancerService(ResourceDefinitionRepoService resourceDefinitionRepoService,\r
+                                    ResourceAssignmentEnhancerService resourceAssignmentEnhancerService) {\r
+        super(resourceDefinitionRepoService);\r
+        this.resourceAssignmentEnhancerService = resourceAssignmentEnhancerService;\r
     }\r
 \r
     @Override\r
-    public void enrichTopologyTemplate(@NotNull ServiceTemplate serviceTemplate) throws BluePrintException{\r
+    public void enrichTopologyTemplate(@NotNull ServiceTemplate serviceTemplate) throws BluePrintException {\r
         super.enrichTopologyTemplate(serviceTemplate);\r
 \r
         // Update the Recipe Inputs and DataTypes\r
@@ -101,7 +106,7 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
             // Modified for ONAP converted Object to JsonNode\r
             JsonNode recipeNames = nodeTemplate.getProperties().get(ConfigModelConstant.PROPERTY_RECIPE_NAMES);\r
 \r
-            log.info("Processing Receipe Names : {} ", recipeNames);\r
+            log.info("Processing Recipe Names : {} ", recipeNames);\r
 \r
             if (recipeNames != null && recipeNames.isArray() && recipeNames.size() > 0) {\r
 \r
@@ -159,6 +164,9 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
                         JacksonUtils.getListFromJson(resourceAssignmentContent, ResourceAssignment.class);\r
 \r
                 Preconditions.checkNotNull(resourceAssignments, "Failed to Processing Resource Mapping " + resourceAssignmentContent);\r
+                // Enhance Resource Assignment\r
+                resourceAssignmentEnhancerService.enhanceBluePrint(this, resourceAssignments);\r
+\r
                 dataTypeProperties = new HashMap<>();\r
 \r
                 for (ResourceAssignment resourceAssignment : resourceAssignments) {\r
@@ -167,9 +175,6 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
                             && resourceAssignment.getProperty() != null\r
                             && StringUtils.isNotBlank(resourceAssignment.getName())) {\r
 \r
-                        // Enrich the Property Definition\r
-                        super.enrichPropertyDefinition(resourceAssignment.getName(), resourceAssignment.getProperty());\r
-\r
                         dataTypeProperties.put(resourceAssignment.getName(), resourceAssignment.getProperty());\r
 \r
                     }\r
@@ -23,28 +23,35 @@ import org.apache.commons.lang3.StringUtils;
 import org.jetbrains.annotations.NotNull;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.*;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionRepoService;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;\r
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.repository.ModelTypeRepository;\r
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ResourceDictionaryRepository;\r
 import org.springframework.stereotype.Service;\r
 import reactor.core.publisher.Mono;\r
 \r
 import java.util.Optional;\r
 \r
 /**\r
- * BluePrintRepoDBService\r
+ * ResourceDefinitionRepoDBService\r
  *\r
  * @author Brinda Santh\r
  */\r
 @Service\r
 @SuppressWarnings("unused")\r
-public class BluePrintRepoDBService implements BluePrintRepoService {\r
+public class ResourceDefinitionRepoDBService implements ResourceDefinitionRepoService {\r
 \r
     private ModelTypeRepository modelTypeRepository;\r
+    private ResourceDictionaryRepository resourceDictionaryRepository;\r
+\r
     @SuppressWarnings("unused")\r
-    public BluePrintRepoDBService(ModelTypeRepository modelTypeRepository) {\r
+    public ResourceDefinitionRepoDBService(ModelTypeRepository modelTypeRepository,\r
+                                           ResourceDictionaryRepository resourceDictionaryRepository) {\r
         this.modelTypeRepository = modelTypeRepository;\r
+        this.resourceDictionaryRepository = resourceDictionaryRepository;\r
     }\r
 \r
     @Override\r
@@ -72,6 +79,17 @@ public class BluePrintRepoDBService implements BluePrintRepoService {
         return getModelType(capabilityDefinitionName, CapabilityDefinition.class);\r
     }\r
 \r
+    @NotNull\r
+    @Override\r
+    public Mono<ResourceDefinition> getResourceDefinition(@NotNull String resourceDefinitionName) throws BluePrintException{\r
+        Optional<ResourceDictionary> dbResourceDictionary = resourceDictionaryRepository.findByName(resourceDefinitionName);\r
+        if(dbResourceDictionary.isPresent()){\r
+            return Mono.just(dbResourceDictionary.get().getDefinition());\r
+        }else{\r
+            throw new BluePrintException(String.format("failed to get resource dictionary (%s) from repo", resourceDefinitionName));\r
+        }\r
+    }\r
+\r
     private <T> Mono<T> getModelType(String modelName, Class<T> valueClass) throws BluePrintException {\r
         Preconditions.checkArgument(StringUtils.isNotBlank(modelName),\r
                 "Failed to get model from repo, model name is missing");\r
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerService.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerService.kt
new file mode 100644 (file)
index 0000000..cf9e96e
--- /dev/null
@@ -0,0 +1,272 @@
+/*\r
+ * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package org.onap.ccsdk.apps.controllerblueprints.service.enhancer\r
+\r
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException\r
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes\r
+import org.onap.ccsdk.apps.controllerblueprints.core.data.*\r
+import org.onap.ccsdk.apps.controllerblueprints.core.format\r
+import com.att.eelf.configuration.EELFLogger\r
+import com.att.eelf.configuration.EELFManager\r
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService\r
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonReactorUtils\r
+import java.io.Serializable\r
+\r
+/**\r
+ * BluePrintEnhancerService\r
+ * @author Brinda Santh\r
+ *\r
+ */\r
+interface BluePrintEnhancerService : Serializable {\r
+\r
+    @Throws(BluePrintException::class)\r
+    fun enhance(content: String): ServiceTemplate\r
+\r
+    /**\r
+     * Read Blueprint from CSAR structure Directory\r
+     */\r
+    @Throws(BluePrintException::class)\r
+    fun enhance(fileName: String, basePath: String): ServiceTemplate\r
+\r
+    @Throws(BluePrintException::class)\r
+    fun enhance(serviceTemplate: ServiceTemplate): ServiceTemplate\r
+\r
+    @Throws(BluePrintException::class)\r
+    fun enrichNodeTemplate(nodeTemplateName: String, nodeTemplate: NodeTemplate)\r
+\r
+    @Throws(BluePrintException::class)\r
+    fun enrichNodeType(nodeTypeName: String, nodeType: NodeType)\r
+\r
+    @Throws(BluePrintException::class)\r
+    fun enrichPropertyDefinition(propertyName: String, propertyDefinition: PropertyDefinition)\r
+}\r
+\r
+open class BluePrintEnhancerDefaultService(val bluePrintRepoService: BluePrintRepoService) : BluePrintEnhancerService {\r
+\r
+    private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintEnhancerDefaultService::class.toString())\r
+\r
+    lateinit var serviceTemplate: ServiceTemplate\r
+\r
+    @Throws(BluePrintException::class)\r
+    override fun enhance(content: String): ServiceTemplate {\r
+        return JacksonReactorUtils.readValueFromFile(content, ServiceTemplate::class.java).map { serviceTemplate ->\r
+            enhance(serviceTemplate!!)\r
+        }.block()!!\r
+    }\r
+\r
+    @Throws(BluePrintException::class)\r
+    override fun enhance(fileName: String, basePath: String): ServiceTemplate {\r
+        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+    }\r
+\r
+    @Throws(BluePrintException::class)\r
+    override fun enhance(serviceTemplate: ServiceTemplate): ServiceTemplate {\r
+        this.serviceTemplate = serviceTemplate\r
+        initialCleanUp()\r
+        enrichTopologyTemplate(serviceTemplate)\r
+\r
+        // log.info("Enriched Blueprint :\n {}", JacksonUtils.getJson(serviceTemplate, true))\r
+        return this.serviceTemplate\r
+    }\r
+\r
+    open fun initialCleanUp() {\r
+        serviceTemplate.artifactTypes?.clear()\r
+        serviceTemplate.nodeTypes?.clear()\r
+        serviceTemplate.dataTypes?.clear()\r
+\r
+        serviceTemplate.artifactTypes = HashMap()\r
+        serviceTemplate.nodeTypes = HashMap()\r
+        serviceTemplate.dataTypes = HashMap()\r
+\r
+    }\r
+\r
+    @Throws(BluePrintException::class)\r
+    open fun enrichTopologyTemplate(serviceTemplate: ServiceTemplate) {\r
+        serviceTemplate.topologyTemplate?.let { topologyTemplate ->\r
+            enrichTopologyTemplateInputs(topologyTemplate)\r
+            enrichTopologyTemplateNodeTemplates(topologyTemplate)\r
+        }\r
+    }\r
+\r
+    @Throws(BluePrintException::class)\r
+    open fun enrichTopologyTemplateInputs(topologyTemplate: TopologyTemplate) {\r
+        topologyTemplate.inputs?.let { inputs ->\r
+            enrichPropertyDefinitions(inputs)\r
+        }\r
+    }\r
+\r
+    open fun enrichTopologyTemplateNodeTemplates(topologyTemplate: TopologyTemplate) {\r
+        topologyTemplate.nodeTemplates?.forEach { nodeTemplateName, nodeTemplate ->\r
+            enrichNodeTemplate(nodeTemplateName, nodeTemplate)\r
+        }\r
+    }\r
+\r
+    @Throws(BluePrintException::class)\r
+    override fun enrichNodeTemplate(nodeTemplateName: String, nodeTemplate: NodeTemplate) {\r
+        val nodeTypeName = nodeTemplate.type\r
+        // Get NodeType from Repo and Update Service Template\r
+        val nodeType = populateNodeType(nodeTypeName)\r
+\r
+        // Enrich NodeType\r
+        enrichNodeType(nodeTypeName, nodeType)\r
+\r
+        //Enrich Node Template Artifacts\r
+        enrichNodeTemplateArtifactDefinition(nodeTemplateName, nodeTemplate)\r
+    }\r
+\r
+    @Throws(BluePrintException::class)\r
+    override fun enrichNodeType(nodeTypeName: String, nodeType: NodeType) {\r
+        log.debug("Enriching NodeType({})", nodeTypeName)\r
+        val derivedFrom = nodeType.derivedFrom\r
+\r
+        if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) {\r
+            val derivedFromNodeType = populateNodeType(nodeTypeName)\r
+            // Enrich NodeType\r
+            enrichNodeType(derivedFrom, derivedFromNodeType)\r
+        }\r
+\r
+        // NodeType Property Definitions\r
+        enrichNodeTypeProperties(nodeTypeName, nodeType)\r
+\r
+        //NodeType Requirement\r
+        enrichNodeTypeRequirements(nodeTypeName, nodeType)\r
+\r
+        //NodeType Capability\r
+        enrichNodeTypeCapabilityProperties(nodeTypeName, nodeType)\r
+\r
+        //NodeType Interface\r
+        enrichNodeTypeInterfaces(nodeTypeName, nodeType)\r
+    }\r
+\r
+    open fun enrichNodeTypeProperties(nodeTypeName: String, nodeType: NodeType) {\r
+        nodeType.properties?.let { enrichPropertyDefinitions(nodeType.properties!!) }\r
+    }\r
+\r
+    open fun enrichNodeTypeRequirements(nodeTypeName: String, nodeType: NodeType) {\r
+\r
+        nodeType.requirements?.forEach { _, requirementDefinition ->\r
+            // Populate Requirement Node\r
+            requirementDefinition.node?.let { requirementNodeTypeName ->\r
+                // Get Requirement NodeType from Repo and Update Service Template\r
+                val requirementNodeType = populateNodeType(requirementNodeTypeName)\r
+\r
+                enrichNodeType(requirementNodeTypeName, requirementNodeType)\r
+            }\r
+        }\r
+    }\r
+\r
+    open fun enrichNodeTypeCapabilityProperties(nodeTypeName: String, nodeType: NodeType) {\r
+        nodeType.capabilities?.forEach { capabilityDefinitionName, capabilityDefinition ->\r
+            capabilityDefinition.properties?.let { properties ->\r
+                enrichPropertyDefinitions(properties)\r
+            }\r
+        }\r
+    }\r
+\r
+    open fun enrichNodeTypeInterfaces(nodeTypeName: String, nodeType: NodeType) {\r
+        nodeType.interfaces?.forEach { interfaceName, interfaceObj ->\r
+            // Populate Node type Interface Operation\r
+            log.debug("Enriching NodeType({}) Interface({})", nodeTypeName, interfaceName)\r
+            populateNodeTypeInterfaceOperation(nodeTypeName, interfaceName, interfaceObj)\r
+\r
+        }\r
+    }\r
+\r
+    open fun populateNodeTypeInterfaceOperation(nodeTypeName: String, interfaceName: String, interfaceObj: InterfaceDefinition) {\r
+\r
+        interfaceObj.operations?.forEach { operationName, operation ->\r
+            enrichNodeTypeInterfaceOperationInputs(nodeTypeName, operationName, operation)\r
+            enrichNodeTypeInterfaceOperationOputputs(nodeTypeName, operationName, operation)\r
+        }\r
+    }\r
+\r
+    open fun enrichNodeTypeInterfaceOperationInputs(nodeTypeName: String, operationName: String, operation: OperationDefinition) {\r
+        operation.inputs?.let { inputs ->\r
+            enrichPropertyDefinitions(inputs)\r
+        }\r
+    }\r
+\r
+    open fun enrichNodeTypeInterfaceOperationOputputs(nodeTypeName: String, operationName: String, operation: OperationDefinition) {\r
+        operation.outputs?.let { inputs ->\r
+            enrichPropertyDefinitions(inputs)\r
+        }\r
+    }\r
+\r
+    open fun enrichPropertyDefinitions(properties: MutableMap<String, PropertyDefinition>) {\r
+\r
+        properties.forEach { propertyName, propertyDefinition ->\r
+            enrichPropertyDefinition(propertyName, propertyDefinition)\r
+        }\r
+    }\r
+\r
+    @Throws(BluePrintException::class)\r
+    override fun enrichPropertyDefinition(propertyName: String, propertyDefinition: PropertyDefinition) {\r
+        val propertyType = propertyDefinition.type\r
+        if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) {\r
+\r
+        } else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) {\r
+            val entrySchema = propertyDefinition.entrySchema\r
+                    ?: throw BluePrintException(format("Entry Schema is missing for collection property : {}", propertyName))\r
+\r
+            if (!BluePrintTypes.validPrimitiveTypes().contains(entrySchema.type)) {\r
+                populateDataTypes(entrySchema.type)\r
+            }\r
+        } else {\r
+            populateDataTypes(propertyType)\r
+        }\r
+\r
+    }\r
+\r
+    open fun enrichNodeTemplateArtifactDefinition(nodeTemplateName: String, nodeTemplate: NodeTemplate) {\r
+\r
+        nodeTemplate.artifacts?.forEach { artifactDefinitionName, artifactDefinition ->\r
+            val artifactTypeName = artifactDefinition.type\r
+                    ?: throw BluePrintException(format("Artifact type is missing for NodeTemplate({}) artifact({})", nodeTemplateName, artifactDefinitionName))\r
+\r
+            // Populate Artifact Type\r
+            populateArtifactType(artifactTypeName)\r
+        }\r
+    }\r
+\r
+    open fun populateNodeType(nodeTypeName: String): NodeType {\r
+\r
+        val nodeType = serviceTemplate.nodeTypes?.get(nodeTypeName)\r
+                ?: bluePrintRepoService.getNodeType(nodeTypeName)?.block()\r
+                ?: throw BluePrintException(format("Couldn't get NodeType({}) from repo.", nodeTypeName))\r
+        serviceTemplate.nodeTypes?.put(nodeTypeName, nodeType)\r
+        return nodeType\r
+    }\r
+\r
+    open fun populateArtifactType(artifactTypeName: String): ArtifactType {\r
+        val artifactType = serviceTemplate.artifactTypes?.get(artifactTypeName)\r
+                ?: bluePrintRepoService.getArtifactType(artifactTypeName)?.block()\r
+                ?: throw BluePrintException(format("Couldn't get ArtifactType({}) from repo.", artifactTypeName))\r
+        serviceTemplate.artifactTypes?.put(artifactTypeName, artifactType)\r
+        return artifactType\r
+    }\r
+\r
+    open fun populateDataTypes(dataTypeName: String): DataType {\r
+        val dataType = serviceTemplate.dataTypes?.get(dataTypeName)\r
+                ?: bluePrintRepoService.getDataType(dataTypeName)?.block()\r
+                ?: throw BluePrintException(format("Couldn't get DataType({}) from repo.", dataTypeName))\r
+        serviceTemplate.dataTypes?.put(dataTypeName, dataType)\r
+        return dataType\r
+    }\r
+\r
+}\r
+\r
index 0d08985..de6f82f 100644 (file)
@@ -19,13 +19,16 @@ package org.onap.ccsdk.apps.controllerblueprints.service.enhancer
 import com.att.eelf.configuration.EELFLogger\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate\r
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintEnhancerDefaultService\r
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintEnhancerService\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition\r
 import com.att.eelf.configuration.EELFManager\r
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes\r
+import org.onap.ccsdk.apps.controllerblueprints.core.format\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceAssignmentValidationDefaultService\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionRepoService\r
+import org.springframework.stereotype.Service\r
 \r
 /**\r
  * ResourceAssignmentEnhancerService.\r
@@ -47,6 +50,7 @@ interface ResourceAssignmentEnhancerService {
  *\r
  * @author Brinda Santh\r
  */\r
+@Service\r
 open class ResourceAssignmentEnhancerDefaultService(private val resourceDefinitionRepoService: ResourceDefinitionRepoService)\r
     : ResourceAssignmentEnhancerService {\r
     private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceAssignmentValidationDefaultService::class.java)\r
@@ -58,20 +62,41 @@ open class ResourceAssignmentEnhancerDefaultService(private val resourceDefiniti
     override fun enhanceBluePrint(bluePrintEnhancerService: BluePrintEnhancerService,\r
                                   resourceAssignments: List<ResourceAssignment>) {\r
 \r
+        val uniqueSourceNodeTypeNames = hashSetOf<String>()\r
+\r
         // Iterate the Resource Assignment and\r
         resourceAssignments.map { resourceAssignment ->\r
             val dictionaryName = resourceAssignment.dictionaryName!!\r
             val dictionarySource = resourceAssignment.dictionarySource!!\r
-            log.info("Enriching Assignment name({}), dictionary name({}), source({})", resourceAssignment.name,\r
+            log.debug("Enriching Assignment name({}), dictionary name({}), source({})", resourceAssignment.name,\r
                     dictionaryName, dictionarySource)\r
-            // Get the Resource Definition from Repo\r
-            val resourceDefinition: ResourceDefinition = getResourceDefinition(dictionaryName)\r
+            val sourceNodeTypeName = ResourceSourceMappingFactory.getRegisterSourceMapping(dictionarySource)\r
+\r
+            // Add Unique Node Types\r
+            uniqueSourceNodeTypeNames.add(sourceNodeTypeName)\r
+\r
+            // TODO("Candidate for Optimisation")\r
+            if (checkResourceDefinitionNeeded(resourceAssignment)) {\r
+\r
+                bluePrintEnhancerService.enrichPropertyDefinition(resourceAssignment.name, resourceAssignment.property!!);\r
+\r
+                // Get the Resource Definition from Repo\r
+                val resourceDefinition: ResourceDefinition = getResourceDefinition(dictionaryName)\r
 \r
-            val sourceNodeTemplate = resourceDefinition.sources.get(dictionarySource)\r
+                val sourceNodeTemplate = resourceDefinition.sources.get(dictionarySource)\r
+                        ?: throw BluePrintException(format("failed to get assigned dictionarySource({}) from resourceDefinition({})", dictionarySource, dictionaryName))\r
 \r
-            // Enrich as NodeTemplate\r
-            bluePrintEnhancerService.enrichNodeTemplate(dictionarySource, sourceNodeTemplate!!)\r
+                // Enrich as NodeTemplate\r
+                bluePrintEnhancerService.enrichNodeTemplate(dictionarySource, sourceNodeTemplate)\r
+            }\r
         }\r
+        // Enrich the ResourceSource NodeTypes\r
+        uniqueSourceNodeTypeNames.map { nodeTypeName ->\r
+            resourceDefinitionRepoService.getNodeType(nodeTypeName).subscribe { nodeType ->\r
+                bluePrintEnhancerService.enrichNodeType(nodeTypeName, nodeType)\r
+            }\r
+        }\r
+\r
     }\r
 \r
     override fun enhanceBluePrint(resourceAssignments: List<ResourceAssignment>): ServiceTemplate {\r
@@ -82,7 +107,14 @@ open class ResourceAssignmentEnhancerDefaultService(private val resourceDefiniti
         return bluePrintEnhancerService.serviceTemplate\r
     }\r
 \r
+    private fun checkResourceDefinitionNeeded(resourceAssignment: ResourceAssignment): Boolean {\r
+        return !((resourceAssignment.dictionarySource.equals(ResourceDictionaryConstants.SOURCE_INPUT)\r
+                || resourceAssignment.dictionarySource.equals(ResourceDictionaryConstants.SOURCE_DEFAULT))\r
+                && BluePrintTypes.validPrimitiveOrCollectionPrimitive(resourceAssignment.property!!))\r
+    }\r
+\r
     private fun getResourceDefinition(name: String): ResourceDefinition {\r
-        return resourceDefinitionRepoService.getResourceDefinition(name).block()!!\r
+        return resourceDefinitionRepoService.getResourceDefinition(name).block()\r
+                ?: throw BluePrintException(format("failed to get dictionary definition({})", name))\r
     }\r
 }
\ No newline at end of file
index 7d16f50..e279ec9 100644 (file)
 \r
 package org.onap.ccsdk.apps.controllerblueprints.service.enhancer;\r
 \r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
 import org.junit.Assert;\r
+import org.junit.Before;\r
 import org.junit.Test;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonReactorUtils;\r
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory;\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionFileRepoService;\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionRepoService;\r
 \r
@@ -33,18 +38,28 @@ import java.util.List;
  * @author Brinda Santh\r
  */\r
 public class ResourceAssignmentEnhancerServiceTest {\r
+    private static EELFLogger log = EELFManager.getInstance().getLogger(ResourceAssignmentEnhancerServiceTest.class);\r
+\r
+    @Before\r
+    public void setUp(){\r
+        ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("db", "source-db");\r
+        ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("input", "source-input");\r
+        ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("default", "source-default");\r
+        ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("mdsal", "source-rest");\r
+    }\r
 \r
     @Test\r
     public void testEnhanceBluePrint() throws BluePrintException {\r
 \r
         List<ResourceAssignment> resourceAssignments = JacksonReactorUtils\r
-                .getListFromClassPathFile("enhance/simple-enrich.json", ResourceAssignment.class).block();\r
+                .getListFromClassPathFile("enhance/enhance-resource-assignment.json", ResourceAssignment.class).block();\r
         Assert.assertNotNull("Failed to get Resource Assignment", resourceAssignments);\r
         ResourceDefinitionRepoService resourceDefinitionRepoService = new ResourceDefinitionFileRepoService("./../../application/load");\r
         ResourceAssignmentEnhancerService resourceAssignmentEnhancerService =\r
                 new ResourceAssignmentEnhancerDefaultService(resourceDefinitionRepoService);\r
         ServiceTemplate serviceTemplate = resourceAssignmentEnhancerService.enhanceBluePrint(resourceAssignments);\r
         Assert.assertNotNull("Failed to get Enriched service Template", serviceTemplate);\r
+        log.trace("Enhanced Service Template : {}", JacksonUtils.getJson(serviceTemplate, true));\r
     }\r
 }\r
 \r
index ab939ff..b2e2901 100644 (file)
@@ -1,5 +1,6 @@
 /*
  *  Copyright © 2018 IBM.
+ *  Modifications 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.
@@ -17,7 +18,6 @@
 package org.onap.ccsdk.apps.controllerblueprints.service.repository;
 
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -55,7 +55,7 @@ public class ResourceDictionaryReactRepositoryTest {
     @Test
     @Commit
     public void test01Save() {
-        ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile("./../../application/load/resource_dictionary/db-source" +
+        ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile("./../../application/load/resource_dictionary/sample-db-source" +
                 ".json", ResourceDefinition.class);
         Assert.assertNotNull("Failed to get resourceDefinition from content", resourceDefinition);
         resourceDefinition.setName(sourceName);
@@ -88,7 +88,7 @@ public class ResourceDictionaryReactRepositoryTest {
     @Test
     @Commit
     public void test05Delete() {
-        resourceDictionaryReactRepository.deleteByName("db-source").block();
+        resourceDictionaryReactRepository.deleteByName(sourceName).block();
     }
 
     private ResourceDictionary transformResourceDictionary(ResourceDefinition resourceDefinition) {
index ac786d0..272cdd0 100644 (file)
@@ -42,7 +42,7 @@ import java.util.List;
 \r
 \r
 @RunWith(SpringRunner.class)\r
-@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)\r
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = {"blueprints.load.initial-data=true"})\r
 @ContextConfiguration(classes = {TestApplication.class})\r
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)\r
 public class ResourceDictionaryRestTest {\r
index faa1082..37cc61d 100644 (file)
@@ -45,7 +45,7 @@ import java.util.List;
 \r
 \r
 @RunWith(SpringRunner.class)\r
-@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)\r
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = {"blueprints.load.initial-data=true"})\r
 @ContextConfiguration(classes = {TestApplication.class})\r
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)\r
 public class ServiceTemplateRestTest {\r
@@ -143,7 +143,7 @@ public class ServiceTemplateRestTest {
 \r
         List<ResourceAssignment> autoMappedResourceAssignment = autoMapResponse.getResourceAssignments();\r
         autoMappedResourceAssignment.forEach(resourceAssignment -> {\r
-            if ("bundle-id".equals(resourceAssignment.getName())) {\r
+            if ("sample-db-source".equals(resourceAssignment.getName())) {\r
                 Assert.assertEquals("Failed to assign default first source", "db",\r
                         resourceAssignment.getDictionarySource());\r
             }\r
index 46b725f..5f34b55 100644 (file)
@@ -19,9 +19,11 @@ package org.onap.ccsdk.apps.controllerblueprints.service.validator;
 \r
 import org.apache.commons.io.FileUtils;\r
 import org.junit.Assert;\r
+import org.junit.Before;\r
 import org.junit.Test;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.utils.ConfigModelUtils;\r
 import com.att.eelf.configuration.EELFLogger;\r
 import com.att.eelf.configuration.EELFManager;\r
@@ -33,6 +35,14 @@ import java.util.List;
 public class ServiceTemplateValidationTest {\r
     private static EELFLogger log = EELFManager.getInstance().getLogger(ServiceTemplateValidationTest.class);\r
 \r
+    @Before\r
+    public void setUp(){\r
+        ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("db", "source-db");\r
+        ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("input", "source-input");\r
+        ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("default", "source-default");\r
+        ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("mdsal", "source-rest");\r
+    }\r
+\r
     @Test\r
     public void testBluePrintDirs() {\r
         List<String> dirs = ConfigModelUtils.getBlueprintNames("load/blueprints");\r
index 3a913b7..397f3b1 100644 (file)
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-
+spring.main.banner-mode=off
 spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS = false
 
 
@@ -23,7 +23,7 @@ logging.level.org.hibernate.SQL=warn
 logging.level.org.hibernate.type.descriptor.sql=debug
 
 
-blueprints.load.initial-data=true
+blueprints.load.initial-data=false
 load.dataTypePath=./../../application/load/model_type/data_type
 load.nodeTypePath=./../../application/load/model_type/node_type
 load.artifactTypePath=./../../application/load/model_type/artifact_type
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json
new file mode 100644 (file)
index 0000000..3715bec
--- /dev/null
@@ -0,0 +1,62 @@
+[\r
+  {\r
+    "name": "rs-db-source",\r
+    "input-param": true,\r
+    "property": {\r
+      "type": "string",\r
+      "required": true\r
+    },\r
+    "dictionary-name": "sample-db-source",\r
+    "dictionary-source": "db",\r
+    "dependencies": [\r
+      "input-source"\r
+    ]\r
+  },\r
+  {\r
+    "name": "ra-default-source",\r
+    "input-param": true,\r
+    "property": {\r
+      "type": "string",\r
+      "required": true\r
+    },\r
+    "dictionary-name": "sample-default-source",\r
+    "dictionary-source": "default",\r
+    "dependencies": []\r
+  },\r
+  {\r
+    "name": "ra-input-source",\r
+    "input-param": true,\r
+    "property": {\r
+      "type": "string",\r
+      "required": true\r
+    },\r
+    "dictionary-name": "sample-input-source",\r
+    "dictionary-source": "input",\r
+    "dependencies": []\r
+  },\r
+  {\r
+    "name": "ra-list-input-source",\r
+    "input-param": true,\r
+    "property": {\r
+      "type": "list",\r
+      "required": true,\r
+      "entry_schema": {\r
+        "type": "string"\r
+      }\r
+    },\r
+    "dictionary-name": "ra-list-input-source",\r
+    "dictionary-source": "input",\r
+    "dependencies": []\r
+  },\r
+  {\r
+    "name": "ra-complex-input-source",\r
+    "input-param": true,\r
+    "property": {\r
+      "type": "dt-v4-aggregate",\r
+      "required": true\r
+    },\r
+    "dictionary-name": "sample-mdsal-source",\r
+    "dictionary-source": "mdsal",\r
+    "dependencies": []\r
+  }\r
+]\r
index 70d03e0..782ed50 100644 (file)
             "properties": {\r
               "mapping": [\r
                 {\r
-                  "name": "bundle-mac",\r
+                  "name": "rs-db-source",\r
                   "property": {\r
                     "required": true,\r
                     "type": "string"\r
                   },\r
                   "input-param": false,\r
-                  "dictionary-name": "bundle-mac",\r
+                  "dictionary-name": "sample-db-source",\r
                   "dictionary-source": "db",\r
                   "dependencies": [\r
                     "hostname"\r
                   "version": 0\r
                 },\r
                 {\r
-                  "name": "wan-aggregate-ipv4-addresses",\r
+                  "name": "mdsal-source",\r
                   "property": {\r
                     "description": "",\r
                     "required": true,\r
                     }\r
                   },\r
                   "input-param": false,\r
-                  "dictionary-name": "wan-aggregate-ipv4-addresses",\r
+                  "dictionary-name": "sample-mdsal-source",\r
                   "dictionary-source": "mdsal",\r
                   "dependencies": [\r
                     "service-instance-id"\r
                     }\r
                   },\r
                   "input-param": false,\r
-                  "dictionary-name": "licenses",\r
+                  "dictionary-name": "sample-licenses",\r
                   "dictionary-source": "mdsal",\r
                   "dependencies": [\r
                     "service-instance-id"\r
index bf3deff..531d756 100644 (file)
       "description" : "This is Dynamic Data type definition generated from resource mapping for the config template name base-config-template.",\r
       "version" : "1.0.0",\r
       "properties" : {\r
-        "bundle-mac" : {\r
-          "required" : true,\r
-          "type" : "string"\r
-        },\r
         "hostname" : {\r
           "required" : true,\r
           "type" : "string"\r
             "type" : "dt-license-key"\r
           }\r
         },\r
-        "wan-aggregate-ipv4-addresses" : {\r
-          "description" : "",\r
+        "rs-db-source" : {\r
           "required" : true,\r
-          "type" : "list",\r
-          "entry_schema" : {\r
-            "type" : "dt-v4-aggregate"\r
-          }\r
+          "type" : "string"\r
         },\r
         "service" : {\r
           "required" : true,\r
         "service-instance-id" : {\r
           "required" : true,\r
           "type" : "string"\r
+        },\r
+        "mdsal-source" : {\r
+          "description" : "",\r
+          "required" : true,\r
+          "type" : "list",\r
+          "entry_schema" : {\r
+            "type" : "dt-v4-aggregate"\r
+          }\r
         }\r
       },\r
       "derived_from" : "tosca.datatypes.Dynamic"\r
       "version" : "1.0.0",\r
       "derived_from" : "tosca.nodes.Root"\r
     },\r
+    "artifact-config-template" : {\r
+      "description" : "This is Configuration Velocity Template",\r
+      "version" : "1.0.0",\r
+      "properties" : {\r
+        "action-names" : {\r
+          "required" : true,\r
+          "type" : "list",\r
+          "entry_schema" : {\r
+            "type" : "string"\r
+          }\r
+        }\r
+      },\r
+      "capabilities" : {\r
+        "content" : {\r
+          "type" : "tosca.capabilities.Content",\r
+          "properties" : {\r
+            "content" : {\r
+              "required" : true,\r
+              "type" : "string"\r
+            }\r
+          }\r
+        },\r
+        "mapping" : {\r
+          "type" : "tosca.capabilities.Mapping",\r
+          "properties" : {\r
+            "mapping" : {\r
+              "required" : false,\r
+              "type" : "list",\r
+              "entry_schema" : {\r
+                "type" : "datatype-resource-assignment"\r
+              }\r
+            }\r
+          }\r
+        }\r
+      },\r
+      "derived_from" : "tosca.nodes.Artifact"\r
+    },\r
+    "tosca.nodes.Vnf" : {\r
+      "description" : "This is VNF Node Type",\r
+      "version" : "1.0.0",\r
+      "derived_from" : "tosca.nodes.Root"\r
+    },\r
+    "tosca.nodes.Artifact" : {\r
+      "description" : "This is Deprecated Artifact Node Type.",\r
+      "version" : "1.0.0",\r
+      "derived_from" : "tosca.nodes.Root"\r
+    },\r
+    "dg-activate-netconf" : {\r
+      "description" : "This is Download Netconf Directed Graph",\r
+      "version" : "1.0.0",\r
+      "properties" : {\r
+        "mode" : {\r
+          "required" : false,\r
+          "type" : "string",\r
+          "default" : "sync"\r
+        },\r
+        "version" : {\r
+          "required" : false,\r
+          "type" : "string",\r
+          "default" : "LATEST"\r
+        },\r
+        "is-start-flow" : {\r
+          "required" : false,\r
+          "type" : "boolean",\r
+          "default" : false\r
+        }\r
+      },\r
+      "capabilities" : {\r
+        "dg-node" : {\r
+          "type" : "tosca.capabilities.Node"\r
+        }\r
+      },\r
+      "requirements" : {\r
+        "component-dependency" : {\r
+          "capability" : "component-node",\r
+          "node" : "component-netconf-executor",\r
+          "relationship" : "tosca.relationships.DependsOn"\r
+        }\r
+      },\r
+      "interfaces" : {\r
+        "CONFIG" : {\r
+          "operations" : {\r
+            "ActivateNetconf" : {\r
+              "inputs" : {\r
+                "params" : {\r
+                  "required" : false,\r
+                  "type" : "list",\r
+                  "entry_schema" : {\r
+                    "type" : "datatype-property"\r
+                  }\r
+                }\r
+              }\r
+            }\r
+          }\r
+        }\r
+      },\r
+      "derived_from" : "tosca.nodes.DG"\r
+    },\r
+    "source-input" : {\r
+      "description" : "This is Input Resource Source Node Type",\r
+      "version" : "1.0.0",\r
+      "properties" : {\r
+        "key" : {\r
+          "required" : false,\r
+          "type" : "string"\r
+        },\r
+        "key-dependencies" : {\r
+          "required" : true,\r
+          "type" : "list",\r
+          "entry_schema" : {\r
+            "type" : "string"\r
+          }\r
+        }\r
+      },\r
+      "derived_from" : "tosca.nodes.ResourceSource"\r
+    },\r
+    "tosca.nodes.ResourceSource" : {\r
+      "description" : "TOSCA base type for Resource Sources",\r
+      "version" : "1.0.0",\r
+      "derived_from" : "tosca.nodes.Root"\r
+    },\r
     "component-resource-assignment" : {\r
       "description" : "This is Resource Assignment Component API",\r
       "version" : "1.0.0",\r
       "version" : "1.0.0",\r
       "derived_from" : "tosca.nodes.Root"\r
     },\r
-    "artifact-config-template" : {\r
-      "description" : "This is Configuration Velocity Template",\r
+    "source-db" : {\r
+      "description" : "This is Database Resource Source Node Type",\r
       "version" : "1.0.0",\r
       "properties" : {\r
-        "action-names" : {\r
+        "type" : {\r
           "required" : true,\r
-          "type" : "list",\r
+          "type" : "string",\r
+          "constraints" : [ {\r
+            "valid_values" : [ "SQL", "PLSQL" ]\r
+          } ]\r
+        },\r
+        "query" : {\r
+          "required" : true,\r
+          "type" : "string"\r
+        },\r
+        "input-key-mapping" : {\r
+          "required" : false,\r
+          "type" : "map",\r
           "entry_schema" : {\r
             "type" : "string"\r
           }\r
-        }\r
-      },\r
-      "capabilities" : {\r
-        "content" : {\r
-          "type" : "tosca.capabilities.Content",\r
-          "properties" : {\r
-            "content" : {\r
-              "required" : true,\r
-              "type" : "string"\r
-            }\r
+        },\r
+        "output-key-mapping" : {\r
+          "required" : false,\r
+          "type" : "map",\r
+          "entry_schema" : {\r
+            "type" : "string"\r
           }\r
         },\r
-        "mapping" : {\r
-          "type" : "tosca.capabilities.Mapping",\r
-          "properties" : {\r
-            "mapping" : {\r
-              "required" : false,\r
-              "type" : "list",\r
-              "entry_schema" : {\r
-                "type" : "datatype-resource-assignment"\r
-              }\r
-            }\r
+        "key-dependencies" : {\r
+          "required" : true,\r
+          "type" : "list",\r
+          "entry_schema" : {\r
+            "type" : "string"\r
           }\r
         }\r
       },\r
-      "derived_from" : "tosca.nodes.Artifact"\r
+      "derived_from" : "tosca.nodes.ResourceSource"\r
     },\r
     "vnf-netconf-device" : {\r
       "description" : "This is VNF Device with Netconf  Capability",\r
       },\r
       "derived_from" : "tosca.nodes.Vnf"\r
     },\r
-    "tosca.nodes.Vnf" : {\r
-      "description" : "This is VNF Node Type",\r
+    "source-rest" : {\r
+      "description" : "This is Rest Resource Source Node Type",\r
       "version" : "1.0.0",\r
-      "derived_from" : "tosca.nodes.Root"\r
+      "properties" : {\r
+        "type" : {\r
+          "required" : false,\r
+          "type" : "string",\r
+          "constraints" : [ {\r
+            "valid_values" : [ "JSON" ]\r
+          } ],\r
+          "default" : "JSON"\r
+        },\r
+        "url-path" : {\r
+          "required" : true,\r
+          "type" : "string"\r
+        },\r
+        "path" : {\r
+          "required" : true,\r
+          "type" : "string"\r
+        },\r
+        "expression-type" : {\r
+          "required" : false,\r
+          "type" : "string",\r
+          "constraints" : [ {\r
+            "valid_values" : [ "JSON_PATH", "JSON_POINTER" ]\r
+          } ],\r
+          "default" : "JSON_PATH"\r
+        },\r
+        "input-key-mapping" : {\r
+          "required" : false,\r
+          "type" : "map",\r
+          "entry_schema" : {\r
+            "type" : "string"\r
+          }\r
+        },\r
+        "output-key-mapping" : {\r
+          "required" : false,\r
+          "type" : "map",\r
+          "entry_schema" : {\r
+            "type" : "string"\r
+          }\r
+        },\r
+        "key-dependencies" : {\r
+          "required" : true,\r
+          "type" : "list",\r
+          "entry_schema" : {\r
+            "type" : "string"\r
+          }\r
+        }\r
+      },\r
+      "derived_from" : "tosca.nodes.ResourceSource"\r
     },\r
     "component-netconf-executor" : {\r
       "description" : "This is Netconf Transaction Configuration Component API",\r
         }\r
       },\r
       "derived_from" : "tosca.nodes.Component"\r
-    },\r
-    "tosca.nodes.Artifact" : {\r
-      "description" : "This is Deprecated Artifact Node Type.",\r
-      "version" : "1.0.0",\r
-      "derived_from" : "tosca.nodes.Root"\r
-    },\r
-    "dg-activate-netconf" : {\r
-      "description" : "This is Download Netconf Directed Graph",\r
-      "version" : "1.0.0",\r
-      "properties" : {\r
-        "mode" : {\r
-          "required" : false,\r
-          "type" : "string",\r
-          "default" : "sync"\r
-        },\r
-        "version" : {\r
-          "required" : false,\r
-          "type" : "string",\r
-          "default" : "LATEST"\r
-        },\r
-        "is-start-flow" : {\r
-          "required" : false,\r
-          "type" : "boolean",\r
-          "default" : false\r
-        }\r
-      },\r
-      "capabilities" : {\r
-        "dg-node" : {\r
-          "type" : "tosca.capabilities.Node"\r
-        }\r
-      },\r
-      "requirements" : {\r
-        "component-dependency" : {\r
-          "capability" : "component-node",\r
-          "node" : "component-netconf-executor",\r
-          "relationship" : "tosca.relationships.DependsOn"\r
-        }\r
-      },\r
-      "interfaces" : {\r
-        "CONFIG" : {\r
-          "operations" : {\r
-            "ActivateNetconf" : {\r
-              "inputs" : {\r
-                "params" : {\r
-                  "required" : false,\r
-                  "type" : "list",\r
-                  "entry_schema" : {\r
-                    "type" : "datatype-property"\r
-                  }\r
-                }\r
-              }\r
-            }\r
-          }\r
-        }\r
-      },\r
-      "derived_from" : "tosca.nodes.DG"\r
     }\r
   },\r
   "topology_template" : {\r
           "mapping" : {\r
             "properties" : {\r
               "mapping" : [ {\r
-                "name" : "bundle-mac",\r
+                "name" : "rs-db-source",\r
                 "property" : {\r
                   "required" : true,\r
                   "type" : "string"\r
                 },\r
                 "input-param" : false,\r
-                "dictionary-name" : "bundle-mac",\r
+                "dictionary-name" : "sample-db-source",\r
                 "dictionary-source" : "db",\r
                 "dependencies" : [ "hostname" ],\r
                 "version" : 0\r
               }, {\r
-                "name" : "wan-aggregate-ipv4-addresses",\r
+                "name" : "mdsal-source",\r
                 "property" : {\r
                   "description" : "",\r
                   "required" : true,\r
                   }\r
                 },\r
                 "input-param" : false,\r
-                "dictionary-name" : "wan-aggregate-ipv4-addresses",\r
+                "dictionary-name" : "sample-mdsal-source",\r
                 "dictionary-source" : "mdsal",\r
                 "dependencies" : [ "service-instance-id" ],\r
                 "version" : 0\r
                   }\r
                 },\r
                 "input-param" : false,\r
-                "dictionary-name" : "licenses",\r
+                "dictionary-name" : "sample-licenses",\r
                 "dictionary-source" : "mdsal",\r
                 "dependencies" : [ "service-instance-id" ],\r
                 "version" : 0\r
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/simple-enrich.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/simple-enrich.json
deleted file mode 100644 (file)
index 641da80..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-[\r
-  {\r
-    "name": "rs-db-source",\r
-    "input-param": true,\r
-    "property": {\r
-      "type": "string",\r
-      "required": true\r
-    },\r
-    "dictionary-name": "db-source",\r
-    "dictionary-source": "db",\r
-    "dependencies": [\r
-      "input-source"\r
-    ]\r
-  },\r
-  {\r
-    "name": "ra-default-source",\r
-    "input-param": true,\r
-    "property": {\r
-      "type": "string",\r
-      "required": true\r
-    },\r
-    "dictionary-name": "default-source",\r
-    "dictionary-source": "default",\r
-    "dependencies": []\r
-  },\r
-  {\r
-    "name": "ra-input-source",\r
-    "input-param": true,\r
-    "property": {\r
-      "type": "string",\r
-      "required": true\r
-    },\r
-    "dictionary-name": "input-source",\r
-    "dictionary-source": "input",\r
-    "dependencies": []\r
-  }\r
-]\r
index 4a04cfd..7b7ef75 100644 (file)
@@ -1,5 +1,6 @@
 <!--
   ~  Copyright © 2018 IBM.
+  ~  Modifications 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.
@@ -27,8 +28,8 @@
     </appender>
 
 
-    <logger name="org.springframework" level="info"/>
-    <logger name="org.springframework.web" level="info"/>
+    <logger name="org.springframework" level="warn"/>
+    <logger name="org.springframework.web" level="warn"/>
     <logger name="org.hibernate" level="error"/>
     <logger name="org.onap.ccsdk.apps" level="info"/>
 
index 5a2a4ec..c6dd794 100644 (file)
@@ -1,11 +1,14 @@
 [\r
        {\r
-               "name": "input-source"\r
+               "name": "sample-input-source"\r
        },\r
        {\r
-               "name": "v4-ip-type"\r
+               "name": "sample-default-source"\r
        },\r
        {\r
-               "name": "db-source"\r
+               "name": "sample-db-source"\r
+       },\r
+       {\r
+               "name": "sample-mdsal-source"\r
        }\r
 ]
\ No newline at end of file