Controller Blueprints Microservice
authorBrinda Santh <brindasanth@in.ibm.com>
Sat, 25 Aug 2018 02:48:32 +0000 (22:48 -0400)
committerBrinda Santh <brindasanth@in.ibm.com>
Sun, 26 Aug 2018 16:10:39 +0000 (12:10 -0400)
Create resource definition and Create Source Node Type definitions for Input, default, db, mdsal and component sources.

Change-Id: Icc49cb4be2e8700b61c281ff2d01c365321bb311
Issue-ID: CCSDK-487
Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
24 files changed:
ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintProcessorException.kt [moved from ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/OrchestratorException.kt with 91% similarity]
ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-component-java.json [new file with mode: 0644]
ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-db.json [new file with mode: 0644]
ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-default.json [new file with mode: 0644]
ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-input.json [new file with mode: 0644]
ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-rest.json [new file with mode: 0644]
ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/tosca.nodes.ResourceSource.json [new file with mode: 0644]
ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/db-source.json
ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/default-source.json
ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/input-source.json
ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json
ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignment.java [deleted file]
ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.java
ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDependency.java
ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.java
ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.java
ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDeserializer.java
ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.java
ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.java
ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt [new file with mode: 0644]
ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt [new file with mode: 0644]
ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDefinitionTest.java [moved from ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/DictionaryDefinitionTest.java with 55% similarity]
ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDictionaryUtilsTest.java

@@ -1,5 +1,6 @@
 /*\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
@@ -20,7 +21,7 @@ package org.onap.ccsdk.apps.controllerblueprints.core
  *\r
  * @author Brinda Santh\r
  */\r
