From 5eebfaa6ac0d4cb4fdf20d19ead7cd0303fc6f29 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Thu, 13 Sep 2018 00:20:34 +0000 Subject: Controller Blueprints Microservice Add resource assignment enhancement and validation to blueprint validation and enhancement. Change-Id: I547760012e7014cfbb7a1e3a1d8ffb77edc9b6a2 Issue-ID: CCSDK-562 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../src/test/resources/application.properties | 4 +- .../enhance/enhance-resource-assignment.json | 62 ++++ .../test/resources/enhance/enhance-template.json | 10 +- .../test/resources/enhance/enhanced-template.json | 312 ++++++++++++++------- .../src/test/resources/enhance/simple-enrich.json | 37 --- .../modules/service/src/test/resources/logback.xml | 5 +- .../test/resources/resourcedictionary/automap.json | 9 +- 7 files changed, 291 insertions(+), 148 deletions(-) create mode 100644 ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json delete mode 100644 ms/controllerblueprints/modules/service/src/test/resources/enhance/simple-enrich.json (limited to 'ms/controllerblueprints/modules/service/src/test/resources') diff --git a/ms/controllerblueprints/modules/service/src/test/resources/application.properties b/ms/controllerblueprints/modules/service/src/test/resources/application.properties index 3a913b70..397f3b13 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/application.properties +++ b/ms/controllerblueprints/modules/service/src/test/resources/application.properties @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # - +spring.main.banner-mode=off spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS = false @@ -23,7 +23,7 @@ logging.level.org.hibernate.SQL=warn logging.level.org.hibernate.type.descriptor.sql=debug -blueprints.load.initial-data=true +blueprints.load.initial-data=false load.dataTypePath=./../../application/load/model_type/data_type load.nodeTypePath=./../../application/load/model_type/node_type load.artifactTypePath=./../../application/load/model_type/artifact_type diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json new file mode 100644 index 00000000..3715beca --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json @@ -0,0 +1,62 @@ +[ + { + "name": "rs-db-source", + "input-param": true, + "property": { + "type": "string", + "required": true + }, + "dictionary-name": "sample-db-source", + "dictionary-source": "db", + "dependencies": [ + "input-source" + ] + }, + { + "name": "ra-default-source", + "input-param": true, + "property": { + "type": "string", + "required": true + }, + "dictionary-name": "sample-default-source", + "dictionary-source": "default", + "dependencies": [] + }, + { + "name": "ra-input-source", + "input-param": true, + "property": { + "type": "string", + "required": true + }, + "dictionary-name": "sample-input-source", + "dictionary-source": "input", + "dependencies": [] + }, + { + "name": "ra-list-input-source", + "input-param": true, + "property": { + "type": "list", + "required": true, + "entry_schema": { + "type": "string" + } + }, + "dictionary-name": "ra-list-input-source", + "dictionary-source": "input", + "dependencies": [] + }, + { + "name": "ra-complex-input-source", + "input-param": true, + "property": { + "type": "dt-v4-aggregate", + "required": true + }, + "dictionary-name": "sample-mdsal-source", + "dictionary-source": "mdsal", + "dependencies": [] + } +] diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json index 70d03e0a..782ed505 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json +++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json @@ -218,13 +218,13 @@ "properties": { "mapping": [ { - "name": "bundle-mac", + "name": "rs-db-source", "property": { "required": true, "type": "string" }, "input-param": false, - "dictionary-name": "bundle-mac", + "dictionary-name": "sample-db-source", "dictionary-source": "db", "dependencies": [ "hostname" @@ -232,7 +232,7 @@ "version": 0 }, { - "name": "wan-aggregate-ipv4-addresses", + "name": "mdsal-source", "property": { "description": "", "required": true, @@ -242,7 +242,7 @@ } }, "input-param": false, - "dictionary-name": "wan-aggregate-ipv4-addresses", + "dictionary-name": "sample-mdsal-source", "dictionary-source": "mdsal", "dependencies": [ "service-instance-id" @@ -313,7 +313,7 @@ } }, "input-param": false, - "dictionary-name": "licenses", + "dictionary-name": "sample-licenses", "dictionary-source": "mdsal", "dependencies": [ "service-instance-id" diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json index bf3deffb..531d756b 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json +++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json @@ -114,10 +114,6 @@ "description" : "This is Dynamic Data type definition generated from resource mapping for the config template name base-config-template.", "version" : "1.0.0", "properties" : { - "bundle-mac" : { - "required" : true, - "type" : "string" - }, "hostname" : { "required" : true, "type" : "string" @@ -129,13 +125,9 @@ "type" : "dt-license-key" } }, - "wan-aggregate-ipv4-addresses" : { - "description" : "", + "rs-db-source" : { "required" : true, - "type" : "list", - "entry_schema" : { - "type" : "dt-v4-aggregate" - } + "type" : "string" }, "service" : { "required" : true, @@ -144,6 +136,14 @@ "service-instance-id" : { "required" : true, "type" : "string" + }, + "mdsal-source" : { + "description" : "", + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "dt-v4-aggregate" + } } }, "derived_from" : "tosca.datatypes.Dynamic" @@ -206,6 +206,127 @@ "version" : "1.0.0", "derived_from" : "tosca.nodes.Root" }, + "artifact-config-template" : { + "description" : "This is Configuration Velocity Template", + "version" : "1.0.0", + "properties" : { + "action-names" : { + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "capabilities" : { + "content" : { + "type" : "tosca.capabilities.Content", + "properties" : { + "content" : { + "required" : true, + "type" : "string" + } + } + }, + "mapping" : { + "type" : "tosca.capabilities.Mapping", + "properties" : { + "mapping" : { + "required" : false, + "type" : "list", + "entry_schema" : { + "type" : "datatype-resource-assignment" + } + } + } + } + }, + "derived_from" : "tosca.nodes.Artifact" + }, + "tosca.nodes.Vnf" : { + "description" : "This is VNF Node Type", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, + "tosca.nodes.Artifact" : { + "description" : "This is Deprecated Artifact Node Type.", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, + "dg-activate-netconf" : { + "description" : "This is Download Netconf Directed Graph", + "version" : "1.0.0", + "properties" : { + "mode" : { + "required" : false, + "type" : "string", + "default" : "sync" + }, + "version" : { + "required" : false, + "type" : "string", + "default" : "LATEST" + }, + "is-start-flow" : { + "required" : false, + "type" : "boolean", + "default" : false + } + }, + "capabilities" : { + "dg-node" : { + "type" : "tosca.capabilities.Node" + } + }, + "requirements" : { + "component-dependency" : { + "capability" : "component-node", + "node" : "component-netconf-executor", + "relationship" : "tosca.relationships.DependsOn" + } + }, + "interfaces" : { + "CONFIG" : { + "operations" : { + "ActivateNetconf" : { + "inputs" : { + "params" : { + "required" : false, + "type" : "list", + "entry_schema" : { + "type" : "datatype-property" + } + } + } + } + } + } + }, + "derived_from" : "tosca.nodes.DG" + }, + "source-input" : { + "description" : "This is Input Resource Source Node Type", + "version" : "1.0.0", + "properties" : { + "key" : { + "required" : false, + "type" : "string" + }, + "key-dependencies" : { + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "derived_from" : "tosca.nodes.ResourceSource" + }, + "tosca.nodes.ResourceSource" : { + "description" : "TOSCA base type for Resource Sources", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, "component-resource-assignment" : { "description" : "This is Resource Assignment Component API", "version" : "1.0.0", @@ -279,42 +400,44 @@ "version" : "1.0.0", "derived_from" : "tosca.nodes.Root" }, - "artifact-config-template" : { - "description" : "This is Configuration Velocity Template", + "source-db" : { + "description" : "This is Database Resource Source Node Type", "version" : "1.0.0", "properties" : { - "action-names" : { + "type" : { "required" : true, - "type" : "list", + "type" : "string", + "constraints" : [ { + "valid_values" : [ "SQL", "PLSQL" ] + } ] + }, + "query" : { + "required" : true, + "type" : "string" + }, + "input-key-mapping" : { + "required" : false, + "type" : "map", "entry_schema" : { "type" : "string" } - } - }, - "capabilities" : { - "content" : { - "type" : "tosca.capabilities.Content", - "properties" : { - "content" : { - "required" : true, - "type" : "string" - } + }, + "output-key-mapping" : { + "required" : false, + "type" : "map", + "entry_schema" : { + "type" : "string" } }, - "mapping" : { - "type" : "tosca.capabilities.Mapping", - "properties" : { - "mapping" : { - "required" : false, - "type" : "list", - "entry_schema" : { - "type" : "datatype-resource-assignment" - } - } + "key-dependencies" : { + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" } } }, - "derived_from" : "tosca.nodes.Artifact" + "derived_from" : "tosca.nodes.ResourceSource" }, "vnf-netconf-device" : { "description" : "This is VNF Device with Netconf Capability", @@ -357,10 +480,57 @@ }, "derived_from" : "tosca.nodes.Vnf" }, - "tosca.nodes.Vnf" : { - "description" : "This is VNF Node Type", + "source-rest" : { + "description" : "This is Rest Resource Source Node Type", "version" : "1.0.0", - "derived_from" : "tosca.nodes.Root" + "properties" : { + "type" : { + "required" : false, + "type" : "string", + "constraints" : [ { + "valid_values" : [ "JSON" ] + } ], + "default" : "JSON" + }, + "url-path" : { + "required" : true, + "type" : "string" + }, + "path" : { + "required" : true, + "type" : "string" + }, + "expression-type" : { + "required" : false, + "type" : "string", + "constraints" : [ { + "valid_values" : [ "JSON_PATH", "JSON_POINTER" ] + } ], + "default" : "JSON_PATH" + }, + "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" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "derived_from" : "tosca.nodes.ResourceSource" }, "component-netconf-executor" : { "description" : "This is Netconf Transaction Configuration Component API", @@ -440,62 +610,6 @@ } }, "derived_from" : "tosca.nodes.Component" - }, - "tosca.nodes.Artifact" : { - "description" : "This is Deprecated Artifact Node Type.", - "version" : "1.0.0", - "derived_from" : "tosca.nodes.Root" - }, - "dg-activate-netconf" : { - "description" : "This is Download Netconf Directed Graph", - "version" : "1.0.0", - "properties" : { - "mode" : { - "required" : false, - "type" : "string", - "default" : "sync" - }, - "version" : { - "required" : false, - "type" : "string", - "default" : "LATEST" - }, - "is-start-flow" : { - "required" : false, - "type" : "boolean", - "default" : false - } - }, - "capabilities" : { - "dg-node" : { - "type" : "tosca.capabilities.Node" - } - }, - "requirements" : { - "component-dependency" : { - "capability" : "component-node", - "node" : "component-netconf-executor", - "relationship" : "tosca.relationships.DependsOn" - } - }, - "interfaces" : { - "CONFIG" : { - "operations" : { - "ActivateNetconf" : { - "inputs" : { - "params" : { - "required" : false, - "type" : "list", - "entry_schema" : { - "type" : "datatype-property" - } - } - } - } - } - } - }, - "derived_from" : "tosca.nodes.DG" } }, "topology_template" : { @@ -704,18 +818,18 @@ "mapping" : { "properties" : { "mapping" : [ { - "name" : "bundle-mac", + "name" : "rs-db-source", "property" : { "required" : true, "type" : "string" }, "input-param" : false, - "dictionary-name" : "bundle-mac", + "dictionary-name" : "sample-db-source", "dictionary-source" : "db", "dependencies" : [ "hostname" ], "version" : 0 }, { - "name" : "wan-aggregate-ipv4-addresses", + "name" : "mdsal-source", "property" : { "description" : "", "required" : true, @@ -725,7 +839,7 @@ } }, "input-param" : false, - "dictionary-name" : "wan-aggregate-ipv4-addresses", + "dictionary-name" : "sample-mdsal-source", "dictionary-source" : "mdsal", "dependencies" : [ "service-instance-id" ], "version" : 0 @@ -787,7 +901,7 @@ } }, "input-param" : false, - "dictionary-name" : "licenses", + "dictionary-name" : "sample-licenses", "dictionary-source" : "mdsal", "dependencies" : [ "service-instance-id" ], "version" : 0 diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/simple-enrich.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/simple-enrich.json deleted file mode 100644 index 641da80a..00000000 --- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/simple-enrich.json +++ /dev/null @@ -1,37 +0,0 @@ -[ - { - "name": "rs-db-source", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "db-source", - "dictionary-source": "db", - "dependencies": [ - "input-source" - ] - }, - { - "name": "ra-default-source", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "default-source", - "dictionary-source": "default", - "dependencies": [] - }, - { - "name": "ra-input-source", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "input-source", - "dictionary-source": "input", - "dependencies": [] - } -] diff --git a/ms/controllerblueprints/modules/service/src/test/resources/logback.xml b/ms/controllerblueprints/modules/service/src/test/resources/logback.xml index 4a04cfdc..7b7ef756 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/logback.xml +++ b/ms/controllerblueprints/modules/service/src/test/resources/logback.xml @@ -1,5 +1,6 @@