From cfc807955c9cae60bce983e4f4ac951bf37ecc20 Mon Sep 17 00:00:00 2001 From: Steve Alphonse Siani Date: Wed, 13 Feb 2019 15:45:50 -0500 Subject: Python library for Jython execution Change-Id: Iee2701b4dade7207950f17c92ea1265c361cf803 Issue-ID: CCSDK-696 Signed-off-by: Steve Alphonse Siani --- .../Definitions/activation-blueprint.json | 128 ++++++++++++++ .../Definitions/artifact_types.json | 28 ++++ .../Definitions/baseconfig-mapping.json | 23 +++ .../capability_python/Definitions/data_types.json | 17 ++ .../capability_python/Definitions/node_types.json | 183 +++++++++++++++++++++ .../Definitions/policy_types.json | 3 + .../Definitions/relationship_types.json | 3 + .../Definitions/resources_definition_types.json | 51 ++++++ 8 files changed, 436 insertions(+) create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/activation-blueprint.json create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/artifact_types.json create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/baseconfig-mapping.json create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/data_types.json create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/node_types.json create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/policy_types.json create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/relationship_types.json create mode 100755 components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/resources_definition_types.json (limited to 'components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions') diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/activation-blueprint.json new file mode 100755 index 00000000..168732c1 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/activation-blueprint.json @@ -0,0 +1,128 @@ +{ + "tosca_definitions_version" : "controller_blueprint_1_0_0", + "metadata" : { + "template_author" : "Alexis de Talhouƫt", + "author-email" : "adetalhouet89@gmail.com", + "user-groups" : "ADMIN, OPERATION", + "template_name" : "capability_python", + "template_version" : "1.0.0", + "template_tags" : "test" + }, + "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" + } + }, + "workflows" : { + "assign-activate" : { + "steps" : { + "activate-process" : { + "description" : "Resource Assign and Netconf Activation Workflow", + "target" : "assign-activate-process", + "activities" : [ { + "call_operation" : "" + } ] + } + }, + "inputs" : { + "assign-activate-properties" : { + "description" : "Dynamic PropertyDefinition for workflow(assign-activate).", + "required" : true, + "type" : "dt-assign-activate-properties" + } + } + } + }, + "node_templates" : { + "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-resolution", + "interfaces" : { + "ResourceResolutionComponent" : { + "operations" : { + "process" : { + "inputs" : { + "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" + } + } + }, + "activate-jython" : { + "type" : "component-jython-executor", + "interfaces" : { + "ComponentJythonExecutor" : { + "operations" : { + "process" : { + "implementation" : { + "primary" : "component-script" + }, + "inputs" : { + "instance-dependencies" : [ ] + }, + "outputs" : { + "response-data" : "", + "status" : "" + } + } + } + } + }, + "artifacts" : { + "component-script" : { + "type" : "artifact-script-jython", + "file" : "Scripts/SamplePythonComponentNode.py" + } + } + } + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/artifact_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/artifact_types.json new file mode 100755 index 00000000..aa5295e4 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/artifact_types.json @@ -0,0 +1,28 @@ +{ + "artifact_types" : { + "artifact-directed-graph" : { + "description" : "Directed Graph File", + "version" : "1.0.0", + "derived_from" : "tosca.artifacts.Implementation", + "file_ext" : [ "json", "xml" ] + }, + "artifact-mapping-resource" : { + "description" : "Resource Mapping File used along with Configuration template", + "version" : "1.0.0", + "derived_from" : "tosca.artifacts.Implementation", + "file_ext" : [ "json" ] + }, + "artifact-script-jython" : { + "description" : "Jython Script File", + "version" : "1.0.0", + "derived_from" : "tosca.artifacts.Implementation", + "file_ext" : [ "py" ] + }, + "artifact-template-velocity" : { + "description" : " Velocity Template used for Configuration", + "version" : "1.0.0", + "derived_from" : "tosca.artifacts.Implementation", + "file_ext" : [ "vtl" ] + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/baseconfig-mapping.json b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/baseconfig-mapping.json new file mode 100755 index 00000000..de6c2411 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/baseconfig-mapping.json @@ -0,0 +1,23 @@ +[ + { + "name": "service-instance-id", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "service-instance-id", + "dictionary-source": "capability", + "dependencies": [ + ] + }, + { + "name": "vnf-id", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "vnf-id", + "dictionary-source": "input", + "dependencies": [] + } +] diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/data_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/data_types.json new file mode 100755 index 00000000..98a8e4b7 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/data_types.json @@ -0,0 +1,17 @@ +{ + "data_types" : { + "dt-assign-activate-properties" : { + "description" : "Dynamic DataType definition for workflow(assign-activate).", + "version" : "1.0.0", + "properties" : { + "vnf-id" : { + "type" : "string" + }, + "service-instance-id" : { + "type" : "string" + } + }, + "derived_from" : "tosca.datatypes.Dynamic" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/node_types.json new file mode 100755 index 00000000..b40c8cb3 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/node_types.json @@ -0,0 +1,183 @@ +{ + "node_types" : { + "component-jython-executor" : { + "description" : "This is Jython Execution Component.", + "version" : "1.0.0", + "capabilities" : { + "component-node" : { + "type" : "tosca.capabilities.Node" + } + }, + "interfaces" : { + "ComponentJythonExecutor" : { + "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-resolution" : { + "description" : "This is Resource Assignment Component API", + "version" : "1.0.0", + "attributes" : { + "assignment-params" : { + "required" : true, + "type" : "string" + } + }, + "capabilities" : { + "component-node" : { + "type" : "tosca.capabilities.Node" + } + }, + "interfaces" : { + "ResourceResolutionComponent" : { + "operations" : { + "process" : { + "inputs" : { + "template-name" : { + "description" : "Service Template Name.", + "required" : true, + "type" : "string" + }, + "template-version" : { + "description" : "Service Template Version.", + "required" : true, + "type" : "string" + }, + "resource-type" : { + "description" : "Request type.", + "required" : true, + "type" : "string" + }, + "template-names" : { + "description" : "Name of the artifact Node Templates, to get the template Content.", + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + }, + "artifact-prefix-names" : { + "description" : "Template , Resource Assignment Artifact Prefix names", + "required" : false, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + }, + "request-id" : { + "description" : "Request Id, Unique Id for the request.", + "required" : false, + "type" : "string" + }, + "resource-id" : { + "description" : "Resource Id.", + "required" : false, + "type" : "string" + }, + "action-name" : { + "description" : "Action Name of the process", + "required" : false, + "type" : "string" + } + }, + "outputs" : { + "resource-assignment-params" : { + "required" : true, + "type" : "string" + }, + "status" : { + "required" : true, + "type" : "string" + } + } + } + } + } + }, + "derived_from" : "tosca.nodes.Component" + }, + "dg-generic" : { + "description" : "This is Generic Directed Graph Type", + "version" : "1.0.0", + "properties" : { + "content" : { + "required" : true, + "type" : "string" + }, + "dependency-node-templates" : { + "description" : "Dependent Step Components NodeTemplate name.", + "required" : true, + "type" : "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "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.Component" : { + "description" : "This is default Component Node", + "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.component.Jython" : { + "description" : "This is Jython Component", + "version" : "1.0.0", + "derived_from" : "tosca.nodes.Root" + } + } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/policy_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/policy_types.json new file mode 100755 index 00000000..1e44cc70 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/policy_types.json @@ -0,0 +1,3 @@ +{ + "policy_types" : { } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/relationship_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/relationship_types.json new file mode 100755 index 00000000..4ddd7a57 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/relationship_types.json @@ -0,0 +1,3 @@ +{ + "relationship_types" : { } +} \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/resources_definition_types.json new file mode 100755 index 00000000..d2c470fe --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_python/Definitions/resources_definition_types.json @@ -0,0 +1,51 @@ +{ + "service-instance-id" : { + "tags" : "service-instance-id, tosca.datatypes.Root, data_type", + "name" : "service-instance-id", + "property" : { + "description" : "To be provided", + "type" : "string" + }, + "updated-by" : "Singal, Kapil ", + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + }, + "primary-db": { + "type": "source-primary-db", + "properties": { + "query": "SELECT artifact_name FROM BLUEPRINT_RUNTIME where artifact_version=\"1.0.0\"", + "input-key-mapping": { + }, + "output-key-mapping": { + "service-instance-id": "artifact_name" + } + } + }, + "capability": { + "type": "source-capability", + "properties": { + "type": "JYTHON-COMPONENT", + "instance-name": "SampleRAProcessor", + "instance-dependencies": [] + } + } + } + }, + "vnf-id" : { + "tags" : "vnf-id", + "name" : "vnf-id", + "property" : { + "description" : "vnf-id", + "type" : "string" + }, + "updated-by" : "Singal, Kapil ", + "sources" : { + "input" : { + "type" : "source-input", + "properties" : { } + } + } + } +} \ No newline at end of file -- cgit 1.2.3-korg