Controller Blueprints Microservice
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Fri, 7 Sep 2018 22:43:20 +0000 (22:43 +0000)
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Fri, 7 Sep 2018 22:43:20 +0000 (22:43 +0000)
Modify get_input, get_attribute, get_property and get_artifact functions string implementation to Json Implementation.

Change-Id: I6d4aadd370dc23127a176964f84fc9bb5e7ab5ee
Issue-ID: CCSDK-432
Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
13 files changed:
components/core/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json
components/core/load/blueprints/simple-baseconfig/Definitions/sample-nodetype.json
components/core/load/blueprints/simple-baseconfig/Definitions/simple-baseconfig.json
components/core/load/model_type/node_type/component-config-generator.json
components/core/load/model_type/node_type/component-netconf-executor.json
components/core/load/model_type/node_type/component-resource-assignment.json
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt
components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt
components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt
components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
components/core/src/test/resources/componentnode/default.json
components/core/src/test/resources/properties/convert.json
components/core/src/test/resources/properties/default.json

index 714195f..9c70d6e 100644 (file)
@@ -40,7 +40,7 @@
           "component-node": {}\r
         },\r
         "interfaces": {\r
-          "org-onap-sdnc-config-assignment-service-ConfigAssignmentNode": {\r
+          "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {\r
             "operations": {\r
               "process": {\r
                 "inputs": {\r
         }\r
       },\r
       "interfaces": {\r
-        "org-onap-sdnc-config-assignment-service-ConfigAssignmentNode": {\r
+        "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {\r
           "operations": {\r
             "process": {\r
               "inputs": {\r
index 6d469ea..207fcc4 100644 (file)
@@ -1,34 +1,5 @@
 {\r
   "description": "This is Resource Assignment Component API",\r
   "version": "1.0.0",\r
-  "properties": {\r
-    "type": {\r
-      "description": "Request Id used to store the generated configuration, in the database along with the template-name",\r
-      "required": false,\r
-      "type": "string"\r
-    }\r
-  },\r
-  "interfaces": {\r
-    "DefaultOperation": {\r
-      "operations": {\r
-        "validate": {\r
-          "inputs": {\r
-            "action-name": {\r
-              "description": "validate for action",\r
-              "required": false,\r
-              "type": "string"\r
-            }\r
-          }\r
-        }\r
-      }\r
-    }\r
-  },\r
-  "artifacts" :{\r
-    "component-jar": {\r
-      "description": "Component Jar",\r
-      "type": "artifact-component-jar",\r
-      "file": "Component/basecomponent.jar"\r
-    }\r
-  },\r
-  "derived_from": "tosca.nodes.Root"\r
+   "derived_from": "tosca.nodes.Root"\r
 }
\ No newline at end of file
index 65028ac..cb091da 100644 (file)
@@ -38,7 +38,7 @@
               "login-key": "sdnc",\r
               "login-account": "sndc-local",\r
               "source": "local",\r
-              "target-ip-address": "{\"get_attribute\":\"lo0-local-ipv4-address\"}",\r
+              "target-ip-address":  { "get_attribute": ["SELF", "lo0-local-ipv4-address"]},\r
               "port-number": 22,\r
               "connection-time-out": 30\r
             }\r
           }\r
         },\r
         "interfaces": {\r
-          "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode": {\r
+          "org-onap-ccsdk-netconf-adaptor-service-NetconfExecutorNode": {\r
             "operations": {\r
               "process": {\r
                 "inputs": {\r
-                  "action-name": "{ \"get_input\" : \"action-name\" }",\r
-                  "service-template-name": "{ \"get_attribute\" : \"template_name\" }",\r
-                  "service-template-version": "{ \"get_attribute\" : \"service-template-version\" }",\r
+                  "action-name": { "get_input" : "action-name" },\r
+                  "service-template-name": { "get_input" : "template_name" },\r
+                  "service-template-version": { "get_input" : "service-template-version" },\r
                   "resource-type": "vnf-type",\r
-                  "request-id": "{ \"get_input\" : \"request-id\" }",\r
-                  "resource-id": "{ \"get_input\" : \"hostname\" }",\r
+                  "request-id": { "get_input" : "request-id" },\r
+                  "resource-id": { "get_input" : "hostname" },\r
                   "execution-script": "execution-script"\r
                 },\r
                 "outputs": {\r
-                  "response-data": "{ \"get_attribute\" : \"netconf-executor-baseconfig.response-data\" }",\r
-                  "status": "{ \"get_attribute\" : \"netconf-executor-baseconfig.status\" }"\r
+                  "response-data": { "get_input" : ["SELF", "netconf-executor-baseconfig.response-data"] },\r
+                  "status": { "get_input" : ["SELF", "netconf-executor-baseconfig.status"] }\r
                 },\r
                 "implementation" : {\r
                   "primary" : "file://netconf_adaptor/DefaultBaseLicenceConfig.py"\r
@@ -88,7 +88,7 @@
           "component-node": {}\r
         },\r
         "interfaces": {\r
-          "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode": {\r
+          "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {\r
             "operations": {\r
               "process": {\r
                 "inputs": {\r
                     "base-config-template",\r
                     "licence-template"\r
                   ],\r
-                  "action-name": "{ \"get_input\" : \"action-name\" }",\r
-                  "service-template-name": "{ \"get_attribute\" : \"template_name\" }",\r
-                  "service-template-version": "{ \"get_attribute\" : \"service-template-version\" }",\r
+                  "action-name": { "get_input" : "action-name" },\r
+                  "service-template-name": { "get_input" : "template_name" },\r
+                  "service-template-version": { "get_input" : "service-template-version" },\r
                   "resource-type": "vnf-type",\r
-                  "request-id": "{ \"get_input\" : \"request-id\" }",\r
-                  "resource-id": "{ \"get_input\" : \"hostname\" }"\r
+                  "request-id": { "get_input" : "request-id" },\r
+                  "resource-id": { "get_input" : "hostname" }\r
                 },\r
                 "outputs": {\r
                   "resource-assignment-params": "success",\r
           }\r
         },\r
         "capabilities": {\r
-          "dg-node": {},\r
-          "content": {\r
-            "properties": {\r
-              "type": "json"\r
-            }\r
-          }\r
+          "dg-node": {}\r
         },\r
         "interfaces": {\r
           "CONFIG": {\r
index 764f9e8..9e86b8a 100644 (file)
@@ -7,7 +7,7 @@
                }\r
        },\r
        "interfaces": {\r
-               "org-openecomp-sdnc-config-generator-service-ConfigGeneratorNode": {\r
+               "org-onap-ccsdk-config-generator-service-ConfigGeneratorNode": {\r
                        "operations": {\r
                                "process": {\r
                                        "inputs": {\r
index aed667a..7dcff58 100644 (file)
@@ -14,7 +14,7 @@
     }\r
   },\r
   "interfaces": {\r
-    "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode": {\r
+    "org-onap-ccsdk-netconf-adaptor-service-NetconfExecutorNode": {\r
       "operations": {\r
         "process": {\r
           "inputs": {\r
index 03f3c28..1389bc3 100644 (file)
@@ -7,7 +7,7 @@
     }\r
   },\r
   "interfaces": {\r
-    "org-onap-sdnc-config-assignment-service-ConfigAssignmentNode": {\r
+    "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {\r
       "operations": {\r
         "process": {\r
           "inputs": {\r
index 8459220..8bfa2db 100644 (file)
@@ -31,12 +31,6 @@ object ConfigModelConstant {
 \r
     const val MODEL_TYPE_NODE_ARTIFACT = "tosca.nodes.Artifact"\r
 \r
-    const val MODEL_TYPE_CAPABILITY_NETCONF = "tosca.capability.Netconf"\r
-    const val MODEL_TYPE_CAPABILITY_SSH = "tosca.capability.Ssh"\r
-    const val MODEL_TYPE_CAPABILITY_SFTP = "tosca.capability.Sftp"\r
-    const val MODEL_TYPE_CAPABILITY_CHEF = "tosca.capability.Chef"\r
-    const val MODEL_TYPE_CAPABILITY_ANSIBLEF = "tosca.capability.Ansible"\r
-\r
     const val CAPABILITY_PROPERTY_MAPPING = "mapping"\r
 \r
     const val PROPERTY_RECIPE_NAMES = "action-names"\r
index 19d515e..82e232d 100644 (file)
@@ -25,6 +25,7 @@ import org.onap.ccsdk.apps.controllerblueprints.core.data.*
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils\r
 import com.att.eelf.configuration.EELFLogger\r
 import com.att.eelf.configuration.EELFManager\r
+\r
 /**\r
  *\r
  *\r
@@ -115,32 +116,34 @@ object BluePrintExpressionService {
     @JvmStatic\r
     fun populateAttributeExpression(jsonNode: JsonNode): AttributeExpression {\r
         val arrayNode: ArrayNode = jsonNode.first() as ArrayNode\r
-        check(arrayNode.size() >= 3) {\r
+        check(arrayNode.size() >= 2) {\r
             throw BluePrintException(String.format("missing attribute expression, " +\r
                     "it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <attribute_name>," +\r
                     " <nested_attribute_name_or_index_1>, ..., <nested_attribute_name_or_index_n> ] , but present {}", jsonNode))\r
         }\r
 \r
         var reqOrCapEntityName: String? = null\r
-        var propertyName = ""\r
-        var subProperty: String? = null\r
-        if (arrayNode.size() == 2) {\r
-            propertyName = arrayNode[1].textValue()\r
-        } else if (arrayNode.size() == 3) {\r
-            reqOrCapEntityName = arrayNode[1].textValue()\r
-            propertyName = arrayNode[2].textValue()\r
-        } else if (arrayNode.size() > 3) {\r
-            reqOrCapEntityName = arrayNode[1].textValue()\r
-            propertyName = arrayNode[2].textValue()\r
-            val propertyPaths: List<String> = arrayNode.filterIndexed { index, obj ->\r
-                index >= 3\r
-            }.map { it.textValue() }\r
-            subProperty = propertyPaths.joinToString("/")\r
+        var attributeName = ""\r
+        var subAttributeName: String? = null\r
+        when {\r
+            arrayNode.size() == 2 -> attributeName = arrayNode[1].textValue()\r
+            arrayNode.size() == 3 -> {\r
+                reqOrCapEntityName = arrayNode[1].textValue()\r
+                attributeName = arrayNode[2].textValue()\r
+            }\r
+            arrayNode.size() > 3 -> {\r
+                reqOrCapEntityName = arrayNode[1].textValue()\r
+                attributeName = arrayNode[2].textValue()\r
+                val propertyPaths: List<String> = arrayNode.filterIndexed { index, _ ->\r
+                    index >= 3\r
+                }.map { it.textValue() }\r
+                subAttributeName = propertyPaths.joinToString("/")\r
+            }\r
         }\r
         return AttributeExpression(modelableEntityName = arrayNode[0].asText(),\r
                 reqOrCapEntityName = reqOrCapEntityName,\r
-                attributeName = propertyName,\r
-                subAttributeName = subProperty\r
+                attributeName = attributeName,\r
+                subAttributeName = subAttributeName\r
         )\r
     }\r
 \r
index 911a891..a021402 100644 (file)
@@ -60,14 +60,22 @@ class BluePrintExpressionServiceTest {
 \r
     @Test\r
     fun testAttributeExpression() {\r
-        val node : JsonNode = jacksonObjectMapper().readTree("{ \"get_attribute\" : [\"SELF\", \"\",\"attribute-name\", \"resource\", \"name\"] }")\r
+        val node : JsonNode = jacksonObjectMapper().readTree("{ \"get_attribute\" : [\"SELF\", \"resource\"] }")\r
         val expressionData : ExpressionData = BluePrintExpressionService.getExpressionData(node)\r
         assertNotNull(expressionData, " Failed to populate expression data")\r
         assertEquals(expressionData.isExpression, true, "Failed to identify as expression")\r
         assertNotNull(expressionData.attributeExpression, " Failed to populate attribute expression data")\r
         assertEquals("SELF", expressionData.attributeExpression?.modelableEntityName, " Failed to get expected modelableEntityName")\r
-        assertEquals("attribute-name", expressionData.attributeExpression?.attributeName, " Failed to get expected attributeName")\r
-        assertEquals("resource/name",expressionData.attributeExpression?.subAttributeName, " Failed to populate nested subAttributeName expression data")\r
+        assertEquals("resource", expressionData.attributeExpression?.attributeName, " Failed to get expected attributeName")\r
+\r
+        val node1 : JsonNode = jacksonObjectMapper().readTree("{ \"get_attribute\" : [\"SELF\", \"\",\"attribute-name\", \"resource\", \"name\"] }")\r
+        val expressionData1 : ExpressionData = BluePrintExpressionService.getExpressionData(node1)\r
+        assertNotNull(expressionData1, " Failed to populate expression data")\r
+        assertEquals(expressionData1.isExpression, true, "Failed to identify as expression")\r
+        assertNotNull(expressionData1.attributeExpression, " Failed to populate attribute expression data")\r
+        assertEquals("SELF", expressionData1.attributeExpression?.modelableEntityName, " Failed to get expected modelableEntityName")\r
+        assertEquals("attribute-name", expressionData1.attributeExpression?.attributeName, " Failed to get expected attributeName")\r
+        assertEquals("resource/name",expressionData1.attributeExpression?.subAttributeName, " Failed to populate nested subAttributeName expression data")\r
     }\r
 \r
 \r
index 919dc56..277ec3a 100644 (file)
@@ -87,7 +87,7 @@ class BluePrintRuntimeServiceTest {
         log.info("Prepared Context {}", context)\r
 \r
         val inContext: MutableMap<String, Any?> = bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationInputs("resource-assignment-ra-component",\r
-                "org-onap-sdnc-config-assignment-service-ConfigAssignmentNode", "process")\r
+                "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode", "process")\r
 \r
         log.info("In Context {}", inContext)\r
 \r
@@ -110,18 +110,18 @@ class BluePrintRuntimeServiceTest {
 \r
         val componentContext: MutableMap<String, Any?> = hashMapOf()\r
         val successValue: JsonNode = jsonNodeFromObject("Success")\r
-        componentContext["resource-assignment-ra-component.org-onap-sdnc-config-assignment-service-ConfigAssignmentNode.process.status"] = successValue\r
-        componentContext["resource-assignment-ra-component.org-onap-sdnc-config-assignment-service-ConfigAssignmentNode.process.resource-assignment-params"] = null\r
+        componentContext["resource-assignment-ra-component.org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode.process.status"] = successValue\r
+        componentContext["resource-assignment-ra-component.org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode.process.resource-assignment-params"] = null\r
 \r
         bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs("resource-assignment-ra-component",\r
-                "org-onap-sdnc-config-assignment-service-ConfigAssignmentNode", "process", componentContext)\r
+                "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode", "process", componentContext)\r
 \r
         assertEquals(NullNode.instance,\r
-                context.get("node_templates/resource-assignment-ra-component/interfaces/org-onap-sdnc-config-assignment-service-ConfigAssignmentNode/operations/process/properties/resource-assignment-params"),\r
+                context.get("node_templates/resource-assignment-ra-component/interfaces/org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode/operations/process/properties/resource-assignment-params"),\r
                 "Failed to get operation property resource-assignment-params")\r
 \r
         assertEquals(successValue,\r
-                context.get("node_templates/resource-assignment-ra-component/interfaces/org-onap-sdnc-config-assignment-service-ConfigAssignmentNode/operations/process/properties/status"),\r
+                context.get("node_templates/resource-assignment-ra-component/interfaces/org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode/operations/process/properties/status"),\r
                 "Failed to get operation property status")\r
 \r
 \r
index b7265fc..184b598 100644 (file)
                        "generate-configuration": {\r
                                "type": "mock-component-generateConfig",\r
                                "interfaces": {\r
-                                       "org-openecomp-sdnc-config-params-service-MockComponentNode": {\r
+                                       "org-onap-ccsdk-config-params-service-MockComponentNode": {\r
                                                "operations": {\r
                                                        "process": {\r
                                                                "inputs": {\r
                                                                        "entity-type": "vnf-type",\r
                                                                        "template-content": "sample-template",\r
-                                                                       "entity-id": "{ \"get_input\" : \"vnf-id\" }"\r
+                                                                       "entity-id": { "get_input" : "vnf-id" }\r
                                                                },\r
                                                                "outputs": {\r
                                                                        "mergedData": "merged Data",\r
@@ -63,7 +63,7 @@
        "node_types": {\r
                "mock-component-generateConfig": {\r
                        "interfaces": {\r
-                               "org-openecomp-sdnc-config-params-service-MockComponentNode": {\r
+                               "org-onap-ccsdk-config-params-service-MockComponentNode": {\r
                                        "operations": {\r
                                                "process": {\r
                                                        "inputs": {\r
index cb7d08e..af79915 100644 (file)
                                                                "required": true\r
                                                        }\r
                                                ],\r
-                                               "pre-data": "{ \"get_attribute\" : \"get-resource-assignment.config-params\" }",\r
+                                               "pre-data": { "get_input" : "get-resource-assignment.config-params" },\r
                                                "prifix": "get-resource-assignment"\r
                                        },\r
                                        "outputs": {\r
                                                "resource-assignment-status": "success",\r
-                                               "resource-assignment-params": "{ \"set_value\" : \"get-resource-assignment.config-params\" }"\r
+                                               "resource-assignment-params": "{ \"set_value\" : \"get-resource-assignment.config-params" }\r
                                        }\r
                                }\r
                        }\r
index 0ac97f9..ec416dc 100644 (file)
@@ -1,5 +1,5 @@
 {\r
-       "default": "{ \"get_input\" : \"loopback-default\" }",\r
+       "default": { "get_input" : "loopback-default" },\r
        "domain": "ethernet",\r
        "criteria": [\r
                {\r
@@ -8,7 +8,7 @@
                        "nodeString": "layer3-service-list[].service-data.l3sdn-vnf-fields.vnf-name"\r
                },\r
                {\r
-                       "value": "{ \"get_input\" : \"host-ip-address\" }",\r
+                       "value": { "get_input" : "host-ip-address" },\r
                        "type": "simple",\r
                        "nodeString": "layer3-service-list[].service-data.l3sdn-vnf-fields.vnf-name"\r
                }\r