From 8d865c28451d63815fb1fd5d1a52800ee33dde91 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Fri, 8 Feb 2019 12:15:11 -0500 Subject: Refactor test blueprint catalog Change-Id: I948067b25787c7a79f769ac4055c34ffdd2f172d Issue-ID: CCSDK-1047 Signed-off-by: Muthuramalingam, Brinda Santh --- .../Definitions/activation-blueprint.json | 336 +++++++++++++++++++++ .../Definitions/artifact_types.json | 45 +++ .../Definitions/baseconfig-mapping.json | 36 +++ .../baseconfiguration/Definitions/data_types.json | 82 +++++ .../baseconfiguration/Definitions/node_types.json | 234 ++++++++++++++ .../Definitions/policy_types.json | 4 + .../Definitions/relationship_types.json | 9 + .../Definitions/resources_definition_types.json | 62 ++++ .../baseconfiguration/Plans/ActivateProcess.bpmn | 66 ++++ .../Plans/CONFIG_ActivateNetconf_1.0.0.xml | 34 +++ .../Plans/CONFIG_AssignActivateNetconf_1.0.0.xml | 42 +++ .../Plans/CONFIG_ResourceAssignment_1.0.0.xml | 34 +++ .../kotlin/ResourceAssignmentProcessor.cba.kts | 44 +++ .../Scripts/kotlin/ScriptComponent.cba.kts | 46 +++ .../Scripts/python/DefaultGetNetConfig.py | 50 +++ .../Scripts/python/SamplePythonComponentNode.py | 12 + .../baseconfiguration/Scripts/python/__init__.py | 0 .../baseconfiguration/TOSCA-Metadata/TOSCA.meta | 8 + .../Templates/baseconfig-template.vtl | 1 + 19 files changed, 1145 insertions(+) create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/artifact_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/data_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/policy_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/relationship_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/ActivateProcess.bpmn create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_ResourceAssignment_1.0.0.xml create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/ResourceAssignmentProcessor.cba.kts create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/ScriptComponent.cba.kts create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SamplePythonComponentNode.py create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/__init__.py create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta create mode 100644 components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/baseconfig-template.vtl (limited to 'components/model-catalog/blueprint-model/test-blueprint/baseconfiguration') diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json new file mode 100644 index 00000000..822cc68b --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -0,0 +1,336 @@ +{ + "metadata": { + "template_author": "Brinda Santh Muthuramalingam", + "author-email": "brindasanth@in.ibm.com", + "user-groups": "ADMIN, OPERATION", + "template_name": "baseconfiguration", + "template_version": "1.0.0", + "template_tags": "brinda, tosca" + }, + "imports": [ + { + "file": "Definitions/data_types.json" + }, + { + "file": "Definitions/relationship_types.json" + }, + { + "file": "Definitions/artifact_types.json" + }, + { + "file": "Definitions/node_types.json" + }, + { + "file": "Definitions/policy_types.json" + } + ], + "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": { + "resource-assignment-process": { + "type": "dg-generic", + "properties": { + "content": { + "get_artifact": [ + "SELF", + "dg-resource-assignment-process" + ] + }, + "dependency-node-templates": [ + "resource-assignment" + ] + }, + "artifacts": { + "dg-resource-assignment-process": { + "type": "artifact-directed-graph", + "file": "Plans/CONFIG_ResourceAssignment_1.0.0.xml" + } + } + }, + "activate-process": { + "type": "dg-generic", + "properties": { + "content": { + "get_artifact": [ + "SELF", + "dg-activate-process" + ] + }, + "dependency-node-templates": [ + "activate-jython" + ] + }, + "artifacts": { + "dg-activate-process": { + "type": "artifact-directed-graph", + "file": "Plans/CONFIG_ActivateNetconf_1.0.0.xml" + } + } + }, + "assign-activate-process": { + "type": "dg-generic", + "properties": { + "content": { + "get_artifact": [ + "SELF", + "dg-assign-activate-process" + ] + }, + "dependency-node-templates": [ + "resource-assignment", + "activate-jython" + ] + }, + "artifacts": { + "dg-assign-activate-process": { + "type": "artifact-directed-graph", + "file": "Plans/CONFIG_AssignActivateNetconf_1.0.0.xml" + } + } + }, + "resource-assignment": { + "type": "component-resource-assignment", + "interfaces": { + "ResourceAssignmentComponent": { + "operations": { + "process": { + "inputs": { + "action-name": { + "get_input": "action-name" + }, + "resource-type": "vnf-type", + "request-id": { + "get_input": "request-id" + }, + "resource-id": { + "get_input": "hostname" + }, + "artifact-prefix-names": [ + "baseconfig" + ] + }, + "outputs": { + "resource-assignment-params": { + "get_attribute": [ + "SELF", + "assignment-params" + ] + }, + "status": "success" + } + } + } + } + }, + "artifacts": { + "baseconfig-template": { + "type": "artifact-template-velocity", + "file": "Templates/baseconfig-template.vtl" + }, + "baseconfig-mapping": { + "type": "artifact-mapping-resource", + "file": "Definitions/baseconfig-mapping.json" + } + } + }, + "resource-assignment-py": { + "type": "component-resource-assignment", + "interfaces": { + "ResourceAssignmentComponent": { + "operations": { + "process": { + "implementation": { + "primary": "component-script" + }, + "inputs": { + "action-name": { + "get_input": "action-name" + } + }, + "outputs": { + "resource-assignment-params": "", + "status": "" + } + } + } + } + }, + "artifacts": { + "component-script": { + "type": "artifact-script-jython", + "file": "Scripts/python/SamplePythonComponentNode.py" + } + } + }, + "activate-jython": { + "type": "component-jython-executor", + "interfaces": { + "JythonExecutorComponent": { + "operations": { + "process": { + "implementation": { + "primary": "component-script" + }, + "inputs": { + "instance-dependencies": [ + "json-parser-service", + "netconf-rpc-service" + ] + }, + "outputs": { + "response-data": "", + "status": "" + } + } + } + } + }, + "artifacts": { + "component-script": { + "type": "artifact-script-jython", + "file": "Scripts/python/SamplePythonComponentNode.py" + } + } + }, + "activate-netconf": { + "type": "component-netconf-executor", + "interfaces": { + "NetconfExecutorComponent": { + "operations": { + "process": { + "implementation": { + "primary": "component-script" + }, + "inputs": { + "instance-dependencies": [ + "json-parser-service", + "netconf-rpc-service" + ] + }, + "outputs": { + "response-data": "", + "status": "" + } + } + } + } + }, + "requirements": { + "netconf-connection": { + "capability": "netconf", + "node": "sample-netconf-device", + "relationship": "tosca.relationships.ConnectsTo" + } + }, + "artifacts": { + "component-script": { + "type": "artifact-script-jython", + "file": "Scripts/python/DefaultGetNetConfig.py" + } + } + }, + "sample-netconf-device": { + "type": "vnf-netconf-device", + "capabilities": { + "netconf": { + "properties": { + "login-key": "sample-key", + "login-account": "sample-account", + "target-ip-address": "localhost", + "port-number": 830, + "connection-time-out": 30 + } + } + } + } + }, + "workflows": { + "resource-assignment": { + "inputs": { + "resource-assignment-properties": { + "required": true, + "type": "dt-resource-assignment-properties" + } + }, + "steps": { + "call-resource-assignment": { + "description": "Resource Assignment Workflow", + "target": "resource-assignment-process", + "activities": [ + { + "call_operation": "CONFIG.ResourceAssignment" + } + ] + } + } + }, + "activate": { + "inputs": { + "request-id": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "hostname": { + "required": true, + "type": "string" + } + }, + "steps": { + "activate-process": { + "description": "Netconf Activation Workflow", + "target": "activate-process", + "activities": [ + { + "call_operation": "CONFIG.ActivateProcess" + } + ] + } + } + }, + "assign-activate": { + "inputs": { + "assign-activate-properties": { + "required": true, + "type": "dt-assign-activate-properties" + } + }, + "steps": { + "activate-process": { + "description": "Resource Assign and Netconf Activation Workflow", + "target": "assign-activate-process", + "activities": [ + { + "call_operation": "CONFIG.AssignActivateProcess" + } + ] + } + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/artifact_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/artifact_types.json new file mode 100644 index 00000000..d741d151 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/artifact_types.json @@ -0,0 +1,45 @@ +{ + "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-jython": { + "description": "Jython Script File", + "version": "1.0.0", + "file_ext": [ + "py" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-directed-graph": { + "description": "Directed Graph File", + "version": "1.0.0", + "file_ext": [ + "json", + "xml" + ], + "derived_from": "tosca.artifacts.Implementation" + }, + "artifact-component-jar": { + "description": "Component Jar", + "version": "1.0.0", + "file_ext": [ + "jar" + ], + "derived_from": "tosca.artifacts.Implementation" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json new file mode 100644 index 00000000..67d2a914 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json @@ -0,0 +1,36 @@ +[ + { + "name": "service-instance-id", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "service-instance-id", + "dictionary-source": "input", + "dependencies": [ + ] + }, + { + "name": "vnf-id", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "vnf-id", + "dictionary-source": "input", + "dependencies": [] + }, + { + "name": "vnf_name", + "input-param": false, + "property": { + "type": "string" + }, + "dictionary-name": "vnf_name", + "dictionary-source": "primary-config-data", + "dependencies": [ + "service-instance-id", + "vnf-id" + ] + } +] diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/data_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/data_types.json new file mode 100644 index 00000000..6d771cd6 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/data_types.json @@ -0,0 +1,82 @@ +{ + "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" + }, + "dt-resource-assignment-properties": { + "description": "This is Dynamically generated data type for workflow activate", + "version": "1.0.0", + "properties": { + "request-id": { + "required": true, + "type": "string" + }, + "service-instance-id": { + "required": true, + "type": "string" + }, + "vnf-id": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "hostname": { + "required": true, + "type": "string" + }, + "vnf_name": { + "required": true, + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Dynamic" + }, + "dt-assign-activate-properties": { + "description": "This is Dynamically generated data type for workflow assign-activate", + "version": "1.0.0", + "properties": { + "request-id": { + "required": true, + "type": "string" + }, + "action-name": { + "required": true, + "type": "string" + }, + "scope-type": { + "required": true, + "type": "string" + }, + "hostname": { + "required": true, + "type": "string" + } + }, + "derived_from": "tosca.datatypes.Dynamic" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json new file mode 100644 index 00000000..f7970bfb --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json @@ -0,0 +1,234 @@ +{ + "node_types": { + "dg-generic": { + "description": "This is Generic Directed Graph Type", + "version": "1.0.0", + "properties": { + "content": { + "required": true, + "type": "string" + }, + "dependency-node-templates": { + "required": true, + "description": "Dependent Step Components", + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.DG" + }, + "tosca.nodes.Component": { + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "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.ResourceSource" : { + "description" : "TOSCA base type for Resource Sources", + "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.component.Jython": { + "description": "This is Resource Assignment Jython Component API", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" + }, + "component-netconf-executor": { + "description": "This is Netconf Transaction Configuration Component API", + "version": "1.0.0", + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "requirements": { + "netconf-connection": { + "capability": "netconf", + "node": "vnf-netconf-device", + "relationship": "tosca.relationships.ConnectsTo" + } + }, + "interfaces": { + "NetconfExecutorComponent": { + "operations": { + "process": { + "inputs": { + "instance-dependencies": { + "description": "Instance Names to Inject to Jython Script.", + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "outputs": { + "response-data": { + "description": "Execution Response Data in JSON format.", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.component.Jython" + }, + "component-resource-assignment": { + "description": "This is Resource Assignment Component API", + "version": "1.0.0", + "attributes": { + "assignment-params": { + "required": true, + "type": "string" + } + }, + "interfaces": { + "ResourceAssignmentComponent": { + "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" + }, + "artifact-prefix-names": { + "required": false, + "description": "Template , Resource Assignment Artifact Prefix names", + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "outputs": { + "resource-assignment-params": { + "required": true, + "type": "string" + }, + "status": { + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" + }, + "component-jython-executor": { + "description": "This is Jython Execution Component.", + "version": "1.0.0", + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "interfaces": { + "JythonExecutorComponent": { + "operations": { + "process": { + "inputs": { + "instance-dependencies": { + "required": true, + "description": "Instance Names to Inject to Jython Script.", + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "outputs": { + "response-data": { + "description": "Execution Response Data in JSON format.", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.component.Jython" + }, + "vnf-netconf-device": { + "description": "This is VNF Device with Netconf Capability", + "version": "1.0.0", + "capabilities": { + "netconf": { + "type": "tosca.capabilities.Netconf", + "properties": { + "login-key": { + "required": true, + "type": "string", + "default": "sdnc" + }, + "login-account": { + "required": true, + "type": "string", + "default": "sdnc-tacacs" + }, + "source": { + "required": true, + "type": "string", + "default": "npm" + }, + "target-ip-address": { + "required": true, + "type": "string" + }, + "port-number": { + "required": true, + "type": "integer", + "default": 830 + }, + "connection-time-out": { + "required": false, + "type": "integer", + "default": 30 + } + } + } + }, + "derived_from": "tosca.nodes.Vnf" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/policy_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/policy_types.json new file mode 100644 index 00000000..0c9b9925 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/policy_types.json @@ -0,0 +1,4 @@ +{ + "policy_types": { + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/relationship_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/relationship_types.json new file mode 100644 index 00000000..87d2dc58 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/relationship_types.json @@ -0,0 +1,9 @@ +{ + "relationship_types": { + "tosca.relationships.ConnectsTo": { + "description": "Relationship tosca.relationships.ConnectsTo", + "version": "1.0.0", + "derived_from": "tosca.relationships.Root" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json new file mode 100644 index 00000000..c8871214 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json @@ -0,0 +1,62 @@ +{ + "service-instance-id": { + "name": "service-instance-id", + "tags": "service-instance-id, tosca.datatypes.Root, data_type", + "updated-by": "Singal, Kapil ", + "property": { + "description": "To be provided", + "type": "string" + }, + "sources": { + "input": { + "type": "source-input", + "properties": {} + } + } + }, + "vnf-id": { + "name": "vnf-id", + "tags": "vnf-id", + "updated-by": "Singal, Kapil ", + "property": { + "description": "vnf-id", + "type": "string" + }, + "sources": { + "input": { + "type": "source-input", + "properties": {} + } + } + }, + "vnf_name": { + "name": "vnf_name", + "tags": "vnf_name", + "updated-by": "Singal, Kapil ", + "property": { + "description": "vnf_name", + "type": "string" + }, + "sources": { + "primary-config-data": { + "type": "source-rest", + "properties": { + "type": "JSON", + "url-path": "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name", + "path": "/param/0/value", + "input-key-mapping": { + "service-instance-id": "service-instance-id", + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + "vnf_name": "value" + }, + "key-dependencies": [ + "service-instance-id", + "vnf-id" + ] + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/ActivateProcess.bpmn b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/ActivateProcess.bpmn new file mode 100644 index 00000000..89ae342f --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/ActivateProcess.bpmn @@ -0,0 +1,66 @@ + + + + + SequenceFlow_0l0dq58 + + + SequenceFlow_1ay0k6p + + + + + + + + + + SequenceFlow_0l0dq58 + SequenceFlow_1ay0k6p + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml new file mode 100644 index 00000000..2f6d2eda --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml new file mode 100644 index 00000000..eb41b7df --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_ResourceAssignment_1.0.0.xml b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_ResourceAssignment_1.0.0.xml new file mode 100644 index 00000000..a197877f --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Plans/CONFIG_ResourceAssignment_1.0.0.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/ResourceAssignmentProcessor.cba.kts b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/ResourceAssignmentProcessor.cba.kts new file mode 100644 index 00000000..f1da6140 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/ResourceAssignmentProcessor.cba.kts @@ -0,0 +1,44 @@ +/* + * 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. + */ + +import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor.* +import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.CapabilityResourceSource +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintScriptsService +import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment +import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive + +open class ScriptResourceAssignmentProcessor : ResourceAssignmentProcessor() { + + lateinit var resourceAssignment: ResourceAssignment + + override fun getName(): String { + return "resource-assignment-processor-custom-capability" + } + + override fun process(resourceAssignment: ResourceAssignment) { + this.resourceAssignment = resourceAssignment + } + + override fun prepareResponse(): ResourceAssignment { + return resourceAssignment + } + + override fun recover(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { + TODO("To Implement") + } + +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/ScriptComponent.cba.kts b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/ScriptComponent.cba.kts new file mode 100644 index 00000000..184c4933 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/ScriptComponent.cba.kts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive +import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate +import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode + +open class SampleKotlinComponent : BlueprintFunctionNode { + + override fun getName(): String { + return "my Name" + } + + override fun prepareRequest(executionRequest: String): String { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun process(executionRequest: String) { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun recover(runtimeException: RuntimeException, executionRequest: String) { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun prepareResponse(): String { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + override fun apply(t: String): String { + return "Successfully Executed Scripts" + } +} diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py new file mode 100644 index 00000000..4db7c731 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/DefaultGetNetConfig.py @@ -0,0 +1,50 @@ +import netconf_constant +from netconfclient import NetconfClient +from java.lang import Exception +from abstract_blueprint_function import AbstractPythonComponentFunction +from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor import NetconfRpcService +from org.onap.ccsdk.apps.controllerblueprints.core.utils import JacksonUtils +from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.interfaces import DeviceInfo +from org.onap.ccsdk.apps.controllerblueprints.core.service import BluePrintRuntimeService + + +class DefaultGetNetConfig(AbstractPythonComponentFunction): + def process(self, execution_request): + try: + log = globals()[netconf_constant.SERVICE_LOG] + print(globals()) + #requestId = globals()[netconf_constant.PARAM_REQUEST_ID] + requestId = '1234' + + bluePrintRuntimeService = globals()['bluePrintRuntimeService'] + + capabilityProperty = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties("sample-netconf-device","netconf") + + log.info("capabilityProperty {}",capabilityProperty) + netconfService = NetconfRpcService() + nc = NetconfClient(log, netconfService) + + nc.connect(netconfService.getNetconfDeviceInfo(capabilityProperty)) + runningConfigTemplate = "runningconfig-template" + + runningConfigMessageId = "get-config-" + requestId + + deviceResponse = nc.getConfig(messageId=runningConfigMessageId, + filter=runningConfigTemplate) + + log.info("Get Running Config Response {} ", deviceResponse.responseMessage) + if(deviceResponse !='null') : + status = deviceResponse.status + responseData = "{}" + if (deviceResponse.status != netconf_constant.STATUS_SUCCESS and deviceResponse.errorMessage != 'null'): + errorMessage = "Get Running Config Failure ::"+ deviceResponse.errorMessage + + except Exception, err: + log.info("Exception in the script {}",err.getMessage()) + status = netconf_constant.STATUS_FAILURE + errorMessage = "Get Running Config Failure ::"+err.getMessage() + + def recover(self, runtime_exception, execution_request): + print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + return None + diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SamplePythonComponentNode.py b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SamplePythonComponentNode.py new file mode 100644 index 00000000..0a583dc5 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/SamplePythonComponentNode.py @@ -0,0 +1,12 @@ +from abstract_blueprint_function import AbstractPythonComponentFunction +from blueprint_constants import * + +class SamplePythonComponentNode(AbstractPythonComponentFunction): + + def process(self, execution_request): + print "Processing calling.." + PROPERTY_BLUEPRINT_BASE_PATH + return None + + def recover(self, runtime_exception, execution_request): + print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH + return None diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/__init__.py b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/python/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 00000000..9066e484 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,8 @@ +TOSCA-Meta-File-Version: 1.0.0 +CSAR-Version: 1.0 +Created-By: Brinda Santh M +Entry-Definitions: Definitions/activation-blueprint.json +Template-Tags: Brinda Santh, activation-blueprint + +Name: Plans/ActivateProcess.bpmn +Content-Type: application/vnd.oasis.bpmn diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/baseconfig-template.vtl b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/baseconfig-template.vtl new file mode 100644 index 00000000..026c5917 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Templates/baseconfig-template.vtl @@ -0,0 +1 @@ +This is Sample Velocity Template \ No newline at end of file -- cgit 1.2.3-korg