aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-04-19 00:30:17 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-19 00:30:17 +0000
commitf812f74460b20a2ba2d4c58e45fd9463a7209769 (patch)
tree278f9422619d36677988ead14ec569cc3e968590 /components
parentf5991756ab79209e793a9de072eb2100958c853f (diff)
parentcc96f30a504aa32030eafefdba69d635869c7949 (diff)
Merge "Add support for Ansible packages"
Diffstat (limited to 'components')
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/artifact_types.json8
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/data_types.json28
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/node_types.json10
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json62
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Scripts/ansible/first.yaml22
-rw-r--r--components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-ansible.json8
-rw-r--r--components/model-catalog/definition-type/starter-type/data_type/dt-system-packages.json26
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/component-remote-python-executor.json8
-rw-r--r--components/model-catalog/proto-definition/proto/CommandExecutor.proto27
-rw-r--r--components/model-catalog/proto-definition/proto/README12
10 files changed, 196 insertions, 15 deletions
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
index 445236354..a6a34ae8e 100644
--- 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
@@ -7,6 +7,14 @@
"file_ext": [
"py"
]
+ },
+ "artifact-script-ansible": {
+ "description": "Ansible Script file",
+ "version": "1.0.0",
+ "file_ext": [
+ "yaml"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
}
}
} \ 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
index b22e30d00..df594ab9e 100644
--- 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
@@ -1,3 +1,29 @@
{
- "data_types": {}
+ "data_types": {
+ "dt-system-packages": {
+ "description": "This represent System Package Data Type",
+ "version": "1.0.0",
+ "properties": {
+ "type": {
+ "required": true,
+ "type": "string",
+ "constraints": [
+ {
+ "valid_values": [
+ "ANSIBLE", "PYTHON"
+ ]
+ }
+ ]
+ },
+ "package": {
+ "required": true,
+ "type": "list",
+ "entry_schema" : {
+ "type" : "string"
+ }
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+ }
+ }
} \ 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
index cd63f0091..0ee00b3ba 100644
--- 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
@@ -33,7 +33,15 @@
"command": {
"description": "Command to execute.",
"required": true,
- "type": "string"
+ "type" : "string"
+ },
+ "packages": {
+ "description": "Packages to install based on type.",
+ "required": true,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "dt-system-packages"
+ }
}
}
}
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
index 464911478..80ef02f4f 100644
--- 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
@@ -51,6 +51,31 @@
}
}
}
+ },
+ "execute-remote-ansible": {
+ "steps": {
+ "execute-script": {
+ "description": "Execute Remote Ansible Script",
+ "target": "execute-remote-ansible",
+ "activities": [
+ {
+ "call_operation": ""
+ }
+ ]
+ }
+ },
+ "inputs": {},
+ "outputs": {
+ "logs": {
+ "type": "json",
+ "value": {
+ "get_attribute": [
+ "execute-remote-ansible",
+ "execution-logs"
+ ]
+ }
+ }
+ }
}
},
"node_templates": {
@@ -79,6 +104,43 @@
"file": "Scripts/python/SamplePython.py"
}
}
+ },
+ "execute-remote-ansible": {
+ "type": "component-remote-python-executor",
+ "interfaces": {
+ "ComponentRemotePythonExecutor": {
+ "operations": {
+ "process": {
+ "implementation": {
+ "primary": "component-script"
+ },
+ "inputs": {
+ "command": "ansible-playbook first.yaml",
+ "packages": [
+ {
+ "type": "PYTHON",
+ "package": [
+ "ansible"
+ ]
+ },
+ {
+ "type": "ANSIBLE",
+ "package": [
+ "juniper.junos"
+ ]
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "artifacts": {
+ "component-script": {
+ "type": "artifact-script-ansible",
+ "file": "Scripts/ansible/first.yaml"
+ }
+ }
}
}
}
diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Scripts/ansible/first.yaml b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Scripts/ansible/first.yaml
new file mode 100644
index 000000000..78d292e10
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Scripts/ansible/first.yaml
@@ -0,0 +1,22 @@
+---
+- name: Get Device Facts
+ hosts: dc1
+ roles:
+ - juniper.junos
+ connection: local
+ gather_facts: no
+
+ tasks:
+ - name: Checking NETCONF connectivity
+ wait_for:
+ host: "{{ inventory_hostname }}"
+ port: 830
+ timeout: 5
+
+ - name: Retrieving information from devices running Junos OS
+ juniper_junos_facts:
+ host: "{{ inventory_hostname }}"
+
+ - name: Print version
+ debug:
+ var: junos.version \ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-ansible.json b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-ansible.json
new file mode 100644
index 000000000..943186d13
--- /dev/null
+++ b/components/model-catalog/definition-type/starter-type/artifact_type/artifact-script-ansible.json
@@ -0,0 +1,8 @@
+{
+ "description": "Ansible Script file",
+ "version": "1.0.0",
+ "file_ext": [
+ "yaml"
+ ],
+ "derived_from": "tosca.artifacts.Implementation"
+} \ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/data_type/dt-system-packages.json b/components/model-catalog/definition-type/starter-type/data_type/dt-system-packages.json
new file mode 100644
index 000000000..81bb030b4
--- /dev/null
+++ b/components/model-catalog/definition-type/starter-type/data_type/dt-system-packages.json
@@ -0,0 +1,26 @@
+{
+ "description": "This represent System Package Data Type",
+ "version": "1.0.0",
+ "properties": {
+ "type": {
+ "required": true,
+ "type": "string",
+ "constraints": [
+ {
+ "valid_values": [
+ "ANSIBLE",
+ "PYTHON"
+ ]
+ }
+ ]
+ },
+ "package": {
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+} \ 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
index 99a4dd8dc..3eaee761f 100644
--- 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
@@ -32,6 +32,14 @@
"description": "Command to execute.",
"required": true,
"type": "string"
+ },
+ "packages": {
+ "description": "Packages to install based on type.",
+ "required": true,
+ "type" : "list",
+ "entry_schema" : {
+ "type" : "dt-system-packages"
+ }
}
}
}
diff --git a/components/model-catalog/proto-definition/proto/CommandExecutor.proto b/components/model-catalog/proto-definition/proto/CommandExecutor.proto
index f488cc1b4..8f02b8aea 100644
--- a/components/model-catalog/proto-definition/proto/CommandExecutor.proto
+++ b/components/model-catalog/proto-definition/proto/CommandExecutor.proto
@@ -10,14 +10,13 @@ message ExecutionInput {
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;
+ string command = 4;
+ int32 timeOut = 5;
// Extra Dynamic Properties for Command processing in JSON format
- google.protobuf.Struct properties = 7;
+ google.protobuf.Struct properties = 6;
// Request Time Stamp
- google.protobuf.Timestamp timestamp = 8;
+ google.protobuf.Timestamp timestamp = 7;
}
message PrepareEnvInput {
@@ -25,11 +24,10 @@ message PrepareEnvInput {
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;
+ repeated Packages packages = 4;
+ int32 timeOut = 5;
+ google.protobuf.Struct properties = 6;
+ google.protobuf.Timestamp timestamp = 7;
}
message Identifiers {
@@ -49,11 +47,14 @@ enum ResponseStatus {
FAILURE = 1;
}
-enum ScriptType {
+message Packages {
+ PackageType type = 1;
+ repeated string package = 2;
+}
+
+enum PackageType {
PYTHON = 0;
ANSIBLE = 1;
- KOTLIN = 2;
- SH = 3;
}
service CommandExecutorService {
diff --git a/components/model-catalog/proto-definition/proto/README b/components/model-catalog/proto-definition/proto/README
new file mode 100644
index 000000000..47bbf3f34
--- /dev/null
+++ b/components/model-catalog/proto-definition/proto/README
@@ -0,0 +1,12 @@
+To create python bindings,
+
+Prerequisites:
+ https://developers.google.com/protocol-buffers/docs/downloads
+ https://github.com/dropbox/mypy-protobuf
+
+
+Command:
+ protoc -I=. --python_out=. --mypy_out=. CommandExecutor.proto
+
+
+