diff options
Diffstat (limited to 'components')
12 files changed, 361 insertions, 1 deletions
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 index d926aa3fc..b771d25f9 100644 --- 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 @@ -68,8 +68,9 @@ "primary-config-data": { "type": "source-rest", "properties": { + "verb": "GET", "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", + "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", @@ -85,5 +86,92 @@ } } } + }, + "aai-get-resource": { + "tags": "aai-get", + "name": "aai-get-resource", + "property": { + "description": "primary aai data to get resource", + "type": "string" + }, + "updated-by": "Steve, Siani <steve.djissitchi@bell.ca>", + "sources": { + "primary-aai-data": { + "type": "source-rest", + "properties": { + "type": "JSON", + "verb": "GET", + "url-path": "/aai/v14/network/generic-vnfs/generic-vnf/$vnf-id", + "path": "", + "input-key-mapping": { + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + }, + "key-dependencies": [ + "vnf-id" + ] + } + } + } + }, + "aai-put-resource": { + "tags": "aai-put", + "name": "aai-put-resource", + "property": { + "description": "primary aai data to update resource", + "type": "string" + }, + "updated-by": "Steve, Siani <steve.djissitchi@bell.ca>", + "sources": { + "primary-aai-data": { + "type": "source-rest", + "properties": { + "type": "JSON", + "verb": "PUT", + "url-path": "/query?format=resource", + "path": "", + "payload": "{\r\n\"start\": \"\\/nodes\\/vf-modules?vf-module-name=vf-module-name\",\r\n\"query\": \"\\/query\\/related-to?startingNodeType=vf-module&relatedToNodeType=generic-vnf\"\r\n}", + + "input-key-mapping": { + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + }, + "key-dependencies": [ + "vnf-id" + ] + } + } + } + }, + "aai-post-resource": { + "tags": "aai-port", + "name": "aai-port-resource", + "property": { + "description": "primary aai data to create new resource", + "type": "string" + }, + "updated-by": "Steve, Siani <steve.djissitchi@bell.ca>", + "sources": { + "primary-aai-data": { + "type": "source-rest", + "properties": { + "type": "JSON", + "verb": "POST", + "url-path": "/aai/add/uri/here", + "path": "", + "payload": "", + "input-key-mapping": { + "vnf-id": "vnf-id" + }, + "output-key-mapping": { + }, + "key-dependencies": [ + "vnf-id" + ] + } + } + } } }
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/artifact_types.json b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/artifact_types.json new file mode 100644 index 000000000..445236354 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/artifact_types.json @@ -0,0 +1,12 @@ +{ + "artifact_types": { + "artifact-script-python": { + "description": "Python Script file", + "version": "1.0.0", + "derived_from": "tosca.artifacts.Implementation", + "file_ext": [ + "py" + ] + } + } +}
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/data_types.json b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/data_types.json new file mode 100644 index 000000000..b22e30d00 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/data_types.json @@ -0,0 +1,3 @@ +{ + "data_types": {} +}
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/node_types.json new file mode 100644 index 000000000..cd63f0091 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/node_types.json @@ -0,0 +1,51 @@ +{ + "node_types": { + "component-remote-python-executor": { + "description": "This is Remote Python Execution Component.", + "version": "1.0.0", + "attributes": { + "execution-logs": { + "required": true, + "type": "string" + } + }, + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "interfaces": { + "ComponentRemotePythonExecutor": { + "operations": { + "process": { + "inputs": { + "endpoint-selector": { + "description": "Remote Container or Server selector name.", + "required": false, + "type": "string", + "default": "remote-python" + }, + "dynamic-properties": { + "description": "Dynamic Json Content or DSL Json reference.", + "required": false, + "type": "json" + }, + "command": { + "description": "Command to execute.", + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" + }, + "tosca.nodes.Component": { + "description": "This is default Component Node", + "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/remote_scripts/Definitions/policy_types.json b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/policy_types.json new file mode 100644 index 000000000..2442ce877 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/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/remote_scripts/Definitions/relationship_types.json b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/relationship_types.json new file mode 100644 index 000000000..097a30afd --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/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/remote_scripts/Definitions/remote_scripts.json b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json new file mode 100644 index 000000000..464911478 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json @@ -0,0 +1,85 @@ +{ + "tosca_definitions_version": "controller_blueprint_1_0_0", + "metadata": { + "template_author": "Brinda Santh Muthuramalingam", + "author-email": "brindasanth@in.ibm.com", + "user-groups": "ADMIN, OPERATION", + "template_name": "remote_scripts", + "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": { + "workflows": { + "execute-remote-python": { + "steps": { + "execute-script": { + "description": "Execute Remote Python Script", + "target": "execute-remote-python", + "activities": [ + { + "call_operation": "" + } + ] + } + }, + "inputs": {}, + "outputs": { + "logs": { + "type": "json", + "value": { + "get_attribute": [ + "execute-remote-python", + "execution-logs" + ] + } + } + } + } + }, + "node_templates": { + "execute-remote-python": { + "type": "component-remote-python-executor", + "interfaces": { + "ComponentRemotePythonExecutor": { + "operations": { + "process": { + "implementation": { + "primary": "component-script", + "dependencies": [ + "pyaml" + ] + }, + "inputs": { + "command": "python SamplePython.py blah" + } + } + } + } + }, + "artifacts": { + "component-script": { + "type": "artifact-script-python", + "file": "Scripts/python/SamplePython.py" + } + } + } + } + } +}
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/resources_definition_types.json new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/resources_definition_types.json @@ -0,0 +1 @@ +{}
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Scripts/python/SamplePython.py b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Scripts/python/SamplePython.py new file mode 100644 index 000000000..5e20e2291 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Scripts/python/SamplePython.py @@ -0,0 +1,5 @@ +#!/usr/bin/python + +import sys + +print(sys.argv[1])
\ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/TOSCA-Metadata/TOSCA.meta b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 000000000..5ca8aa031 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,5 @@ +TOSCA-Meta-File-Version: 1.0.0 +CSAR-Version: 1.0 +Created-By: Brinda Santh <brindasanth@in.ibm.com> +Entry-Definitions: Definitions/remote_scripts.json +Template-Tags: Brinda Santh, remote_scripts
\ No newline at end of file diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-remote-python-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-remote-python-executor.json new file mode 100644 index 000000000..99a4dd8dc --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/node_type/component-remote-python-executor.json @@ -0,0 +1,42 @@ +{ + "description": "This is Remote Python Execution Component.", + "version": "1.0.0", + "attributes": { + "execution-logs": { + "required": true, + "type": "string" + } + }, + "capabilities": { + "component-node": { + "type": "tosca.capabilities.Node" + } + }, + "interfaces": { + "ComponentRemotePythonExecutor": { + "operations": { + "process": { + "inputs": { + "endpoint-selector": { + "description": "Remote Container or Server selector name.", + "required": false, + "type": "string", + "default": "remote-python" + }, + "dynamic-properties": { + "description": "Dynamic Json Content or DSL Json reference.", + "required": false, + "type": "json" + }, + "command": { + "description": "Command to execute.", + "required": true, + "type": "string" + } + } + } + } + } + }, + "derived_from": "tosca.nodes.Component" +}
\ No newline at end of file diff --git a/components/model-catalog/proto-definition/proto/CommandExecutor.proto b/components/model-catalog/proto-definition/proto/CommandExecutor.proto new file mode 100644 index 000000000..f488cc1b4 --- /dev/null +++ b/components/model-catalog/proto-definition/proto/CommandExecutor.proto @@ -0,0 +1,62 @@ +syntax = "proto3"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +option java_multiple_files = true; +package org.onap.ccsdk.cds.controllerblueprints.command.api; + +message ExecutionInput { + string requestId = 1; + // Optional Id used to correlate multiple requests so that it can identify previous request information. + string correlationId = 2; + // Optional Blueprint Information used to identify CBA content information in shared file structure environment. + Identifiers identifiers = 3; + ScriptType scriptType = 4; + // Actual Command to Execute in Scripting Environment + string command = 5; + int32 timeOut = 6; + // Extra Dynamic Properties for Command processing in JSON format + google.protobuf.Struct properties = 7; + // Request Time Stamp + google.protobuf.Timestamp timestamp = 8; +} + +message PrepareEnvInput { + Identifiers identifiers = 1; + string requestId = 2; + // Optional Id used to correlate multiple requests so that it can identify previous request information. + string correlationId = 3; + ScriptType scriptType = 4; + repeated string packages = 5; + int32 timeOut = 6; + google.protobuf.Struct properties = 7; + google.protobuf.Timestamp timestamp = 8; +} + +message Identifiers { + string blueprintName = 1; + string blueprintVersion = 2; +} + +message ExecutionOutput { + string requestId = 1; + string response = 2; + ResponseStatus status = 3; + google.protobuf.Timestamp timestamp = 4; +} + +enum ResponseStatus { + SUCCESS = 0; + FAILURE = 1; +} + +enum ScriptType { + PYTHON = 0; + ANSIBLE = 1; + KOTLIN = 2; + SH = 3; +} + +service CommandExecutorService { + rpc prepareEnv (PrepareEnvInput) returns (ExecutionOutput); + rpc executeCommand (ExecutionInput) returns (ExecutionOutput); +} |