summaryrefslogtreecommitdiffstats
path: root/cds-regression-test/cba/ansible-python-dg
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2020-12-04 21:44:23 +0000
committerGerrit Code Review <gerrit@onap.org>2020-12-04 21:44:23 +0000
commitbfffa2d982cc506979aaa0b96b6bb352c8dda9a7 (patch)
tree1093505679ce13406d66b9ccc5fd78884923ea37 /cds-regression-test/cba/ansible-python-dg
parent81b196b4c766c7dec927405da1a831cd437c5466 (diff)
parentd3cdace51db473c93540229da3a0fd061120957c (diff)
Merge "cds-bash script package"
Diffstat (limited to 'cds-regression-test/cba/ansible-python-dg')
-rw-r--r--cds-regression-test/cba/ansible-python-dg/Definitions/ansible-python.json175
-rw-r--r--cds-regression-test/cba/ansible-python-dg/Plans/ansible-python-dg.xml27
-rw-r--r--cds-regression-test/cba/ansible-python-dg/Scripts/rt-python.py11
-rw-r--r--cds-regression-test/cba/ansible-python-dg/TOSCA-Metadata/TOSCA.meta8
4 files changed, 221 insertions, 0 deletions
diff --git a/cds-regression-test/cba/ansible-python-dg/Definitions/ansible-python.json b/cds-regression-test/cba/ansible-python-dg/Definitions/ansible-python.json
new file mode 100644
index 0000000..eb39f30
--- /dev/null
+++ b/cds-regression-test/cba/ansible-python-dg/Definitions/ansible-python.json
@@ -0,0 +1,175 @@
+{
+ "metadata": {
+ "template_author": "Selffish",
+ "author-email": "test@bell.ca",
+ "template_name": "RT-ansible-python-dg",
+ "template_version": "1.0.0",
+ "template_tags": "Bell, CBA, test"
+ },
+ "dsl_definitions": {
+ "ansible-remote-endpoint": {
+ "type": "token-auth",
+ "url": "http://cds-regression-mockserver/ansible-python-dg/success",
+ "token": "Bearer J9gEtMDqf7P4YsJ7444fioY9VAhLDIs1"
+ },
+ "remote-executor": {
+ "type": "token-auth",
+ "host": "regression-cdsce-cds-ce",
+ "port": "50051",
+ "token": "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw=="
+ }
+ },
+ "topology_template": {
+ "workflows": {
+ "run-dg": {
+ "steps": {
+ "process": {
+ "description": "Run ansible then pass artifacts to command executor",
+ "target": "execute-dg",
+ "activities": [
+ {
+ "call_operation": ""
+ }
+ ]
+ }
+ },
+ "inputs": {
+ "endpoint-selector": {
+ "required": true,
+ "type": "string"
+ },
+ "job-template-name": {
+ "required": true,
+ "type": "string"
+ },
+ "limit": {
+ "required": false,
+ "type": "string"
+ },
+ "inventory": {
+ "required": false,
+ "type": "string"
+ },
+ "tags": {
+ "required": false,
+ "type": "string"
+ },
+ "skip-tags": {
+ "required": false,
+ "type": "string"
+ },
+ "extra-vars": {
+ "required": false,
+ "type": "json"
+ }
+ },
+ "outputs": {
+ "execute-command-logs": {
+ "type": "string",
+ "value": {
+ "get_attribute": [
+ "python",
+ "execute-command-logs"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "node_templates": {
+ "execute-dg": {
+ "type": "dg-generic",
+ "properties": {
+ "content": {
+ "get_artifact": [
+ "SELF",
+ "dg"
+ ]
+ },
+ "dependency-node-templates": [
+ "ansible",
+ "python"
+ ]
+ },
+ "artifacts": {
+ "dg": {
+ "type": "artifact-directed-graph",
+ "file": "Plans/ansible-python-dg.xml"
+ }
+ }
+ },
+ "ansible": {
+ "type": "component-remote-ansible-executor",
+ "interfaces": {
+ "ComponentRemoteAnsibleExecutor": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "endpoint-selector": "*ansible-remote-endpoint",
+ "job-template-name": {
+ "get_input": "job-template-name"
+ },
+ "limit": {
+ "get_input": "limit"
+ },
+ "inventory": {
+ "get_input": "inventory"
+ },
+ "extra-vars": {
+ "get_input": "extra-vars"
+ },
+ "tags": {
+ "get_input": "tags"
+ },
+ "skip-tags": {
+ "get_input": "skip-tags"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "python": {
+ "type": "component-remote-python-executor",
+ "interfaces": {
+ "ComponentRemotePythonExecutor": {
+ "operations": {
+ "process": {
+ "implementation": {
+ "primary": "component-script",
+ "timeout": 1800,
+ "operation_host": "SELF"
+ },
+ "inputs": {
+ "endpoint-selector": "remote-executor",
+ "command": "python rt-python.py",
+ "dynamic-properties": {
+ "get_attribute": [
+ "ansible",
+ "ansible-artifacts"
+ ]
+ },
+ "packages": [
+ {
+ "type": "pip",
+ "package": [
+ "requests"
+ ]
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "artifacts": {
+ "component-script": {
+ "type": "artifact-script-python",
+ "file": "Scripts/rt-python.py"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/cds-regression-test/cba/ansible-python-dg/Plans/ansible-python-dg.xml b/cds-regression-test/cba/ansible-python-dg/Plans/ansible-python-dg.xml
new file mode 100644
index 0000000..e00f17a
--- /dev/null
+++ b/cds-regression-test/cba/ansible-python-dg/Plans/ansible-python-dg.xml
@@ -0,0 +1,27 @@
+<service-logic
+ xmlns='http://www.onap.org/sdnc/svclogic'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='CONFIG' version='1.0.0'>
+ <method rpc='AnsiblePython' mode='sync'>
+ <block atomic="true">
+ <execute plugin="ansible" method="process">
+ <outcome value='failure'>
+ <return status="failure">
+ </return>
+ </outcome>
+ <outcome value='success'>
+ <execute plugin="python" method="process">
+ <outcome value='failure'>
+ <return status="failure">
+ </return>
+ </outcome>
+ <outcome value='success'>
+ <return status='success'>
+ </return>
+ </outcome>
+ </execute>
+ </outcome>
+ </execute>
+ </block>
+ </method>
+</service-logic> \ No newline at end of file
diff --git a/cds-regression-test/cba/ansible-python-dg/Scripts/rt-python.py b/cds-regression-test/cba/ansible-python-dg/Scripts/rt-python.py
new file mode 100644
index 0000000..76af364
--- /dev/null
+++ b/cds-regression-test/cba/ansible-python-dg/Scripts/rt-python.py
@@ -0,0 +1,11 @@
+#!/usr/bin/python
+
+import sys
+import json
+
+
+if __name__ == "__main__":
+ ansibleArtifacts = json.loads(sys.argv[1])
+ interfaceName = ansibleArtifacts["topology"]["tor-8.tenlab-cloud"][0]["interface_name"]
+ print(interfaceName)
+ sys.exit(0)
diff --git a/cds-regression-test/cba/ansible-python-dg/TOSCA-Metadata/TOSCA.meta b/cds-regression-test/cba/ansible-python-dg/TOSCA-Metadata/TOSCA.meta
new file mode 100644
index 0000000..844f38b
--- /dev/null
+++ b/cds-regression-test/cba/ansible-python-dg/TOSCA-Metadata/TOSCA.meta
@@ -0,0 +1,8 @@
+TOSCA-Meta-File-Version: 1.0.0
+CSAR-Version: 1.0
+Created-By: Selffish
+Entry-Definitions: Definitions/ansible-python.json
+Template-Tags: test, regression
+Template-Name: RT-ansible-python-dg
+Template-Version: 1.0.0
+Template-Type: DEFAULT