summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintProcessorException.kt (renamed from ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/OrchestratorException.kt)3
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt5
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-component-java.json31
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-db.json44
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-default.json18
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-input.json18
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-rest.json62
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/tosca.nodes.ResourceSource.json5
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/db-source.json25
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/default-source.json28
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/input-source.json16
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json54
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignment.java167
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.java2
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDependency.java2
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.java2
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.java2
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDeserializer.java3
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.java2
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.java3
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt34
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt95
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDefinitionTest.java (renamed from ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/DictionaryDefinitionTest.java)33
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDictionaryUtilsTest.java18
24 files changed, 421 insertions, 251 deletions
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/OrchestratorException.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintProcessorException.kt
index 68abad154..50717031d 100644
--- a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/OrchestratorException.kt
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintProcessorException.kt
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications 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.
@@ -20,7 +21,7 @@ package org.onap.ccsdk.apps.controllerblueprints.core
*
* @author Brinda Santh
*/
-class OrchestratorException : Exception {
+class BluePrintProcessorException : Exception {
var code: Int = 100
constructor(message: String, cause: Throwable) : super(message, cause)
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
index 213f5f401..08152313b 100644
--- a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications 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.
@@ -20,7 +21,7 @@ package org.onap.ccsdk.apps.controllerblueprints.core.service
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.NullNode
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.OrchestratorException
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactDefinition
import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition
@@ -154,7 +155,7 @@ class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var contex
val nodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
val artifactDefinition: ArtifactDefinition = nodeTemplate.artifacts?.get(artifactName)
- ?: throw OrchestratorException(String.format("failed to get artifat definition {} from the node template"
+ ?: throw BluePrintProcessorException(String.format("failed to get artifat definition {} from the node template"
, artifactName))
val propertyAssignmentExpression = PropertyAssignmentService( context, this)
return propertyAssignmentExpression.artifactContent(artifactDefinition)
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
index 000000000..95a9801dc
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-component-java.json
@@ -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
index 000000000..7ebeaa82c
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-db.json
@@ -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
index 000000000..dd0bffcc1
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-default.json
@@ -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
index 000000000..99c4691c4
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-input.json
@@ -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
index 000000000..e77020ec9
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/source-rest.json
@@ -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
index 000000000..2ef553e24
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/load/model_type/node_type/tosca.nodes.ResourceSource.json
@@ -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
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/db-source.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/db-source.json
index 8b97cdeb7..cd4e282b4 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/db-source.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/db-source.json
@@ -1,20 +1,25 @@
{
"name": "bundle-id",
- "description": "name of the ",
+ "property" :{
+ "description": "name of the ",
+ "type": "string"
+ },
"resource-type": "ONAP",
"resource-path": "vnf/bundle-id",
"updated-by": "brindasanth@onap.com",
- "data-type": "String",
"tags": "bundle-id, brindasanth@onap.com",
- "source": {
+ "sources": {
"db": {
- "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "db-country": "country",
- "db-state": "state"
+ "type": "source-db",
+ "properties": {
+ "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
+ "input-key-mapping": {
+ "profile_name": "profile_name"
+ },
+ "output-key-mapping": {
+ "db-country": "country",
+ "db-state": "state"
+ }
}
}
},
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/default-source.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/default-source.json
index ac23292ed..91921b640 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/default-source.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/default-source.json
@@ -1,14 +1,18 @@
{
- "tags": "v4-ip-type, tosca.datatypes.Root, data_type, brindasanth@onap.com",
- "name": "v4-ip-type",
- "description": "To be provided",
- "updated-by": "brindasanth@onap.com",
- "resource-type": "ONAP",
- "resource-path": "vnf/v4-ip-type",
- "data-type": "string",
- "source": {
- "default": {
-
- }
- }
+ "tags": "v4-ip-type, tosca.datatypes.Root, data_type, brindasanth@onap.com",
+ "name": "v4-ip-type",
+ "property" :{
+ "description": "name of the ",
+ "type": "string"
+ },
+ "updated-by": "brindasanth@onap.com",
+ "resource-type": "ONAP",
+ "resource-path": "vnf/v4-ip-type",
+ "sources": {
+ "default": {
+ "type": "source-default",
+ "properties": {
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/input-source.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/input-source.json
index 35736b663..c34c252b3 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/input-source.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/input-source.json
@@ -1,17 +1,19 @@
{
"name": "action-name",
+ "property" :{
+ "description": "name of the ",
+ "type": "string"
+ },
"resource-path": "action-name",
"resource-type": "ONAP",
- "description": "To be provided",
- "valid-values": null,
- "sample-value": null,
"updated-by": "brindasanth@onap.com",
"tags": null,
- "default": null,
- "data-type": "string",
- "source": {
+ "sources": {
"input": {
- "key": "action-name"
+ "type": "source-input",
+ "properties": {
+ "key": "action-name"
+ }
}
}
} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json
index c103f94dc..73d835c10 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json
@@ -1,36 +1,36 @@
{
- "tags": "oam-local-ipv4-address, tosca.datatypes.Root, data_type, st1848@att.com",
+ "tags": "oam-local-ipv4-address",
"name": "oam-local-ipv4-address",
- "description": "based on service-instance-id,network-role,v4-ip-type and vm-type get the ipv4-gateway-prefix from the SDN-GC mdsal",
- "updated-by": "st1848@att.com",
+ "property" :{
+ "description": "based on service-instance-id,network-role,v4-ip-type and vm-type get the ipv4-gateway-prefix from the SDN-GC mdsal",
+ "type": "string"
+ },
+ "updated-by": "brindasanth@onap.com",
"resource-type": "ATT",
"resource-path": "vnf/oam-local-ipv4-address",
- "data-type": "string",
- "source": {
+ "sources": {
"mdsal": {
- "base": "sdnc-gc",
- "type": "JSON",
- "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",
- "path": "/v4-assigned-ip-list/0/v4-ip-prefix",
- "input-key-mapping": {
- "service-instance-id": "service-instance-id",
- "network-role": "network-role",
- "v4-ip-type": "v4-ip-type",
- "vm-type": "vm-type"
- },
- "output-key-mapping": {
- "oam-local-ipv4-address": "v4-ip-prefix"
+ "type": "source-rest",
+ "properties": {
+ "type": "JSON",
+ "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",
+ "path": "/v4-assigned-ip-list/0/v4-ip-prefix",
+ "input-key-mapping": {
+ "service-instance-id": "service-instance-id",
+ "network-role": "network-role",
+ "v4-ip-type": "v4-ip-type",
+ "vm-type": "vm-type"
+ },
+ "output-key-mapping": {
+ "oam-local-ipv4-address": "v4-ip-prefix"
+ },
+ "key-dependency": [
+ "service-instance-id",
+ "network-role",
+ "v4-ip-type",
+ "vm-type"
+ ]
}
}
- },
- "candidate-dependency": {
- "mdsal": {
- "names": [
- "service-instance-id",
- "network-role",
- "v4-ip-type",
- "vm-type"
- ]
- }
}
} \ 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
index f85e5ebcd..000000000
--- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignment.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.resource.dict;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * ResourceAssignment.java Purpose: Provide ResourceAssignment Custom TOSCO Model POJO bean.
- *
- * @author Brinda Santh
- * @version 1.0
- */
-public class ResourceAssignment {
- @JsonProperty(value = "name", required = true)
- private String name;
-
- @JsonProperty(value = "property", required = true)
- private PropertyDefinition property;
-
- @JsonProperty("input-param")
- private Boolean inputParameter;
-
- @JsonProperty("dictionary-name")
- private String dictionaryName;
-
- @JsonProperty("dictionary-source")
- private String dictionarySource;
-
- @JsonProperty("dependencies")
- private List<String> dependencies;
-
- @JsonProperty("version")
- private int version;
-
- @JsonProperty("status")
- private String status;
-
- @JsonProperty("message")
- private String message;
-
- @JsonProperty("updated-date")
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- private Date updatedDate;
-
- @JsonProperty("updated-by")
- private String updatedBy;
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder("[");
- builder.append("name = " + name);
- builder.append(", source = " + dictionarySource);
- if (dependencies != null) {
- builder.append(", dependencies = " + dependencies);
- }
- builder.append("]");
- return builder.toString();
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public PropertyDefinition getProperty() {
- return property;
- }
-
- public void setProperty(PropertyDefinition property) {
- this.property = property;
- }
-
- public Boolean getInputParameter() {
- return inputParameter;
- }
-
- public void setInputParameter(Boolean inputParameter) {
- this.inputParameter = inputParameter;
- }
-
- public String getDictionaryName() {
- return dictionaryName;
- }
-
- public void setDictionaryName(String dictionaryName) {
- this.dictionaryName = dictionaryName;
- }
-
- public String getDictionarySource() {
- return dictionarySource;
- }
-
- public void setDictionarySource(String dictionarySource) {
- this.dictionarySource = dictionarySource;
- }
-
- public List<String> getDependencies() {
- return dependencies;
- }
-
- public void setDependencies(List<String> dependencies) {
- this.dependencies = dependencies;
- }
-
- public int getVersion() {
- return version;
- }
-
- public void setVersion(int version) {
- this.version = version;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public Date getUpdatedDate() {
- return updatedDate;
- }
-
- public void setUpdatedDate(Date updatedDate) {
- this.updatedDate = updatedDate;
- }
-
- public String getUpdatedBy() {
- return updatedBy;
- }
-
- public void setUpdatedBy(String updatedBy) {
- this.updatedBy = updatedBy;
- }
-
-}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.java
index 7c2d926f0..92178673e 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.java
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications 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.
@@ -26,6 +27,7 @@ import java.util.Map;
* DictionaryDefinition.java Purpose:
* @author Brinda Santh
*/
+@Deprecated
public class DictionaryDefinition {
@JsonProperty(value = "name", required = true)
private String name;
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDependency.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDependency.java
index acb710584..6ffbca264 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDependency.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDependency.java
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications 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.
@@ -22,6 +23,7 @@ import java.util.List;
* DictionaryDependency
* @author Brinda Santh
*/
+@Deprecated
public class DictionaryDependency {
private List<String> names;
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.java
index 724d0224e..fbeab52f0 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.java
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications 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.
@@ -24,6 +25,7 @@ import java.util.Map;
* SourceDb
* @author Brinda Santh
*/
+@Deprecated
public class SourceDb implements ResourceSource{
@JsonProperty(value = "base", required = true)
private String base;
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.java
index d165192e9..e0f83bb89 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.java
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications 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.
@@ -20,6 +21,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict.data;
* SourceDefault
* @author Brinda Santh
*/
+@Deprecated
public class SourceDefault implements ResourceSource {
private String key;
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDeserializer.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDeserializer.java
index 86476e1c2..a097c56d9 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDeserializer.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDeserializer.java
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications 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.
@@ -29,7 +30,7 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-
+@Deprecated
public class SourceDeserializer extends JsonDeserializer<Map<String, ResourceSource>> {
private static final Logger log = LoggerFactory.getLogger(SourceDeserializer.class);
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.java
index 87184f223..8ab16ecbc 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.java
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications 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.
@@ -20,6 +21,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict.data;
* SourceInput
* @author Brinda Santh
*/
+@Deprecated
public class SourceInput implements ResourceSource {
private String key;
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.java
index 8a066e91a..379f6e915 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.java
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications 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.
@@ -23,7 +24,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict.data;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;
-
+@Deprecated
public class SourceMdsal implements ResourceSource {
@JsonProperty(value = "base", required = true)
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
index 000000000..a6802f677
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt
@@ -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
index 000000000..c2c8094b9
--- /dev/null
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt
@@ -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
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/DictionaryDefinitionTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDefinitionTest.java
index 851ba1256..c71843804 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/DictionaryDefinitionTest.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDefinitionTest.java
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications 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.
@@ -17,54 +18,44 @@
package org.onap.ccsdk.apps.controllerblueprints.resource.dict.util;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.Test;
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.*;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class DictionaryDefinitionTest {
- private Logger log = LoggerFactory.getLogger(DictionaryDefinitionTest.class);
+public class ResourceDefinitionTest {
+ private Logger log = LoggerFactory.getLogger(ResourceDefinitionTest.class);
String basePath = "load/resource_dictionary";
- @Before
- public void setup(){
- SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_DB, SourceDb.class);
- SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_INPUT, SourceInput.class);
- SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_MDSAL, SourceMdsal.class);
- SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_DEFAULT,SourceDefault.class);
- }
-
@Test
public void testDictionaryDefinitionInputSource(){
String fileName = basePath + "/input-source.json";
- DictionaryDefinition dictionaryDefinition = JacksonUtils.readValueFromFile(fileName, DictionaryDefinition.class);
- Assert.assertNotNull("Failed to populate dictionaryDefinition for input type", dictionaryDefinition);
+ ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);
+ Assert.assertNotNull("Failed to populate dictionaryDefinition for input type", resourceDefinition);
}
@Test
public void testDictionaryDefinitionDefaultSource(){
String fileName = basePath + "/default-source.json";
- DictionaryDefinition dictionaryDefinition = JacksonUtils.readValueFromFile(fileName, DictionaryDefinition.class);
- Assert.assertNotNull("Failed to populate dictionaryDefinition for default type", dictionaryDefinition);
+ ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);
+ Assert.assertNotNull("Failed to populate dictionaryDefinition for default type", resourceDefinition);
}
@Test
public void testDictionaryDefinitionDBSource(){
String fileName = basePath + "/db-source.json";
- DictionaryDefinition dictionaryDefinition = JacksonUtils.readValueFromFile(fileName, DictionaryDefinition.class);
- Assert.assertNotNull("Failed to populate dictionaryDefinition for db type", dictionaryDefinition);
+ ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);
+ Assert.assertNotNull("Failed to populate dictionaryDefinition for db type", resourceDefinition);
}
@Test
public void testDictionaryDefinitionMDSALSource(){
String fileName = basePath + "/mdsal-source.json";
- DictionaryDefinition dictionaryDefinition = JacksonUtils.readValueFromFile(fileName, DictionaryDefinition.class);
- Assert.assertNotNull("Failed to populate dictionaryDefinition for mdsal type", dictionaryDefinition);
+ ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile(fileName, ResourceDefinition.class);
+ Assert.assertNotNull("Failed to populate dictionaryDefinition for mdsal type", resourceDefinition);
}
}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDictionaryUtilsTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDictionaryUtilsTest.java
index 0c9a1c5d8..b6ac103ee 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDictionaryUtilsTest.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDictionaryUtilsTest.java
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications 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.
@@ -20,6 +21,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict.util;
import org.junit.Assert;
import org.junit.Test;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.*;
@@ -37,9 +39,11 @@ public class ResourceDictionaryUtilsTest {
@Test
public void validateSingleInputSource() {
try {
- log.info(" **************** Validating validateSingleSource *****************");
ResourceAssignment resourceAssignment = new ResourceAssignment();
resourceAssignment.setName("test-input-key");
+ PropertyDefinition propertyDefinition = new PropertyDefinition();
+ propertyDefinition.setType("string");
+ resourceAssignment.setProperty(propertyDefinition);
DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();
dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);
@@ -64,9 +68,12 @@ public class ResourceDictionaryUtilsTest {
@Test
public void validateSingleDbSource() {
try {
- log.info(" **************** Validating validateSingleSource *****************");
ResourceAssignment resourceAssignment = new ResourceAssignment();
resourceAssignment.setName("test-db-key");
+ PropertyDefinition propertyDefinition = new PropertyDefinition();
+ propertyDefinition.setType("string");
+ resourceAssignment.setProperty(propertyDefinition);
+
DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();
dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);
@@ -110,6 +117,9 @@ public class ResourceDictionaryUtilsTest {
public void testSourceDefault() {
ResourceAssignment resourceAssignment = new ResourceAssignment();
resourceAssignment.setName("test-input-key");
+ PropertyDefinition propertyDefinition = new PropertyDefinition();
+ propertyDefinition.setType("string");
+ resourceAssignment.setProperty(propertyDefinition);
DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();
dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);
@@ -139,6 +149,10 @@ public class ResourceDictionaryUtilsTest {
public void testSourceMdsal() {
ResourceAssignment resourceAssignment = new ResourceAssignment();
resourceAssignment.setName("test-input-key");
+ PropertyDefinition propertyDefinition = new PropertyDefinition();
+ propertyDefinition.setType("string");
+ resourceAssignment.setProperty(propertyDefinition);
+
DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();
dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);