-class OrchestratorException : Exception {\r
+class BluePrintProcessorException : Exception {\r
     var code: Int = 100\r
 \r
     constructor(message: String, cause: Throwable) : super(message, cause)\r
index 213f5f4..0815231 100644 (file)
@@ -1,5 +1,6 @@
 /*\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
@@ -20,7 +21,7 @@ package org.onap.ccsdk.apps.controllerblueprints.core.service
 import com.fasterxml.jackson.databind.JsonNode\r
 import com.fasterxml.jackson.databind.node.NullNode\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException\r
-import org.onap.ccsdk.apps.controllerblueprints.core.OrchestratorException\r
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactDefinition\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition\r
@@ -154,7 +155,7 @@ class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var contex
         val nodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)\r
 \r
         val artifactDefinition: ArtifactDefinition = nodeTemplate.artifacts?.get(artifactName)\r
-                ?: throw OrchestratorException(String.format("failed to get artifat definition {} from the node template"\r
+                ?: throw BluePrintProcessorException(String.format("failed to get artifat definition {} from the node template"\r
                         , artifactName))\r
         val propertyAssignmentExpression = PropertyAssignmentService( context, this)\r
         return propertyAssignmentExpression.artifactContent(artifactDefinition)\r
diff --git a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-component-java.json b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-component-java.json
new file mode 100644 (file)
index 0000000..95a9801
--- /dev/null
@@ -0,0 +1,31 @@
+{
+  "description": "This is Custom Java Component Resource Source Node Type",
+  "version": "1.0.0",
+  "properties": {
+    "type": {
+      "required": false,
+      "type": "string",
+      "default" : "DYNAMIC",
+      "constraints": [
+        {
+          "validValues": [
+            "DYNAMIC"
+          ]
+        }
+      ]
+    },
+    "class-name": {
+      "required": true,
+      "type": "string",
+      "description" : "Fully Qualified Class Name ( <Package Name> + . + <Class Name> )"
+    },
+    "key-dependencies": {
+      "required": false,
+      "type": "list",
+      "entry_schema": {
+        "type": "string"
+      }
+    }
+  },
+  "derived_from": "tosca.nodes.ResourceSource"
+}
\ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-db.json b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-db.json
new file mode 100644 (file)
index 0000000..7ebeaa8
--- /dev/null
@@ -0,0 +1,44 @@
+{
+  "description": "This is Database Resource Source Node Type",
+  "version": "1.0.0",
+  "properties": {
+    "type": {
+      "required": true,
+      "type": "string",
+      "constraints": [
+        {
+          "validValues": [
+            "SQL",
+            "PLSQL"
+          ]
+        }
+      ]
+    },
+    "query": {
+      "required": true,
+      "type": "string"
+    },
+    "input-key-mapping": {
+      "required": false,
+      "type": "map",
+      "entry_schema": {
+        "type": "string"
+      }
+    },
+    "output-key-mapping": {
+      "required": false,
+      "type": "map",
+      "entry_schema": {
+        "type": "string"
+      }
+    },
+    "key-dependencies": {
+      "required": false,
+      "type": "list",
+      "entry_schema": {
+        "type": "string"
+      }
+    }
+  },
+  "derived_from": "tosca.nodes.ResourceSource"
+}
\ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-default.json b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-default.json
new file mode 100644 (file)
index 0000000..dd0bffc
--- /dev/null
@@ -0,0 +1,18 @@
+{
+  "description": "This is Default Resource Source Node Type",
+  "version": "1.0.0",
+  "properties": {
+    "key": {
+      "required": false,
+      "type": "string"
+    },
+    "key-dependencies": {
+      "required": false,
+      "type": "list",
+      "entry_schema": {
+        "type": "string"
+      }
+    }
+  },
+  "derived_from": "tosca.nodes.ResourceSource"
+}
\ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-input.json b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-input.json
new file mode 100644 (file)
index 0000000..99c4691
--- /dev/null
@@ -0,0 +1,18 @@
+{
+  "description": "This is Input Resource Source Node Type",
+  "version": "1.0.0",
+  "properties": {
+    "key": {
+      "required": false,
+      "type": "string"
+    },
+    "key-dependencies": {
+      "required": false,
+      "type": "list",
+      "entry_schema": {
+        "type": "string"
+      }
+    }
+  },
+  "derived_from": "tosca.nodes.ResourceSource"
+}
\ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-rest.json b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-rest.json
new file mode 100644 (file)
index 0000000..e77020e
--- /dev/null
@@ -0,0 +1,62 @@
+{
+  "description": "This is Rest Resource Source Node Type",
+  "version": "1.0.0",
+  "properties": {
+    "type": {
+      "required": false,
+      "type": "string",
+      "default": "JSON",
+      "constraints": [
+        {
+          "validValues": [
+            "XML",
+            "JSON"
+          ]
+        }
+      ]
+    },
+    "url-path": {
+      "required": true,
+      "type": "string"
+    },
+    "path": {
+      "required": true,
+      "type": "string"
+    },
+    "expression-type": {
+      "required": false,
+      "type": "string",
+      "default": "JSON_PATH",
+      "constraints": [
+        {
+          "validValues": [
+            "JSON_PATH",
+            "JSON_POINTER"
+          ]
+        }
+      ]
+    },
+    "input-key-mapping": {
+      "required": false,
+      "type": "map",
+      "entry_schema": {
+        "type": "string"
+      }
+    },
+    "output-key-mapping": {
+      "required": false,
+      "type": "map",
+      "entry_schema": {
+        "type": "string"
+      }
+    },
+    "key-dependencies": {
+      "required": false,
+      "type": "list",
+      "entry_schema": {
+        "type": "string"
+      }
+    }
+  },
+  "derived_from": "tosca.nodes.ResourceSource"
+}
\ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/tosca.nodes.ResourceSource.json b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/tosca.nodes.ResourceSource.json
new file mode 100644 (file)
index 0000000..2ef553e
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "description": "TOSCA base type for Resource Sources",
+  "version": "1.0.0",
+  "derived_from": "tosca.nodes.Root"
+}
\ No newline at end of file
index 8b97cde..cd4e282 100644 (file)
@@ -1,20 +1,25 @@
 {\r
   "name": "bundle-id",\r
-  "description": "name of the ",\r
+  "property" :{\r
+    "description": "name of the ",\r
+    "type": "string"\r
+  },\r
   "resource-type": "ONAP",\r
   "resource-path": "vnf/bundle-id",\r
   "updated-by": "brindasanth@onap.com",\r
-  "data-type": "String",\r
   "tags": "bundle-id, brindasanth@onap.com",\r
-  "source": {\r
+  "sources": {\r
     "db": {\r
-      "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",\r
-      "input-key-mapping": {\r
-        "profile_name": "profile_name"\r
-      },\r
-      "output-key-mapping": {\r
-        "db-country": "country",\r
-        "db-state": "state"\r
+      "type": "source-db",\r
+      "properties": {\r
+        "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",\r
+        "input-key-mapping": {\r
+          "profile_name": "profile_name"\r
+        },\r
+        "output-key-mapping": {\r
+          "db-country": "country",\r
+          "db-state": "state"\r
+        }\r
       }\r
     }\r
   },\r
index ac23292..91921b6 100644 (file)
@@ -1,14 +1,18 @@
 {\r
-       "tags": "v4-ip-type, tosca.datatypes.Root, data_type, brindasanth@onap.com",\r
-       "name": "v4-ip-type",\r
-       "description": "To be provided",\r
-       "updated-by": "brindasanth@onap.com",\r
-       "resource-type": "ONAP",\r
-       "resource-path": "vnf/v4-ip-type",\r
-       "data-type": "string",\r
-       "source": {\r
-               "default": {\r
-                       \r
-               }\r
-       }\r
+  "tags": "v4-ip-type, tosca.datatypes.Root, data_type, brindasanth@onap.com",\r
+  "name": "v4-ip-type",\r
+  "property" :{\r
+    "description": "name of the ",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "brindasanth@onap.com",\r
+  "resource-type": "ONAP",\r
+  "resource-path": "vnf/v4-ip-type",\r
+  "sources": {\r
+    "default": {\r
+      "type": "source-default",\r
+      "properties": {\r
+      }\r
+    }\r
+  }\r
 }
\ No newline at end of file
index 35736b6..c34c252 100644 (file)
@@ -1,17 +1,19 @@
 {\r
        "name": "action-name",\r
+       "property" :{\r
+               "description": "name of the ",\r
+               "type": "string"\r
+       },\r
        "resource-path": "action-name",\r
        "resource-type": "ONAP",\r
-       "description": "To be provided",\r
-       "valid-values": null,\r
-       "sample-value": null,\r
        "updated-by": "brindasanth@onap.com",\r
        "tags": null,\r
-       "default": null,\r
-       "data-type": "string",\r
-       "source": {\r
+       "sources": {\r
                "input": {\r
-                       "key": "action-name"\r
+                       "type": "source-input",\r
+                       "properties": {\r
+                               "key": "action-name"\r
+                       }\r
                }\r
        }\r
 }
\ No newline at end of file
index c103f94..73d835c 100644 (file)
@@ -1,36 +1,36 @@
 {\r
-  "tags": "oam-local-ipv4-address, tosca.datatypes.Root, data_type, st1848@att.com",\r
+  "tags": "oam-local-ipv4-address",\r
   "name": "oam-local-ipv4-address",\r
-  "description": "based on service-instance-id,network-role,v4-ip-type and vm-type get the ipv4-gateway-prefix from the SDN-GC mdsal",\r
-  "updated-by": "st1848@att.com",\r
+  "property" :{\r
+    "description": "based on service-instance-id,network-role,v4-ip-type and vm-type get the ipv4-gateway-prefix from the SDN-GC mdsal",\r
+    "type": "string"\r
+  },\r
+  "updated-by": "brindasanth@onap.com",\r
   "resource-type": "ATT",\r
   "resource-path": "vnf/oam-local-ipv4-address",\r
-  "data-type": "string",\r
-  "source": {\r
+  "sources": {\r
     "mdsal": {\r
-      "base": "sdnc-gc",\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
-        "service-instance-id": "service-instance-id",\r
-        "network-role": "network-role",\r
-        "v4-ip-type": "v4-ip-type",\r
-        "vm-type": "vm-type"\r
-      },\r
-      "output-key-mapping": {\r
-        "oam-local-ipv4-address": "v4-ip-prefix"\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
+          "service-instance-id": "service-instance-id",\r
+          "network-role": "network-role",\r
+          "v4-ip-type": "v4-ip-type",\r
+          "vm-type": "vm-type"\r
+        },\r
+        "output-key-mapping": {\r
+          "oam-local-ipv4-address": "v4-ip-prefix"\r
+        },\r
+        "key-dependency": [\r
+          "service-instance-id",\r
+          "network-role",\r
+          "v4-ip-type",\r
+          "vm-type"\r
+        ]\r
       }\r
     }\r
-  },\r
-  "candidate-dependency": {\r
-    "mdsal": {\r
-      "names": [\r
-        "service-instance-id",\r
-        "network-role",\r
-        "v4-ip-type",\r
-        "vm-type"\r
-      ]\r
-    }\r
   }\r
 }
\ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignment.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignment.java
deleted file mode 100644 (file)
index f85e5eb..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\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.resource.dict;\r
-\r
-import com.fasterxml.jackson.annotation.JsonFormat;\r
-import com.fasterxml.jackson.annotation.JsonProperty;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition;\r
-\r
-import java.util.Date;\r
-import java.util.List;\r
-\r
-/**\r
- * ResourceAssignment.java Purpose: Provide ResourceAssignment Custom TOSCO Model POJO bean.\r
- *\r
- * @author Brinda Santh\r
- * @version 1.0\r
- */\r
-public class ResourceAssignment {\r
-    @JsonProperty(value = "name", required = true)\r
-    private String name;\r
-\r
-    @JsonProperty(value = "property", required = true)\r
-    private PropertyDefinition property;\r
-\r
-    @JsonProperty("input-param")\r
-    private Boolean inputParameter;\r
-\r
-    @JsonProperty("dictionary-name")\r
-    private String dictionaryName;\r
-\r
-    @JsonProperty("dictionary-source")\r
-    private String dictionarySource;\r
-\r
-    @JsonProperty("dependencies")\r
-    private List<String> dependencies;\r
-\r
-    @JsonProperty("version")\r
-    private int version;\r
-\r
-    @JsonProperty("status")\r
-    private String status;\r
-\r
-    @JsonProperty("message")\r
-    private String message;\r
-\r
-    @JsonProperty("updated-date")\r
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")\r
-    private Date updatedDate;\r
-\r
-    @JsonProperty("updated-by")\r
-    private String updatedBy;\r
-\r
-    @Override\r
-    public String toString() {\r
-        StringBuilder builder = new StringBuilder("[");\r
-        builder.append("name = " + name);\r
-        builder.append(", source = " + dictionarySource);\r
-        if (dependencies != null) {\r
-            builder.append(", dependencies = " + dependencies);\r
-        }\r
-        builder.append("]");\r
-        return builder.toString();\r
-    }\r
-\r
-    public String getName() {\r
-        return name;\r
-    }\r
-\r
-    public void setName(String name) {\r
-        this.name = name;\r
-    }\r
-\r
-    public PropertyDefinition getProperty() {\r
-        return property;\r
-    }\r
-\r
-    public void setProperty(PropertyDefinition property) {\r
-        this.property = property;\r
-    }\r
-\r
-    public Boolean getInputParameter() {\r
-        return inputParameter;\r
-    }\r
-\r
-    public void setInputParameter(Boolean inputParameter) {\r
-        this.inputParameter = inputParameter;\r
-    }\r
-\r
-    public String getDictionaryName() {\r
-        return dictionaryName;\r
-    }\r
-\r
-    public void setDictionaryName(String dictionaryName) {\r
-        this.dictionaryName = dictionaryName;\r
-    }\r
-\r
-    public String getDictionarySource() {\r
-        return dictionarySource;\r
-    }\r
-\r
-    public void setDictionarySource(String dictionarySource) {\r
-        this.dictionarySource = dictionarySource;\r
-    }\r
-\r
-    public List<String> getDependencies() {\r
-        return dependencies;\r
-    }\r
-\r
-    public void setDependencies(List<String> dependencies) {\r
-        this.dependencies = dependencies;\r
-    }\r
-\r
-    public int getVersion() {\r
-        return version;\r
-    }\r
-\r
-    public void setVersion(int version) {\r
-        this.version = version;\r
-    }\r
-\r
-    public String getStatus() {\r
-        return status;\r
-    }\r
-\r
-    public void setStatus(String status) {\r
-        this.status = status;\r
-    }\r
-\r
-    public String getMessage() {\r
-        return message;\r
-    }\r
-\r
-    public void setMessage(String message) {\r
-        this.message = message;\r
-    }\r
-\r
-    public Date getUpdatedDate() {\r
-        return updatedDate;\r
-    }\r
-\r
-    public void setUpdatedDate(Date updatedDate) {\r
-        this.updatedDate = updatedDate;\r
-    }\r
-\r
-    public String getUpdatedBy() {\r
-        return updatedBy;\r
-    }\r
-\r
-    public void setUpdatedBy(String updatedBy) {\r
-        this.updatedBy = updatedBy;\r
-    }\r
-\r
-}\r
index 7c2d926..9217867 100644 (file)
@@ -1,5 +1,6 @@
 /*\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
@@ -26,6 +27,7 @@ import java.util.Map;
  * DictionaryDefinition.java Purpose:\r
  * @author Brinda Santh\r
  */\r
+@Deprecated\r
 public class DictionaryDefinition {\r
     @JsonProperty(value = "name", required = true)\r
     private String name;\r
index acb7105..6ffbca2 100644 (file)
@@ -1,5 +1,6 @@
 /*\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
@@ -22,6 +23,7 @@ import java.util.List;
  * DictionaryDependency\r
  * @author Brinda Santh\r
  */\r
+@Deprecated\r
 public class DictionaryDependency {\r
     private List<String> names;\r
 \r
index 724d022..fbeab52 100644 (file)
@@ -1,5 +1,6 @@
 /*\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
@@ -24,6 +25,7 @@ import java.util.Map;
  * SourceDb\r
  * @author Brinda Santh\r
  */\r
+@Deprecated\r
 public class SourceDb  implements ResourceSource{\r
     @JsonProperty(value = "base", required = true)\r
     private String base;\r
index d165192..e0f83bb 100644 (file)
@@ -1,5 +1,6 @@
 /*\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
@@ -20,6 +21,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict.data;
  * SourceDefault\r
  * @author Brinda Santh\r
  */\r
+@Deprecated\r
 public class SourceDefault implements ResourceSource {\r
 \r
     private String key;\r
index 86476e1..a097c56 100644 (file)
@@ -1,5 +1,6 @@
 /*\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
@@ -29,7 +30,7 @@ import org.slf4j.LoggerFactory;
 import java.io.IOException;\r
 import java.util.HashMap;\r
 import java.util.Map;\r
-\r
+@Deprecated\r
 public class SourceDeserializer extends JsonDeserializer<Map<String, ResourceSource>> {\r
 \r
     private static final Logger log = LoggerFactory.getLogger(SourceDeserializer.class);\r
index 87184f2..8ab16ec 100644 (file)
@@ -1,5 +1,6 @@
 /*\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
@@ -20,6 +21,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict.data;
  * SourceInput\r
  * @author Brinda Santh\r
  */\r
+@Deprecated\r
 public class SourceInput implements ResourceSource {\r
 \r
     private String key;\r
index 8a066e9..379f6e9 100644 (file)
@@ -1,5 +1,6 @@
 /*\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
@@ -23,7 +24,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict.data;
 import com.fasterxml.jackson.annotation.JsonProperty;\r
 \r
 import java.util.Map;\r
-\r
+@Deprecated\r
 public class SourceMdsal implements ResourceSource {\r
 \r
     @JsonProperty(value = "base", required = true)\r
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt
new file mode 100644 (file)
index 0000000..a6802f6
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ *  Copyright © 2018 IBM.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
+
+interface ResourceAssignmentProcessor {
+
+    @Throws(BluePrintProcessorException::class)
+    fun validate(resourceAssignment: ResourceAssignment, context : MutableMap<String, Any>)
+
+    @Throws(BluePrintProcessorException::class)
+    fun process(resourceAssignment: ResourceAssignment, context : MutableMap<String, Any>)
+
+    @Throws(BluePrintProcessorException::class)
+    fun errorHandle(resourceAssignment: ResourceAssignment, context : MutableMap<String, Any>)
+
+    @Throws(BluePrintProcessorException::class)
+    fun reTrigger(resourceAssignment: ResourceAssignment, context : MutableMap<String, Any>)
+}
\ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt
new file mode 100644 (file)
index 0000000..c2c8094
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ *  Copyright © 2018 IBM.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict
+
+import com.fasterxml.jackson.annotation.JsonFormat
+import com.fasterxml.jackson.annotation.JsonProperty
+import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.DecryptionRule
+import java.io.Serializable
+import java.util.*
+
+open class ResourceDefinition{
+
+    @JsonProperty(value = "name", required = true)
+    lateinit var name: String
+
+    @JsonProperty(value = "property", required = true)
+    lateinit var property : PropertyDefinition
+
+    var tags: String? = null
+
+    @JsonProperty(value = "updated-by")
+    lateinit var updatedBy: String
+
+    @JsonProperty(value = "resource-type", required = true)
+    lateinit var resourceType: String
+
+    @JsonProperty(value = "resource-path", required = true)
+    lateinit var resourcePath: String
+
+    @JsonProperty(value = "sources", required = true)
+    var sources: MutableMap<String, NodeTemplate>? = null
+
+    @JsonProperty("decryption-rules")
+    var decryptionRules: MutableList<DecryptionRule>? = null
+
+}
+
+open class ResourceAssignment {
+
+    @JsonProperty(value = "name", required = true)
+    lateinit var name: String
+
+    @JsonProperty(value = "property")
+    var property: PropertyDefinition? = null
+
+    @JsonProperty("input-param")
+    var inputParameter: Boolean = false
+
+    @JsonProperty("dictionary-name")
+    var dictionaryName: String? = null
+
+    @JsonProperty("dictionary-source")
+    var dictionarySource: String? = null
+
+    @JsonProperty("dependencies")
+    var dependencies: MutableList<String>? = null
+
+    @JsonProperty("version")
+    var version: Int = 0
+
+    @JsonProperty("status")
+    var status: String? = null
+
+    @JsonProperty("message")
+    var message: String? = null
+
+    @JsonProperty("updated-date")
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
+    var updatedDate: Date? = null
+
+    @JsonProperty("updated-by")
+    var updatedBy: String? = null
+}
+
+/**
+ * Interface for Source Definitions (ex Input Source,
+ * Default Source, Database Source, Rest Sources, etc)
+ */
+interface ResourceSource : Serializable
@@ -1,5 +1,6 @@
 /*\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
 package org.onap.ccsdk.apps.controllerblueprints.resource.dict.util;\r
 \r
 import org.junit.Assert;\r
-import org.junit.Before;\r
 import org.junit.Test;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants;\r
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.*;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;\r
 import org.slf4j.Logger;\r
 import org.slf4j.LoggerFactory;\r
 \r
-public class DictionaryDefinitionTest {\r
-    private Logger log = LoggerFactory.getLogger(DictionaryDefinitionTest.class);\r
+public class ResourceDefinitionTest {\r
+    private Logger log = LoggerFactory.getLogger(ResourceDefinitionTest.class);\r
     String basePath = "load/resource_dictionary";\r
 \r
-    @Before\r
-    public void setup(){\r
-        SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_DB, SourceDb.class);\r
-        SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_INPUT, SourceInput.class);\r
-        SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_MDSAL, SourceMdsal.class);\r
-        SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_DEFAULT,SourceDefault.class);\r
-    }\r
-\r
     @Test\r
     public void testDictionaryDefinitionInputSource(){\r
 \r
         String fileName = basePath + "/input-source.json";\r
-        DictionaryDefinition dictionaryDefinition = JacksonUtils.readValueFromFile(fileName, DictionaryDefinition.class);\r
-        Assert.assertNotNull("Failed to populate dictionaryDefinition for input type", dictionaryDefinition);\r
+        ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);\r
+        Assert.assertNotNull("Failed to populate dictionaryDefinition for input type", resourceDefinition);\r
     }\r
 \r
     @Test\r
     public void testDictionaryDefinitionDefaultSource(){\r
 \r
         String fileName = basePath + "/default-source.json";\r
-        DictionaryDefinition dictionaryDefinition = JacksonUtils.readValueFromFile(fileName, DictionaryDefinition.class);\r
-        Assert.assertNotNull("Failed to populate dictionaryDefinition for default type", dictionaryDefinition);\r
+        ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);\r
+        Assert.assertNotNull("Failed to populate dictionaryDefinition for default type", resourceDefinition);\r
     }\r
 \r
     @Test\r
     public void testDictionaryDefinitionDBSource(){\r
 \r
         String fileName = basePath + "/db-source.json";\r
-        DictionaryDefinition dictionaryDefinition = JacksonUtils.readValueFromFile(fileName, DictionaryDefinition.class);\r
-        Assert.assertNotNull("Failed to populate dictionaryDefinition for db type", dictionaryDefinition);\r
+        ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);\r
+        Assert.assertNotNull("Failed to populate dictionaryDefinition for db type", resourceDefinition);\r
     }\r
 \r
     @Test\r
     public void testDictionaryDefinitionMDSALSource(){\r
         String fileName = basePath + "/mdsal-source.json";\r
-        DictionaryDefinition dictionaryDefinition = JacksonUtils.readValueFromFile(fileName, DictionaryDefinition.class);\r
-        Assert.assertNotNull("Failed to populate dictionaryDefinition for mdsal type", dictionaryDefinition);\r
+        ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);\r
+        Assert.assertNotNull("Failed to populate dictionaryDefinition for mdsal type", resourceDefinition);\r
     }\r
 }\r
index 0c9a1c5..b6ac103 100644 (file)
@@ -1,5 +1,6 @@
 /*\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
@@ -20,6 +21,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict.util;
 import org.junit.Assert;\r
 import org.junit.Test;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;\r
+import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition;\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants;\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.*;\r
@@ -37,9 +39,11 @@ public class ResourceDictionaryUtilsTest {
     @Test\r
     public void validateSingleInputSource() {\r
         try {\r
-            log.info(" **************** Validating validateSingleSource *****************");\r
             ResourceAssignment resourceAssignment = new ResourceAssignment();\r
             resourceAssignment.setName("test-input-key");\r
+            PropertyDefinition propertyDefinition = new PropertyDefinition();\r
+            propertyDefinition.setType("string");\r
+            resourceAssignment.setProperty(propertyDefinition);\r
             DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();\r
             dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);\r
 \r
@@ -64,9 +68,12 @@ public class ResourceDictionaryUtilsTest {
     @Test\r
     public void validateSingleDbSource() {\r
         try {\r
-            log.info(" **************** Validating validateSingleSource *****************");\r
             ResourceAssignment resourceAssignment = new ResourceAssignment();\r
             resourceAssignment.setName("test-db-key");\r
+            PropertyDefinition propertyDefinition = new PropertyDefinition();\r
+            propertyDefinition.setType("string");\r
+            resourceAssignment.setProperty(propertyDefinition);\r
+\r
             DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();\r
             dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);\r
 \r
@@ -110,6 +117,9 @@ public class ResourceDictionaryUtilsTest {
     public void testSourceDefault() {\r
         ResourceAssignment resourceAssignment = new ResourceAssignment();\r
         resourceAssignment.setName("test-input-key");\r
+        PropertyDefinition propertyDefinition = new PropertyDefinition();\r
+        propertyDefinition.setType("string");\r
+        resourceAssignment.setProperty(propertyDefinition);\r
 \r
         DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();\r
         dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);\r
@@ -139,6 +149,10 @@ public class ResourceDictionaryUtilsTest {
     public void testSourceMdsal() {\r
         ResourceAssignment resourceAssignment = new ResourceAssignment();\r
         resourceAssignment.setName("test-input-key");\r
+        PropertyDefinition propertyDefinition = new PropertyDefinition();\r
+        propertyDefinition.setType("string");\r
+        resourceAssignment.setProperty(propertyDefinition);\r
+\r
         DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();\r
         dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);\r
 \r