From 44bff49a6a45f2c4d31020501cb1c0b2eeb1b0fd Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Thu, 6 Sep 2018 20:18:24 +0000 Subject: Controller Blueprints Microservice Add Blueprint Dervied from NodeType, Requirement Definitions and Assignments validations. Change-Id: I1cc643b5a83c5a707c8e3ae1342a439f122da55e Issue-ID: CCSDK-484 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../Definitions/activation-blueprint.json | 7 +- .../model_type/node_type/tosca.nodes.Artifact.json | 5 + .../Definitions/activation-blueprint.json | 411 --------------------- .../Mappings/baseconfig-mapping.json | 3 - .../baseconfiguration/Plans/ActivateProcess.bpmn | 66 ---- .../Scripts/SamplePythonComponentNode.py | 8 - .../baseconfiguration/Scripts/__init__.py | 0 .../baseconfiguration/TOSCA-Metadata/TOSCA.meta | 8 - .../Templates/baseconfig-template.vtl | 1 - .../load/blueprints/baseconfiguration/__init__.py | 0 .../blueprints/vrr-test/Definitions/vrr-test.json | 20 + .../validator/ServiceTemplateValidationTest.java | 5 +- .../test/resources/enhance/enhanced-template.json | 28 +- 13 files changed, 57 insertions(+), 505 deletions(-) create mode 100644 ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.Artifact.json delete mode 100644 ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json delete mode 100644 ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Mappings/baseconfig-mapping.json delete mode 100644 ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Plans/ActivateProcess.bpmn delete mode 100644 ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/SamplePythonComponentNode.py delete mode 100644 ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/__init__.py delete mode 100644 ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/TOSCA-Metadata/TOSCA.meta delete mode 100644 ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Templates/baseconfig-template.vtl delete mode 100644 ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/__init__.py (limited to 'ms') diff --git a/ms/controllerblueprints/application/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json b/ms/controllerblueprints/application/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json index 851ded2c..d4fbf5cf 100644 --- a/ms/controllerblueprints/application/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json +++ b/ms/controllerblueprints/application/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json @@ -217,7 +217,7 @@ "default" : "LATEST" } }, - "derived_from": "tosca.nodes.Component" + "derived_from": "tosca.nodes.DG" }, "tosca.nodes.Component": { "description": "This is Resource Assignment Component API", @@ -253,6 +253,11 @@ }, "derived_from": "tosca.nodes.Root" }, + "tosca.nodes.DG" : { + "description" : "This is Directed Graph Node Type", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, "tosca.nodes.component.Python": { "description": "This is Resource Assignment Python Component API", "version": "1.0.0", diff --git a/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.Artifact.json b/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.Artifact.json new file mode 100644 index 00000000..81410527 --- /dev/null +++ b/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.Artifact.json @@ -0,0 +1,5 @@ +{ + "description": "This is Deprecated Artifact Node Type.", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" +} \ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json deleted file mode 100644 index 851ded2c..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json +++ /dev/null @@ -1,411 +0,0 @@ -{ - "metadata": { - "template_author": "Brinda Santh Muthuramalingam", - "author-email": "brindasanth@gmail.com", - "user-groups" : "ADMIN, OPERATION", - "template_name": "baseconfiguration", - "template_version": "1.0.0", - "template_tags": "brinda, tosca" - }, - "topology_template": { - "inputs": { - "request-id": { - "required": true, - "type": "string" - }, - "action-name": { - "required": true, - "type": "string" - }, - "scope-type": { - "required": true, - "type": "string" - }, - "hostname": { - "required": true, - "type": "string" - } - }, - "node_templates": { - "activate-process": { - "type": "bpmn-activate", - "properties": { - "process-name": { "get_input" : "action-name" }, - "version" : { "get_property" : ["SELF", "process-name"] }, - "content": { "get_artifact" : ["SELF", "activate-process"] } - }, - "artifacts": { - "activate-process": { - "type": "artifact-bpmn-camunda", - "file": "Plans/ActivateProcess.bpmn" - } - } - }, - "resource-assignment": { - "type": "component-resource-assignment", - "properties":{ - "request-id": "1234" - }, - "interfaces": { - "DefaultComponentNode": { - "operations": { - "process": { - "inputs": { - "action-name": { "get_input" : "action-name" }, - "resource-type": "vnf-type", - "request-id": { "get_input" : "request-id" }, - "resource-id": { "get_input" : "hostname" }, - "template-content": { "get_artifact" : ["SELF", "baseconfig-template"] }, - "mapping-content": { "get_artifact" : ["SELF", "baseconfig-mapping"] } - }, - "outputs": { - "resource-assignment-params": "", - "status": "" - } - } - } - } - }, - "artifacts": { - "baseconfig-template": { - "type": "artifact-template-velocity", - "file": "Templates/baseconfig-template.vtl" - }, - "baseconfig-mapping": { - "type": "artifact-mapping-resource", - "file": "Mappings/baseconfig-mapping.json" - } - } - }, - "resource-assignment-py": { - "type": "component-resource-assignment", - "properties":{ - "request-id": "1234" - }, - "interfaces": { - "DefaultComponentNode": { - "operations": { - "process": { - "implementation" :{ - "primary" : "component-script" - }, - "inputs": { - "action-name": { "get_input" : "action-name" } - }, - "outputs": { - "resource-assignment-params": "", - "status": "" - } - } - } - } - }, - "artifacts": { - "component-script": { - "type": "artifact-script-python", - "file": "Scripts/baseconfig-template.vtl" - } - } - } - }, - "workflows":{ - "activate-process":{ - "steps" : { - "call-resource-assignment" : { - "description" : "Invoke Resource Assignment Component", - "target" : "resource-assignment", - "activities" : [ - { - "call_operation": "ResourceAssignmentNode.process" - } - ], - "on_success" : [ - "download-baseconfig" - ] - }, - "download-baseconfig" : { - "description" : "Call Download Base Config Component", - "target" : "activate-netconf", - "activities" : [ - { - "call_operation": "NetconfTransactionNode.process" - } - ], - "on_success" : [ - "download-licence" - ] - }, - "download-licence" : { - "description" : "Call Download Licence Component", - "target" : "activate-netconf", - "activities" : [ - { - "call_operation": "NetconfTransactionNode.process" - } - ] - } - } - } - } - }, - "artifact_types": { - "artifact-template-velocity": { - "description": " Velocity Template used for Configuration", - "version": "1.0.0", - "file_ext": [ - "vtl" - ], - "derived_from": "tosca.artifacts.Implementation" - }, - "artifact-mapping-resource": { - "description": " Velocity Template Resource Mapping File used along with Configuration template", - "version": "1.0.0", - "file_ext": [ - "json" - ], - "derived_from": "tosca.artifacts.Implementation" - }, - "artifact-script-kotlin": { - "description": " Kotlin Script Template used for Configuration", - "version": "1.0.0", - "file_ext": [ - "kt" - ], - "derived_from": "tosca.artifacts.Implementation" - }, - "artifact-script-python": { - "description": " Kotlin Script Template used for Configuration", - "version": "1.0.0", - "file_ext": [ - "py" - ], - "derived_from": "tosca.artifacts.Implementation" - }, - "artifact-bpmn-camunda": { - "description": " Camunda BPM File", - "version": "1.0.0", - "file_ext": [ - "bpmn" - ], - "derived_from": "tosca.artifacts.Implementation" - }, - "artifact-component-jar": { - "description": "Component Jar", - "version": "1.0.0", - "file_ext": [ - "jar" - ], - "derived_from": "tosca.artifacts.Implementation" - } - }, - "node_types": { - "bpmn-activate": { - "description": "This is BPMN Activate node type", - "version": "1.0.0", - "properties": { - "content": { - "required": false, - "type": "string" - }, - "process-name": { - "required": false, - "type": "string" - }, - "version": { - "required": false, - "type": "string", - "default" : "LATEST" - } - }, - "derived_from": "tosca.nodes.Component" - }, - "tosca.nodes.Component": { - "description": "This is Resource Assignment Component API", - "version": "1.0.0", - "properties": { - "type": { - "description": "Request Id used to store the generated configuration, in the database along with the template-name", - "required": false, - "type": "string" - } - }, - "interfaces": { - "DefaultOperation": { - "operations": { - "validate": { - "inputs": { - "action-name": { - "description": "validate for action", - "required": false, - "type": "string" - } - } - } - } - } - }, - "artifacts" :{ - "component-jar": { - "description": "Component Jar", - "type": "artifact-component-jar", - "file": "Component/basecomponent.jar" - } - }, - "derived_from": "tosca.nodes.Root" - }, - "tosca.nodes.component.Python": { - "description": "This is Resource Assignment Python Component API", - "version": "1.0.0", - "properties": { - "type": { - "description": "Request Id used to store the generated configuration, in the database along with the template-name", - "required": false, - "type": "string" - } - }, - "interfaces": { - "DefaultOperation": { - "operations": { - "validate": { - "inputs": { - "action-name": { - "description": "validate for action", - "required": false, - "type": "string" - } - } - } - } - } - }, - "artifacts" :{ - "component-jar": { - "description": "Component Jar", - "type": "artifact-component-jar", - "file": "Component/basecomponent.jar" - } - }, - "derived_from": "tosca.nodes.Root" - }, - "component-resource-assignment": { - "description": "This is Resource Assignment Component API", - "version": "1.0.0", - "properties": { - "request-id": { - "description": "Request Id used to store the generated configuration, in the database along with the template-name", - "required": true, - "type": "string" - } - }, - "interfaces": { - "DefaultComponentNode": { - "operations": { - "process": { - "inputs": { - "action-name": { - "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", - "required": false, - "type": "string" - }, - "resource-type": { - "required": false, - "type": "string" - }, - "request-id": { - "description": "Request Id used to store the generated configuration, in the database along with the template-name", - "required": true, - "type": "string" - }, - "resource-id": { - "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", - "required": true, - "type": "string" - }, - "template-content": { - "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", - "required": true, - "type": "string" - }, - "mapping-content": { - "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present", - "required": true, - "type": "string" - } - }, - "outputs": { - "resource-assignment-params": { - "required": true, - "type": "string" - }, - "status": { - "required": true, - "type": "string" - } - } - } - } - } - }, - "derived_from": "tosca.nodes.Component" - }, - "component-resource-assignment-python": { - "description": "This is Resource Assignment Component API", - "version": "1.0.0", - "properties": { - "request-id": { - "description": "Request Id used to store the generated configuration, in the database along with the template-name", - "required": true, - "type": "string" - } - }, - "interfaces": { - "DefaultComponentNode": { - "operations": { - "process": { - "inputs": { - "action-name": { - "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority", - "required": false, - "type": "string" - } - }, - "outputs": { - "resource-assignment-params": { - "required": true, - "type": "string" - }, - "status": { - "required": true, - "type": "string" - } - } - } - } - } - }, - "derived_from": "tosca.nodes.component.Python" - } - }, - "data_types": { - "sample-property" : { - "description": "This is sample data type", - "version": "1.0.0", - "properties": { - "content": { - "required": false, - "type": "string" - }, - "process-name": { - "required": false, - "type": "string" - }, - "version": { - "required": false, - "type": "string", - "default" : "LATEST" - } - }, - "derived_from" : "tosca.datatypes.Root" - } - } -} \ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Mappings/baseconfig-mapping.json b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Mappings/baseconfig-mapping.json deleted file mode 100644 index 6abfb51b..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Mappings/baseconfig-mapping.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "assignments": "Sample Assignments" -} \ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Plans/ActivateProcess.bpmn b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Plans/ActivateProcess.bpmn deleted file mode 100644 index 5e94c0f8..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Plans/ActivateProcess.bpmn +++ /dev/null @@ -1,66 +0,0 @@ - - - - - SequenceFlow_0l0dq58 - - - SequenceFlow_1ay0k6p - - - - - - - - - - SequenceFlow_0l0dq58 - SequenceFlow_1ay0k6p - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/SamplePythonComponentNode.py b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/SamplePythonComponentNode.py deleted file mode 100644 index eb198c79..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/SamplePythonComponentNode.py +++ /dev/null @@ -1,8 +0,0 @@ -from com.brvith.orchestrator.core.interfaces import ComponentNode - -class SamplePythonComponentNode(ComponentNode): - def prepare(self, context, componentContext): - return None - - def prepare(self, context, componentContext): - return None \ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/__init__.py b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/TOSCA-Metadata/TOSCA.meta b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/TOSCA-Metadata/TOSCA.meta deleted file mode 100644 index 05c2c67f..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: Brinda Santh M -Entry-Definitions: Definitions/activation-blueprint.json -Template-Tags: vrr-test, Brinda Santh - -Name: Plans/ActivateProcess.bpmn -Content-Type: application/vnd.oasis.bpmn diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Templates/baseconfig-template.vtl b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Templates/baseconfig-template.vtl deleted file mode 100644 index 026c5917..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Templates/baseconfig-template.vtl +++ /dev/null @@ -1 +0,0 @@ -This is Sample Velocity Template \ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/__init__.py b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Definitions/vrr-test.json b/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Definitions/vrr-test.json index a06165bf..92785796 100644 --- a/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Definitions/vrr-test.json +++ b/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Definitions/vrr-test.json @@ -644,6 +644,26 @@ } }, "derived_from": "tosca.nodes.Component" + }, + "tosca.nodes.DG" : { + "description" : "This is Directed Graph Node Type", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, + "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" + }, + "tosca.nodes.Component" : { + "description" : "This is default Component Node", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" } }, "data_types": { diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java index 93ea4c49..46b725f8 100644 --- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java @@ -37,16 +37,15 @@ public class ServiceTemplateValidationTest { public void testBluePrintDirs() { List dirs = ConfigModelUtils.getBlueprintNames("load/blueprints"); Assert.assertNotNull("Failed to get blueprint directories", dirs); - Assert.assertEquals("Failed to get actual directories", 2, dirs.size()); + Assert.assertEquals("Failed to get actual directories", 1, dirs.size()); } @Test public void validateServiceTemplate() throws Exception { - validateServiceTemplate("load/blueprints/baseconfiguration/Definitions/activation-blueprint.json"); validateServiceTemplate("load/blueprints/vrr-test/Definitions/vrr-test.json"); } - //@Test + @Test public void validateEnhancedServiceTemplate() throws Exception { ServiceTemplate serviceTemplate = JacksonUtils .readValueFromClassPathFile("enhance/enhanced-template.json", ServiceTemplate.class); 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 c3f25738..9f8af1aa 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 @@ -215,6 +215,11 @@ }, "derived_from" : "tosca.nodes.DG" }, + "tosca.nodes.Component" : { + "description" : "This is default Component Node", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, "component-resource-assignment" : { "description" : "This is Resource Assignment Component API", "version" : "1.0.0", @@ -283,6 +288,11 @@ }, "derived_from" : "tosca.nodes.Component" }, + "tosca.nodes.DG" : { + "description" : "This is Directed Graph Node Type", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, "artifact-config-template" : { "description" : "This is Configuration Velocity Template", "version" : "1.0.0", @@ -361,6 +371,11 @@ }, "derived_from" : "tosca.nodes.Vnf" }, + "tosca.nodes.Vnf" : { + "description" : "This is VNF Node Type", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + }, "component-netconf-executor" : { "description" : "This is Netconf Transaction Configuration Component API", "version" : "1.0.0", @@ -386,12 +401,12 @@ "required" : true, "type" : "string" }, - "service-template-name" : { + "template-name" : { "description" : "Service Template Name", "required" : true, "type" : "string" }, - "service-template-version" : { + "template-version" : { "description" : "Service Template Version", "required" : true, "type" : "string" @@ -440,6 +455,11 @@ }, "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", @@ -571,8 +591,8 @@ }, "inputs" : { "action-name" : "{ \"get_input\" : \"action-name\" }", - "template_name" : "{ \"get_attribute\" : \"template_name\" }", - "service-template-version" : "{ \"get_attribute\" : \"service-template-version\" }", + "template-name" : "{ \"get_attribute\" : \"template_name\" }", + "template-version" : "{ \"get_attribute\" : \"template_version\" }", "resource-type" : "vnf-type", "request-id" : "{ \"get_input\" : \"request-id\" }", "resource-id" : "{ \"get_input\" : \"hostname\" }", -- cgit 1.2.3-korg