From e92fce768cb792f11920f45fdbb38b3af69e212f Mon Sep 17 00:00:00 2001 From: Jozsef Csongvai Date: Tue, 19 Jan 2021 12:32:04 -0500 Subject: Update to latest version Issue-ID: TEST-295 Signed-off-by: Jozsef Csongvai Change-Id: Ie14e2061c1e0931bf3d555e54c79bb736d140d5c --- .coafile | 23 +- .gitignore | 6 + .../Definitions/ansible-python.json | 175 ++++++++++++ cba/ansible-python-dg/Plans/ansible-python-dg.xml | 27 ++ cba/ansible-python-dg/Scripts/rt-python.py | 26 ++ cba/ansible-python-dg/TOSCA-Metadata/TOSCA.meta | 8 + cba/cli/Definitions/cli.json | 113 ++++++++ cba/cli/Scripts/kotlin/cli/cli.kt | 59 ++++ cba/cli/TOSCA-Metadata/TOSCA.meta | 8 + cba/lock-device/Definitions/lock-device.json | 98 +++++++ cba/lock-device/Scripts/kotlin/ProcessOperation.kt | 49 ++++ cba/lock-device/TOSCA-Metadata/TOSCA.meta | 8 + cba/lock-device/Templates/base-mapping.json | 23 ++ cba/netconf/Definitions/netconf.json | 137 +++++++++ cba/netconf/Scripts/kotlin/kotlin.kt | 63 ++++ cba/netconf/Scripts/python/NetconfTest.py | 56 ++++ cba/netconf/TOSCA-Metadata/TOSCA.meta | 8 + cba/py-executor/.DS_Store | Bin 0 -> 6148 bytes cba/py-executor/Definitions/py-executor.json | 174 +++++++++++ cba/py-executor/Scripts/python/__init__.py | 18 ++ cba/py-executor/Scripts/python/failing_script.py | 34 +++ cba/py-executor/Scripts/python/hello_world.py | 42 +++ cba/py-executor/TOSCA-Metadata/TOSCA.meta | 8 + cba/remote-ansible/Definitions/remote-ansible.json | 281 ++++++++++++++++++ cba/remote-ansible/TOSCA-Metadata/TOSCA.meta | 8 + cba/remote-python/Definitions/remote-python.json | 229 +++++++++++++++ .../Scripts/python/EchoRemotePython.py | 28 ++ .../Scripts/python/FailingRemotePython.py | 30 ++ cba/remote-python/TOSCA-Metadata/TOSCA.meta | 8 + .../Definitions/resource-resolution.json | 98 +++++++ .../Scripts/kotlin/ResolvProperties.kt | 64 +++++ .../Scripts/python/ResolvProperties.py | 40 +++ cba/resource-resolution/TOSCA-Metadata/TOSCA.meta | 8 + .../Templates/hello-world-jinja-mapping.json | 127 +++++++++ .../Templates/hello-world-template.jinja | 20 ++ .../Templates/hello-world-template.vtl | 16 ++ .../Templates/hello-world-velocity-mapping.json | 105 +++++++ .../Definitions/retrieve-resolution.json | 120 ++++++++ .../Scripts/kotlin/ResolvProperties.kt | 64 +++++ .../Scripts/kotlin/ResolvProperties1.kt | 36 +++ .../Scripts/kotlin/ResolvProperties2.kt | 36 +++ .../Scripts/kotlin/ResolvProperties3.kt | 35 +++ .../Scripts/kotlin/ResolvProperties4.kt | 38 +++ .../Scripts/kotlin/RetrieveResolution.kt | 63 ++++ cba/retrieve-resolution/TOSCA-Metadata/TOSCA.meta | 8 + .../Templates/hello-world-template.vtl | 7 + .../Templates/hello-world-velocity-mapping.json | 52 ++++ .../Definitions/ansible-python.json | 175 ------------ .../ansible-python-dg/Plans/ansible-python-dg.xml | 27 -- .../cba/ansible-python-dg/Scripts/rt-python.py | 11 - .../ansible-python-dg/TOSCA-Metadata/TOSCA.meta | 8 - .../Definitions/ansible-python.json | 175 ------------ .../ansible-python-dg/Plans/ansible-python-dg.xml | 27 -- .../cba/cba/ansible-python-dg/Scripts/rt-python.py | 11 - .../ansible-python-dg/TOSCA-Metadata/TOSCA.meta | 8 - .../cba/cba/cli/elalto/Definitions/cli.json | 106 ------- .../cba/cba/cli/elalto/Scripts/kotlin/cli/cli.kt | 59 ---- .../cba/cba/cli/elalto/TOSCA-Metadata/TOSCA.meta | 8 - .../cba/cba/cli/frankfurt/Definitions/cli.json | 113 -------- .../cba/cli/frankfurt/Scripts/kotlin/cli/cli.kt | 59 ---- .../cba/cli/frankfurt/TOSCA-Metadata/TOSCA.meta | 8 - .../cba/lock-device/Definitions/lock-device.json | 98 ------- .../lock-device/Scripts/kotlin/ProcessOperation.kt | 49 ---- .../cba/cba/lock-device/TOSCA-Metadata/TOSCA.meta | 8 - .../cba/lock-device/Templates/base-mapping.json | 23 -- .../cba/cba/netconf/Definitions/netconf.json | 137 --------- .../cba/cba/netconf/Scripts/kotlin/kotlin.kt | 47 --- .../cba/cba/netconf/Scripts/python/NetconfTest.py | 53 ---- .../cba/cba/netconf/TOSCA-Metadata/TOSCA.meta | 8 - cds-regression-test/cba/cba/py-executor/.DS_Store | Bin 6148 -> 0 bytes .../cba/py-executor/Definitions/py-executor.json | 174 ----------- .../cba/cba/py-executor/Scripts/python/__init__.py | 16 -- .../py-executor/Scripts/python/failing_script.py | 34 --- .../cba/py-executor/Scripts/python/hello_world.py | 41 --- .../cba/cba/py-executor/TOSCA-Metadata/TOSCA.meta | 8 - .../remote-ansible/Definitions/remote-ansible.json | 317 --------------------- .../cba/remote-ansible/TOSCA-Metadata/TOSCA.meta | 8 - .../remote-python/Definitions/remote-python.json | 229 --------------- .../Scripts/python/EchoRemotePython.py | 13 - .../Scripts/python/FailingRemotePython.py | 15 - .../cba/remote-python/TOSCA-Metadata/TOSCA.meta | 8 - .../Definitions/resource-resolution.json | 99 ------- .../Scripts/kotlin/ResolvProperties.kt | 49 ---- .../Scripts/python/ResolvProperties.py | 40 --- .../resource-resolution/TOSCA-Metadata/TOSCA.meta | 8 - .../Templates/hello-world-jinja-mapping.json | 115 -------- .../Templates/hello-world-template.jinja | 19 -- .../Templates/hello-world-template.vtl | 16 -- .../Templates/hello-world-velocity-mapping.json | 105 ------- .../cba/cli/elalto/Definitions/cli.json | 106 ------- .../cba/cli/elalto/Scripts/kotlin/cli/cli.kt | 59 ---- .../cba/cli/elalto/TOSCA-Metadata/TOSCA.meta | 8 - .../cba/cli/frankfurt/Definitions/cli.json | 113 -------- .../cba/cli/frankfurt/Scripts/kotlin/cli/cli.kt | 59 ---- .../cba/cli/frankfurt/TOSCA-Metadata/TOSCA.meta | 8 - .../cba/lock-device/Definitions/lock-device.json | 98 ------- .../lock-device/Scripts/kotlin/ProcessOperation.kt | 49 ---- .../cba/lock-device/TOSCA-Metadata/TOSCA.meta | 8 - .../cba/lock-device/Templates/base-mapping.json | 23 -- .../cba/netconf/Definitions/netconf.json | 137 --------- .../cba/netconf/Scripts/kotlin/kotlin.kt | 47 --- .../cba/netconf/Scripts/python/NetconfTest.py | 53 ---- .../cba/netconf/TOSCA-Metadata/TOSCA.meta | 8 - cds-regression-test/cba/py-executor/.DS_Store | Bin 6148 -> 0 bytes .../cba/py-executor/Definitions/py-executor.json | 174 ----------- .../cba/py-executor/Scripts/python/__init__.py | 16 -- .../py-executor/Scripts/python/failing_script.py | 34 --- .../cba/py-executor/Scripts/python/hello_world.py | 41 --- .../cba/py-executor/TOSCA-Metadata/TOSCA.meta | 8 - .../remote-ansible/Definitions/remote-ansible.json | 317 --------------------- .../cba/remote-ansible/TOSCA-Metadata/TOSCA.meta | 8 - .../remote-python/Definitions/remote-python.json | 229 --------------- .../Scripts/python/EchoRemotePython.py | 13 - .../Scripts/python/FailingRemotePython.py | 15 - .../cba/remote-python/TOSCA-Metadata/TOSCA.meta | 8 - .../Definitions/resource-resolution.json | 99 ------- .../Scripts/kotlin/ResolvProperties.kt | 49 ---- .../Scripts/python/ResolvProperties.py | 40 --- .../resource-resolution/TOSCA-Metadata/TOSCA.meta | 8 - .../Templates/hello-world-jinja-mapping.json | 115 -------- .../Templates/hello-world-template.jinja | 19 -- .../Templates/hello-world-template.vtl | 16 -- .../Templates/hello-world-velocity-mapping.json | 105 ------- .../mockserver/mockserver-deployment.yaml | 21 -- .../mockserver/mockserver-service.yaml | 12 - .../dependencies/odl-test-tool/Dockerfile | 8 - .../odl-test-tool/testtool-deployment.yaml | 22 -- .../odl-test-tool/testtool-service.yaml | 10 - .../dependencies/python3/Dockerfile | 3 - .../dependencies/ssh-mock/Dockerfile | 4 - .../dependencies/ssh-mock/create-user.sh | 17 -- .../dependencies/ssh-mock/sshd_config | 115 -------- .../dependencies/ssh-mock/sshmock-deployment.yaml | 22 -- .../dependencies/ssh-mock/sshmock-service.yaml | 10 - cds-regression-test/init-mockserver-job.yml | 42 --- .../ansible-python-dg-enrichment-test.sh | 16 -- .../ansible-python-dg-upload-test.sh | 20 -- .../ansible-python-dg/dummy-request-payload.json | 14 - .../test/ansible-python-dg/init-mockserver.sh | 35 --- .../mock-payloads/get_job-template-launch.json | 46 --- .../ansible-python-dg/mock-payloads/inventory.json | 110 ------- .../mock-payloads/job-execution.json | 216 -------------- .../mock-payloads/job-output.json | 24 -- .../mock-payloads/job-template.json | 224 --------------- .../mock-payloads/post_job-template-launch.json | 144 ---------- .../success/expected-response.json | 30 -- .../ansible-python-dg/success/request-payload.json | 27 -- .../test/ansible-python-dg/success/test.sh | 25 -- cds-regression-test/test/bootstrap.sh | 19 -- .../test/cli/cli-enrichment-test.sh | 16 -- cds-regression-test/test/cli/cli-upload-test.sh | 20 -- .../resources/elalto/expected-response.json | 27 -- .../resources/elalto/request-payload.json | 25 -- .../resources/frankfurt/expected-response.json | 34 --- .../resources/frankfurt/request-payload.json | 26 -- cds-regression-test/test/cli/command-fail/test.sh | 30 -- .../test/cli/dummy-request-payload.json | 14 - .../resources/elalto/expected-response.json | 27 -- .../success/resources/elalto/request-payload.json | 26 -- .../resources/frankfurt/expected-response.json | 38 --- .../resources/frankfurt/request-payload.json | 27 -- cds-regression-test/test/cli/success/test.sh | 25 -- cds-regression-test/test/exit_on_failure.sh | 8 - .../test/lock-device/dummy-request-payload.json | 14 - .../lock-device/lock-device-enrichment-test.sh | 21 -- .../test/lock-device/lock-device-upload-test.sh | 25 -- .../expected-payloads/expected-payload-1.json | 28 -- .../expected-payloads/expected-payload-2.json | 28 -- .../expected-payloads/expected-payload-3.json | 26 -- .../expected-payloads/expected-payload-4.json | 26 -- .../request-payloads/request-payload-1.json | 20 -- .../request-payloads/request-payload-2.json | 20 -- .../request-payloads/request-payload-3.json | 20 -- .../request-payloads/request-payload-4.json | 20 -- .../test/lock-device/success/test.sh | 48 ---- .../test/netconf/dummy-request-payload.json | 14 - .../jython/connect-fail/expected-response.json | 29 -- .../jython/connect-fail/request-payload.json | 19 -- .../test/netconf/jython/connect-fail/test.sh | 26 -- .../netconf/jython/success/expected-response.json | 29 -- .../netconf/jython/success/request-payload.json | 19 -- .../test/netconf/jython/success/test.sh | 26 -- .../kotlin/connect-fail/expected-response.json | 29 -- .../kotlin/connect-fail/request-payload.json | 19 -- .../test/netconf/kotlin/connect-fail/test.sh | 26 -- .../netconf/kotlin/success/expected-response.json | 29 -- .../netconf/kotlin/success/request-payload.json | 19 -- .../test/netconf/kotlin/success/test.sh | 26 -- .../test/netconf/netconf-enrichment-test.sh | 17 -- .../test/netconf/netconf-upload-test.sh | 20 -- .../connection-fail/expected-response.json | 25 -- .../connection-fail/request-payload.json | 16 -- .../test/py-executor/connection-fail/test.sh | 25 -- .../test/py-executor/dummy-request-payload.json | 14 - .../failing-script/expected-response.json | 25 -- .../failing-script/request-payload.json | 16 -- .../test/py-executor/failing-script/test.sh | 25 -- .../py-executor/py-executor-enrichment-test.sh | 23 -- .../test/py-executor/py-executor-upload-test.sh | 27 -- .../py-executor/success/expected-response.json | 32 --- .../test/py-executor/success/request-payload.json | 16 -- .../test/py-executor/success/test.sh | 25 -- .../connection-failure/expected-response.json | 28 -- .../connection-failure/request-payload.json | 27 -- .../test/remote-ansible/connection-failure/test.sh | 25 -- .../test/remote-ansible/dummy-request-payload.json | 14 - .../resources/elalto/expected-response.json | 28 -- .../failure/resources/elalto/request-payload.json | 27 -- .../resources/frankfurt/expected-response.json | 29 -- .../resources/frankfurt/request-payload.json | 27 -- .../test/remote-ansible/failure/test.sh | 26 -- .../test/remote-ansible/init-mockserver.sh | 39 --- .../mock-payloads/get_job-template-launch.json | 46 --- .../remote-ansible/mock-payloads/inventory.json | 110 ------- .../mock-payloads/job-execution.json | 183 ------------ .../remote-ansible/mock-payloads/job-output.json | 24 -- .../mock-payloads/job-template-error.json | 8 - .../remote-ansible/mock-payloads/job-template.json | 224 --------------- .../mock-payloads/post_job-template-launch.json | 144 ---------- .../remote-ansible-enrichment-test.sh | 16 -- .../remote-ansible/remote-ansible-upload-test.sh | 20 -- .../remote-ansible/success/expected-response.json | 29 -- .../remote-ansible/success/request-payload.json | 27 -- .../test/remote-ansible/success/test.sh | 25 -- .../resources/elalto/expected-response.json | 29 -- .../resources/elalto/request-payload.json | 16 -- .../resources/frankfurt/expected-response.json | 29 -- .../resources/frankfurt/request-payload.json | 16 -- .../test/remote-python/connection-fail/test.sh | 26 -- .../test/remote-python/dummy-request-payload.json | 14 - .../failing-script/expected-response.json | 33 --- .../failing-script/request-payload.json | 16 -- .../test/remote-python/failing-script/test.sh | 25 -- .../remote-python/remote-python-enrichment-test.sh | 16 -- .../remote-python/remote-python-upload-test.sh | 20 -- .../remote-python/success/expected-response.json | 36 --- .../remote-python/success/request-payload.json | 16 -- .../test/remote-python/success/test.sh | 25 -- .../test/reset-verify-mockserver.sh | 10 - .../test/resource-resolution/data-dict/RT-db.json | 30 -- .../resource-resolution/data-dict/RT-kotlin.json | 26 -- .../data-dict/RT-rest-delete.json | 32 --- .../resource-resolution/data-dict/RT-rest-get.json | 32 --- .../data-dict/RT-rest-patch.json | 32 --- .../data-dict/RT-rest-post.json | 32 --- .../resource-resolution/data-dict/RT-rest-put.json | 32 --- .../resource-resolution/dummy-request-payload.json | 14 - .../expected-payloads/expected-response-1.json | 31 -- .../expected-payloads/expected-response-2.json | 31 -- .../request-payloads/request-payload-1.json | 26 -- .../request-payloads/request-payload-2.json | 26 -- .../resource-resolution/force-resolution/test.sh | 44 --- .../test/resource-resolution/init-mockserver.sh | 51 ---- .../resource-resolution-enrichment-test.sh | 16 -- .../resource-resolution-upload-dd.sh | 29 -- .../resource-resolution-upload-test.sh | 20 -- .../expected-payloads/expected-response.json | 31 -- .../success/request-payloads/request-payload.json | 26 -- .../test/resource-resolution/success/test.sh | 25 -- .../ansible-python-dg-enrichment-test.sh | 16 -- .../ansible-python-dg-upload-test.sh | 20 -- .../ansible-python-dg/dummy-request-payload.json | 14 - .../test/test/ansible-python-dg/init-mockserver.sh | 35 --- .../mock-payloads/get_job-template-launch.json | 46 --- .../ansible-python-dg/mock-payloads/inventory.json | 110 ------- .../mock-payloads/job-execution.json | 216 -------------- .../mock-payloads/job-output.json | 24 -- .../mock-payloads/job-template.json | 224 --------------- .../mock-payloads/post_job-template-launch.json | 144 ---------- .../success/expected-response.json | 30 -- .../ansible-python-dg/success/request-payload.json | 27 -- .../test/test/ansible-python-dg/success/test.sh | 25 -- cds-regression-test/test/test/bootstrap.sh | 19 -- .../test/test/cli/cli-enrichment-test.sh | 16 -- .../test/test/cli/cli-upload-test.sh | 20 -- .../resources/elalto/expected-response.json | 27 -- .../resources/elalto/request-payload.json | 25 -- .../resources/frankfurt/expected-response.json | 34 --- .../resources/frankfurt/request-payload.json | 26 -- .../test/test/cli/command-fail/test.sh | 30 -- .../test/test/cli/dummy-request-payload.json | 14 - .../resources/elalto/expected-response.json | 27 -- .../success/resources/elalto/request-payload.json | 26 -- .../resources/frankfurt/expected-response.json | 38 --- .../resources/frankfurt/request-payload.json | 27 -- cds-regression-test/test/test/cli/success/test.sh | 25 -- cds-regression-test/test/test/exit_on_failure.sh | 8 - .../test/lock-device/dummy-request-payload.json | 14 - .../lock-device/lock-device-enrichment-test.sh | 21 -- .../test/lock-device/lock-device-upload-test.sh | 25 -- .../expected-payloads/expected-payload-1.json | 28 -- .../expected-payloads/expected-payload-2.json | 28 -- .../expected-payloads/expected-payload-3.json | 26 -- .../expected-payloads/expected-payload-4.json | 26 -- .../request-payloads/request-payload-1.json | 20 -- .../request-payloads/request-payload-2.json | 20 -- .../request-payloads/request-payload-3.json | 20 -- .../request-payloads/request-payload-4.json | 20 -- .../test/test/lock-device/success/test.sh | 48 ---- .../test/test/netconf/dummy-request-payload.json | 14 - .../jython/connect-fail/expected-response.json | 29 -- .../jython/connect-fail/request-payload.json | 19 -- .../test/test/netconf/jython/connect-fail/test.sh | 26 -- .../netconf/jython/success/expected-response.json | 29 -- .../netconf/jython/success/request-payload.json | 19 -- .../test/test/netconf/jython/success/test.sh | 26 -- .../kotlin/connect-fail/expected-response.json | 29 -- .../kotlin/connect-fail/request-payload.json | 19 -- .../test/test/netconf/kotlin/connect-fail/test.sh | 26 -- .../netconf/kotlin/success/expected-response.json | 29 -- .../netconf/kotlin/success/request-payload.json | 19 -- .../test/test/netconf/kotlin/success/test.sh | 26 -- .../test/test/netconf/netconf-enrichment-test.sh | 17 -- .../test/test/netconf/netconf-upload-test.sh | 20 -- .../connection-fail/expected-response.json | 25 -- .../connection-fail/request-payload.json | 16 -- .../test/test/py-executor/connection-fail/test.sh | 25 -- .../test/py-executor/dummy-request-payload.json | 14 - .../failing-script/expected-response.json | 25 -- .../failing-script/request-payload.json | 16 -- .../test/test/py-executor/failing-script/test.sh | 25 -- .../py-executor/py-executor-enrichment-test.sh | 23 -- .../test/py-executor/py-executor-upload-test.sh | 27 -- .../py-executor/success/expected-response.json | 32 --- .../test/py-executor/success/request-payload.json | 16 -- .../test/test/py-executor/success/test.sh | 25 -- .../connection-failure/expected-response.json | 28 -- .../connection-failure/request-payload.json | 27 -- .../test/remote-ansible/connection-failure/test.sh | 25 -- .../test/remote-ansible/dummy-request-payload.json | 14 - .../resources/elalto/expected-response.json | 28 -- .../failure/resources/elalto/request-payload.json | 27 -- .../resources/frankfurt/expected-response.json | 29 -- .../resources/frankfurt/request-payload.json | 27 -- .../test/test/remote-ansible/failure/test.sh | 26 -- .../test/test/remote-ansible/init-mockserver.sh | 39 --- .../mock-payloads/get_job-template-launch.json | 46 --- .../remote-ansible/mock-payloads/inventory.json | 110 ------- .../mock-payloads/job-execution.json | 183 ------------ .../remote-ansible/mock-payloads/job-output.json | 24 -- .../mock-payloads/job-template-error.json | 8 - .../remote-ansible/mock-payloads/job-template.json | 224 --------------- .../mock-payloads/post_job-template-launch.json | 144 ---------- .../remote-ansible-enrichment-test.sh | 16 -- .../remote-ansible/remote-ansible-upload-test.sh | 20 -- .../remote-ansible/success/expected-response.json | 29 -- .../remote-ansible/success/request-payload.json | 27 -- .../test/test/remote-ansible/success/test.sh | 25 -- .../resources/elalto/expected-response.json | 29 -- .../resources/elalto/request-payload.json | 16 -- .../resources/frankfurt/expected-response.json | 29 -- .../resources/frankfurt/request-payload.json | 16 -- .../test/remote-python/connection-fail/test.sh | 26 -- .../test/remote-python/dummy-request-payload.json | 14 - .../failing-script/expected-response.json | 33 --- .../failing-script/request-payload.json | 16 -- .../test/test/remote-python/failing-script/test.sh | 25 -- .../remote-python/remote-python-enrichment-test.sh | 16 -- .../remote-python/remote-python-upload-test.sh | 20 -- .../remote-python/success/expected-response.json | 36 --- .../remote-python/success/request-payload.json | 16 -- .../test/test/remote-python/success/test.sh | 25 -- .../test/test/reset-verify-mockserver.sh | 10 - .../test/resource-resolution/data-dict/RT-db.json | 30 -- .../resource-resolution/data-dict/RT-kotlin.json | 26 -- .../data-dict/RT-rest-delete.json | 32 --- .../resource-resolution/data-dict/RT-rest-get.json | 32 --- .../data-dict/RT-rest-patch.json | 32 --- .../data-dict/RT-rest-post.json | 32 --- .../resource-resolution/data-dict/RT-rest-put.json | 32 --- .../resource-resolution/dummy-request-payload.json | 14 - .../expected-payloads/expected-response-1.json | 31 -- .../expected-payloads/expected-response-2.json | 31 -- .../request-payloads/request-payload-1.json | 26 -- .../request-payloads/request-payload-2.json | 26 -- .../resource-resolution/force-resolution/test.sh | 44 --- .../test/resource-resolution/init-mockserver.sh | 51 ---- .../resource-resolution-enrichment-test.sh | 16 -- .../resource-resolution-upload-dd.sh | 29 -- .../resource-resolution-upload-test.sh | 20 -- .../expected-payloads/expected-response.json | 31 -- .../success/request-payloads/request-payload.json | 26 -- .../test/test/resource-resolution/success/test.sh | 25 -- cds-regression-test/test/test/utils.sh | 242 ---------------- cds-regression-test/test/utils.sh | 242 ---------------- .../ansible-python-dg-enrichment-test.sh | 36 +++ .../ansible-python-dg-upload-test.sh | 36 +++ test/ansible-python-dg/dummy-request-payload.json | 14 + test/ansible-python-dg/init-mockserver.sh | 67 +++++ .../mock-payloads/get_job-template-launch.json | 46 +++ .../ansible-python-dg/mock-payloads/inventory.json | 110 +++++++ .../mock-payloads/job-execution.json | 216 ++++++++++++++ .../mock-payloads/job-output.json | 24 ++ .../mock-payloads/job-template.json | 224 +++++++++++++++ .../mock-payloads/post_job-template-launch.json | 144 ++++++++++ .../success/expected-response.json | 30 ++ .../ansible-python-dg/success/request-payload.json | 27 ++ test/ansible-python-dg/success/test.sh | 40 +++ test/bootstrap.sh | 31 ++ test/cli/cli-enrichment-test.sh | 32 +++ test/cli/cli-upload-test.sh | 36 +++ test/cli/command-fail/expected-response.json | 34 +++ test/cli/command-fail/request-payload.json | 26 ++ test/cli/command-fail/test.sh | 41 +++ test/cli/dummy-request-payload.json | 14 + test/cli/success/expected-response.json | 38 +++ test/cli/success/request-payload.json | 27 ++ test/cli/success/test.sh | 41 +++ test/exit_on_failure.sh | 23 ++ test/lock-device/dummy-request-payload.json | 14 + test/lock-device/lock-device-enrichment-test.sh | 32 +++ test/lock-device/lock-device-upload-test.sh | 36 +++ .../expected-payloads/expected-payload-1.json | 28 ++ .../expected-payloads/expected-payload-2.json | 26 ++ .../expected-payloads/expected-payload-3.json | 28 ++ .../expected-payloads/expected-payload-4.json | 26 ++ .../request-payloads/request-payload-1.json | 20 ++ .../request-payloads/request-payload-2.json | 20 ++ .../request-payloads/request-payload-3.json | 20 ++ .../request-payloads/request-payload-4.json | 20 ++ test/lock-device/success/test.sh | 62 ++++ test/netconf/dummy-request-payload.json | 14 + .../jython/connect-fail/expected-response.json | 29 ++ .../jython/connect-fail/request-payload.json | 19 ++ test/netconf/jython/connect-fail/test.sh | 41 +++ test/netconf/jython/success/expected-response.json | 29 ++ test/netconf/jython/success/request-payload.json | 19 ++ test/netconf/jython/success/test.sh | 41 +++ .../kotlin/connect-fail/expected-response.json | 29 ++ .../kotlin/connect-fail/request-payload.json | 19 ++ test/netconf/kotlin/connect-fail/test.sh | 41 +++ test/netconf/kotlin/success/expected-response.json | 29 ++ test/netconf/kotlin/success/request-payload.json | 19 ++ test/netconf/kotlin/success/test.sh | 41 +++ test/netconf/netconf-enrichment-test.sh | 33 +++ test/netconf/netconf-upload-test.sh | 36 +++ .../connection-fail/expected-response.json | 25 ++ .../connection-fail/request-payload.json | 16 ++ test/py-executor/connection-fail/test.sh | 40 +++ test/py-executor/dummy-request-payload.json | 14 + .../failing-script/expected-response.json | 25 ++ .../failing-script/request-payload.json | 16 ++ test/py-executor/failing-script/test.sh | 40 +++ test/py-executor/py-executor-enrichment-test.sh | 34 +++ test/py-executor/py-executor-upload-test.sh | 36 +++ test/py-executor/success/expected-response.json | 32 +++ test/py-executor/success/request-payload.json | 16 ++ test/py-executor/success/test.sh | 40 +++ .../connection-failure/expected-response.json | 28 ++ .../connection-failure/request-payload.json | 27 ++ test/remote-ansible/connection-failure/test.sh | 40 +++ test/remote-ansible/dummy-request-payload.json | 14 + test/remote-ansible/failure/expected-response.json | 29 ++ test/remote-ansible/failure/request-payload.json | 27 ++ test/remote-ansible/failure/test.sh | 41 +++ test/remote-ansible/init-mockserver.sh | 75 +++++ .../mock-payloads/get_job-template-launch.json | 46 +++ test/remote-ansible/mock-payloads/inventory.json | 110 +++++++ .../mock-payloads/job-execution.json | 183 ++++++++++++ test/remote-ansible/mock-payloads/job-output.json | 24 ++ .../mock-payloads/job-template-error.json | 8 + .../remote-ansible/mock-payloads/job-template.json | 224 +++++++++++++++ .../mock-payloads/post_job-template-launch.json | 144 ++++++++++ .../remote-ansible-enrichment-test.sh | 36 +++ test/remote-ansible/remote-ansible-upload-test.sh | 36 +++ test/remote-ansible/success/expected-response.json | 29 ++ test/remote-ansible/success/request-payload.json | 27 ++ test/remote-ansible/success/test.sh | 40 +++ .../connection-fail/expected-response.json | 29 ++ .../connection-fail/request-payload.json | 16 ++ test/remote-python/connection-fail/test.sh | 41 +++ test/remote-python/dummy-request-payload.json | 14 + .../failing-script/expected-response.json | 33 +++ .../failing-script/request-payload.json | 16 ++ test/remote-python/failing-script/test.sh | 40 +++ .../remote-python/remote-python-enrichment-test.sh | 34 +++ test/remote-python/remote-python-upload-test.sh | 36 +++ test/remote-python/success/expected-response.json | 36 +++ test/remote-python/success/request-payload.json | 16 ++ test/remote-python/success/test.sh | 40 +++ test/resource-resolution/data-dict/RT-db.json | 30 ++ test/resource-resolution/data-dict/RT-kotlin.json | 26 ++ .../data-dict/RT-rest-delete.json | 32 +++ .../data-dict/RT-rest-get-id.json | 34 +++ .../resource-resolution/data-dict/RT-rest-get.json | 32 +++ .../data-dict/RT-rest-patch.json | 32 +++ .../data-dict/RT-rest-post.json | 32 +++ .../resource-resolution/data-dict/RT-rest-put.json | 32 +++ .../resource-resolution/dummy-request-payload.json | 14 + test/resource-resolution/init-mockserver.sh | 93 ++++++ .../resource-resolution-enrichment-test.sh | 37 +++ .../resource-resolution-upload-dd.sh | 44 +++ .../resource-resolution-upload-test.sh | 36 +++ .../expected-payloads/expected-response.json | 31 ++ .../success/request-payloads/request-payload.json | 26 ++ test/resource-resolution/success/test.sh | 40 +++ .../retrieve-resolution/data-dict/RT-kotlin-1.json | 26 ++ .../retrieve-resolution/data-dict/RT-kotlin-2.json | 26 ++ .../retrieve-resolution/data-dict/RT-kotlin-3.json | 26 ++ .../retrieve-resolution/data-dict/RT-kotlin-4.json | 26 ++ .../retrieve-resolution/dummy-request-payload.json | 14 + .../retrieve-resolution-enrichment-test.sh | 32 +++ .../retrieve-resolution-upload-dd.sh | 44 +++ .../retrieve-resolution-upload-test.sh | 36 +++ .../expected-payloads/expected-response.json | 45 +++ .../request-payloads/request-payload.json | 25 ++ test/retrieve-resolution/retrieve-success/test.sh | 40 +++ test/utils.sh | 259 +++++++++++++++++ 508 files changed, 7851 insertions(+), 13884 deletions(-) create mode 100644 .gitignore create mode 100644 cba/ansible-python-dg/Definitions/ansible-python.json create mode 100644 cba/ansible-python-dg/Plans/ansible-python-dg.xml create mode 100644 cba/ansible-python-dg/Scripts/rt-python.py create mode 100644 cba/ansible-python-dg/TOSCA-Metadata/TOSCA.meta create mode 100644 cba/cli/Definitions/cli.json create mode 100755 cba/cli/Scripts/kotlin/cli/cli.kt create mode 100755 cba/cli/TOSCA-Metadata/TOSCA.meta create mode 100644 cba/lock-device/Definitions/lock-device.json create mode 100755 cba/lock-device/Scripts/kotlin/ProcessOperation.kt create mode 100644 cba/lock-device/TOSCA-Metadata/TOSCA.meta create mode 100644 cba/lock-device/Templates/base-mapping.json create mode 100644 cba/netconf/Definitions/netconf.json create mode 100644 cba/netconf/Scripts/kotlin/kotlin.kt create mode 100644 cba/netconf/Scripts/python/NetconfTest.py create mode 100644 cba/netconf/TOSCA-Metadata/TOSCA.meta create mode 100644 cba/py-executor/.DS_Store create mode 100644 cba/py-executor/Definitions/py-executor.json create mode 100644 cba/py-executor/Scripts/python/__init__.py create mode 100644 cba/py-executor/Scripts/python/failing_script.py create mode 100644 cba/py-executor/Scripts/python/hello_world.py create mode 100644 cba/py-executor/TOSCA-Metadata/TOSCA.meta create mode 100644 cba/remote-ansible/Definitions/remote-ansible.json create mode 100644 cba/remote-ansible/TOSCA-Metadata/TOSCA.meta create mode 100644 cba/remote-python/Definitions/remote-python.json create mode 100644 cba/remote-python/Scripts/python/EchoRemotePython.py create mode 100644 cba/remote-python/Scripts/python/FailingRemotePython.py create mode 100644 cba/remote-python/TOSCA-Metadata/TOSCA.meta create mode 100644 cba/resource-resolution/Definitions/resource-resolution.json create mode 100644 cba/resource-resolution/Scripts/kotlin/ResolvProperties.kt create mode 100644 cba/resource-resolution/Scripts/python/ResolvProperties.py create mode 100644 cba/resource-resolution/TOSCA-Metadata/TOSCA.meta create mode 100644 cba/resource-resolution/Templates/hello-world-jinja-mapping.json create mode 100644 cba/resource-resolution/Templates/hello-world-template.jinja create mode 100644 cba/resource-resolution/Templates/hello-world-template.vtl create mode 100644 cba/resource-resolution/Templates/hello-world-velocity-mapping.json create mode 100644 cba/retrieve-resolution/Definitions/retrieve-resolution.json create mode 100644 cba/retrieve-resolution/Scripts/kotlin/ResolvProperties.kt create mode 100644 cba/retrieve-resolution/Scripts/kotlin/ResolvProperties1.kt create mode 100644 cba/retrieve-resolution/Scripts/kotlin/ResolvProperties2.kt create mode 100644 cba/retrieve-resolution/Scripts/kotlin/ResolvProperties3.kt create mode 100644 cba/retrieve-resolution/Scripts/kotlin/ResolvProperties4.kt create mode 100644 cba/retrieve-resolution/Scripts/kotlin/RetrieveResolution.kt create mode 100644 cba/retrieve-resolution/TOSCA-Metadata/TOSCA.meta create mode 100644 cba/retrieve-resolution/Templates/hello-world-template.vtl create mode 100644 cba/retrieve-resolution/Templates/hello-world-velocity-mapping.json delete mode 100644 cds-regression-test/cba/ansible-python-dg/Definitions/ansible-python.json delete mode 100644 cds-regression-test/cba/ansible-python-dg/Plans/ansible-python-dg.xml delete mode 100644 cds-regression-test/cba/ansible-python-dg/Scripts/rt-python.py delete mode 100644 cds-regression-test/cba/ansible-python-dg/TOSCA-Metadata/TOSCA.meta delete mode 100644 cds-regression-test/cba/cba/ansible-python-dg/Definitions/ansible-python.json delete mode 100644 cds-regression-test/cba/cba/ansible-python-dg/Plans/ansible-python-dg.xml delete mode 100644 cds-regression-test/cba/cba/ansible-python-dg/Scripts/rt-python.py delete mode 100644 cds-regression-test/cba/cba/ansible-python-dg/TOSCA-Metadata/TOSCA.meta delete mode 100644 cds-regression-test/cba/cba/cli/elalto/Definitions/cli.json delete mode 100755 cds-regression-test/cba/cba/cli/elalto/Scripts/kotlin/cli/cli.kt delete mode 100755 cds-regression-test/cba/cba/cli/elalto/TOSCA-Metadata/TOSCA.meta delete mode 100644 cds-regression-test/cba/cba/cli/frankfurt/Definitions/cli.json delete mode 100755 cds-regression-test/cba/cba/cli/frankfurt/Scripts/kotlin/cli/cli.kt delete mode 100755 cds-regression-test/cba/cba/cli/frankfurt/TOSCA-Metadata/TOSCA.meta delete mode 100644 cds-regression-test/cba/cba/lock-device/Definitions/lock-device.json delete mode 100755 cds-regression-test/cba/cba/lock-device/Scripts/kotlin/ProcessOperation.kt delete mode 100644 cds-regression-test/cba/cba/lock-device/TOSCA-Metadata/TOSCA.meta delete mode 100644 cds-regression-test/cba/cba/lock-device/Templates/base-mapping.json delete mode 100644 cds-regression-test/cba/cba/netconf/Definitions/netconf.json delete mode 100644 cds-regression-test/cba/cba/netconf/Scripts/kotlin/kotlin.kt delete mode 100644 cds-regression-test/cba/cba/netconf/Scripts/python/NetconfTest.py delete mode 100644 cds-regression-test/cba/cba/netconf/TOSCA-Metadata/TOSCA.meta delete mode 100644 cds-regression-test/cba/cba/py-executor/.DS_Store delete mode 100644 cds-regression-test/cba/cba/py-executor/Definitions/py-executor.json delete mode 100644 cds-regression-test/cba/cba/py-executor/Scripts/python/__init__.py delete mode 100644 cds-regression-test/cba/cba/py-executor/Scripts/python/failing_script.py delete mode 100644 cds-regression-test/cba/cba/py-executor/Scripts/python/hello_world.py delete mode 100644 cds-regression-test/cba/cba/py-executor/TOSCA-Metadata/TOSCA.meta delete mode 100644 cds-regression-test/cba/cba/remote-ansible/Definitions/remote-ansible.json delete mode 100644 cds-regression-test/cba/cba/remote-ansible/TOSCA-Metadata/TOSCA.meta delete mode 100644 cds-regression-test/cba/cba/remote-python/Definitions/remote-python.json delete mode 100644 cds-regression-test/cba/cba/remote-python/Scripts/python/EchoRemotePython.py delete mode 100644 cds-regression-test/cba/cba/remote-python/Scripts/python/FailingRemotePython.py delete mode 100644 cds-regression-test/cba/cba/remote-python/TOSCA-Metadata/TOSCA.meta delete mode 100644 cds-regression-test/cba/cba/resource-resolution/Definitions/resource-resolution.json delete mode 100644 cds-regression-test/cba/cba/resource-resolution/Scripts/kotlin/ResolvProperties.kt delete mode 100644 cds-regression-test/cba/cba/resource-resolution/Scripts/python/ResolvProperties.py delete mode 100644 cds-regression-test/cba/cba/resource-resolution/TOSCA-Metadata/TOSCA.meta delete mode 100644 cds-regression-test/cba/cba/resource-resolution/Templates/hello-world-jinja-mapping.json delete mode 100644 cds-regression-test/cba/cba/resource-resolution/Templates/hello-world-template.jinja delete mode 100644 cds-regression-test/cba/cba/resource-resolution/Templates/hello-world-template.vtl delete mode 100644 cds-regression-test/cba/cba/resource-resolution/Templates/hello-world-velocity-mapping.json delete mode 100644 cds-regression-test/cba/cli/elalto/Definitions/cli.json delete mode 100755 cds-regression-test/cba/cli/elalto/Scripts/kotlin/cli/cli.kt delete mode 100755 cds-regression-test/cba/cli/elalto/TOSCA-Metadata/TOSCA.meta delete mode 100644 cds-regression-test/cba/cli/frankfurt/Definitions/cli.json delete mode 100755 cds-regression-test/cba/cli/frankfurt/Scripts/kotlin/cli/cli.kt delete mode 100755 cds-regression-test/cba/cli/frankfurt/TOSCA-Metadata/TOSCA.meta delete mode 100644 cds-regression-test/cba/lock-device/Definitions/lock-device.json delete mode 100755 cds-regression-test/cba/lock-device/Scripts/kotlin/ProcessOperation.kt delete mode 100644 cds-regression-test/cba/lock-device/TOSCA-Metadata/TOSCA.meta delete mode 100644 cds-regression-test/cba/lock-device/Templates/base-mapping.json delete mode 100644 cds-regression-test/cba/netconf/Definitions/netconf.json delete mode 100644 cds-regression-test/cba/netconf/Scripts/kotlin/kotlin.kt delete mode 100644 cds-regression-test/cba/netconf/Scripts/python/NetconfTest.py delete mode 100644 cds-regression-test/cba/netconf/TOSCA-Metadata/TOSCA.meta delete mode 100644 cds-regression-test/cba/py-executor/.DS_Store delete mode 100644 cds-regression-test/cba/py-executor/Definitions/py-executor.json delete mode 100644 cds-regression-test/cba/py-executor/Scripts/python/__init__.py delete mode 100644 cds-regression-test/cba/py-executor/Scripts/python/failing_script.py delete mode 100644 cds-regression-test/cba/py-executor/Scripts/python/hello_world.py delete mode 100644 cds-regression-test/cba/py-executor/TOSCA-Metadata/TOSCA.meta delete mode 100644 cds-regression-test/cba/remote-ansible/Definitions/remote-ansible.json delete mode 100644 cds-regression-test/cba/remote-ansible/TOSCA-Metadata/TOSCA.meta delete mode 100644 cds-regression-test/cba/remote-python/Definitions/remote-python.json delete mode 100644 cds-regression-test/cba/remote-python/Scripts/python/EchoRemotePython.py delete mode 100644 cds-regression-test/cba/remote-python/Scripts/python/FailingRemotePython.py delete mode 100644 cds-regression-test/cba/remote-python/TOSCA-Metadata/TOSCA.meta delete mode 100644 cds-regression-test/cba/resource-resolution/Definitions/resource-resolution.json delete mode 100644 cds-regression-test/cba/resource-resolution/Scripts/kotlin/ResolvProperties.kt delete mode 100644 cds-regression-test/cba/resource-resolution/Scripts/python/ResolvProperties.py delete mode 100644 cds-regression-test/cba/resource-resolution/TOSCA-Metadata/TOSCA.meta delete mode 100644 cds-regression-test/cba/resource-resolution/Templates/hello-world-jinja-mapping.json delete mode 100644 cds-regression-test/cba/resource-resolution/Templates/hello-world-template.jinja delete mode 100644 cds-regression-test/cba/resource-resolution/Templates/hello-world-template.vtl delete mode 100644 cds-regression-test/cba/resource-resolution/Templates/hello-world-velocity-mapping.json delete mode 100644 cds-regression-test/dependencies/mockserver/mockserver-deployment.yaml delete mode 100644 cds-regression-test/dependencies/mockserver/mockserver-service.yaml delete mode 100644 cds-regression-test/dependencies/odl-test-tool/Dockerfile delete mode 100644 cds-regression-test/dependencies/odl-test-tool/testtool-deployment.yaml delete mode 100644 cds-regression-test/dependencies/odl-test-tool/testtool-service.yaml delete mode 100644 cds-regression-test/dependencies/python3/Dockerfile delete mode 100644 cds-regression-test/dependencies/ssh-mock/Dockerfile delete mode 100755 cds-regression-test/dependencies/ssh-mock/create-user.sh delete mode 100644 cds-regression-test/dependencies/ssh-mock/sshd_config delete mode 100644 cds-regression-test/dependencies/ssh-mock/sshmock-deployment.yaml delete mode 100644 cds-regression-test/dependencies/ssh-mock/sshmock-service.yaml delete mode 100644 cds-regression-test/init-mockserver-job.yml delete mode 100644 cds-regression-test/test/ansible-python-dg/ansible-python-dg-enrichment-test.sh delete mode 100644 cds-regression-test/test/ansible-python-dg/ansible-python-dg-upload-test.sh delete mode 100644 cds-regression-test/test/ansible-python-dg/dummy-request-payload.json delete mode 100644 cds-regression-test/test/ansible-python-dg/init-mockserver.sh delete mode 100644 cds-regression-test/test/ansible-python-dg/mock-payloads/get_job-template-launch.json delete mode 100644 cds-regression-test/test/ansible-python-dg/mock-payloads/inventory.json delete mode 100644 cds-regression-test/test/ansible-python-dg/mock-payloads/job-execution.json delete mode 100644 cds-regression-test/test/ansible-python-dg/mock-payloads/job-output.json delete mode 100644 cds-regression-test/test/ansible-python-dg/mock-payloads/job-template.json delete mode 100644 cds-regression-test/test/ansible-python-dg/mock-payloads/post_job-template-launch.json delete mode 100644 cds-regression-test/test/ansible-python-dg/success/expected-response.json delete mode 100644 cds-regression-test/test/ansible-python-dg/success/request-payload.json delete mode 100644 cds-regression-test/test/ansible-python-dg/success/test.sh delete mode 100755 cds-regression-test/test/bootstrap.sh delete mode 100755 cds-regression-test/test/cli/cli-enrichment-test.sh delete mode 100755 cds-regression-test/test/cli/cli-upload-test.sh delete mode 100644 cds-regression-test/test/cli/command-fail/resources/elalto/expected-response.json delete mode 100644 cds-regression-test/test/cli/command-fail/resources/elalto/request-payload.json delete mode 100644 cds-regression-test/test/cli/command-fail/resources/frankfurt/expected-response.json delete mode 100644 cds-regression-test/test/cli/command-fail/resources/frankfurt/request-payload.json delete mode 100755 cds-regression-test/test/cli/command-fail/test.sh delete mode 100644 cds-regression-test/test/cli/dummy-request-payload.json delete mode 100644 cds-regression-test/test/cli/success/resources/elalto/expected-response.json delete mode 100644 cds-regression-test/test/cli/success/resources/elalto/request-payload.json delete mode 100644 cds-regression-test/test/cli/success/resources/frankfurt/expected-response.json delete mode 100644 cds-regression-test/test/cli/success/resources/frankfurt/request-payload.json delete mode 100755 cds-regression-test/test/cli/success/test.sh delete mode 100755 cds-regression-test/test/exit_on_failure.sh delete mode 100644 cds-regression-test/test/lock-device/dummy-request-payload.json delete mode 100644 cds-regression-test/test/lock-device/lock-device-enrichment-test.sh delete mode 100644 cds-regression-test/test/lock-device/lock-device-upload-test.sh delete mode 100644 cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-1.json delete mode 100644 cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-2.json delete mode 100644 cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-3.json delete mode 100644 cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-4.json delete mode 100644 cds-regression-test/test/lock-device/success/request-payloads/request-payload-1.json delete mode 100644 cds-regression-test/test/lock-device/success/request-payloads/request-payload-2.json delete mode 100644 cds-regression-test/test/lock-device/success/request-payloads/request-payload-3.json delete mode 100644 cds-regression-test/test/lock-device/success/request-payloads/request-payload-4.json delete mode 100644 cds-regression-test/test/lock-device/success/test.sh delete mode 100644 cds-regression-test/test/netconf/dummy-request-payload.json delete mode 100644 cds-regression-test/test/netconf/jython/connect-fail/expected-response.json delete mode 100644 cds-regression-test/test/netconf/jython/connect-fail/request-payload.json delete mode 100755 cds-regression-test/test/netconf/jython/connect-fail/test.sh delete mode 100644 cds-regression-test/test/netconf/jython/success/expected-response.json delete mode 100644 cds-regression-test/test/netconf/jython/success/request-payload.json delete mode 100755 cds-regression-test/test/netconf/jython/success/test.sh delete mode 100644 cds-regression-test/test/netconf/kotlin/connect-fail/expected-response.json delete mode 100644 cds-regression-test/test/netconf/kotlin/connect-fail/request-payload.json delete mode 100755 cds-regression-test/test/netconf/kotlin/connect-fail/test.sh delete mode 100644 cds-regression-test/test/netconf/kotlin/success/expected-response.json delete mode 100644 cds-regression-test/test/netconf/kotlin/success/request-payload.json delete mode 100755 cds-regression-test/test/netconf/kotlin/success/test.sh delete mode 100755 cds-regression-test/test/netconf/netconf-enrichment-test.sh delete mode 100755 cds-regression-test/test/netconf/netconf-upload-test.sh delete mode 100644 cds-regression-test/test/py-executor/connection-fail/expected-response.json delete mode 100644 cds-regression-test/test/py-executor/connection-fail/request-payload.json delete mode 100644 cds-regression-test/test/py-executor/connection-fail/test.sh delete mode 100644 cds-regression-test/test/py-executor/dummy-request-payload.json delete mode 100644 cds-regression-test/test/py-executor/failing-script/expected-response.json delete mode 100644 cds-regression-test/test/py-executor/failing-script/request-payload.json delete mode 100644 cds-regression-test/test/py-executor/failing-script/test.sh delete mode 100644 cds-regression-test/test/py-executor/py-executor-enrichment-test.sh delete mode 100644 cds-regression-test/test/py-executor/py-executor-upload-test.sh delete mode 100644 cds-regression-test/test/py-executor/success/expected-response.json delete mode 100644 cds-regression-test/test/py-executor/success/request-payload.json delete mode 100644 cds-regression-test/test/py-executor/success/test.sh delete mode 100644 cds-regression-test/test/remote-ansible/connection-failure/expected-response.json delete mode 100644 cds-regression-test/test/remote-ansible/connection-failure/request-payload.json delete mode 100644 cds-regression-test/test/remote-ansible/connection-failure/test.sh delete mode 100644 cds-regression-test/test/remote-ansible/dummy-request-payload.json delete mode 100644 cds-regression-test/test/remote-ansible/failure/resources/elalto/expected-response.json delete mode 100644 cds-regression-test/test/remote-ansible/failure/resources/elalto/request-payload.json delete mode 100644 cds-regression-test/test/remote-ansible/failure/resources/frankfurt/expected-response.json delete mode 100644 cds-regression-test/test/remote-ansible/failure/resources/frankfurt/request-payload.json delete mode 100644 cds-regression-test/test/remote-ansible/failure/test.sh delete mode 100755 cds-regression-test/test/remote-ansible/init-mockserver.sh delete mode 100644 cds-regression-test/test/remote-ansible/mock-payloads/get_job-template-launch.json delete mode 100644 cds-regression-test/test/remote-ansible/mock-payloads/inventory.json delete mode 100644 cds-regression-test/test/remote-ansible/mock-payloads/job-execution.json delete mode 100644 cds-regression-test/test/remote-ansible/mock-payloads/job-output.json delete mode 100644 cds-regression-test/test/remote-ansible/mock-payloads/job-template-error.json delete mode 100644 cds-regression-test/test/remote-ansible/mock-payloads/job-template.json delete mode 100644 cds-regression-test/test/remote-ansible/mock-payloads/post_job-template-launch.json delete mode 100755 cds-regression-test/test/remote-ansible/remote-ansible-enrichment-test.sh delete mode 100755 cds-regression-test/test/remote-ansible/remote-ansible-upload-test.sh delete mode 100644 cds-regression-test/test/remote-ansible/success/expected-response.json delete mode 100644 cds-regression-test/test/remote-ansible/success/request-payload.json delete mode 100644 cds-regression-test/test/remote-ansible/success/test.sh delete mode 100644 cds-regression-test/test/remote-python/connection-fail/resources/elalto/expected-response.json delete mode 100644 cds-regression-test/test/remote-python/connection-fail/resources/elalto/request-payload.json delete mode 100644 cds-regression-test/test/remote-python/connection-fail/resources/frankfurt/expected-response.json delete mode 100644 cds-regression-test/test/remote-python/connection-fail/resources/frankfurt/request-payload.json delete mode 100644 cds-regression-test/test/remote-python/connection-fail/test.sh delete mode 100644 cds-regression-test/test/remote-python/dummy-request-payload.json delete mode 100644 cds-regression-test/test/remote-python/failing-script/expected-response.json delete mode 100644 cds-regression-test/test/remote-python/failing-script/request-payload.json delete mode 100755 cds-regression-test/test/remote-python/failing-script/test.sh delete mode 100755 cds-regression-test/test/remote-python/remote-python-enrichment-test.sh delete mode 100755 cds-regression-test/test/remote-python/remote-python-upload-test.sh delete mode 100644 cds-regression-test/test/remote-python/success/expected-response.json delete mode 100644 cds-regression-test/test/remote-python/success/request-payload.json delete mode 100755 cds-regression-test/test/remote-python/success/test.sh delete mode 100644 cds-regression-test/test/reset-verify-mockserver.sh delete mode 100644 cds-regression-test/test/resource-resolution/data-dict/RT-db.json delete mode 100644 cds-regression-test/test/resource-resolution/data-dict/RT-kotlin.json delete mode 100644 cds-regression-test/test/resource-resolution/data-dict/RT-rest-delete.json delete mode 100644 cds-regression-test/test/resource-resolution/data-dict/RT-rest-get.json delete mode 100644 cds-regression-test/test/resource-resolution/data-dict/RT-rest-patch.json delete mode 100644 cds-regression-test/test/resource-resolution/data-dict/RT-rest-post.json delete mode 100644 cds-regression-test/test/resource-resolution/data-dict/RT-rest-put.json delete mode 100644 cds-regression-test/test/resource-resolution/dummy-request-payload.json delete mode 100644 cds-regression-test/test/resource-resolution/force-resolution/expected-payloads/expected-response-1.json delete mode 100644 cds-regression-test/test/resource-resolution/force-resolution/expected-payloads/expected-response-2.json delete mode 100644 cds-regression-test/test/resource-resolution/force-resolution/request-payloads/request-payload-1.json delete mode 100644 cds-regression-test/test/resource-resolution/force-resolution/request-payloads/request-payload-2.json delete mode 100644 cds-regression-test/test/resource-resolution/force-resolution/test.sh delete mode 100755 cds-regression-test/test/resource-resolution/init-mockserver.sh delete mode 100755 cds-regression-test/test/resource-resolution/resource-resolution-enrichment-test.sh delete mode 100755 cds-regression-test/test/resource-resolution/resource-resolution-upload-dd.sh delete mode 100755 cds-regression-test/test/resource-resolution/resource-resolution-upload-test.sh delete mode 100644 cds-regression-test/test/resource-resolution/success/expected-payloads/expected-response.json delete mode 100644 cds-regression-test/test/resource-resolution/success/request-payloads/request-payload.json delete mode 100755 cds-regression-test/test/resource-resolution/success/test.sh delete mode 100644 cds-regression-test/test/test/ansible-python-dg/ansible-python-dg-enrichment-test.sh delete mode 100644 cds-regression-test/test/test/ansible-python-dg/ansible-python-dg-upload-test.sh delete mode 100644 cds-regression-test/test/test/ansible-python-dg/dummy-request-payload.json delete mode 100644 cds-regression-test/test/test/ansible-python-dg/init-mockserver.sh delete mode 100644 cds-regression-test/test/test/ansible-python-dg/mock-payloads/get_job-template-launch.json delete mode 100644 cds-regression-test/test/test/ansible-python-dg/mock-payloads/inventory.json delete mode 100644 cds-regression-test/test/test/ansible-python-dg/mock-payloads/job-execution.json delete mode 100644 cds-regression-test/test/test/ansible-python-dg/mock-payloads/job-output.json delete mode 100644 cds-regression-test/test/test/ansible-python-dg/mock-payloads/job-template.json delete mode 100644 cds-regression-test/test/test/ansible-python-dg/mock-payloads/post_job-template-launch.json delete mode 100644 cds-regression-test/test/test/ansible-python-dg/success/expected-response.json delete mode 100644 cds-regression-test/test/test/ansible-python-dg/success/request-payload.json delete mode 100644 cds-regression-test/test/test/ansible-python-dg/success/test.sh delete mode 100755 cds-regression-test/test/test/bootstrap.sh delete mode 100755 cds-regression-test/test/test/cli/cli-enrichment-test.sh delete mode 100755 cds-regression-test/test/test/cli/cli-upload-test.sh delete mode 100644 cds-regression-test/test/test/cli/command-fail/resources/elalto/expected-response.json delete mode 100644 cds-regression-test/test/test/cli/command-fail/resources/elalto/request-payload.json delete mode 100644 cds-regression-test/test/test/cli/command-fail/resources/frankfurt/expected-response.json delete mode 100644 cds-regression-test/test/test/cli/command-fail/resources/frankfurt/request-payload.json delete mode 100755 cds-regression-test/test/test/cli/command-fail/test.sh delete mode 100644 cds-regression-test/test/test/cli/dummy-request-payload.json delete mode 100644 cds-regression-test/test/test/cli/success/resources/elalto/expected-response.json delete mode 100644 cds-regression-test/test/test/cli/success/resources/elalto/request-payload.json delete mode 100644 cds-regression-test/test/test/cli/success/resources/frankfurt/expected-response.json delete mode 100644 cds-regression-test/test/test/cli/success/resources/frankfurt/request-payload.json delete mode 100755 cds-regression-test/test/test/cli/success/test.sh delete mode 100755 cds-regression-test/test/test/exit_on_failure.sh delete mode 100644 cds-regression-test/test/test/lock-device/dummy-request-payload.json delete mode 100644 cds-regression-test/test/test/lock-device/lock-device-enrichment-test.sh delete mode 100644 cds-regression-test/test/test/lock-device/lock-device-upload-test.sh delete mode 100644 cds-regression-test/test/test/lock-device/success/expected-payloads/expected-payload-1.json delete mode 100644 cds-regression-test/test/test/lock-device/success/expected-payloads/expected-payload-2.json delete mode 100644 cds-regression-test/test/test/lock-device/success/expected-payloads/expected-payload-3.json delete mode 100644 cds-regression-test/test/test/lock-device/success/expected-payloads/expected-payload-4.json delete mode 100644 cds-regression-test/test/test/lock-device/success/request-payloads/request-payload-1.json delete mode 100644 cds-regression-test/test/test/lock-device/success/request-payloads/request-payload-2.json delete mode 100644 cds-regression-test/test/test/lock-device/success/request-payloads/request-payload-3.json delete mode 100644 cds-regression-test/test/test/lock-device/success/request-payloads/request-payload-4.json delete mode 100644 cds-regression-test/test/test/lock-device/success/test.sh delete mode 100644 cds-regression-test/test/test/netconf/dummy-request-payload.json delete mode 100644 cds-regression-test/test/test/netconf/jython/connect-fail/expected-response.json delete mode 100644 cds-regression-test/test/test/netconf/jython/connect-fail/request-payload.json delete mode 100755 cds-regression-test/test/test/netconf/jython/connect-fail/test.sh delete mode 100644 cds-regression-test/test/test/netconf/jython/success/expected-response.json delete mode 100644 cds-regression-test/test/test/netconf/jython/success/request-payload.json delete mode 100755 cds-regression-test/test/test/netconf/jython/success/test.sh delete mode 100644 cds-regression-test/test/test/netconf/kotlin/connect-fail/expected-response.json delete mode 100644 cds-regression-test/test/test/netconf/kotlin/connect-fail/request-payload.json delete mode 100755 cds-regression-test/test/test/netconf/kotlin/connect-fail/test.sh delete mode 100644 cds-regression-test/test/test/netconf/kotlin/success/expected-response.json delete mode 100644 cds-regression-test/test/test/netconf/kotlin/success/request-payload.json delete mode 100755 cds-regression-test/test/test/netconf/kotlin/success/test.sh delete mode 100755 cds-regression-test/test/test/netconf/netconf-enrichment-test.sh delete mode 100755 cds-regression-test/test/test/netconf/netconf-upload-test.sh delete mode 100644 cds-regression-test/test/test/py-executor/connection-fail/expected-response.json delete mode 100644 cds-regression-test/test/test/py-executor/connection-fail/request-payload.json delete mode 100644 cds-regression-test/test/test/py-executor/connection-fail/test.sh delete mode 100644 cds-regression-test/test/test/py-executor/dummy-request-payload.json delete mode 100644 cds-regression-test/test/test/py-executor/failing-script/expected-response.json delete mode 100644 cds-regression-test/test/test/py-executor/failing-script/request-payload.json delete mode 100644 cds-regression-test/test/test/py-executor/failing-script/test.sh delete mode 100644 cds-regression-test/test/test/py-executor/py-executor-enrichment-test.sh delete mode 100644 cds-regression-test/test/test/py-executor/py-executor-upload-test.sh delete mode 100644 cds-regression-test/test/test/py-executor/success/expected-response.json delete mode 100644 cds-regression-test/test/test/py-executor/success/request-payload.json delete mode 100644 cds-regression-test/test/test/py-executor/success/test.sh delete mode 100644 cds-regression-test/test/test/remote-ansible/connection-failure/expected-response.json delete mode 100644 cds-regression-test/test/test/remote-ansible/connection-failure/request-payload.json delete mode 100644 cds-regression-test/test/test/remote-ansible/connection-failure/test.sh delete mode 100644 cds-regression-test/test/test/remote-ansible/dummy-request-payload.json delete mode 100644 cds-regression-test/test/test/remote-ansible/failure/resources/elalto/expected-response.json delete mode 100644 cds-regression-test/test/test/remote-ansible/failure/resources/elalto/request-payload.json delete mode 100644 cds-regression-test/test/test/remote-ansible/failure/resources/frankfurt/expected-response.json delete mode 100644 cds-regression-test/test/test/remote-ansible/failure/resources/frankfurt/request-payload.json delete mode 100644 cds-regression-test/test/test/remote-ansible/failure/test.sh delete mode 100755 cds-regression-test/test/test/remote-ansible/init-mockserver.sh delete mode 100644 cds-regression-test/test/test/remote-ansible/mock-payloads/get_job-template-launch.json delete mode 100644 cds-regression-test/test/test/remote-ansible/mock-payloads/inventory.json delete mode 100644 cds-regression-test/test/test/remote-ansible/mock-payloads/job-execution.json delete mode 100644 cds-regression-test/test/test/remote-ansible/mock-payloads/job-output.json delete mode 100644 cds-regression-test/test/test/remote-ansible/mock-payloads/job-template-error.json delete mode 100644 cds-regression-test/test/test/remote-ansible/mock-payloads/job-template.json delete mode 100644 cds-regression-test/test/test/remote-ansible/mock-payloads/post_job-template-launch.json delete mode 100755 cds-regression-test/test/test/remote-ansible/remote-ansible-enrichment-test.sh delete mode 100755 cds-regression-test/test/test/remote-ansible/remote-ansible-upload-test.sh delete mode 100644 cds-regression-test/test/test/remote-ansible/success/expected-response.json delete mode 100644 cds-regression-test/test/test/remote-ansible/success/request-payload.json delete mode 100644 cds-regression-test/test/test/remote-ansible/success/test.sh delete mode 100644 cds-regression-test/test/test/remote-python/connection-fail/resources/elalto/expected-response.json delete mode 100644 cds-regression-test/test/test/remote-python/connection-fail/resources/elalto/request-payload.json delete mode 100644 cds-regression-test/test/test/remote-python/connection-fail/resources/frankfurt/expected-response.json delete mode 100644 cds-regression-test/test/test/remote-python/connection-fail/resources/frankfurt/request-payload.json delete mode 100644 cds-regression-test/test/test/remote-python/connection-fail/test.sh delete mode 100644 cds-regression-test/test/test/remote-python/dummy-request-payload.json delete mode 100644 cds-regression-test/test/test/remote-python/failing-script/expected-response.json delete mode 100644 cds-regression-test/test/test/remote-python/failing-script/request-payload.json delete mode 100755 cds-regression-test/test/test/remote-python/failing-script/test.sh delete mode 100755 cds-regression-test/test/test/remote-python/remote-python-enrichment-test.sh delete mode 100755 cds-regression-test/test/test/remote-python/remote-python-upload-test.sh delete mode 100644 cds-regression-test/test/test/remote-python/success/expected-response.json delete mode 100644 cds-regression-test/test/test/remote-python/success/request-payload.json delete mode 100755 cds-regression-test/test/test/remote-python/success/test.sh delete mode 100644 cds-regression-test/test/test/reset-verify-mockserver.sh delete mode 100644 cds-regression-test/test/test/resource-resolution/data-dict/RT-db.json delete mode 100644 cds-regression-test/test/test/resource-resolution/data-dict/RT-kotlin.json delete mode 100644 cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-delete.json delete mode 100644 cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-get.json delete mode 100644 cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-patch.json delete mode 100644 cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-post.json delete mode 100644 cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-put.json delete mode 100644 cds-regression-test/test/test/resource-resolution/dummy-request-payload.json delete mode 100644 cds-regression-test/test/test/resource-resolution/force-resolution/expected-payloads/expected-response-1.json delete mode 100644 cds-regression-test/test/test/resource-resolution/force-resolution/expected-payloads/expected-response-2.json delete mode 100644 cds-regression-test/test/test/resource-resolution/force-resolution/request-payloads/request-payload-1.json delete mode 100644 cds-regression-test/test/test/resource-resolution/force-resolution/request-payloads/request-payload-2.json delete mode 100644 cds-regression-test/test/test/resource-resolution/force-resolution/test.sh delete mode 100755 cds-regression-test/test/test/resource-resolution/init-mockserver.sh delete mode 100755 cds-regression-test/test/test/resource-resolution/resource-resolution-enrichment-test.sh delete mode 100755 cds-regression-test/test/test/resource-resolution/resource-resolution-upload-dd.sh delete mode 100755 cds-regression-test/test/test/resource-resolution/resource-resolution-upload-test.sh delete mode 100644 cds-regression-test/test/test/resource-resolution/success/expected-payloads/expected-response.json delete mode 100644 cds-regression-test/test/test/resource-resolution/success/request-payloads/request-payload.json delete mode 100755 cds-regression-test/test/test/resource-resolution/success/test.sh delete mode 100755 cds-regression-test/test/test/utils.sh delete mode 100755 cds-regression-test/test/utils.sh create mode 100644 test/ansible-python-dg/ansible-python-dg-enrichment-test.sh create mode 100644 test/ansible-python-dg/ansible-python-dg-upload-test.sh create mode 100644 test/ansible-python-dg/dummy-request-payload.json create mode 100644 test/ansible-python-dg/init-mockserver.sh create mode 100644 test/ansible-python-dg/mock-payloads/get_job-template-launch.json create mode 100644 test/ansible-python-dg/mock-payloads/inventory.json create mode 100644 test/ansible-python-dg/mock-payloads/job-execution.json create mode 100644 test/ansible-python-dg/mock-payloads/job-output.json create mode 100644 test/ansible-python-dg/mock-payloads/job-template.json create mode 100644 test/ansible-python-dg/mock-payloads/post_job-template-launch.json create mode 100644 test/ansible-python-dg/success/expected-response.json create mode 100644 test/ansible-python-dg/success/request-payload.json create mode 100644 test/ansible-python-dg/success/test.sh create mode 100755 test/bootstrap.sh create mode 100755 test/cli/cli-enrichment-test.sh create mode 100755 test/cli/cli-upload-test.sh create mode 100644 test/cli/command-fail/expected-response.json create mode 100644 test/cli/command-fail/request-payload.json create mode 100755 test/cli/command-fail/test.sh create mode 100644 test/cli/dummy-request-payload.json create mode 100644 test/cli/success/expected-response.json create mode 100644 test/cli/success/request-payload.json create mode 100755 test/cli/success/test.sh create mode 100755 test/exit_on_failure.sh create mode 100644 test/lock-device/dummy-request-payload.json create mode 100644 test/lock-device/lock-device-enrichment-test.sh create mode 100644 test/lock-device/lock-device-upload-test.sh create mode 100644 test/lock-device/success/expected-payloads/expected-payload-1.json create mode 100644 test/lock-device/success/expected-payloads/expected-payload-2.json create mode 100644 test/lock-device/success/expected-payloads/expected-payload-3.json create mode 100644 test/lock-device/success/expected-payloads/expected-payload-4.json create mode 100644 test/lock-device/success/request-payloads/request-payload-1.json create mode 100644 test/lock-device/success/request-payloads/request-payload-2.json create mode 100644 test/lock-device/success/request-payloads/request-payload-3.json create mode 100644 test/lock-device/success/request-payloads/request-payload-4.json create mode 100644 test/lock-device/success/test.sh create mode 100644 test/netconf/dummy-request-payload.json create mode 100644 test/netconf/jython/connect-fail/expected-response.json create mode 100644 test/netconf/jython/connect-fail/request-payload.json create mode 100755 test/netconf/jython/connect-fail/test.sh create mode 100644 test/netconf/jython/success/expected-response.json create mode 100644 test/netconf/jython/success/request-payload.json create mode 100755 test/netconf/jython/success/test.sh create mode 100644 test/netconf/kotlin/connect-fail/expected-response.json create mode 100644 test/netconf/kotlin/connect-fail/request-payload.json create mode 100755 test/netconf/kotlin/connect-fail/test.sh create mode 100644 test/netconf/kotlin/success/expected-response.json create mode 100644 test/netconf/kotlin/success/request-payload.json create mode 100755 test/netconf/kotlin/success/test.sh create mode 100755 test/netconf/netconf-enrichment-test.sh create mode 100755 test/netconf/netconf-upload-test.sh create mode 100644 test/py-executor/connection-fail/expected-response.json create mode 100644 test/py-executor/connection-fail/request-payload.json create mode 100644 test/py-executor/connection-fail/test.sh create mode 100644 test/py-executor/dummy-request-payload.json create mode 100644 test/py-executor/failing-script/expected-response.json create mode 100644 test/py-executor/failing-script/request-payload.json create mode 100644 test/py-executor/failing-script/test.sh create mode 100644 test/py-executor/py-executor-enrichment-test.sh create mode 100644 test/py-executor/py-executor-upload-test.sh create mode 100644 test/py-executor/success/expected-response.json create mode 100644 test/py-executor/success/request-payload.json create mode 100644 test/py-executor/success/test.sh create mode 100644 test/remote-ansible/connection-failure/expected-response.json create mode 100644 test/remote-ansible/connection-failure/request-payload.json create mode 100644 test/remote-ansible/connection-failure/test.sh create mode 100644 test/remote-ansible/dummy-request-payload.json create mode 100644 test/remote-ansible/failure/expected-response.json create mode 100644 test/remote-ansible/failure/request-payload.json create mode 100644 test/remote-ansible/failure/test.sh create mode 100755 test/remote-ansible/init-mockserver.sh create mode 100644 test/remote-ansible/mock-payloads/get_job-template-launch.json create mode 100644 test/remote-ansible/mock-payloads/inventory.json create mode 100644 test/remote-ansible/mock-payloads/job-execution.json create mode 100644 test/remote-ansible/mock-payloads/job-output.json create mode 100644 test/remote-ansible/mock-payloads/job-template-error.json create mode 100644 test/remote-ansible/mock-payloads/job-template.json create mode 100644 test/remote-ansible/mock-payloads/post_job-template-launch.json create mode 100755 test/remote-ansible/remote-ansible-enrichment-test.sh create mode 100755 test/remote-ansible/remote-ansible-upload-test.sh create mode 100644 test/remote-ansible/success/expected-response.json create mode 100644 test/remote-ansible/success/request-payload.json create mode 100644 test/remote-ansible/success/test.sh create mode 100644 test/remote-python/connection-fail/expected-response.json create mode 100644 test/remote-python/connection-fail/request-payload.json create mode 100644 test/remote-python/connection-fail/test.sh create mode 100644 test/remote-python/dummy-request-payload.json create mode 100644 test/remote-python/failing-script/expected-response.json create mode 100644 test/remote-python/failing-script/request-payload.json create mode 100755 test/remote-python/failing-script/test.sh create mode 100755 test/remote-python/remote-python-enrichment-test.sh create mode 100755 test/remote-python/remote-python-upload-test.sh create mode 100644 test/remote-python/success/expected-response.json create mode 100644 test/remote-python/success/request-payload.json create mode 100755 test/remote-python/success/test.sh create mode 100644 test/resource-resolution/data-dict/RT-db.json create mode 100644 test/resource-resolution/data-dict/RT-kotlin.json create mode 100644 test/resource-resolution/data-dict/RT-rest-delete.json create mode 100644 test/resource-resolution/data-dict/RT-rest-get-id.json create mode 100644 test/resource-resolution/data-dict/RT-rest-get.json create mode 100644 test/resource-resolution/data-dict/RT-rest-patch.json create mode 100644 test/resource-resolution/data-dict/RT-rest-post.json create mode 100644 test/resource-resolution/data-dict/RT-rest-put.json create mode 100644 test/resource-resolution/dummy-request-payload.json create mode 100755 test/resource-resolution/init-mockserver.sh create mode 100755 test/resource-resolution/resource-resolution-enrichment-test.sh create mode 100755 test/resource-resolution/resource-resolution-upload-dd.sh create mode 100755 test/resource-resolution/resource-resolution-upload-test.sh create mode 100644 test/resource-resolution/success/expected-payloads/expected-response.json create mode 100644 test/resource-resolution/success/request-payloads/request-payload.json create mode 100755 test/resource-resolution/success/test.sh create mode 100644 test/retrieve-resolution/data-dict/RT-kotlin-1.json create mode 100644 test/retrieve-resolution/data-dict/RT-kotlin-2.json create mode 100644 test/retrieve-resolution/data-dict/RT-kotlin-3.json create mode 100644 test/retrieve-resolution/data-dict/RT-kotlin-4.json create mode 100644 test/retrieve-resolution/dummy-request-payload.json create mode 100755 test/retrieve-resolution/retrieve-resolution-enrichment-test.sh create mode 100644 test/retrieve-resolution/retrieve-resolution-upload-dd.sh create mode 100755 test/retrieve-resolution/retrieve-resolution-upload-test.sh create mode 100644 test/retrieve-resolution/retrieve-success/expected-payloads/expected-response.json create mode 100644 test/retrieve-resolution/retrieve-success/request-payloads/request-payload.json create mode 100755 test/retrieve-resolution/retrieve-success/test.sh create mode 100755 test/utils.sh diff --git a/.coafile b/.coafile index 0cc60d0..60e742e 100644 --- a/.coafile +++ b/.coafile @@ -11,10 +11,25 @@ indent_size = 2 ignore = .tox/**, # this file does not contain parsable JSON. Invalid control character at. - cds-regression-test/test/ansible-python-dg/mock-payloads/job-output.json, - cds-regression-test/test/remote-ansible/mock-payloads/job-output.json, - cds-regression-test/test/test/ansible-python-dg/mock-payloads/job-output.json, - cds-regression-test/test/test/remote-ansible/mock-payloads/job-output.json + cba/ansible-python-dg/Definitions/ansible-python.json, + cba/py-executor/Definitions/py-executor.json, + cba/remote-ansible/Definitions/remote-ansible.json, + cba/remote-python/Definitions/remote-python.json, + cba/resource-resolution/Definitions/resource-resolution.json, + test/ansible-python-dg/mock-payloads/get_job-template-launch.json, + test/ansible-python-dg/mock-payloads/inventory.json, + test/ansible-python-dg/mock-payloads/job-execution.json, + test/ansible-python-dg/mock-payloads/job-output.json, + test/ansible-python-dg/mock-payloads/job-template.json, + test/ansible-python-dg/mock-payloads/post_job-template-launch.json, + test/cli/command-fail/expected-response.json, + test/remote-ansible/mock-payloads/get_job-template-launch.json, + test/remote-ansible/mock-payloads/inventory.json, + test/remote-ansible/mock-payloads/job-execution.json, + test/remote-ansible/mock-payloads/job-output.json, + test/remote-ansible/mock-payloads/job-template-error.json, + test/remote-ansible/mock-payloads/job-template.json, + test/remote-ansible/mock-payloads/post_job-template-launch.json [py] bears = PyLintBear diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1d4ff41 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +cba-enriched +responses +failed-tests +cba/*.zip +.DS_Store +.tox/ \ No newline at end of file diff --git a/cba/ansible-python-dg/Definitions/ansible-python.json b/cba/ansible-python-dg/Definitions/ansible-python.json new file mode 100644 index 0000000..849ee55 --- /dev/null +++ b/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": .MOCK_SRV, + "token": "Bearer J9gEtMDqf7P4YsJ7444fioY9VAhLDIs1" + }, + "remote-executor": { + "type": "token-auth", + "host": .CMD_EXEC_SVC, + "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/cba/ansible-python-dg/Plans/ansible-python-dg.xml b/cba/ansible-python-dg/Plans/ansible-python-dg.xml new file mode 100644 index 0000000..e00f17a --- /dev/null +++ b/cba/ansible-python-dg/Plans/ansible-python-dg.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cba/ansible-python-dg/Scripts/rt-python.py b/cba/ansible-python-dg/Scripts/rt-python.py new file mode 100644 index 0000000..6bee5d3 --- /dev/null +++ b/cba/ansible-python-dg/Scripts/rt-python.py @@ -0,0 +1,26 @@ +#!/usr/bin/python +# +# Copyright (C) 2020 Bell Canada. +# +# 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 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/cba/ansible-python-dg/TOSCA-Metadata/TOSCA.meta b/cba/ansible-python-dg/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 0000000..844f38b --- /dev/null +++ b/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 diff --git a/cba/cli/Definitions/cli.json b/cba/cli/Definitions/cli.json new file mode 100644 index 0000000..c0070da --- /dev/null +++ b/cba/cli/Definitions/cli.json @@ -0,0 +1,113 @@ +{ + "metadata": { + "template_author": "Selffish", + "author-email": "test@bell.ca", + "template_name": "RT-cli", + "template_version": "1.0.0", + "template_tags": "test, regression" + }, + "dsl_definitions": { + "device-properties": { + "type": "basic-auth", + "host": { + "get_input": "host" + }, + "username": { + "get_input": "username" + }, + "password": { + "get_input": "password" + }, + "port": { + "get_input": "port" + }, + "logging": { + "get_input": "logging" + }, + "connectionTimeOut": { + "get_input": "connectionTimeOut" + } + } + }, + "topology_template": { + "workflows": { + "cli": { + "steps": { + "cli": { + "description": "CLI Workflow", + "target": "cli" + } + }, + "inputs": { + "resolution-key": { + "required": false, + "type": "string" + }, + "password": { + "required": true, + "type": "string" + }, + "username": { + "required": true, + "type": "string" + }, + "host": { + "required": true, + "type": "string" + }, + "port": { + "required": false, + "type": "string" + }, + "connectionTimeOut": { + "required": true, + "type": "string" + }, + "logging": { + "required": true, + "type": "boolean" + }, + "commands": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "outputs": { + "response-data": { + "type": "string", + "value": { + "get_attribute": [ + "cli", + "response-data" + ] + } + } + } + } + }, + "node_templates": { + "cli": { + "type": "component-script-executor", + "interfaces": { + "ComponentScriptExecutor": { + "operations": { + "process": { + "implementation": { + "primary": "component-script" + }, + "inputs": { + "script-type": "kotlin", + "script-class-reference": "cli.CliRegressionTest" + }, + "outputs": {} + } + } + } + } + } + } + } +} diff --git a/cba/cli/Scripts/kotlin/cli/cli.kt b/cba/cli/Scripts/kotlin/cli/cli.kt new file mode 100755 index 0000000..1e1ade0 --- /dev/null +++ b/cba/cli/Scripts/kotlin/cli/cli.kt @@ -0,0 +1,59 @@ +/* + * Copyright © 2019 IBM, Bell Canada. + * + * 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. + */ + +package cli + +import org.onap.ccsdk.cds.controllerblueprints.core.logger +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.cliDeviceInfo +import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.getSshClientService +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor +import org.onap.ccsdk.cds.blueprintsprocessor.ssh.service.CommandResult +import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils +import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType + +open class CliRegressionTest : AbstractScriptComponentFunction() { + + private val log = logger(CliRegressionTest::class) + + override suspend fun processNB(executionRequest: ExecutionServiceInput) { + // Get Client Service + val sshClientService = getSshClientService(cliDeviceInfo("device-properties")) + sshClientService.startSession() + + // Read Commands + val timeout = bluePrintRuntimeService.getInputValue("connectionTimeOut").asText() + val commands = bluePrintRuntimeService.getInputValue("commands") + .let { JacksonUtils.getListFromJsonNode(it, String::class.java) } + + // Execute + var responsesLog: List? = null + try { + responsesLog = sshClientService.executeCommands(commands, timeout.toLong()) + log.info(responsesLog.toString()) + } catch (e: Exception) { + e.message?.let { addError(it) } + } finally { + setAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, responsesLog?.map { it->it.asJsonType()}.asJsonType()) + sshClientService.closeSession() + } + } + + override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { + log.info("Executing Recovery") + } +} diff --git a/cba/cli/TOSCA-Metadata/TOSCA.meta b/cba/cli/TOSCA-Metadata/TOSCA.meta new file mode 100755 index 0000000..7bb2d45 --- /dev/null +++ b/cba/cli/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/cli.json +Template-Tags: test, regression +Template-Name: RT-cli +Template-Version: 1.0.0 +Template-Type: DEFAULT \ No newline at end of file diff --git a/cba/lock-device/Definitions/lock-device.json b/cba/lock-device/Definitions/lock-device.json new file mode 100644 index 0000000..c90021c --- /dev/null +++ b/cba/lock-device/Definitions/lock-device.json @@ -0,0 +1,98 @@ +{ + "metadata": { + "template_author": "Selffish", + "author-email": "test@bell.ca", + "template_name": "RT-lock-device", + "template_version": "1.0.0", + "template_tags": "Bell, CBA, test" + }, + "dsl_definitions": {}, + "topology_template": { + "workflows": { + "resolve-deploy-kotlin": { + "steps": { + "resolve": { + "description": "resolve vnf-id", + "target": "resource-resolution", + "on_success": [ + "execute-script" + ] + }, + "execute-script": { + "description": "Execute Kotlin Script", + "target": "execute-kotlin" + } + }, + "outputs": { + "response-data": { + "type": "string", + "value": { + "get_attribute": [ + "execute-kotlin", + "response-data" + ] + } + } + } + } + }, + "node_templates": { + "resource-resolution": { + "type": "component-resource-resolution", + "interfaces": { + "ResourceResolutionComponent": { + "operations": { + "process": { + "inputs": { + "artifact-prefix-names": [ + "base" + ], + "resolution-summary": true + } + } + } + } + }, + "artifacts": { + "base-mapping": { + "type": "artifact-mapping-resource", + "file": "Templates/base-mapping.json" + } + } + }, + "execute-kotlin": { + "type": "component-script-executor", + "interfaces": { + "ComponentScriptExecutor": { + "operations": { + "process": { + "implementation": { + "primary": "component-script", + "lock": { + "key": { + "get_attribute": [ + "resource-resolution", + "", + "assignment-map", + "base", + "vnf-id" + ] + }, + "acquireTimeout": { + "get_input": "lock-acquire-timeout" + } + } + }, + "inputs": { + "script-type": "kotlin", + "script-class-reference": "cba.cds.RT.ProcessOperation" + }, + "outputs": {} + } + } + } + } + } + } + } +} diff --git a/cba/lock-device/Scripts/kotlin/ProcessOperation.kt b/cba/lock-device/Scripts/kotlin/ProcessOperation.kt new file mode 100755 index 0000000..e84623a --- /dev/null +++ b/cba/lock-device/Scripts/kotlin/ProcessOperation.kt @@ -0,0 +1,49 @@ +/* + * Copyright © 2019 Bell Canada. + * + * 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. + */ + +package cba.cds.RT + +import org.onap.ccsdk.cds.controllerblueprints.core.logger +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor +import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType +import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BasicAuthRestClientService +import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties +import kotlinx.coroutines.delay + +open class ProcessOperation : AbstractScriptComponentFunction() { + + private val log = logger(ProcessOperation::class) + + override suspend fun processNB(executionRequest: ExecutionServiceInput) { + val time : Long = 30_000 + try { + log.info("Processing for $time ms... ${executionRequest.commonHeader.requestId}") + delay(time) + log.info("Done processing ${executionRequest.commonHeader.requestId}!") + setAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, "Success: ${executionRequest.commonHeader.requestId}".asJsonType()) + } catch (e: Exception) { + e.message?.let { addError(it) } + } + } + + override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { + setAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, runtimeException.message!!.asJsonType()) + addError(runtimeException.message!!) + log.info("Executing Recovery") + } +} diff --git a/cba/lock-device/TOSCA-Metadata/TOSCA.meta b/cba/lock-device/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 0000000..e182865 --- /dev/null +++ b/cba/lock-device/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/lock-device.json +Template-Tags: test, regression +Template-Name: RT-lock-device +Template-Version: 1.0.0 +Template-Type: DEFAULT \ No newline at end of file diff --git a/cba/lock-device/Templates/base-mapping.json b/cba/lock-device/Templates/base-mapping.json new file mode 100644 index 0000000..b5b64a8 --- /dev/null +++ b/cba/lock-device/Templates/base-mapping.json @@ -0,0 +1,23 @@ +[ + { + "name": "vnf-id", + "input-param": true, + "property": { + "type": "string", + "default": "rt-vnf-xyz-123" + }, + "dictionary-name": "input-source", + "dictionary-source": "default", + "dependencies": [] + }, + { + "name": "lock-acquire-timeout", + "input-param": true, + "property": { + "type": "integer" + }, + "dictionary-name": "input-source", + "dictionary-source": "input", + "dependencies": [] + } +] diff --git a/cba/netconf/Definitions/netconf.json b/cba/netconf/Definitions/netconf.json new file mode 100644 index 0000000..74a98c1 --- /dev/null +++ b/cba/netconf/Definitions/netconf.json @@ -0,0 +1,137 @@ +{ + "metadata": { + "template_author": "Selffish", + "author-email": "test@bell.ca", + "template_name": "RT-netconf", + "template_version": "1.0.0", + "template_tags": "Bell, CBA, test" + }, + "topology_template": { + "workflows": { + "netconf-jython": { + "steps": { + "netconf-jython": { + "description": "deploy config", + "target": "execute-jython-netconf" + } + }, + "inputs": { + "netconf-host": { + "required": true, + "type": "string" + }, + "netconf-timeout": { + "required": true, + "type": "string" + } + }, + "outputs": { + "response-data": { + "type": "string", + "value": { + "get_attribute": [ + "execute-jython-netconf", + "response-data" + ] + } + } + } + }, + "netconf-kotlin": { + "steps": { + "netconf-kotlin": { + "description": "deploy config", + "target": "execute-kotlin-netconf" + } + }, + "inputs": { + "netconf-host": { + "required": true, + "type": "string" + }, + "netconf-timeout": { + "required": true, + "type": "string" + } + }, + "outputs": { + "response-data": { + "type": "string", + "value": { + "get_attribute": [ + "execute-kotlin-netconf", + "response-data" + ] + } + } + } + } + }, + "node_templates": { + "execute-jython-netconf": { + "type": "component-netconf-executor", + "requirements": { + "netconf-connection": { + "capability": "netconf", + "node": "netconf-device", + "relationship": "tosca.relationships.ConnectsTo" + } + }, + "interfaces": { + "ComponentNetconfExecutor": { + "operations": { + "process": { + "inputs": { + "script-type": "jython", + "script-class-reference": "Scripts/python/NetconfTest.py", + "instance-dependencies": [] + } + } + } + } + } + }, + "execute-kotlin-netconf": { + "type": "component-netconf-executor", + "requirements": { + "netconf-connection": { + "capability": "netconf", + "node": "netconf-device", + "relationship": "tosca.relationships.ConnectsTo" + } + }, + "interfaces": { + "ComponentNetconfExecutor": { + "operations": { + "process": { + "inputs": { + "script-type": "kotlin", + "script-class-reference": "org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.ConfigDeploy", + "instance-dependencies": [] + } + } + } + } + } + }, + "netconf-device": { + "type": "vnf-netconf-device", + "capabilities": { + "netconf": { + "properties": { + "login-key": "password", + "login-account": "admin", + "target-ip-address": { + "get_input": "netconf-host" + }, + "port-number": 17830, + "connection-time-out": { + "get_input": "netconf-timeout" + } + } + } + } + } + } + } +} diff --git a/cba/netconf/Scripts/kotlin/kotlin.kt b/cba/netconf/Scripts/kotlin/kotlin.kt new file mode 100644 index 0000000..949d603 --- /dev/null +++ b/cba/netconf/Scripts/kotlin/kotlin.kt @@ -0,0 +1,63 @@ +/* + * Copyright © 2020 Bell Canada. + * + * 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. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor + +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedContentFromResolvedArtifactNB +import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils +import org.slf4j.LoggerFactory + +open class ConfigDeploy : AbstractScriptComponentFunction() { + + private val log = LoggerFactory.getLogger(ConfigDeploy::class.java)!! + + override suspend fun processNB(executionRequest: ExecutionServiceInput) { + val device = netconfDevice("netconf-connection") + val client = device.netconfRpcService + val session = device.netconfSession + + val payload=""" + + + + Regression-Mock + + + """ + + val response: MutableMap = mutableMapOf("deploySuccess" to false) + + try { + session.connect() + client.lock() + client.editConfig(payload) + client.commit() + client.unLock() + session.disconnect() + response["deploySuccess"] = true + } catch (e: Exception) { + e.message?.let { super.addError(it) } + } + + super.setAttribute("response-data", JacksonUtils.jsonNodeFromObject(response)) + } + + override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { + log.info("Executing Recovery") + } +} diff --git a/cba/netconf/Scripts/python/NetconfTest.py b/cba/netconf/Scripts/python/NetconfTest.py new file mode 100644 index 0000000..0c7a773 --- /dev/null +++ b/cba/netconf/Scripts/python/NetconfTest.py @@ -0,0 +1,56 @@ +# Copyright (c) 2019 IBM, Bell Canada. +# +# 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 netconf_constant +import sys +from java.lang import Exception as JavaException +from common import ResolutionHelper +from netconfclient import NetconfClient +import json +from org.onap.ccsdk.cds.blueprintsprocessor.services.execution import AbstractScriptComponentFunction +from com.fasterxml.jackson.databind import JsonNode; +from com.fasterxml.jackson.databind import ObjectMapper; + +class NetconfTest(AbstractScriptComponentFunction): + + def process(self, execution_request): + log = globals()[netconf_constant.SERVICE_LOG] + payload=""" + + + + Regression-Mock + + + """ + responsePayload = '{"deploySuccess": false}' + + try: + nc = NetconfClient(log, self, "netconf-connection") + nc.connect() + nc.lock() + nc.edit_config(message_content=payload, config_target="candidate") + operationResponse = nc.commit() + nc.unlock() + nc.disconnect() + responsePayload = json.dumps({"deploySuccess": operationResponse.isSuccess()}) + except JavaException, err: # Ignore PyLintBear (E0001) + self.addError(err.message) + except Exception, err: + self.addError("Python error: {}".format(err)) + + self.setAttribute("response-data", ObjectMapper().readTree(responsePayload)) + return None + + def recover(self, exception): + return None \ No newline at end of file diff --git a/cba/netconf/TOSCA-Metadata/TOSCA.meta b/cba/netconf/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 0000000..1155ae8 --- /dev/null +++ b/cba/netconf/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/netconf.json +Template-Tags: test, regression +Template-Name: RT-netconf +Template-Version: 1.0.0 +Template-Type: DEFAULT \ No newline at end of file diff --git a/cba/py-executor/.DS_Store b/cba/py-executor/.DS_Store new file mode 100644 index 0000000..cd1acc1 Binary files /dev/null and b/cba/py-executor/.DS_Store differ diff --git a/cba/py-executor/Definitions/py-executor.json b/cba/py-executor/Definitions/py-executor.json new file mode 100644 index 0000000..7d9755b --- /dev/null +++ b/cba/py-executor/Definitions/py-executor.json @@ -0,0 +1,174 @@ +{ + "metadata": { + "template_author": "Selffish", + "author-email": "test@bell.ca", + "template_name": "RT-py-executor", + "template_version": "1.0.0", + "template_tags": "Bell, CBA, test" + }, + "dsl_definitions": { + "py-executor": { + "type": "tls-auth", + "host": .PY_EXEC_SVC, + "port": "50052", + "trustCertCollection": "/opt/app/onap/config/certs/py-executor/py-executor-chain.pem" + }, + "invalid-py-executor": { + "type": "tls-auth", + "host": "127.0.0.1", + "port": "12345", + "trustCertCollection": "/opt/app/onap/config/certs/py-executor/py-executor-chain.pem" + }, + "parameters": { + "hello" : "world" + } + }, + "topology_template": { + "workflows": { + "remote-python": { + "steps": { + "execute-script": { + "description": "Execute Remote Python Script", + "target": "execute-remote-python" + } + }, + "inputs": {}, + "outputs": { + "status": { + "type": "string", + "value": { + "get_attribute": [ + "execute-remote-python", + "status" + ] + } + }, + "response-data": { + "type": "json", + "value": { + "get_attribute": [ + "execute-remote-python", + "response-data" + ] + } + } + } + }, + "connection-fail": { + "steps": { + "execute-script": { + "description": "Execute Remote Python Script to an invalid endpoint", + "target": "execute-connection-fail" + } + }, + "inputs": {}, + "outputs": { + "status": { + "type": "string", + "value": { + "get_attribute": [ + "execute-connection-fail", + "status" + ] + } + }, + "response-data": { + "type": "json", + "value": { + "get_attribute": [ + "execute-connection-fail", + "response-data" + ] + } + } + } + }, + "failing-remote-python": { + "steps": { + "execute-script": { + "description": "Execute Remote Python Script", + "target": "execute-failing-remote-python" + } + }, + "inputs": {}, + "outputs": { + "status": { + "type": "string", + "value": { + "get_attribute": [ + "execute-failing-remote-python", + "status" + ] + } + }, + "response-data": { + "type": "json", + "value": { + "get_attribute": [ + "execute-failing-remote-python", + "response-data" + ] + } + } + } + } + }, + "node_templates": { + "execute-remote-python": { + "type": "component-remote-script-executor", + "interfaces": { + "ComponentRemoteScriptExecutor": { + "operations": { + "process": { + "inputs": { + "selector": "*py-executor", + "blueprint-name": "RT-py-executor", + "blueprint-version": "1.0.0", + "blueprint-action": "HelloWorld", + "timeout": 1000, + "request-data": "*parameters" + } + } + } + } + } + }, + "execute-connection-fail": { + "type": "component-remote-script-executor", + "interfaces": { + "ComponentRemoteScriptExecutor": { + "operations": { + "process": { + "inputs": { + "selector": "*invalid-py-executor", + "blueprint-name": "RT-py-executor", + "blueprint-version": "1.0.0", + "blueprint-action": "HelloWorld", + "timeout": 1000 + } + } + } + } + } + }, + "execute-failing-remote-python": { + "type": "component-remote-script-executor", + "interfaces": { + "ComponentRemoteScriptExecutor": { + "operations": { + "process": { + "inputs": { + "selector": "*py-executor", + "blueprint-name": "RT-py-executor", + "blueprint-version": "1.0.0", + "blueprint-action": "FailingScript", + "timeout": 1000 + } + } + } + } + } + } + } + } +} diff --git a/cba/py-executor/Scripts/python/__init__.py b/cba/py-executor/Scripts/python/__init__.py new file mode 100644 index 0000000..0c354d8 --- /dev/null +++ b/cba/py-executor/Scripts/python/__init__.py @@ -0,0 +1,18 @@ +# +# Copyright © 2020 Bell Canada. +# +# 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. +# + +from .hello_world import * +from .failing_script import * diff --git a/cba/py-executor/Scripts/python/failing_script.py b/cba/py-executor/Scripts/python/failing_script.py new file mode 100644 index 0000000..e7a8802 --- /dev/null +++ b/cba/py-executor/Scripts/python/failing_script.py @@ -0,0 +1,34 @@ +#!/usr/bin/python +# +# Copyright © 2020 Bell Canada. +# +# 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 logging +from blueprints_grpc import executor_utils +from blueprints_grpc.blueprint_processing_server import AbstractScriptFunction + +class FailingScript(AbstractScriptFunction): + def __init__(self): + self.logger = logging.getLogger(self.__class__.__name__) + + def process(self, execution_request): + self.logger.info("Request Received in Script : {}".format(execution_request)) + raise RuntimeError('Script raised an exception') + + def recover(self, runtime_exception, execution_request): # Ignore PyLintBear (W0613) + return None + + def send_notification(self, execution_request): + yield executor_utils.send_notification(execution_request, "I am notification") diff --git a/cba/py-executor/Scripts/python/hello_world.py b/cba/py-executor/Scripts/python/hello_world.py new file mode 100644 index 0000000..1500a3c --- /dev/null +++ b/cba/py-executor/Scripts/python/hello_world.py @@ -0,0 +1,42 @@ +#!/usr/bin/python +# +# Copyright © 2020 Bell Canada. +# +# 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 logging +from blueprints_grpc import executor_utils +from blueprints_grpc.blueprint_processing_server import AbstractScriptFunction +import json +from google.protobuf import json_format + +class HelloWorld(AbstractScriptFunction): + def __init__(self): + self.logger = logging.getLogger(self.__class__.__name__) + + def process(self, execution_request): + self.logger.info("Request Received in Script : {}".format(execution_request)) + + inputs = json_format.MessageToJson(execution_request.payload) + response_payload_json = json.loads(inputs) + + execution_response = executor_utils.success_response(execution_request, response_payload_json, 200) + self.logger.info("Response returned : {}".format(execution_response)) + yield execution_response + + def recover(self, runtime_exception, execution_request): # Ignore PyLintBear (W0613) + return None + + def send_notification(self, execution_request): + yield executor_utils.send_notification(execution_request, "I am notification") diff --git a/cba/py-executor/TOSCA-Metadata/TOSCA.meta b/cba/py-executor/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 0000000..8389ebb --- /dev/null +++ b/cba/py-executor/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/py-executor.json +Template-Tags: test, regression +Template-Name: RT-py-executor +Template-Version: 1.0.0 +Template-Type: DEFAULT diff --git a/cba/remote-ansible/Definitions/remote-ansible.json b/cba/remote-ansible/Definitions/remote-ansible.json new file mode 100644 index 0000000..59ca6c6 --- /dev/null +++ b/cba/remote-ansible/Definitions/remote-ansible.json @@ -0,0 +1,281 @@ +{ + "metadata": { + "template_author": "Selffish", + "author-email": "test@bell.ca", + "template_name": "RT-remote-ansible", + "template_version": "1.0.0", + "template_tags": "Bell, CBA, test" + }, + "dsl_definitions": { + "ansible-remote-success-endpoint": { + "type": "token-auth", + "url": .MOCK_SRV_SUCCESS, + "token": "Bearer J9gEtMDqf7P4YsJ7444fioY9VAhLDIs1" + }, + "ansible-remote-failure-endpoint": { + "type": "token-auth", + "url": .MOCK_SRV_FAIL, + "token": "Bearer J9gEtMDqf7P4YsJ7444fioY9VAhLDIs1" + }, + "ansible-remote-invalid-endpoint": { + "type": "token-auth", + "url": "http://localhost:12345", + "token": "Bearer J9gEtMDqf7P4YsJ7444fioY9VAhLDIs1" + } + }, + "topology_template": { + "workflows": { + "execute-remote-ansible-success": { + "steps": { + "process": { + "description": "Execute Remote Ansible Script", + "target": "execute-remote-ansible-success", + "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": { + "ansible-command-status": { + "type": "string", + "value": { + "get_attribute": [ + "execute-remote-ansible-success", + "ansible-command-status" + ] + } + }, + "ansible-command-logs": { + "type": "string", + "value": { + "get_attribute": [ + "execute-remote-ansible-success", + "ansible-command-logs" + ] + } + } + } + }, + "connection-fail": { + "steps": { + "process": { + "description": "Execute Remote Ansible Script", + "target": "connection-fail", + "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": { + "ansible-command-status": { + "type": "string", + "value": { + "get_attribute": [ + "connection-fail", + "ansible-command-status" + ] + } + }, + "ansible-command-logs": { + "type": "string", + "value": { + "get_attribute": [ + "connection-fail", + "ansible-command-logs" + ] + } + } + } + }, + "execute-remote-ansible-failure": { + "steps": { + "process": { + "description": "Execute Remote Ansible Script", + "target": "execute-remote-ansible-failure", + "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": { + "ansible-command-status": { + "type": "string", + "value": { + "get_attribute": [ + "execute-remote-ansible-failure", + "ansible-command-status" + ] + } + }, + "ansible-command-logs": { + "type": "string", + "value": { + "get_attribute": [ + "execute-remote-ansible-failure", + "ansible-command-logs" + ] + } + } + } + } + }, + "node_templates": { + "execute-remote-ansible-success": { + "type": "component-remote-ansible-executor", + "interfaces": { + "ComponentRemoteAnsibleExecutor": { + "operations": { + "process": { + "inputs": { + "endpoint-selector" : "*ansible-remote-success-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" } + } + } + } + } + } + }, + "connection-fail": { + "type": "component-remote-ansible-executor", + "interfaces": { + "ComponentRemoteAnsibleExecutor": { + "operations": { + "process": { + "inputs": { + "endpoint-selector" : "*ansible-remote-invalid-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" } + } + } + } + } + } + }, + "execute-remote-ansible-failure": { + "type": "component-remote-ansible-executor", + "interfaces": { + "ComponentRemoteAnsibleExecutor": { + "operations": { + "process": { + "inputs": { + "endpoint-selector" : "*ansible-remote-failure-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" } + } + } + } + } + } + } + } + } + } diff --git a/cba/remote-ansible/TOSCA-Metadata/TOSCA.meta b/cba/remote-ansible/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 0000000..1b4ba50 --- /dev/null +++ b/cba/remote-ansible/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/remote-ansible.json +Template-Tags: test, regression +Template-Name: RT-remote-ansible +Template-Version: 1.0.0 +Template-Type: DEFAULT diff --git a/cba/remote-python/Definitions/remote-python.json b/cba/remote-python/Definitions/remote-python.json new file mode 100644 index 0000000..c002e9d --- /dev/null +++ b/cba/remote-python/Definitions/remote-python.json @@ -0,0 +1,229 @@ +{ + "metadata": { + "template_author": "Selffish", + "author-email": "test@bell.ca", + "template_name": "RT-remote-python", + "template_version": "1.0.0", + "template_tags": "Bell, CBA, test" + }, + "dsl_definitions": { + "args": { + "arg0": "remote executor regression" + }, + "remote-executor": { + "type": "token-auth", + "host": .CMD_EXEC_SVC, + "port": "50051", + "token": "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==" + }, + "remote-executor-wrong-port": { + "type": "token-auth", + "host": "127.0.0.1", + "port": "4242", + "token": "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==" + } + }, + "topology_template": { + "workflows": { + "remote-python": { + "steps": { + "execute-script": { + "description": "Execute Remote Python Script", + "target": "execute-remote-python" + } + }, + "inputs": { + "input": { + "required": false, + "type": "string" + } + }, + "outputs": { + "execute-command-logs": { + "type": "string", + "value": { + "get_attribute": [ + "execute-remote-python", + "execute-command-logs" + ] + } + }, + "execute-command-payload": { + "type": "json", + "value": { + "get_attribute": [ + "execute-remote-python", + "response-data" + ] + } + } + } + }, + "failing-remote-python": { + "steps": { + "execute-script": { + "description": "Execute Remote Python Script", + "target": "execute-failing-remote-python" + } + }, + "inputs": {}, + "outputs": { + "execute-command-logs": { + "type": "string", + "value": { + "get_attribute": [ + "execute-failing-remote-python", + "execute-command-logs" + ] + } + }, + "execute-command-payload": { + "type": "json", + "value": { + "get_attribute": [ + "execute-failing-remote-python", + "response-data" + ] + } + } + } + }, + "connection-fail": { + "steps": { + "execute-script": { + "description": "Execute Remote Python Script", + "target": "connection-fail" + } + }, + "inputs": {}, + "outputs": { + "execute-command-logs": { + "type": "string", + "value": { + "get_attribute": [ + "connection-fail", + "execute-command-logs" + ] + } + }, + "execute-command-payload": { + "type": "json", + "value": { + "get_attribute": [ + "connection-fail", + "response-data" + ] + } + } + } + } + }, + "node_templates": { + "execute-remote-python": { + "type": "component-remote-python-executor", + "interfaces": { + "ComponentRemotePythonExecutor": { + "operations": { + "process": { + "implementation": { + "primary": "component-script", + "timeout": 180, + "operation_host": "SELF" + }, + "inputs": { + "endpoint-selector": "remote-executor", + "command": "python EchoRemotePython.py", + "argument-properties": "*args", + "packages": [ + { + "type": "pip", + "package": [ + "requests" + ] + } + ] + } + } + } + } + }, + "artifacts": { + "component-script": { + "type": "artifact-script-python", + "file": "Scripts/python/EchoRemotePython.py" + } + } + }, + "execute-failing-remote-python": { + "type": "component-remote-python-executor", + "interfaces": { + "ComponentRemotePythonExecutor": { + "operations": { + "process": { + "implementation": { + "primary": "component-script", + "timeout": 180, + "operation_host": "SELF" + }, + "inputs": { + "endpoint-selector": "remote-executor", + "command": "python FailingRemotePython.py", + "argument-properties": "*args", + "packages": [ + { + "type": "pip", + "package": [ + "requests" + ] + } + ] + } + } + } + } + }, + "artifacts": { + "component-script": { + "type": "artifact-script-python", + "file": "Scripts/python/FailingRemotePython.py" + } + } + }, + "connection-fail": { + "type": "component-remote-python-executor", + "interfaces": { + "ComponentRemotePythonExecutor": { + "operations": { + "process": { + "implementation": { + "primary": "component-script", + "timeout": 180, + "operation_host": "SELF" + }, + "inputs": { + "endpoint-selector": "remote-executor-wrong-port", + "command": "python EchoRemotePython.py", + "argument-properties": "*args", + "packages": [ + { + "type": "pip", + "package": [ + "requests" + ] + } + ] + } + } + } + } + }, + "artifacts": { + "component-script": { + "type": "artifact-script-python", + "file": "Scripts/python/EchoRemotePython.py" + } + } + } + } + } +} diff --git a/cba/remote-python/Scripts/python/EchoRemotePython.py b/cba/remote-python/Scripts/python/EchoRemotePython.py new file mode 100644 index 0000000..5b775f2 --- /dev/null +++ b/cba/remote-python/Scripts/python/EchoRemotePython.py @@ -0,0 +1,28 @@ +#!/usr/bin/python +# +# Copyright © 2020 Bell Canada. +# +# 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 sys +from cds_utils.payload_coder import send_response_data_payload + +def echo(arg): + print(arg) + +if __name__ == "__main__": + echo(sys.argv[1]) + resp_data = {"abc": ["xyz", "qqq"]} + send_response_data_payload(resp_data) + sys.exit(0) diff --git a/cba/remote-python/Scripts/python/FailingRemotePython.py b/cba/remote-python/Scripts/python/FailingRemotePython.py new file mode 100644 index 0000000..e8a356b --- /dev/null +++ b/cba/remote-python/Scripts/python/FailingRemotePython.py @@ -0,0 +1,30 @@ +#!/usr/bin/python +# +# Copyright © 2020 Bell Canada. +# +# 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 sys +from cds_utils.payload_coder import send_response_data_payload + +if __name__ == "__main__": + try: + raise Exception("Intentionally raised exception!") + except Exception as e: + print("Intentionally raised exception!") + resp_data = { + "errorMessage": "Intentionally raised exception!" + } + send_response_data_payload(resp_data) + sys.exit(1) diff --git a/cba/remote-python/TOSCA-Metadata/TOSCA.meta b/cba/remote-python/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 0000000..85fa3bd --- /dev/null +++ b/cba/remote-python/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/remote-python.json +Template-Tags: test, regression +Template-Name: RT-remote-python +Template-Version: 1.0.0 +Template-Type: DEFAULT \ No newline at end of file diff --git a/cba/resource-resolution/Definitions/resource-resolution.json b/cba/resource-resolution/Definitions/resource-resolution.json new file mode 100644 index 0000000..1e38953 --- /dev/null +++ b/cba/resource-resolution/Definitions/resource-resolution.json @@ -0,0 +1,98 @@ +{ + "metadata": { + "template_author": "Selffish", + "author-email": "test@bell.ca", + "template_name": "RT-resource-resolution", + "template_version": "1.0.0", + "template_tags": "Bell, CBA, test" + }, + "dsl_definitions": { + "rest-endpoint": { + "type": "token-auth", + "url": .MOCK_SRV, + "token": "NoTokenRequired" + }, + "db-endpoint": { + "type": "maria-db", + "url": .DB_URL, + "username": "sdnctl", + "password": "sdnctl" + } + }, + "topology_template": { + "workflows": { + "resource-resolution": { + "steps": { + "helloworld": { + "description": "Component resource resolution regression test", + "target": "resource-resolution" + } + }, + "inputs": { + "resolution-key": { + "required": true, + "type": "string" + }, + "template-prefix": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "outputs": { + "meshed-template": { + "type": "json", + "value": { + "get_attribute": [ + "resource-resolution", + "assignment-params" + ] + } + } + } + } + }, + "node_templates": { + "resource-resolution": { + "type": "component-resource-resolution", + "interfaces": { + "ResourceResolutionComponent": { + "operations": { + "process": { + "inputs": { + "artifact-prefix-names": { + "get_input": "template-prefix" + }, + "store-result": true, + "resolution-key": { + "get_input": "resolution-key" + } + } + } + } + } + }, + "artifacts": { + "helloworld-velocity-template": { + "type": "artifact-template-velocity", + "file": "Templates/hello-world-template.vtl" + }, + "helloworld-velocity-mapping": { + "type": "artifact-mapping-resource", + "file": "Templates/hello-world-velocity-mapping.json" + }, + "helloworld-jinja-template": { + "type": "artifact-template-jinja", + "file": "Templates/hello-world-template.jinja" + }, + "helloworld-jinja-mapping": { + "type": "artifact-mapping-resource", + "file": "Templates/hello-world-jinja-mapping.json" + } + } + } + } + } +} \ No newline at end of file diff --git a/cba/resource-resolution/Scripts/kotlin/ResolvProperties.kt b/cba/resource-resolution/Scripts/kotlin/ResolvProperties.kt new file mode 100644 index 0000000..dff4761 --- /dev/null +++ b/cba/resource-resolution/Scripts/kotlin/ResolvProperties.kt @@ -0,0 +1,64 @@ +/* + * Copyright © 2020 Bell Canada. + * + * 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. + */ +package cba.cds.RT + +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment +import org.slf4j.LoggerFactory + +open class ResolvPropertiesKt() : ResourceAssignmentProcessor() { + + private val log = LoggerFactory.getLogger(ResolvPropertiesKt::class.java)!! + + override fun getName(): String { + return "ResolvPropertiesKt" + } + + override suspend fun processNB(resourceAssignment: ResourceAssignment) { + + var retValue = "undefined" + val resourceAssignmentNames = listOf("j_kotlin","v_kotlin") + + try { + if(resourceAssignment.name == "from_suspend_function") { + retValue = getResolvedValue(resourceAssignment) + } + if(resourceAssignmentNames.contains(resourceAssignment.name)) { + retValue = "ok" + } + ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, retValue) + + } catch (e: Exception) { + log.error(e.message, e) + ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, "ERROR") + + throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments, cause: ${e.message}", e) + } + } + + /* + * CCSDK-2150 : https://jira.onap.org/browse/CCSDK-2150 + */ + suspend fun getResolvedValue(resourceAssignment: ResourceAssignment): String { + return "ok" + } + + override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { + raRuntimeService.getBluePrintError().addError("Failed in ResolvPropertiesKt-ResourceAssignmentProcessor : ${runtimeException.message}") + } +} diff --git a/cba/resource-resolution/Scripts/python/ResolvProperties.py b/cba/resource-resolution/Scripts/python/ResolvProperties.py new file mode 100644 index 0000000..ac063cd --- /dev/null +++ b/cba/resource-resolution/Scripts/python/ResolvProperties.py @@ -0,0 +1,40 @@ +# Copyright (c) 2019 IBM, Bell Canada. +# +# 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. +from abstract_ra_processor import AbstractRAProcessor +from blueprint_constants import * + +class ResolvProperties(AbstractRAProcessor): + + def process(self, resource_assignment): + + resource_assignment_names = ["v_python","j_python"] + script_value = "undefined" + + try: + if resource_assignment.name in resource_assignment_names : + script_value = "ok" + # set value for resource getting currently resolved + self.set_resource_data_value(resource_assignment, script_value) + except JavaException, err: # Ignore PyLintBear (E0001) + log.error("Java Exception in the script {}", err) + self.set_resource_data_value(resource_assignment, "ERROR") + except Exception, err: + log.error("Python Exception in the script {}", err) + self.set_resource_data_value(resource_assignment, "ERROR") + return None + + def recover(self, runtime_exception, resource_assignment): + log.error("Exception in the script {}", runtime_exception) + print self.addError(runtime_exception.cause.message) + return None diff --git a/cba/resource-resolution/TOSCA-Metadata/TOSCA.meta b/cba/resource-resolution/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 0000000..bb9b59a --- /dev/null +++ b/cba/resource-resolution/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/resource-resolution.json +Template-Tags: test, regression +Template-Name: RT-resource-resolution +Template-Version: 1.0.0 +Template-Type: DEFAULT \ No newline at end of file diff --git a/cba/resource-resolution/Templates/hello-world-jinja-mapping.json b/cba/resource-resolution/Templates/hello-world-jinja-mapping.json new file mode 100644 index 0000000..8b3e4d0 --- /dev/null +++ b/cba/resource-resolution/Templates/hello-world-jinja-mapping.json @@ -0,0 +1,127 @@ +[ + { + "name": "j_default", + "input-param": true, + "property": { + "type": "string", + "default": "ok" + }, + "dictionary-name": "input-source", + "dictionary-source": "input", + "dependencies": [] + }, + { + "name": "j_input", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "input-source", + "dictionary-source": "input", + "dependencies": [] + }, + { + "name": "j_python", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "properties-capability-source", + "dictionary-source": "capability", + "dependencies": [] + }, + { + "name": "j_kotlin", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "kotlin-script", + "dictionary-source": "capability", + "dependencies": [] + }, + { + "name": "from_suspend_function", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "kotlin-script", + "dictionary-source": "capability", + "dependencies": [] + }, + { + "name": "j_db", + "input-param": true, + "property": { + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "dictionary-name": "RT-db", + "dictionary-source": "processor-db" + }, + { + "name": "j_get", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "RT-rest-get", + "dictionary-source": "sdnc", + "dependencies": [] + }, + { + "name": "j_get_id", + "input-param": false, + "property": { + "type": "string" + }, + "dictionary-name": "RT-rest-get-id", + "dictionary-source": "sdnc", + "dependencies": [ + "j_get" + ] + }, + { + "name": "j_post", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "RT-rest-post", + "dictionary-source": "sdnc", + "dependencies": [] + }, + { + "name": "j_put", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "RT-rest-put", + "dictionary-source": "sdnc", + "dependencies": [] + }, + { + "name": "j_patch", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "RT-rest-patch", + "dictionary-source": "sdnc", + "dependencies": [] + }, + { + "name": "j_del", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "RT-rest-delete", + "dictionary-source": "sdnc", + "dependencies": [] + } +] diff --git a/cba/resource-resolution/Templates/hello-world-template.jinja b/cba/resource-resolution/Templates/hello-world-template.jinja new file mode 100644 index 0000000..27c614e --- /dev/null +++ b/cba/resource-resolution/Templates/hello-world-template.jinja @@ -0,0 +1,20 @@ +{ + "default": "{{ j_default }}", + "input": "{{ j_input }}", + "script": { + "python": "{{ j_python }}", + "kotlin": { + "base": "{{ j_kotlin }}" + "from suspend function": "{{ from_suspend_function }}" + } + }, + "db": "{{ j_db[0].value }}", + "rest": { + "GET": "{{j_get}}", + "GET_ID": "{{j_get_id}}", + "POST": "{{j_post}}", + "PUT": "{{j_put}}", + "PATCH": "{{j_patch}}", + "DELETE": "{{j_del}}" + } +} diff --git a/cba/resource-resolution/Templates/hello-world-template.vtl b/cba/resource-resolution/Templates/hello-world-template.vtl new file mode 100644 index 0000000..f821770 --- /dev/null +++ b/cba/resource-resolution/Templates/hello-world-template.vtl @@ -0,0 +1,16 @@ +{ + "default": "${v_default}", + "input": "${v_input}", + "script": { + "python": "${v_python}", + "kotlin": "${v_kotlin}" + }, + "db": "${v_db.get(0).value}", + "rest": { + "GET": "${v_get}", + "POST": "${v_post}", + "PUT": "${v_put}", + "PATCH": "${v_patch}", + "DELETE": "${v_del}" + } +} diff --git a/cba/resource-resolution/Templates/hello-world-velocity-mapping.json b/cba/resource-resolution/Templates/hello-world-velocity-mapping.json new file mode 100644 index 0000000..4314908 --- /dev/null +++ b/cba/resource-resolution/Templates/hello-world-velocity-mapping.json @@ -0,0 +1,105 @@ +[ + { + "name": "v_default", + "input-param": true, + "property": { + "type": "string", + "default": "ok" + }, + "dictionary-name": "input-source", + "dictionary-source": "input", + "dependencies": [] + }, + { + "name": "v_input", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "input-source", + "dictionary-source": "input", + "dependencies": [] + }, + { + "name": "v_python", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "properties-capability-source", + "dictionary-source": "capability", + "dependencies": [] + }, + { + "name": "v_kotlin", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "kotlin-script", + "dictionary-source": "capability", + "dependencies": [] + }, + { + "name": "v_db", + "input-param": true, + "property": { + "type": "list", + "entry_schema": { + "type": "string" + } + }, + "dictionary-name": "RT-db", + "dictionary-source": "processor-db" + }, + { + "name": "v_get", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "RT-rest-get", + "dictionary-source": "sdnc", + "dependencies": [] + }, + { + "name": "v_post", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "RT-rest-post", + "dictionary-source": "sdnc", + "dependencies": [] + }, + { + "name": "v_put", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "RT-rest-put", + "dictionary-source": "sdnc", + "dependencies": [] + }, + { + "name": "v_patch", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "RT-rest-patch", + "dictionary-source": "sdnc", + "dependencies": [] + }, + { + "name": "v_del", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "RT-rest-delete", + "dictionary-source": "sdnc", + "dependencies": [] + } +] diff --git a/cba/retrieve-resolution/Definitions/retrieve-resolution.json b/cba/retrieve-resolution/Definitions/retrieve-resolution.json new file mode 100644 index 0000000..87fcdd9 --- /dev/null +++ b/cba/retrieve-resolution/Definitions/retrieve-resolution.json @@ -0,0 +1,120 @@ +{ + "metadata": { + "template_author": "Selffish", + "author-email": "test@bell.ca", + "template_name": "RT-retrieve-resolution", + "template_version": "1.0.0", + "template_tags": "Bell, CBA, test" + }, + "dsl_definitions": { + "retrieve-resolution-properties": { + "resolution-key": { + "get_input": "resolution-key" + }, + "artifact-name": { + "get_input": "artifact-name" + } + } + }, + "topology_template": { + "workflows": { + "retrieve-resolution": { + "steps": { + "resolve": { + "description": "Resolve", + "target": "resource-resolution", + "on_success": [ + "retrieve" + ] + }, + "retrieve": { + "description": "retrieve", + "target": "retrieve-resolution" + } + }, + "inputs": { + "resolution-key": { + "required": true, + "type": "string" + }, + "artifact-name": { + "required": true, + "type": "string" + }, + "template-prefix": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "outputs": { + "retrieved-values": { + "type": "list", + "entry_schema": { + "type": "string" + }, + "value": { + "get_attribute": [ + "retrieve-resolution", + "response-data" + ] + } + } + } + } + }, + "node_templates": { + "resource-resolution": { + "type": "component-resource-resolution", + "interfaces": { + "ResourceResolutionComponent": { + "operations": { + "process": { + "inputs": { + "artifact-prefix-names": { + "get_input": "template-prefix" + }, + "store-result": true, + "resolution-key": { + "get_input": "resolution-key" + } + } + } + } + } + }, + "artifacts": { + "helloworld-velocity-template": { + "type": "artifact-template-velocity", + "file": "Templates/hello-world-template.vtl" + }, + "helloworld-velocity-mapping": { + "type": "artifact-mapping-resource", + "file": "Templates/hello-world-velocity-mapping.json" + } + } + }, + "retrieve-resolution": { + "type": "component-script-executor", + "interfaces": { + "ComponentScriptExecutor": { + "operations": { + "process": { + "implementation": { + "primary": "component-script" + }, + "inputs": { + "script-type": "kotlin", + "script-class-reference": "cba.cds.RT.RetrieveResolution", + "dynamic-properties": "*retrieve-resolution-properties" + } + } + } + } + } + } + } + } +} diff --git a/cba/retrieve-resolution/Scripts/kotlin/ResolvProperties.kt b/cba/retrieve-resolution/Scripts/kotlin/ResolvProperties.kt new file mode 100644 index 0000000..dff4761 --- /dev/null +++ b/cba/retrieve-resolution/Scripts/kotlin/ResolvProperties.kt @@ -0,0 +1,64 @@ +/* + * Copyright © 2020 Bell Canada. + * + * 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. + */ +package cba.cds.RT + +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment +import org.slf4j.LoggerFactory + +open class ResolvPropertiesKt() : ResourceAssignmentProcessor() { + + private val log = LoggerFactory.getLogger(ResolvPropertiesKt::class.java)!! + + override fun getName(): String { + return "ResolvPropertiesKt" + } + + override suspend fun processNB(resourceAssignment: ResourceAssignment) { + + var retValue = "undefined" + val resourceAssignmentNames = listOf("j_kotlin","v_kotlin") + + try { + if(resourceAssignment.name == "from_suspend_function") { + retValue = getResolvedValue(resourceAssignment) + } + if(resourceAssignmentNames.contains(resourceAssignment.name)) { + retValue = "ok" + } + ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, retValue) + + } catch (e: Exception) { + log.error(e.message, e) + ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, "ERROR") + + throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments, cause: ${e.message}", e) + } + } + + /* + * CCSDK-2150 : https://jira.onap.org/browse/CCSDK-2150 + */ + suspend fun getResolvedValue(resourceAssignment: ResourceAssignment): String { + return "ok" + } + + override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { + raRuntimeService.getBluePrintError().addError("Failed in ResolvPropertiesKt-ResourceAssignmentProcessor : ${runtimeException.message}") + } +} diff --git a/cba/retrieve-resolution/Scripts/kotlin/ResolvProperties1.kt b/cba/retrieve-resolution/Scripts/kotlin/ResolvProperties1.kt new file mode 100644 index 0000000..d960f20 --- /dev/null +++ b/cba/retrieve-resolution/Scripts/kotlin/ResolvProperties1.kt @@ -0,0 +1,36 @@ +/* + * Copyright © 2020 Bell Canada. + * + * 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. + */ +package cba.cds.RT + +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment + +open class ResolvProperties1Kt() : ResourceAssignmentProcessor() { + + override fun getName(): String { + return "ResolvProperties1Kt" + } + + override suspend fun processNB(resourceAssignment: ResourceAssignment) { + ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, "val1") + } + + override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { + raRuntimeService.getBluePrintError().addError("Failed in ResolvPropertiesKt-ResourceAssignmentProcessor : ${runtimeException.message}") + } +} diff --git a/cba/retrieve-resolution/Scripts/kotlin/ResolvProperties2.kt b/cba/retrieve-resolution/Scripts/kotlin/ResolvProperties2.kt new file mode 100644 index 0000000..4bf7944 --- /dev/null +++ b/cba/retrieve-resolution/Scripts/kotlin/ResolvProperties2.kt @@ -0,0 +1,36 @@ +/* + * Copyright © 2020 Bell Canada. + * + * 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. + */ +package cba.cds.RT + +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment + +open class ResolvProperties2Kt() : ResourceAssignmentProcessor() { + + override fun getName(): String { + return "ResolvProperties2Kt" + } + + override suspend fun processNB(resourceAssignment: ResourceAssignment) { + ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, "val2") + } + + override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { + raRuntimeService.getBluePrintError().addError("Failed in ResolvPropertiesKt-ResourceAssignmentProcessor : ${runtimeException.message}") + } +} diff --git a/cba/retrieve-resolution/Scripts/kotlin/ResolvProperties3.kt b/cba/retrieve-resolution/Scripts/kotlin/ResolvProperties3.kt new file mode 100644 index 0000000..f8de27b --- /dev/null +++ b/cba/retrieve-resolution/Scripts/kotlin/ResolvProperties3.kt @@ -0,0 +1,35 @@ +/* + * Copyright © 2020 Bell Canada. + * + * 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. + */ +package cba.cds.RT + +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment + +open class ResolvProperties3Kt() : ResourceAssignmentProcessor() { + + override fun getName(): String { + return "ResolvProperties3Kt" + } + override suspend fun processNB(resourceAssignment: ResourceAssignment) { + ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, "val3") + } + + override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { + raRuntimeService.getBluePrintError().addError("Failed in ResolvPropertiesKt-ResourceAssignmentProcessor : ${runtimeException.message}") + } +} diff --git a/cba/retrieve-resolution/Scripts/kotlin/ResolvProperties4.kt b/cba/retrieve-resolution/Scripts/kotlin/ResolvProperties4.kt new file mode 100644 index 0000000..37e4d0b --- /dev/null +++ b/cba/retrieve-resolution/Scripts/kotlin/ResolvProperties4.kt @@ -0,0 +1,38 @@ +/* + * Copyright © 2020 Bell Canada. + * + * 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. + */ +package cba.cds.RT + +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment +import kotlinx.coroutines.delay + +open class ResolvProperties4Kt() : ResourceAssignmentProcessor() { + + override fun getName(): String { + return "ResolvProperties4Kt" + } + + override suspend fun processNB(resourceAssignment: ResourceAssignment) { + delay(1000) + ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, "val4") + } + + override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { + raRuntimeService.getBluePrintError().addError("Failed in ResolvPropertiesKt-ResourceAssignmentProcessor : ${runtimeException.message}") + } +} diff --git a/cba/retrieve-resolution/Scripts/kotlin/RetrieveResolution.kt b/cba/retrieve-resolution/Scripts/kotlin/RetrieveResolution.kt new file mode 100644 index 0000000..c223498 --- /dev/null +++ b/cba/retrieve-resolution/Scripts/kotlin/RetrieveResolution.kt @@ -0,0 +1,63 @@ +/* + * Copyright © 2020 Bell Canada. + * + * 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. + */ +package cba.cds.RT + +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.ResourceResolution +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedContentFromResolvedArtifactNB +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedResourceResolutionsNB +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor +import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType +import org.slf4j.LoggerFactory + +open class RetrieveResolution : AbstractScriptComponentFunction() { + + private val log = LoggerFactory.getLogger(RetrieveResolution::class.java)!! + private val OCCURENCE: Int = 1 + + override suspend fun processNB(executionRequest: ExecutionServiceInput) { + + /* + * Here resolution-key comes as part of retrieve-resolution request payload. + */ + val resolution_key = getDynamicProperties("resolution-key").asText() + log.info("Got the resolution_key: $resolution_key from RetrieveResolution") + + /* + * Here artifact_name comes as part of retrieve-resolution request payload. + */ + val artifact_name = getDynamicProperties("artifact-name").asText() + log.info("Got the artifact_name: $artifact_name from RetrieveResolution") + + val output: List = storedResourceResolutionsNB(resolution_key, artifact_name, OCCURENCE) + val sortedValueOutput = output.sortedBy { it.value }.map { it -> it.value } + + val result = storedContentFromResolvedArtifactNB(resolution_key, artifact_name) + val returnVal = mutableMapOf( + "resolved-template" to result.asJsonType(), + "retrieved-resolution" to mutableListOf(sortedValueOutput).asJsonType() + ).asJsonType() + + log.info("Return Val: \n$returnVal\n") + // Return the response. + setAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, returnVal) + } + + override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { + log.info("Executing Recovery") + } +} diff --git a/cba/retrieve-resolution/TOSCA-Metadata/TOSCA.meta b/cba/retrieve-resolution/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 0000000..03f9368 --- /dev/null +++ b/cba/retrieve-resolution/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/retrieve-resolution.json +Template-Tags: test, regression +Template-Name: RT-retrieve-resolution +Template-Version: 1.0.0 +Template-Type: DEFAULT \ No newline at end of file diff --git a/cba/retrieve-resolution/Templates/hello-world-template.vtl b/cba/retrieve-resolution/Templates/hello-world-template.vtl new file mode 100644 index 0000000..38f1c5f --- /dev/null +++ b/cba/retrieve-resolution/Templates/hello-world-template.vtl @@ -0,0 +1,7 @@ +{ + "input": "${v_input}", + "kotlin1": "${v_kotlin1}", + "kotlin2": "${v_kotlin2}", + "kotlin3": "${v_kotlin3}", + "kotlin4": "${v_kotlin4}" +} diff --git a/cba/retrieve-resolution/Templates/hello-world-velocity-mapping.json b/cba/retrieve-resolution/Templates/hello-world-velocity-mapping.json new file mode 100644 index 0000000..93c4704 --- /dev/null +++ b/cba/retrieve-resolution/Templates/hello-world-velocity-mapping.json @@ -0,0 +1,52 @@ +[ + { + "name": "v_input", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "input-source", + "dictionary-source": "input", + "dependencies": [] + }, + { + "name": "v_kotlin1", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "kotlin-script-1", + "dictionary-source": "capability", + "dependencies": [] + }, + { + "name": "v_kotlin2", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "kotlin-script-2", + "dictionary-source": "capability", + "dependencies": [] + }, + { + "name": "v_kotlin3", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "kotlin-script-3", + "dictionary-source": "capability", + "dependencies": [] + }, + { + "name": "v_kotlin4", + "input-param": true, + "property": { + "type": "string" + }, + "dictionary-name": "kotlin-script-4", + "dictionary-source": "capability", + "dependencies": [] + } +] 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 deleted file mode 100644 index eb39f30..0000000 --- a/cds-regression-test/cba/ansible-python-dg/Definitions/ansible-python.json +++ /dev/null @@ -1,175 +0,0 @@ -{ - "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 deleted file mode 100644 index e00f17a..0000000 --- a/cds-regression-test/cba/ansible-python-dg/Plans/ansible-python-dg.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ 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 deleted file mode 100644 index 76af364..0000000 --- a/cds-regression-test/cba/ansible-python-dg/Scripts/rt-python.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/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 deleted file mode 100644 index 844f38b..0000000 --- a/cds-regression-test/cba/ansible-python-dg/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -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 diff --git a/cds-regression-test/cba/cba/ansible-python-dg/Definitions/ansible-python.json b/cds-regression-test/cba/cba/ansible-python-dg/Definitions/ansible-python.json deleted file mode 100644 index eb39f30..0000000 --- a/cds-regression-test/cba/cba/ansible-python-dg/Definitions/ansible-python.json +++ /dev/null @@ -1,175 +0,0 @@ -{ - "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/cba/ansible-python-dg/Plans/ansible-python-dg.xml b/cds-regression-test/cba/cba/ansible-python-dg/Plans/ansible-python-dg.xml deleted file mode 100644 index e00f17a..0000000 --- a/cds-regression-test/cba/cba/ansible-python-dg/Plans/ansible-python-dg.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/cds-regression-test/cba/cba/ansible-python-dg/Scripts/rt-python.py b/cds-regression-test/cba/cba/ansible-python-dg/Scripts/rt-python.py deleted file mode 100644 index 76af364..0000000 --- a/cds-regression-test/cba/cba/ansible-python-dg/Scripts/rt-python.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/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/cba/ansible-python-dg/TOSCA-Metadata/TOSCA.meta b/cds-regression-test/cba/cba/ansible-python-dg/TOSCA-Metadata/TOSCA.meta deleted file mode 100644 index 844f38b..0000000 --- a/cds-regression-test/cba/cba/ansible-python-dg/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -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 diff --git a/cds-regression-test/cba/cba/cli/elalto/Definitions/cli.json b/cds-regression-test/cba/cba/cli/elalto/Definitions/cli.json deleted file mode 100644 index 722663e..0000000 --- a/cds-regression-test/cba/cba/cli/elalto/Definitions/cli.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "metadata": { - "template_author": "Selffish", - "author-email": "test@bell.ca", - "template_name": "RT-cli", - "template_version": "1.0.0", - "template_tags": "test, regression" - }, - "dsl_definitions": { - "device-properties": { - "type": "basic-auth", - "host": { - "get_input": "host" - }, - "username": { - "get_input": "username" - }, - "password": { - "get_input": "password" - }, - "port": { - "get_input": "port" - }, - "connectionTimeOut": { - "get_input": "connectionTimeOut" - } - } - }, - "topology_template": { - "workflows": { - "cli": { - "steps": { - "cli": { - "description": "CLI Workflow", - "target": "cli" - } - }, - "inputs": { - "resolution-key": { - "required": false, - "type": "string" - }, - "password": { - "required": true, - "type": "string" - }, - "username": { - "required": true, - "type": "string" - }, - "host": { - "required": true, - "type": "string" - }, - "port": { - "required": false, - "type": "string" - }, - "connectionTimeOut": { - "required": true, - "type": "string" - }, - "commands": { - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "outputs": { - "response-data": { - "type": "string", - "value": { - "get_attribute": [ - "cli", - "response-data" - ] - } - } - } - } - }, - "node_templates": { - "cli": { - "type": "component-script-executor", - "interfaces": { - "ComponentScriptExecutor": { - "operations": { - "process": { - "implementation": { - "primary": "component-script" - }, - "inputs": { - "script-type": "kotlin", - "script-class-reference": "cli.CliRegressionTest" - }, - "outputs": {} - } - } - } - } - } - } - } -} diff --git a/cds-regression-test/cba/cba/cli/elalto/Scripts/kotlin/cli/cli.kt b/cds-regression-test/cba/cba/cli/elalto/Scripts/kotlin/cli/cli.kt deleted file mode 100755 index 12786c8..0000000 --- a/cds-regression-test/cba/cba/cli/elalto/Scripts/kotlin/cli/cli.kt +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright © 2019 IBM, Bell Canada. - * - * 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. - */ - -package cli - -import org.onap.ccsdk.cds.controllerblueprints.core.logger -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput -import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.cliDeviceInfo -import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.getSshClientService -import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction -import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor -import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils - - -open class CliRegressionTest : AbstractScriptComponentFunction() { - - private val log = logger(CliRegressionTest::class) - - override suspend fun processNB(executionRequest: ExecutionServiceInput) { - // Get Client Service - val sshClientService = getSshClientService(cliDeviceInfo("device-properties")) - sshClientService.startSession() - - // Read Commands - val timeout = bluePrintRuntimeService.getInputValue("connectionTimeOut").asText() - val commands = bluePrintRuntimeService.getInputValue("commands") - .let { JacksonUtils.getListFromJsonNode(it, String::class.java) } - - // Execute - var responsesLog = "Error" - try { - responsesLog = sshClientService.executeCommands(commands, timeout.toLong()) - log.info(responsesLog) - } catch (e: Exception) { - e.message?.let { addError(it) } - } finally { - setAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, responsesLog.asJsonPrimitive()) - sshClientService.closeSession() - } - } - - override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - log.info("Executing Recovery") - } -} \ No newline at end of file diff --git a/cds-regression-test/cba/cba/cli/elalto/TOSCA-Metadata/TOSCA.meta b/cds-regression-test/cba/cba/cli/elalto/TOSCA-Metadata/TOSCA.meta deleted file mode 100755 index 7bb2d45..0000000 --- a/cds-regression-test/cba/cba/cli/elalto/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: Selffish -Entry-Definitions: Definitions/cli.json -Template-Tags: test, regression -Template-Name: RT-cli -Template-Version: 1.0.0 -Template-Type: DEFAULT \ No newline at end of file diff --git a/cds-regression-test/cba/cba/cli/frankfurt/Definitions/cli.json b/cds-regression-test/cba/cba/cli/frankfurt/Definitions/cli.json deleted file mode 100644 index c0070da..0000000 --- a/cds-regression-test/cba/cba/cli/frankfurt/Definitions/cli.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "metadata": { - "template_author": "Selffish", - "author-email": "test@bell.ca", - "template_name": "RT-cli", - "template_version": "1.0.0", - "template_tags": "test, regression" - }, - "dsl_definitions": { - "device-properties": { - "type": "basic-auth", - "host": { - "get_input": "host" - }, - "username": { - "get_input": "username" - }, - "password": { - "get_input": "password" - }, - "port": { - "get_input": "port" - }, - "logging": { - "get_input": "logging" - }, - "connectionTimeOut": { - "get_input": "connectionTimeOut" - } - } - }, - "topology_template": { - "workflows": { - "cli": { - "steps": { - "cli": { - "description": "CLI Workflow", - "target": "cli" - } - }, - "inputs": { - "resolution-key": { - "required": false, - "type": "string" - }, - "password": { - "required": true, - "type": "string" - }, - "username": { - "required": true, - "type": "string" - }, - "host": { - "required": true, - "type": "string" - }, - "port": { - "required": false, - "type": "string" - }, - "connectionTimeOut": { - "required": true, - "type": "string" - }, - "logging": { - "required": true, - "type": "boolean" - }, - "commands": { - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "outputs": { - "response-data": { - "type": "string", - "value": { - "get_attribute": [ - "cli", - "response-data" - ] - } - } - } - } - }, - "node_templates": { - "cli": { - "type": "component-script-executor", - "interfaces": { - "ComponentScriptExecutor": { - "operations": { - "process": { - "implementation": { - "primary": "component-script" - }, - "inputs": { - "script-type": "kotlin", - "script-class-reference": "cli.CliRegressionTest" - }, - "outputs": {} - } - } - } - } - } - } - } -} diff --git a/cds-regression-test/cba/cba/cli/frankfurt/Scripts/kotlin/cli/cli.kt b/cds-regression-test/cba/cba/cli/frankfurt/Scripts/kotlin/cli/cli.kt deleted file mode 100755 index 1e1ade0..0000000 --- a/cds-regression-test/cba/cba/cli/frankfurt/Scripts/kotlin/cli/cli.kt +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright © 2019 IBM, Bell Canada. - * - * 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. - */ - -package cli - -import org.onap.ccsdk.cds.controllerblueprints.core.logger -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput -import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.cliDeviceInfo -import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.getSshClientService -import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction -import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor -import org.onap.ccsdk.cds.blueprintsprocessor.ssh.service.CommandResult -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType - -open class CliRegressionTest : AbstractScriptComponentFunction() { - - private val log = logger(CliRegressionTest::class) - - override suspend fun processNB(executionRequest: ExecutionServiceInput) { - // Get Client Service - val sshClientService = getSshClientService(cliDeviceInfo("device-properties")) - sshClientService.startSession() - - // Read Commands - val timeout = bluePrintRuntimeService.getInputValue("connectionTimeOut").asText() - val commands = bluePrintRuntimeService.getInputValue("commands") - .let { JacksonUtils.getListFromJsonNode(it, String::class.java) } - - // Execute - var responsesLog: List? = null - try { - responsesLog = sshClientService.executeCommands(commands, timeout.toLong()) - log.info(responsesLog.toString()) - } catch (e: Exception) { - e.message?.let { addError(it) } - } finally { - setAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, responsesLog?.map { it->it.asJsonType()}.asJsonType()) - sshClientService.closeSession() - } - } - - override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - log.info("Executing Recovery") - } -} diff --git a/cds-regression-test/cba/cba/cli/frankfurt/TOSCA-Metadata/TOSCA.meta b/cds-regression-test/cba/cba/cli/frankfurt/TOSCA-Metadata/TOSCA.meta deleted file mode 100755 index 7bb2d45..0000000 --- a/cds-regression-test/cba/cba/cli/frankfurt/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: Selffish -Entry-Definitions: Definitions/cli.json -Template-Tags: test, regression -Template-Name: RT-cli -Template-Version: 1.0.0 -Template-Type: DEFAULT \ No newline at end of file diff --git a/cds-regression-test/cba/cba/lock-device/Definitions/lock-device.json b/cds-regression-test/cba/cba/lock-device/Definitions/lock-device.json deleted file mode 100644 index c90021c..0000000 --- a/cds-regression-test/cba/cba/lock-device/Definitions/lock-device.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "metadata": { - "template_author": "Selffish", - "author-email": "test@bell.ca", - "template_name": "RT-lock-device", - "template_version": "1.0.0", - "template_tags": "Bell, CBA, test" - }, - "dsl_definitions": {}, - "topology_template": { - "workflows": { - "resolve-deploy-kotlin": { - "steps": { - "resolve": { - "description": "resolve vnf-id", - "target": "resource-resolution", - "on_success": [ - "execute-script" - ] - }, - "execute-script": { - "description": "Execute Kotlin Script", - "target": "execute-kotlin" - } - }, - "outputs": { - "response-data": { - "type": "string", - "value": { - "get_attribute": [ - "execute-kotlin", - "response-data" - ] - } - } - } - } - }, - "node_templates": { - "resource-resolution": { - "type": "component-resource-resolution", - "interfaces": { - "ResourceResolutionComponent": { - "operations": { - "process": { - "inputs": { - "artifact-prefix-names": [ - "base" - ], - "resolution-summary": true - } - } - } - } - }, - "artifacts": { - "base-mapping": { - "type": "artifact-mapping-resource", - "file": "Templates/base-mapping.json" - } - } - }, - "execute-kotlin": { - "type": "component-script-executor", - "interfaces": { - "ComponentScriptExecutor": { - "operations": { - "process": { - "implementation": { - "primary": "component-script", - "lock": { - "key": { - "get_attribute": [ - "resource-resolution", - "", - "assignment-map", - "base", - "vnf-id" - ] - }, - "acquireTimeout": { - "get_input": "lock-acquire-timeout" - } - } - }, - "inputs": { - "script-type": "kotlin", - "script-class-reference": "cba.cds.RT.ProcessOperation" - }, - "outputs": {} - } - } - } - } - } - } - } -} diff --git a/cds-regression-test/cba/cba/lock-device/Scripts/kotlin/ProcessOperation.kt b/cds-regression-test/cba/cba/lock-device/Scripts/kotlin/ProcessOperation.kt deleted file mode 100755 index 4c795e4..0000000 --- a/cds-regression-test/cba/cba/lock-device/Scripts/kotlin/ProcessOperation.kt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright © 2019 Bell Canada. - * - * 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. - */ - -package cba.cds.RT - -import org.onap.ccsdk.cds.controllerblueprints.core.logger -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput -import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction -import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor -import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType -import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BasicAuthRestClientService -import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties -import kotlinx.coroutines.delay - -open class ProcessOperation : AbstractScriptComponentFunction() { - - private val log = logger(ProcessOperation::class) - - override suspend fun processNB(executionRequest: ExecutionServiceInput) { - val time : Long = 15_000 - try { - log.info("Processing for $time ms... ${executionRequest.commonHeader.requestId}") - delay(time) - log.info("Done processing ${executionRequest.commonHeader.requestId}!") - setAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, "Success: ${executionRequest.commonHeader.requestId}".asJsonType()) - } catch (e: Exception) { - e.message?.let { addError(it) } - } - } - - override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - setAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, runtimeException.message!!.asJsonType()) - addError(runtimeException.message!!) - log.info("Executing Recovery") - } -} diff --git a/cds-regression-test/cba/cba/lock-device/TOSCA-Metadata/TOSCA.meta b/cds-regression-test/cba/cba/lock-device/TOSCA-Metadata/TOSCA.meta deleted file mode 100644 index e182865..0000000 --- a/cds-regression-test/cba/cba/lock-device/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: Selffish -Entry-Definitions: Definitions/lock-device.json -Template-Tags: test, regression -Template-Name: RT-lock-device -Template-Version: 1.0.0 -Template-Type: DEFAULT \ No newline at end of file diff --git a/cds-regression-test/cba/cba/lock-device/Templates/base-mapping.json b/cds-regression-test/cba/cba/lock-device/Templates/base-mapping.json deleted file mode 100644 index b5b64a8..0000000 --- a/cds-regression-test/cba/cba/lock-device/Templates/base-mapping.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - { - "name": "vnf-id", - "input-param": true, - "property": { - "type": "string", - "default": "rt-vnf-xyz-123" - }, - "dictionary-name": "input-source", - "dictionary-source": "default", - "dependencies": [] - }, - { - "name": "lock-acquire-timeout", - "input-param": true, - "property": { - "type": "integer" - }, - "dictionary-name": "input-source", - "dictionary-source": "input", - "dependencies": [] - } -] diff --git a/cds-regression-test/cba/cba/netconf/Definitions/netconf.json b/cds-regression-test/cba/cba/netconf/Definitions/netconf.json deleted file mode 100644 index 74a98c1..0000000 --- a/cds-regression-test/cba/cba/netconf/Definitions/netconf.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "metadata": { - "template_author": "Selffish", - "author-email": "test@bell.ca", - "template_name": "RT-netconf", - "template_version": "1.0.0", - "template_tags": "Bell, CBA, test" - }, - "topology_template": { - "workflows": { - "netconf-jython": { - "steps": { - "netconf-jython": { - "description": "deploy config", - "target": "execute-jython-netconf" - } - }, - "inputs": { - "netconf-host": { - "required": true, - "type": "string" - }, - "netconf-timeout": { - "required": true, - "type": "string" - } - }, - "outputs": { - "response-data": { - "type": "string", - "value": { - "get_attribute": [ - "execute-jython-netconf", - "response-data" - ] - } - } - } - }, - "netconf-kotlin": { - "steps": { - "netconf-kotlin": { - "description": "deploy config", - "target": "execute-kotlin-netconf" - } - }, - "inputs": { - "netconf-host": { - "required": true, - "type": "string" - }, - "netconf-timeout": { - "required": true, - "type": "string" - } - }, - "outputs": { - "response-data": { - "type": "string", - "value": { - "get_attribute": [ - "execute-kotlin-netconf", - "response-data" - ] - } - } - } - } - }, - "node_templates": { - "execute-jython-netconf": { - "type": "component-netconf-executor", - "requirements": { - "netconf-connection": { - "capability": "netconf", - "node": "netconf-device", - "relationship": "tosca.relationships.ConnectsTo" - } - }, - "interfaces": { - "ComponentNetconfExecutor": { - "operations": { - "process": { - "inputs": { - "script-type": "jython", - "script-class-reference": "Scripts/python/NetconfTest.py", - "instance-dependencies": [] - } - } - } - } - } - }, - "execute-kotlin-netconf": { - "type": "component-netconf-executor", - "requirements": { - "netconf-connection": { - "capability": "netconf", - "node": "netconf-device", - "relationship": "tosca.relationships.ConnectsTo" - } - }, - "interfaces": { - "ComponentNetconfExecutor": { - "operations": { - "process": { - "inputs": { - "script-type": "kotlin", - "script-class-reference": "org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.ConfigDeploy", - "instance-dependencies": [] - } - } - } - } - } - }, - "netconf-device": { - "type": "vnf-netconf-device", - "capabilities": { - "netconf": { - "properties": { - "login-key": "password", - "login-account": "admin", - "target-ip-address": { - "get_input": "netconf-host" - }, - "port-number": 17830, - "connection-time-out": { - "get_input": "netconf-timeout" - } - } - } - } - } - } - } -} diff --git a/cds-regression-test/cba/cba/netconf/Scripts/kotlin/kotlin.kt b/cds-regression-test/cba/cba/netconf/Scripts/kotlin/kotlin.kt deleted file mode 100644 index 956890a..0000000 --- a/cds-regression-test/cba/cba/netconf/Scripts/kotlin/kotlin.kt +++ /dev/null @@ -1,47 +0,0 @@ -package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor - -import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput -import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedContentFromResolvedArtifactNB -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -import org.slf4j.LoggerFactory - -open class ConfigDeploy : AbstractScriptComponentFunction() { - - private val log = LoggerFactory.getLogger(ConfigDeploy::class.java)!! - - override suspend fun processNB(executionRequest: ExecutionServiceInput) { - val device = netconfDevice("netconf-connection") - val client = device.netconfRpcService - val session = device.netconfSession - - val payload=""" - - - - Regression-Mock - - - """ - - val response: MutableMap = mutableMapOf("deploySuccess" to false) - - try { - session.connect() - client.lock() - client.editConfig(payload) - client.commit() - client.unLock() - session.disconnect() - response["deploySuccess"] = true - } catch (e: Exception) { - e.message?.let { super.addError(it) } - } - - super.setAttribute("response-data", JacksonUtils.jsonNodeFromObject(response)) - } - - override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - log.info("Executing Recovery") - } -} diff --git a/cds-regression-test/cba/cba/netconf/Scripts/python/NetconfTest.py b/cds-regression-test/cba/cba/netconf/Scripts/python/NetconfTest.py deleted file mode 100644 index 7b743d6..0000000 --- a/cds-regression-test/cba/cba/netconf/Scripts/python/NetconfTest.py +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (c) 2019 IBM, Bell Canada. -# -# 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 netconf_constant -from java.lang import Exception as JavaException -from netconfclient import NetconfClient -import json -from org.onap.ccsdk.cds.blueprintsprocessor.services.execution import AbstractScriptComponentFunction - -class NetconfTest(AbstractScriptComponentFunction): - - def process(self): - log = globals()[netconf_constant.SERVICE_LOG] - payload=""" - - - - Regression-Mock - - - """ - responsePayload = '{"deploySuccess": false}' - print(responsePayload) - - try: - nc = NetconfClient(log, self, "netconf-connection") - nc.connect() - nc.lock() - nc.edit_config(message_content=payload, config_target="candidate") - operationResponse = nc.commit() - nc.unlock() - nc.disconnect() - responsePayload = json.dumps({"deploySuccess": operationResponse.isSuccess()}) - except JavaException as err: - self.addError(err.message) - except Exception as err: - self.addError("Python error: {}".format(err)) - - # self.setAttribute("response-data", ObjectMapper().readTree(responsePayload)) - return None - - def recover(self): - return None diff --git a/cds-regression-test/cba/cba/netconf/TOSCA-Metadata/TOSCA.meta b/cds-regression-test/cba/cba/netconf/TOSCA-Metadata/TOSCA.meta deleted file mode 100644 index 1155ae8..0000000 --- a/cds-regression-test/cba/cba/netconf/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: Selffish -Entry-Definitions: Definitions/netconf.json -Template-Tags: test, regression -Template-Name: RT-netconf -Template-Version: 1.0.0 -Template-Type: DEFAULT \ No newline at end of file diff --git a/cds-regression-test/cba/cba/py-executor/.DS_Store b/cds-regression-test/cba/cba/py-executor/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/cds-regression-test/cba/cba/py-executor/.DS_Store and /dev/null differ diff --git a/cds-regression-test/cba/cba/py-executor/Definitions/py-executor.json b/cds-regression-test/cba/cba/py-executor/Definitions/py-executor.json deleted file mode 100644 index b28162c..0000000 --- a/cds-regression-test/cba/cba/py-executor/Definitions/py-executor.json +++ /dev/null @@ -1,174 +0,0 @@ -{ - "metadata": { - "template_author": "Selffish", - "author-email": "test@bell.ca", - "template_name": "RT-py-executor", - "template_version": "1.0.0", - "template_tags": "Bell, CBA, test" - }, - "dsl_definitions": { - "py-executor": { - "type": "tls-auth", - "host": "cds-py-executor-py-exec", - "port": "50052", - "trustCertCollection": "/opt/app/onap/config/certs/py-executor/py-executor-chain.pem" - }, - "invalid-py-executor": { - "type": "tls-auth", - "host": "127.0.0.1", - "port": "12345", - "trustCertCollection": "/opt/app/onap/config/certs/py-executor/py-executor-chain.pem" - }, - "parameters": { - "hello": "world" - } - }, - "topology_template": { - "workflows": { - "remote-python": { - "steps": { - "execute-script": { - "description": "Execute Remote Python Script", - "target": "execute-remote-python" - } - }, - "inputs": {}, - "outputs": { - "status": { - "type": "string", - "value": { - "get_attribute": [ - "execute-remote-python", - "status" - ] - } - }, - "response-data": { - "type": "json", - "value": { - "get_attribute": [ - "execute-remote-python", - "response-data" - ] - } - } - } - }, - "connection-fail": { - "steps": { - "execute-script": { - "description": "Execute Remote Python Script to an invalid endpoint", - "target": "execute-connection-fail" - } - }, - "inputs": {}, - "outputs": { - "status": { - "type": "string", - "value": { - "get_attribute": [ - "execute-connection-fail", - "status" - ] - } - }, - "response-data": { - "type": "json", - "value": { - "get_attribute": [ - "execute-connection-fail", - "response-data" - ] - } - } - } - }, - "failing-remote-python": { - "steps": { - "execute-script": { - "description": "Execute Remote Python Script", - "target": "execute-failing-remote-python" - } - }, - "inputs": {}, - "outputs": { - "status": { - "type": "string", - "value": { - "get_attribute": [ - "execute-failing-remote-python", - "status" - ] - } - }, - "response-data": { - "type": "json", - "value": { - "get_attribute": [ - "execute-failing-remote-python", - "response-data" - ] - } - } - } - } - }, - "node_templates": { - "execute-remote-python": { - "type": "component-remote-script-executor", - "interfaces": { - "ComponentRemoteScriptExecutor": { - "operations": { - "process": { - "inputs": { - "selector": "*py-executor", - "blueprint-name": "RT-py-executor", - "blueprint-version": "1.0.0", - "blueprint-action": "HelloWorld", - "timeout": 1000, - "request-data": "*parameters" - } - } - } - } - } - }, - "execute-connection-fail": { - "type": "component-remote-script-executor", - "interfaces": { - "ComponentRemoteScriptExecutor": { - "operations": { - "process": { - "inputs": { - "selector": "*invalid-py-executor", - "blueprint-name": "RT-py-executor", - "blueprint-version": "1.0.0", - "blueprint-action": "HelloWorld", - "timeout": 1000 - } - } - } - } - } - }, - "execute-failing-remote-python": { - "type": "component-remote-script-executor", - "interfaces": { - "ComponentRemoteScriptExecutor": { - "operations": { - "process": { - "inputs": { - "selector": "*py-executor", - "blueprint-name": "RT-py-executor", - "blueprint-version": "1.0.0", - "blueprint-action": "FailingScript", - "timeout": 1000 - } - } - } - } - } - } - } - } -} diff --git a/cds-regression-test/cba/cba/py-executor/Scripts/python/__init__.py b/cds-regression-test/cba/cba/py-executor/Scripts/python/__init__.py deleted file mode 100644 index dcef3a9..0000000 --- a/cds-regression-test/cba/cba/py-executor/Scripts/python/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright © 2018-2019 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. - -from .hello_world import * -from .failing_script import * diff --git a/cds-regression-test/cba/cba/py-executor/Scripts/python/failing_script.py b/cds-regression-test/cba/cba/py-executor/Scripts/python/failing_script.py deleted file mode 100644 index 66efd3f..0000000 --- a/cds-regression-test/cba/cba/py-executor/Scripts/python/failing_script.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/python -# -# Copyright © 2018-2019 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 logging -from blueprints_grpc import executor_utils -from blueprints_grpc.blueprint_processing_server import AbstractScriptFunction - - -class FailingScript(AbstractScriptFunction): - def __init__(self): - self.logger = logging.getLogger(self.__class__.__name__) - - def process(self, execution_request): - self.logger.info("Request Received in Script : {}".format(execution_request)) - raise RuntimeError('Script raised an exception') - - def recover(self): - return None - - def send_notification(self, execution_request): - yield executor_utils.send_notification(execution_request, "I am notification") diff --git a/cds-regression-test/cba/cba/py-executor/Scripts/python/hello_world.py b/cds-regression-test/cba/cba/py-executor/Scripts/python/hello_world.py deleted file mode 100644 index 1d308ee..0000000 --- a/cds-regression-test/cba/cba/py-executor/Scripts/python/hello_world.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/python -# -# Copyright © 2018-2019 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 logging -from blueprints_grpc import executor_utils -from blueprints_grpc.blueprint_processing_server import AbstractScriptFunction -import json -from google.protobuf import json_format - -class HelloWorld(AbstractScriptFunction): - def __init__(self): - self.logger = logging.getLogger(self.__class__.__name__) - - def process(self, execution_request): - self.logger.info("Request Received in Script : {}".format(execution_request)) - - inputs = json_format.MessageToJson(execution_request.payload) - response_payload_json = json.loads(inputs) - - execution_response = executor_utils.success_response(execution_request, response_payload_json, 200) - self.logger.info("Response returned : {}".format(execution_response)) - yield execution_response - - def recover(self): - return None - - def send_notification(self, execution_request): - yield executor_utils.send_notification(execution_request, "I am notification") diff --git a/cds-regression-test/cba/cba/py-executor/TOSCA-Metadata/TOSCA.meta b/cds-regression-test/cba/cba/py-executor/TOSCA-Metadata/TOSCA.meta deleted file mode 100644 index 8389ebb..0000000 --- a/cds-regression-test/cba/cba/py-executor/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: Selffish -Entry-Definitions: Definitions/py-executor.json -Template-Tags: test, regression -Template-Name: RT-py-executor -Template-Version: 1.0.0 -Template-Type: DEFAULT diff --git a/cds-regression-test/cba/cba/remote-ansible/Definitions/remote-ansible.json b/cds-regression-test/cba/cba/remote-ansible/Definitions/remote-ansible.json deleted file mode 100644 index ee0d466..0000000 --- a/cds-regression-test/cba/cba/remote-ansible/Definitions/remote-ansible.json +++ /dev/null @@ -1,317 +0,0 @@ -{ - "metadata": { - "template_author": "Selffish", - "author-email": "test@bell.ca", - "template_name": "RT-remote-ansible", - "template_version": "1.0.0", - "template_tags": "Bell, CBA, test" - }, - "dsl_definitions": { - "ansible-remote-success-endpoint": { - "type": "token-auth", - "url": "http://cds-regression-mockserver/remote-ansible/success", - "token": "Bearer J9gEtMDqf7P4YsJ7444fioY9VAhLDIs1" - }, - "ansible-remote-failure-endpoint": { - "type": "token-auth", - "url": "http://cds-regression-mockserver/remote-ansible/failure", - "token": "Bearer J9gEtMDqf7P4YsJ7444fioY9VAhLDIs1" - }, - "ansible-remote-invalid-endpoint": { - "type": "token-auth", - "url": "http://localhost:12345", - "token": "Bearer J9gEtMDqf7P4YsJ7444fioY9VAhLDIs1" - } - }, - "topology_template": { - "workflows": { - "execute-remote-ansible-success": { - "steps": { - "process": { - "description": "Execute Remote Ansible Script", - "target": "execute-remote-ansible-success", - "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": { - "ansible-command-status": { - "type": "string", - "value": { - "get_attribute": [ - "execute-remote-ansible-success", - "ansible-command-status" - ] - } - }, - "ansible-command-logs": { - "type": "string", - "value": { - "get_attribute": [ - "execute-remote-ansible-success", - "ansible-command-logs" - ] - } - } - } - }, - "connection-fail": { - "steps": { - "process": { - "description": "Execute Remote Ansible Script", - "target": "connection-fail", - "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": { - "ansible-command-status": { - "type": "string", - "value": { - "get_attribute": [ - "connection-fail", - "ansible-command-status" - ] - } - }, - "ansible-command-logs": { - "type": "string", - "value": { - "get_attribute": [ - "connection-fail", - "ansible-command-logs" - ] - } - } - } - }, - "execute-remote-ansible-failure": { - "steps": { - "process": { - "description": "Execute Remote Ansible Script", - "target": "execute-remote-ansible-failure", - "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": { - "ansible-command-status": { - "type": "string", - "value": { - "get_attribute": [ - "execute-remote-ansible-failure", - "ansible-command-status" - ] - } - }, - "ansible-command-logs": { - "type": "string", - "value": { - "get_attribute": [ - "execute-remote-ansible-failure", - "ansible-command-logs" - ] - } - } - } - } - }, - "node_templates": { - "execute-remote-ansible-success": { - "type": "component-remote-ansible-executor", - "interfaces": { - "ComponentRemoteAnsibleExecutor": { - "operations": { - "process": { - "inputs": { - "endpoint-selector": "*ansible-remote-success-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" - } - } - } - } - } - } - }, - "connection-fail": { - "type": "component-remote-ansible-executor", - "interfaces": { - "ComponentRemoteAnsibleExecutor": { - "operations": { - "process": { - "inputs": { - "endpoint-selector": "*ansible-remote-invalid-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" - } - } - } - } - } - } - }, - "execute-remote-ansible-failure": { - "type": "component-remote-ansible-executor", - "interfaces": { - "ComponentRemoteAnsibleExecutor": { - "operations": { - "process": { - "inputs": { - "endpoint-selector": "*ansible-remote-failure-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" - } - } - } - } - } - } - } - } - } -} diff --git a/cds-regression-test/cba/cba/remote-ansible/TOSCA-Metadata/TOSCA.meta b/cds-regression-test/cba/cba/remote-ansible/TOSCA-Metadata/TOSCA.meta deleted file mode 100644 index 1b4ba50..0000000 --- a/cds-regression-test/cba/cba/remote-ansible/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: Selffish -Entry-Definitions: Definitions/remote-ansible.json -Template-Tags: test, regression -Template-Name: RT-remote-ansible -Template-Version: 1.0.0 -Template-Type: DEFAULT diff --git a/cds-regression-test/cba/cba/remote-python/Definitions/remote-python.json b/cds-regression-test/cba/cba/remote-python/Definitions/remote-python.json deleted file mode 100644 index 456c14d..0000000 --- a/cds-regression-test/cba/cba/remote-python/Definitions/remote-python.json +++ /dev/null @@ -1,229 +0,0 @@ -{ - "metadata": { - "template_author": "Selffish", - "author-email": "test@bell.ca", - "template_name": "RT-remote-python", - "template_version": "1.0.0", - "template_tags": "Bell, CBA, test" - }, - "dsl_definitions": { - "args": { - "arg0": "remote executor regression" - }, - "remote-executor": { - "type": "token-auth", - "host": "regression-cdsce-cds-ce", - "port": "50051", - "token": "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==" - }, - "remote-executor-wrong-port": { - "type": "token-auth", - "host": "127.0.0.1", - "port": "4242", - "token": "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==" - } - }, - "topology_template": { - "workflows": { - "remote-python": { - "steps": { - "execute-script": { - "description": "Execute Remote Python Script", - "target": "execute-remote-python" - } - }, - "inputs": { - "input": { - "required": false, - "type": "string" - } - }, - "outputs": { - "execute-command-logs": { - "type": "string", - "value": { - "get_attribute": [ - "execute-remote-python", - "execute-command-logs" - ] - } - }, - "execute-command-payload": { - "type": "json", - "value": { - "get_attribute": [ - "execute-remote-python", - "response-data" - ] - } - } - } - }, - "failing-remote-python": { - "steps": { - "execute-script": { - "description": "Execute Remote Python Script", - "target": "execute-failing-remote-python" - } - }, - "inputs": {}, - "outputs": { - "execute-command-logs": { - "type": "string", - "value": { - "get_attribute": [ - "execute-failing-remote-python", - "execute-command-logs" - ] - } - }, - "execute-command-payload": { - "type": "json", - "value": { - "get_attribute": [ - "execute-failing-remote-python", - "response-data" - ] - } - } - } - }, - "connection-fail": { - "steps": { - "execute-script": { - "description": "Execute Remote Python Script", - "target": "connection-fail" - } - }, - "inputs": {}, - "outputs": { - "execute-command-logs": { - "type": "string", - "value": { - "get_attribute": [ - "connection-fail", - "execute-command-logs" - ] - } - }, - "execute-command-payload": { - "type": "json", - "value": { - "get_attribute": [ - "connection-fail", - "response-data" - ] - } - } - } - } - }, - "node_templates": { - "execute-remote-python": { - "type": "component-remote-python-executor", - "interfaces": { - "ComponentRemotePythonExecutor": { - "operations": { - "process": { - "implementation": { - "primary": "component-script", - "timeout": 180, - "operation_host": "SELF" - }, - "inputs": { - "endpoint-selector": "remote-executor", - "command": "python EchoRemotePython.py", - "argument-properties": "*args", - "packages": [ - { - "type": "pip", - "package": [ - "requests" - ] - } - ] - } - } - } - } - }, - "artifacts": { - "component-script": { - "type": "artifact-script-python", - "file": "Scripts/python/EchoRemotePython.py" - } - } - }, - "execute-failing-remote-python": { - "type": "component-remote-python-executor", - "interfaces": { - "ComponentRemotePythonExecutor": { - "operations": { - "process": { - "implementation": { - "primary": "component-script", - "timeout": 180, - "operation_host": "SELF" - }, - "inputs": { - "endpoint-selector": "remote-executor", - "command": "python FailingRemotePython.py", - "argument-properties": "*args", - "packages": [ - { - "type": "pip", - "package": [ - "requests" - ] - } - ] - } - } - } - } - }, - "artifacts": { - "component-script": { - "type": "artifact-script-python", - "file": "Scripts/python/FailingRemotePython.py" - } - } - }, - "connection-fail": { - "type": "component-remote-python-executor", - "interfaces": { - "ComponentRemotePythonExecutor": { - "operations": { - "process": { - "implementation": { - "primary": "component-script", - "timeout": 180, - "operation_host": "SELF" - }, - "inputs": { - "endpoint-selector": "remote-executor-wrong-port", - "command": "python EchoRemotePython.py", - "argument-properties": "*args", - "packages": [ - { - "type": "pip", - "package": [ - "requests" - ] - } - ] - } - } - } - } - }, - "artifacts": { - "component-script": { - "type": "artifact-script-python", - "file": "Scripts/python/EchoRemotePython.py" - } - } - } - } - } -} diff --git a/cds-regression-test/cba/cba/remote-python/Scripts/python/EchoRemotePython.py b/cds-regression-test/cba/cba/remote-python/Scripts/python/EchoRemotePython.py deleted file mode 100644 index 08488da..0000000 --- a/cds-regression-test/cba/cba/remote-python/Scripts/python/EchoRemotePython.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/python - -import sys -from cds_utils.payload_coder import send_response_data_payload - -def echo(arg): - print(arg) - -if __name__ == "__main__": - echo(sys.argv[1]) - resp_data = {"abc": ["xyz", "qqq"]} - send_response_data_payload(resp_data) - sys.exit(0) diff --git a/cds-regression-test/cba/cba/remote-python/Scripts/python/FailingRemotePython.py b/cds-regression-test/cba/cba/remote-python/Scripts/python/FailingRemotePython.py deleted file mode 100644 index 672492d..0000000 --- a/cds-regression-test/cba/cba/remote-python/Scripts/python/FailingRemotePython.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/python - -import sys -from cds_utils.payload_coder import send_response_data_payload - -if __name__ == "__main__": - try: - raise Exception("Intentionally raised exception!") - except Exception as e: - print("Intentionally raised exception!") - resp_data = { - "errorMessage": "Intentionally raised exception!" - } - send_response_data_payload(resp_data) - sys.exit(1) diff --git a/cds-regression-test/cba/cba/remote-python/TOSCA-Metadata/TOSCA.meta b/cds-regression-test/cba/cba/remote-python/TOSCA-Metadata/TOSCA.meta deleted file mode 100644 index 85fa3bd..0000000 --- a/cds-regression-test/cba/cba/remote-python/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: Selffish -Entry-Definitions: Definitions/remote-python.json -Template-Tags: test, regression -Template-Name: RT-remote-python -Template-Version: 1.0.0 -Template-Type: DEFAULT \ No newline at end of file diff --git a/cds-regression-test/cba/cba/resource-resolution/Definitions/resource-resolution.json b/cds-regression-test/cba/cba/resource-resolution/Definitions/resource-resolution.json deleted file mode 100644 index af804a2..0000000 --- a/cds-regression-test/cba/cba/resource-resolution/Definitions/resource-resolution.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "metadata": { - "template_author": "Selffish", - "author-email": "test@bell.ca", - "template_name": "RT-resource-resolution", - "template_version": "1.0.0", - "template_tags": "Bell, CBA, test" - }, - "dsl_definitions": { - "rest-endpoint": { - "type": "token-auth", - "url": "http://cds-regression-mockserver", - "token": "NoTokenRequired" - }, - "db-endpoint": { - "type": "maria-db", - "url": "jdbc:mysql://cds-db:3306/sdnctl", - "username": "sdnctl", - "password": "sdnctl" - } - }, - "topology_template": { - "workflows": { - "resource-resolution": { - "steps": { - "helloworld": { - "description": "Component resource resolution regression test", - "target": "resource-resolution" - } - }, - "inputs": { - "resolution-key": { - "required": true, - "type": "string" - }, - "template-prefix": { - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "outputs": { - "meshed-template": { - "type": "json", - "value": { - "get_attribute": [ - "resource-resolution", - "assignment-params" - ] - } - } - } - } - }, - "node_templates": { - "resource-resolution": { - "type": "component-resource-resolution", - "interfaces": { - "ResourceResolutionComponent": { - "operations": { - "process": { - "inputs": { - "artifact-prefix-names": { - "get_input": "template-prefix" - }, - "store-result": true, - "force-resolution": true, - "resolution-key": { - "get_input": "resolution-key" - } - } - } - } - } - }, - "artifacts": { - "helloworld-velocity-template": { - "type": "artifact-template-velocity", - "file": "Templates/hello-world-template.vtl" - }, - "helloworld-velocity-mapping": { - "type": "artifact-mapping-resource", - "file": "Templates/hello-world-velocity-mapping.json" - }, - "helloworld-jinja-template": { - "type": "artifact-template-jinja", - "file": "Templates/hello-world-template.jinja" - }, - "helloworld-jinja-mapping": { - "type": "artifact-mapping-resource", - "file": "Templates/hello-world-jinja-mapping.json" - } - } - } - } - } -} diff --git a/cds-regression-test/cba/cba/resource-resolution/Scripts/kotlin/ResolvProperties.kt b/cds-regression-test/cba/cba/resource-resolution/Scripts/kotlin/ResolvProperties.kt deleted file mode 100644 index 5dd8a86..0000000 --- a/cds-regression-test/cba/cba/resource-resolution/Scripts/kotlin/ResolvProperties.kt +++ /dev/null @@ -1,49 +0,0 @@ -package cba.cds.RT - -import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor -import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment -import org.slf4j.LoggerFactory - -open class ResolvPropertiesKt() : ResourceAssignmentProcessor() { - - private val log = LoggerFactory.getLogger(ResolvPropertiesKt::class.java)!! - - override fun getName(): String { - return "ResolvPropertiesKt" - } - - override suspend fun processNB(resourceAssignment: ResourceAssignment) { - - var retValue = "undefined" - val resourceAssignmentNames = listOf("j_kotlin","v_kotlin") - - try { - if(resourceAssignment.name == "from_suspend_function") { - retValue = getResolvedValue(resourceAssignment) - } - if(resourceAssignmentNames.contains(resourceAssignment.name)) { - retValue = "ok" - } - ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, retValue) - - } catch (e: Exception) { - log.error(e.message, e) - ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, "ERROR") - - throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments, cause: ${e.message}", e) - } - } - - /* - * CCSDK-2150 : https://jira.onap.org/browse/CCSDK-2150 - */ - suspend fun getResolvedValue(resourceAssignment: ResourceAssignment): String { - return "ok" - } - - override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { - raRuntimeService.getBluePrintError().addError("Failed in ResolvPropertiesKt-ResourceAssignmentProcessor : ${runtimeException.message}") - } -} diff --git a/cds-regression-test/cba/cba/resource-resolution/Scripts/python/ResolvProperties.py b/cds-regression-test/cba/cba/resource-resolution/Scripts/python/ResolvProperties.py deleted file mode 100644 index 5fac59f..0000000 --- a/cds-regression-test/cba/cba/resource-resolution/Scripts/python/ResolvProperties.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (c) 2019 IBM, Bell Canada. -# -# 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. -from abstract_ra_processor import AbstractRAProcessor -from blueprint_constants import * - -class ResolvProperties(AbstractRAProcessor): - - def process(self, resource_assignment): - - resource_assignment_names = ["v_python","j_python"] - script_value = "undefined" - - try: - if resource_assignment.name in resource_assignment_names : - script_value = "ok" - # set value for resource getting currently resolved - self.set_resource_data_value(resource_assignment, script_value) - # except JavaException as err: - # print("Java Exception in the script {}", err) - # # self.set_resource_data_value(resource_assignment, "ERROR") - except Exception as err: - print("Python Exception in the script {}", err) - # self.set_resource_data_value(resource_assignment, "ERROR") - return None - - def recover(self, runtime_exception): - print("Exception in the script {}", runtime_exception) - # print self.addError(runtime_exception.cause.message) - return None diff --git a/cds-regression-test/cba/cba/resource-resolution/TOSCA-Metadata/TOSCA.meta b/cds-regression-test/cba/cba/resource-resolution/TOSCA-Metadata/TOSCA.meta deleted file mode 100644 index bb9b59a..0000000 --- a/cds-regression-test/cba/cba/resource-resolution/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: Selffish -Entry-Definitions: Definitions/resource-resolution.json -Template-Tags: test, regression -Template-Name: RT-resource-resolution -Template-Version: 1.0.0 -Template-Type: DEFAULT \ No newline at end of file diff --git a/cds-regression-test/cba/cba/resource-resolution/Templates/hello-world-jinja-mapping.json b/cds-regression-test/cba/cba/resource-resolution/Templates/hello-world-jinja-mapping.json deleted file mode 100644 index 395e7a1..0000000 --- a/cds-regression-test/cba/cba/resource-resolution/Templates/hello-world-jinja-mapping.json +++ /dev/null @@ -1,115 +0,0 @@ -[ - { - "name": "j_default", - "input-param": true, - "property": { - "type": "string", - "default": "ok" - }, - "dictionary-name": "input-source", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "j_input", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "input-source", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "j_python", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "properties-capability-source", - "dictionary-source": "capability", - "dependencies": [] - }, - { - "name": "j_kotlin", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "kotlin-script", - "dictionary-source": "capability", - "dependencies": [] - }, - { - "name": "from_suspend_function", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "kotlin-script", - "dictionary-source": "capability", - "dependencies": [] - }, - { - "name": "j_db", - "input-param": true, - "property": { - "type": "list", - "entry_schema": { - "type": "string" - } - }, - "dictionary-name": "RT-db", - "dictionary-source": "processor-db" - }, - { - "name": "j_get", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-get", - "dictionary-source": "sdnc", - "dependencies": [] - }, - { - "name": "j_post", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-post", - "dictionary-source": "sdnc", - "dependencies": [] - }, - { - "name": "j_put", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-put", - "dictionary-source": "sdnc", - "dependencies": [] - }, - { - "name": "j_patch", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-patch", - "dictionary-source": "sdnc", - "dependencies": [] - }, - { - "name": "j_del", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-delete", - "dictionary-source": "sdnc", - "dependencies": [] - } -] diff --git a/cds-regression-test/cba/cba/resource-resolution/Templates/hello-world-template.jinja b/cds-regression-test/cba/cba/resource-resolution/Templates/hello-world-template.jinja deleted file mode 100644 index 19947b5..0000000 --- a/cds-regression-test/cba/cba/resource-resolution/Templates/hello-world-template.jinja +++ /dev/null @@ -1,19 +0,0 @@ -{ - "default": "{{ j_default }}", - "input": "{{ j_input }}", - "script": { - "python": "{{ j_python }}", - "kotlin": { - "base": "{{ j_kotlin }}" - "from suspend function": "{{ from_suspend_function }}" - } - }, - "db": "{{ j_db[0].value }}", - "rest": { - "GET": "{{j_get}}", - "POST": "{{j_post}}", - "PUT": "{{j_put}}", - "PATCH": "{{j_patch}}", - "DELETE": "{{j_del}}" - } -} diff --git a/cds-regression-test/cba/cba/resource-resolution/Templates/hello-world-template.vtl b/cds-regression-test/cba/cba/resource-resolution/Templates/hello-world-template.vtl deleted file mode 100644 index f821770..0000000 --- a/cds-regression-test/cba/cba/resource-resolution/Templates/hello-world-template.vtl +++ /dev/null @@ -1,16 +0,0 @@ -{ - "default": "${v_default}", - "input": "${v_input}", - "script": { - "python": "${v_python}", - "kotlin": "${v_kotlin}" - }, - "db": "${v_db.get(0).value}", - "rest": { - "GET": "${v_get}", - "POST": "${v_post}", - "PUT": "${v_put}", - "PATCH": "${v_patch}", - "DELETE": "${v_del}" - } -} diff --git a/cds-regression-test/cba/cba/resource-resolution/Templates/hello-world-velocity-mapping.json b/cds-regression-test/cba/cba/resource-resolution/Templates/hello-world-velocity-mapping.json deleted file mode 100644 index 4314908..0000000 --- a/cds-regression-test/cba/cba/resource-resolution/Templates/hello-world-velocity-mapping.json +++ /dev/null @@ -1,105 +0,0 @@ -[ - { - "name": "v_default", - "input-param": true, - "property": { - "type": "string", - "default": "ok" - }, - "dictionary-name": "input-source", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "v_input", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "input-source", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "v_python", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "properties-capability-source", - "dictionary-source": "capability", - "dependencies": [] - }, - { - "name": "v_kotlin", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "kotlin-script", - "dictionary-source": "capability", - "dependencies": [] - }, - { - "name": "v_db", - "input-param": true, - "property": { - "type": "list", - "entry_schema": { - "type": "string" - } - }, - "dictionary-name": "RT-db", - "dictionary-source": "processor-db" - }, - { - "name": "v_get", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-get", - "dictionary-source": "sdnc", - "dependencies": [] - }, - { - "name": "v_post", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-post", - "dictionary-source": "sdnc", - "dependencies": [] - }, - { - "name": "v_put", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-put", - "dictionary-source": "sdnc", - "dependencies": [] - }, - { - "name": "v_patch", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-patch", - "dictionary-source": "sdnc", - "dependencies": [] - }, - { - "name": "v_del", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-delete", - "dictionary-source": "sdnc", - "dependencies": [] - } -] diff --git a/cds-regression-test/cba/cli/elalto/Definitions/cli.json b/cds-regression-test/cba/cli/elalto/Definitions/cli.json deleted file mode 100644 index 722663e..0000000 --- a/cds-regression-test/cba/cli/elalto/Definitions/cli.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "metadata": { - "template_author": "Selffish", - "author-email": "test@bell.ca", - "template_name": "RT-cli", - "template_version": "1.0.0", - "template_tags": "test, regression" - }, - "dsl_definitions": { - "device-properties": { - "type": "basic-auth", - "host": { - "get_input": "host" - }, - "username": { - "get_input": "username" - }, - "password": { - "get_input": "password" - }, - "port": { - "get_input": "port" - }, - "connectionTimeOut": { - "get_input": "connectionTimeOut" - } - } - }, - "topology_template": { - "workflows": { - "cli": { - "steps": { - "cli": { - "description": "CLI Workflow", - "target": "cli" - } - }, - "inputs": { - "resolution-key": { - "required": false, - "type": "string" - }, - "password": { - "required": true, - "type": "string" - }, - "username": { - "required": true, - "type": "string" - }, - "host": { - "required": true, - "type": "string" - }, - "port": { - "required": false, - "type": "string" - }, - "connectionTimeOut": { - "required": true, - "type": "string" - }, - "commands": { - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "outputs": { - "response-data": { - "type": "string", - "value": { - "get_attribute": [ - "cli", - "response-data" - ] - } - } - } - } - }, - "node_templates": { - "cli": { - "type": "component-script-executor", - "interfaces": { - "ComponentScriptExecutor": { - "operations": { - "process": { - "implementation": { - "primary": "component-script" - }, - "inputs": { - "script-type": "kotlin", - "script-class-reference": "cli.CliRegressionTest" - }, - "outputs": {} - } - } - } - } - } - } - } -} diff --git a/cds-regression-test/cba/cli/elalto/Scripts/kotlin/cli/cli.kt b/cds-regression-test/cba/cli/elalto/Scripts/kotlin/cli/cli.kt deleted file mode 100755 index 12786c8..0000000 --- a/cds-regression-test/cba/cli/elalto/Scripts/kotlin/cli/cli.kt +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright © 2019 IBM, Bell Canada. - * - * 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. - */ - -package cli - -import org.onap.ccsdk.cds.controllerblueprints.core.logger -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput -import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.cliDeviceInfo -import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.getSshClientService -import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction -import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor -import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils - - -open class CliRegressionTest : AbstractScriptComponentFunction() { - - private val log = logger(CliRegressionTest::class) - - override suspend fun processNB(executionRequest: ExecutionServiceInput) { - // Get Client Service - val sshClientService = getSshClientService(cliDeviceInfo("device-properties")) - sshClientService.startSession() - - // Read Commands - val timeout = bluePrintRuntimeService.getInputValue("connectionTimeOut").asText() - val commands = bluePrintRuntimeService.getInputValue("commands") - .let { JacksonUtils.getListFromJsonNode(it, String::class.java) } - - // Execute - var responsesLog = "Error" - try { - responsesLog = sshClientService.executeCommands(commands, timeout.toLong()) - log.info(responsesLog) - } catch (e: Exception) { - e.message?.let { addError(it) } - } finally { - setAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, responsesLog.asJsonPrimitive()) - sshClientService.closeSession() - } - } - - override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - log.info("Executing Recovery") - } -} \ No newline at end of file diff --git a/cds-regression-test/cba/cli/elalto/TOSCA-Metadata/TOSCA.meta b/cds-regression-test/cba/cli/elalto/TOSCA-Metadata/TOSCA.meta deleted file mode 100755 index 7bb2d45..0000000 --- a/cds-regression-test/cba/cli/elalto/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: Selffish -Entry-Definitions: Definitions/cli.json -Template-Tags: test, regression -Template-Name: RT-cli -Template-Version: 1.0.0 -Template-Type: DEFAULT \ No newline at end of file diff --git a/cds-regression-test/cba/cli/frankfurt/Definitions/cli.json b/cds-regression-test/cba/cli/frankfurt/Definitions/cli.json deleted file mode 100644 index c0070da..0000000 --- a/cds-regression-test/cba/cli/frankfurt/Definitions/cli.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "metadata": { - "template_author": "Selffish", - "author-email": "test@bell.ca", - "template_name": "RT-cli", - "template_version": "1.0.0", - "template_tags": "test, regression" - }, - "dsl_definitions": { - "device-properties": { - "type": "basic-auth", - "host": { - "get_input": "host" - }, - "username": { - "get_input": "username" - }, - "password": { - "get_input": "password" - }, - "port": { - "get_input": "port" - }, - "logging": { - "get_input": "logging" - }, - "connectionTimeOut": { - "get_input": "connectionTimeOut" - } - } - }, - "topology_template": { - "workflows": { - "cli": { - "steps": { - "cli": { - "description": "CLI Workflow", - "target": "cli" - } - }, - "inputs": { - "resolution-key": { - "required": false, - "type": "string" - }, - "password": { - "required": true, - "type": "string" - }, - "username": { - "required": true, - "type": "string" - }, - "host": { - "required": true, - "type": "string" - }, - "port": { - "required": false, - "type": "string" - }, - "connectionTimeOut": { - "required": true, - "type": "string" - }, - "logging": { - "required": true, - "type": "boolean" - }, - "commands": { - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "outputs": { - "response-data": { - "type": "string", - "value": { - "get_attribute": [ - "cli", - "response-data" - ] - } - } - } - } - }, - "node_templates": { - "cli": { - "type": "component-script-executor", - "interfaces": { - "ComponentScriptExecutor": { - "operations": { - "process": { - "implementation": { - "primary": "component-script" - }, - "inputs": { - "script-type": "kotlin", - "script-class-reference": "cli.CliRegressionTest" - }, - "outputs": {} - } - } - } - } - } - } - } -} diff --git a/cds-regression-test/cba/cli/frankfurt/Scripts/kotlin/cli/cli.kt b/cds-regression-test/cba/cli/frankfurt/Scripts/kotlin/cli/cli.kt deleted file mode 100755 index 1e1ade0..0000000 --- a/cds-regression-test/cba/cli/frankfurt/Scripts/kotlin/cli/cli.kt +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright © 2019 IBM, Bell Canada. - * - * 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. - */ - -package cli - -import org.onap.ccsdk.cds.controllerblueprints.core.logger -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput -import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.cliDeviceInfo -import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.getSshClientService -import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction -import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor -import org.onap.ccsdk.cds.blueprintsprocessor.ssh.service.CommandResult -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType - -open class CliRegressionTest : AbstractScriptComponentFunction() { - - private val log = logger(CliRegressionTest::class) - - override suspend fun processNB(executionRequest: ExecutionServiceInput) { - // Get Client Service - val sshClientService = getSshClientService(cliDeviceInfo("device-properties")) - sshClientService.startSession() - - // Read Commands - val timeout = bluePrintRuntimeService.getInputValue("connectionTimeOut").asText() - val commands = bluePrintRuntimeService.getInputValue("commands") - .let { JacksonUtils.getListFromJsonNode(it, String::class.java) } - - // Execute - var responsesLog: List? = null - try { - responsesLog = sshClientService.executeCommands(commands, timeout.toLong()) - log.info(responsesLog.toString()) - } catch (e: Exception) { - e.message?.let { addError(it) } - } finally { - setAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, responsesLog?.map { it->it.asJsonType()}.asJsonType()) - sshClientService.closeSession() - } - } - - override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - log.info("Executing Recovery") - } -} diff --git a/cds-regression-test/cba/cli/frankfurt/TOSCA-Metadata/TOSCA.meta b/cds-regression-test/cba/cli/frankfurt/TOSCA-Metadata/TOSCA.meta deleted file mode 100755 index 7bb2d45..0000000 --- a/cds-regression-test/cba/cli/frankfurt/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: Selffish -Entry-Definitions: Definitions/cli.json -Template-Tags: test, regression -Template-Name: RT-cli -Template-Version: 1.0.0 -Template-Type: DEFAULT \ No newline at end of file diff --git a/cds-regression-test/cba/lock-device/Definitions/lock-device.json b/cds-regression-test/cba/lock-device/Definitions/lock-device.json deleted file mode 100644 index c90021c..0000000 --- a/cds-regression-test/cba/lock-device/Definitions/lock-device.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "metadata": { - "template_author": "Selffish", - "author-email": "test@bell.ca", - "template_name": "RT-lock-device", - "template_version": "1.0.0", - "template_tags": "Bell, CBA, test" - }, - "dsl_definitions": {}, - "topology_template": { - "workflows": { - "resolve-deploy-kotlin": { - "steps": { - "resolve": { - "description": "resolve vnf-id", - "target": "resource-resolution", - "on_success": [ - "execute-script" - ] - }, - "execute-script": { - "description": "Execute Kotlin Script", - "target": "execute-kotlin" - } - }, - "outputs": { - "response-data": { - "type": "string", - "value": { - "get_attribute": [ - "execute-kotlin", - "response-data" - ] - } - } - } - } - }, - "node_templates": { - "resource-resolution": { - "type": "component-resource-resolution", - "interfaces": { - "ResourceResolutionComponent": { - "operations": { - "process": { - "inputs": { - "artifact-prefix-names": [ - "base" - ], - "resolution-summary": true - } - } - } - } - }, - "artifacts": { - "base-mapping": { - "type": "artifact-mapping-resource", - "file": "Templates/base-mapping.json" - } - } - }, - "execute-kotlin": { - "type": "component-script-executor", - "interfaces": { - "ComponentScriptExecutor": { - "operations": { - "process": { - "implementation": { - "primary": "component-script", - "lock": { - "key": { - "get_attribute": [ - "resource-resolution", - "", - "assignment-map", - "base", - "vnf-id" - ] - }, - "acquireTimeout": { - "get_input": "lock-acquire-timeout" - } - } - }, - "inputs": { - "script-type": "kotlin", - "script-class-reference": "cba.cds.RT.ProcessOperation" - }, - "outputs": {} - } - } - } - } - } - } - } -} diff --git a/cds-regression-test/cba/lock-device/Scripts/kotlin/ProcessOperation.kt b/cds-regression-test/cba/lock-device/Scripts/kotlin/ProcessOperation.kt deleted file mode 100755 index 4c795e4..0000000 --- a/cds-regression-test/cba/lock-device/Scripts/kotlin/ProcessOperation.kt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright © 2019 Bell Canada. - * - * 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. - */ - -package cba.cds.RT - -import org.onap.ccsdk.cds.controllerblueprints.core.logger -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput -import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction -import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor -import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType -import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BasicAuthRestClientService -import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties -import kotlinx.coroutines.delay - -open class ProcessOperation : AbstractScriptComponentFunction() { - - private val log = logger(ProcessOperation::class) - - override suspend fun processNB(executionRequest: ExecutionServiceInput) { - val time : Long = 15_000 - try { - log.info("Processing for $time ms... ${executionRequest.commonHeader.requestId}") - delay(time) - log.info("Done processing ${executionRequest.commonHeader.requestId}!") - setAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, "Success: ${executionRequest.commonHeader.requestId}".asJsonType()) - } catch (e: Exception) { - e.message?.let { addError(it) } - } - } - - override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - setAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, runtimeException.message!!.asJsonType()) - addError(runtimeException.message!!) - log.info("Executing Recovery") - } -} diff --git a/cds-regression-test/cba/lock-device/TOSCA-Metadata/TOSCA.meta b/cds-regression-test/cba/lock-device/TOSCA-Metadata/TOSCA.meta deleted file mode 100644 index e182865..0000000 --- a/cds-regression-test/cba/lock-device/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: Selffish -Entry-Definitions: Definitions/lock-device.json -Template-Tags: test, regression -Template-Name: RT-lock-device -Template-Version: 1.0.0 -Template-Type: DEFAULT \ No newline at end of file diff --git a/cds-regression-test/cba/lock-device/Templates/base-mapping.json b/cds-regression-test/cba/lock-device/Templates/base-mapping.json deleted file mode 100644 index b5b64a8..0000000 --- a/cds-regression-test/cba/lock-device/Templates/base-mapping.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - { - "name": "vnf-id", - "input-param": true, - "property": { - "type": "string", - "default": "rt-vnf-xyz-123" - }, - "dictionary-name": "input-source", - "dictionary-source": "default", - "dependencies": [] - }, - { - "name": "lock-acquire-timeout", - "input-param": true, - "property": { - "type": "integer" - }, - "dictionary-name": "input-source", - "dictionary-source": "input", - "dependencies": [] - } -] diff --git a/cds-regression-test/cba/netconf/Definitions/netconf.json b/cds-regression-test/cba/netconf/Definitions/netconf.json deleted file mode 100644 index 74a98c1..0000000 --- a/cds-regression-test/cba/netconf/Definitions/netconf.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "metadata": { - "template_author": "Selffish", - "author-email": "test@bell.ca", - "template_name": "RT-netconf", - "template_version": "1.0.0", - "template_tags": "Bell, CBA, test" - }, - "topology_template": { - "workflows": { - "netconf-jython": { - "steps": { - "netconf-jython": { - "description": "deploy config", - "target": "execute-jython-netconf" - } - }, - "inputs": { - "netconf-host": { - "required": true, - "type": "string" - }, - "netconf-timeout": { - "required": true, - "type": "string" - } - }, - "outputs": { - "response-data": { - "type": "string", - "value": { - "get_attribute": [ - "execute-jython-netconf", - "response-data" - ] - } - } - } - }, - "netconf-kotlin": { - "steps": { - "netconf-kotlin": { - "description": "deploy config", - "target": "execute-kotlin-netconf" - } - }, - "inputs": { - "netconf-host": { - "required": true, - "type": "string" - }, - "netconf-timeout": { - "required": true, - "type": "string" - } - }, - "outputs": { - "response-data": { - "type": "string", - "value": { - "get_attribute": [ - "execute-kotlin-netconf", - "response-data" - ] - } - } - } - } - }, - "node_templates": { - "execute-jython-netconf": { - "type": "component-netconf-executor", - "requirements": { - "netconf-connection": { - "capability": "netconf", - "node": "netconf-device", - "relationship": "tosca.relationships.ConnectsTo" - } - }, - "interfaces": { - "ComponentNetconfExecutor": { - "operations": { - "process": { - "inputs": { - "script-type": "jython", - "script-class-reference": "Scripts/python/NetconfTest.py", - "instance-dependencies": [] - } - } - } - } - } - }, - "execute-kotlin-netconf": { - "type": "component-netconf-executor", - "requirements": { - "netconf-connection": { - "capability": "netconf", - "node": "netconf-device", - "relationship": "tosca.relationships.ConnectsTo" - } - }, - "interfaces": { - "ComponentNetconfExecutor": { - "operations": { - "process": { - "inputs": { - "script-type": "kotlin", - "script-class-reference": "org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.ConfigDeploy", - "instance-dependencies": [] - } - } - } - } - } - }, - "netconf-device": { - "type": "vnf-netconf-device", - "capabilities": { - "netconf": { - "properties": { - "login-key": "password", - "login-account": "admin", - "target-ip-address": { - "get_input": "netconf-host" - }, - "port-number": 17830, - "connection-time-out": { - "get_input": "netconf-timeout" - } - } - } - } - } - } - } -} diff --git a/cds-regression-test/cba/netconf/Scripts/kotlin/kotlin.kt b/cds-regression-test/cba/netconf/Scripts/kotlin/kotlin.kt deleted file mode 100644 index 956890a..0000000 --- a/cds-regression-test/cba/netconf/Scripts/kotlin/kotlin.kt +++ /dev/null @@ -1,47 +0,0 @@ -package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor - -import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput -import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedContentFromResolvedArtifactNB -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -import org.slf4j.LoggerFactory - -open class ConfigDeploy : AbstractScriptComponentFunction() { - - private val log = LoggerFactory.getLogger(ConfigDeploy::class.java)!! - - override suspend fun processNB(executionRequest: ExecutionServiceInput) { - val device = netconfDevice("netconf-connection") - val client = device.netconfRpcService - val session = device.netconfSession - - val payload=""" - - - - Regression-Mock - - - """ - - val response: MutableMap = mutableMapOf("deploySuccess" to false) - - try { - session.connect() - client.lock() - client.editConfig(payload) - client.commit() - client.unLock() - session.disconnect() - response["deploySuccess"] = true - } catch (e: Exception) { - e.message?.let { super.addError(it) } - } - - super.setAttribute("response-data", JacksonUtils.jsonNodeFromObject(response)) - } - - override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - log.info("Executing Recovery") - } -} diff --git a/cds-regression-test/cba/netconf/Scripts/python/NetconfTest.py b/cds-regression-test/cba/netconf/Scripts/python/NetconfTest.py deleted file mode 100644 index c52c8af..0000000 --- a/cds-regression-test/cba/netconf/Scripts/python/NetconfTest.py +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (c) 2019 IBM, Bell Canada. -# -# 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 netconf_constant -from java.lang import Exception as JavaException -from netconfclient import NetconfClient -import json -from org.onap.ccsdk.cds.blueprintsprocessor.services.execution import AbstractScriptComponentFunction -from com.fasterxml.jackson.databind import ObjectMapper - -class NetconfTest(AbstractScriptComponentFunction): - - def process(self): - log = globals()[netconf_constant.SERVICE_LOG] - payload=""" - - - - Regression-Mock - - - """ - responsePayload = '{"deploySuccess": false}' - - try: - nc = NetconfClient(log, self, "netconf-connection") - nc.connect() - nc.lock() - nc.edit_config(message_content=payload, config_target="candidate") - operationResponse = nc.commit() - nc.unlock() - nc.disconnect() - responsePayload = json.dumps({"deploySuccess": operationResponse.isSuccess()}) - except JavaException as err: - self.addError(err.message) - except Exception as err: - self.addError("Python error: {}".format(err)) - - self.setAttribute("response-data", ObjectMapper().readTree(responsePayload)) - return None - - def recover(self): - return None diff --git a/cds-regression-test/cba/netconf/TOSCA-Metadata/TOSCA.meta b/cds-regression-test/cba/netconf/TOSCA-Metadata/TOSCA.meta deleted file mode 100644 index 1155ae8..0000000 --- a/cds-regression-test/cba/netconf/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: Selffish -Entry-Definitions: Definitions/netconf.json -Template-Tags: test, regression -Template-Name: RT-netconf -Template-Version: 1.0.0 -Template-Type: DEFAULT \ No newline at end of file diff --git a/cds-regression-test/cba/py-executor/.DS_Store b/cds-regression-test/cba/py-executor/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/cds-regression-test/cba/py-executor/.DS_Store and /dev/null differ diff --git a/cds-regression-test/cba/py-executor/Definitions/py-executor.json b/cds-regression-test/cba/py-executor/Definitions/py-executor.json deleted file mode 100644 index b28162c..0000000 --- a/cds-regression-test/cba/py-executor/Definitions/py-executor.json +++ /dev/null @@ -1,174 +0,0 @@ -{ - "metadata": { - "template_author": "Selffish", - "author-email": "test@bell.ca", - "template_name": "RT-py-executor", - "template_version": "1.0.0", - "template_tags": "Bell, CBA, test" - }, - "dsl_definitions": { - "py-executor": { - "type": "tls-auth", - "host": "cds-py-executor-py-exec", - "port": "50052", - "trustCertCollection": "/opt/app/onap/config/certs/py-executor/py-executor-chain.pem" - }, - "invalid-py-executor": { - "type": "tls-auth", - "host": "127.0.0.1", - "port": "12345", - "trustCertCollection": "/opt/app/onap/config/certs/py-executor/py-executor-chain.pem" - }, - "parameters": { - "hello": "world" - } - }, - "topology_template": { - "workflows": { - "remote-python": { - "steps": { - "execute-script": { - "description": "Execute Remote Python Script", - "target": "execute-remote-python" - } - }, - "inputs": {}, - "outputs": { - "status": { - "type": "string", - "value": { - "get_attribute": [ - "execute-remote-python", - "status" - ] - } - }, - "response-data": { - "type": "json", - "value": { - "get_attribute": [ - "execute-remote-python", - "response-data" - ] - } - } - } - }, - "connection-fail": { - "steps": { - "execute-script": { - "description": "Execute Remote Python Script to an invalid endpoint", - "target": "execute-connection-fail" - } - }, - "inputs": {}, - "outputs": { - "status": { - "type": "string", - "value": { - "get_attribute": [ - "execute-connection-fail", - "status" - ] - } - }, - "response-data": { - "type": "json", - "value": { - "get_attribute": [ - "execute-connection-fail", - "response-data" - ] - } - } - } - }, - "failing-remote-python": { - "steps": { - "execute-script": { - "description": "Execute Remote Python Script", - "target": "execute-failing-remote-python" - } - }, - "inputs": {}, - "outputs": { - "status": { - "type": "string", - "value": { - "get_attribute": [ - "execute-failing-remote-python", - "status" - ] - } - }, - "response-data": { - "type": "json", - "value": { - "get_attribute": [ - "execute-failing-remote-python", - "response-data" - ] - } - } - } - } - }, - "node_templates": { - "execute-remote-python": { - "type": "component-remote-script-executor", - "interfaces": { - "ComponentRemoteScriptExecutor": { - "operations": { - "process": { - "inputs": { - "selector": "*py-executor", - "blueprint-name": "RT-py-executor", - "blueprint-version": "1.0.0", - "blueprint-action": "HelloWorld", - "timeout": 1000, - "request-data": "*parameters" - } - } - } - } - } - }, - "execute-connection-fail": { - "type": "component-remote-script-executor", - "interfaces": { - "ComponentRemoteScriptExecutor": { - "operations": { - "process": { - "inputs": { - "selector": "*invalid-py-executor", - "blueprint-name": "RT-py-executor", - "blueprint-version": "1.0.0", - "blueprint-action": "HelloWorld", - "timeout": 1000 - } - } - } - } - } - }, - "execute-failing-remote-python": { - "type": "component-remote-script-executor", - "interfaces": { - "ComponentRemoteScriptExecutor": { - "operations": { - "process": { - "inputs": { - "selector": "*py-executor", - "blueprint-name": "RT-py-executor", - "blueprint-version": "1.0.0", - "blueprint-action": "FailingScript", - "timeout": 1000 - } - } - } - } - } - } - } - } -} diff --git a/cds-regression-test/cba/py-executor/Scripts/python/__init__.py b/cds-regression-test/cba/py-executor/Scripts/python/__init__.py deleted file mode 100644 index dcef3a9..0000000 --- a/cds-regression-test/cba/py-executor/Scripts/python/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright © 2018-2019 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. - -from .hello_world import * -from .failing_script import * diff --git a/cds-regression-test/cba/py-executor/Scripts/python/failing_script.py b/cds-regression-test/cba/py-executor/Scripts/python/failing_script.py deleted file mode 100644 index 66efd3f..0000000 --- a/cds-regression-test/cba/py-executor/Scripts/python/failing_script.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/python -# -# Copyright © 2018-2019 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 logging -from blueprints_grpc import executor_utils -from blueprints_grpc.blueprint_processing_server import AbstractScriptFunction - - -class FailingScript(AbstractScriptFunction): - def __init__(self): - self.logger = logging.getLogger(self.__class__.__name__) - - def process(self, execution_request): - self.logger.info("Request Received in Script : {}".format(execution_request)) - raise RuntimeError('Script raised an exception') - - def recover(self): - return None - - def send_notification(self, execution_request): - yield executor_utils.send_notification(execution_request, "I am notification") diff --git a/cds-regression-test/cba/py-executor/Scripts/python/hello_world.py b/cds-regression-test/cba/py-executor/Scripts/python/hello_world.py deleted file mode 100644 index 1d308ee..0000000 --- a/cds-regression-test/cba/py-executor/Scripts/python/hello_world.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/python -# -# Copyright © 2018-2019 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 logging -from blueprints_grpc import executor_utils -from blueprints_grpc.blueprint_processing_server import AbstractScriptFunction -import json -from google.protobuf import json_format - -class HelloWorld(AbstractScriptFunction): - def __init__(self): - self.logger = logging.getLogger(self.__class__.__name__) - - def process(self, execution_request): - self.logger.info("Request Received in Script : {}".format(execution_request)) - - inputs = json_format.MessageToJson(execution_request.payload) - response_payload_json = json.loads(inputs) - - execution_response = executor_utils.success_response(execution_request, response_payload_json, 200) - self.logger.info("Response returned : {}".format(execution_response)) - yield execution_response - - def recover(self): - return None - - def send_notification(self, execution_request): - yield executor_utils.send_notification(execution_request, "I am notification") diff --git a/cds-regression-test/cba/py-executor/TOSCA-Metadata/TOSCA.meta b/cds-regression-test/cba/py-executor/TOSCA-Metadata/TOSCA.meta deleted file mode 100644 index 8389ebb..0000000 --- a/cds-regression-test/cba/py-executor/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: Selffish -Entry-Definitions: Definitions/py-executor.json -Template-Tags: test, regression -Template-Name: RT-py-executor -Template-Version: 1.0.0 -Template-Type: DEFAULT diff --git a/cds-regression-test/cba/remote-ansible/Definitions/remote-ansible.json b/cds-regression-test/cba/remote-ansible/Definitions/remote-ansible.json deleted file mode 100644 index ee0d466..0000000 --- a/cds-regression-test/cba/remote-ansible/Definitions/remote-ansible.json +++ /dev/null @@ -1,317 +0,0 @@ -{ - "metadata": { - "template_author": "Selffish", - "author-email": "test@bell.ca", - "template_name": "RT-remote-ansible", - "template_version": "1.0.0", - "template_tags": "Bell, CBA, test" - }, - "dsl_definitions": { - "ansible-remote-success-endpoint": { - "type": "token-auth", - "url": "http://cds-regression-mockserver/remote-ansible/success", - "token": "Bearer J9gEtMDqf7P4YsJ7444fioY9VAhLDIs1" - }, - "ansible-remote-failure-endpoint": { - "type": "token-auth", - "url": "http://cds-regression-mockserver/remote-ansible/failure", - "token": "Bearer J9gEtMDqf7P4YsJ7444fioY9VAhLDIs1" - }, - "ansible-remote-invalid-endpoint": { - "type": "token-auth", - "url": "http://localhost:12345", - "token": "Bearer J9gEtMDqf7P4YsJ7444fioY9VAhLDIs1" - } - }, - "topology_template": { - "workflows": { - "execute-remote-ansible-success": { - "steps": { - "process": { - "description": "Execute Remote Ansible Script", - "target": "execute-remote-ansible-success", - "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": { - "ansible-command-status": { - "type": "string", - "value": { - "get_attribute": [ - "execute-remote-ansible-success", - "ansible-command-status" - ] - } - }, - "ansible-command-logs": { - "type": "string", - "value": { - "get_attribute": [ - "execute-remote-ansible-success", - "ansible-command-logs" - ] - } - } - } - }, - "connection-fail": { - "steps": { - "process": { - "description": "Execute Remote Ansible Script", - "target": "connection-fail", - "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": { - "ansible-command-status": { - "type": "string", - "value": { - "get_attribute": [ - "connection-fail", - "ansible-command-status" - ] - } - }, - "ansible-command-logs": { - "type": "string", - "value": { - "get_attribute": [ - "connection-fail", - "ansible-command-logs" - ] - } - } - } - }, - "execute-remote-ansible-failure": { - "steps": { - "process": { - "description": "Execute Remote Ansible Script", - "target": "execute-remote-ansible-failure", - "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": { - "ansible-command-status": { - "type": "string", - "value": { - "get_attribute": [ - "execute-remote-ansible-failure", - "ansible-command-status" - ] - } - }, - "ansible-command-logs": { - "type": "string", - "value": { - "get_attribute": [ - "execute-remote-ansible-failure", - "ansible-command-logs" - ] - } - } - } - } - }, - "node_templates": { - "execute-remote-ansible-success": { - "type": "component-remote-ansible-executor", - "interfaces": { - "ComponentRemoteAnsibleExecutor": { - "operations": { - "process": { - "inputs": { - "endpoint-selector": "*ansible-remote-success-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" - } - } - } - } - } - } - }, - "connection-fail": { - "type": "component-remote-ansible-executor", - "interfaces": { - "ComponentRemoteAnsibleExecutor": { - "operations": { - "process": { - "inputs": { - "endpoint-selector": "*ansible-remote-invalid-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" - } - } - } - } - } - } - }, - "execute-remote-ansible-failure": { - "type": "component-remote-ansible-executor", - "interfaces": { - "ComponentRemoteAnsibleExecutor": { - "operations": { - "process": { - "inputs": { - "endpoint-selector": "*ansible-remote-failure-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" - } - } - } - } - } - } - } - } - } -} diff --git a/cds-regression-test/cba/remote-ansible/TOSCA-Metadata/TOSCA.meta b/cds-regression-test/cba/remote-ansible/TOSCA-Metadata/TOSCA.meta deleted file mode 100644 index 1b4ba50..0000000 --- a/cds-regression-test/cba/remote-ansible/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: Selffish -Entry-Definitions: Definitions/remote-ansible.json -Template-Tags: test, regression -Template-Name: RT-remote-ansible -Template-Version: 1.0.0 -Template-Type: DEFAULT diff --git a/cds-regression-test/cba/remote-python/Definitions/remote-python.json b/cds-regression-test/cba/remote-python/Definitions/remote-python.json deleted file mode 100644 index 456c14d..0000000 --- a/cds-regression-test/cba/remote-python/Definitions/remote-python.json +++ /dev/null @@ -1,229 +0,0 @@ -{ - "metadata": { - "template_author": "Selffish", - "author-email": "test@bell.ca", - "template_name": "RT-remote-python", - "template_version": "1.0.0", - "template_tags": "Bell, CBA, test" - }, - "dsl_definitions": { - "args": { - "arg0": "remote executor regression" - }, - "remote-executor": { - "type": "token-auth", - "host": "regression-cdsce-cds-ce", - "port": "50051", - "token": "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==" - }, - "remote-executor-wrong-port": { - "type": "token-auth", - "host": "127.0.0.1", - "port": "4242", - "token": "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==" - } - }, - "topology_template": { - "workflows": { - "remote-python": { - "steps": { - "execute-script": { - "description": "Execute Remote Python Script", - "target": "execute-remote-python" - } - }, - "inputs": { - "input": { - "required": false, - "type": "string" - } - }, - "outputs": { - "execute-command-logs": { - "type": "string", - "value": { - "get_attribute": [ - "execute-remote-python", - "execute-command-logs" - ] - } - }, - "execute-command-payload": { - "type": "json", - "value": { - "get_attribute": [ - "execute-remote-python", - "response-data" - ] - } - } - } - }, - "failing-remote-python": { - "steps": { - "execute-script": { - "description": "Execute Remote Python Script", - "target": "execute-failing-remote-python" - } - }, - "inputs": {}, - "outputs": { - "execute-command-logs": { - "type": "string", - "value": { - "get_attribute": [ - "execute-failing-remote-python", - "execute-command-logs" - ] - } - }, - "execute-command-payload": { - "type": "json", - "value": { - "get_attribute": [ - "execute-failing-remote-python", - "response-data" - ] - } - } - } - }, - "connection-fail": { - "steps": { - "execute-script": { - "description": "Execute Remote Python Script", - "target": "connection-fail" - } - }, - "inputs": {}, - "outputs": { - "execute-command-logs": { - "type": "string", - "value": { - "get_attribute": [ - "connection-fail", - "execute-command-logs" - ] - } - }, - "execute-command-payload": { - "type": "json", - "value": { - "get_attribute": [ - "connection-fail", - "response-data" - ] - } - } - } - } - }, - "node_templates": { - "execute-remote-python": { - "type": "component-remote-python-executor", - "interfaces": { - "ComponentRemotePythonExecutor": { - "operations": { - "process": { - "implementation": { - "primary": "component-script", - "timeout": 180, - "operation_host": "SELF" - }, - "inputs": { - "endpoint-selector": "remote-executor", - "command": "python EchoRemotePython.py", - "argument-properties": "*args", - "packages": [ - { - "type": "pip", - "package": [ - "requests" - ] - } - ] - } - } - } - } - }, - "artifacts": { - "component-script": { - "type": "artifact-script-python", - "file": "Scripts/python/EchoRemotePython.py" - } - } - }, - "execute-failing-remote-python": { - "type": "component-remote-python-executor", - "interfaces": { - "ComponentRemotePythonExecutor": { - "operations": { - "process": { - "implementation": { - "primary": "component-script", - "timeout": 180, - "operation_host": "SELF" - }, - "inputs": { - "endpoint-selector": "remote-executor", - "command": "python FailingRemotePython.py", - "argument-properties": "*args", - "packages": [ - { - "type": "pip", - "package": [ - "requests" - ] - } - ] - } - } - } - } - }, - "artifacts": { - "component-script": { - "type": "artifact-script-python", - "file": "Scripts/python/FailingRemotePython.py" - } - } - }, - "connection-fail": { - "type": "component-remote-python-executor", - "interfaces": { - "ComponentRemotePythonExecutor": { - "operations": { - "process": { - "implementation": { - "primary": "component-script", - "timeout": 180, - "operation_host": "SELF" - }, - "inputs": { - "endpoint-selector": "remote-executor-wrong-port", - "command": "python EchoRemotePython.py", - "argument-properties": "*args", - "packages": [ - { - "type": "pip", - "package": [ - "requests" - ] - } - ] - } - } - } - } - }, - "artifacts": { - "component-script": { - "type": "artifact-script-python", - "file": "Scripts/python/EchoRemotePython.py" - } - } - } - } - } -} diff --git a/cds-regression-test/cba/remote-python/Scripts/python/EchoRemotePython.py b/cds-regression-test/cba/remote-python/Scripts/python/EchoRemotePython.py deleted file mode 100644 index 08488da..0000000 --- a/cds-regression-test/cba/remote-python/Scripts/python/EchoRemotePython.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/python - -import sys -from cds_utils.payload_coder import send_response_data_payload - -def echo(arg): - print(arg) - -if __name__ == "__main__": - echo(sys.argv[1]) - resp_data = {"abc": ["xyz", "qqq"]} - send_response_data_payload(resp_data) - sys.exit(0) diff --git a/cds-regression-test/cba/remote-python/Scripts/python/FailingRemotePython.py b/cds-regression-test/cba/remote-python/Scripts/python/FailingRemotePython.py deleted file mode 100644 index 672492d..0000000 --- a/cds-regression-test/cba/remote-python/Scripts/python/FailingRemotePython.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/python - -import sys -from cds_utils.payload_coder import send_response_data_payload - -if __name__ == "__main__": - try: - raise Exception("Intentionally raised exception!") - except Exception as e: - print("Intentionally raised exception!") - resp_data = { - "errorMessage": "Intentionally raised exception!" - } - send_response_data_payload(resp_data) - sys.exit(1) diff --git a/cds-regression-test/cba/remote-python/TOSCA-Metadata/TOSCA.meta b/cds-regression-test/cba/remote-python/TOSCA-Metadata/TOSCA.meta deleted file mode 100644 index 85fa3bd..0000000 --- a/cds-regression-test/cba/remote-python/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: Selffish -Entry-Definitions: Definitions/remote-python.json -Template-Tags: test, regression -Template-Name: RT-remote-python -Template-Version: 1.0.0 -Template-Type: DEFAULT \ No newline at end of file diff --git a/cds-regression-test/cba/resource-resolution/Definitions/resource-resolution.json b/cds-regression-test/cba/resource-resolution/Definitions/resource-resolution.json deleted file mode 100644 index af804a2..0000000 --- a/cds-regression-test/cba/resource-resolution/Definitions/resource-resolution.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "metadata": { - "template_author": "Selffish", - "author-email": "test@bell.ca", - "template_name": "RT-resource-resolution", - "template_version": "1.0.0", - "template_tags": "Bell, CBA, test" - }, - "dsl_definitions": { - "rest-endpoint": { - "type": "token-auth", - "url": "http://cds-regression-mockserver", - "token": "NoTokenRequired" - }, - "db-endpoint": { - "type": "maria-db", - "url": "jdbc:mysql://cds-db:3306/sdnctl", - "username": "sdnctl", - "password": "sdnctl" - } - }, - "topology_template": { - "workflows": { - "resource-resolution": { - "steps": { - "helloworld": { - "description": "Component resource resolution regression test", - "target": "resource-resolution" - } - }, - "inputs": { - "resolution-key": { - "required": true, - "type": "string" - }, - "template-prefix": { - "required": true, - "type": "list", - "entry_schema": { - "type": "string" - } - } - }, - "outputs": { - "meshed-template": { - "type": "json", - "value": { - "get_attribute": [ - "resource-resolution", - "assignment-params" - ] - } - } - } - } - }, - "node_templates": { - "resource-resolution": { - "type": "component-resource-resolution", - "interfaces": { - "ResourceResolutionComponent": { - "operations": { - "process": { - "inputs": { - "artifact-prefix-names": { - "get_input": "template-prefix" - }, - "store-result": true, - "force-resolution": true, - "resolution-key": { - "get_input": "resolution-key" - } - } - } - } - } - }, - "artifacts": { - "helloworld-velocity-template": { - "type": "artifact-template-velocity", - "file": "Templates/hello-world-template.vtl" - }, - "helloworld-velocity-mapping": { - "type": "artifact-mapping-resource", - "file": "Templates/hello-world-velocity-mapping.json" - }, - "helloworld-jinja-template": { - "type": "artifact-template-jinja", - "file": "Templates/hello-world-template.jinja" - }, - "helloworld-jinja-mapping": { - "type": "artifact-mapping-resource", - "file": "Templates/hello-world-jinja-mapping.json" - } - } - } - } - } -} diff --git a/cds-regression-test/cba/resource-resolution/Scripts/kotlin/ResolvProperties.kt b/cds-regression-test/cba/resource-resolution/Scripts/kotlin/ResolvProperties.kt deleted file mode 100644 index 5dd8a86..0000000 --- a/cds-regression-test/cba/resource-resolution/Scripts/kotlin/ResolvProperties.kt +++ /dev/null @@ -1,49 +0,0 @@ -package cba.cds.RT - -import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor -import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment -import org.slf4j.LoggerFactory - -open class ResolvPropertiesKt() : ResourceAssignmentProcessor() { - - private val log = LoggerFactory.getLogger(ResolvPropertiesKt::class.java)!! - - override fun getName(): String { - return "ResolvPropertiesKt" - } - - override suspend fun processNB(resourceAssignment: ResourceAssignment) { - - var retValue = "undefined" - val resourceAssignmentNames = listOf("j_kotlin","v_kotlin") - - try { - if(resourceAssignment.name == "from_suspend_function") { - retValue = getResolvedValue(resourceAssignment) - } - if(resourceAssignmentNames.contains(resourceAssignment.name)) { - retValue = "ok" - } - ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, retValue) - - } catch (e: Exception) { - log.error(e.message, e) - ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, "ERROR") - - throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments, cause: ${e.message}", e) - } - } - - /* - * CCSDK-2150 : https://jira.onap.org/browse/CCSDK-2150 - */ - suspend fun getResolvedValue(resourceAssignment: ResourceAssignment): String { - return "ok" - } - - override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { - raRuntimeService.getBluePrintError().addError("Failed in ResolvPropertiesKt-ResourceAssignmentProcessor : ${runtimeException.message}") - } -} diff --git a/cds-regression-test/cba/resource-resolution/Scripts/python/ResolvProperties.py b/cds-regression-test/cba/resource-resolution/Scripts/python/ResolvProperties.py deleted file mode 100644 index 4397a67..0000000 --- a/cds-regression-test/cba/resource-resolution/Scripts/python/ResolvProperties.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (c) 2019 IBM, Bell Canada. -# -# 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. -from abstract_ra_processor import AbstractRAProcessor -from blueprint_constants import * - -class ResolvProperties(AbstractRAProcessor): - - def process(self, resource_assignment): - - resource_assignment_names = ["v_python","j_python"] - script_value = "undefined" - - try: - if resource_assignment.name in resource_assignment_names : - script_value = "ok" - # set value for resource getting currently resolved - self.set_resource_data_value(resource_assignment, script_value) - # except JavaException as err: - # print("Java Exception in the script {}", err) - # self.set_resource_data_value(resource_assignment, "ERROR") - except Exception as err: - print("Python Exception in the script {}", err) - # self.set_resource_data_value(resource_assignment, "ERROR") - return None - - def recover(self, runtime_exception): - print("Exception in the script {}", runtime_exception) - # print self.addError(runtime_exception.cause.message) - return None diff --git a/cds-regression-test/cba/resource-resolution/TOSCA-Metadata/TOSCA.meta b/cds-regression-test/cba/resource-resolution/TOSCA-Metadata/TOSCA.meta deleted file mode 100644 index bb9b59a..0000000 --- a/cds-regression-test/cba/resource-resolution/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0 -CSAR-Version: 1.0 -Created-By: Selffish -Entry-Definitions: Definitions/resource-resolution.json -Template-Tags: test, regression -Template-Name: RT-resource-resolution -Template-Version: 1.0.0 -Template-Type: DEFAULT \ No newline at end of file diff --git a/cds-regression-test/cba/resource-resolution/Templates/hello-world-jinja-mapping.json b/cds-regression-test/cba/resource-resolution/Templates/hello-world-jinja-mapping.json deleted file mode 100644 index 395e7a1..0000000 --- a/cds-regression-test/cba/resource-resolution/Templates/hello-world-jinja-mapping.json +++ /dev/null @@ -1,115 +0,0 @@ -[ - { - "name": "j_default", - "input-param": true, - "property": { - "type": "string", - "default": "ok" - }, - "dictionary-name": "input-source", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "j_input", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "input-source", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "j_python", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "properties-capability-source", - "dictionary-source": "capability", - "dependencies": [] - }, - { - "name": "j_kotlin", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "kotlin-script", - "dictionary-source": "capability", - "dependencies": [] - }, - { - "name": "from_suspend_function", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "kotlin-script", - "dictionary-source": "capability", - "dependencies": [] - }, - { - "name": "j_db", - "input-param": true, - "property": { - "type": "list", - "entry_schema": { - "type": "string" - } - }, - "dictionary-name": "RT-db", - "dictionary-source": "processor-db" - }, - { - "name": "j_get", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-get", - "dictionary-source": "sdnc", - "dependencies": [] - }, - { - "name": "j_post", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-post", - "dictionary-source": "sdnc", - "dependencies": [] - }, - { - "name": "j_put", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-put", - "dictionary-source": "sdnc", - "dependencies": [] - }, - { - "name": "j_patch", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-patch", - "dictionary-source": "sdnc", - "dependencies": [] - }, - { - "name": "j_del", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-delete", - "dictionary-source": "sdnc", - "dependencies": [] - } -] diff --git a/cds-regression-test/cba/resource-resolution/Templates/hello-world-template.jinja b/cds-regression-test/cba/resource-resolution/Templates/hello-world-template.jinja deleted file mode 100644 index 19947b5..0000000 --- a/cds-regression-test/cba/resource-resolution/Templates/hello-world-template.jinja +++ /dev/null @@ -1,19 +0,0 @@ -{ - "default": "{{ j_default }}", - "input": "{{ j_input }}", - "script": { - "python": "{{ j_python }}", - "kotlin": { - "base": "{{ j_kotlin }}" - "from suspend function": "{{ from_suspend_function }}" - } - }, - "db": "{{ j_db[0].value }}", - "rest": { - "GET": "{{j_get}}", - "POST": "{{j_post}}", - "PUT": "{{j_put}}", - "PATCH": "{{j_patch}}", - "DELETE": "{{j_del}}" - } -} diff --git a/cds-regression-test/cba/resource-resolution/Templates/hello-world-template.vtl b/cds-regression-test/cba/resource-resolution/Templates/hello-world-template.vtl deleted file mode 100644 index f821770..0000000 --- a/cds-regression-test/cba/resource-resolution/Templates/hello-world-template.vtl +++ /dev/null @@ -1,16 +0,0 @@ -{ - "default": "${v_default}", - "input": "${v_input}", - "script": { - "python": "${v_python}", - "kotlin": "${v_kotlin}" - }, - "db": "${v_db.get(0).value}", - "rest": { - "GET": "${v_get}", - "POST": "${v_post}", - "PUT": "${v_put}", - "PATCH": "${v_patch}", - "DELETE": "${v_del}" - } -} diff --git a/cds-regression-test/cba/resource-resolution/Templates/hello-world-velocity-mapping.json b/cds-regression-test/cba/resource-resolution/Templates/hello-world-velocity-mapping.json deleted file mode 100644 index 4314908..0000000 --- a/cds-regression-test/cba/resource-resolution/Templates/hello-world-velocity-mapping.json +++ /dev/null @@ -1,105 +0,0 @@ -[ - { - "name": "v_default", - "input-param": true, - "property": { - "type": "string", - "default": "ok" - }, - "dictionary-name": "input-source", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "v_input", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "input-source", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "v_python", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "properties-capability-source", - "dictionary-source": "capability", - "dependencies": [] - }, - { - "name": "v_kotlin", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "kotlin-script", - "dictionary-source": "capability", - "dependencies": [] - }, - { - "name": "v_db", - "input-param": true, - "property": { - "type": "list", - "entry_schema": { - "type": "string" - } - }, - "dictionary-name": "RT-db", - "dictionary-source": "processor-db" - }, - { - "name": "v_get", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-get", - "dictionary-source": "sdnc", - "dependencies": [] - }, - { - "name": "v_post", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-post", - "dictionary-source": "sdnc", - "dependencies": [] - }, - { - "name": "v_put", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-put", - "dictionary-source": "sdnc", - "dependencies": [] - }, - { - "name": "v_patch", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-patch", - "dictionary-source": "sdnc", - "dependencies": [] - }, - { - "name": "v_del", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "RT-rest-delete", - "dictionary-source": "sdnc", - "dependencies": [] - } -] diff --git a/cds-regression-test/dependencies/mockserver/mockserver-deployment.yaml b/cds-regression-test/dependencies/mockserver/mockserver-deployment.yaml deleted file mode 100644 index 36a9e30..0000000 --- a/cds-regression-test/dependencies/mockserver/mockserver-deployment.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: cds-regression-mockserver - labels: - app: cds-regression-mockserver -spec: - replicas: 1 - selector: - matchLabels: - app: cds-regression-mockserver - template: - metadata: - labels: - app: cds-regression-mockserver - spec: - containers: - - name: cds-regression-mockserver - image: mockserver/mockserver - ports: - - containerPort: 1080 diff --git a/cds-regression-test/dependencies/mockserver/mockserver-service.yaml b/cds-regression-test/dependencies/mockserver/mockserver-service.yaml deleted file mode 100644 index b735a9c..0000000 --- a/cds-regression-test/dependencies/mockserver/mockserver-service.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: cds-regression-mockserver -spec: - type: NodePort - selector: - app: cds-regression-mockserver - ports: - - protocol: TCP - port: 1080 - nodePort: 31095 diff --git a/cds-regression-test/dependencies/odl-test-tool/Dockerfile b/cds-regression-test/dependencies/odl-test-tool/Dockerfile deleted file mode 100644 index 18b21ea..0000000 --- a/cds-regression-test/dependencies/odl-test-tool/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM openjdk:14-alpine - -# checkout and build https://git.opendaylight.org/gerrit/admin/repos/netconf -# wiki https://wiki.opendaylight.org/view/OpenDaylight_Controller:Netconf:Testtool -COPY netconf-testtool-1.8.0-executable.jar /opt/app/netconf-testtool/netconf-testtool-1.8.0-executable.jar -EXPOSE 17830 -ENTRYPOINT ["java", "-Xmx1G", "-XX:MaxPermSize=256M", "-jar", "/opt/app/netconf-testtool/netconf-testtool-1.8.0-executable.jar"] - diff --git a/cds-regression-test/dependencies/odl-test-tool/testtool-deployment.yaml b/cds-regression-test/dependencies/odl-test-tool/testtool-deployment.yaml deleted file mode 100644 index e2c36a6..0000000 --- a/cds-regression-test/dependencies/odl-test-tool/testtool-deployment.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: odl-netconf-testtool - labels: - app: odl-netconf-testtool -spec: - replicas: 1 - selector: - matchLabels: - app: netconf-testtool - template: - metadata: - labels: - app: netconf-testtool - spec: - containers: - - name: netconf-testtool - image: registry-public.nso.lab-services.ca/odl/netconf-test-tool:1.8.0 - imagePullPolicy: Always - ports: - - containerPort: 17830 diff --git a/cds-regression-test/dependencies/odl-test-tool/testtool-service.yaml b/cds-regression-test/dependencies/odl-test-tool/testtool-service.yaml deleted file mode 100644 index 141f514..0000000 --- a/cds-regression-test/dependencies/odl-test-tool/testtool-service.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: odl-netconf-testtool -spec: - selector: - app: netconf-testtool - ports: - - protocol: TCP - port: 17830 diff --git a/cds-regression-test/dependencies/python3/Dockerfile b/cds-regression-test/dependencies/python3/Dockerfile deleted file mode 100644 index 1a5c714..0000000 --- a/cds-regression-test/dependencies/python3/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM python:3 - -RUN pip install confluent_kafka requests-futures diff --git a/cds-regression-test/dependencies/ssh-mock/Dockerfile b/cds-regression-test/dependencies/ssh-mock/Dockerfile deleted file mode 100644 index af3e88b..0000000 --- a/cds-regression-test/dependencies/ssh-mock/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM danielguerra/alpine-sshd:latest -COPY ./create-user.sh /opt/create-user.sh -COPY ./sshd_config /etc/ssh/sshd_config -RUN ["/opt/create-user.sh"] \ No newline at end of file diff --git a/cds-regression-test/dependencies/ssh-mock/create-user.sh b/cds-regression-test/dependencies/ssh-mock/create-user.sh deleted file mode 100755 index fc4ca8d..0000000 --- a/cds-regression-test/dependencies/ssh-mock/create-user.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -mkdir -p /home/cdstest/dev /home/cdstest/bin /home/cdstest/lib /home/cdstest/etc -cd /home/cdstest/dev -mknod -m 666 null c 1 3 -mknod -m 666 tty c 5 0 -mknod -m 666 zero c 1 5 -mknod -m 666 random c 1 8 -cp /bin/ash /bin/ls /bin/date /home/cdstest/bin/. -cp /lib/ld-musl-x86_64.so.1 /home/cdstest/lib/. -adduser cdstest < - tar -xvf /regression-test-files/files.tar.gz && - . ./$TEST_DIRECTORY/reset-verify-mockserver.sh && - . ./$TEST_DIRECTORY/resource-resolution/init-mockserver.sh && - . ./$TEST_DIRECTORY/remote-ansible/init-mockserver.sh && - . ./$TEST_DIRECTORY/ansible-python-dg/init-mockserver.sh - image: registry-dev.nso.lab-services.ca/nso-platform-onap-cds-regression-image:latest - name: init-mockserver - resources: {} - volumeMounts: - - name: regression-test-files - mountPath: /regression-test-files - env: - - name: TEST_DIRECTORY - valueFrom: - configMapKeyRef: - name: regression-env - key: TEST_DIRECTORY - - name: MOCKSERVER_URL - valueFrom: - configMapKeyRef: - name: regression-env - key: MOCKSERVER_URL - restartPolicy: Never - volumes: - - name: regression-test-files - configMap: - name: regression-test-files -status: {} diff --git a/cds-regression-test/test/ansible-python-dg/ansible-python-dg-enrichment-test.sh b/cds-regression-test/test/ansible-python-dg/ansible-python-dg-enrichment-test.sh deleted file mode 100644 index 26dfa99..0000000 --- a/cds-regression-test/test/ansible-python-dg/ansible-python-dg-enrichment-test.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -CBA_NAME="ansible-python-dg" -TEST_NAME="$CBA_NAME-enrichment" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Compressing CBA: $CBA_NAME" -compress_cba $CBA_NAME - -echo "Enriching CBA: $CBA_NAME" -enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/cds-regression-test/test/ansible-python-dg/ansible-python-dg-upload-test.sh b/cds-regression-test/test/ansible-python-dg/ansible-python-dg-upload-test.sh deleted file mode 100644 index f3abae1..0000000 --- a/cds-regression-test/test/ansible-python-dg/ansible-python-dg-upload-test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -CBA_NAME="ansible-python-dg" -TEST_NAME="$CBA_NAME-upload" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Uploading CBA: $CBA_NAME" -upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -# This step prevents a race-condition for parallel process requests -# when cba has not yet been written to filesystem -echo 'Send process request to force CDS to load CBA to filesystem' -process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/cds-regression-test/test/ansible-python-dg/dummy-request-payload.json b/cds-regression-test/test/ansible-python-dg/dummy-request-payload.json deleted file mode 100644 index f04d745..0000000 --- a/cds-regression-test/test/ansible-python-dg/dummy-request-payload.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "dummy-request-should-fail", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-ansible-python-dg", - "blueprintVersion": "1.0.0", - "actionName": "dummy", - "mode": "sync" - }, - "payload": {} -} diff --git a/cds-regression-test/test/ansible-python-dg/init-mockserver.sh b/cds-regression-test/test/ansible-python-dg/init-mockserver.sh deleted file mode 100644 index b777714..0000000 --- a/cds-regression-test/test/ansible-python-dg/init-mockserver.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -CBA_NAME="ansible-python-dg" -DIR_PAYLOADS="$TEST_DIRECTORY/$CBA_NAME/mock-payloads" - - -# JOB TEMPLATE -echo "Mocking Job Template route..." -JT_PAYLOAD="job-template.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$JT_PAYLOAD" - -# JOB TEMPLATE LAUNCH - GET -echo "Mocking Job Template Launch GET route..." -GET_JT_LAUNCH_PAYLOAD="get_job-template-launch.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$GET_JT_LAUNCH_PAYLOAD" - -# JOB TEMPLATE LAUNCH -echo "Mocking Inventory route..." -INVENTORY_PAYLOAD="inventory.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$INVENTORY_PAYLOAD" - -# JOB TEMPLATE LAUNCH - POST -echo "Mocking Job Template Launch POST route..." -POST_JT_LAUNCH_PAYLOAD="post_job-template-launch.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$POST_JT_LAUNCH_PAYLOAD" - -# JOB EXECUTION -echo "Mocking Job Execution route..." -JOB_EXECUTION_PAYLOAD="job-execution.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$JOB_EXECUTION_PAYLOAD" - -# JOB OUTPUT -echo "Mocking Job Output route..." -JOB_OUTPUT_PAYLOAD="job-output.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$JOB_OUTPUT_PAYLOAD" diff --git a/cds-regression-test/test/ansible-python-dg/mock-payloads/get_job-template-launch.json b/cds-regression-test/test/ansible-python-dg/mock-payloads/get_job-template-launch.json deleted file mode 100644 index f4d0020..0000000 --- a/cds-regression-test/test/ansible-python-dg/mock-payloads/get_job-template-launch.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "httpRequest": { - "method": "GET", - "path": "/ansible-python-dg/success/api/v2/job_templates/123/launch/" - }, - "httpResponse": { - "body": { - "can_start_without_user_input": false, - "passwords_needed_to_start": [], - "ask_variables_on_launch": true, - "ask_tags_on_launch": true, - "ask_diff_mode_on_launch": false, - "ask_skip_tags_on_launch": true, - "ask_job_type_on_launch": false, - "ask_limit_on_launch": true, - "ask_verbosity_on_launch": false, - "ask_inventory_on_launch": true, - "ask_credential_on_launch": true, - "survey_enabled": true, - "variables_needed_to_start": [ - "tor_group", - "site_id" - ], - "credential_needed_to_start": false, - "inventory_needed_to_start": false, - "job_template_data": { - "name": "hello_world_job_template", - "id": "123", - "description": "hello_world Runner Job Template" - }, - "defaults": { - "extra_vars": "", - "diff_mode": false, - "limit": "", - "job_tags": "", - "skip_tags": "", - "job_type": "run", - "verbosity": 0, - "inventory": { - "name": "Demo Inventory", - "id": 1 - } - } - } - } -} diff --git a/cds-regression-test/test/ansible-python-dg/mock-payloads/inventory.json b/cds-regression-test/test/ansible-python-dg/mock-payloads/inventory.json deleted file mode 100644 index 87cfdfb..0000000 --- a/cds-regression-test/test/ansible-python-dg/mock-payloads/inventory.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "httpRequest": { - "method": "GET", - "path": "/ansible-python-dg/success/api/v2/inventories/" - }, - "httpResponse": { - "body": { - "count": 1, - "next": null, - "previous": null, - "results": [ - { - "id": 1, - "type": "inventory", - "url": "/api/v2/inventories/1/", - "related": { - "created_by": "/api/v2/users/1/", - "modified_by": "/api/v2/users/1/", - "hosts": "/api/v2/inventories/1/hosts/", - "groups": "/api/v2/inventories/1/groups/", - "root_groups": "/api/v2/inventories/1/root_groups/", - "variable_data": "/api/v2/inventories/1/variable_data/", - "script": "/api/v2/inventories/1/script/", - "tree": "/api/v2/inventories/1/tree/", - "inventory_sources": "/api/v2/inventories/1/inventory_sources/", - "update_inventory_sources": "/api/v2/inventories/1/update_inventory_sources/", - "activity_stream": "/api/v2/inventories/1/activity_stream/", - "job_templates": "/api/v2/inventories/1/job_templates/", - "ad_hoc_commands": "/api/v2/inventories/1/ad_hoc_commands/", - "access_list": "/api/v2/inventories/1/access_list/", - "object_roles": "/api/v2/inventories/1/object_roles/", - "instance_groups": "/api/v2/inventories/1/instance_groups/", - "copy": "/api/v2/inventories/1/copy/", - "organization": "/api/v2/organizations/1/" - }, - "summary_fields": { - "organization": { - "id": 1, - "name": "Default", - "description": "" - }, - "created_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "modified_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "object_roles": { - "admin_role": { - "description": "Can manage all aspects of the inventory", - "name": "Admin", - "id": 21 - }, - "update_role": { - "description": "May update project or inventory or group using the configured source update system", - "name": "Update", - "id": 22 - }, - "adhoc_role": { - "description": "May run ad hoc commands on an inventory", - "name": "Ad Hoc", - "id": 23 - }, - "use_role": { - "description": "Can use the inventory in a job template", - "name": "Use", - "id": 24 - }, - "read_role": { - "description": "May view settings for the inventory", - "name": "Read", - "id": 25 - } - }, - "user_capabilities": { - "edit": true, - "delete": true, - "copy": true, - "adhoc": true - } - }, - "created": "2019-05-21T15:45:31.954359Z", - "modified": "2019-05-21T15:45:31.954378Z", - "name": "Demo Inventory", - "description": "", - "organization": 1, - "kind": "", - "host_filter": null, - "variables": "", - "has_active_failures": false, - "total_hosts": 1, - "hosts_with_active_failures": 0, - "total_groups": 0, - "groups_with_active_failures": 0, - "has_inventory_sources": false, - "total_inventory_sources": 0, - "inventory_sources_with_failures": 0, - "insights_credential": null, - "pending_deletion": false - } - ] - } - } -} diff --git a/cds-regression-test/test/ansible-python-dg/mock-payloads/job-execution.json b/cds-regression-test/test/ansible-python-dg/mock-payloads/job-execution.json deleted file mode 100644 index 34772d7..0000000 --- a/cds-regression-test/test/ansible-python-dg/mock-payloads/job-execution.json +++ /dev/null @@ -1,216 +0,0 @@ -{ - "httpRequest": { - "method": "GET", - "path": "/ansible-python-dg/success/api/v2/jobs/456/" - }, - "httpResponse": { - "body": { - "id": "456", - "type": "job", - "url": "/api/v2/jobs/456/", - "related": { - "created_by": "/api/v2/users/1/", - "labels": "/api/v2/jobs/456/labels/", - "inventory": "/api/v2/inventories/1/", - "project": "/api/v2/projects/8/", - "extra_credentials": "/api/v2/jobs/456/extra_credentials/", - "credentials": "/api/v2/jobs/456/credentials/", - "unified_job_template": "/api/v2/job_templates/123/", - "stdout": "/api/v2/jobs/456/stdout/", - "job_events": "/api/v2/jobs/456/job_events/", - "job_host_summaries": "/api/v2/jobs/456/job_host_summaries/", - "activity_stream": "/api/v2/jobs/456/activity_stream/", - "notifications": "/api/v2/jobs/456/notifications/", - "job_template": "/api/v2/job_templates/123/", - "cancel": "/api/v2/jobs/456/cancel/", - "create_schedule": "/api/v2/jobs/456/create_schedule/", - "relaunch": "/api/v2/jobs/456/relaunch/" - }, - "summary_fields": { - "inventory": { - "id": 1, - "name": "Demo Inventory", - "description": "", - "has_active_failures": false, - "total_hosts": 1, - "hosts_with_active_failures": 0, - "total_groups": 0, - "groups_with_active_failures": 0, - "has_inventory_sources": false, - "total_inventory_sources": 0, - "inventory_sources_with_failures": 0, - "organization_id": 1, - "kind": "" - }, - "project": { - "id": 8, - "name": "cds_playbooks", - "description": "CDS - cds_playbooks Project", - "status": "ok", - "scm_type": "" - }, - "job_template": { - "id": "123", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template" - }, - "unified_job_template": { - "id": "123", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "unified_job_type": "job" - }, - "instance_group": { - "name": "tower", - "id": 1 - }, - "created_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "user_capabilities": { - "delete": true, - "start": true - }, - "labels": { - "count": 0, - "results": [] - }, - "extra_credentials": [], - "credentials": [] - }, - "created": "2019-06-12T11:21:26.891986Z", - "modified": "2019-06-12T11:21:27.355185Z", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "job_type": "run", - "inventory": 1, - "project": 8, - "playbook": "hello_world.yml", - "forks": 0, - "limit": "", - "verbosity": 0, - "extra_vars": "{\"tor_group\": \"vEPC\", \"site_id\": \"3 - Belmont\"}", - "job_tags": "", - "force_handlers": false, - "skip_tags": "", - "start_at_task": "", - "timeout": 0, - "use_fact_cache": false, - "unified_job_template": "123", - "launch_type": "manual", - "status": "successful", - "failed": false, - "started": "2019-06-12T11:21:27.510766Z", - "finished": "2019-06-12T11:21:48.993385Z", - "elapsed": 21.483, - "job_args": "[\"ansible-playbook\", \"-u\", \"root\", \"-i\", \"/tmp/awx_223_ft8hu4p4/tmptmtwllu4\", \"-e\", \"@/tmp/awx_223_ft8hu4p4/env/extravars\", \"hello_world.yml\"]", - "job_cwd": "/var/lib/awx/projects/cds_playbooks_folder", - "job_env": { - "HOSTNAME": "awx", - "LC_ALL": "en_US.UTF-8", - "VIRTUAL_ENV": "/var/lib/awx/venv/ansible", - "PATH": "/var/lib/awx/venv/ansible/bin:/var/lib/awx/venv/awx/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", - "SUPERVISOR_GROUP_NAME": "tower-processes", - "PWD": "/var/lib/awx", - "LANG": "en_US.UTF-8", - "PS1": "(awx) ", - "SUPERVISOR_ENABLED": "1", - "HOME": "/var/lib/awx", - "SHLVL": "2", - "LANGUAGE": "en_US.UTF-8", - "LC_CTYPE": "en_US.UTF-8", - "SUPERVISOR_PROCESS_NAME": "dispatcher", - "SUPERVISOR_SERVER_URL": "unix:///tmp/supervisor.sock", - "DJANGO_SETTINGS_MODULE": "awx.settings.production", - "DJANGO_LIVE_TEST_SERVER_ADDRESS": "localhost:9013-9199", - "TZ": "UTC", - "ANSIBLE_FORCE_COLOR": "True", - "ANSIBLE_HOST_KEY_CHECKING": "False", - "ANSIBLE_INVENTORY_UNPARSED_FAILED": "True", - "ANSIBLE_PARAMIKO_RECORD_HOST_KEYS": "False", - "ANSIBLE_VENV_PATH": "/var/lib/awx/venv/ansible", - "AWX_PRIVATE_DATA_DIR": "/tmp/awx_223_ft8hu4p4", - "PYTHONPATH": "/var/lib/awx/venv/ansible/lib/python2.7/site-packages:/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/lib:", - "JOB_ID": "456", - "INVENTORY_ID": "1", - "PROJECT_REVISION": "", - "ANSIBLE_RETRY_FILES_ENABLED": "False", - "MAX_EVENT_RES": "700000", - "ANSIBLE_CALLBACK_PLUGINS": "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/plugins/callback", - "AWX_HOST": "https://towerhost", - "ANSIBLE_SSH_CONTROL_PATH_DIR": "/tmp/awx_223_ft8hu4p4/cp", - "ANSIBLE_STDOUT_CALLBACK": "awx_display", - "AWX_ISOLATED_DATA_DIR": "/tmp/awx_223_ft8hu4p4/artifacts/456" - }, - "job_explanation": "", - "execution_node": "awx", - "controller_node": "", - "result_traceback": "", - "event_processing_finished": true, - "job_template": "123", - "passwords_needed_to_start": [], - "ask_diff_mode_on_launch": false, - "ask_variables_on_launch": true, - "ask_limit_on_launch": true, - "ask_tags_on_launch": true, - "ask_skip_tags_on_launch": true, - "ask_job_type_on_launch": false, - "ask_verbosity_on_launch": false, - "ask_inventory_on_launch": true, - "ask_credential_on_launch": true, - "allow_simultaneous": false, - "artifacts": { - "interface_groups": [ - "NSO-Openstack-NFVI-SRIOV-Shared" - ], - "host_groups": "NSO-Openstack-NFVI-SRIOV-Shared_999, ", - "topology": { - "tor-8.tenlab-cloud": [ - { - "interface_lldp_description": "sriov-s-2", - "interface_group": "NSO-Openstack-NFVI-SRIOV-Shared", - "lldp_interface_id": 740, - "compute_device": "nfvi-compute-14.tenlab-nfvi", - "interface_parent_name": null, - "interface_name": "TenGigE0/0/0/19", - "host_aggregate": "vLNS", - "tor_device": "tor-8.tenlab-cloud", - "compute_interface": "sriov-s-2" - } - ], - "tor-7.tenlab-cloud": [ - { - "interface_lldp_description": "sriov-s-1", - "interface_group": "NSO-Openstack-NFVI-SRIOV-Shared", - "lldp_interface_id": 698, - "compute_device": "nfvi-compute-14.tenlab-nfvi", - "interface_parent_name": null, - "interface_name": "TenGigE0/0/0/19", - "host_aggregate": "vLNS", - "tor_device": "tor-7.tenlab-cloud", - "compute_interface": "sriov-s-1" - } - ] - } - }, - "scm_revision": "", - "instance_group": 1, - "diff_mode": false, - "job_slice_number": 0, - "job_slice_count": 1, - "host_status_counts": { - "ok": 1 - }, - "playbook_counts": { - "play_count": 1, - "task_count": 2 - }, - "custom_virtualenv": "/var/lib/awx/venv/ansible", - "credential": null, - "vault_credential": null - } - } -} diff --git a/cds-regression-test/test/ansible-python-dg/mock-payloads/job-output.json b/cds-regression-test/test/ansible-python-dg/mock-payloads/job-output.json deleted file mode 100644 index 4877737..0000000 --- a/cds-regression-test/test/ansible-python-dg/mock-payloads/job-output.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "httpRequest" : { - "method" : "GET", - "path" : "/ansible-python-dg/success/api/v2/jobs/456/stdout/" - }, - "httpResponse" : { - "body" : " - - PLAY [Hello World Sample] ****************************************************** - - TASK [Gathering Facts] ********************************************************* - ok: [localhost] - - TASK [Hello Message] *********************************************************** - ok: [localhost] => { - \"msg\": \"Hello World!\" - } - - PLAY RECAP ********************************************************************* - localhost : ok=2 changed=0 unreachable=0 failed=0 - -" - } -} diff --git a/cds-regression-test/test/ansible-python-dg/mock-payloads/job-template.json b/cds-regression-test/test/ansible-python-dg/mock-payloads/job-template.json deleted file mode 100644 index 5b78274..0000000 --- a/cds-regression-test/test/ansible-python-dg/mock-payloads/job-template.json +++ /dev/null @@ -1,224 +0,0 @@ -{ - "httpRequest": { - "method": "GET", - "path": "/ansible-python-dg/success/api/v2/job_templates/hello_world_job_template/" - }, - "httpResponse": { - "body": { - "id": "123", - "type": "job_template", - "url": "/api/v2/job_templates/123/", - "related": { - "named_url": "/api/v2/job_templates/hello_world_job_template/", - "created_by": "/api/v2/users/1/", - "modified_by": "/api/v2/users/1/", - "labels": "/api/v2/job_templates/123/labels/", - "inventory": "/api/v2/inventories/1/", - "project": "/api/v2/projects/8/", - "extra_credentials": "/api/v2/job_templates/123/extra_credentials/", - "credentials": "/api/v2/job_templates/123/credentials/", - "last_job": "/api/v2/jobs/222/", - "jobs": "/api/v2/job_templates/123/jobs/", - "schedules": "/api/v2/job_templates/123/schedules/", - "activity_stream": "/api/v2/job_templates/123/activity_stream/", - "launch": "/api/v2/job_templates/123/launch/", - "notification_templates_any": "/api/v2/job_templates/123/notification_templates_any/", - "notification_templates_success": "/api/v2/job_templates/123/notification_templates_success/", - "notification_templates_error": "/api/v2/job_templates/123/notification_templates_error/", - "access_list": "/api/v2/job_templates/123/access_list/", - "survey_spec": "/api/v2/job_templates/123/survey_spec/", - "object_roles": "/api/v2/job_templates/123/object_roles/", - "instance_groups": "/api/v2/job_templates/123/instance_groups/", - "slice_workflow_jobs": "/api/v2/job_templates/123/slice_workflow_jobs/", - "copy": "/api/v2/job_templates/123/copy/" - }, - "summary_fields": { - "inventory": { - "id": 1, - "name": "Demo Inventory", - "description": "", - "has_active_failures": false, - "total_hosts": 1, - "hosts_with_active_failures": 0, - "total_groups": 0, - "groups_with_active_failures": 0, - "has_inventory_sources": false, - "total_inventory_sources": 0, - "inventory_sources_with_failures": 0, - "organization_id": 1, - "kind": "" - }, - "project": { - "id": 8, - "name": "cds_playbooks", - "description": "CDS - cds_playbooks Project", - "status": "ok", - "scm_type": "" - }, - "last_job": { - "id": 222, - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "finished": "2019-06-12T11:20:27.892787Z", - "status": "successful", - "failed": false - }, - "last_update": { - "id": 222, - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "status": "successful", - "failed": false - }, - "created_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "modified_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "object_roles": { - "admin_role": { - "description": "Can manage all aspects of the job template", - "name": "Admin", - "id": 51 - }, - "execute_role": { - "description": "May run the job template", - "name": "Execute", - "id": 52 - }, - "read_role": { - "description": "May view settings for the job template", - "name": "Read", - "id": 53 - } - }, - "user_capabilities": { - "edit": true, - "delete": true, - "start": true, - "schedule": true, - "copy": true - }, - "labels": { - "count": 0, - "results": [] - }, - "survey": { - "title": "", - "description": "" - }, - "recent_jobs": [ - { - "id": 222, - "status": "successful", - "finished": "2019-06-12T11:20:27.892787Z", - "type": "job" - }, - { - "id": 65, - "status": "successful", - "finished": "2019-06-03T18:27:19.114796Z", - "type": "job" - }, - { - "id": 64, - "status": "successful", - "finished": "2019-06-03T18:26:53.606618Z", - "type": "job" - }, - { - "id": 63, - "status": "successful", - "finished": "2019-06-03T18:24:36.072943Z", - "type": "job" - }, - { - "id": 62, - "status": "successful", - "finished": "2019-06-03T18:17:50.616528Z", - "type": "job" - }, - { - "id": 61, - "status": "successful", - "finished": "2019-06-03T18:04:42.995611Z", - "type": "job" - }, - { - "id": 60, - "status": "successful", - "finished": "2019-06-03T17:47:13.983951Z", - "type": "job" - }, - { - "id": 50, - "status": "successful", - "finished": "2019-05-30T15:47:55.700161Z", - "type": "job" - }, - { - "id": 49, - "status": "successful", - "finished": "2019-05-29T14:46:51.615926Z", - "type": "job" - }, - { - "id": 47, - "status": "successful", - "finished": "2019-05-27T20:23:58.656709Z", - "type": "job" - } - ], - "extra_credentials": [], - "credentials": [] - }, - "created": "2019-05-21T19:28:05.953730Z", - "modified": "2019-05-21T20:06:55.728697Z", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "job_type": "run", - "inventory": 1, - "project": 8, - "playbook": "hello_world.yml", - "forks": 0, - "limit": "", - "verbosity": 0, - "extra_vars": "", - "job_tags": "", - "force_handlers": false, - "skip_tags": "", - "start_at_task": "", - "timeout": 0, - "use_fact_cache": false, - "last_job_run": "2019-06-12T11:20:27.892787Z", - "last_job_failed": false, - "next_job_run": null, - "status": "successful", - "host_config_key": "", - "ask_diff_mode_on_launch": false, - "ask_variables_on_launch": true, - "ask_limit_on_launch": true, - "ask_tags_on_launch": true, - "ask_skip_tags_on_launch": true, - "ask_job_type_on_launch": false, - "ask_verbosity_on_launch": false, - "ask_inventory_on_launch": true, - "ask_credential_on_launch": true, - "survey_enabled": true, - "become_enabled": false, - "diff_mode": false, - "allow_simultaneous": false, - "custom_virtualenv": null, - "job_slice_count": 1, - "credential": null, - "vault_credential": null - } - } -} diff --git a/cds-regression-test/test/ansible-python-dg/mock-payloads/post_job-template-launch.json b/cds-regression-test/test/ansible-python-dg/mock-payloads/post_job-template-launch.json deleted file mode 100644 index da92392..0000000 --- a/cds-regression-test/test/ansible-python-dg/mock-payloads/post_job-template-launch.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "httpRequest": { - "method": "POST", - "path": "/ansible-python-dg/success/api/v2/job_templates/123/launch/" - }, - "httpResponse": { - "body": { - "job": "456", - "ignored_fields": {}, - "id": "456", - "type": "job", - "url": "/api/v2/jobs/456/", - "related": { - "created_by": "/api/v2/users/1/", - "modified_by": "/api/v2/users/1/", - "labels": "/api/v2/jobs/456/labels/", - "inventory": "/api/v2/inventories/1/", - "project": "/api/v2/projects/8/", - "extra_credentials": "/api/v2/jobs/456/extra_credentials/", - "credentials": "/api/v2/jobs/456/credentials/", - "unified_job_template": "/api/v2/job_templates/123/", - "stdout": "/api/v2/jobs/456/stdout/", - "job_events": "/api/v2/jobs/456/job_events/", - "job_host_summaries": "/api/v2/jobs/456/job_host_summaries/", - "activity_stream": "/api/v2/jobs/456/activity_stream/", - "notifications": "/api/v2/jobs/456/notifications/", - "job_template": "/api/v2/job_templates/123/", - "cancel": "/api/v2/jobs/456/cancel/", - "create_schedule": "/api/v2/jobs/456/create_schedule/", - "relaunch": "/api/v2/jobs/456/relaunch/" - }, - "summary_fields": { - "inventory": { - "id": 1, - "name": "Demo Inventory", - "description": "", - "has_active_failures": false, - "total_hosts": 1, - "hosts_with_active_failures": 0, - "total_groups": 0, - "groups_with_active_failures": 0, - "has_inventory_sources": false, - "total_inventory_sources": 0, - "inventory_sources_with_failures": 0, - "organization_id": 1, - "kind": "" - }, - "project": { - "id": 8, - "name": "cds_playbooks", - "description": "CDS - cds_playbooks Project", - "status": "ok", - "scm_type": "" - }, - "job_template": { - "id": "123", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template" - }, - "unified_job_template": { - "id": "123", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "unified_job_type": "job" - }, - "created_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "modified_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "user_capabilities": { - "delete": true, - "start": true - }, - "labels": { - "count": 0, - "results": [] - }, - "extra_credentials": [], - "credentials": [] - }, - "created": "2019-06-12T11:21:26.891986Z", - "modified": "2019-06-12T11:21:27.016410Z", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "job_type": "run", - "inventory": 1, - "project": 8, - "playbook": "hello_world.yml", - "forks": 0, - "limit": "", - "verbosity": 0, - "extra_vars": "{\"tor_group\": \"vEPC\", \"site_id\": \"3 - Belmont\"}", - "job_tags": "", - "force_handlers": false, - "skip_tags": "", - "start_at_task": "", - "timeout": 0, - "use_fact_cache": false, - "unified_job_template": "123", - "launch_type": "manual", - "status": "pending", - "failed": false, - "started": null, - "finished": null, - "elapsed": 0, - "job_args": "", - "job_cwd": "", - "job_env": {}, - "job_explanation": "", - "execution_node": "", - "controller_node": "", - "result_traceback": "", - "event_processing_finished": false, - "job_template": "123", - "passwords_needed_to_start": [], - "ask_diff_mode_on_launch": false, - "ask_variables_on_launch": true, - "ask_limit_on_launch": true, - "ask_tags_on_launch": true, - "ask_skip_tags_on_launch": true, - "ask_job_type_on_launch": false, - "ask_verbosity_on_launch": false, - "ask_inventory_on_launch": true, - "ask_credential_on_launch": true, - "allow_simultaneous": false, - "artifacts": {}, - "scm_revision": "", - "instance_group": null, - "diff_mode": false, - "job_slice_number": 0, - "job_slice_count": 1, - "credential": null, - "vault_credential": null - } - } -} diff --git a/cds-regression-test/test/ansible-python-dg/success/expected-response.json b/cds-regression-test/test/ansible-python-dg/success/expected-response.json deleted file mode 100644 index 833c2eb..0000000 --- a/cds-regression-test/test/ansible-python-dg/success/expected-response.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-05-26T01:11:00.914Z", - "originatorId": "System", - "requestId": "ansible-python-dg-success", - "subRequestId": "ansible-python-dg-success-1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-ansible-python-dg", - "blueprintVersion": "1.0.0", - "actionName": "run-dg", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-05-26T01:11:17.384Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "run-dg-response": { - "execute-command-logs": [ - "TenGigE0/0/0/19" - ] - } - } -} diff --git a/cds-regression-test/test/ansible-python-dg/success/request-payload.json b/cds-regression-test/test/ansible-python-dg/success/request-payload.json deleted file mode 100644 index bf68498..0000000 --- a/cds-regression-test/test/ansible-python-dg/success/request-payload.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "ansible-python-dg-success", - "subRequestId": "ansible-python-dg-success-1" - }, - "actionIdentifiers": { - "blueprintName": "RT-ansible-python-dg", - "blueprintVersion": "1.0.0", - "actionName": "run-dg", - "mode": "sync" - }, - "payload": { - "run-dg-request": { - "endpoint-selector": "awx", - "job-template-name": "hello_world_job_template", - "inventory": "Demo Inventory", - "limit": "123", - "tags": "some-tag", - "skip-tags": "some-skip-tag", - "extra-vars": { - "site_id": "3 - Belmont", - "tor_group": "vEPC" - } - } - } -} diff --git a/cds-regression-test/test/ansible-python-dg/success/test.sh b/cds-regression-test/test/ansible-python-dg/success/test.sh deleted file mode 100644 index 8977244..0000000 --- a/cds-regression-test/test/ansible-python-dg/success/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -CBA_NAME="ansible-python-dg" -TEST_NAME="success" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/bootstrap.sh b/cds-regression-test/test/bootstrap.sh deleted file mode 100755 index 36641ed..0000000 --- a/cds-regression-test/test/bootstrap.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# Starting from Frankfurt CDS release, we need to bootstrap on the first execution. - -# bootstrap files output filenames -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/bootstrap-response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/bootstrap-response-payload" - -if [ ${CDS_VERSION} == "elalto" ]; then - echo "Skipping bootstrap for elalto release" -else - echo "Bootstrapping CDS" - . ./$TEST_DIRECTORY/utils.sh - bootstrap_cds ${RESPONSE_PAYLOAD_FILE} ${RESPONSE_HEADERS_FILE} - echo "DEBUG::: RESPONSE_HEADERS_FILE: ${RESPONSE_HEADERS_FILE}" - cat ${RESPONSE_HEADERS_FILE} - echo "DEBUG::: RESPONSE_PAYLOAD_FILE: ${RESPONSE_PAYLOAD_FILE}" - cat ${RESPONSE_PAYLOAD_FILE} - assert_status_code 200 ${RESPONSE_HEADERS_FILE} -fi diff --git a/cds-regression-test/test/cli/cli-enrichment-test.sh b/cds-regression-test/test/cli/cli-enrichment-test.sh deleted file mode 100755 index a41a1ea..0000000 --- a/cds-regression-test/test/cli/cli-enrichment-test.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -CBA_NAME="cli" -TEST_NAME="$CBA_NAME-enrichment" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Compressing CBA: $CBA_NAME" -compress_cba_versioned $CBA_NAME - -echo "Enriching CBA: $CBA_NAME" -enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/cds-regression-test/test/cli/cli-upload-test.sh b/cds-regression-test/test/cli/cli-upload-test.sh deleted file mode 100755 index 7285cd4..0000000 --- a/cds-regression-test/test/cli/cli-upload-test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -CBA_NAME="cli" -TEST_NAME="$CBA_NAME-upload" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Uploading CBA: $CBA_NAME" -upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -# This step prevents a race-condition for parallel process requests -# when cba has not yet been written to filesystem -echo 'Send process request to force CDS to load CBA to filesystem' -process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/cds-regression-test/test/cli/command-fail/resources/elalto/expected-response.json b/cds-regression-test/test/cli/command-fail/resources/elalto/expected-response.json deleted file mode 100644 index b7b29e2..0000000 --- a/cds-regression-test/test/cli/command-fail/resources/elalto/expected-response.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-02-11T21:24:35.215Z", - "originatorId": "System", - "requestId": "regression-test-cli-command-fail", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-cli", - "blueprintVersion": "1.0.0", - "actionName": "cli", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-02-11T21:24:36.824Z", - "errorMessage": "Failed to execute commands, below the output : \nCommand : nonExistCommand", - "message": "failure" - }, - "payload": { - "cli-response": { - "response-data": "Error" - } - } -} diff --git a/cds-regression-test/test/cli/command-fail/resources/elalto/request-payload.json b/cds-regression-test/test/cli/command-fail/resources/elalto/request-payload.json deleted file mode 100644 index db861c9..0000000 --- a/cds-regression-test/test/cli/command-fail/resources/elalto/request-payload.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-cli", - "blueprintVersion": "1.0.0", - "actionName": "cli" - }, - "payload": { - "cli-request": { - "host": "cds-regression-sshmock", - "username": "cdstest", - "password": "testcds", - "port": "22", - "connectionTimeOut": "5000", - "commands": [ - "nonExistCommand" - ] - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "regression-test-cli-command-fail", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/cli/command-fail/resources/frankfurt/expected-response.json b/cds-regression-test/test/cli/command-fail/resources/frankfurt/expected-response.json deleted file mode 100644 index 6b71773..0000000 --- a/cds-regression-test/test/cli/command-fail/resources/frankfurt/expected-response.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-06-04T15:05:20.003Z", - "originatorId": "System", - "requestId": "regression-test-cli-command-fail", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-cli", - "blueprintVersion": "1.0.0", - "actionName": "cli", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-06-04T15:05:41.528Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "cli-response": { - "response-data": [ - { - "command": "nonExistCommand", - "deviceOutput": "nonExistCommand\r\n/ $ nonExistCommand\r\n-ash: nonExistCommand: not found\r\n/ $ \u001b[6n", - "successful": true - } - ] - } - } -} diff --git a/cds-regression-test/test/cli/command-fail/resources/frankfurt/request-payload.json b/cds-regression-test/test/cli/command-fail/resources/frankfurt/request-payload.json deleted file mode 100644 index 700271e..0000000 --- a/cds-regression-test/test/cli/command-fail/resources/frankfurt/request-payload.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-cli", - "blueprintVersion": "1.0.0", - "actionName": "cli" - }, - "payload": { - "cli-request": { - "host": "cds-regression-sshmock", - "username": "cdstest", - "password": "testcds", - "port": "22", - "connectionTimeOut": "5000", - "logging": true, - "commands": [ - "nonExistCommand" - ] - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "regression-test-cli-command-fail", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/cli/command-fail/test.sh b/cds-regression-test/test/cli/command-fail/test.sh deleted file mode 100755 index a150680..0000000 --- a/cds-regression-test/test/cli/command-fail/test.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -CBA_NAME="cli" -TEST_NAME="command-fail" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -RESOURCES_DIR="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/resources/$CDS_VERSION" -REQUEST_PAYLOAD_FILE="$RESOURCES_DIR/request-payload.json" -EXPECTED_PAYLOAD_FILE="$RESOURCES_DIR/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -if [ "${CDS_VERSION} " == "elalto " ]; then - echo 'Assert statuscode 500' - assert_status_code 500 $RESPONSE_HEADERS_FILE -else - echo 'Assert statuscode 200' - assert_status_code 200 $RESPONSE_HEADERS_FILE -fi - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/cli/dummy-request-payload.json b/cds-regression-test/test/cli/dummy-request-payload.json deleted file mode 100644 index 62d2f92..0000000 --- a/cds-regression-test/test/cli/dummy-request-payload.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "dummy-request-should-fail", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-cli", - "blueprintVersion": "1.0.0", - "actionName": "dummy", - "mode": "sync" - }, - "payload": {} -} diff --git a/cds-regression-test/test/cli/success/resources/elalto/expected-response.json b/cds-regression-test/test/cli/success/resources/elalto/expected-response.json deleted file mode 100644 index a813478..0000000 --- a/cds-regression-test/test/cli/success/resources/elalto/expected-response.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-02-11T21:19:57.762Z", - "originatorId": "System", - "requestId": "regression-test-cli", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-cli", - "blueprintVersion": "1.0.0", - "actionName": "cli", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-02-11T21:20:00.446Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "cli-response": { - "response-data": "\nCommand : pwd\n/\n\nCommand : ls\nbin\ndev\netc\nlib\n" - } - } -} diff --git a/cds-regression-test/test/cli/success/resources/elalto/request-payload.json b/cds-regression-test/test/cli/success/resources/elalto/request-payload.json deleted file mode 100644 index 8019144..0000000 --- a/cds-regression-test/test/cli/success/resources/elalto/request-payload.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-cli", - "blueprintVersion": "1.0.0", - "actionName": "cli" - }, - "payload": { - "cli-request": { - "host": "cds-regression-sshmock", - "username": "cdstest", - "password": "testcds", - "port": "22", - "connectionTimeOut": "5000", - "commands": [ - "pwd", - "ls" - ] - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "regression-test-cli", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/cli/success/resources/frankfurt/expected-response.json b/cds-regression-test/test/cli/success/resources/frankfurt/expected-response.json deleted file mode 100644 index 55248cb..0000000 --- a/cds-regression-test/test/cli/success/resources/frankfurt/expected-response.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-05-25T20:54:11.024Z", - "originatorId": "System", - "requestId": "regression-test-cli", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-cli", - "blueprintVersion": "1.0.0", - "actionName": "cli", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-05-25T20:54:21.453Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "cli-response": { - "response-data": [ - { - "command": "pwd", - "deviceOutput": "pwd\r\n/ $ pwd\r\n/\r\n/ $ \u001b[6n", - "successful": true - }, - { - "command": "ls", - "deviceOutput": "pwd\r\n/ $ pwd\r\n/\r\n/ $ \u001b[6nls\r\n\u001b[1;34mbin\u001b[m \u001b[1;34mdev\u001b[m \u001b[1;34metc\u001b[m \u001b[1;34mlib\u001b[m\r\n/ $ \u001b[6n", - "successful": true - } - ] - } - } -} diff --git a/cds-regression-test/test/cli/success/resources/frankfurt/request-payload.json b/cds-regression-test/test/cli/success/resources/frankfurt/request-payload.json deleted file mode 100644 index 0438a7c..0000000 --- a/cds-regression-test/test/cli/success/resources/frankfurt/request-payload.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-cli", - "blueprintVersion": "1.0.0", - "actionName": "cli" - }, - "payload": { - "cli-request": { - "host": "cds-regression-sshmock", - "username": "cdstest", - "password": "testcds", - "port": "22", - "connectionTimeOut": "5000", - "logging": true, - "commands": [ - "pwd", - "ls" - ] - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "regression-test-cli", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/cli/success/test.sh b/cds-regression-test/test/cli/success/test.sh deleted file mode 100755 index 6a589d5..0000000 --- a/cds-regression-test/test/cli/success/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -CBA_NAME="cli" -TEST_NAME="success" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -RESOURCES_DIR="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/resources/$CDS_VERSION" -REQUEST_PAYLOAD_FILE="$RESOURCES_DIR/request-payload.json" -EXPECTED_PAYLOAD_FILE="$RESOURCES_DIR/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/exit_on_failure.sh b/cds-regression-test/test/exit_on_failure.sh deleted file mode 100755 index 733e9a6..0000000 --- a/cds-regression-test/test/exit_on_failure.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -if [ "$(wc -c $FAILED_TESTS_DIRECTORY/*|awk '/total/ {print $1}')" -gt 0 ] -then - echo "exiting due to presence of files in FAILED_TESTS_DIRECTORY" - wc -c $FAILED_TESTS_DIRECTORY/* - exit 1; -fi diff --git a/cds-regression-test/test/lock-device/dummy-request-payload.json b/cds-regression-test/test/lock-device/dummy-request-payload.json deleted file mode 100644 index c3ca13c..0000000 --- a/cds-regression-test/test/lock-device/dummy-request-payload.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "dummy-request-should-fail", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-lock-device", - "blueprintVersion": "1.0.0", - "actionName": "dummy", - "mode": "sync" - }, - "payload": {} -} diff --git a/cds-regression-test/test/lock-device/lock-device-enrichment-test.sh b/cds-regression-test/test/lock-device/lock-device-enrichment-test.sh deleted file mode 100644 index 6c549dd..0000000 --- a/cds-regression-test/test/lock-device/lock-device-enrichment-test.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -if [ "${CDS_VERSION} " == "elalto " ]; then - echo "Skipping, not available in elalto" - return 0 -fi - -CBA_NAME="lock-device" -TEST_NAME="$CBA_NAME-enrichment" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Compressing CBA: $CBA_NAME" -compress_cba $CBA_NAME - -echo "Enriching CBA: $CBA_NAME" -enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/cds-regression-test/test/lock-device/lock-device-upload-test.sh b/cds-regression-test/test/lock-device/lock-device-upload-test.sh deleted file mode 100644 index 902c6c7..0000000 --- a/cds-regression-test/test/lock-device/lock-device-upload-test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -if [ "${CDS_VERSION} " == "elalto " ]; then - echo "Skipping, not available in elalto" - return 0 -fi - -CBA_NAME="lock-device" -TEST_NAME="$CBA_NAME-upload" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Uploading CBA: $CBA_NAME" -upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -# This step prevents a race-condition for parallel process requests -# when cba has not yet been written to filesystem -echo 'Send process request to force CDS to load CBA to filesystem' -process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-1.json b/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-1.json deleted file mode 100644 index b70b502..0000000 --- a/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-1.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-06-30T17:46:47.772Z", - "originatorId": "System", - "requestId": "lock-request-1", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-lock-device", - "blueprintVersion": "1.0.0", - "actionName": "resolve-deploy-kotlin", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-06-30T17:47:02.922Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "resolve-deploy-kotlin-response": { - "response-data": "Success: lock-request-1" - } - } -} diff --git a/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-2.json b/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-2.json deleted file mode 100644 index bd0dfdc..0000000 --- a/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-2.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-06-30T17:46:50.008Z", - "originatorId": "System", - "requestId": "lock-request-2", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-lock-device", - "blueprintVersion": "1.0.0", - "actionName": "resolve-deploy-kotlin", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-06-30T17:47:18.221Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "resolve-deploy-kotlin-response": { - "response-data": "Success: lock-request-2" - } - } -} diff --git a/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-3.json b/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-3.json deleted file mode 100644 index 9743758..0000000 --- a/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-3.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-06-30T17:46:51.761Z", - "originatorId": "System", - "requestId": "lock-request-3", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-lock-device", - "blueprintVersion": "1.0.0", - "actionName": "resolve-deploy-kotlin", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-06-30T17:47:12.301Z", - "errorMessage": "Failed in ComponentScriptExecutor : Failed to acquire lock within timeout, failed to get execution property(node_templates/execute-kotlin/attributes/response-data)", - "message": "failure" - }, - "payload": { - "resolve-deploy-kotlin-response": {} - } -} diff --git a/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-4.json b/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-4.json deleted file mode 100644 index 3b916ed..0000000 --- a/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-4.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-06-30T17:46:54.081Z", - "originatorId": "System", - "requestId": "lock-request-4", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-lock-device", - "blueprintVersion": "1.0.0", - "actionName": "resolve-deploy-kotlin", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-06-30T17:47:14.865Z", - "errorMessage": "Failed in ComponentScriptExecutor : Failed to acquire lock within timeout, failed to get execution property(node_templates/execute-kotlin/attributes/response-data)", - "message": "failure" - }, - "payload": { - "resolve-deploy-kotlin-response": {} - } -} diff --git a/cds-regression-test/test/lock-device/success/request-payloads/request-payload-1.json b/cds-regression-test/test/lock-device/success/request-payloads/request-payload-1.json deleted file mode 100644 index 20be12a..0000000 --- a/cds-regression-test/test/lock-device/success/request-payloads/request-payload-1.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-lock-device", - "blueprintVersion": "1.0.0", - "actionName": "resolve-deploy-kotlin" - }, - "payload": { - "resolve-deploy-kotlin-request": { - "resolve-deploy-kotlin-properties": { - "lock-acquire-timeout": 5 - } - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "lock-request-1", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/lock-device/success/request-payloads/request-payload-2.json b/cds-regression-test/test/lock-device/success/request-payloads/request-payload-2.json deleted file mode 100644 index 3fdc8d2..0000000 --- a/cds-regression-test/test/lock-device/success/request-payloads/request-payload-2.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-lock-device", - "blueprintVersion": "1.0.0", - "actionName": "resolve-deploy-kotlin" - }, - "payload": { - "resolve-deploy-kotlin-request": { - "resolve-deploy-kotlin-properties": { - "lock-acquire-timeout": 25 - } - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "lock-request-2", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/lock-device/success/request-payloads/request-payload-3.json b/cds-regression-test/test/lock-device/success/request-payloads/request-payload-3.json deleted file mode 100644 index f0277bc..0000000 --- a/cds-regression-test/test/lock-device/success/request-payloads/request-payload-3.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-lock-device", - "blueprintVersion": "1.0.0", - "actionName": "resolve-deploy-kotlin" - }, - "payload": { - "resolve-deploy-kotlin-request": { - "resolve-deploy-kotlin-properties": { - "lock-acquire-timeout": 15 - } - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "lock-request-3", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/lock-device/success/request-payloads/request-payload-4.json b/cds-regression-test/test/lock-device/success/request-payloads/request-payload-4.json deleted file mode 100644 index 2ba6b89..0000000 --- a/cds-regression-test/test/lock-device/success/request-payloads/request-payload-4.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-lock-device", - "blueprintVersion": "1.0.0", - "actionName": "resolve-deploy-kotlin" - }, - "payload": { - "resolve-deploy-kotlin-request": { - "resolve-deploy-kotlin-properties": { - "lock-acquire-timeout": 15 - } - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "lock-request-4", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/lock-device/success/test.sh b/cds-regression-test/test/lock-device/success/test.sh deleted file mode 100644 index 5553e5f..0000000 --- a/cds-regression-test/test/lock-device/success/test.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -CBA_NAME="lock-device" -TEST_NAME="success" -TEST_NUMBER=$RANDOM -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -for i in `seq 1 4` -do - echo "Sending request $i" - RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers-$i" - RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-$i" - REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payloads/request-payload-$i.json" - - process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE & - pids[${i}]=$! - sleep 3 -done - -echo "Waiting for responses" -for pid in ${pids[*]} -do - wait $pid -done - -echo "Assert payload - request 1" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-1" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-payloads/expected-payload-1.json" -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE - -echo "Assert payload - request 2" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-2" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-payloads/expected-payload-2.json" -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE - -echo "Assert payload - request 3" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-3" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-payloads/expected-payload-3.json" -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE - -echo "Assert payload - request 4" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-4" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-payloads/expected-payload-4.json" -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/netconf/dummy-request-payload.json b/cds-regression-test/test/netconf/dummy-request-payload.json deleted file mode 100644 index acc4f92..0000000 --- a/cds-regression-test/test/netconf/dummy-request-payload.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "dummy-request-should-fail", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-netconf", - "blueprintVersion": "1.0.0", - "actionName": "dummy", - "mode": "sync" - }, - "payload": {} -} diff --git a/cds-regression-test/test/netconf/jython/connect-fail/expected-response.json b/cds-regression-test/test/netconf/jython/connect-fail/expected-response.json deleted file mode 100644 index ff0cceb..0000000 --- a/cds-regression-test/test/netconf/jython/connect-fail/expected-response.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-02-04T14:16:32.798Z", - "originatorId": "System", - "requestId": "regression-test-netconf-jython-connect-fail", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-netconf", - "blueprintVersion": "1.0.0", - "actionName": "netconf-jython", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-02-04T14:16:32.824Z", - "errorMessage": "org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.NetconfException: 127.0.0.1:17830: Failed to establish SSH session", - "message": "failure" - }, - "payload": { - "netconf-jython-response": { - "response-data": { - "deploySuccess": false - } - } - } -} diff --git a/cds-regression-test/test/netconf/jython/connect-fail/request-payload.json b/cds-regression-test/test/netconf/jython/connect-fail/request-payload.json deleted file mode 100644 index 9a9f240..0000000 --- a/cds-regression-test/test/netconf/jython/connect-fail/request-payload.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-netconf", - "blueprintVersion": "1.0.0", - "actionName": "netconf-jython" - }, - "payload": { - "netconf-jython-request": { - "netconf-host": "127.0.0.1", - "netconf-timeout": 5 - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "regression-test-netconf-jython-connect-fail", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/netconf/jython/connect-fail/test.sh b/cds-regression-test/test/netconf/jython/connect-fail/test.sh deleted file mode 100755 index 670fa49..0000000 --- a/cds-regression-test/test/netconf/jython/connect-fail/test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -CBA_NAME="netconf" -LANG="jython" -TEST_NAME="connect-fail" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode 500' -assert_status_code 500 $RESPONSE_HEADERS_FILE - -echo 'Assert connect fail payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/netconf/jython/success/expected-response.json b/cds-regression-test/test/netconf/jython/success/expected-response.json deleted file mode 100644 index 6408577..0000000 --- a/cds-regression-test/test/netconf/jython/success/expected-response.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-02-03T13:40:43.697Z", - "originatorId": "System", - "requestId": "regression-test-netconf-jython", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-netconf", - "blueprintVersion": "1.0.0", - "actionName": "netconf-jython", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-02-03T13:40:51.835Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "netconf-jython-response": { - "response-data": { - "deploySuccess": true - } - } - } -} diff --git a/cds-regression-test/test/netconf/jython/success/request-payload.json b/cds-regression-test/test/netconf/jython/success/request-payload.json deleted file mode 100644 index dcaaeb1..0000000 --- a/cds-regression-test/test/netconf/jython/success/request-payload.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-netconf", - "blueprintVersion": "1.0.0", - "actionName": "netconf-jython" - }, - "payload": { - "netconf-jython-request": { - "netconf-host": "odl-netconf-testtool", - "netconf-timeout": 30 - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "regression-test-netconf-jython", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/netconf/jython/success/test.sh b/cds-regression-test/test/netconf/jython/success/test.sh deleted file mode 100755 index 4b3e2c0..0000000 --- a/cds-regression-test/test/netconf/jython/success/test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -CBA_NAME="netconf" -LANG="jython" -TEST_NAME="success" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/netconf/kotlin/connect-fail/expected-response.json b/cds-regression-test/test/netconf/kotlin/connect-fail/expected-response.json deleted file mode 100644 index 9334b50..0000000 --- a/cds-regression-test/test/netconf/kotlin/connect-fail/expected-response.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-02-04T14:16:32.798Z", - "originatorId": "System", - "requestId": "regression-test-netconf-kotlin-connect-fail", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-netconf", - "blueprintVersion": "1.0.0", - "actionName": "netconf-kotlin", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-02-04T14:16:32.824Z", - "errorMessage": "org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.NetconfException: 127.0.0.1:17830: Failed to establish SSH session", - "message": "failure" - }, - "payload": { - "netconf-kotlin-response": { - "response-data": { - "deploySuccess": false - } - } - } -} diff --git a/cds-regression-test/test/netconf/kotlin/connect-fail/request-payload.json b/cds-regression-test/test/netconf/kotlin/connect-fail/request-payload.json deleted file mode 100644 index 8cac64a..0000000 --- a/cds-regression-test/test/netconf/kotlin/connect-fail/request-payload.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-netconf", - "blueprintVersion": "1.0.0", - "actionName": "netconf-kotlin" - }, - "payload": { - "netconf-kotlin-request": { - "netconf-host": "127.0.0.1", - "netconf-timeout": 5 - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "regression-test-netconf-kotlin-connect-fail", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/netconf/kotlin/connect-fail/test.sh b/cds-regression-test/test/netconf/kotlin/connect-fail/test.sh deleted file mode 100755 index d30e5ab..0000000 --- a/cds-regression-test/test/netconf/kotlin/connect-fail/test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -CBA_NAME="netconf" -LANG="kotlin" -TEST_NAME="connect-fail" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode 500' -assert_status_code 500 $RESPONSE_HEADERS_FILE - -echo 'Assert connect fail payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/netconf/kotlin/success/expected-response.json b/cds-regression-test/test/netconf/kotlin/success/expected-response.json deleted file mode 100644 index dfb81d7..0000000 --- a/cds-regression-test/test/netconf/kotlin/success/expected-response.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-02-03T13:40:43.697Z", - "originatorId": "System", - "requestId": "regression-test-netconf-kotlin", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-netconf", - "blueprintVersion": "1.0.0", - "actionName": "netconf-kotlin", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-02-03T13:40:51.835Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "netconf-kotlin-response": { - "response-data": { - "deploySuccess": true - } - } - } -} diff --git a/cds-regression-test/test/netconf/kotlin/success/request-payload.json b/cds-regression-test/test/netconf/kotlin/success/request-payload.json deleted file mode 100644 index 412614f..0000000 --- a/cds-regression-test/test/netconf/kotlin/success/request-payload.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-netconf", - "blueprintVersion": "1.0.0", - "actionName": "netconf-kotlin" - }, - "payload": { - "netconf-kotlin-request": { - "netconf-host": "odl-netconf-testtool", - "netconf-timeout": 30 - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "regression-test-netconf-kotlin", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/netconf/kotlin/success/test.sh b/cds-regression-test/test/netconf/kotlin/success/test.sh deleted file mode 100755 index 8de0e6f..0000000 --- a/cds-regression-test/test/netconf/kotlin/success/test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -CBA_NAME="netconf" -LANG="kotlin" -TEST_NAME="success" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/netconf/netconf-enrichment-test.sh b/cds-regression-test/test/netconf/netconf-enrichment-test.sh deleted file mode 100755 index 3c76ce4..0000000 --- a/cds-regression-test/test/netconf/netconf-enrichment-test.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -CBA_NAME="netconf" -TEST_NAME="$CBA_NAME-enrichment" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Compressing CBA: $CBA_NAME" -compress_cba $CBA_NAME - -echo "Enriching CBA: $CBA_NAME" -enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - diff --git a/cds-regression-test/test/netconf/netconf-upload-test.sh b/cds-regression-test/test/netconf/netconf-upload-test.sh deleted file mode 100755 index 933a7b2..0000000 --- a/cds-regression-test/test/netconf/netconf-upload-test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -CBA_NAME="netconf" -TEST_NAME="$CBA_NAME-upload" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Uploading CBA: $CBA_NAME" -upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -# This step prevents a race-condition for parallel process requests -# when cba has not yet been written to filesystem -echo 'Send process request to force CDS to load CBA to filesystem' -process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/cds-regression-test/test/py-executor/connection-fail/expected-response.json b/cds-regression-test/test/py-executor/connection-fail/expected-response.json deleted file mode 100644 index 93b2598..0000000 --- a/cds-regression-test/test/py-executor/connection-fail/expected-response.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-05-19T17:26:02.923Z", - "originatorId": "System", - "requestId": "123456", - "subRequestId": "1234-12234", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-py-executor", - "blueprintVersion": "1.0.0", - "actionName": "connection-fail", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-05-19T17:26:02.926Z", - "errorMessage": "Failed in ComponentRemoteScriptExecutor : UNAVAILABLE: io exception, failed to get execution property(node_templates/execute-connection-fail/attributes/status)", - "message": "failure" - }, - "payload": { - "connection-fail-response": {} - } -} diff --git a/cds-regression-test/test/py-executor/connection-fail/request-payload.json b/cds-regression-test/test/py-executor/connection-fail/request-payload.json deleted file mode 100644 index 7273340..0000000 --- a/cds-regression-test/test/py-executor/connection-fail/request-payload.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "123456", - "subRequestId": "1234-12234" - }, - "actionIdentifiers": { - "blueprintName": "RT-py-executor", - "blueprintVersion": "1.0.0", - "actionName": "connection-fail", - "mode": "sync" - }, - "payload": { - "connection-fail-request": {} - } -} diff --git a/cds-regression-test/test/py-executor/connection-fail/test.sh b/cds-regression-test/test/py-executor/connection-fail/test.sh deleted file mode 100644 index b4b77e6..0000000 --- a/cds-regression-test/test/py-executor/connection-fail/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -CBA_NAME="py-executor" -TEST_NAME="connection-fail" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 500 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/py-executor/dummy-request-payload.json b/cds-regression-test/test/py-executor/dummy-request-payload.json deleted file mode 100644 index 688e5e9..0000000 --- a/cds-regression-test/test/py-executor/dummy-request-payload.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "dummy-request-should-fail", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "dummy", - "mode": "sync" - }, - "payload": {} -} diff --git a/cds-regression-test/test/py-executor/failing-script/expected-response.json b/cds-regression-test/test/py-executor/failing-script/expected-response.json deleted file mode 100644 index 17148b0..0000000 --- a/cds-regression-test/test/py-executor/failing-script/expected-response.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-05-19T17:24:33.353Z", - "originatorId": "System", - "requestId": "123456", - "subRequestId": "1234-12234", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-py-executor", - "blueprintVersion": "1.0.0", - "actionName": "failing-remote-python", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-05-19T17:24:33.370Z", - "errorMessage": "Failed in ComponentRemoteScriptExecutor : UNKNOWN: Exception iterating responses: Script raised an exception, failed to get execution property(node_templates/execute-failing-remote-python/attributes/status)", - "message": "failure" - }, - "payload": { - "failing-remote-python-response": {} - } -} diff --git a/cds-regression-test/test/py-executor/failing-script/request-payload.json b/cds-regression-test/test/py-executor/failing-script/request-payload.json deleted file mode 100644 index bacd876..0000000 --- a/cds-regression-test/test/py-executor/failing-script/request-payload.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "123456", - "subRequestId": "1234-12234" - }, - "actionIdentifiers": { - "blueprintName": "RT-py-executor", - "blueprintVersion": "1.0.0", - "actionName": "failing-remote-python", - "mode": "sync" - }, - "payload": { - "failing-remote-python-request": {} - } -} diff --git a/cds-regression-test/test/py-executor/failing-script/test.sh b/cds-regression-test/test/py-executor/failing-script/test.sh deleted file mode 100644 index 4386e09..0000000 --- a/cds-regression-test/test/py-executor/failing-script/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -CBA_NAME="py-executor" -TEST_NAME="failing-script" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 500 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/py-executor/py-executor-enrichment-test.sh b/cds-regression-test/test/py-executor/py-executor-enrichment-test.sh deleted file mode 100644 index e671787..0000000 --- a/cds-regression-test/test/py-executor/py-executor-enrichment-test.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -## Not tested on El Alto -if [ "${CDS_VERSION} " == "elalto " ]; then - echo "Skipping, not available in elalto" - return 0 -fi - -CBA_NAME="py-executor" -TEST_NAME="$CBA_NAME-enrichment" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Compressing CBA: $CBA_NAME" -compress_cba $CBA_NAME - -echo "Enriching CBA: $CBA_NAME" -enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/cds-regression-test/test/py-executor/py-executor-upload-test.sh b/cds-regression-test/test/py-executor/py-executor-upload-test.sh deleted file mode 100644 index 46402e3..0000000 --- a/cds-regression-test/test/py-executor/py-executor-upload-test.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -## Not tested on El Alto -if [ "${CDS_VERSION} " == "elalto " ]; then - echo "Skipping, not available in elalto" - return 0 -fi - -CBA_NAME="py-executor" -TEST_NAME="$CBA_NAME-upload" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Uploading CBA: $CBA_NAME" -upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -# This step prevents a race-condition for parallel process requests -# when cba has not yet been written to filesystem -echo 'Send process request to force CDS to load CBA to filesystem' -process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/cds-regression-test/test/py-executor/success/expected-response.json b/cds-regression-test/test/py-executor/success/expected-response.json deleted file mode 100644 index 1318508..0000000 --- a/cds-regression-test/test/py-executor/success/expected-response.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-05-26T13:47:27.143Z", - "originatorId": "System", - "requestId": "123456", - "subRequestId": "1234-12234", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-py-executor", - "blueprintVersion": "1.0.0", - "actionName": "remote-python", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-05-26T13:47:27.193Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "remote-python-response": { - "status": "success", - "response-data": { - "HelloWorld-request": { - "hello": "world" - } - } - } - } -} diff --git a/cds-regression-test/test/py-executor/success/request-payload.json b/cds-regression-test/test/py-executor/success/request-payload.json deleted file mode 100644 index f23b0de..0000000 --- a/cds-regression-test/test/py-executor/success/request-payload.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "123456", - "subRequestId": "1234-12234" - }, - "actionIdentifiers": { - "blueprintName": "RT-py-executor", - "blueprintVersion": "1.0.0", - "actionName": "remote-python", - "mode": "sync" - }, - "payload": { - "remote-python-request": {} - } -} diff --git a/cds-regression-test/test/py-executor/success/test.sh b/cds-regression-test/test/py-executor/success/test.sh deleted file mode 100644 index d2d064a..0000000 --- a/cds-regression-test/test/py-executor/success/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -CBA_NAME="py-executor" -TEST_NAME="success" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/remote-ansible/connection-failure/expected-response.json b/cds-regression-test/test/remote-ansible/connection-failure/expected-response.json deleted file mode 100644 index 301e70b..0000000 --- a/cds-regression-test/test/remote-ansible/connection-failure/expected-response.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-05-01T19:38:57.529Z", - "originatorId": "System", - "requestId": "remote-ansible-connection-failure", - "subRequestId": "remote-ansible-connection-failure-1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-ansible", - "blueprintVersion": "1.0.0", - "actionName": "connection-fail", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-05-01T19:38:57.551Z", - "errorMessage": "error : ansible-command-logs : Failed to process on remote executor (Connect to localhost:12345 [localhost/127.0.0.1] failed: Connection refused (Connection refused))", - "message": "failure" - }, - "payload": { - "connection-fail-response": { - "ansible-command-status": "error", - "ansible-command-logs": "Failed to process on remote executor (Connect to localhost:12345 [localhost/127.0.0.1] failed: Connection refused (Connection refused))" - } - } -} diff --git a/cds-regression-test/test/remote-ansible/connection-failure/request-payload.json b/cds-regression-test/test/remote-ansible/connection-failure/request-payload.json deleted file mode 100644 index 08e39c7..0000000 --- a/cds-regression-test/test/remote-ansible/connection-failure/request-payload.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "remote-ansible-connection-failure", - "subRequestId": "remote-ansible-connection-failure-1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-ansible", - "blueprintVersion": "1.0.0", - "actionName": "connection-fail", - "mode": "sync" - }, - "payload": { - "connection-fail-request": { - "endpoint-selector": "awx", - "job-template-name": "hello_world_job_template", - "inventory": "Demo Inventory", - "limit": "123", - "tags": "some-tag", - "skip-tags": "some-skip-tag", - "extra-vars": { - "site_id": "3 - Belmont", - "tor_group": "vEPC" - } - } - } -} diff --git a/cds-regression-test/test/remote-ansible/connection-failure/test.sh b/cds-regression-test/test/remote-ansible/connection-failure/test.sh deleted file mode 100644 index 7c880fe..0000000 --- a/cds-regression-test/test/remote-ansible/connection-failure/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -CBA_NAME="remote-ansible" -TEST_NAME="connection-failure" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 500 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/remote-ansible/dummy-request-payload.json b/cds-regression-test/test/remote-ansible/dummy-request-payload.json deleted file mode 100644 index 5bb8112..0000000 --- a/cds-regression-test/test/remote-ansible/dummy-request-payload.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "dummy-request-should-fail", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-ansible", - "blueprintVersion": "1.0.0", - "actionName": "dummy", - "mode": "sync" - }, - "payload": {} -} diff --git a/cds-regression-test/test/remote-ansible/failure/resources/elalto/expected-response.json b/cds-regression-test/test/remote-ansible/failure/resources/elalto/expected-response.json deleted file mode 100644 index 050e328..0000000 --- a/cds-regression-test/test/remote-ansible/failure/resources/elalto/expected-response.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-05-01T18:55:44.034Z", - "originatorId": "System", - "requestId": "remote-ansible-failure", - "subRequestId": "remote-ansible-failure-1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-ansible", - "blueprintVersion": "1.0.0", - "actionName": "execute-remote-ansible-failure", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-05-01T18:55:44.046Z", - "errorMessage": "error : ansible-command-logs : Failed to process on remote executor (mapper.readTree(response.body) must not be null)", - "message": "failure" - }, - "payload": { - "execute-remote-ansible-failure-response": { - "ansible-command-status": "error", - "ansible-command-logs": "Failed to process on remote executor (mapper.readTree(response.body) must not be null)" - } - } -} diff --git a/cds-regression-test/test/remote-ansible/failure/resources/elalto/request-payload.json b/cds-regression-test/test/remote-ansible/failure/resources/elalto/request-payload.json deleted file mode 100644 index a4589ae..0000000 --- a/cds-regression-test/test/remote-ansible/failure/resources/elalto/request-payload.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "remote-ansible-failure", - "subRequestId": "remote-ansible-failure-1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-ansible", - "blueprintVersion": "1.0.0", - "actionName": "execute-remote-ansible-failure", - "mode": "sync" - }, - "payload": { - "execute-remote-ansible-failure-request": { - "endpoint-selector": "awx", - "job-template-name": "hello_world_job_template", - "inventory": "Demo Inventory", - "limit": "123", - "tags": "some-tag", - "skip-tags": "some-skip-tag", - "extra-vars": { - "site_id": "3 - Belmont", - "tor_group": "vEPC" - } - } - } -} diff --git a/cds-regression-test/test/remote-ansible/failure/resources/frankfurt/expected-response.json b/cds-regression-test/test/remote-ansible/failure/resources/frankfurt/expected-response.json deleted file mode 100644 index 713b934..0000000 --- a/cds-regression-test/test/remote-ansible/failure/resources/frankfurt/expected-response.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-06-02T21:03:35.836Z", - "originatorId": "System", - "requestId": "remote-ansible-failure", - "subRequestId": "remote-ansible-failure-1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-ansible", - "blueprintVersion": "1.0.0", - "actionName": "execute-remote-ansible-failure", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-06-02T21:03:38.655Z", - "errorMessage": "error : ansible-command-logs : Workflow/Job template hello_world_job_template does not exists", - "message": "failure" - }, - "payload": { - "execute-remote-ansible-failure-response": { - "ansible-command-status": "error", - "ansible-command-logs": "Workflow/Job template hello_world_job_template does not exists" - } - } -} diff --git a/cds-regression-test/test/remote-ansible/failure/resources/frankfurt/request-payload.json b/cds-regression-test/test/remote-ansible/failure/resources/frankfurt/request-payload.json deleted file mode 100644 index a4589ae..0000000 --- a/cds-regression-test/test/remote-ansible/failure/resources/frankfurt/request-payload.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "remote-ansible-failure", - "subRequestId": "remote-ansible-failure-1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-ansible", - "blueprintVersion": "1.0.0", - "actionName": "execute-remote-ansible-failure", - "mode": "sync" - }, - "payload": { - "execute-remote-ansible-failure-request": { - "endpoint-selector": "awx", - "job-template-name": "hello_world_job_template", - "inventory": "Demo Inventory", - "limit": "123", - "tags": "some-tag", - "skip-tags": "some-skip-tag", - "extra-vars": { - "site_id": "3 - Belmont", - "tor_group": "vEPC" - } - } - } -} diff --git a/cds-regression-test/test/remote-ansible/failure/test.sh b/cds-regression-test/test/remote-ansible/failure/test.sh deleted file mode 100644 index c044762..0000000 --- a/cds-regression-test/test/remote-ansible/failure/test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -CBA_NAME="remote-ansible" -TEST_NAME="failure" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -RESOURCES_DIR="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/resources/$CDS_VERSION" -REQUEST_PAYLOAD_FILE="$RESOURCES_DIR/request-payload.json" -EXPECTED_PAYLOAD_FILE="$RESOURCES_DIR/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 500 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/remote-ansible/init-mockserver.sh b/cds-regression-test/test/remote-ansible/init-mockserver.sh deleted file mode 100755 index c737b9e..0000000 --- a/cds-regression-test/test/remote-ansible/init-mockserver.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -CBA_NAME="remote-ansible" -DIR_PAYLOADS="$TEST_DIRECTORY/$CBA_NAME/mock-payloads" - -# JOB TEMPLATE -echo "Mocking Job Template route..." -JT_PAYLOAD="job-template.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$JT_PAYLOAD" - -# JOB TEMPLATE ERROR -echo "Mocking Job Template Error route..." -JT_ERR_PAYLOAD="job-template-error.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$JT_ERR_PAYLOAD" - -# JOB TEMPLATE LAUNCH - GET -echo "Mocking Job Template Launch GET route..." -GET_JT_LAUNCH_PAYLOAD="get_job-template-launch.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$GET_JT_LAUNCH_PAYLOAD" - -# JOB TEMPLATE LAUNCH -echo "Mocking Inventory route..." -INVENTORY_PAYLOAD="inventory.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$INVENTORY_PAYLOAD" - -# JOB TEMPLATE LAUNCH - POST -echo "Mocking Job Template Launch POST route..." -POST_JT_LAUNCH_PAYLOAD="post_job-template-launch.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$POST_JT_LAUNCH_PAYLOAD" - -# JOB EXECUTION -echo "Mocking Job Execution route..." -JOB_EXECUTION_PAYLOAD="job-execution.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$JOB_EXECUTION_PAYLOAD" - -# JOB OUTPUT -echo "Mocking Job Output route..." -JOB_OUTPUT_PAYLOAD="job-output.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$JOB_OUTPUT_PAYLOAD" diff --git a/cds-regression-test/test/remote-ansible/mock-payloads/get_job-template-launch.json b/cds-regression-test/test/remote-ansible/mock-payloads/get_job-template-launch.json deleted file mode 100644 index ed7904d..0000000 --- a/cds-regression-test/test/remote-ansible/mock-payloads/get_job-template-launch.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "httpRequest": { - "method": "GET", - "path": "/remote-ansible/success/api/v2/job_templates/123/launch/" - }, - "httpResponse": { - "body": { - "can_start_without_user_input": false, - "passwords_needed_to_start": [], - "ask_variables_on_launch": true, - "ask_tags_on_launch": true, - "ask_diff_mode_on_launch": false, - "ask_skip_tags_on_launch": true, - "ask_job_type_on_launch": false, - "ask_limit_on_launch": true, - "ask_verbosity_on_launch": false, - "ask_inventory_on_launch": true, - "ask_credential_on_launch": true, - "survey_enabled": true, - "variables_needed_to_start": [ - "tor_group", - "site_id" - ], - "credential_needed_to_start": false, - "inventory_needed_to_start": false, - "job_template_data": { - "name": "hello_world_job_template", - "id": "123", - "description": "hello_world Runner Job Template" - }, - "defaults": { - "extra_vars": "", - "diff_mode": false, - "limit": "", - "job_tags": "", - "skip_tags": "", - "job_type": "run", - "verbosity": 0, - "inventory": { - "name": "Demo Inventory", - "id": 1 - } - } - } - } -} diff --git a/cds-regression-test/test/remote-ansible/mock-payloads/inventory.json b/cds-regression-test/test/remote-ansible/mock-payloads/inventory.json deleted file mode 100644 index 165b929..0000000 --- a/cds-regression-test/test/remote-ansible/mock-payloads/inventory.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "httpRequest": { - "method": "GET", - "path": "/remote-ansible/success/api/v2/inventories/" - }, - "httpResponse": { - "body": { - "count": 1, - "next": null, - "previous": null, - "results": [ - { - "id": 1, - "type": "inventory", - "url": "/api/v2/inventories/1/", - "related": { - "created_by": "/api/v2/users/1/", - "modified_by": "/api/v2/users/1/", - "hosts": "/api/v2/inventories/1/hosts/", - "groups": "/api/v2/inventories/1/groups/", - "root_groups": "/api/v2/inventories/1/root_groups/", - "variable_data": "/api/v2/inventories/1/variable_data/", - "script": "/api/v2/inventories/1/script/", - "tree": "/api/v2/inventories/1/tree/", - "inventory_sources": "/api/v2/inventories/1/inventory_sources/", - "update_inventory_sources": "/api/v2/inventories/1/update_inventory_sources/", - "activity_stream": "/api/v2/inventories/1/activity_stream/", - "job_templates": "/api/v2/inventories/1/job_templates/", - "ad_hoc_commands": "/api/v2/inventories/1/ad_hoc_commands/", - "access_list": "/api/v2/inventories/1/access_list/", - "object_roles": "/api/v2/inventories/1/object_roles/", - "instance_groups": "/api/v2/inventories/1/instance_groups/", - "copy": "/api/v2/inventories/1/copy/", - "organization": "/api/v2/organizations/1/" - }, - "summary_fields": { - "organization": { - "id": 1, - "name": "Default", - "description": "" - }, - "created_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "modified_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "object_roles": { - "admin_role": { - "description": "Can manage all aspects of the inventory", - "name": "Admin", - "id": 21 - }, - "update_role": { - "description": "May update project or inventory or group using the configured source update system", - "name": "Update", - "id": 22 - }, - "adhoc_role": { - "description": "May run ad hoc commands on an inventory", - "name": "Ad Hoc", - "id": 23 - }, - "use_role": { - "description": "Can use the inventory in a job template", - "name": "Use", - "id": 24 - }, - "read_role": { - "description": "May view settings for the inventory", - "name": "Read", - "id": 25 - } - }, - "user_capabilities": { - "edit": true, - "delete": true, - "copy": true, - "adhoc": true - } - }, - "created": "2019-05-21T15:45:31.954359Z", - "modified": "2019-05-21T15:45:31.954378Z", - "name": "Demo Inventory", - "description": "", - "organization": 1, - "kind": "", - "host_filter": null, - "variables": "", - "has_active_failures": false, - "total_hosts": 1, - "hosts_with_active_failures": 0, - "total_groups": 0, - "groups_with_active_failures": 0, - "has_inventory_sources": false, - "total_inventory_sources": 0, - "inventory_sources_with_failures": 0, - "insights_credential": null, - "pending_deletion": false - } - ] - } - } -} diff --git a/cds-regression-test/test/remote-ansible/mock-payloads/job-execution.json b/cds-regression-test/test/remote-ansible/mock-payloads/job-execution.json deleted file mode 100644 index e8df26b..0000000 --- a/cds-regression-test/test/remote-ansible/mock-payloads/job-execution.json +++ /dev/null @@ -1,183 +0,0 @@ -{ - "httpRequest": { - "method": "GET", - "path": "/remote-ansible/success/api/v2/jobs/456/" - }, - "httpResponse": { - "body": { - "id": "456", - "type": "job", - "url": "/api/v2/jobs/456/", - "related": { - "created_by": "/api/v2/users/1/", - "labels": "/api/v2/jobs/456/labels/", - "inventory": "/api/v2/inventories/1/", - "project": "/api/v2/projects/8/", - "extra_credentials": "/api/v2/jobs/456/extra_credentials/", - "credentials": "/api/v2/jobs/456/credentials/", - "unified_job_template": "/api/v2/job_templates/123/", - "stdout": "/api/v2/jobs/456/stdout/", - "job_events": "/api/v2/jobs/456/job_events/", - "job_host_summaries": "/api/v2/jobs/456/job_host_summaries/", - "activity_stream": "/api/v2/jobs/456/activity_stream/", - "notifications": "/api/v2/jobs/456/notifications/", - "job_template": "/api/v2/job_templates/123/", - "cancel": "/api/v2/jobs/456/cancel/", - "create_schedule": "/api/v2/jobs/456/create_schedule/", - "relaunch": "/api/v2/jobs/456/relaunch/" - }, - "summary_fields": { - "inventory": { - "id": 1, - "name": "Demo Inventory", - "description": "", - "has_active_failures": false, - "total_hosts": 1, - "hosts_with_active_failures": 0, - "total_groups": 0, - "groups_with_active_failures": 0, - "has_inventory_sources": false, - "total_inventory_sources": 0, - "inventory_sources_with_failures": 0, - "organization_id": 1, - "kind": "" - }, - "project": { - "id": 8, - "name": "cds_playbooks", - "description": "CDS - cds_playbooks Project", - "status": "ok", - "scm_type": "" - }, - "job_template": { - "id": "123", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template" - }, - "unified_job_template": { - "id": "123", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "unified_job_type": "job" - }, - "instance_group": { - "name": "tower", - "id": 1 - }, - "created_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "user_capabilities": { - "delete": true, - "start": true - }, - "labels": { - "count": 0, - "results": [] - }, - "extra_credentials": [], - "credentials": [] - }, - "created": "2019-06-12T11:21:26.891986Z", - "modified": "2019-06-12T11:21:27.355185Z", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "job_type": "run", - "inventory": 1, - "project": 8, - "playbook": "hello_world.yml", - "forks": 0, - "limit": "", - "verbosity": 0, - "extra_vars": "{\"tor_group\": \"vEPC\", \"site_id\": \"3 - Belmont\"}", - "job_tags": "", - "force_handlers": false, - "skip_tags": "", - "start_at_task": "", - "timeout": 0, - "use_fact_cache": false, - "unified_job_template": "123", - "launch_type": "manual", - "status": "successful", - "failed": false, - "started": "2019-06-12T11:21:27.510766Z", - "finished": "2019-06-12T11:21:48.993385Z", - "elapsed": 21.483, - "job_args": "[\"ansible-playbook\", \"-u\", \"root\", \"-i\", \"/tmp/awx_223_ft8hu4p4/tmptmtwllu4\", \"-e\", \"@/tmp/awx_223_ft8hu4p4/env/extravars\", \"hello_world.yml\"]", - "job_cwd": "/var/lib/awx/projects/cds_playbooks_folder", - "job_env": { - "HOSTNAME": "awx", - "LC_ALL": "en_US.UTF-8", - "VIRTUAL_ENV": "/var/lib/awx/venv/ansible", - "PATH": "/var/lib/awx/venv/ansible/bin:/var/lib/awx/venv/awx/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", - "SUPERVISOR_GROUP_NAME": "tower-processes", - "PWD": "/var/lib/awx", - "LANG": "en_US.UTF-8", - "PS1": "(awx) ", - "SUPERVISOR_ENABLED": "1", - "HOME": "/var/lib/awx", - "SHLVL": "2", - "LANGUAGE": "en_US.UTF-8", - "LC_CTYPE": "en_US.UTF-8", - "SUPERVISOR_PROCESS_NAME": "dispatcher", - "SUPERVISOR_SERVER_URL": "unix:///tmp/supervisor.sock", - "DJANGO_SETTINGS_MODULE": "awx.settings.production", - "DJANGO_LIVE_TEST_SERVER_ADDRESS": "localhost:9013-9199", - "TZ": "UTC", - "ANSIBLE_FORCE_COLOR": "True", - "ANSIBLE_HOST_KEY_CHECKING": "False", - "ANSIBLE_INVENTORY_UNPARSED_FAILED": "True", - "ANSIBLE_PARAMIKO_RECORD_HOST_KEYS": "False", - "ANSIBLE_VENV_PATH": "/var/lib/awx/venv/ansible", - "AWX_PRIVATE_DATA_DIR": "/tmp/awx_223_ft8hu4p4", - "PYTHONPATH": "/var/lib/awx/venv/ansible/lib/python2.7/site-packages:/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/lib:", - "JOB_ID": "456", - "INVENTORY_ID": "1", - "PROJECT_REVISION": "", - "ANSIBLE_RETRY_FILES_ENABLED": "False", - "MAX_EVENT_RES": "700000", - "ANSIBLE_CALLBACK_PLUGINS": "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/plugins/callback", - "AWX_HOST": "https://towerhost", - "ANSIBLE_SSH_CONTROL_PATH_DIR": "/tmp/awx_223_ft8hu4p4/cp", - "ANSIBLE_STDOUT_CALLBACK": "awx_display", - "AWX_ISOLATED_DATA_DIR": "/tmp/awx_223_ft8hu4p4/artifacts/456" - }, - "job_explanation": "", - "execution_node": "awx", - "controller_node": "", - "result_traceback": "", - "event_processing_finished": true, - "job_template": "123", - "passwords_needed_to_start": [], - "ask_diff_mode_on_launch": false, - "ask_variables_on_launch": true, - "ask_limit_on_launch": true, - "ask_tags_on_launch": true, - "ask_skip_tags_on_launch": true, - "ask_job_type_on_launch": false, - "ask_verbosity_on_launch": false, - "ask_inventory_on_launch": true, - "ask_credential_on_launch": true, - "allow_simultaneous": false, - "artifacts": {}, - "scm_revision": "", - "instance_group": 1, - "diff_mode": false, - "job_slice_number": 0, - "job_slice_count": 1, - "host_status_counts": { - "ok": 1 - }, - "playbook_counts": { - "play_count": 1, - "task_count": 2 - }, - "custom_virtualenv": "/var/lib/awx/venv/ansible", - "credential": null, - "vault_credential": null - } - } -} diff --git a/cds-regression-test/test/remote-ansible/mock-payloads/job-output.json b/cds-regression-test/test/remote-ansible/mock-payloads/job-output.json deleted file mode 100644 index 4ae2a49..0000000 --- a/cds-regression-test/test/remote-ansible/mock-payloads/job-output.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "httpRequest" : { - "method" : "GET", - "path" : "/remote-ansible/success/api/v2/jobs/456/stdout/" - }, - "httpResponse" : { - "body" : " - - PLAY [Hello World Sample] ****************************************************** - - TASK [Gathering Facts] ********************************************************* - ok: [localhost] - - TASK [Hello Message] *********************************************************** - ok: [localhost] => { - \"msg\": \"Hello World!\" - } - - PLAY RECAP ********************************************************************* - localhost : ok=2 changed=0 unreachable=0 failed=0 - -" - } -} diff --git a/cds-regression-test/test/remote-ansible/mock-payloads/job-template-error.json b/cds-regression-test/test/remote-ansible/mock-payloads/job-template-error.json deleted file mode 100644 index 49a9798..0000000 --- a/cds-regression-test/test/remote-ansible/mock-payloads/job-template-error.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "httpRequest": { - "path": "/remote-ansible/failure/api/v2/job_templates/hello_world_job_template/" - }, - "httpResponse": { - "statusCode": 500 - } -} diff --git a/cds-regression-test/test/remote-ansible/mock-payloads/job-template.json b/cds-regression-test/test/remote-ansible/mock-payloads/job-template.json deleted file mode 100644 index 10552c4..0000000 --- a/cds-regression-test/test/remote-ansible/mock-payloads/job-template.json +++ /dev/null @@ -1,224 +0,0 @@ -{ - "httpRequest": { - "method": "GET", - "path": "/remote-ansible/success/api/v2/job_templates/hello_world_job_template/" - }, - "httpResponse": { - "body": { - "id": "123", - "type": "job_template", - "url": "/api/v2/job_templates/123/", - "related": { - "named_url": "/api/v2/job_templates/hello_world_job_template/", - "created_by": "/api/v2/users/1/", - "modified_by": "/api/v2/users/1/", - "labels": "/api/v2/job_templates/123/labels/", - "inventory": "/api/v2/inventories/1/", - "project": "/api/v2/projects/8/", - "extra_credentials": "/api/v2/job_templates/123/extra_credentials/", - "credentials": "/api/v2/job_templates/123/credentials/", - "last_job": "/api/v2/jobs/222/", - "jobs": "/api/v2/job_templates/123/jobs/", - "schedules": "/api/v2/job_templates/123/schedules/", - "activity_stream": "/api/v2/job_templates/123/activity_stream/", - "launch": "/api/v2/job_templates/123/launch/", - "notification_templates_any": "/api/v2/job_templates/123/notification_templates_any/", - "notification_templates_success": "/api/v2/job_templates/123/notification_templates_success/", - "notification_templates_error": "/api/v2/job_templates/123/notification_templates_error/", - "access_list": "/api/v2/job_templates/123/access_list/", - "survey_spec": "/api/v2/job_templates/123/survey_spec/", - "object_roles": "/api/v2/job_templates/123/object_roles/", - "instance_groups": "/api/v2/job_templates/123/instance_groups/", - "slice_workflow_jobs": "/api/v2/job_templates/123/slice_workflow_jobs/", - "copy": "/api/v2/job_templates/123/copy/" - }, - "summary_fields": { - "inventory": { - "id": 1, - "name": "Demo Inventory", - "description": "", - "has_active_failures": false, - "total_hosts": 1, - "hosts_with_active_failures": 0, - "total_groups": 0, - "groups_with_active_failures": 0, - "has_inventory_sources": false, - "total_inventory_sources": 0, - "inventory_sources_with_failures": 0, - "organization_id": 1, - "kind": "" - }, - "project": { - "id": 8, - "name": "cds_playbooks", - "description": "CDS - cds_playbooks Project", - "status": "ok", - "scm_type": "" - }, - "last_job": { - "id": 222, - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "finished": "2019-06-12T11:20:27.892787Z", - "status": "successful", - "failed": false - }, - "last_update": { - "id": 222, - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "status": "successful", - "failed": false - }, - "created_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "modified_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "object_roles": { - "admin_role": { - "description": "Can manage all aspects of the job template", - "name": "Admin", - "id": 51 - }, - "execute_role": { - "description": "May run the job template", - "name": "Execute", - "id": 52 - }, - "read_role": { - "description": "May view settings for the job template", - "name": "Read", - "id": 53 - } - }, - "user_capabilities": { - "edit": true, - "delete": true, - "start": true, - "schedule": true, - "copy": true - }, - "labels": { - "count": 0, - "results": [] - }, - "survey": { - "title": "", - "description": "" - }, - "recent_jobs": [ - { - "id": 222, - "status": "successful", - "finished": "2019-06-12T11:20:27.892787Z", - "type": "job" - }, - { - "id": 65, - "status": "successful", - "finished": "2019-06-03T18:27:19.114796Z", - "type": "job" - }, - { - "id": 64, - "status": "successful", - "finished": "2019-06-03T18:26:53.606618Z", - "type": "job" - }, - { - "id": 63, - "status": "successful", - "finished": "2019-06-03T18:24:36.072943Z", - "type": "job" - }, - { - "id": 62, - "status": "successful", - "finished": "2019-06-03T18:17:50.616528Z", - "type": "job" - }, - { - "id": 61, - "status": "successful", - "finished": "2019-06-03T18:04:42.995611Z", - "type": "job" - }, - { - "id": 60, - "status": "successful", - "finished": "2019-06-03T17:47:13.983951Z", - "type": "job" - }, - { - "id": 50, - "status": "successful", - "finished": "2019-05-30T15:47:55.700161Z", - "type": "job" - }, - { - "id": 49, - "status": "successful", - "finished": "2019-05-29T14:46:51.615926Z", - "type": "job" - }, - { - "id": 47, - "status": "successful", - "finished": "2019-05-27T20:23:58.656709Z", - "type": "job" - } - ], - "extra_credentials": [], - "credentials": [] - }, - "created": "2019-05-21T19:28:05.953730Z", - "modified": "2019-05-21T20:06:55.728697Z", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "job_type": "run", - "inventory": 1, - "project": 8, - "playbook": "hello_world.yml", - "forks": 0, - "limit": "", - "verbosity": 0, - "extra_vars": "", - "job_tags": "", - "force_handlers": false, - "skip_tags": "", - "start_at_task": "", - "timeout": 0, - "use_fact_cache": false, - "last_job_run": "2019-06-12T11:20:27.892787Z", - "last_job_failed": false, - "next_job_run": null, - "status": "successful", - "host_config_key": "", - "ask_diff_mode_on_launch": false, - "ask_variables_on_launch": true, - "ask_limit_on_launch": true, - "ask_tags_on_launch": true, - "ask_skip_tags_on_launch": true, - "ask_job_type_on_launch": false, - "ask_verbosity_on_launch": false, - "ask_inventory_on_launch": true, - "ask_credential_on_launch": true, - "survey_enabled": true, - "become_enabled": false, - "diff_mode": false, - "allow_simultaneous": false, - "custom_virtualenv": null, - "job_slice_count": 1, - "credential": null, - "vault_credential": null - } - } -} diff --git a/cds-regression-test/test/remote-ansible/mock-payloads/post_job-template-launch.json b/cds-regression-test/test/remote-ansible/mock-payloads/post_job-template-launch.json deleted file mode 100644 index 8484374..0000000 --- a/cds-regression-test/test/remote-ansible/mock-payloads/post_job-template-launch.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "httpRequest": { - "method": "POST", - "path": "/remote-ansible/success/api/v2/job_templates/123/launch/" - }, - "httpResponse": { - "body": { - "job": "456", - "ignored_fields": {}, - "id": "456", - "type": "job", - "url": "/api/v2/jobs/456/", - "related": { - "created_by": "/api/v2/users/1/", - "modified_by": "/api/v2/users/1/", - "labels": "/api/v2/jobs/456/labels/", - "inventory": "/api/v2/inventories/1/", - "project": "/api/v2/projects/8/", - "extra_credentials": "/api/v2/jobs/456/extra_credentials/", - "credentials": "/api/v2/jobs/456/credentials/", - "unified_job_template": "/api/v2/job_templates/123/", - "stdout": "/api/v2/jobs/456/stdout/", - "job_events": "/api/v2/jobs/456/job_events/", - "job_host_summaries": "/api/v2/jobs/456/job_host_summaries/", - "activity_stream": "/api/v2/jobs/456/activity_stream/", - "notifications": "/api/v2/jobs/456/notifications/", - "job_template": "/api/v2/job_templates/123/", - "cancel": "/api/v2/jobs/456/cancel/", - "create_schedule": "/api/v2/jobs/456/create_schedule/", - "relaunch": "/api/v2/jobs/456/relaunch/" - }, - "summary_fields": { - "inventory": { - "id": 1, - "name": "Demo Inventory", - "description": "", - "has_active_failures": false, - "total_hosts": 1, - "hosts_with_active_failures": 0, - "total_groups": 0, - "groups_with_active_failures": 0, - "has_inventory_sources": false, - "total_inventory_sources": 0, - "inventory_sources_with_failures": 0, - "organization_id": 1, - "kind": "" - }, - "project": { - "id": 8, - "name": "cds_playbooks", - "description": "CDS - cds_playbooks Project", - "status": "ok", - "scm_type": "" - }, - "job_template": { - "id": "123", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template" - }, - "unified_job_template": { - "id": "123", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "unified_job_type": "job" - }, - "created_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "modified_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "user_capabilities": { - "delete": true, - "start": true - }, - "labels": { - "count": 0, - "results": [] - }, - "extra_credentials": [], - "credentials": [] - }, - "created": "2019-06-12T11:21:26.891986Z", - "modified": "2019-06-12T11:21:27.016410Z", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "job_type": "run", - "inventory": 1, - "project": 8, - "playbook": "hello_world.yml", - "forks": 0, - "limit": "", - "verbosity": 0, - "extra_vars": "{\"tor_group\": \"vEPC\", \"site_id\": \"3 - Belmont\"}", - "job_tags": "", - "force_handlers": false, - "skip_tags": "", - "start_at_task": "", - "timeout": 0, - "use_fact_cache": false, - "unified_job_template": "123", - "launch_type": "manual", - "status": "pending", - "failed": false, - "started": null, - "finished": null, - "elapsed": 0, - "job_args": "", - "job_cwd": "", - "job_env": {}, - "job_explanation": "", - "execution_node": "", - "controller_node": "", - "result_traceback": "", - "event_processing_finished": false, - "job_template": "123", - "passwords_needed_to_start": [], - "ask_diff_mode_on_launch": false, - "ask_variables_on_launch": true, - "ask_limit_on_launch": true, - "ask_tags_on_launch": true, - "ask_skip_tags_on_launch": true, - "ask_job_type_on_launch": false, - "ask_verbosity_on_launch": false, - "ask_inventory_on_launch": true, - "ask_credential_on_launch": true, - "allow_simultaneous": false, - "artifacts": {}, - "scm_revision": "", - "instance_group": null, - "diff_mode": false, - "job_slice_number": 0, - "job_slice_count": 1, - "credential": null, - "vault_credential": null - } - } -} diff --git a/cds-regression-test/test/remote-ansible/remote-ansible-enrichment-test.sh b/cds-regression-test/test/remote-ansible/remote-ansible-enrichment-test.sh deleted file mode 100755 index 9e4de45..0000000 --- a/cds-regression-test/test/remote-ansible/remote-ansible-enrichment-test.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -CBA_NAME="remote-ansible" -TEST_NAME="$CBA_NAME-enrichment" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Compressing CBA: $CBA_NAME" -compress_cba $CBA_NAME - -echo "Enriching CBA: $CBA_NAME" -enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/cds-regression-test/test/remote-ansible/remote-ansible-upload-test.sh b/cds-regression-test/test/remote-ansible/remote-ansible-upload-test.sh deleted file mode 100755 index 334b9b9..0000000 --- a/cds-regression-test/test/remote-ansible/remote-ansible-upload-test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -CBA_NAME="remote-ansible" -TEST_NAME="$CBA_NAME-upload" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Uploading CBA: $CBA_NAME" -upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -# This step prevents a race-condition for parallel process requests -# when cba has not yet been written to filesystem -echo 'Send process request to force CDS to load CBA to filesystem' -process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/cds-regression-test/test/remote-ansible/success/expected-response.json b/cds-regression-test/test/remote-ansible/success/expected-response.json deleted file mode 100644 index 9dce094..0000000 --- a/cds-regression-test/test/remote-ansible/success/expected-response.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-06-03T16:20:03.527Z", - "originatorId": "System", - "requestId": "remote-ansible-success", - "subRequestId": "remote-ansible-success-1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-ansible", - "blueprintVersion": "1.0.0", - "actionName": "execute-remote-ansible-success", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-06-03T16:20:18.859Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "execute-remote-ansible-success-response": { - "ansible-command-status": "successful", - "ansible-command-logs": "Output for Job 456 :\n PLAY [Hello World Sample] ****************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Hello Message] *********************************************************** ok: [localhost] => { \"msg\": \"Hello World!\" } PLAY RECAP ********************************************************************* localhost : ok=2 changed=0 unreachable=0 failed=0\n" - } - } -} diff --git a/cds-regression-test/test/remote-ansible/success/request-payload.json b/cds-regression-test/test/remote-ansible/success/request-payload.json deleted file mode 100644 index 3718c4d..0000000 --- a/cds-regression-test/test/remote-ansible/success/request-payload.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "remote-ansible-success", - "subRequestId": "remote-ansible-success-1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-ansible", - "blueprintVersion": "1.0.0", - "actionName": "execute-remote-ansible-success", - "mode": "sync" - }, - "payload": { - "execute-remote-ansible-success-request": { - "endpoint-selector": "awx", - "job-template-name": "hello_world_job_template", - "inventory": "Demo Inventory", - "limit": "123", - "tags": "some-tag", - "skip-tags": "some-skip-tag", - "extra-vars": { - "site_id": "3 - Belmont", - "tor_group": "vEPC" - } - } - } -} diff --git a/cds-regression-test/test/remote-ansible/success/test.sh b/cds-regression-test/test/remote-ansible/success/test.sh deleted file mode 100644 index eab16ca..0000000 --- a/cds-regression-test/test/remote-ansible/success/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -CBA_NAME="remote-ansible" -TEST_NAME="success" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code_versioned 200 $RESPONSE_HEADERS_FILE $RESPONSE_PAYLOAD_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/remote-python/connection-fail/resources/elalto/expected-response.json b/cds-regression-test/test/remote-python/connection-fail/resources/elalto/expected-response.json deleted file mode 100644 index 2ab445b..0000000 --- a/cds-regression-test/test/remote-python/connection-fail/resources/elalto/expected-response.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "correlationUUID": "9f53fea6-c288-4d19-8d85-93832294f21a", - "commonHeader": { - "timestamp": "2020-07-20T18:15:21.593Z", - "originatorId": "System", - "requestId": "remote-python-connection-fail", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "connection-fail", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-07-20T18:15:22.846Z", - "errorMessage": "FAILURE : prepare-env : Command failed during env. preparation... timeout(120) requestId (remote-python-connection-fail). grpcError: (Connection refused: /127.0.0.1:4242)", - "message": "failure" - }, - "payload": { - "connection-fail-response": { - "execute-command-payload": "", - "execute-command-logs": "" - } - } -} diff --git a/cds-regression-test/test/remote-python/connection-fail/resources/elalto/request-payload.json b/cds-regression-test/test/remote-python/connection-fail/resources/elalto/request-payload.json deleted file mode 100644 index 4bcf8e2..0000000 --- a/cds-regression-test/test/remote-python/connection-fail/resources/elalto/request-payload.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "remote-python-connection-fail", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "connection-fail", - "mode": "sync" - }, - "payload": { - "connection-fail-request": {} - } -} diff --git a/cds-regression-test/test/remote-python/connection-fail/resources/frankfurt/expected-response.json b/cds-regression-test/test/remote-python/connection-fail/resources/frankfurt/expected-response.json deleted file mode 100644 index c9b15bd..0000000 --- a/cds-regression-test/test/remote-python/connection-fail/resources/frankfurt/expected-response.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-06-09T21:02:52.783Z", - "originatorId": "System", - "requestId": "remote-python-connection-fail", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "connection-fail", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-06-09T21:02:53.142Z", - "errorMessage": "FAILURE : prepare-env : Command failed during env. preparation... timeout(120) requestId (remote-python-connection-fail). grpcError: (finishConnect(..) failed: Connection refused: /127.0.0.1:4242)", - "message": "failure" - }, - "payload": { - "connection-fail-response": { - "execute-command-logs": "[]", - "execute-command-payload": "{}" - } - } -} diff --git a/cds-regression-test/test/remote-python/connection-fail/resources/frankfurt/request-payload.json b/cds-regression-test/test/remote-python/connection-fail/resources/frankfurt/request-payload.json deleted file mode 100644 index 4bcf8e2..0000000 --- a/cds-regression-test/test/remote-python/connection-fail/resources/frankfurt/request-payload.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "remote-python-connection-fail", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "connection-fail", - "mode": "sync" - }, - "payload": { - "connection-fail-request": {} - } -} diff --git a/cds-regression-test/test/remote-python/connection-fail/test.sh b/cds-regression-test/test/remote-python/connection-fail/test.sh deleted file mode 100644 index 4d3a38f..0000000 --- a/cds-regression-test/test/remote-python/connection-fail/test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -CBA_NAME="remote-python" -TEST_NAME="connection-fail" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -RESOURCES_DIR="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/resources/$CDS_VERSION" -REQUEST_PAYLOAD_FILE="$RESOURCES_DIR/request-payload.json" -EXPECTED_PAYLOAD_FILE="$RESOURCES_DIR/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 500 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/remote-python/dummy-request-payload.json b/cds-regression-test/test/remote-python/dummy-request-payload.json deleted file mode 100644 index 688e5e9..0000000 --- a/cds-regression-test/test/remote-python/dummy-request-payload.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "dummy-request-should-fail", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "dummy", - "mode": "sync" - }, - "payload": {} -} diff --git a/cds-regression-test/test/remote-python/failing-script/expected-response.json b/cds-regression-test/test/remote-python/failing-script/expected-response.json deleted file mode 100644 index 119b135..0000000 --- a/cds-regression-test/test/remote-python/failing-script/expected-response.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "correlationUUID": "0ae1f48a-ec91-4573-af76-070ec42e2cdd", - "commonHeader": { - "timestamp": "2020-07-02T23:46:04.959Z", - "originatorId": "System", - "requestId": "remote-python-failing-script", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "failing-remote-python", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-07-02T23:46:22.167Z", - "errorMessage": "FAILURE : execute-command : [\"Intentionally raised exception!\"]", - "message": "failure" - }, - "payload": { - "failing-remote-python-response": { - "execute-command-payload": { - "errorMessage": "Intentionally raised exception!" - }, - "execute-command-logs": [ - "Intentionally raised exception!" - ] - } - } -} diff --git a/cds-regression-test/test/remote-python/failing-script/request-payload.json b/cds-regression-test/test/remote-python/failing-script/request-payload.json deleted file mode 100644 index d4c612c..0000000 --- a/cds-regression-test/test/remote-python/failing-script/request-payload.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "remote-python-failing-script", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "failing-remote-python", - "mode": "sync" - }, - "payload": { - "failing-remote-python-request": {} - } -} diff --git a/cds-regression-test/test/remote-python/failing-script/test.sh b/cds-regression-test/test/remote-python/failing-script/test.sh deleted file mode 100755 index 1c394a3..0000000 --- a/cds-regression-test/test/remote-python/failing-script/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -CBA_NAME="remote-python" -TEST_NAME="failing-script" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 500 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/remote-python/remote-python-enrichment-test.sh b/cds-regression-test/test/remote-python/remote-python-enrichment-test.sh deleted file mode 100755 index e2344bd..0000000 --- a/cds-regression-test/test/remote-python/remote-python-enrichment-test.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -CBA_NAME="remote-python" -TEST_NAME="$CBA_NAME-enrichment" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Compressing CBA: $CBA_NAME" -compress_cba $CBA_NAME - -echo "Enriching CBA: $CBA_NAME" -enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/cds-regression-test/test/remote-python/remote-python-upload-test.sh b/cds-regression-test/test/remote-python/remote-python-upload-test.sh deleted file mode 100755 index f62490c..0000000 --- a/cds-regression-test/test/remote-python/remote-python-upload-test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -CBA_NAME="remote-python" -TEST_NAME="$CBA_NAME-upload" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Uploading CBA: $CBA_NAME" -upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -# This step prevents a race-condition for parallel process requests -# when cba has not yet been written to filesystem -echo 'Send process request to force CDS to load CBA to filesystem' -process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/cds-regression-test/test/remote-python/success/expected-response.json b/cds-regression-test/test/remote-python/success/expected-response.json deleted file mode 100644 index 8b0149f..0000000 --- a/cds-regression-test/test/remote-python/success/expected-response.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "correlationUUID": "9acac95d-9b17-4224-9fe1-0cdb652d027c", - "commonHeader": { - "timestamp": "2020-07-02T22:52:50.662Z", - "originatorId": "System", - "requestId": "remote-python-request", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "remote-python", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-07-02T22:53:05.357Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "remote-python-response": { - "execute-command-payload": { - "abc": [ - "xyz", - "qqq" - ] - }, - "execute-command-logs": [ - "remote executor regression" - ] - } - } -} diff --git a/cds-regression-test/test/remote-python/success/request-payload.json b/cds-regression-test/test/remote-python/success/request-payload.json deleted file mode 100644 index b3b9be8..0000000 --- a/cds-regression-test/test/remote-python/success/request-payload.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "remote-python-request", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "remote-python", - "mode": "sync" - }, - "payload": { - "remote-python-request": {} - } -} diff --git a/cds-regression-test/test/remote-python/success/test.sh b/cds-regression-test/test/remote-python/success/test.sh deleted file mode 100755 index 1afabbb..0000000 --- a/cds-regression-test/test/remote-python/success/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -CBA_NAME="remote-python" -TEST_NAME="success" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/reset-verify-mockserver.sh b/cds-regression-test/test/reset-verify-mockserver.sh deleted file mode 100644 index 8b3ecf6..0000000 --- a/cds-regression-test/test/reset-verify-mockserver.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/reset-mockserver-$TEST_NUMBER-response-headers" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Reset mockserver - $TEST_NUMBER" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/reset" > /dev/null 2> $RESPONSE_HEADERS_FILE -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/cds-regression-test/test/resource-resolution/data-dict/RT-db.json b/cds-regression-test/test/resource-resolution/data-dict/RT-db.json deleted file mode 100644 index d8e1daf..0000000 --- a/cds-regression-test/test/resource-resolution/data-dict/RT-db.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "RT-db", - "data_type": "string", - "description": "DB request for regression test", - "tags": "datetime", - "updatedBy": "Selfish", - "definition": { - "name": "RT-db", - "tags": "RT-db", - "updated-by": "Selffish", - "property": { - "description": "DB request for regression test", - "type": "string" - }, - "sources": { - "processor-db": { - "type": "source-db", - "properties": { - "endpoint-selector": "db-endpoint", - "type": "SQL", - "query": "select sdnctl.RESOURCE_RESOLUTION.value from sdnctl.RESOURCE_RESOLUTION where value='ok'", - "input-key-mapping": {}, - "output-key-mapping": { - "value": "value" - } - } - } - } - } -} diff --git a/cds-regression-test/test/resource-resolution/data-dict/RT-kotlin.json b/cds-regression-test/test/resource-resolution/data-dict/RT-kotlin.json deleted file mode 100644 index c521792..0000000 --- a/cds-regression-test/test/resource-resolution/data-dict/RT-kotlin.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "kotlin-script", - "data_type": "string", - "description": "Kotlin script used to read properties.", - "tags": "kotlin-script", - "updatedBy": "Self-fish", - "definition": { - "name": "kotlin-script", - "updated-by": "Selffish", - "tags": "properties-capability-source", - "property": { - "description": "Kotlin script used to read properties.", - "type": "string" - }, - "sources": { - "capability": { - "type": "source-capability", - "properties": { - "script-type": "kotlin", - "script-class-reference": "cba.cds.RT.ResolvPropertiesKt", - "instance-dependencies": [] - } - } - } - } -} diff --git a/cds-regression-test/test/resource-resolution/data-dict/RT-rest-delete.json b/cds-regression-test/test/resource-resolution/data-dict/RT-rest-delete.json deleted file mode 100644 index c1cef3b..0000000 --- a/cds-regression-test/test/resource-resolution/data-dict/RT-rest-delete.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "RT-rest-delete", - "data_type": "string", - "description": "Rest DELETE request for regression test", - "tags": "RT-rest-delete", - "updatedBy": "Selfish", - "definition": { - "name": "RT-rest-delete", - "tags": "RT-rest-delete", - "updated-by": "Selffish", - "property": { - "description": "Rest DELETE request for regression test", - "type": "string" - }, - "sources": { - "sdnc": { - "type": "source-rest", - "properties": { - "type": "string", - "verb": "DELETE", - "url-path": "/delete", - "endpoint-selector": "rest-endpoint", - "path": "", - "input-key-mapping": {}, - "output-key-mapping": { - "value": "value" - } - } - } - } - } -} diff --git a/cds-regression-test/test/resource-resolution/data-dict/RT-rest-get.json b/cds-regression-test/test/resource-resolution/data-dict/RT-rest-get.json deleted file mode 100644 index 210ac27..0000000 --- a/cds-regression-test/test/resource-resolution/data-dict/RT-rest-get.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "RT-rest-get", - "data_type": "string", - "description": "Rest GET request for regression test", - "tags": "RT-rest-get", - "updatedBy": "Selfish", - "definition": { - "name": "RT-rest-get", - "tags": "RT-rest-get", - "updated-by": "Selffish", - "property": { - "description": "Rest GET request for regression test", - "type": "string" - }, - "sources": { - "sdnc": { - "type": "source-rest", - "properties": { - "type": "string", - "verb": "GET", - "url-path": "/get", - "endpoint-selector": "rest-endpoint", - "path": "", - "input-key-mapping": {}, - "output-key-mapping": { - "value": "value" - } - } - } - } - } -} diff --git a/cds-regression-test/test/resource-resolution/data-dict/RT-rest-patch.json b/cds-regression-test/test/resource-resolution/data-dict/RT-rest-patch.json deleted file mode 100644 index 41f94da..0000000 --- a/cds-regression-test/test/resource-resolution/data-dict/RT-rest-patch.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "RT-rest-patch", - "data_type": "string", - "description": "Rest PATCH request for regression test", - "tags": "RT-rest-patch", - "updatedBy": "Selfish", - "definition": { - "name": "RT-rest-patch", - "tags": "RT-rest-patch", - "updated-by": "Selffish", - "property": { - "description": "Rest PATCH request for regression test", - "type": "string" - }, - "sources": { - "sdnc": { - "type": "source-rest", - "properties": { - "type": "string", - "verb": "PATCH", - "url-path": "/patch", - "endpoint-selector": "rest-endpoint", - "path": "", - "input-key-mapping": {}, - "output-key-mapping": { - "value": "value" - } - } - } - } - } -} diff --git a/cds-regression-test/test/resource-resolution/data-dict/RT-rest-post.json b/cds-regression-test/test/resource-resolution/data-dict/RT-rest-post.json deleted file mode 100644 index 63721bb..0000000 --- a/cds-regression-test/test/resource-resolution/data-dict/RT-rest-post.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "RT-rest-post", - "data_type": "string", - "description": "Rest POST request for regression test", - "tags": "RT-rest-post", - "updatedBy": "Selfish", - "definition": { - "name": "RT-rest-post", - "tags": "RT-rest-post", - "updated-by": "Selffish", - "property": { - "description": "Rest POST request for regression test", - "type": "string" - }, - "sources": { - "sdnc": { - "type": "source-rest", - "properties": { - "type": "string", - "verb": "POST", - "url-path": "/post", - "endpoint-selector": "rest-endpoint", - "path": "", - "input-key-mapping": {}, - "output-key-mapping": { - "value": "value" - } - } - } - } - } -} diff --git a/cds-regression-test/test/resource-resolution/data-dict/RT-rest-put.json b/cds-regression-test/test/resource-resolution/data-dict/RT-rest-put.json deleted file mode 100644 index cf165d3..0000000 --- a/cds-regression-test/test/resource-resolution/data-dict/RT-rest-put.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "RT-rest-put", - "data_type": "string", - "description": "Rest PUT request for regression test", - "tags": "RT-rest-put", - "updatedBy": "Selfish", - "definition": { - "name": "RT-rest-put", - "tags": "RT-rest-put", - "updated-by": "Selffish", - "property": { - "description": "Rest PUT request for regression test", - "type": "string" - }, - "sources": { - "sdnc": { - "type": "source-rest", - "properties": { - "type": "string", - "verb": "PUT", - "url-path": "/put", - "endpoint-selector": "rest-endpoint", - "path": "", - "input-key-mapping": {}, - "output-key-mapping": { - "value": "value" - } - } - } - } - } -} diff --git a/cds-regression-test/test/resource-resolution/dummy-request-payload.json b/cds-regression-test/test/resource-resolution/dummy-request-payload.json deleted file mode 100644 index 60b3442..0000000 --- a/cds-regression-test/test/resource-resolution/dummy-request-payload.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "dummy-request-should-fail", - "subRequestId": "11" - }, - "actionIdentifiers": { - "blueprintName": "RT-resource-resolution", - "blueprintVersion": "1.0.0", - "actionName": "dummy", - "mode": "sync" - }, - "payload": {} -} diff --git a/cds-regression-test/test/resource-resolution/force-resolution/expected-payloads/expected-response-1.json b/cds-regression-test/test/resource-resolution/force-resolution/expected-payloads/expected-response-1.json deleted file mode 100644 index efb6282..0000000 --- a/cds-regression-test/test/resource-resolution/force-resolution/expected-payloads/expected-response-1.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-05-07T22:18:06.901Z", - "originatorId": "System", - "requestId": "1234", - "subRequestId": "1234-12234", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-resource-resolution", - "blueprintVersion": "1.0.0", - "actionName": "resource-resolution", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-05-07T22:18:22.289Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "resource-resolution-response": { - "meshed-template": { - "helloworld-velocity": "{\n \"default\": \"ok\",\n \"input\": \"ok\",\n \"script\": {\n \"python\": \"ok\",\n \"kotlin\": \"ok\"\n },\n \"db\": \"ok\",\n \"rest\": {\n \"GET\": \"get:ok\",\n \"POST\": \"post:ok\",\n \"PUT\": \"put:ok\",\n \"PATCH\": \"patch:ok\",\n \"DELETE\": \"delete:ok\"\n }\n}\n", - "helloworld-jinja": "{\n \"default\": \"ok\",\n \"input\": \"ok\",\n \"script\": {\n \"python\": \"ok\",\n \"kotlin\": {\n \"base\": \"ok\"\n \"from suspend function\": \"ok\"\n }\n },\n \"db\": \"ok\",\n \"rest\": {\n \"GET\": \"get:ok\",\n \"POST\": \"post:ok\",\n \"PUT\": \"put:ok\",\n \"PATCH\": \"patch:ok\",\n \"DELETE\": \"delete:ok\"\n }\n}\n" - } - } - } -} diff --git a/cds-regression-test/test/resource-resolution/force-resolution/expected-payloads/expected-response-2.json b/cds-regression-test/test/resource-resolution/force-resolution/expected-payloads/expected-response-2.json deleted file mode 100644 index 5d52426..0000000 --- a/cds-regression-test/test/resource-resolution/force-resolution/expected-payloads/expected-response-2.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-05-07T22:18:06.901Z", - "originatorId": "System", - "requestId": "1234", - "subRequestId": "1234-12234", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-resource-resolution", - "blueprintVersion": "1.0.0", - "actionName": "resource-resolution", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-05-07T22:18:22.289Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "resource-resolution-response": { - "meshed-template": { - "helloworld-velocity": "{\n \"default\": \"ok\",\n \"input\": \"ok-ok\",\n \"script\": {\n \"python\": \"ok\",\n \"kotlin\": \"ok\"\n },\n \"db\": \"ok\",\n \"rest\": {\n \"GET\": \"get:ok\",\n \"POST\": \"post:ok\",\n \"PUT\": \"put:ok\",\n \"PATCH\": \"patch:ok\",\n \"DELETE\": \"delete:ok\"\n }\n}\n", - "helloworld-jinja": "{\n \"default\": \"ok\",\n \"input\": \"ok-ok\",\n \"script\": {\n \"python\": \"ok\",\n \"kotlin\": {\n \"base\": \"ok\"\n \"from suspend function\": \"ok\"\n }\n },\n \"db\": \"ok\",\n \"rest\": {\n \"GET\": \"get:ok\",\n \"POST\": \"post:ok\",\n \"PUT\": \"put:ok\",\n \"PATCH\": \"patch:ok\",\n \"DELETE\": \"delete:ok\"\n }\n}\n" - } - } - } -} diff --git a/cds-regression-test/test/resource-resolution/force-resolution/request-payloads/request-payload-1.json b/cds-regression-test/test/resource-resolution/force-resolution/request-payloads/request-payload-1.json deleted file mode 100644 index 91e4612..0000000 --- a/cds-regression-test/test/resource-resolution/force-resolution/request-payloads/request-payload-1.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "1234", - "subRequestId": "1234-12234" - }, - "actionIdentifiers": { - "blueprintName": "RT-resource-resolution", - "blueprintVersion": "1.0.0", - "actionName": "resource-resolution", - "mode": "sync" - }, - "payload": { - "resource-resolution-request": { - "template-prefix": [ - "helloworld-velocity", - "helloworld-jinja" - ], - "resolution-key": "regression-test", - "resource-resolution-properties": { - "v_input": "ok", - "j_input": "ok" - } - } - } -} diff --git a/cds-regression-test/test/resource-resolution/force-resolution/request-payloads/request-payload-2.json b/cds-regression-test/test/resource-resolution/force-resolution/request-payloads/request-payload-2.json deleted file mode 100644 index de8a797..0000000 --- a/cds-regression-test/test/resource-resolution/force-resolution/request-payloads/request-payload-2.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "1234", - "subRequestId": "1234-12234" - }, - "actionIdentifiers": { - "blueprintName": "RT-resource-resolution", - "blueprintVersion": "1.0.0", - "actionName": "resource-resolution", - "mode": "sync" - }, - "payload": { - "resource-resolution-request": { - "template-prefix": [ - "helloworld-velocity", - "helloworld-jinja" - ], - "resolution-key": "regression-test", - "resource-resolution-properties": { - "v_input": "ok-ok", - "j_input": "ok-ok" - } - } - } -} diff --git a/cds-regression-test/test/resource-resolution/force-resolution/test.sh b/cds-regression-test/test/resource-resolution/force-resolution/test.sh deleted file mode 100644 index 013df7e..0000000 --- a/cds-regression-test/test/resource-resolution/force-resolution/test.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -CBA_NAME="resource-resolution" -TEST_NAME="force-resolution" -TEST_NUMBER=$RANDOM - -REQUEST_PAYLOAD_DIR="request-payloads" -EXPECTED_PAYLOAD_DIR="expected-payloads" - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE_1="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers-1" -RESPONSE_PAYLOAD_FILE_1="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-1" -REQUEST_PAYLOAD_FILE_1="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/$REQUEST_PAYLOAD_DIR/request-payload-1.json" -EXPECTED_PAYLOAD_FILE_1="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/$EXPECTED_PAYLOAD_DIR/expected-response-1.json" - -RESPONSE_HEADERS_FILE_2="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers-2" -RESPONSE_PAYLOAD_FILE_2="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-2" -REQUEST_PAYLOAD_FILE_2="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/$REQUEST_PAYLOAD_DIR/request-payload-2.json" -EXPECTED_PAYLOAD_FILE_2="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/$EXPECTED_PAYLOAD_DIR/expected-response-2.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" -echo "Running initial ressource-resolution to resolve template..." -process_cba $REQUEST_PAYLOAD_FILE_1 $RESPONSE_PAYLOAD_FILE_1 $RESPONSE_HEADERS_FILE_1 - -echo 'Assert statuscode' -assert_status_code 200 $RESPONSE_HEADERS_FILE_1 - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE_1 $RESPONSE_PAYLOAD_FILE_1 - - -# Verify force-resolution -## Same resolution-key, different input values from above test. -## Force-resolution is enabled in the CBA so we shouldn't get the same resolved template as above. -echo "Running the same ressource-resolution but with different inputs..." -process_cba $REQUEST_PAYLOAD_FILE_2 $RESPONSE_PAYLOAD_FILE_2 $RESPONSE_HEADERS_FILE_2 - -echo 'Assert statuscode' -assert_status_code 200 $RESPONSE_HEADERS_FILE_2 - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE_2 $RESPONSE_PAYLOAD_FILE_2 diff --git a/cds-regression-test/test/resource-resolution/init-mockserver.sh b/cds-regression-test/test/resource-resolution/init-mockserver.sh deleted file mode 100755 index 005ed2f..0000000 --- a/cds-regression-test/test/resource-resolution/init-mockserver.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d '{ - "httpRequest" : { - "method" : "GET", - "path" : "/get" - }, - "httpResponse" : { - "body" : "{\"value\": \"get:ok\"}" - } -}' - -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d '{ - "httpRequest" : { - "method" : "POST", - "path" : "/post" - }, - "httpResponse" : { - "body" : "{\"value\": \"post:ok\"}" - } -}' - -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d '{ - "httpRequest" : { - "method" : "PUT", - "path" : "/put" - }, - "httpResponse" : { - "body" : "{\"value\": \"put:ok\"}" - } -}' - -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d '{ - "httpRequest" : { - "method" : "PATCH", - "path" : "/patch" - }, - "httpResponse" : { - "body" : "{\"value\": \"patch:ok\"}" - } -}' - -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d '{ - "httpRequest" : { - "method" : "DELETE", - "path" : "/delete" - }, - "httpResponse" : { - "body" : "{\"value\": \"delete:ok\"}" - } -}' diff --git a/cds-regression-test/test/resource-resolution/resource-resolution-enrichment-test.sh b/cds-regression-test/test/resource-resolution/resource-resolution-enrichment-test.sh deleted file mode 100755 index 79236ae..0000000 --- a/cds-regression-test/test/resource-resolution/resource-resolution-enrichment-test.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -CBA_NAME="resource-resolution" -TEST_NAME="$CBA_NAME-enrichment" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Compressing CBA: $CBA_NAME" -compress_cba $CBA_NAME - -echo "Enriching CBA: $CBA_NAME" -enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/cds-regression-test/test/resource-resolution/resource-resolution-upload-dd.sh b/cds-regression-test/test/resource-resolution/resource-resolution-upload-dd.sh deleted file mode 100755 index 96f1007..0000000 --- a/cds-regression-test/test/resource-resolution/resource-resolution-upload-dd.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -TEST_NAME="upload-data-dict" -TEST_NUMBER=$RANDOM -REQUEST_DD_PAYLOAD_DIR="$TEST_DIRECTORY/resource-resolution/data-dict" - -. ./$TEST_DIRECTORY/utils.sh - -# delete useless log file -rm $FAILED_TESTS_LOG - -DD_PAYLOADS=$(ls $REQUEST_DD_PAYLOAD_DIR) -for DD_PAYLOAD in $DD_PAYLOADS -do - echo "Uploading DD : $DD_PAYLOAD" - PAYLOAD_NAME=$(echo "$DD_PAYLOAD" | cut -d '.' -f1) - RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$PAYLOAD_NAME-$TEST_NUMBER-response-headers" - RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$PAYLOAD_NAME-$TEST_NUMBER-response-payload" - PAYLOAD_FILE="$REQUEST_DD_PAYLOAD_DIR/$DD_PAYLOAD" - FAILED_TESTS_LOG="$FAILED_TESTS_DIRECTORY/$TEST_NAME-$PAYLOAD_NAME-$TEST_NUMBER.log" - - # create log life - touch $FAILED_TESTS_LOG - - upload_dd $PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - - echo 'Assert status 200' - assert_status_code 200 $RESPONSE_HEADERS_FILE -done diff --git a/cds-regression-test/test/resource-resolution/resource-resolution-upload-test.sh b/cds-regression-test/test/resource-resolution/resource-resolution-upload-test.sh deleted file mode 100755 index 16c7326..0000000 --- a/cds-regression-test/test/resource-resolution/resource-resolution-upload-test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -CBA_NAME="resource-resolution" -TEST_NAME="$CBA_NAME-upload" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Uploading CBA: $CBA_NAME" -upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -# This step prevents a race-condition for parallel process requests -# when cba has not yet been written to filesystem -echo 'Send process request to force CDS to load CBA to filesystem' -process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/cds-regression-test/test/resource-resolution/success/expected-payloads/expected-response.json b/cds-regression-test/test/resource-resolution/success/expected-payloads/expected-response.json deleted file mode 100644 index efb6282..0000000 --- a/cds-regression-test/test/resource-resolution/success/expected-payloads/expected-response.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-05-07T22:18:06.901Z", - "originatorId": "System", - "requestId": "1234", - "subRequestId": "1234-12234", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-resource-resolution", - "blueprintVersion": "1.0.0", - "actionName": "resource-resolution", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-05-07T22:18:22.289Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "resource-resolution-response": { - "meshed-template": { - "helloworld-velocity": "{\n \"default\": \"ok\",\n \"input\": \"ok\",\n \"script\": {\n \"python\": \"ok\",\n \"kotlin\": \"ok\"\n },\n \"db\": \"ok\",\n \"rest\": {\n \"GET\": \"get:ok\",\n \"POST\": \"post:ok\",\n \"PUT\": \"put:ok\",\n \"PATCH\": \"patch:ok\",\n \"DELETE\": \"delete:ok\"\n }\n}\n", - "helloworld-jinja": "{\n \"default\": \"ok\",\n \"input\": \"ok\",\n \"script\": {\n \"python\": \"ok\",\n \"kotlin\": {\n \"base\": \"ok\"\n \"from suspend function\": \"ok\"\n }\n },\n \"db\": \"ok\",\n \"rest\": {\n \"GET\": \"get:ok\",\n \"POST\": \"post:ok\",\n \"PUT\": \"put:ok\",\n \"PATCH\": \"patch:ok\",\n \"DELETE\": \"delete:ok\"\n }\n}\n" - } - } - } -} diff --git a/cds-regression-test/test/resource-resolution/success/request-payloads/request-payload.json b/cds-regression-test/test/resource-resolution/success/request-payloads/request-payload.json deleted file mode 100644 index 91e4612..0000000 --- a/cds-regression-test/test/resource-resolution/success/request-payloads/request-payload.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "1234", - "subRequestId": "1234-12234" - }, - "actionIdentifiers": { - "blueprintName": "RT-resource-resolution", - "blueprintVersion": "1.0.0", - "actionName": "resource-resolution", - "mode": "sync" - }, - "payload": { - "resource-resolution-request": { - "template-prefix": [ - "helloworld-velocity", - "helloworld-jinja" - ], - "resolution-key": "regression-test", - "resource-resolution-properties": { - "v_input": "ok", - "j_input": "ok" - } - } - } -} diff --git a/cds-regression-test/test/resource-resolution/success/test.sh b/cds-regression-test/test/resource-resolution/success/test.sh deleted file mode 100755 index c43c276..0000000 --- a/cds-regression-test/test/resource-resolution/success/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -CBA_NAME="resource-resolution" -TEST_NAME="success" -TEST_NUMBER=$RANDOM - -REQUEST_PAYLOAD_DIR="request-payloads" -EXPECTED_PAYLOAD_DIR="expected-payloads" - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/$REQUEST_PAYLOAD_DIR/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/$EXPECTED_PAYLOAD_DIR/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/test/ansible-python-dg/ansible-python-dg-enrichment-test.sh b/cds-regression-test/test/test/ansible-python-dg/ansible-python-dg-enrichment-test.sh deleted file mode 100644 index 26dfa99..0000000 --- a/cds-regression-test/test/test/ansible-python-dg/ansible-python-dg-enrichment-test.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -CBA_NAME="ansible-python-dg" -TEST_NAME="$CBA_NAME-enrichment" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Compressing CBA: $CBA_NAME" -compress_cba $CBA_NAME - -echo "Enriching CBA: $CBA_NAME" -enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/cds-regression-test/test/test/ansible-python-dg/ansible-python-dg-upload-test.sh b/cds-regression-test/test/test/ansible-python-dg/ansible-python-dg-upload-test.sh deleted file mode 100644 index f3abae1..0000000 --- a/cds-regression-test/test/test/ansible-python-dg/ansible-python-dg-upload-test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -CBA_NAME="ansible-python-dg" -TEST_NAME="$CBA_NAME-upload" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Uploading CBA: $CBA_NAME" -upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -# This step prevents a race-condition for parallel process requests -# when cba has not yet been written to filesystem -echo 'Send process request to force CDS to load CBA to filesystem' -process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/cds-regression-test/test/test/ansible-python-dg/dummy-request-payload.json b/cds-regression-test/test/test/ansible-python-dg/dummy-request-payload.json deleted file mode 100644 index f04d745..0000000 --- a/cds-regression-test/test/test/ansible-python-dg/dummy-request-payload.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "dummy-request-should-fail", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-ansible-python-dg", - "blueprintVersion": "1.0.0", - "actionName": "dummy", - "mode": "sync" - }, - "payload": {} -} diff --git a/cds-regression-test/test/test/ansible-python-dg/init-mockserver.sh b/cds-regression-test/test/test/ansible-python-dg/init-mockserver.sh deleted file mode 100644 index b777714..0000000 --- a/cds-regression-test/test/test/ansible-python-dg/init-mockserver.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -CBA_NAME="ansible-python-dg" -DIR_PAYLOADS="$TEST_DIRECTORY/$CBA_NAME/mock-payloads" - - -# JOB TEMPLATE -echo "Mocking Job Template route..." -JT_PAYLOAD="job-template.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$JT_PAYLOAD" - -# JOB TEMPLATE LAUNCH - GET -echo "Mocking Job Template Launch GET route..." -GET_JT_LAUNCH_PAYLOAD="get_job-template-launch.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$GET_JT_LAUNCH_PAYLOAD" - -# JOB TEMPLATE LAUNCH -echo "Mocking Inventory route..." -INVENTORY_PAYLOAD="inventory.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$INVENTORY_PAYLOAD" - -# JOB TEMPLATE LAUNCH - POST -echo "Mocking Job Template Launch POST route..." -POST_JT_LAUNCH_PAYLOAD="post_job-template-launch.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$POST_JT_LAUNCH_PAYLOAD" - -# JOB EXECUTION -echo "Mocking Job Execution route..." -JOB_EXECUTION_PAYLOAD="job-execution.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$JOB_EXECUTION_PAYLOAD" - -# JOB OUTPUT -echo "Mocking Job Output route..." -JOB_OUTPUT_PAYLOAD="job-output.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$JOB_OUTPUT_PAYLOAD" diff --git a/cds-regression-test/test/test/ansible-python-dg/mock-payloads/get_job-template-launch.json b/cds-regression-test/test/test/ansible-python-dg/mock-payloads/get_job-template-launch.json deleted file mode 100644 index f4d0020..0000000 --- a/cds-regression-test/test/test/ansible-python-dg/mock-payloads/get_job-template-launch.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "httpRequest": { - "method": "GET", - "path": "/ansible-python-dg/success/api/v2/job_templates/123/launch/" - }, - "httpResponse": { - "body": { - "can_start_without_user_input": false, - "passwords_needed_to_start": [], - "ask_variables_on_launch": true, - "ask_tags_on_launch": true, - "ask_diff_mode_on_launch": false, - "ask_skip_tags_on_launch": true, - "ask_job_type_on_launch": false, - "ask_limit_on_launch": true, - "ask_verbosity_on_launch": false, - "ask_inventory_on_launch": true, - "ask_credential_on_launch": true, - "survey_enabled": true, - "variables_needed_to_start": [ - "tor_group", - "site_id" - ], - "credential_needed_to_start": false, - "inventory_needed_to_start": false, - "job_template_data": { - "name": "hello_world_job_template", - "id": "123", - "description": "hello_world Runner Job Template" - }, - "defaults": { - "extra_vars": "", - "diff_mode": false, - "limit": "", - "job_tags": "", - "skip_tags": "", - "job_type": "run", - "verbosity": 0, - "inventory": { - "name": "Demo Inventory", - "id": 1 - } - } - } - } -} diff --git a/cds-regression-test/test/test/ansible-python-dg/mock-payloads/inventory.json b/cds-regression-test/test/test/ansible-python-dg/mock-payloads/inventory.json deleted file mode 100644 index 87cfdfb..0000000 --- a/cds-regression-test/test/test/ansible-python-dg/mock-payloads/inventory.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "httpRequest": { - "method": "GET", - "path": "/ansible-python-dg/success/api/v2/inventories/" - }, - "httpResponse": { - "body": { - "count": 1, - "next": null, - "previous": null, - "results": [ - { - "id": 1, - "type": "inventory", - "url": "/api/v2/inventories/1/", - "related": { - "created_by": "/api/v2/users/1/", - "modified_by": "/api/v2/users/1/", - "hosts": "/api/v2/inventories/1/hosts/", - "groups": "/api/v2/inventories/1/groups/", - "root_groups": "/api/v2/inventories/1/root_groups/", - "variable_data": "/api/v2/inventories/1/variable_data/", - "script": "/api/v2/inventories/1/script/", - "tree": "/api/v2/inventories/1/tree/", - "inventory_sources": "/api/v2/inventories/1/inventory_sources/", - "update_inventory_sources": "/api/v2/inventories/1/update_inventory_sources/", - "activity_stream": "/api/v2/inventories/1/activity_stream/", - "job_templates": "/api/v2/inventories/1/job_templates/", - "ad_hoc_commands": "/api/v2/inventories/1/ad_hoc_commands/", - "access_list": "/api/v2/inventories/1/access_list/", - "object_roles": "/api/v2/inventories/1/object_roles/", - "instance_groups": "/api/v2/inventories/1/instance_groups/", - "copy": "/api/v2/inventories/1/copy/", - "organization": "/api/v2/organizations/1/" - }, - "summary_fields": { - "organization": { - "id": 1, - "name": "Default", - "description": "" - }, - "created_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "modified_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "object_roles": { - "admin_role": { - "description": "Can manage all aspects of the inventory", - "name": "Admin", - "id": 21 - }, - "update_role": { - "description": "May update project or inventory or group using the configured source update system", - "name": "Update", - "id": 22 - }, - "adhoc_role": { - "description": "May run ad hoc commands on an inventory", - "name": "Ad Hoc", - "id": 23 - }, - "use_role": { - "description": "Can use the inventory in a job template", - "name": "Use", - "id": 24 - }, - "read_role": { - "description": "May view settings for the inventory", - "name": "Read", - "id": 25 - } - }, - "user_capabilities": { - "edit": true, - "delete": true, - "copy": true, - "adhoc": true - } - }, - "created": "2019-05-21T15:45:31.954359Z", - "modified": "2019-05-21T15:45:31.954378Z", - "name": "Demo Inventory", - "description": "", - "organization": 1, - "kind": "", - "host_filter": null, - "variables": "", - "has_active_failures": false, - "total_hosts": 1, - "hosts_with_active_failures": 0, - "total_groups": 0, - "groups_with_active_failures": 0, - "has_inventory_sources": false, - "total_inventory_sources": 0, - "inventory_sources_with_failures": 0, - "insights_credential": null, - "pending_deletion": false - } - ] - } - } -} diff --git a/cds-regression-test/test/test/ansible-python-dg/mock-payloads/job-execution.json b/cds-regression-test/test/test/ansible-python-dg/mock-payloads/job-execution.json deleted file mode 100644 index 34772d7..0000000 --- a/cds-regression-test/test/test/ansible-python-dg/mock-payloads/job-execution.json +++ /dev/null @@ -1,216 +0,0 @@ -{ - "httpRequest": { - "method": "GET", - "path": "/ansible-python-dg/success/api/v2/jobs/456/" - }, - "httpResponse": { - "body": { - "id": "456", - "type": "job", - "url": "/api/v2/jobs/456/", - "related": { - "created_by": "/api/v2/users/1/", - "labels": "/api/v2/jobs/456/labels/", - "inventory": "/api/v2/inventories/1/", - "project": "/api/v2/projects/8/", - "extra_credentials": "/api/v2/jobs/456/extra_credentials/", - "credentials": "/api/v2/jobs/456/credentials/", - "unified_job_template": "/api/v2/job_templates/123/", - "stdout": "/api/v2/jobs/456/stdout/", - "job_events": "/api/v2/jobs/456/job_events/", - "job_host_summaries": "/api/v2/jobs/456/job_host_summaries/", - "activity_stream": "/api/v2/jobs/456/activity_stream/", - "notifications": "/api/v2/jobs/456/notifications/", - "job_template": "/api/v2/job_templates/123/", - "cancel": "/api/v2/jobs/456/cancel/", - "create_schedule": "/api/v2/jobs/456/create_schedule/", - "relaunch": "/api/v2/jobs/456/relaunch/" - }, - "summary_fields": { - "inventory": { - "id": 1, - "name": "Demo Inventory", - "description": "", - "has_active_failures": false, - "total_hosts": 1, - "hosts_with_active_failures": 0, - "total_groups": 0, - "groups_with_active_failures": 0, - "has_inventory_sources": false, - "total_inventory_sources": 0, - "inventory_sources_with_failures": 0, - "organization_id": 1, - "kind": "" - }, - "project": { - "id": 8, - "name": "cds_playbooks", - "description": "CDS - cds_playbooks Project", - "status": "ok", - "scm_type": "" - }, - "job_template": { - "id": "123", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template" - }, - "unified_job_template": { - "id": "123", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "unified_job_type": "job" - }, - "instance_group": { - "name": "tower", - "id": 1 - }, - "created_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "user_capabilities": { - "delete": true, - "start": true - }, - "labels": { - "count": 0, - "results": [] - }, - "extra_credentials": [], - "credentials": [] - }, - "created": "2019-06-12T11:21:26.891986Z", - "modified": "2019-06-12T11:21:27.355185Z", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "job_type": "run", - "inventory": 1, - "project": 8, - "playbook": "hello_world.yml", - "forks": 0, - "limit": "", - "verbosity": 0, - "extra_vars": "{\"tor_group\": \"vEPC\", \"site_id\": \"3 - Belmont\"}", - "job_tags": "", - "force_handlers": false, - "skip_tags": "", - "start_at_task": "", - "timeout": 0, - "use_fact_cache": false, - "unified_job_template": "123", - "launch_type": "manual", - "status": "successful", - "failed": false, - "started": "2019-06-12T11:21:27.510766Z", - "finished": "2019-06-12T11:21:48.993385Z", - "elapsed": 21.483, - "job_args": "[\"ansible-playbook\", \"-u\", \"root\", \"-i\", \"/tmp/awx_223_ft8hu4p4/tmptmtwllu4\", \"-e\", \"@/tmp/awx_223_ft8hu4p4/env/extravars\", \"hello_world.yml\"]", - "job_cwd": "/var/lib/awx/projects/cds_playbooks_folder", - "job_env": { - "HOSTNAME": "awx", - "LC_ALL": "en_US.UTF-8", - "VIRTUAL_ENV": "/var/lib/awx/venv/ansible", - "PATH": "/var/lib/awx/venv/ansible/bin:/var/lib/awx/venv/awx/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", - "SUPERVISOR_GROUP_NAME": "tower-processes", - "PWD": "/var/lib/awx", - "LANG": "en_US.UTF-8", - "PS1": "(awx) ", - "SUPERVISOR_ENABLED": "1", - "HOME": "/var/lib/awx", - "SHLVL": "2", - "LANGUAGE": "en_US.UTF-8", - "LC_CTYPE": "en_US.UTF-8", - "SUPERVISOR_PROCESS_NAME": "dispatcher", - "SUPERVISOR_SERVER_URL": "unix:///tmp/supervisor.sock", - "DJANGO_SETTINGS_MODULE": "awx.settings.production", - "DJANGO_LIVE_TEST_SERVER_ADDRESS": "localhost:9013-9199", - "TZ": "UTC", - "ANSIBLE_FORCE_COLOR": "True", - "ANSIBLE_HOST_KEY_CHECKING": "False", - "ANSIBLE_INVENTORY_UNPARSED_FAILED": "True", - "ANSIBLE_PARAMIKO_RECORD_HOST_KEYS": "False", - "ANSIBLE_VENV_PATH": "/var/lib/awx/venv/ansible", - "AWX_PRIVATE_DATA_DIR": "/tmp/awx_223_ft8hu4p4", - "PYTHONPATH": "/var/lib/awx/venv/ansible/lib/python2.7/site-packages:/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/lib:", - "JOB_ID": "456", - "INVENTORY_ID": "1", - "PROJECT_REVISION": "", - "ANSIBLE_RETRY_FILES_ENABLED": "False", - "MAX_EVENT_RES": "700000", - "ANSIBLE_CALLBACK_PLUGINS": "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/plugins/callback", - "AWX_HOST": "https://towerhost", - "ANSIBLE_SSH_CONTROL_PATH_DIR": "/tmp/awx_223_ft8hu4p4/cp", - "ANSIBLE_STDOUT_CALLBACK": "awx_display", - "AWX_ISOLATED_DATA_DIR": "/tmp/awx_223_ft8hu4p4/artifacts/456" - }, - "job_explanation": "", - "execution_node": "awx", - "controller_node": "", - "result_traceback": "", - "event_processing_finished": true, - "job_template": "123", - "passwords_needed_to_start": [], - "ask_diff_mode_on_launch": false, - "ask_variables_on_launch": true, - "ask_limit_on_launch": true, - "ask_tags_on_launch": true, - "ask_skip_tags_on_launch": true, - "ask_job_type_on_launch": false, - "ask_verbosity_on_launch": false, - "ask_inventory_on_launch": true, - "ask_credential_on_launch": true, - "allow_simultaneous": false, - "artifacts": { - "interface_groups": [ - "NSO-Openstack-NFVI-SRIOV-Shared" - ], - "host_groups": "NSO-Openstack-NFVI-SRIOV-Shared_999, ", - "topology": { - "tor-8.tenlab-cloud": [ - { - "interface_lldp_description": "sriov-s-2", - "interface_group": "NSO-Openstack-NFVI-SRIOV-Shared", - "lldp_interface_id": 740, - "compute_device": "nfvi-compute-14.tenlab-nfvi", - "interface_parent_name": null, - "interface_name": "TenGigE0/0/0/19", - "host_aggregate": "vLNS", - "tor_device": "tor-8.tenlab-cloud", - "compute_interface": "sriov-s-2" - } - ], - "tor-7.tenlab-cloud": [ - { - "interface_lldp_description": "sriov-s-1", - "interface_group": "NSO-Openstack-NFVI-SRIOV-Shared", - "lldp_interface_id": 698, - "compute_device": "nfvi-compute-14.tenlab-nfvi", - "interface_parent_name": null, - "interface_name": "TenGigE0/0/0/19", - "host_aggregate": "vLNS", - "tor_device": "tor-7.tenlab-cloud", - "compute_interface": "sriov-s-1" - } - ] - } - }, - "scm_revision": "", - "instance_group": 1, - "diff_mode": false, - "job_slice_number": 0, - "job_slice_count": 1, - "host_status_counts": { - "ok": 1 - }, - "playbook_counts": { - "play_count": 1, - "task_count": 2 - }, - "custom_virtualenv": "/var/lib/awx/venv/ansible", - "credential": null, - "vault_credential": null - } - } -} diff --git a/cds-regression-test/test/test/ansible-python-dg/mock-payloads/job-output.json b/cds-regression-test/test/test/ansible-python-dg/mock-payloads/job-output.json deleted file mode 100644 index 4877737..0000000 --- a/cds-regression-test/test/test/ansible-python-dg/mock-payloads/job-output.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "httpRequest" : { - "method" : "GET", - "path" : "/ansible-python-dg/success/api/v2/jobs/456/stdout/" - }, - "httpResponse" : { - "body" : " - - PLAY [Hello World Sample] ****************************************************** - - TASK [Gathering Facts] ********************************************************* - ok: [localhost] - - TASK [Hello Message] *********************************************************** - ok: [localhost] => { - \"msg\": \"Hello World!\" - } - - PLAY RECAP ********************************************************************* - localhost : ok=2 changed=0 unreachable=0 failed=0 - -" - } -} diff --git a/cds-regression-test/test/test/ansible-python-dg/mock-payloads/job-template.json b/cds-regression-test/test/test/ansible-python-dg/mock-payloads/job-template.json deleted file mode 100644 index 5b78274..0000000 --- a/cds-regression-test/test/test/ansible-python-dg/mock-payloads/job-template.json +++ /dev/null @@ -1,224 +0,0 @@ -{ - "httpRequest": { - "method": "GET", - "path": "/ansible-python-dg/success/api/v2/job_templates/hello_world_job_template/" - }, - "httpResponse": { - "body": { - "id": "123", - "type": "job_template", - "url": "/api/v2/job_templates/123/", - "related": { - "named_url": "/api/v2/job_templates/hello_world_job_template/", - "created_by": "/api/v2/users/1/", - "modified_by": "/api/v2/users/1/", - "labels": "/api/v2/job_templates/123/labels/", - "inventory": "/api/v2/inventories/1/", - "project": "/api/v2/projects/8/", - "extra_credentials": "/api/v2/job_templates/123/extra_credentials/", - "credentials": "/api/v2/job_templates/123/credentials/", - "last_job": "/api/v2/jobs/222/", - "jobs": "/api/v2/job_templates/123/jobs/", - "schedules": "/api/v2/job_templates/123/schedules/", - "activity_stream": "/api/v2/job_templates/123/activity_stream/", - "launch": "/api/v2/job_templates/123/launch/", - "notification_templates_any": "/api/v2/job_templates/123/notification_templates_any/", - "notification_templates_success": "/api/v2/job_templates/123/notification_templates_success/", - "notification_templates_error": "/api/v2/job_templates/123/notification_templates_error/", - "access_list": "/api/v2/job_templates/123/access_list/", - "survey_spec": "/api/v2/job_templates/123/survey_spec/", - "object_roles": "/api/v2/job_templates/123/object_roles/", - "instance_groups": "/api/v2/job_templates/123/instance_groups/", - "slice_workflow_jobs": "/api/v2/job_templates/123/slice_workflow_jobs/", - "copy": "/api/v2/job_templates/123/copy/" - }, - "summary_fields": { - "inventory": { - "id": 1, - "name": "Demo Inventory", - "description": "", - "has_active_failures": false, - "total_hosts": 1, - "hosts_with_active_failures": 0, - "total_groups": 0, - "groups_with_active_failures": 0, - "has_inventory_sources": false, - "total_inventory_sources": 0, - "inventory_sources_with_failures": 0, - "organization_id": 1, - "kind": "" - }, - "project": { - "id": 8, - "name": "cds_playbooks", - "description": "CDS - cds_playbooks Project", - "status": "ok", - "scm_type": "" - }, - "last_job": { - "id": 222, - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "finished": "2019-06-12T11:20:27.892787Z", - "status": "successful", - "failed": false - }, - "last_update": { - "id": 222, - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "status": "successful", - "failed": false - }, - "created_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "modified_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "object_roles": { - "admin_role": { - "description": "Can manage all aspects of the job template", - "name": "Admin", - "id": 51 - }, - "execute_role": { - "description": "May run the job template", - "name": "Execute", - "id": 52 - }, - "read_role": { - "description": "May view settings for the job template", - "name": "Read", - "id": 53 - } - }, - "user_capabilities": { - "edit": true, - "delete": true, - "start": true, - "schedule": true, - "copy": true - }, - "labels": { - "count": 0, - "results": [] - }, - "survey": { - "title": "", - "description": "" - }, - "recent_jobs": [ - { - "id": 222, - "status": "successful", - "finished": "2019-06-12T11:20:27.892787Z", - "type": "job" - }, - { - "id": 65, - "status": "successful", - "finished": "2019-06-03T18:27:19.114796Z", - "type": "job" - }, - { - "id": 64, - "status": "successful", - "finished": "2019-06-03T18:26:53.606618Z", - "type": "job" - }, - { - "id": 63, - "status": "successful", - "finished": "2019-06-03T18:24:36.072943Z", - "type": "job" - }, - { - "id": 62, - "status": "successful", - "finished": "2019-06-03T18:17:50.616528Z", - "type": "job" - }, - { - "id": 61, - "status": "successful", - "finished": "2019-06-03T18:04:42.995611Z", - "type": "job" - }, - { - "id": 60, - "status": "successful", - "finished": "2019-06-03T17:47:13.983951Z", - "type": "job" - }, - { - "id": 50, - "status": "successful", - "finished": "2019-05-30T15:47:55.700161Z", - "type": "job" - }, - { - "id": 49, - "status": "successful", - "finished": "2019-05-29T14:46:51.615926Z", - "type": "job" - }, - { - "id": 47, - "status": "successful", - "finished": "2019-05-27T20:23:58.656709Z", - "type": "job" - } - ], - "extra_credentials": [], - "credentials": [] - }, - "created": "2019-05-21T19:28:05.953730Z", - "modified": "2019-05-21T20:06:55.728697Z", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "job_type": "run", - "inventory": 1, - "project": 8, - "playbook": "hello_world.yml", - "forks": 0, - "limit": "", - "verbosity": 0, - "extra_vars": "", - "job_tags": "", - "force_handlers": false, - "skip_tags": "", - "start_at_task": "", - "timeout": 0, - "use_fact_cache": false, - "last_job_run": "2019-06-12T11:20:27.892787Z", - "last_job_failed": false, - "next_job_run": null, - "status": "successful", - "host_config_key": "", - "ask_diff_mode_on_launch": false, - "ask_variables_on_launch": true, - "ask_limit_on_launch": true, - "ask_tags_on_launch": true, - "ask_skip_tags_on_launch": true, - "ask_job_type_on_launch": false, - "ask_verbosity_on_launch": false, - "ask_inventory_on_launch": true, - "ask_credential_on_launch": true, - "survey_enabled": true, - "become_enabled": false, - "diff_mode": false, - "allow_simultaneous": false, - "custom_virtualenv": null, - "job_slice_count": 1, - "credential": null, - "vault_credential": null - } - } -} diff --git a/cds-regression-test/test/test/ansible-python-dg/mock-payloads/post_job-template-launch.json b/cds-regression-test/test/test/ansible-python-dg/mock-payloads/post_job-template-launch.json deleted file mode 100644 index da92392..0000000 --- a/cds-regression-test/test/test/ansible-python-dg/mock-payloads/post_job-template-launch.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "httpRequest": { - "method": "POST", - "path": "/ansible-python-dg/success/api/v2/job_templates/123/launch/" - }, - "httpResponse": { - "body": { - "job": "456", - "ignored_fields": {}, - "id": "456", - "type": "job", - "url": "/api/v2/jobs/456/", - "related": { - "created_by": "/api/v2/users/1/", - "modified_by": "/api/v2/users/1/", - "labels": "/api/v2/jobs/456/labels/", - "inventory": "/api/v2/inventories/1/", - "project": "/api/v2/projects/8/", - "extra_credentials": "/api/v2/jobs/456/extra_credentials/", - "credentials": "/api/v2/jobs/456/credentials/", - "unified_job_template": "/api/v2/job_templates/123/", - "stdout": "/api/v2/jobs/456/stdout/", - "job_events": "/api/v2/jobs/456/job_events/", - "job_host_summaries": "/api/v2/jobs/456/job_host_summaries/", - "activity_stream": "/api/v2/jobs/456/activity_stream/", - "notifications": "/api/v2/jobs/456/notifications/", - "job_template": "/api/v2/job_templates/123/", - "cancel": "/api/v2/jobs/456/cancel/", - "create_schedule": "/api/v2/jobs/456/create_schedule/", - "relaunch": "/api/v2/jobs/456/relaunch/" - }, - "summary_fields": { - "inventory": { - "id": 1, - "name": "Demo Inventory", - "description": "", - "has_active_failures": false, - "total_hosts": 1, - "hosts_with_active_failures": 0, - "total_groups": 0, - "groups_with_active_failures": 0, - "has_inventory_sources": false, - "total_inventory_sources": 0, - "inventory_sources_with_failures": 0, - "organization_id": 1, - "kind": "" - }, - "project": { - "id": 8, - "name": "cds_playbooks", - "description": "CDS - cds_playbooks Project", - "status": "ok", - "scm_type": "" - }, - "job_template": { - "id": "123", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template" - }, - "unified_job_template": { - "id": "123", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "unified_job_type": "job" - }, - "created_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "modified_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "user_capabilities": { - "delete": true, - "start": true - }, - "labels": { - "count": 0, - "results": [] - }, - "extra_credentials": [], - "credentials": [] - }, - "created": "2019-06-12T11:21:26.891986Z", - "modified": "2019-06-12T11:21:27.016410Z", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "job_type": "run", - "inventory": 1, - "project": 8, - "playbook": "hello_world.yml", - "forks": 0, - "limit": "", - "verbosity": 0, - "extra_vars": "{\"tor_group\": \"vEPC\", \"site_id\": \"3 - Belmont\"}", - "job_tags": "", - "force_handlers": false, - "skip_tags": "", - "start_at_task": "", - "timeout": 0, - "use_fact_cache": false, - "unified_job_template": "123", - "launch_type": "manual", - "status": "pending", - "failed": false, - "started": null, - "finished": null, - "elapsed": 0, - "job_args": "", - "job_cwd": "", - "job_env": {}, - "job_explanation": "", - "execution_node": "", - "controller_node": "", - "result_traceback": "", - "event_processing_finished": false, - "job_template": "123", - "passwords_needed_to_start": [], - "ask_diff_mode_on_launch": false, - "ask_variables_on_launch": true, - "ask_limit_on_launch": true, - "ask_tags_on_launch": true, - "ask_skip_tags_on_launch": true, - "ask_job_type_on_launch": false, - "ask_verbosity_on_launch": false, - "ask_inventory_on_launch": true, - "ask_credential_on_launch": true, - "allow_simultaneous": false, - "artifacts": {}, - "scm_revision": "", - "instance_group": null, - "diff_mode": false, - "job_slice_number": 0, - "job_slice_count": 1, - "credential": null, - "vault_credential": null - } - } -} diff --git a/cds-regression-test/test/test/ansible-python-dg/success/expected-response.json b/cds-regression-test/test/test/ansible-python-dg/success/expected-response.json deleted file mode 100644 index 833c2eb..0000000 --- a/cds-regression-test/test/test/ansible-python-dg/success/expected-response.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-05-26T01:11:00.914Z", - "originatorId": "System", - "requestId": "ansible-python-dg-success", - "subRequestId": "ansible-python-dg-success-1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-ansible-python-dg", - "blueprintVersion": "1.0.0", - "actionName": "run-dg", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-05-26T01:11:17.384Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "run-dg-response": { - "execute-command-logs": [ - "TenGigE0/0/0/19" - ] - } - } -} diff --git a/cds-regression-test/test/test/ansible-python-dg/success/request-payload.json b/cds-regression-test/test/test/ansible-python-dg/success/request-payload.json deleted file mode 100644 index bf68498..0000000 --- a/cds-regression-test/test/test/ansible-python-dg/success/request-payload.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "ansible-python-dg-success", - "subRequestId": "ansible-python-dg-success-1" - }, - "actionIdentifiers": { - "blueprintName": "RT-ansible-python-dg", - "blueprintVersion": "1.0.0", - "actionName": "run-dg", - "mode": "sync" - }, - "payload": { - "run-dg-request": { - "endpoint-selector": "awx", - "job-template-name": "hello_world_job_template", - "inventory": "Demo Inventory", - "limit": "123", - "tags": "some-tag", - "skip-tags": "some-skip-tag", - "extra-vars": { - "site_id": "3 - Belmont", - "tor_group": "vEPC" - } - } - } -} diff --git a/cds-regression-test/test/test/ansible-python-dg/success/test.sh b/cds-regression-test/test/test/ansible-python-dg/success/test.sh deleted file mode 100644 index 8977244..0000000 --- a/cds-regression-test/test/test/ansible-python-dg/success/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -CBA_NAME="ansible-python-dg" -TEST_NAME="success" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/test/bootstrap.sh b/cds-regression-test/test/test/bootstrap.sh deleted file mode 100755 index 36641ed..0000000 --- a/cds-regression-test/test/test/bootstrap.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# Starting from Frankfurt CDS release, we need to bootstrap on the first execution. - -# bootstrap files output filenames -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/bootstrap-response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/bootstrap-response-payload" - -if [ ${CDS_VERSION} == "elalto" ]; then - echo "Skipping bootstrap for elalto release" -else - echo "Bootstrapping CDS" - . ./$TEST_DIRECTORY/utils.sh - bootstrap_cds ${RESPONSE_PAYLOAD_FILE} ${RESPONSE_HEADERS_FILE} - echo "DEBUG::: RESPONSE_HEADERS_FILE: ${RESPONSE_HEADERS_FILE}" - cat ${RESPONSE_HEADERS_FILE} - echo "DEBUG::: RESPONSE_PAYLOAD_FILE: ${RESPONSE_PAYLOAD_FILE}" - cat ${RESPONSE_PAYLOAD_FILE} - assert_status_code 200 ${RESPONSE_HEADERS_FILE} -fi diff --git a/cds-regression-test/test/test/cli/cli-enrichment-test.sh b/cds-regression-test/test/test/cli/cli-enrichment-test.sh deleted file mode 100755 index a41a1ea..0000000 --- a/cds-regression-test/test/test/cli/cli-enrichment-test.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -CBA_NAME="cli" -TEST_NAME="$CBA_NAME-enrichment" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Compressing CBA: $CBA_NAME" -compress_cba_versioned $CBA_NAME - -echo "Enriching CBA: $CBA_NAME" -enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/cds-regression-test/test/test/cli/cli-upload-test.sh b/cds-regression-test/test/test/cli/cli-upload-test.sh deleted file mode 100755 index 7285cd4..0000000 --- a/cds-regression-test/test/test/cli/cli-upload-test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -CBA_NAME="cli" -TEST_NAME="$CBA_NAME-upload" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Uploading CBA: $CBA_NAME" -upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -# This step prevents a race-condition for parallel process requests -# when cba has not yet been written to filesystem -echo 'Send process request to force CDS to load CBA to filesystem' -process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/cds-regression-test/test/test/cli/command-fail/resources/elalto/expected-response.json b/cds-regression-test/test/test/cli/command-fail/resources/elalto/expected-response.json deleted file mode 100644 index b7b29e2..0000000 --- a/cds-regression-test/test/test/cli/command-fail/resources/elalto/expected-response.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-02-11T21:24:35.215Z", - "originatorId": "System", - "requestId": "regression-test-cli-command-fail", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-cli", - "blueprintVersion": "1.0.0", - "actionName": "cli", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-02-11T21:24:36.824Z", - "errorMessage": "Failed to execute commands, below the output : \nCommand : nonExistCommand", - "message": "failure" - }, - "payload": { - "cli-response": { - "response-data": "Error" - } - } -} diff --git a/cds-regression-test/test/test/cli/command-fail/resources/elalto/request-payload.json b/cds-regression-test/test/test/cli/command-fail/resources/elalto/request-payload.json deleted file mode 100644 index db861c9..0000000 --- a/cds-regression-test/test/test/cli/command-fail/resources/elalto/request-payload.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-cli", - "blueprintVersion": "1.0.0", - "actionName": "cli" - }, - "payload": { - "cli-request": { - "host": "cds-regression-sshmock", - "username": "cdstest", - "password": "testcds", - "port": "22", - "connectionTimeOut": "5000", - "commands": [ - "nonExistCommand" - ] - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "regression-test-cli-command-fail", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/test/cli/command-fail/resources/frankfurt/expected-response.json b/cds-regression-test/test/test/cli/command-fail/resources/frankfurt/expected-response.json deleted file mode 100644 index 6b71773..0000000 --- a/cds-regression-test/test/test/cli/command-fail/resources/frankfurt/expected-response.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-06-04T15:05:20.003Z", - "originatorId": "System", - "requestId": "regression-test-cli-command-fail", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-cli", - "blueprintVersion": "1.0.0", - "actionName": "cli", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-06-04T15:05:41.528Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "cli-response": { - "response-data": [ - { - "command": "nonExistCommand", - "deviceOutput": "nonExistCommand\r\n/ $ nonExistCommand\r\n-ash: nonExistCommand: not found\r\n/ $ \u001b[6n", - "successful": true - } - ] - } - } -} diff --git a/cds-regression-test/test/test/cli/command-fail/resources/frankfurt/request-payload.json b/cds-regression-test/test/test/cli/command-fail/resources/frankfurt/request-payload.json deleted file mode 100644 index 700271e..0000000 --- a/cds-regression-test/test/test/cli/command-fail/resources/frankfurt/request-payload.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-cli", - "blueprintVersion": "1.0.0", - "actionName": "cli" - }, - "payload": { - "cli-request": { - "host": "cds-regression-sshmock", - "username": "cdstest", - "password": "testcds", - "port": "22", - "connectionTimeOut": "5000", - "logging": true, - "commands": [ - "nonExistCommand" - ] - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "regression-test-cli-command-fail", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/test/cli/command-fail/test.sh b/cds-regression-test/test/test/cli/command-fail/test.sh deleted file mode 100755 index a150680..0000000 --- a/cds-regression-test/test/test/cli/command-fail/test.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -CBA_NAME="cli" -TEST_NAME="command-fail" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -RESOURCES_DIR="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/resources/$CDS_VERSION" -REQUEST_PAYLOAD_FILE="$RESOURCES_DIR/request-payload.json" -EXPECTED_PAYLOAD_FILE="$RESOURCES_DIR/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -if [ "${CDS_VERSION} " == "elalto " ]; then - echo 'Assert statuscode 500' - assert_status_code 500 $RESPONSE_HEADERS_FILE -else - echo 'Assert statuscode 200' - assert_status_code 200 $RESPONSE_HEADERS_FILE -fi - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/test/cli/dummy-request-payload.json b/cds-regression-test/test/test/cli/dummy-request-payload.json deleted file mode 100644 index 62d2f92..0000000 --- a/cds-regression-test/test/test/cli/dummy-request-payload.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "dummy-request-should-fail", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-cli", - "blueprintVersion": "1.0.0", - "actionName": "dummy", - "mode": "sync" - }, - "payload": {} -} diff --git a/cds-regression-test/test/test/cli/success/resources/elalto/expected-response.json b/cds-regression-test/test/test/cli/success/resources/elalto/expected-response.json deleted file mode 100644 index a813478..0000000 --- a/cds-regression-test/test/test/cli/success/resources/elalto/expected-response.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-02-11T21:19:57.762Z", - "originatorId": "System", - "requestId": "regression-test-cli", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-cli", - "blueprintVersion": "1.0.0", - "actionName": "cli", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-02-11T21:20:00.446Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "cli-response": { - "response-data": "\nCommand : pwd\n/\n\nCommand : ls\nbin\ndev\netc\nlib\n" - } - } -} diff --git a/cds-regression-test/test/test/cli/success/resources/elalto/request-payload.json b/cds-regression-test/test/test/cli/success/resources/elalto/request-payload.json deleted file mode 100644 index 8019144..0000000 --- a/cds-regression-test/test/test/cli/success/resources/elalto/request-payload.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-cli", - "blueprintVersion": "1.0.0", - "actionName": "cli" - }, - "payload": { - "cli-request": { - "host": "cds-regression-sshmock", - "username": "cdstest", - "password": "testcds", - "port": "22", - "connectionTimeOut": "5000", - "commands": [ - "pwd", - "ls" - ] - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "regression-test-cli", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/test/cli/success/resources/frankfurt/expected-response.json b/cds-regression-test/test/test/cli/success/resources/frankfurt/expected-response.json deleted file mode 100644 index 55248cb..0000000 --- a/cds-regression-test/test/test/cli/success/resources/frankfurt/expected-response.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-05-25T20:54:11.024Z", - "originatorId": "System", - "requestId": "regression-test-cli", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-cli", - "blueprintVersion": "1.0.0", - "actionName": "cli", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-05-25T20:54:21.453Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "cli-response": { - "response-data": [ - { - "command": "pwd", - "deviceOutput": "pwd\r\n/ $ pwd\r\n/\r\n/ $ \u001b[6n", - "successful": true - }, - { - "command": "ls", - "deviceOutput": "pwd\r\n/ $ pwd\r\n/\r\n/ $ \u001b[6nls\r\n\u001b[1;34mbin\u001b[m \u001b[1;34mdev\u001b[m \u001b[1;34metc\u001b[m \u001b[1;34mlib\u001b[m\r\n/ $ \u001b[6n", - "successful": true - } - ] - } - } -} diff --git a/cds-regression-test/test/test/cli/success/resources/frankfurt/request-payload.json b/cds-regression-test/test/test/cli/success/resources/frankfurt/request-payload.json deleted file mode 100644 index 0438a7c..0000000 --- a/cds-regression-test/test/test/cli/success/resources/frankfurt/request-payload.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-cli", - "blueprintVersion": "1.0.0", - "actionName": "cli" - }, - "payload": { - "cli-request": { - "host": "cds-regression-sshmock", - "username": "cdstest", - "password": "testcds", - "port": "22", - "connectionTimeOut": "5000", - "logging": true, - "commands": [ - "pwd", - "ls" - ] - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "regression-test-cli", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/test/cli/success/test.sh b/cds-regression-test/test/test/cli/success/test.sh deleted file mode 100755 index 6a589d5..0000000 --- a/cds-regression-test/test/test/cli/success/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -CBA_NAME="cli" -TEST_NAME="success" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -RESOURCES_DIR="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/resources/$CDS_VERSION" -REQUEST_PAYLOAD_FILE="$RESOURCES_DIR/request-payload.json" -EXPECTED_PAYLOAD_FILE="$RESOURCES_DIR/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/test/exit_on_failure.sh b/cds-regression-test/test/test/exit_on_failure.sh deleted file mode 100755 index 733e9a6..0000000 --- a/cds-regression-test/test/test/exit_on_failure.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -if [ "$(wc -c $FAILED_TESTS_DIRECTORY/*|awk '/total/ {print $1}')" -gt 0 ] -then - echo "exiting due to presence of files in FAILED_TESTS_DIRECTORY" - wc -c $FAILED_TESTS_DIRECTORY/* - exit 1; -fi diff --git a/cds-regression-test/test/test/lock-device/dummy-request-payload.json b/cds-regression-test/test/test/lock-device/dummy-request-payload.json deleted file mode 100644 index c3ca13c..0000000 --- a/cds-regression-test/test/test/lock-device/dummy-request-payload.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "dummy-request-should-fail", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-lock-device", - "blueprintVersion": "1.0.0", - "actionName": "dummy", - "mode": "sync" - }, - "payload": {} -} diff --git a/cds-regression-test/test/test/lock-device/lock-device-enrichment-test.sh b/cds-regression-test/test/test/lock-device/lock-device-enrichment-test.sh deleted file mode 100644 index 6c549dd..0000000 --- a/cds-regression-test/test/test/lock-device/lock-device-enrichment-test.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -if [ "${CDS_VERSION} " == "elalto " ]; then - echo "Skipping, not available in elalto" - return 0 -fi - -CBA_NAME="lock-device" -TEST_NAME="$CBA_NAME-enrichment" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Compressing CBA: $CBA_NAME" -compress_cba $CBA_NAME - -echo "Enriching CBA: $CBA_NAME" -enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/cds-regression-test/test/test/lock-device/lock-device-upload-test.sh b/cds-regression-test/test/test/lock-device/lock-device-upload-test.sh deleted file mode 100644 index 902c6c7..0000000 --- a/cds-regression-test/test/test/lock-device/lock-device-upload-test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -if [ "${CDS_VERSION} " == "elalto " ]; then - echo "Skipping, not available in elalto" - return 0 -fi - -CBA_NAME="lock-device" -TEST_NAME="$CBA_NAME-upload" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Uploading CBA: $CBA_NAME" -upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -# This step prevents a race-condition for parallel process requests -# when cba has not yet been written to filesystem -echo 'Send process request to force CDS to load CBA to filesystem' -process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/cds-regression-test/test/test/lock-device/success/expected-payloads/expected-payload-1.json b/cds-regression-test/test/test/lock-device/success/expected-payloads/expected-payload-1.json deleted file mode 100644 index b70b502..0000000 --- a/cds-regression-test/test/test/lock-device/success/expected-payloads/expected-payload-1.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-06-30T17:46:47.772Z", - "originatorId": "System", - "requestId": "lock-request-1", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-lock-device", - "blueprintVersion": "1.0.0", - "actionName": "resolve-deploy-kotlin", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-06-30T17:47:02.922Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "resolve-deploy-kotlin-response": { - "response-data": "Success: lock-request-1" - } - } -} diff --git a/cds-regression-test/test/test/lock-device/success/expected-payloads/expected-payload-2.json b/cds-regression-test/test/test/lock-device/success/expected-payloads/expected-payload-2.json deleted file mode 100644 index bd0dfdc..0000000 --- a/cds-regression-test/test/test/lock-device/success/expected-payloads/expected-payload-2.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-06-30T17:46:50.008Z", - "originatorId": "System", - "requestId": "lock-request-2", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-lock-device", - "blueprintVersion": "1.0.0", - "actionName": "resolve-deploy-kotlin", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-06-30T17:47:18.221Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "resolve-deploy-kotlin-response": { - "response-data": "Success: lock-request-2" - } - } -} diff --git a/cds-regression-test/test/test/lock-device/success/expected-payloads/expected-payload-3.json b/cds-regression-test/test/test/lock-device/success/expected-payloads/expected-payload-3.json deleted file mode 100644 index 9743758..0000000 --- a/cds-regression-test/test/test/lock-device/success/expected-payloads/expected-payload-3.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-06-30T17:46:51.761Z", - "originatorId": "System", - "requestId": "lock-request-3", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-lock-device", - "blueprintVersion": "1.0.0", - "actionName": "resolve-deploy-kotlin", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-06-30T17:47:12.301Z", - "errorMessage": "Failed in ComponentScriptExecutor : Failed to acquire lock within timeout, failed to get execution property(node_templates/execute-kotlin/attributes/response-data)", - "message": "failure" - }, - "payload": { - "resolve-deploy-kotlin-response": {} - } -} diff --git a/cds-regression-test/test/test/lock-device/success/expected-payloads/expected-payload-4.json b/cds-regression-test/test/test/lock-device/success/expected-payloads/expected-payload-4.json deleted file mode 100644 index 3b916ed..0000000 --- a/cds-regression-test/test/test/lock-device/success/expected-payloads/expected-payload-4.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-06-30T17:46:54.081Z", - "originatorId": "System", - "requestId": "lock-request-4", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-lock-device", - "blueprintVersion": "1.0.0", - "actionName": "resolve-deploy-kotlin", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-06-30T17:47:14.865Z", - "errorMessage": "Failed in ComponentScriptExecutor : Failed to acquire lock within timeout, failed to get execution property(node_templates/execute-kotlin/attributes/response-data)", - "message": "failure" - }, - "payload": { - "resolve-deploy-kotlin-response": {} - } -} diff --git a/cds-regression-test/test/test/lock-device/success/request-payloads/request-payload-1.json b/cds-regression-test/test/test/lock-device/success/request-payloads/request-payload-1.json deleted file mode 100644 index 20be12a..0000000 --- a/cds-regression-test/test/test/lock-device/success/request-payloads/request-payload-1.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-lock-device", - "blueprintVersion": "1.0.0", - "actionName": "resolve-deploy-kotlin" - }, - "payload": { - "resolve-deploy-kotlin-request": { - "resolve-deploy-kotlin-properties": { - "lock-acquire-timeout": 5 - } - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "lock-request-1", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/test/lock-device/success/request-payloads/request-payload-2.json b/cds-regression-test/test/test/lock-device/success/request-payloads/request-payload-2.json deleted file mode 100644 index 3fdc8d2..0000000 --- a/cds-regression-test/test/test/lock-device/success/request-payloads/request-payload-2.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-lock-device", - "blueprintVersion": "1.0.0", - "actionName": "resolve-deploy-kotlin" - }, - "payload": { - "resolve-deploy-kotlin-request": { - "resolve-deploy-kotlin-properties": { - "lock-acquire-timeout": 25 - } - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "lock-request-2", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/test/lock-device/success/request-payloads/request-payload-3.json b/cds-regression-test/test/test/lock-device/success/request-payloads/request-payload-3.json deleted file mode 100644 index f0277bc..0000000 --- a/cds-regression-test/test/test/lock-device/success/request-payloads/request-payload-3.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-lock-device", - "blueprintVersion": "1.0.0", - "actionName": "resolve-deploy-kotlin" - }, - "payload": { - "resolve-deploy-kotlin-request": { - "resolve-deploy-kotlin-properties": { - "lock-acquire-timeout": 15 - } - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "lock-request-3", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/test/lock-device/success/request-payloads/request-payload-4.json b/cds-regression-test/test/test/lock-device/success/request-payloads/request-payload-4.json deleted file mode 100644 index 2ba6b89..0000000 --- a/cds-regression-test/test/test/lock-device/success/request-payloads/request-payload-4.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-lock-device", - "blueprintVersion": "1.0.0", - "actionName": "resolve-deploy-kotlin" - }, - "payload": { - "resolve-deploy-kotlin-request": { - "resolve-deploy-kotlin-properties": { - "lock-acquire-timeout": 15 - } - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "lock-request-4", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/test/lock-device/success/test.sh b/cds-regression-test/test/test/lock-device/success/test.sh deleted file mode 100644 index 5553e5f..0000000 --- a/cds-regression-test/test/test/lock-device/success/test.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -CBA_NAME="lock-device" -TEST_NAME="success" -TEST_NUMBER=$RANDOM -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -for i in `seq 1 4` -do - echo "Sending request $i" - RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers-$i" - RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-$i" - REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payloads/request-payload-$i.json" - - process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE & - pids[${i}]=$! - sleep 3 -done - -echo "Waiting for responses" -for pid in ${pids[*]} -do - wait $pid -done - -echo "Assert payload - request 1" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-1" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-payloads/expected-payload-1.json" -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE - -echo "Assert payload - request 2" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-2" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-payloads/expected-payload-2.json" -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE - -echo "Assert payload - request 3" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-3" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-payloads/expected-payload-3.json" -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE - -echo "Assert payload - request 4" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-4" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-payloads/expected-payload-4.json" -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/test/netconf/dummy-request-payload.json b/cds-regression-test/test/test/netconf/dummy-request-payload.json deleted file mode 100644 index acc4f92..0000000 --- a/cds-regression-test/test/test/netconf/dummy-request-payload.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "dummy-request-should-fail", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-netconf", - "blueprintVersion": "1.0.0", - "actionName": "dummy", - "mode": "sync" - }, - "payload": {} -} diff --git a/cds-regression-test/test/test/netconf/jython/connect-fail/expected-response.json b/cds-regression-test/test/test/netconf/jython/connect-fail/expected-response.json deleted file mode 100644 index ff0cceb..0000000 --- a/cds-regression-test/test/test/netconf/jython/connect-fail/expected-response.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-02-04T14:16:32.798Z", - "originatorId": "System", - "requestId": "regression-test-netconf-jython-connect-fail", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-netconf", - "blueprintVersion": "1.0.0", - "actionName": "netconf-jython", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-02-04T14:16:32.824Z", - "errorMessage": "org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.NetconfException: 127.0.0.1:17830: Failed to establish SSH session", - "message": "failure" - }, - "payload": { - "netconf-jython-response": { - "response-data": { - "deploySuccess": false - } - } - } -} diff --git a/cds-regression-test/test/test/netconf/jython/connect-fail/request-payload.json b/cds-regression-test/test/test/netconf/jython/connect-fail/request-payload.json deleted file mode 100644 index 9a9f240..0000000 --- a/cds-regression-test/test/test/netconf/jython/connect-fail/request-payload.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-netconf", - "blueprintVersion": "1.0.0", - "actionName": "netconf-jython" - }, - "payload": { - "netconf-jython-request": { - "netconf-host": "127.0.0.1", - "netconf-timeout": 5 - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "regression-test-netconf-jython-connect-fail", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/test/netconf/jython/connect-fail/test.sh b/cds-regression-test/test/test/netconf/jython/connect-fail/test.sh deleted file mode 100755 index 670fa49..0000000 --- a/cds-regression-test/test/test/netconf/jython/connect-fail/test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -CBA_NAME="netconf" -LANG="jython" -TEST_NAME="connect-fail" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode 500' -assert_status_code 500 $RESPONSE_HEADERS_FILE - -echo 'Assert connect fail payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/test/netconf/jython/success/expected-response.json b/cds-regression-test/test/test/netconf/jython/success/expected-response.json deleted file mode 100644 index 6408577..0000000 --- a/cds-regression-test/test/test/netconf/jython/success/expected-response.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-02-03T13:40:43.697Z", - "originatorId": "System", - "requestId": "regression-test-netconf-jython", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-netconf", - "blueprintVersion": "1.0.0", - "actionName": "netconf-jython", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-02-03T13:40:51.835Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "netconf-jython-response": { - "response-data": { - "deploySuccess": true - } - } - } -} diff --git a/cds-regression-test/test/test/netconf/jython/success/request-payload.json b/cds-regression-test/test/test/netconf/jython/success/request-payload.json deleted file mode 100644 index dcaaeb1..0000000 --- a/cds-regression-test/test/test/netconf/jython/success/request-payload.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-netconf", - "blueprintVersion": "1.0.0", - "actionName": "netconf-jython" - }, - "payload": { - "netconf-jython-request": { - "netconf-host": "odl-netconf-testtool", - "netconf-timeout": 30 - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "regression-test-netconf-jython", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/test/netconf/jython/success/test.sh b/cds-regression-test/test/test/netconf/jython/success/test.sh deleted file mode 100755 index 4b3e2c0..0000000 --- a/cds-regression-test/test/test/netconf/jython/success/test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -CBA_NAME="netconf" -LANG="jython" -TEST_NAME="success" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/test/netconf/kotlin/connect-fail/expected-response.json b/cds-regression-test/test/test/netconf/kotlin/connect-fail/expected-response.json deleted file mode 100644 index 9334b50..0000000 --- a/cds-regression-test/test/test/netconf/kotlin/connect-fail/expected-response.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-02-04T14:16:32.798Z", - "originatorId": "System", - "requestId": "regression-test-netconf-kotlin-connect-fail", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-netconf", - "blueprintVersion": "1.0.0", - "actionName": "netconf-kotlin", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-02-04T14:16:32.824Z", - "errorMessage": "org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.NetconfException: 127.0.0.1:17830: Failed to establish SSH session", - "message": "failure" - }, - "payload": { - "netconf-kotlin-response": { - "response-data": { - "deploySuccess": false - } - } - } -} diff --git a/cds-regression-test/test/test/netconf/kotlin/connect-fail/request-payload.json b/cds-regression-test/test/test/netconf/kotlin/connect-fail/request-payload.json deleted file mode 100644 index 8cac64a..0000000 --- a/cds-regression-test/test/test/netconf/kotlin/connect-fail/request-payload.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-netconf", - "blueprintVersion": "1.0.0", - "actionName": "netconf-kotlin" - }, - "payload": { - "netconf-kotlin-request": { - "netconf-host": "127.0.0.1", - "netconf-timeout": 5 - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "regression-test-netconf-kotlin-connect-fail", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/test/netconf/kotlin/connect-fail/test.sh b/cds-regression-test/test/test/netconf/kotlin/connect-fail/test.sh deleted file mode 100755 index d30e5ab..0000000 --- a/cds-regression-test/test/test/netconf/kotlin/connect-fail/test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -CBA_NAME="netconf" -LANG="kotlin" -TEST_NAME="connect-fail" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode 500' -assert_status_code 500 $RESPONSE_HEADERS_FILE - -echo 'Assert connect fail payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/test/netconf/kotlin/success/expected-response.json b/cds-regression-test/test/test/netconf/kotlin/success/expected-response.json deleted file mode 100644 index dfb81d7..0000000 --- a/cds-regression-test/test/test/netconf/kotlin/success/expected-response.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-02-03T13:40:43.697Z", - "originatorId": "System", - "requestId": "regression-test-netconf-kotlin", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-netconf", - "blueprintVersion": "1.0.0", - "actionName": "netconf-kotlin", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-02-03T13:40:51.835Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "netconf-kotlin-response": { - "response-data": { - "deploySuccess": true - } - } - } -} diff --git a/cds-regression-test/test/test/netconf/kotlin/success/request-payload.json b/cds-regression-test/test/test/netconf/kotlin/success/request-payload.json deleted file mode 100644 index 412614f..0000000 --- a/cds-regression-test/test/test/netconf/kotlin/success/request-payload.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "actionIdentifiers": { - "mode": "sync", - "blueprintName": "RT-netconf", - "blueprintVersion": "1.0.0", - "actionName": "netconf-kotlin" - }, - "payload": { - "netconf-kotlin-request": { - "netconf-host": "odl-netconf-testtool", - "netconf-timeout": 30 - } - }, - "commonHeader": { - "subRequestId": "1", - "requestId": "regression-test-netconf-kotlin", - "originatorId": "System" - } -} diff --git a/cds-regression-test/test/test/netconf/kotlin/success/test.sh b/cds-regression-test/test/test/netconf/kotlin/success/test.sh deleted file mode 100755 index 8de0e6f..0000000 --- a/cds-regression-test/test/test/netconf/kotlin/success/test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -CBA_NAME="netconf" -LANG="kotlin" -TEST_NAME="success" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/test/netconf/netconf-enrichment-test.sh b/cds-regression-test/test/test/netconf/netconf-enrichment-test.sh deleted file mode 100755 index 3c76ce4..0000000 --- a/cds-regression-test/test/test/netconf/netconf-enrichment-test.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -CBA_NAME="netconf" -TEST_NAME="$CBA_NAME-enrichment" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Compressing CBA: $CBA_NAME" -compress_cba $CBA_NAME - -echo "Enriching CBA: $CBA_NAME" -enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - diff --git a/cds-regression-test/test/test/netconf/netconf-upload-test.sh b/cds-regression-test/test/test/netconf/netconf-upload-test.sh deleted file mode 100755 index 933a7b2..0000000 --- a/cds-regression-test/test/test/netconf/netconf-upload-test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -CBA_NAME="netconf" -TEST_NAME="$CBA_NAME-upload" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Uploading CBA: $CBA_NAME" -upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -# This step prevents a race-condition for parallel process requests -# when cba has not yet been written to filesystem -echo 'Send process request to force CDS to load CBA to filesystem' -process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/cds-regression-test/test/test/py-executor/connection-fail/expected-response.json b/cds-regression-test/test/test/py-executor/connection-fail/expected-response.json deleted file mode 100644 index 93b2598..0000000 --- a/cds-regression-test/test/test/py-executor/connection-fail/expected-response.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-05-19T17:26:02.923Z", - "originatorId": "System", - "requestId": "123456", - "subRequestId": "1234-12234", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-py-executor", - "blueprintVersion": "1.0.0", - "actionName": "connection-fail", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-05-19T17:26:02.926Z", - "errorMessage": "Failed in ComponentRemoteScriptExecutor : UNAVAILABLE: io exception, failed to get execution property(node_templates/execute-connection-fail/attributes/status)", - "message": "failure" - }, - "payload": { - "connection-fail-response": {} - } -} diff --git a/cds-regression-test/test/test/py-executor/connection-fail/request-payload.json b/cds-regression-test/test/test/py-executor/connection-fail/request-payload.json deleted file mode 100644 index 7273340..0000000 --- a/cds-regression-test/test/test/py-executor/connection-fail/request-payload.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "123456", - "subRequestId": "1234-12234" - }, - "actionIdentifiers": { - "blueprintName": "RT-py-executor", - "blueprintVersion": "1.0.0", - "actionName": "connection-fail", - "mode": "sync" - }, - "payload": { - "connection-fail-request": {} - } -} diff --git a/cds-regression-test/test/test/py-executor/connection-fail/test.sh b/cds-regression-test/test/test/py-executor/connection-fail/test.sh deleted file mode 100644 index b4b77e6..0000000 --- a/cds-regression-test/test/test/py-executor/connection-fail/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -CBA_NAME="py-executor" -TEST_NAME="connection-fail" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 500 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/test/py-executor/dummy-request-payload.json b/cds-regression-test/test/test/py-executor/dummy-request-payload.json deleted file mode 100644 index 688e5e9..0000000 --- a/cds-regression-test/test/test/py-executor/dummy-request-payload.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "dummy-request-should-fail", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "dummy", - "mode": "sync" - }, - "payload": {} -} diff --git a/cds-regression-test/test/test/py-executor/failing-script/expected-response.json b/cds-regression-test/test/test/py-executor/failing-script/expected-response.json deleted file mode 100644 index 17148b0..0000000 --- a/cds-regression-test/test/test/py-executor/failing-script/expected-response.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-05-19T17:24:33.353Z", - "originatorId": "System", - "requestId": "123456", - "subRequestId": "1234-12234", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-py-executor", - "blueprintVersion": "1.0.0", - "actionName": "failing-remote-python", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-05-19T17:24:33.370Z", - "errorMessage": "Failed in ComponentRemoteScriptExecutor : UNKNOWN: Exception iterating responses: Script raised an exception, failed to get execution property(node_templates/execute-failing-remote-python/attributes/status)", - "message": "failure" - }, - "payload": { - "failing-remote-python-response": {} - } -} diff --git a/cds-regression-test/test/test/py-executor/failing-script/request-payload.json b/cds-regression-test/test/test/py-executor/failing-script/request-payload.json deleted file mode 100644 index bacd876..0000000 --- a/cds-regression-test/test/test/py-executor/failing-script/request-payload.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "123456", - "subRequestId": "1234-12234" - }, - "actionIdentifiers": { - "blueprintName": "RT-py-executor", - "blueprintVersion": "1.0.0", - "actionName": "failing-remote-python", - "mode": "sync" - }, - "payload": { - "failing-remote-python-request": {} - } -} diff --git a/cds-regression-test/test/test/py-executor/failing-script/test.sh b/cds-regression-test/test/test/py-executor/failing-script/test.sh deleted file mode 100644 index 4386e09..0000000 --- a/cds-regression-test/test/test/py-executor/failing-script/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -CBA_NAME="py-executor" -TEST_NAME="failing-script" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 500 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/test/py-executor/py-executor-enrichment-test.sh b/cds-regression-test/test/test/py-executor/py-executor-enrichment-test.sh deleted file mode 100644 index e671787..0000000 --- a/cds-regression-test/test/test/py-executor/py-executor-enrichment-test.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -## Not tested on El Alto -if [ "${CDS_VERSION} " == "elalto " ]; then - echo "Skipping, not available in elalto" - return 0 -fi - -CBA_NAME="py-executor" -TEST_NAME="$CBA_NAME-enrichment" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Compressing CBA: $CBA_NAME" -compress_cba $CBA_NAME - -echo "Enriching CBA: $CBA_NAME" -enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/cds-regression-test/test/test/py-executor/py-executor-upload-test.sh b/cds-regression-test/test/test/py-executor/py-executor-upload-test.sh deleted file mode 100644 index 46402e3..0000000 --- a/cds-regression-test/test/test/py-executor/py-executor-upload-test.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -## Not tested on El Alto -if [ "${CDS_VERSION} " == "elalto " ]; then - echo "Skipping, not available in elalto" - return 0 -fi - -CBA_NAME="py-executor" -TEST_NAME="$CBA_NAME-upload" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Uploading CBA: $CBA_NAME" -upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -# This step prevents a race-condition for parallel process requests -# when cba has not yet been written to filesystem -echo 'Send process request to force CDS to load CBA to filesystem' -process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/cds-regression-test/test/test/py-executor/success/expected-response.json b/cds-regression-test/test/test/py-executor/success/expected-response.json deleted file mode 100644 index 1318508..0000000 --- a/cds-regression-test/test/test/py-executor/success/expected-response.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-05-26T13:47:27.143Z", - "originatorId": "System", - "requestId": "123456", - "subRequestId": "1234-12234", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-py-executor", - "blueprintVersion": "1.0.0", - "actionName": "remote-python", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-05-26T13:47:27.193Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "remote-python-response": { - "status": "success", - "response-data": { - "HelloWorld-request": { - "hello": "world" - } - } - } - } -} diff --git a/cds-regression-test/test/test/py-executor/success/request-payload.json b/cds-regression-test/test/test/py-executor/success/request-payload.json deleted file mode 100644 index f23b0de..0000000 --- a/cds-regression-test/test/test/py-executor/success/request-payload.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "123456", - "subRequestId": "1234-12234" - }, - "actionIdentifiers": { - "blueprintName": "RT-py-executor", - "blueprintVersion": "1.0.0", - "actionName": "remote-python", - "mode": "sync" - }, - "payload": { - "remote-python-request": {} - } -} diff --git a/cds-regression-test/test/test/py-executor/success/test.sh b/cds-regression-test/test/test/py-executor/success/test.sh deleted file mode 100644 index d2d064a..0000000 --- a/cds-regression-test/test/test/py-executor/success/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -CBA_NAME="py-executor" -TEST_NAME="success" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/test/remote-ansible/connection-failure/expected-response.json b/cds-regression-test/test/test/remote-ansible/connection-failure/expected-response.json deleted file mode 100644 index 301e70b..0000000 --- a/cds-regression-test/test/test/remote-ansible/connection-failure/expected-response.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-05-01T19:38:57.529Z", - "originatorId": "System", - "requestId": "remote-ansible-connection-failure", - "subRequestId": "remote-ansible-connection-failure-1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-ansible", - "blueprintVersion": "1.0.0", - "actionName": "connection-fail", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-05-01T19:38:57.551Z", - "errorMessage": "error : ansible-command-logs : Failed to process on remote executor (Connect to localhost:12345 [localhost/127.0.0.1] failed: Connection refused (Connection refused))", - "message": "failure" - }, - "payload": { - "connection-fail-response": { - "ansible-command-status": "error", - "ansible-command-logs": "Failed to process on remote executor (Connect to localhost:12345 [localhost/127.0.0.1] failed: Connection refused (Connection refused))" - } - } -} diff --git a/cds-regression-test/test/test/remote-ansible/connection-failure/request-payload.json b/cds-regression-test/test/test/remote-ansible/connection-failure/request-payload.json deleted file mode 100644 index 08e39c7..0000000 --- a/cds-regression-test/test/test/remote-ansible/connection-failure/request-payload.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "remote-ansible-connection-failure", - "subRequestId": "remote-ansible-connection-failure-1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-ansible", - "blueprintVersion": "1.0.0", - "actionName": "connection-fail", - "mode": "sync" - }, - "payload": { - "connection-fail-request": { - "endpoint-selector": "awx", - "job-template-name": "hello_world_job_template", - "inventory": "Demo Inventory", - "limit": "123", - "tags": "some-tag", - "skip-tags": "some-skip-tag", - "extra-vars": { - "site_id": "3 - Belmont", - "tor_group": "vEPC" - } - } - } -} diff --git a/cds-regression-test/test/test/remote-ansible/connection-failure/test.sh b/cds-regression-test/test/test/remote-ansible/connection-failure/test.sh deleted file mode 100644 index 7c880fe..0000000 --- a/cds-regression-test/test/test/remote-ansible/connection-failure/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -CBA_NAME="remote-ansible" -TEST_NAME="connection-failure" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 500 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/test/remote-ansible/dummy-request-payload.json b/cds-regression-test/test/test/remote-ansible/dummy-request-payload.json deleted file mode 100644 index 5bb8112..0000000 --- a/cds-regression-test/test/test/remote-ansible/dummy-request-payload.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "dummy-request-should-fail", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-ansible", - "blueprintVersion": "1.0.0", - "actionName": "dummy", - "mode": "sync" - }, - "payload": {} -} diff --git a/cds-regression-test/test/test/remote-ansible/failure/resources/elalto/expected-response.json b/cds-regression-test/test/test/remote-ansible/failure/resources/elalto/expected-response.json deleted file mode 100644 index 050e328..0000000 --- a/cds-regression-test/test/test/remote-ansible/failure/resources/elalto/expected-response.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "commonHeader": { - "timestamp": "2020-05-01T18:55:44.034Z", - "originatorId": "System", - "requestId": "remote-ansible-failure", - "subRequestId": "remote-ansible-failure-1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-ansible", - "blueprintVersion": "1.0.0", - "actionName": "execute-remote-ansible-failure", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-05-01T18:55:44.046Z", - "errorMessage": "error : ansible-command-logs : Failed to process on remote executor (mapper.readTree(response.body) must not be null)", - "message": "failure" - }, - "payload": { - "execute-remote-ansible-failure-response": { - "ansible-command-status": "error", - "ansible-command-logs": "Failed to process on remote executor (mapper.readTree(response.body) must not be null)" - } - } -} diff --git a/cds-regression-test/test/test/remote-ansible/failure/resources/elalto/request-payload.json b/cds-regression-test/test/test/remote-ansible/failure/resources/elalto/request-payload.json deleted file mode 100644 index a4589ae..0000000 --- a/cds-regression-test/test/test/remote-ansible/failure/resources/elalto/request-payload.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "remote-ansible-failure", - "subRequestId": "remote-ansible-failure-1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-ansible", - "blueprintVersion": "1.0.0", - "actionName": "execute-remote-ansible-failure", - "mode": "sync" - }, - "payload": { - "execute-remote-ansible-failure-request": { - "endpoint-selector": "awx", - "job-template-name": "hello_world_job_template", - "inventory": "Demo Inventory", - "limit": "123", - "tags": "some-tag", - "skip-tags": "some-skip-tag", - "extra-vars": { - "site_id": "3 - Belmont", - "tor_group": "vEPC" - } - } - } -} diff --git a/cds-regression-test/test/test/remote-ansible/failure/resources/frankfurt/expected-response.json b/cds-regression-test/test/test/remote-ansible/failure/resources/frankfurt/expected-response.json deleted file mode 100644 index 713b934..0000000 --- a/cds-regression-test/test/test/remote-ansible/failure/resources/frankfurt/expected-response.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-06-02T21:03:35.836Z", - "originatorId": "System", - "requestId": "remote-ansible-failure", - "subRequestId": "remote-ansible-failure-1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-ansible", - "blueprintVersion": "1.0.0", - "actionName": "execute-remote-ansible-failure", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-06-02T21:03:38.655Z", - "errorMessage": "error : ansible-command-logs : Workflow/Job template hello_world_job_template does not exists", - "message": "failure" - }, - "payload": { - "execute-remote-ansible-failure-response": { - "ansible-command-status": "error", - "ansible-command-logs": "Workflow/Job template hello_world_job_template does not exists" - } - } -} diff --git a/cds-regression-test/test/test/remote-ansible/failure/resources/frankfurt/request-payload.json b/cds-regression-test/test/test/remote-ansible/failure/resources/frankfurt/request-payload.json deleted file mode 100644 index a4589ae..0000000 --- a/cds-regression-test/test/test/remote-ansible/failure/resources/frankfurt/request-payload.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "remote-ansible-failure", - "subRequestId": "remote-ansible-failure-1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-ansible", - "blueprintVersion": "1.0.0", - "actionName": "execute-remote-ansible-failure", - "mode": "sync" - }, - "payload": { - "execute-remote-ansible-failure-request": { - "endpoint-selector": "awx", - "job-template-name": "hello_world_job_template", - "inventory": "Demo Inventory", - "limit": "123", - "tags": "some-tag", - "skip-tags": "some-skip-tag", - "extra-vars": { - "site_id": "3 - Belmont", - "tor_group": "vEPC" - } - } - } -} diff --git a/cds-regression-test/test/test/remote-ansible/failure/test.sh b/cds-regression-test/test/test/remote-ansible/failure/test.sh deleted file mode 100644 index c044762..0000000 --- a/cds-regression-test/test/test/remote-ansible/failure/test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -CBA_NAME="remote-ansible" -TEST_NAME="failure" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -RESOURCES_DIR="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/resources/$CDS_VERSION" -REQUEST_PAYLOAD_FILE="$RESOURCES_DIR/request-payload.json" -EXPECTED_PAYLOAD_FILE="$RESOURCES_DIR/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 500 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/test/remote-ansible/init-mockserver.sh b/cds-regression-test/test/test/remote-ansible/init-mockserver.sh deleted file mode 100755 index c737b9e..0000000 --- a/cds-regression-test/test/test/remote-ansible/init-mockserver.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -CBA_NAME="remote-ansible" -DIR_PAYLOADS="$TEST_DIRECTORY/$CBA_NAME/mock-payloads" - -# JOB TEMPLATE -echo "Mocking Job Template route..." -JT_PAYLOAD="job-template.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$JT_PAYLOAD" - -# JOB TEMPLATE ERROR -echo "Mocking Job Template Error route..." -JT_ERR_PAYLOAD="job-template-error.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$JT_ERR_PAYLOAD" - -# JOB TEMPLATE LAUNCH - GET -echo "Mocking Job Template Launch GET route..." -GET_JT_LAUNCH_PAYLOAD="get_job-template-launch.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$GET_JT_LAUNCH_PAYLOAD" - -# JOB TEMPLATE LAUNCH -echo "Mocking Inventory route..." -INVENTORY_PAYLOAD="inventory.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$INVENTORY_PAYLOAD" - -# JOB TEMPLATE LAUNCH - POST -echo "Mocking Job Template Launch POST route..." -POST_JT_LAUNCH_PAYLOAD="post_job-template-launch.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$POST_JT_LAUNCH_PAYLOAD" - -# JOB EXECUTION -echo "Mocking Job Execution route..." -JOB_EXECUTION_PAYLOAD="job-execution.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$JOB_EXECUTION_PAYLOAD" - -# JOB OUTPUT -echo "Mocking Job Output route..." -JOB_OUTPUT_PAYLOAD="job-output.json" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d "@$DIR_PAYLOADS/$JOB_OUTPUT_PAYLOAD" diff --git a/cds-regression-test/test/test/remote-ansible/mock-payloads/get_job-template-launch.json b/cds-regression-test/test/test/remote-ansible/mock-payloads/get_job-template-launch.json deleted file mode 100644 index ed7904d..0000000 --- a/cds-regression-test/test/test/remote-ansible/mock-payloads/get_job-template-launch.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "httpRequest": { - "method": "GET", - "path": "/remote-ansible/success/api/v2/job_templates/123/launch/" - }, - "httpResponse": { - "body": { - "can_start_without_user_input": false, - "passwords_needed_to_start": [], - "ask_variables_on_launch": true, - "ask_tags_on_launch": true, - "ask_diff_mode_on_launch": false, - "ask_skip_tags_on_launch": true, - "ask_job_type_on_launch": false, - "ask_limit_on_launch": true, - "ask_verbosity_on_launch": false, - "ask_inventory_on_launch": true, - "ask_credential_on_launch": true, - "survey_enabled": true, - "variables_needed_to_start": [ - "tor_group", - "site_id" - ], - "credential_needed_to_start": false, - "inventory_needed_to_start": false, - "job_template_data": { - "name": "hello_world_job_template", - "id": "123", - "description": "hello_world Runner Job Template" - }, - "defaults": { - "extra_vars": "", - "diff_mode": false, - "limit": "", - "job_tags": "", - "skip_tags": "", - "job_type": "run", - "verbosity": 0, - "inventory": { - "name": "Demo Inventory", - "id": 1 - } - } - } - } -} diff --git a/cds-regression-test/test/test/remote-ansible/mock-payloads/inventory.json b/cds-regression-test/test/test/remote-ansible/mock-payloads/inventory.json deleted file mode 100644 index 165b929..0000000 --- a/cds-regression-test/test/test/remote-ansible/mock-payloads/inventory.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "httpRequest": { - "method": "GET", - "path": "/remote-ansible/success/api/v2/inventories/" - }, - "httpResponse": { - "body": { - "count": 1, - "next": null, - "previous": null, - "results": [ - { - "id": 1, - "type": "inventory", - "url": "/api/v2/inventories/1/", - "related": { - "created_by": "/api/v2/users/1/", - "modified_by": "/api/v2/users/1/", - "hosts": "/api/v2/inventories/1/hosts/", - "groups": "/api/v2/inventories/1/groups/", - "root_groups": "/api/v2/inventories/1/root_groups/", - "variable_data": "/api/v2/inventories/1/variable_data/", - "script": "/api/v2/inventories/1/script/", - "tree": "/api/v2/inventories/1/tree/", - "inventory_sources": "/api/v2/inventories/1/inventory_sources/", - "update_inventory_sources": "/api/v2/inventories/1/update_inventory_sources/", - "activity_stream": "/api/v2/inventories/1/activity_stream/", - "job_templates": "/api/v2/inventories/1/job_templates/", - "ad_hoc_commands": "/api/v2/inventories/1/ad_hoc_commands/", - "access_list": "/api/v2/inventories/1/access_list/", - "object_roles": "/api/v2/inventories/1/object_roles/", - "instance_groups": "/api/v2/inventories/1/instance_groups/", - "copy": "/api/v2/inventories/1/copy/", - "organization": "/api/v2/organizations/1/" - }, - "summary_fields": { - "organization": { - "id": 1, - "name": "Default", - "description": "" - }, - "created_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "modified_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "object_roles": { - "admin_role": { - "description": "Can manage all aspects of the inventory", - "name": "Admin", - "id": 21 - }, - "update_role": { - "description": "May update project or inventory or group using the configured source update system", - "name": "Update", - "id": 22 - }, - "adhoc_role": { - "description": "May run ad hoc commands on an inventory", - "name": "Ad Hoc", - "id": 23 - }, - "use_role": { - "description": "Can use the inventory in a job template", - "name": "Use", - "id": 24 - }, - "read_role": { - "description": "May view settings for the inventory", - "name": "Read", - "id": 25 - } - }, - "user_capabilities": { - "edit": true, - "delete": true, - "copy": true, - "adhoc": true - } - }, - "created": "2019-05-21T15:45:31.954359Z", - "modified": "2019-05-21T15:45:31.954378Z", - "name": "Demo Inventory", - "description": "", - "organization": 1, - "kind": "", - "host_filter": null, - "variables": "", - "has_active_failures": false, - "total_hosts": 1, - "hosts_with_active_failures": 0, - "total_groups": 0, - "groups_with_active_failures": 0, - "has_inventory_sources": false, - "total_inventory_sources": 0, - "inventory_sources_with_failures": 0, - "insights_credential": null, - "pending_deletion": false - } - ] - } - } -} diff --git a/cds-regression-test/test/test/remote-ansible/mock-payloads/job-execution.json b/cds-regression-test/test/test/remote-ansible/mock-payloads/job-execution.json deleted file mode 100644 index e8df26b..0000000 --- a/cds-regression-test/test/test/remote-ansible/mock-payloads/job-execution.json +++ /dev/null @@ -1,183 +0,0 @@ -{ - "httpRequest": { - "method": "GET", - "path": "/remote-ansible/success/api/v2/jobs/456/" - }, - "httpResponse": { - "body": { - "id": "456", - "type": "job", - "url": "/api/v2/jobs/456/", - "related": { - "created_by": "/api/v2/users/1/", - "labels": "/api/v2/jobs/456/labels/", - "inventory": "/api/v2/inventories/1/", - "project": "/api/v2/projects/8/", - "extra_credentials": "/api/v2/jobs/456/extra_credentials/", - "credentials": "/api/v2/jobs/456/credentials/", - "unified_job_template": "/api/v2/job_templates/123/", - "stdout": "/api/v2/jobs/456/stdout/", - "job_events": "/api/v2/jobs/456/job_events/", - "job_host_summaries": "/api/v2/jobs/456/job_host_summaries/", - "activity_stream": "/api/v2/jobs/456/activity_stream/", - "notifications": "/api/v2/jobs/456/notifications/", - "job_template": "/api/v2/job_templates/123/", - "cancel": "/api/v2/jobs/456/cancel/", - "create_schedule": "/api/v2/jobs/456/create_schedule/", - "relaunch": "/api/v2/jobs/456/relaunch/" - }, - "summary_fields": { - "inventory": { - "id": 1, - "name": "Demo Inventory", - "description": "", - "has_active_failures": false, - "total_hosts": 1, - "hosts_with_active_failures": 0, - "total_groups": 0, - "groups_with_active_failures": 0, - "has_inventory_sources": false, - "total_inventory_sources": 0, - "inventory_sources_with_failures": 0, - "organization_id": 1, - "kind": "" - }, - "project": { - "id": 8, - "name": "cds_playbooks", - "description": "CDS - cds_playbooks Project", - "status": "ok", - "scm_type": "" - }, - "job_template": { - "id": "123", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template" - }, - "unified_job_template": { - "id": "123", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "unified_job_type": "job" - }, - "instance_group": { - "name": "tower", - "id": 1 - }, - "created_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "user_capabilities": { - "delete": true, - "start": true - }, - "labels": { - "count": 0, - "results": [] - }, - "extra_credentials": [], - "credentials": [] - }, - "created": "2019-06-12T11:21:26.891986Z", - "modified": "2019-06-12T11:21:27.355185Z", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "job_type": "run", - "inventory": 1, - "project": 8, - "playbook": "hello_world.yml", - "forks": 0, - "limit": "", - "verbosity": 0, - "extra_vars": "{\"tor_group\": \"vEPC\", \"site_id\": \"3 - Belmont\"}", - "job_tags": "", - "force_handlers": false, - "skip_tags": "", - "start_at_task": "", - "timeout": 0, - "use_fact_cache": false, - "unified_job_template": "123", - "launch_type": "manual", - "status": "successful", - "failed": false, - "started": "2019-06-12T11:21:27.510766Z", - "finished": "2019-06-12T11:21:48.993385Z", - "elapsed": 21.483, - "job_args": "[\"ansible-playbook\", \"-u\", \"root\", \"-i\", \"/tmp/awx_223_ft8hu4p4/tmptmtwllu4\", \"-e\", \"@/tmp/awx_223_ft8hu4p4/env/extravars\", \"hello_world.yml\"]", - "job_cwd": "/var/lib/awx/projects/cds_playbooks_folder", - "job_env": { - "HOSTNAME": "awx", - "LC_ALL": "en_US.UTF-8", - "VIRTUAL_ENV": "/var/lib/awx/venv/ansible", - "PATH": "/var/lib/awx/venv/ansible/bin:/var/lib/awx/venv/awx/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", - "SUPERVISOR_GROUP_NAME": "tower-processes", - "PWD": "/var/lib/awx", - "LANG": "en_US.UTF-8", - "PS1": "(awx) ", - "SUPERVISOR_ENABLED": "1", - "HOME": "/var/lib/awx", - "SHLVL": "2", - "LANGUAGE": "en_US.UTF-8", - "LC_CTYPE": "en_US.UTF-8", - "SUPERVISOR_PROCESS_NAME": "dispatcher", - "SUPERVISOR_SERVER_URL": "unix:///tmp/supervisor.sock", - "DJANGO_SETTINGS_MODULE": "awx.settings.production", - "DJANGO_LIVE_TEST_SERVER_ADDRESS": "localhost:9013-9199", - "TZ": "UTC", - "ANSIBLE_FORCE_COLOR": "True", - "ANSIBLE_HOST_KEY_CHECKING": "False", - "ANSIBLE_INVENTORY_UNPARSED_FAILED": "True", - "ANSIBLE_PARAMIKO_RECORD_HOST_KEYS": "False", - "ANSIBLE_VENV_PATH": "/var/lib/awx/venv/ansible", - "AWX_PRIVATE_DATA_DIR": "/tmp/awx_223_ft8hu4p4", - "PYTHONPATH": "/var/lib/awx/venv/ansible/lib/python2.7/site-packages:/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/lib:", - "JOB_ID": "456", - "INVENTORY_ID": "1", - "PROJECT_REVISION": "", - "ANSIBLE_RETRY_FILES_ENABLED": "False", - "MAX_EVENT_RES": "700000", - "ANSIBLE_CALLBACK_PLUGINS": "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/plugins/callback", - "AWX_HOST": "https://towerhost", - "ANSIBLE_SSH_CONTROL_PATH_DIR": "/tmp/awx_223_ft8hu4p4/cp", - "ANSIBLE_STDOUT_CALLBACK": "awx_display", - "AWX_ISOLATED_DATA_DIR": "/tmp/awx_223_ft8hu4p4/artifacts/456" - }, - "job_explanation": "", - "execution_node": "awx", - "controller_node": "", - "result_traceback": "", - "event_processing_finished": true, - "job_template": "123", - "passwords_needed_to_start": [], - "ask_diff_mode_on_launch": false, - "ask_variables_on_launch": true, - "ask_limit_on_launch": true, - "ask_tags_on_launch": true, - "ask_skip_tags_on_launch": true, - "ask_job_type_on_launch": false, - "ask_verbosity_on_launch": false, - "ask_inventory_on_launch": true, - "ask_credential_on_launch": true, - "allow_simultaneous": false, - "artifacts": {}, - "scm_revision": "", - "instance_group": 1, - "diff_mode": false, - "job_slice_number": 0, - "job_slice_count": 1, - "host_status_counts": { - "ok": 1 - }, - "playbook_counts": { - "play_count": 1, - "task_count": 2 - }, - "custom_virtualenv": "/var/lib/awx/venv/ansible", - "credential": null, - "vault_credential": null - } - } -} diff --git a/cds-regression-test/test/test/remote-ansible/mock-payloads/job-output.json b/cds-regression-test/test/test/remote-ansible/mock-payloads/job-output.json deleted file mode 100644 index 4ae2a49..0000000 --- a/cds-regression-test/test/test/remote-ansible/mock-payloads/job-output.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "httpRequest" : { - "method" : "GET", - "path" : "/remote-ansible/success/api/v2/jobs/456/stdout/" - }, - "httpResponse" : { - "body" : " - - PLAY [Hello World Sample] ****************************************************** - - TASK [Gathering Facts] ********************************************************* - ok: [localhost] - - TASK [Hello Message] *********************************************************** - ok: [localhost] => { - \"msg\": \"Hello World!\" - } - - PLAY RECAP ********************************************************************* - localhost : ok=2 changed=0 unreachable=0 failed=0 - -" - } -} diff --git a/cds-regression-test/test/test/remote-ansible/mock-payloads/job-template-error.json b/cds-regression-test/test/test/remote-ansible/mock-payloads/job-template-error.json deleted file mode 100644 index 49a9798..0000000 --- a/cds-regression-test/test/test/remote-ansible/mock-payloads/job-template-error.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "httpRequest": { - "path": "/remote-ansible/failure/api/v2/job_templates/hello_world_job_template/" - }, - "httpResponse": { - "statusCode": 500 - } -} diff --git a/cds-regression-test/test/test/remote-ansible/mock-payloads/job-template.json b/cds-regression-test/test/test/remote-ansible/mock-payloads/job-template.json deleted file mode 100644 index 10552c4..0000000 --- a/cds-regression-test/test/test/remote-ansible/mock-payloads/job-template.json +++ /dev/null @@ -1,224 +0,0 @@ -{ - "httpRequest": { - "method": "GET", - "path": "/remote-ansible/success/api/v2/job_templates/hello_world_job_template/" - }, - "httpResponse": { - "body": { - "id": "123", - "type": "job_template", - "url": "/api/v2/job_templates/123/", - "related": { - "named_url": "/api/v2/job_templates/hello_world_job_template/", - "created_by": "/api/v2/users/1/", - "modified_by": "/api/v2/users/1/", - "labels": "/api/v2/job_templates/123/labels/", - "inventory": "/api/v2/inventories/1/", - "project": "/api/v2/projects/8/", - "extra_credentials": "/api/v2/job_templates/123/extra_credentials/", - "credentials": "/api/v2/job_templates/123/credentials/", - "last_job": "/api/v2/jobs/222/", - "jobs": "/api/v2/job_templates/123/jobs/", - "schedules": "/api/v2/job_templates/123/schedules/", - "activity_stream": "/api/v2/job_templates/123/activity_stream/", - "launch": "/api/v2/job_templates/123/launch/", - "notification_templates_any": "/api/v2/job_templates/123/notification_templates_any/", - "notification_templates_success": "/api/v2/job_templates/123/notification_templates_success/", - "notification_templates_error": "/api/v2/job_templates/123/notification_templates_error/", - "access_list": "/api/v2/job_templates/123/access_list/", - "survey_spec": "/api/v2/job_templates/123/survey_spec/", - "object_roles": "/api/v2/job_templates/123/object_roles/", - "instance_groups": "/api/v2/job_templates/123/instance_groups/", - "slice_workflow_jobs": "/api/v2/job_templates/123/slice_workflow_jobs/", - "copy": "/api/v2/job_templates/123/copy/" - }, - "summary_fields": { - "inventory": { - "id": 1, - "name": "Demo Inventory", - "description": "", - "has_active_failures": false, - "total_hosts": 1, - "hosts_with_active_failures": 0, - "total_groups": 0, - "groups_with_active_failures": 0, - "has_inventory_sources": false, - "total_inventory_sources": 0, - "inventory_sources_with_failures": 0, - "organization_id": 1, - "kind": "" - }, - "project": { - "id": 8, - "name": "cds_playbooks", - "description": "CDS - cds_playbooks Project", - "status": "ok", - "scm_type": "" - }, - "last_job": { - "id": 222, - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "finished": "2019-06-12T11:20:27.892787Z", - "status": "successful", - "failed": false - }, - "last_update": { - "id": 222, - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "status": "successful", - "failed": false - }, - "created_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "modified_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "object_roles": { - "admin_role": { - "description": "Can manage all aspects of the job template", - "name": "Admin", - "id": 51 - }, - "execute_role": { - "description": "May run the job template", - "name": "Execute", - "id": 52 - }, - "read_role": { - "description": "May view settings for the job template", - "name": "Read", - "id": 53 - } - }, - "user_capabilities": { - "edit": true, - "delete": true, - "start": true, - "schedule": true, - "copy": true - }, - "labels": { - "count": 0, - "results": [] - }, - "survey": { - "title": "", - "description": "" - }, - "recent_jobs": [ - { - "id": 222, - "status": "successful", - "finished": "2019-06-12T11:20:27.892787Z", - "type": "job" - }, - { - "id": 65, - "status": "successful", - "finished": "2019-06-03T18:27:19.114796Z", - "type": "job" - }, - { - "id": 64, - "status": "successful", - "finished": "2019-06-03T18:26:53.606618Z", - "type": "job" - }, - { - "id": 63, - "status": "successful", - "finished": "2019-06-03T18:24:36.072943Z", - "type": "job" - }, - { - "id": 62, - "status": "successful", - "finished": "2019-06-03T18:17:50.616528Z", - "type": "job" - }, - { - "id": 61, - "status": "successful", - "finished": "2019-06-03T18:04:42.995611Z", - "type": "job" - }, - { - "id": 60, - "status": "successful", - "finished": "2019-06-03T17:47:13.983951Z", - "type": "job" - }, - { - "id": 50, - "status": "successful", - "finished": "2019-05-30T15:47:55.700161Z", - "type": "job" - }, - { - "id": 49, - "status": "successful", - "finished": "2019-05-29T14:46:51.615926Z", - "type": "job" - }, - { - "id": 47, - "status": "successful", - "finished": "2019-05-27T20:23:58.656709Z", - "type": "job" - } - ], - "extra_credentials": [], - "credentials": [] - }, - "created": "2019-05-21T19:28:05.953730Z", - "modified": "2019-05-21T20:06:55.728697Z", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "job_type": "run", - "inventory": 1, - "project": 8, - "playbook": "hello_world.yml", - "forks": 0, - "limit": "", - "verbosity": 0, - "extra_vars": "", - "job_tags": "", - "force_handlers": false, - "skip_tags": "", - "start_at_task": "", - "timeout": 0, - "use_fact_cache": false, - "last_job_run": "2019-06-12T11:20:27.892787Z", - "last_job_failed": false, - "next_job_run": null, - "status": "successful", - "host_config_key": "", - "ask_diff_mode_on_launch": false, - "ask_variables_on_launch": true, - "ask_limit_on_launch": true, - "ask_tags_on_launch": true, - "ask_skip_tags_on_launch": true, - "ask_job_type_on_launch": false, - "ask_verbosity_on_launch": false, - "ask_inventory_on_launch": true, - "ask_credential_on_launch": true, - "survey_enabled": true, - "become_enabled": false, - "diff_mode": false, - "allow_simultaneous": false, - "custom_virtualenv": null, - "job_slice_count": 1, - "credential": null, - "vault_credential": null - } - } -} diff --git a/cds-regression-test/test/test/remote-ansible/mock-payloads/post_job-template-launch.json b/cds-regression-test/test/test/remote-ansible/mock-payloads/post_job-template-launch.json deleted file mode 100644 index 8484374..0000000 --- a/cds-regression-test/test/test/remote-ansible/mock-payloads/post_job-template-launch.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "httpRequest": { - "method": "POST", - "path": "/remote-ansible/success/api/v2/job_templates/123/launch/" - }, - "httpResponse": { - "body": { - "job": "456", - "ignored_fields": {}, - "id": "456", - "type": "job", - "url": "/api/v2/jobs/456/", - "related": { - "created_by": "/api/v2/users/1/", - "modified_by": "/api/v2/users/1/", - "labels": "/api/v2/jobs/456/labels/", - "inventory": "/api/v2/inventories/1/", - "project": "/api/v2/projects/8/", - "extra_credentials": "/api/v2/jobs/456/extra_credentials/", - "credentials": "/api/v2/jobs/456/credentials/", - "unified_job_template": "/api/v2/job_templates/123/", - "stdout": "/api/v2/jobs/456/stdout/", - "job_events": "/api/v2/jobs/456/job_events/", - "job_host_summaries": "/api/v2/jobs/456/job_host_summaries/", - "activity_stream": "/api/v2/jobs/456/activity_stream/", - "notifications": "/api/v2/jobs/456/notifications/", - "job_template": "/api/v2/job_templates/123/", - "cancel": "/api/v2/jobs/456/cancel/", - "create_schedule": "/api/v2/jobs/456/create_schedule/", - "relaunch": "/api/v2/jobs/456/relaunch/" - }, - "summary_fields": { - "inventory": { - "id": 1, - "name": "Demo Inventory", - "description": "", - "has_active_failures": false, - "total_hosts": 1, - "hosts_with_active_failures": 0, - "total_groups": 0, - "groups_with_active_failures": 0, - "has_inventory_sources": false, - "total_inventory_sources": 0, - "inventory_sources_with_failures": 0, - "organization_id": 1, - "kind": "" - }, - "project": { - "id": 8, - "name": "cds_playbooks", - "description": "CDS - cds_playbooks Project", - "status": "ok", - "scm_type": "" - }, - "job_template": { - "id": "123", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template" - }, - "unified_job_template": { - "id": "123", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "unified_job_type": "job" - }, - "created_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "modified_by": { - "id": 1, - "username": "admin", - "first_name": "", - "last_name": "" - }, - "user_capabilities": { - "delete": true, - "start": true - }, - "labels": { - "count": 0, - "results": [] - }, - "extra_credentials": [], - "credentials": [] - }, - "created": "2019-06-12T11:21:26.891986Z", - "modified": "2019-06-12T11:21:27.016410Z", - "name": "hello_world_job_template", - "description": "hello_world Runner Job Template", - "job_type": "run", - "inventory": 1, - "project": 8, - "playbook": "hello_world.yml", - "forks": 0, - "limit": "", - "verbosity": 0, - "extra_vars": "{\"tor_group\": \"vEPC\", \"site_id\": \"3 - Belmont\"}", - "job_tags": "", - "force_handlers": false, - "skip_tags": "", - "start_at_task": "", - "timeout": 0, - "use_fact_cache": false, - "unified_job_template": "123", - "launch_type": "manual", - "status": "pending", - "failed": false, - "started": null, - "finished": null, - "elapsed": 0, - "job_args": "", - "job_cwd": "", - "job_env": {}, - "job_explanation": "", - "execution_node": "", - "controller_node": "", - "result_traceback": "", - "event_processing_finished": false, - "job_template": "123", - "passwords_needed_to_start": [], - "ask_diff_mode_on_launch": false, - "ask_variables_on_launch": true, - "ask_limit_on_launch": true, - "ask_tags_on_launch": true, - "ask_skip_tags_on_launch": true, - "ask_job_type_on_launch": false, - "ask_verbosity_on_launch": false, - "ask_inventory_on_launch": true, - "ask_credential_on_launch": true, - "allow_simultaneous": false, - "artifacts": {}, - "scm_revision": "", - "instance_group": null, - "diff_mode": false, - "job_slice_number": 0, - "job_slice_count": 1, - "credential": null, - "vault_credential": null - } - } -} diff --git a/cds-regression-test/test/test/remote-ansible/remote-ansible-enrichment-test.sh b/cds-regression-test/test/test/remote-ansible/remote-ansible-enrichment-test.sh deleted file mode 100755 index 9e4de45..0000000 --- a/cds-regression-test/test/test/remote-ansible/remote-ansible-enrichment-test.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -CBA_NAME="remote-ansible" -TEST_NAME="$CBA_NAME-enrichment" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Compressing CBA: $CBA_NAME" -compress_cba $CBA_NAME - -echo "Enriching CBA: $CBA_NAME" -enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/cds-regression-test/test/test/remote-ansible/remote-ansible-upload-test.sh b/cds-regression-test/test/test/remote-ansible/remote-ansible-upload-test.sh deleted file mode 100755 index 334b9b9..0000000 --- a/cds-regression-test/test/test/remote-ansible/remote-ansible-upload-test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -CBA_NAME="remote-ansible" -TEST_NAME="$CBA_NAME-upload" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Uploading CBA: $CBA_NAME" -upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -# This step prevents a race-condition for parallel process requests -# when cba has not yet been written to filesystem -echo 'Send process request to force CDS to load CBA to filesystem' -process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/cds-regression-test/test/test/remote-ansible/success/expected-response.json b/cds-regression-test/test/test/remote-ansible/success/expected-response.json deleted file mode 100644 index 9dce094..0000000 --- a/cds-regression-test/test/test/remote-ansible/success/expected-response.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-06-03T16:20:03.527Z", - "originatorId": "System", - "requestId": "remote-ansible-success", - "subRequestId": "remote-ansible-success-1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-ansible", - "blueprintVersion": "1.0.0", - "actionName": "execute-remote-ansible-success", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-06-03T16:20:18.859Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "execute-remote-ansible-success-response": { - "ansible-command-status": "successful", - "ansible-command-logs": "Output for Job 456 :\n PLAY [Hello World Sample] ****************************************************** TASK [Gathering Facts] ********************************************************* ok: [localhost] TASK [Hello Message] *********************************************************** ok: [localhost] => { \"msg\": \"Hello World!\" } PLAY RECAP ********************************************************************* localhost : ok=2 changed=0 unreachable=0 failed=0\n" - } - } -} diff --git a/cds-regression-test/test/test/remote-ansible/success/request-payload.json b/cds-regression-test/test/test/remote-ansible/success/request-payload.json deleted file mode 100644 index 3718c4d..0000000 --- a/cds-regression-test/test/test/remote-ansible/success/request-payload.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "remote-ansible-success", - "subRequestId": "remote-ansible-success-1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-ansible", - "blueprintVersion": "1.0.0", - "actionName": "execute-remote-ansible-success", - "mode": "sync" - }, - "payload": { - "execute-remote-ansible-success-request": { - "endpoint-selector": "awx", - "job-template-name": "hello_world_job_template", - "inventory": "Demo Inventory", - "limit": "123", - "tags": "some-tag", - "skip-tags": "some-skip-tag", - "extra-vars": { - "site_id": "3 - Belmont", - "tor_group": "vEPC" - } - } - } -} diff --git a/cds-regression-test/test/test/remote-ansible/success/test.sh b/cds-regression-test/test/test/remote-ansible/success/test.sh deleted file mode 100644 index eab16ca..0000000 --- a/cds-regression-test/test/test/remote-ansible/success/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -CBA_NAME="remote-ansible" -TEST_NAME="success" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code_versioned 200 $RESPONSE_HEADERS_FILE $RESPONSE_PAYLOAD_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/test/remote-python/connection-fail/resources/elalto/expected-response.json b/cds-regression-test/test/test/remote-python/connection-fail/resources/elalto/expected-response.json deleted file mode 100644 index 2ab445b..0000000 --- a/cds-regression-test/test/test/remote-python/connection-fail/resources/elalto/expected-response.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "correlationUUID": "9f53fea6-c288-4d19-8d85-93832294f21a", - "commonHeader": { - "timestamp": "2020-07-20T18:15:21.593Z", - "originatorId": "System", - "requestId": "remote-python-connection-fail", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "connection-fail", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-07-20T18:15:22.846Z", - "errorMessage": "FAILURE : prepare-env : Command failed during env. preparation... timeout(120) requestId (remote-python-connection-fail). grpcError: (Connection refused: /127.0.0.1:4242)", - "message": "failure" - }, - "payload": { - "connection-fail-response": { - "execute-command-payload": "", - "execute-command-logs": "" - } - } -} diff --git a/cds-regression-test/test/test/remote-python/connection-fail/resources/elalto/request-payload.json b/cds-regression-test/test/test/remote-python/connection-fail/resources/elalto/request-payload.json deleted file mode 100644 index 4bcf8e2..0000000 --- a/cds-regression-test/test/test/remote-python/connection-fail/resources/elalto/request-payload.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "remote-python-connection-fail", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "connection-fail", - "mode": "sync" - }, - "payload": { - "connection-fail-request": {} - } -} diff --git a/cds-regression-test/test/test/remote-python/connection-fail/resources/frankfurt/expected-response.json b/cds-regression-test/test/test/remote-python/connection-fail/resources/frankfurt/expected-response.json deleted file mode 100644 index c9b15bd..0000000 --- a/cds-regression-test/test/test/remote-python/connection-fail/resources/frankfurt/expected-response.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-06-09T21:02:52.783Z", - "originatorId": "System", - "requestId": "remote-python-connection-fail", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "connection-fail", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-06-09T21:02:53.142Z", - "errorMessage": "FAILURE : prepare-env : Command failed during env. preparation... timeout(120) requestId (remote-python-connection-fail). grpcError: (finishConnect(..) failed: Connection refused: /127.0.0.1:4242)", - "message": "failure" - }, - "payload": { - "connection-fail-response": { - "execute-command-logs": "[]", - "execute-command-payload": "{}" - } - } -} diff --git a/cds-regression-test/test/test/remote-python/connection-fail/resources/frankfurt/request-payload.json b/cds-regression-test/test/test/remote-python/connection-fail/resources/frankfurt/request-payload.json deleted file mode 100644 index 4bcf8e2..0000000 --- a/cds-regression-test/test/test/remote-python/connection-fail/resources/frankfurt/request-payload.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "remote-python-connection-fail", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "connection-fail", - "mode": "sync" - }, - "payload": { - "connection-fail-request": {} - } -} diff --git a/cds-regression-test/test/test/remote-python/connection-fail/test.sh b/cds-regression-test/test/test/remote-python/connection-fail/test.sh deleted file mode 100644 index 4d3a38f..0000000 --- a/cds-regression-test/test/test/remote-python/connection-fail/test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -CBA_NAME="remote-python" -TEST_NAME="connection-fail" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -RESOURCES_DIR="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/resources/$CDS_VERSION" -REQUEST_PAYLOAD_FILE="$RESOURCES_DIR/request-payload.json" -EXPECTED_PAYLOAD_FILE="$RESOURCES_DIR/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 500 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/test/remote-python/dummy-request-payload.json b/cds-regression-test/test/test/remote-python/dummy-request-payload.json deleted file mode 100644 index 688e5e9..0000000 --- a/cds-regression-test/test/test/remote-python/dummy-request-payload.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "dummy-request-should-fail", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "dummy", - "mode": "sync" - }, - "payload": {} -} diff --git a/cds-regression-test/test/test/remote-python/failing-script/expected-response.json b/cds-regression-test/test/test/remote-python/failing-script/expected-response.json deleted file mode 100644 index 119b135..0000000 --- a/cds-regression-test/test/test/remote-python/failing-script/expected-response.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "correlationUUID": "0ae1f48a-ec91-4573-af76-070ec42e2cdd", - "commonHeader": { - "timestamp": "2020-07-02T23:46:04.959Z", - "originatorId": "System", - "requestId": "remote-python-failing-script", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "failing-remote-python", - "mode": "sync" - }, - "status": { - "code": 500, - "eventType": "EVENT_COMPONENT_FAILURE", - "timestamp": "2020-07-02T23:46:22.167Z", - "errorMessage": "FAILURE : execute-command : [\"Intentionally raised exception!\"]", - "message": "failure" - }, - "payload": { - "failing-remote-python-response": { - "execute-command-payload": { - "errorMessage": "Intentionally raised exception!" - }, - "execute-command-logs": [ - "Intentionally raised exception!" - ] - } - } -} diff --git a/cds-regression-test/test/test/remote-python/failing-script/request-payload.json b/cds-regression-test/test/test/remote-python/failing-script/request-payload.json deleted file mode 100644 index d4c612c..0000000 --- a/cds-regression-test/test/test/remote-python/failing-script/request-payload.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "remote-python-failing-script", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "failing-remote-python", - "mode": "sync" - }, - "payload": { - "failing-remote-python-request": {} - } -} diff --git a/cds-regression-test/test/test/remote-python/failing-script/test.sh b/cds-regression-test/test/test/remote-python/failing-script/test.sh deleted file mode 100755 index 1c394a3..0000000 --- a/cds-regression-test/test/test/remote-python/failing-script/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -CBA_NAME="remote-python" -TEST_NAME="failing-script" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 500 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/test/remote-python/remote-python-enrichment-test.sh b/cds-regression-test/test/test/remote-python/remote-python-enrichment-test.sh deleted file mode 100755 index e2344bd..0000000 --- a/cds-regression-test/test/test/remote-python/remote-python-enrichment-test.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -CBA_NAME="remote-python" -TEST_NAME="$CBA_NAME-enrichment" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Compressing CBA: $CBA_NAME" -compress_cba $CBA_NAME - -echo "Enriching CBA: $CBA_NAME" -enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/cds-regression-test/test/test/remote-python/remote-python-upload-test.sh b/cds-regression-test/test/test/remote-python/remote-python-upload-test.sh deleted file mode 100755 index f62490c..0000000 --- a/cds-regression-test/test/test/remote-python/remote-python-upload-test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -CBA_NAME="remote-python" -TEST_NAME="$CBA_NAME-upload" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Uploading CBA: $CBA_NAME" -upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -# This step prevents a race-condition for parallel process requests -# when cba has not yet been written to filesystem -echo 'Send process request to force CDS to load CBA to filesystem' -process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/cds-regression-test/test/test/remote-python/success/expected-response.json b/cds-regression-test/test/test/remote-python/success/expected-response.json deleted file mode 100644 index 8b0149f..0000000 --- a/cds-regression-test/test/test/remote-python/success/expected-response.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "correlationUUID": "9acac95d-9b17-4224-9fe1-0cdb652d027c", - "commonHeader": { - "timestamp": "2020-07-02T22:52:50.662Z", - "originatorId": "System", - "requestId": "remote-python-request", - "subRequestId": "1", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "remote-python", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-07-02T22:53:05.357Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "remote-python-response": { - "execute-command-payload": { - "abc": [ - "xyz", - "qqq" - ] - }, - "execute-command-logs": [ - "remote executor regression" - ] - } - } -} diff --git a/cds-regression-test/test/test/remote-python/success/request-payload.json b/cds-regression-test/test/test/remote-python/success/request-payload.json deleted file mode 100644 index b3b9be8..0000000 --- a/cds-regression-test/test/test/remote-python/success/request-payload.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "remote-python-request", - "subRequestId": "1" - }, - "actionIdentifiers": { - "blueprintName": "RT-remote-python", - "blueprintVersion": "1.0.0", - "actionName": "remote-python", - "mode": "sync" - }, - "payload": { - "remote-python-request": {} - } -} diff --git a/cds-regression-test/test/test/remote-python/success/test.sh b/cds-regression-test/test/test/remote-python/success/test.sh deleted file mode 100755 index 1afabbb..0000000 --- a/cds-regression-test/test/test/remote-python/success/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -CBA_NAME="remote-python" -TEST_NAME="success" -TEST_NUMBER=$RANDOM - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" - -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" - -echo 'Calling CDS process' -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/test/reset-verify-mockserver.sh b/cds-regression-test/test/test/reset-verify-mockserver.sh deleted file mode 100644 index 8b3ecf6..0000000 --- a/cds-regression-test/test/test/reset-verify-mockserver.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/reset-mockserver-$TEST_NUMBER-response-headers" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Reset mockserver - $TEST_NUMBER" -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/reset" > /dev/null 2> $RESPONSE_HEADERS_FILE -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/cds-regression-test/test/test/resource-resolution/data-dict/RT-db.json b/cds-regression-test/test/test/resource-resolution/data-dict/RT-db.json deleted file mode 100644 index d8e1daf..0000000 --- a/cds-regression-test/test/test/resource-resolution/data-dict/RT-db.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "RT-db", - "data_type": "string", - "description": "DB request for regression test", - "tags": "datetime", - "updatedBy": "Selfish", - "definition": { - "name": "RT-db", - "tags": "RT-db", - "updated-by": "Selffish", - "property": { - "description": "DB request for regression test", - "type": "string" - }, - "sources": { - "processor-db": { - "type": "source-db", - "properties": { - "endpoint-selector": "db-endpoint", - "type": "SQL", - "query": "select sdnctl.RESOURCE_RESOLUTION.value from sdnctl.RESOURCE_RESOLUTION where value='ok'", - "input-key-mapping": {}, - "output-key-mapping": { - "value": "value" - } - } - } - } - } -} diff --git a/cds-regression-test/test/test/resource-resolution/data-dict/RT-kotlin.json b/cds-regression-test/test/test/resource-resolution/data-dict/RT-kotlin.json deleted file mode 100644 index c521792..0000000 --- a/cds-regression-test/test/test/resource-resolution/data-dict/RT-kotlin.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "kotlin-script", - "data_type": "string", - "description": "Kotlin script used to read properties.", - "tags": "kotlin-script", - "updatedBy": "Self-fish", - "definition": { - "name": "kotlin-script", - "updated-by": "Selffish", - "tags": "properties-capability-source", - "property": { - "description": "Kotlin script used to read properties.", - "type": "string" - }, - "sources": { - "capability": { - "type": "source-capability", - "properties": { - "script-type": "kotlin", - "script-class-reference": "cba.cds.RT.ResolvPropertiesKt", - "instance-dependencies": [] - } - } - } - } -} diff --git a/cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-delete.json b/cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-delete.json deleted file mode 100644 index c1cef3b..0000000 --- a/cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-delete.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "RT-rest-delete", - "data_type": "string", - "description": "Rest DELETE request for regression test", - "tags": "RT-rest-delete", - "updatedBy": "Selfish", - "definition": { - "name": "RT-rest-delete", - "tags": "RT-rest-delete", - "updated-by": "Selffish", - "property": { - "description": "Rest DELETE request for regression test", - "type": "string" - }, - "sources": { - "sdnc": { - "type": "source-rest", - "properties": { - "type": "string", - "verb": "DELETE", - "url-path": "/delete", - "endpoint-selector": "rest-endpoint", - "path": "", - "input-key-mapping": {}, - "output-key-mapping": { - "value": "value" - } - } - } - } - } -} diff --git a/cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-get.json b/cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-get.json deleted file mode 100644 index 210ac27..0000000 --- a/cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-get.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "RT-rest-get", - "data_type": "string", - "description": "Rest GET request for regression test", - "tags": "RT-rest-get", - "updatedBy": "Selfish", - "definition": { - "name": "RT-rest-get", - "tags": "RT-rest-get", - "updated-by": "Selffish", - "property": { - "description": "Rest GET request for regression test", - "type": "string" - }, - "sources": { - "sdnc": { - "type": "source-rest", - "properties": { - "type": "string", - "verb": "GET", - "url-path": "/get", - "endpoint-selector": "rest-endpoint", - "path": "", - "input-key-mapping": {}, - "output-key-mapping": { - "value": "value" - } - } - } - } - } -} diff --git a/cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-patch.json b/cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-patch.json deleted file mode 100644 index 41f94da..0000000 --- a/cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-patch.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "RT-rest-patch", - "data_type": "string", - "description": "Rest PATCH request for regression test", - "tags": "RT-rest-patch", - "updatedBy": "Selfish", - "definition": { - "name": "RT-rest-patch", - "tags": "RT-rest-patch", - "updated-by": "Selffish", - "property": { - "description": "Rest PATCH request for regression test", - "type": "string" - }, - "sources": { - "sdnc": { - "type": "source-rest", - "properties": { - "type": "string", - "verb": "PATCH", - "url-path": "/patch", - "endpoint-selector": "rest-endpoint", - "path": "", - "input-key-mapping": {}, - "output-key-mapping": { - "value": "value" - } - } - } - } - } -} diff --git a/cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-post.json b/cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-post.json deleted file mode 100644 index 63721bb..0000000 --- a/cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-post.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "RT-rest-post", - "data_type": "string", - "description": "Rest POST request for regression test", - "tags": "RT-rest-post", - "updatedBy": "Selfish", - "definition": { - "name": "RT-rest-post", - "tags": "RT-rest-post", - "updated-by": "Selffish", - "property": { - "description": "Rest POST request for regression test", - "type": "string" - }, - "sources": { - "sdnc": { - "type": "source-rest", - "properties": { - "type": "string", - "verb": "POST", - "url-path": "/post", - "endpoint-selector": "rest-endpoint", - "path": "", - "input-key-mapping": {}, - "output-key-mapping": { - "value": "value" - } - } - } - } - } -} diff --git a/cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-put.json b/cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-put.json deleted file mode 100644 index cf165d3..0000000 --- a/cds-regression-test/test/test/resource-resolution/data-dict/RT-rest-put.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "RT-rest-put", - "data_type": "string", - "description": "Rest PUT request for regression test", - "tags": "RT-rest-put", - "updatedBy": "Selfish", - "definition": { - "name": "RT-rest-put", - "tags": "RT-rest-put", - "updated-by": "Selffish", - "property": { - "description": "Rest PUT request for regression test", - "type": "string" - }, - "sources": { - "sdnc": { - "type": "source-rest", - "properties": { - "type": "string", - "verb": "PUT", - "url-path": "/put", - "endpoint-selector": "rest-endpoint", - "path": "", - "input-key-mapping": {}, - "output-key-mapping": { - "value": "value" - } - } - } - } - } -} diff --git a/cds-regression-test/test/test/resource-resolution/dummy-request-payload.json b/cds-regression-test/test/test/resource-resolution/dummy-request-payload.json deleted file mode 100644 index 60b3442..0000000 --- a/cds-regression-test/test/test/resource-resolution/dummy-request-payload.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "dummy-request-should-fail", - "subRequestId": "11" - }, - "actionIdentifiers": { - "blueprintName": "RT-resource-resolution", - "blueprintVersion": "1.0.0", - "actionName": "dummy", - "mode": "sync" - }, - "payload": {} -} diff --git a/cds-regression-test/test/test/resource-resolution/force-resolution/expected-payloads/expected-response-1.json b/cds-regression-test/test/test/resource-resolution/force-resolution/expected-payloads/expected-response-1.json deleted file mode 100644 index efb6282..0000000 --- a/cds-regression-test/test/test/resource-resolution/force-resolution/expected-payloads/expected-response-1.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-05-07T22:18:06.901Z", - "originatorId": "System", - "requestId": "1234", - "subRequestId": "1234-12234", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-resource-resolution", - "blueprintVersion": "1.0.0", - "actionName": "resource-resolution", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-05-07T22:18:22.289Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "resource-resolution-response": { - "meshed-template": { - "helloworld-velocity": "{\n \"default\": \"ok\",\n \"input\": \"ok\",\n \"script\": {\n \"python\": \"ok\",\n \"kotlin\": \"ok\"\n },\n \"db\": \"ok\",\n \"rest\": {\n \"GET\": \"get:ok\",\n \"POST\": \"post:ok\",\n \"PUT\": \"put:ok\",\n \"PATCH\": \"patch:ok\",\n \"DELETE\": \"delete:ok\"\n }\n}\n", - "helloworld-jinja": "{\n \"default\": \"ok\",\n \"input\": \"ok\",\n \"script\": {\n \"python\": \"ok\",\n \"kotlin\": {\n \"base\": \"ok\"\n \"from suspend function\": \"ok\"\n }\n },\n \"db\": \"ok\",\n \"rest\": {\n \"GET\": \"get:ok\",\n \"POST\": \"post:ok\",\n \"PUT\": \"put:ok\",\n \"PATCH\": \"patch:ok\",\n \"DELETE\": \"delete:ok\"\n }\n}\n" - } - } - } -} diff --git a/cds-regression-test/test/test/resource-resolution/force-resolution/expected-payloads/expected-response-2.json b/cds-regression-test/test/test/resource-resolution/force-resolution/expected-payloads/expected-response-2.json deleted file mode 100644 index 5d52426..0000000 --- a/cds-regression-test/test/test/resource-resolution/force-resolution/expected-payloads/expected-response-2.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-05-07T22:18:06.901Z", - "originatorId": "System", - "requestId": "1234", - "subRequestId": "1234-12234", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-resource-resolution", - "blueprintVersion": "1.0.0", - "actionName": "resource-resolution", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-05-07T22:18:22.289Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "resource-resolution-response": { - "meshed-template": { - "helloworld-velocity": "{\n \"default\": \"ok\",\n \"input\": \"ok-ok\",\n \"script\": {\n \"python\": \"ok\",\n \"kotlin\": \"ok\"\n },\n \"db\": \"ok\",\n \"rest\": {\n \"GET\": \"get:ok\",\n \"POST\": \"post:ok\",\n \"PUT\": \"put:ok\",\n \"PATCH\": \"patch:ok\",\n \"DELETE\": \"delete:ok\"\n }\n}\n", - "helloworld-jinja": "{\n \"default\": \"ok\",\n \"input\": \"ok-ok\",\n \"script\": {\n \"python\": \"ok\",\n \"kotlin\": {\n \"base\": \"ok\"\n \"from suspend function\": \"ok\"\n }\n },\n \"db\": \"ok\",\n \"rest\": {\n \"GET\": \"get:ok\",\n \"POST\": \"post:ok\",\n \"PUT\": \"put:ok\",\n \"PATCH\": \"patch:ok\",\n \"DELETE\": \"delete:ok\"\n }\n}\n" - } - } - } -} diff --git a/cds-regression-test/test/test/resource-resolution/force-resolution/request-payloads/request-payload-1.json b/cds-regression-test/test/test/resource-resolution/force-resolution/request-payloads/request-payload-1.json deleted file mode 100644 index 91e4612..0000000 --- a/cds-regression-test/test/test/resource-resolution/force-resolution/request-payloads/request-payload-1.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "1234", - "subRequestId": "1234-12234" - }, - "actionIdentifiers": { - "blueprintName": "RT-resource-resolution", - "blueprintVersion": "1.0.0", - "actionName": "resource-resolution", - "mode": "sync" - }, - "payload": { - "resource-resolution-request": { - "template-prefix": [ - "helloworld-velocity", - "helloworld-jinja" - ], - "resolution-key": "regression-test", - "resource-resolution-properties": { - "v_input": "ok", - "j_input": "ok" - } - } - } -} diff --git a/cds-regression-test/test/test/resource-resolution/force-resolution/request-payloads/request-payload-2.json b/cds-regression-test/test/test/resource-resolution/force-resolution/request-payloads/request-payload-2.json deleted file mode 100644 index de8a797..0000000 --- a/cds-regression-test/test/test/resource-resolution/force-resolution/request-payloads/request-payload-2.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "1234", - "subRequestId": "1234-12234" - }, - "actionIdentifiers": { - "blueprintName": "RT-resource-resolution", - "blueprintVersion": "1.0.0", - "actionName": "resource-resolution", - "mode": "sync" - }, - "payload": { - "resource-resolution-request": { - "template-prefix": [ - "helloworld-velocity", - "helloworld-jinja" - ], - "resolution-key": "regression-test", - "resource-resolution-properties": { - "v_input": "ok-ok", - "j_input": "ok-ok" - } - } - } -} diff --git a/cds-regression-test/test/test/resource-resolution/force-resolution/test.sh b/cds-regression-test/test/test/resource-resolution/force-resolution/test.sh deleted file mode 100644 index 013df7e..0000000 --- a/cds-regression-test/test/test/resource-resolution/force-resolution/test.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -CBA_NAME="resource-resolution" -TEST_NAME="force-resolution" -TEST_NUMBER=$RANDOM - -REQUEST_PAYLOAD_DIR="request-payloads" -EXPECTED_PAYLOAD_DIR="expected-payloads" - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE_1="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers-1" -RESPONSE_PAYLOAD_FILE_1="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-1" -REQUEST_PAYLOAD_FILE_1="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/$REQUEST_PAYLOAD_DIR/request-payload-1.json" -EXPECTED_PAYLOAD_FILE_1="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/$EXPECTED_PAYLOAD_DIR/expected-response-1.json" - -RESPONSE_HEADERS_FILE_2="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers-2" -RESPONSE_PAYLOAD_FILE_2="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-2" -REQUEST_PAYLOAD_FILE_2="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/$REQUEST_PAYLOAD_DIR/request-payload-2.json" -EXPECTED_PAYLOAD_FILE_2="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/$EXPECTED_PAYLOAD_DIR/expected-response-2.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" -echo "Running initial ressource-resolution to resolve template..." -process_cba $REQUEST_PAYLOAD_FILE_1 $RESPONSE_PAYLOAD_FILE_1 $RESPONSE_HEADERS_FILE_1 - -echo 'Assert statuscode' -assert_status_code 200 $RESPONSE_HEADERS_FILE_1 - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE_1 $RESPONSE_PAYLOAD_FILE_1 - - -# Verify force-resolution -## Same resolution-key, different input values from above test. -## Force-resolution is enabled in the CBA so we shouldn't get the same resolved template as above. -echo "Running the same ressource-resolution but with different inputs..." -process_cba $REQUEST_PAYLOAD_FILE_2 $RESPONSE_PAYLOAD_FILE_2 $RESPONSE_HEADERS_FILE_2 - -echo 'Assert statuscode' -assert_status_code 200 $RESPONSE_HEADERS_FILE_2 - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE_2 $RESPONSE_PAYLOAD_FILE_2 diff --git a/cds-regression-test/test/test/resource-resolution/init-mockserver.sh b/cds-regression-test/test/test/resource-resolution/init-mockserver.sh deleted file mode 100755 index 005ed2f..0000000 --- a/cds-regression-test/test/test/resource-resolution/init-mockserver.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d '{ - "httpRequest" : { - "method" : "GET", - "path" : "/get" - }, - "httpResponse" : { - "body" : "{\"value\": \"get:ok\"}" - } -}' - -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d '{ - "httpRequest" : { - "method" : "POST", - "path" : "/post" - }, - "httpResponse" : { - "body" : "{\"value\": \"post:ok\"}" - } -}' - -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d '{ - "httpRequest" : { - "method" : "PUT", - "path" : "/put" - }, - "httpResponse" : { - "body" : "{\"value\": \"put:ok\"}" - } -}' - -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d '{ - "httpRequest" : { - "method" : "PATCH", - "path" : "/patch" - }, - "httpResponse" : { - "body" : "{\"value\": \"patch:ok\"}" - } -}' - -curl -v -X PUT "http://$MOCKSERVER_URL:$MOCKSERVER_PORT/mockserver/expectation" -d '{ - "httpRequest" : { - "method" : "DELETE", - "path" : "/delete" - }, - "httpResponse" : { - "body" : "{\"value\": \"delete:ok\"}" - } -}' diff --git a/cds-regression-test/test/test/resource-resolution/resource-resolution-enrichment-test.sh b/cds-regression-test/test/test/resource-resolution/resource-resolution-enrichment-test.sh deleted file mode 100755 index 79236ae..0000000 --- a/cds-regression-test/test/test/resource-resolution/resource-resolution-enrichment-test.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -CBA_NAME="resource-resolution" -TEST_NAME="$CBA_NAME-enrichment" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Compressing CBA: $CBA_NAME" -compress_cba $CBA_NAME - -echo "Enriching CBA: $CBA_NAME" -enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/cds-regression-test/test/test/resource-resolution/resource-resolution-upload-dd.sh b/cds-regression-test/test/test/resource-resolution/resource-resolution-upload-dd.sh deleted file mode 100755 index 96f1007..0000000 --- a/cds-regression-test/test/test/resource-resolution/resource-resolution-upload-dd.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -TEST_NAME="upload-data-dict" -TEST_NUMBER=$RANDOM -REQUEST_DD_PAYLOAD_DIR="$TEST_DIRECTORY/resource-resolution/data-dict" - -. ./$TEST_DIRECTORY/utils.sh - -# delete useless log file -rm $FAILED_TESTS_LOG - -DD_PAYLOADS=$(ls $REQUEST_DD_PAYLOAD_DIR) -for DD_PAYLOAD in $DD_PAYLOADS -do - echo "Uploading DD : $DD_PAYLOAD" - PAYLOAD_NAME=$(echo "$DD_PAYLOAD" | cut -d '.' -f1) - RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$PAYLOAD_NAME-$TEST_NUMBER-response-headers" - RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$PAYLOAD_NAME-$TEST_NUMBER-response-payload" - PAYLOAD_FILE="$REQUEST_DD_PAYLOAD_DIR/$DD_PAYLOAD" - FAILED_TESTS_LOG="$FAILED_TESTS_DIRECTORY/$TEST_NAME-$PAYLOAD_NAME-$TEST_NUMBER.log" - - # create log life - touch $FAILED_TESTS_LOG - - upload_dd $PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - - echo 'Assert status 200' - assert_status_code 200 $RESPONSE_HEADERS_FILE -done diff --git a/cds-regression-test/test/test/resource-resolution/resource-resolution-upload-test.sh b/cds-regression-test/test/test/resource-resolution/resource-resolution-upload-test.sh deleted file mode 100755 index 16c7326..0000000 --- a/cds-regression-test/test/test/resource-resolution/resource-resolution-upload-test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -CBA_NAME="resource-resolution" -TEST_NAME="$CBA_NAME-upload" -TEST_NUMBER=$RANDOM -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Uploading CBA: $CBA_NAME" -upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert status 200' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -# This step prevents a race-condition for parallel process requests -# when cba has not yet been written to filesystem -echo 'Send process request to force CDS to load CBA to filesystem' -process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/cds-regression-test/test/test/resource-resolution/success/expected-payloads/expected-response.json b/cds-regression-test/test/test/resource-resolution/success/expected-payloads/expected-response.json deleted file mode 100644 index efb6282..0000000 --- a/cds-regression-test/test/test/resource-resolution/success/expected-payloads/expected-response.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "correlationUUID": null, - "commonHeader": { - "timestamp": "2020-05-07T22:18:06.901Z", - "originatorId": "System", - "requestId": "1234", - "subRequestId": "1234-12234", - "flags": null - }, - "actionIdentifiers": { - "blueprintName": "RT-resource-resolution", - "blueprintVersion": "1.0.0", - "actionName": "resource-resolution", - "mode": "sync" - }, - "status": { - "code": 200, - "eventType": "EVENT_COMPONENT_EXECUTED", - "timestamp": "2020-05-07T22:18:22.289Z", - "errorMessage": null, - "message": "success" - }, - "payload": { - "resource-resolution-response": { - "meshed-template": { - "helloworld-velocity": "{\n \"default\": \"ok\",\n \"input\": \"ok\",\n \"script\": {\n \"python\": \"ok\",\n \"kotlin\": \"ok\"\n },\n \"db\": \"ok\",\n \"rest\": {\n \"GET\": \"get:ok\",\n \"POST\": \"post:ok\",\n \"PUT\": \"put:ok\",\n \"PATCH\": \"patch:ok\",\n \"DELETE\": \"delete:ok\"\n }\n}\n", - "helloworld-jinja": "{\n \"default\": \"ok\",\n \"input\": \"ok\",\n \"script\": {\n \"python\": \"ok\",\n \"kotlin\": {\n \"base\": \"ok\"\n \"from suspend function\": \"ok\"\n }\n },\n \"db\": \"ok\",\n \"rest\": {\n \"GET\": \"get:ok\",\n \"POST\": \"post:ok\",\n \"PUT\": \"put:ok\",\n \"PATCH\": \"patch:ok\",\n \"DELETE\": \"delete:ok\"\n }\n}\n" - } - } - } -} diff --git a/cds-regression-test/test/test/resource-resolution/success/request-payloads/request-payload.json b/cds-regression-test/test/test/resource-resolution/success/request-payloads/request-payload.json deleted file mode 100644 index 91e4612..0000000 --- a/cds-regression-test/test/test/resource-resolution/success/request-payloads/request-payload.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "commonHeader": { - "originatorId": "System", - "requestId": "1234", - "subRequestId": "1234-12234" - }, - "actionIdentifiers": { - "blueprintName": "RT-resource-resolution", - "blueprintVersion": "1.0.0", - "actionName": "resource-resolution", - "mode": "sync" - }, - "payload": { - "resource-resolution-request": { - "template-prefix": [ - "helloworld-velocity", - "helloworld-jinja" - ], - "resolution-key": "regression-test", - "resource-resolution-properties": { - "v_input": "ok", - "j_input": "ok" - } - } - } -} diff --git a/cds-regression-test/test/test/resource-resolution/success/test.sh b/cds-regression-test/test/test/resource-resolution/success/test.sh deleted file mode 100755 index c43c276..0000000 --- a/cds-regression-test/test/test/resource-resolution/success/test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -CBA_NAME="resource-resolution" -TEST_NAME="success" -TEST_NUMBER=$RANDOM - -REQUEST_PAYLOAD_DIR="request-payloads" -EXPECTED_PAYLOAD_DIR="expected-payloads" - -mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" -RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" -RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" -REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/$REQUEST_PAYLOAD_DIR/request-payload.json" -EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/$EXPECTED_PAYLOAD_DIR/expected-response.json" - -. ./$TEST_DIRECTORY/utils.sh - -echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" -process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE - -echo 'Assert statuscode' -assert_status_code 200 $RESPONSE_HEADERS_FILE - -echo 'Assert payload' -assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/cds-regression-test/test/test/utils.sh b/cds-regression-test/test/test/utils.sh deleted file mode 100755 index a8766d3..0000000 --- a/cds-regression-test/test/test/utils.sh +++ /dev/null @@ -1,242 +0,0 @@ -#ssert_status_code()!/bin/bash -FAILED_TESTS_LOG="$FAILED_TESTS_DIRECTORY/$TEST_NAME-$RANDOM.log" - -touch $FAILED_TESTS_LOG - -# ------------------------------------------------------------------ -# CDS API -# ------------------------------------------------------------------ -CDS_AUTHORIZATION="Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==" -AUTHORIZATION_HEADER="Authorization: $CDS_AUTHORIZATION" -CONTENT_TYPE_FORM_DATA="Content-Type: multipart/form-data" -CONTENT_TYPE_APPLICATION_JSON="Content-Type: application/json" -BOOTSTRAP_ENDPOINT="api/v1/blueprint-model/bootstrap" - -# Input Arguments: -# 1. CBA name -compress_cba() { - pushd $CBA_DIRECTORY/$1 - zip -r ../$1.zip . - popd -} - - # Input Arguments: - # 1. CBA name -compress_cba_versioned() { - pushd "$CBA_DIRECTORY/$1/$CDS_VERSION" - zip -r ../../$1.zip . - popd -} - -# Sends CBA to CDS for enrichment -# -# Input Arguments: -# 1. CBA name -# 2. filepath for response header output -enrich_cba() { - curl -vs http://$CDS_URL_REGRESSION_TEST:$RUNTIME_PORT/$ENRICH_URI \ - -H "$CONTENT_TYPE_FORM_DATA" \ - -H "$AUTHORIZATION_HEADER" \ - -F file="@$CBA_DIRECTORY/$1.zip" \ - -o "$CBA_ENRICHED_FOLDER/$1.zip" \ - 2> $2 -} - -# Uploads CBA to CDS -# -# Input Arguments: -# 1. CBA name -# 2. filepath for response payload output -# 3. filepath for response header output -upload_cba() { - if [ "${CDS_VERSION} " == "elalto " ]; then - UPLOAD_ENDPOINT=${UPLOAD_URI_ELALTO} - else - UPLOAD_ENDPOINT=${UPLOAD_URI_FRANKFURT} - fi - curl -vs http://$CDS_URL_REGRESSION_TEST:$RUNTIME_PORT/${UPLOAD_ENDPOINT} \ - -H "$CONTENT_TYPE_FORM_DATA" \ - -H "$AUTHORIZATION_HEADER" \ - -F file="@$CBA_ENRICHED_FOLDER/$1.zip" \ - > $2 \ - 2> $3 -} - -# Uploads DD to CDS -# -# Input Arguments: -# 1. filepath for request payload json file -# 2. filepath for response payload output -# 3. filepath for response header output -upload_dd() { - curl -vs http://$CDS_URL_REGRESSION_TEST:$RUNTIME_PORT/$LOAD_DATA_DICT \ - -H "$CONTENT_TYPE_APPLICATION_JSON" \ - -H "$AUTHORIZATION_HEADER" \ - --data "@$1" \ - >$2 \ - 2> $3 -} - -# Sends process request to CDS -# -# Input Arguments: -# 1. filepath for request payload json file -# 2. filepath for response payload output -# 3. filepath for response header output -process_cba() { - curl -vs http://$CDS_URL_REGRESSION_TEST:$RUNTIME_PORT/$PROCESS_URI \ - -H "$CONTENT_TYPE_APPLICATION_JSON" \ - -H "$AUTHORIZATION_HEADER" \ - --data "@$1" \ - >$2 \ - 2> $3 -} - -# Bootstrap CDS request (Frankfurt and up) -# Input arguments: -# 1. filepath for response payload output -# 2. filepath for response header output -bootstrap_cds() { - curl -vs http://$CDS_URL_REGRESSION_TEST:$RUNTIME_PORT/${BOOTSTRAP_ENDPOINT} \ - -H "$CONTENT_TYPE_APPLICATION_JSON" \ - -H "$AUTHORIZATION_HEADER" \ - --data-raw '{ - "loadModelType" : true, - "loadResourceDictionary" : true, - "loadCBA" : false -}'>$1 2>$2 - -} - -# ------------------------------------------------------------------ -# Blueprint modifications -# ------------------------------------------------------------------ - - -# Sets a value in the definition json file -# Input arguments -# 1: CBA name -# 1: jq path for value to be set -# 2: value -definition_set_value() { - local BLUEPRINT_DEFINITION_FILE=`grep "Entry" $CBA_DIRECTORY/$1/TOSCA-Metadata/TOSCA.meta|awk '{ print $2 }'` - local TEMPFILE=`mktemp` - jq "$2=$3" < $CBA_DIRECTORY/$1/$BLUEPRINT_DEFINITION_FILE > $TEMPFILE - mv $TEMPFILE $CBA_DIRECTORY/$1/$BLUEPRINT_DEFINITION_FILE -} - -# Makes environment variables available for json templating using jq path -# example template { "cds-version": .CDS_VERSION } - will populate value CDS_VERSION from env -# Input arguments -# 1: template file -apply_env_to_json_template() { - local TEMPFILE=`mktemp` - jq -n env|jq -f $1 > $TEMPFILE - mv $TEMPFILE $1 -} - -# ------------------------------------------------------------------ -# Assert Functions -# ------------------------------------------------------------------ - -match() { - local input="$(cat)" - local m="$(grep -o "$1" <<<"$input")" - test "$m" || tee -a $FAILED_TESTS_LOG < $EXPECTED - jq 'del(.correlationUUID,.[].timestamp?)' < $2 > $ACTUAL - assert_json_equals $EXPECTED $ACTUAL -} - -# Asserts response status code -# -# Input arguments: -# 1. expected response code, eg. 200 -# 2. filepath for response header file - -assert_status_code() { match "^< HTTP/.* $1 " < $2; } - -# Asserts respones status code (CDS version-dependent) -# For elalto, we look for the code as returned by the query, -# but not elalto (frankfurt and onward,) we look for json return object .status.code -# Input arguments: -# 1. expected response code, eg. 200 -# 2. filepath for response header file -# 2. filepath for response payload file -assert_status_code_versioned() { - if [ "${CDS_VERSION}" == "elalto" ]; then - match "^< HTTP/.* $1 " < $2; - else - assert_json_property_equals '.status.code' $1 $3 - fi -} - -exit_on_errors() { - if [ -s $FAILED_TESTS_LOG ] - then exit 1 - fi -} diff --git a/cds-regression-test/test/utils.sh b/cds-regression-test/test/utils.sh deleted file mode 100755 index a8766d3..0000000 --- a/cds-regression-test/test/utils.sh +++ /dev/null @@ -1,242 +0,0 @@ -#ssert_status_code()!/bin/bash -FAILED_TESTS_LOG="$FAILED_TESTS_DIRECTORY/$TEST_NAME-$RANDOM.log" - -touch $FAILED_TESTS_LOG - -# ------------------------------------------------------------------ -# CDS API -# ------------------------------------------------------------------ -CDS_AUTHORIZATION="Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==" -AUTHORIZATION_HEADER="Authorization: $CDS_AUTHORIZATION" -CONTENT_TYPE_FORM_DATA="Content-Type: multipart/form-data" -CONTENT_TYPE_APPLICATION_JSON="Content-Type: application/json" -BOOTSTRAP_ENDPOINT="api/v1/blueprint-model/bootstrap" - -# Input Arguments: -# 1. CBA name -compress_cba() { - pushd $CBA_DIRECTORY/$1 - zip -r ../$1.zip . - popd -} - - # Input Arguments: - # 1. CBA name -compress_cba_versioned() { - pushd "$CBA_DIRECTORY/$1/$CDS_VERSION" - zip -r ../../$1.zip . - popd -} - -# Sends CBA to CDS for enrichment -# -# Input Arguments: -# 1. CBA name -# 2. filepath for response header output -enrich_cba() { - curl -vs http://$CDS_URL_REGRESSION_TEST:$RUNTIME_PORT/$ENRICH_URI \ - -H "$CONTENT_TYPE_FORM_DATA" \ - -H "$AUTHORIZATION_HEADER" \ - -F file="@$CBA_DIRECTORY/$1.zip" \ - -o "$CBA_ENRICHED_FOLDER/$1.zip" \ - 2> $2 -} - -# Uploads CBA to CDS -# -# Input Arguments: -# 1. CBA name -# 2. filepath for response payload output -# 3. filepath for response header output -upload_cba() { - if [ "${CDS_VERSION} " == "elalto " ]; then - UPLOAD_ENDPOINT=${UPLOAD_URI_ELALTO} - else - UPLOAD_ENDPOINT=${UPLOAD_URI_FRANKFURT} - fi - curl -vs http://$CDS_URL_REGRESSION_TEST:$RUNTIME_PORT/${UPLOAD_ENDPOINT} \ - -H "$CONTENT_TYPE_FORM_DATA" \ - -H "$AUTHORIZATION_HEADER" \ - -F file="@$CBA_ENRICHED_FOLDER/$1.zip" \ - > $2 \ - 2> $3 -} - -# Uploads DD to CDS -# -# Input Arguments: -# 1. filepath for request payload json file -# 2. filepath for response payload output -# 3. filepath for response header output -upload_dd() { - curl -vs http://$CDS_URL_REGRESSION_TEST:$RUNTIME_PORT/$LOAD_DATA_DICT \ - -H "$CONTENT_TYPE_APPLICATION_JSON" \ - -H "$AUTHORIZATION_HEADER" \ - --data "@$1" \ - >$2 \ - 2> $3 -} - -# Sends process request to CDS -# -# Input Arguments: -# 1. filepath for request payload json file -# 2. filepath for response payload output -# 3. filepath for response header output -process_cba() { - curl -vs http://$CDS_URL_REGRESSION_TEST:$RUNTIME_PORT/$PROCESS_URI \ - -H "$CONTENT_TYPE_APPLICATION_JSON" \ - -H "$AUTHORIZATION_HEADER" \ - --data "@$1" \ - >$2 \ - 2> $3 -} - -# Bootstrap CDS request (Frankfurt and up) -# Input arguments: -# 1. filepath for response payload output -# 2. filepath for response header output -bootstrap_cds() { - curl -vs http://$CDS_URL_REGRESSION_TEST:$RUNTIME_PORT/${BOOTSTRAP_ENDPOINT} \ - -H "$CONTENT_TYPE_APPLICATION_JSON" \ - -H "$AUTHORIZATION_HEADER" \ - --data-raw '{ - "loadModelType" : true, - "loadResourceDictionary" : true, - "loadCBA" : false -}'>$1 2>$2 - -} - -# ------------------------------------------------------------------ -# Blueprint modifications -# ------------------------------------------------------------------ - - -# Sets a value in the definition json file -# Input arguments -# 1: CBA name -# 1: jq path for value to be set -# 2: value -definition_set_value() { - local BLUEPRINT_DEFINITION_FILE=`grep "Entry" $CBA_DIRECTORY/$1/TOSCA-Metadata/TOSCA.meta|awk '{ print $2 }'` - local TEMPFILE=`mktemp` - jq "$2=$3" < $CBA_DIRECTORY/$1/$BLUEPRINT_DEFINITION_FILE > $TEMPFILE - mv $TEMPFILE $CBA_DIRECTORY/$1/$BLUEPRINT_DEFINITION_FILE -} - -# Makes environment variables available for json templating using jq path -# example template { "cds-version": .CDS_VERSION } - will populate value CDS_VERSION from env -# Input arguments -# 1: template file -apply_env_to_json_template() { - local TEMPFILE=`mktemp` - jq -n env|jq -f $1 > $TEMPFILE - mv $TEMPFILE $1 -} - -# ------------------------------------------------------------------ -# Assert Functions -# ------------------------------------------------------------------ - -match() { - local input="$(cat)" - local m="$(grep -o "$1" <<<"$input")" - test "$m" || tee -a $FAILED_TESTS_LOG < $EXPECTED - jq 'del(.correlationUUID,.[].timestamp?)' < $2 > $ACTUAL - assert_json_equals $EXPECTED $ACTUAL -} - -# Asserts response status code -# -# Input arguments: -# 1. expected response code, eg. 200 -# 2. filepath for response header file - -assert_status_code() { match "^< HTTP/.* $1 " < $2; } - -# Asserts respones status code (CDS version-dependent) -# For elalto, we look for the code as returned by the query, -# but not elalto (frankfurt and onward,) we look for json return object .status.code -# Input arguments: -# 1. expected response code, eg. 200 -# 2. filepath for response header file -# 2. filepath for response payload file -assert_status_code_versioned() { - if [ "${CDS_VERSION}" == "elalto" ]; then - match "^< HTTP/.* $1 " < $2; - else - assert_json_property_equals '.status.code' $1 $3 - fi -} - -exit_on_errors() { - if [ -s $FAILED_TESTS_LOG ] - then exit 1 - fi -} diff --git a/test/ansible-python-dg/ansible-python-dg-enrichment-test.sh b/test/ansible-python-dg/ansible-python-dg-enrichment-test.sh new file mode 100644 index 0000000..ea41c92 --- /dev/null +++ b/test/ansible-python-dg/ansible-python-dg-enrichment-test.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="ansible-python-dg" +TEST_NAME="$CBA_NAME-enrichment" +TEST_NUMBER=$RANDOM +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" + +. ./$TEST_DIRECTORY/utils.sh + +export MOCK_SRV="http://cds-regression-mockserver/mock-$CI_PIPELINE_ID/ansible-python-dg/success" +export CMD_EXEC_SVC=${CMD_EXEC_SVC:-"cds-command-executor"} +apply_env_to_definition $CBA_NAME + +echo "Compressing CBA: $CBA_NAME" +compress_cba $CBA_NAME + +echo "Enriching CBA: $CBA_NAME" +enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE + +echo 'Assert status 200' +assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/test/ansible-python-dg/ansible-python-dg-upload-test.sh b/test/ansible-python-dg/ansible-python-dg-upload-test.sh new file mode 100644 index 0000000..568bb40 --- /dev/null +++ b/test/ansible-python-dg/ansible-python-dg-upload-test.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="ansible-python-dg" +TEST_NAME="$CBA_NAME-upload" +TEST_NUMBER=$RANDOM +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" +REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Uploading CBA: $CBA_NAME" +upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert status 200' +assert_status_code 200 $RESPONSE_HEADERS_FILE + +# This step prevents a race-condition for parallel process requests +# when cba has not yet been written to filesystem +echo 'Send process request to force CDS to load CBA to filesystem' +process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/test/ansible-python-dg/dummy-request-payload.json b/test/ansible-python-dg/dummy-request-payload.json new file mode 100644 index 0000000..f04d745 --- /dev/null +++ b/test/ansible-python-dg/dummy-request-payload.json @@ -0,0 +1,14 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "dummy-request-should-fail", + "subRequestId": "1" + }, + "actionIdentifiers": { + "blueprintName": "RT-ansible-python-dg", + "blueprintVersion": "1.0.0", + "actionName": "dummy", + "mode": "sync" + }, + "payload": {} +} diff --git a/test/ansible-python-dg/init-mockserver.sh b/test/ansible-python-dg/init-mockserver.sh new file mode 100644 index 0000000..42122d3 --- /dev/null +++ b/test/ansible-python-dg/init-mockserver.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# +. ./$TEST_DIRECTORY/utils.sh + +CBA_NAME="ansible-python-dg" +DIR_PAYLOADS="$TEST_DIRECTORY/$CBA_NAME/mock-payloads" + +OP=expectation +if [[ $1 == rm ]]; then + OP=clear +fi + +# JOB TEMPLATE +echo "Mocking Job Template route..." +export PATH_JT_PAYLOAD="/mock-$CI_PIPELINE_ID/ansible-python-dg/success/api/v2/job_templates/hello_world_job_template/" +JT_PAYLOAD="$DIR_PAYLOADS/job-template.json" +apply_env_to_json_template $JT_PAYLOAD +curl -vLk -X PUT "http://$CLUSTER_IP:$MOCKSERVER_NODEPORT/mockserver/$OP" -d "@$JT_PAYLOAD" + +# JOB TEMPLATE LAUNCH - GET +echo "Mocking Job Template Launch GET route..." +export PATH_GET_JT_LAUNCH_PAYLOAD="/mock-$CI_PIPELINE_ID/ansible-python-dg/success/api/v2/job_templates/123/launch/" +GET_JT_LAUNCH_PAYLOAD="$DIR_PAYLOADS/get_job-template-launch.json" +apply_env_to_json_template $GET_JT_LAUNCH_PAYLOAD +curl -vLk -X PUT "http://$CLUSTER_IP:$MOCKSERVER_NODEPORT/mockserver/$OP" -d "@$GET_JT_LAUNCH_PAYLOAD" + +# JOB TEMPLATE LAUNCH +echo "Mocking Inventory route..." +export PATH_INVENTORY="/mock-$CI_PIPELINE_ID/ansible-python-dg/success/api/v2/inventories/" +INVENTORY_PAYLOAD="$DIR_PAYLOADS/inventory.json" +apply_env_to_json_template $INVENTORY_PAYLOAD +curl -vLk -X PUT "http://$CLUSTER_IP:$MOCKSERVER_NODEPORT/mockserver/$OP" -d "@$INVENTORY_PAYLOAD" + +# JOB TEMPLATE LAUNCH - POST +echo "Mocking Job Template Launch POST route..." +export PATH_POST_JT_LAUNCH_PAYLOAD="/mock-$CI_PIPELINE_ID/ansible-python-dg/success/api/v2/job_templates/123/launch/" +POST_JT_LAUNCH_PAYLOAD="$DIR_PAYLOADS/post_job-template-launch.json" +apply_env_to_json_template $POST_JT_LAUNCH_PAYLOAD +curl -vLk -X PUT "http://$CLUSTER_IP:$MOCKSERVER_NODEPORT/mockserver/$OP" -d "@$POST_JT_LAUNCH_PAYLOAD" + +# JOB EXECUTION +echo "Mocking Job Execution route..." +export PATH_JOB_EXECUTION_PAYLOAD="/mock-$CI_PIPELINE_ID/ansible-python-dg/success/api/v2/jobs/456/" +JOB_EXECUTION_PAYLOAD="$DIR_PAYLOADS/job-execution.json" +apply_env_to_json_template $JOB_EXECUTION_PAYLOAD +curl -vLk -X PUT "http://$CLUSTER_IP:$MOCKSERVER_NODEPORT/mockserver/$OP" -d "@$JOB_EXECUTION_PAYLOAD" + +# JOB OUTPUT +echo "Mocking Job Output route..." +export PATH_JOB_OUTPUT_PAYLOAD="/mock-$CI_PIPELINE_ID/ansible-python-dg/success/api/v2/jobs/456/stdout/" +JOB_OUTPUT_PAYLOAD="$DIR_PAYLOADS/job-output.json" +apply_env_to_json_template $JOB_OUTPUT_PAYLOAD +curl -vLk -X PUT "http://$CLUSTER_IP:$MOCKSERVER_NODEPORT/mockserver/$OP" -d "@$JOB_OUTPUT_PAYLOAD" diff --git a/test/ansible-python-dg/mock-payloads/get_job-template-launch.json b/test/ansible-python-dg/mock-payloads/get_job-template-launch.json new file mode 100644 index 0000000..ddc9e17 --- /dev/null +++ b/test/ansible-python-dg/mock-payloads/get_job-template-launch.json @@ -0,0 +1,46 @@ +{ + "httpRequest" : { + "method" : "GET", + "path" : .PATH_GET_JT_LAUNCH_PAYLOAD + }, + "httpResponse" : { + "body" : { + "can_start_without_user_input": false, + "passwords_needed_to_start": [], + "ask_variables_on_launch": true, + "ask_tags_on_launch": true, + "ask_diff_mode_on_launch": false, + "ask_skip_tags_on_launch": true, + "ask_job_type_on_launch": false, + "ask_limit_on_launch": true, + "ask_verbosity_on_launch": false, + "ask_inventory_on_launch": true, + "ask_credential_on_launch": true, + "survey_enabled": true, + "variables_needed_to_start": [ + "tor_group", + "site_id" + ], + "credential_needed_to_start": false, + "inventory_needed_to_start": false, + "job_template_data": { + "name": "hello_world_job_template", + "id": "123", + "description": "hello_world Runner Job Template" + }, + "defaults": { + "extra_vars": "", + "diff_mode": false, + "limit": "", + "job_tags": "", + "skip_tags": "", + "job_type": "run", + "verbosity": 0, + "inventory": { + "name": "Demo Inventory", + "id": 1 + } + } + } + } +} diff --git a/test/ansible-python-dg/mock-payloads/inventory.json b/test/ansible-python-dg/mock-payloads/inventory.json new file mode 100644 index 0000000..9fd5ba1 --- /dev/null +++ b/test/ansible-python-dg/mock-payloads/inventory.json @@ -0,0 +1,110 @@ +{ + "httpRequest" : { + "method" : "GET", + "path" : .PATH_INVENTORY + }, + "httpResponse" : { + "body" : { + "count": 1, + "next": null, + "previous": null, + "results": [ + { + "id": 1, + "type": "inventory", + "url": "/api/v2/inventories/1/", + "related": { + "created_by": "/api/v2/users/1/", + "modified_by": "/api/v2/users/1/", + "hosts": "/api/v2/inventories/1/hosts/", + "groups": "/api/v2/inventories/1/groups/", + "root_groups": "/api/v2/inventories/1/root_groups/", + "variable_data": "/api/v2/inventories/1/variable_data/", + "script": "/api/v2/inventories/1/script/", + "tree": "/api/v2/inventories/1/tree/", + "inventory_sources": "/api/v2/inventories/1/inventory_sources/", + "update_inventory_sources": "/api/v2/inventories/1/update_inventory_sources/", + "activity_stream": "/api/v2/inventories/1/activity_stream/", + "job_templates": "/api/v2/inventories/1/job_templates/", + "ad_hoc_commands": "/api/v2/inventories/1/ad_hoc_commands/", + "access_list": "/api/v2/inventories/1/access_list/", + "object_roles": "/api/v2/inventories/1/object_roles/", + "instance_groups": "/api/v2/inventories/1/instance_groups/", + "copy": "/api/v2/inventories/1/copy/", + "organization": "/api/v2/organizations/1/" + }, + "summary_fields": { + "organization": { + "id": 1, + "name": "Default", + "description": "" + }, + "created_by": { + "id": 1, + "username": "admin", + "first_name": "", + "last_name": "" + }, + "modified_by": { + "id": 1, + "username": "admin", + "first_name": "", + "last_name": "" + }, + "object_roles": { + "admin_role": { + "description": "Can manage all aspects of the inventory", + "name": "Admin", + "id": 21 + }, + "update_role": { + "description": "May update project or inventory or group using the configured source update system", + "name": "Update", + "id": 22 + }, + "adhoc_role": { + "description": "May run ad hoc commands on an inventory", + "name": "Ad Hoc", + "id": 23 + }, + "use_role": { + "description": "Can use the inventory in a job template", + "name": "Use", + "id": 24 + }, + "read_role": { + "description": "May view settings for the inventory", + "name": "Read", + "id": 25 + } + }, + "user_capabilities": { + "edit": true, + "delete": true, + "copy": true, + "adhoc": true + } + }, + "created": "2019-05-21T15:45:31.954359Z", + "modified": "2019-05-21T15:45:31.954378Z", + "name": "Demo Inventory", + "description": "", + "organization": 1, + "kind": "", + "host_filter": null, + "variables": "", + "has_active_failures": false, + "total_hosts": 1, + "hosts_with_active_failures": 0, + "total_groups": 0, + "groups_with_active_failures": 0, + "has_inventory_sources": false, + "total_inventory_sources": 0, + "inventory_sources_with_failures": 0, + "insights_credential": null, + "pending_deletion": false + } + ] + } + } +} diff --git a/test/ansible-python-dg/mock-payloads/job-execution.json b/test/ansible-python-dg/mock-payloads/job-execution.json new file mode 100644 index 0000000..b32e7c0 --- /dev/null +++ b/test/ansible-python-dg/mock-payloads/job-execution.json @@ -0,0 +1,216 @@ +{ + "httpRequest" : { + "method" : "GET", + "path" : .PATH_JOB_EXECUTION_PAYLOAD + }, + "httpResponse" : { + "body" : { + "id": "456", + "type": "job", + "url": "/api/v2/jobs/456/", + "related": { + "created_by": "/api/v2/users/1/", + "labels": "/api/v2/jobs/456/labels/", + "inventory": "/api/v2/inventories/1/", + "project": "/api/v2/projects/8/", + "extra_credentials": "/api/v2/jobs/456/extra_credentials/", + "credentials": "/api/v2/jobs/456/credentials/", + "unified_job_template": "/api/v2/job_templates/123/", + "stdout": "/api/v2/jobs/456/stdout/", + "job_events": "/api/v2/jobs/456/job_events/", + "job_host_summaries": "/api/v2/jobs/456/job_host_summaries/", + "activity_stream": "/api/v2/jobs/456/activity_stream/", + "notifications": "/api/v2/jobs/456/notifications/", + "job_template": "/api/v2/job_templates/123/", + "cancel": "/api/v2/jobs/456/cancel/", + "create_schedule": "/api/v2/jobs/456/create_schedule/", + "relaunch": "/api/v2/jobs/456/relaunch/" + }, + "summary_fields": { + "inventory": { + "id": 1, + "name": "Demo Inventory", + "description": "", + "has_active_failures": false, + "total_hosts": 1, + "hosts_with_active_failures": 0, + "total_groups": 0, + "groups_with_active_failures": 0, + "has_inventory_sources": false, + "total_inventory_sources": 0, + "inventory_sources_with_failures": 0, + "organization_id": 1, + "kind": "" + }, + "project": { + "id": 8, + "name": "cds_playbooks", + "description": "CDS - cds_playbooks Project", + "status": "ok", + "scm_type": "" + }, + "job_template": { + "id": "123", + "name": "hello_world_job_template", + "description": "hello_world Runner Job Template" + }, + "unified_job_template": { + "id": "123", + "name": "hello_world_job_template", + "description": "hello_world Runner Job Template", + "unified_job_type": "job" + }, + "instance_group": { + "name": "tower", + "id": 1 + }, + "created_by": { + "id": 1, + "username": "admin", + "first_name": "", + "last_name": "" + }, + "user_capabilities": { + "delete": true, + "start": true + }, + "labels": { + "count": 0, + "results": [] + }, + "extra_credentials": [], + "credentials": [] + }, + "created": "2019-06-12T11:21:26.891986Z", + "modified": "2019-06-12T11:21:27.355185Z", + "name": "hello_world_job_template", + "description": "hello_world Runner Job Template", + "job_type": "run", + "inventory": 1, + "project": 8, + "playbook": "hello_world.yml", + "forks": 0, + "limit": "", + "verbosity": 0, + "extra_vars": "{\"tor_group\": \"vEPC\", \"site_id\": \"3 - Belmont\"}", + "job_tags": "", + "force_handlers": false, + "skip_tags": "", + "start_at_task": "", + "timeout": 0, + "use_fact_cache": false, + "unified_job_template": "123", + "launch_type": "manual", + "status": "successful", + "failed": false, + "started": "2019-06-12T11:21:27.510766Z", + "finished": "2019-06-12T11:21:48.993385Z", + "elapsed": 21.483, + "job_args": "[\"ansible-playbook\", \"-u\", \"root\", \"-i\", \"/tmp/awx_223_ft8hu4p4/tmptmtwllu4\", \"-e\", \"@/tmp/awx_223_ft8hu4p4/env/extravars\", \"hello_world.yml\"]", + "job_cwd": "/var/lib/awx/projects/cds_playbooks_folder", + "job_env": { + "HOSTNAME": "awx", + "LC_ALL": "en_US.UTF-8", + "VIRTUAL_ENV": "/var/lib/awx/venv/ansible", + "PATH": "/var/lib/awx/venv/ansible/bin:/var/lib/awx/venv/awx/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", + "SUPERVISOR_GROUP_NAME": "tower-processes", + "PWD": "/var/lib/awx", + "LANG": "en_US.UTF-8", + "PS1": "(awx) ", + "SUPERVISOR_ENABLED": "1", + "HOME": "/var/lib/awx", + "SHLVL": "2", + "LANGUAGE": "en_US.UTF-8", + "LC_CTYPE": "en_US.UTF-8", + "SUPERVISOR_PROCESS_NAME": "dispatcher", + "SUPERVISOR_SERVER_URL": "unix:///tmp/supervisor.sock", + "DJANGO_SETTINGS_MODULE": "awx.settings.production", + "DJANGO_LIVE_TEST_SERVER_ADDRESS": "localhost:9013-9199", + "TZ": "UTC", + "ANSIBLE_FORCE_COLOR": "True", + "ANSIBLE_HOST_KEY_CHECKING": "False", + "ANSIBLE_INVENTORY_UNPARSED_FAILED": "True", + "ANSIBLE_PARAMIKO_RECORD_HOST_KEYS": "False", + "ANSIBLE_VENV_PATH": "/var/lib/awx/venv/ansible", + "AWX_PRIVATE_DATA_DIR": "/tmp/awx_223_ft8hu4p4", + "PYTHONPATH": "/var/lib/awx/venv/ansible/lib/python2.7/site-packages:/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/lib:", + "JOB_ID": "456", + "INVENTORY_ID": "1", + "PROJECT_REVISION": "", + "ANSIBLE_RETRY_FILES_ENABLED": "False", + "MAX_EVENT_RES": "700000", + "ANSIBLE_CALLBACK_PLUGINS": "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/plugins/callback", + "AWX_HOST": "https://towerhost", + "ANSIBLE_SSH_CONTROL_PATH_DIR": "/tmp/awx_223_ft8hu4p4/cp", + "ANSIBLE_STDOUT_CALLBACK": "awx_display", + "AWX_ISOLATED_DATA_DIR": "/tmp/awx_223_ft8hu4p4/artifacts/456" + }, + "job_explanation": "", + "execution_node": "awx", + "controller_node": "", + "result_traceback": "", + "event_processing_finished": true, + "job_template": "123", + "passwords_needed_to_start": [], + "ask_diff_mode_on_launch": false, + "ask_variables_on_launch": true, + "ask_limit_on_launch": true, + "ask_tags_on_launch": true, + "ask_skip_tags_on_launch": true, + "ask_job_type_on_launch": false, + "ask_verbosity_on_launch": false, + "ask_inventory_on_launch": true, + "ask_credential_on_launch": true, + "allow_simultaneous": false, + "artifacts": { + "interface_groups": [ + "NSO-Openstack-NFVI-SRIOV-Shared" + ], + "host_groups": "NSO-Openstack-NFVI-SRIOV-Shared_999, ", + "topology": { + "tor-8.tenlab-cloud": [ + { + "interface_lldp_description": "sriov-s-2", + "interface_group": "NSO-Openstack-NFVI-SRIOV-Shared", + "lldp_interface_id": 740, + "compute_device": "nfvi-compute-14.tenlab-nfvi", + "interface_parent_name": null, + "interface_name": "TenGigE0/0/0/19", + "host_aggregate": "vLNS", + "tor_device": "tor-8.tenlab-cloud", + "compute_interface": "sriov-s-2" + } + ], + "tor-7.tenlab-cloud": [ + { + "interface_lldp_description": "sriov-s-1", + "interface_group": "NSO-Openstack-NFVI-SRIOV-Shared", + "lldp_interface_id": 698, + "compute_device": "nfvi-compute-14.tenlab-nfvi", + "interface_parent_name": null, + "interface_name": "TenGigE0/0/0/19", + "host_aggregate": "vLNS", + "tor_device": "tor-7.tenlab-cloud", + "compute_interface": "sriov-s-1" + } + ] + } + }, + "scm_revision": "", + "instance_group": 1, + "diff_mode": false, + "job_slice_number": 0, + "job_slice_count": 1, + "host_status_counts": { + "ok": 1 + }, + "playbook_counts": { + "play_count": 1, + "task_count": 2 + }, + "custom_virtualenv": "/var/lib/awx/venv/ansible", + "credential": null, + "vault_credential": null + } + } +} diff --git a/test/ansible-python-dg/mock-payloads/job-output.json b/test/ansible-python-dg/mock-payloads/job-output.json new file mode 100644 index 0000000..cd861c3 --- /dev/null +++ b/test/ansible-python-dg/mock-payloads/job-output.json @@ -0,0 +1,24 @@ +{ + "httpRequest" : { + "method" : "GET", + "path" : .PATH_JOB_OUTPUT_PAYLOAD + }, + "httpResponse" : { + "body" : " + + PLAY [Hello World Sample] ****************************************************** + + TASK [Gathering Facts] ********************************************************* + ok: [localhost] + + TASK [Hello Message] *********************************************************** + ok: [localhost] => { + \"msg\": \"Hello World!\" + } + + PLAY RECAP ********************************************************************* + localhost : ok=2 changed=0 unreachable=0 failed=0 + +" + } +} diff --git a/test/ansible-python-dg/mock-payloads/job-template.json b/test/ansible-python-dg/mock-payloads/job-template.json new file mode 100644 index 0000000..942bed2 --- /dev/null +++ b/test/ansible-python-dg/mock-payloads/job-template.json @@ -0,0 +1,224 @@ +{ + "httpRequest" : { + "method" : "GET", + "path" : .PATH_JT_PAYLOAD + }, + "httpResponse" : { + "body" : { + "id": "123", + "type": "job_template", + "url": "/api/v2/job_templates/123/", + "related": { + "named_url": "/api/v2/job_templates/hello_world_job_template/", + "created_by": "/api/v2/users/1/", + "modified_by": "/api/v2/users/1/", + "labels": "/api/v2/job_templates/123/labels/", + "inventory": "/api/v2/inventories/1/", + "project": "/api/v2/projects/8/", + "extra_credentials": "/api/v2/job_templates/123/extra_credentials/", + "credentials": "/api/v2/job_templates/123/credentials/", + "last_job": "/api/v2/jobs/222/", + "jobs": "/api/v2/job_templates/123/jobs/", + "schedules": "/api/v2/job_templates/123/schedules/", + "activity_stream": "/api/v2/job_templates/123/activity_stream/", + "launch": "/api/v2/job_templates/123/launch/", + "notification_templates_any": "/api/v2/job_templates/123/notification_templates_any/", + "notification_templates_success": "/api/v2/job_templates/123/notification_templates_success/", + "notification_templates_error": "/api/v2/job_templates/123/notification_templates_error/", + "access_list": "/api/v2/job_templates/123/access_list/", + "survey_spec": "/api/v2/job_templates/123/survey_spec/", + "object_roles": "/api/v2/job_templates/123/object_roles/", + "instance_groups": "/api/v2/job_templates/123/instance_groups/", + "slice_workflow_jobs": "/api/v2/job_templates/123/slice_workflow_jobs/", + "copy": "/api/v2/job_templates/123/copy/" + }, + "summary_fields": { + "inventory": { + "id": 1, + "name": "Demo Inventory", + "description": "", + "has_active_failures": false, + "total_hosts": 1, + "hosts_with_active_failures": 0, + "total_groups": 0, + "groups_with_active_failures": 0, + "has_inventory_sources": false, + "total_inventory_sources": 0, + "inventory_sources_with_failures": 0, + "organization_id": 1, + "kind": "" + }, + "project": { + "id": 8, + "name": "cds_playbooks", + "description": "CDS - cds_playbooks Project", + "status": "ok", + "scm_type": "" + }, + "last_job": { + "id": 222, + "name": "hello_world_job_template", + "description": "hello_world Runner Job Template", + "finished": "2019-06-12T11:20:27.892787Z", + "status": "successful", + "failed": false + }, + "last_update": { + "id": 222, + "name": "hello_world_job_template", + "description": "hello_world Runner Job Template", + "status": "successful", + "failed": false + }, + "created_by": { + "id": 1, + "username": "admin", + "first_name": "", + "last_name": "" + }, + "modified_by": { + "id": 1, + "username": "admin", + "first_name": "", + "last_name": "" + }, + "object_roles": { + "admin_role": { + "description": "Can manage all aspects of the job template", + "name": "Admin", + "id": 51 + }, + "execute_role": { + "description": "May run the job template", + "name": "Execute", + "id": 52 + }, + "read_role": { + "description": "May view settings for the job template", + "name": "Read", + "id": 53 + } + }, + "user_capabilities": { + "edit": true, + "delete": true, + "start": true, + "schedule": true, + "copy": true + }, + "labels": { + "count": 0, + "results": [] + }, + "survey": { + "title": "", + "description": "" + }, + "recent_jobs": [ + { + "id": 222, + "status": "successful", + "finished": "2019-06-12T11:20:27.892787Z", + "type": "job" + }, + { + "id": 65, + "status": "successful", + "finished": "2019-06-03T18:27:19.114796Z", + "type": "job" + }, + { + "id": 64, + "status": "successful", + "finished": "2019-06-03T18:26:53.606618Z", + "type": "job" + }, + { + "id": 63, + "status": "successful", + "finished": "2019-06-03T18:24:36.072943Z", + "type": "job" + }, + { + "id": 62, + "status": "successful", + "finished": "2019-06-03T18:17:50.616528Z", + "type": "job" + }, + { + "id": 61, + "status": "successful", + "finished": "2019-06-03T18:04:42.995611Z", + "type": "job" + }, + { + "id": 60, + "status": "successful", + "finished": "2019-06-03T17:47:13.983951Z", + "type": "job" + }, + { + "id": 50, + "status": "successful", + "finished": "2019-05-30T15:47:55.700161Z", + "type": "job" + }, + { + "id": 49, + "status": "successful", + "finished": "2019-05-29T14:46:51.615926Z", + "type": "job" + }, + { + "id": 47, + "status": "successful", + "finished": "2019-05-27T20:23:58.656709Z", + "type": "job" + } + ], + "extra_credentials": [], + "credentials": [] + }, + "created": "2019-05-21T19:28:05.953730Z", + "modified": "2019-05-21T20:06:55.728697Z", + "name": "hello_world_job_template", + "description": "hello_world Runner Job Template", + "job_type": "run", + "inventory": 1, + "project": 8, + "playbook": "hello_world.yml", + "forks": 0, + "limit": "", + "verbosity": 0, + "extra_vars": "", + "job_tags": "", + "force_handlers": false, + "skip_tags": "", + "start_at_task": "", + "timeout": 0, + "use_fact_cache": false, + "last_job_run": "2019-06-12T11:20:27.892787Z", + "last_job_failed": false, + "next_job_run": null, + "status": "successful", + "host_config_key": "", + "ask_diff_mode_on_launch": false, + "ask_variables_on_launch": true, + "ask_limit_on_launch": true, + "ask_tags_on_launch": true, + "ask_skip_tags_on_launch": true, + "ask_job_type_on_launch": false, + "ask_verbosity_on_launch": false, + "ask_inventory_on_launch": true, + "ask_credential_on_launch": true, + "survey_enabled": true, + "become_enabled": false, + "diff_mode": false, + "allow_simultaneous": false, + "custom_virtualenv": null, + "job_slice_count": 1, + "credential": null, + "vault_credential": null + } + } +} diff --git a/test/ansible-python-dg/mock-payloads/post_job-template-launch.json b/test/ansible-python-dg/mock-payloads/post_job-template-launch.json new file mode 100644 index 0000000..531e471 --- /dev/null +++ b/test/ansible-python-dg/mock-payloads/post_job-template-launch.json @@ -0,0 +1,144 @@ +{ + "httpRequest" : { + "method" : "POST", + "path" : .PATH_POST_JT_LAUNCH_PAYLOAD + }, + "httpResponse" : { + "body" : { + "job": "456", + "ignored_fields": {}, + "id": "456", + "type": "job", + "url": "/api/v2/jobs/456/", + "related": { + "created_by": "/api/v2/users/1/", + "modified_by": "/api/v2/users/1/", + "labels": "/api/v2/jobs/456/labels/", + "inventory": "/api/v2/inventories/1/", + "project": "/api/v2/projects/8/", + "extra_credentials": "/api/v2/jobs/456/extra_credentials/", + "credentials": "/api/v2/jobs/456/credentials/", + "unified_job_template": "/api/v2/job_templates/123/", + "stdout": "/api/v2/jobs/456/stdout/", + "job_events": "/api/v2/jobs/456/job_events/", + "job_host_summaries": "/api/v2/jobs/456/job_host_summaries/", + "activity_stream": "/api/v2/jobs/456/activity_stream/", + "notifications": "/api/v2/jobs/456/notifications/", + "job_template": "/api/v2/job_templates/123/", + "cancel": "/api/v2/jobs/456/cancel/", + "create_schedule": "/api/v2/jobs/456/create_schedule/", + "relaunch": "/api/v2/jobs/456/relaunch/" + }, + "summary_fields": { + "inventory": { + "id": 1, + "name": "Demo Inventory", + "description": "", + "has_active_failures": false, + "total_hosts": 1, + "hosts_with_active_failures": 0, + "total_groups": 0, + "groups_with_active_failures": 0, + "has_inventory_sources": false, + "total_inventory_sources": 0, + "inventory_sources_with_failures": 0, + "organization_id": 1, + "kind": "" + }, + "project": { + "id": 8, + "name": "cds_playbooks", + "description": "CDS - cds_playbooks Project", + "status": "ok", + "scm_type": "" + }, + "job_template": { + "id": "123", + "name": "hello_world_job_template", + "description": "hello_world Runner Job Template" + }, + "unified_job_template": { + "id": "123", + "name": "hello_world_job_template", + "description": "hello_world Runner Job Template", + "unified_job_type": "job" + }, + "created_by": { + "id": 1, + "username": "admin", + "first_name": "", + "last_name": "" + }, + "modified_by": { + "id": 1, + "username": "admin", + "first_name": "", + "last_name": "" + }, + "user_capabilities": { + "delete": true, + "start": true + }, + "labels": { + "count": 0, + "results": [] + }, + "extra_credentials": [], + "credentials": [] + }, + "created": "2019-06-12T11:21:26.891986Z", + "modified": "2019-06-12T11:21:27.016410Z", + "name": "hello_world_job_template", + "description": "hello_world Runner Job Template", + "job_type": "run", + "inventory": 1, + "project": 8, + "playbook": "hello_world.yml", + "forks": 0, + "limit": "", + "verbosity": 0, + "extra_vars": "{\"tor_group\": \"vEPC\", \"site_id\": \"3 - Belmont\"}", + "job_tags": "", + "force_handlers": false, + "skip_tags": "", + "start_at_task": "", + "timeout": 0, + "use_fact_cache": false, + "unified_job_template": "123", + "launch_type": "manual", + "status": "pending", + "failed": false, + "started": null, + "finished": null, + "elapsed": 0, + "job_args": "", + "job_cwd": "", + "job_env": {}, + "job_explanation": "", + "execution_node": "", + "controller_node": "", + "result_traceback": "", + "event_processing_finished": false, + "job_template": "123", + "passwords_needed_to_start": [], + "ask_diff_mode_on_launch": false, + "ask_variables_on_launch": true, + "ask_limit_on_launch": true, + "ask_tags_on_launch": true, + "ask_skip_tags_on_launch": true, + "ask_job_type_on_launch": false, + "ask_verbosity_on_launch": false, + "ask_inventory_on_launch": true, + "ask_credential_on_launch": true, + "allow_simultaneous": false, + "artifacts": {}, + "scm_revision": "", + "instance_group": null, + "diff_mode": false, + "job_slice_number": 0, + "job_slice_count": 1, + "credential": null, + "vault_credential": null + } + } +} diff --git a/test/ansible-python-dg/success/expected-response.json b/test/ansible-python-dg/success/expected-response.json new file mode 100644 index 0000000..833c2eb --- /dev/null +++ b/test/ansible-python-dg/success/expected-response.json @@ -0,0 +1,30 @@ +{ + "correlationUUID": null, + "commonHeader": { + "timestamp": "2020-05-26T01:11:00.914Z", + "originatorId": "System", + "requestId": "ansible-python-dg-success", + "subRequestId": "ansible-python-dg-success-1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-ansible-python-dg", + "blueprintVersion": "1.0.0", + "actionName": "run-dg", + "mode": "sync" + }, + "status": { + "code": 200, + "eventType": "EVENT_COMPONENT_EXECUTED", + "timestamp": "2020-05-26T01:11:17.384Z", + "errorMessage": null, + "message": "success" + }, + "payload": { + "run-dg-response": { + "execute-command-logs": [ + "TenGigE0/0/0/19" + ] + } + } +} diff --git a/test/ansible-python-dg/success/request-payload.json b/test/ansible-python-dg/success/request-payload.json new file mode 100644 index 0000000..bf68498 --- /dev/null +++ b/test/ansible-python-dg/success/request-payload.json @@ -0,0 +1,27 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "ansible-python-dg-success", + "subRequestId": "ansible-python-dg-success-1" + }, + "actionIdentifiers": { + "blueprintName": "RT-ansible-python-dg", + "blueprintVersion": "1.0.0", + "actionName": "run-dg", + "mode": "sync" + }, + "payload": { + "run-dg-request": { + "endpoint-selector": "awx", + "job-template-name": "hello_world_job_template", + "inventory": "Demo Inventory", + "limit": "123", + "tags": "some-tag", + "skip-tags": "some-skip-tag", + "extra-vars": { + "site_id": "3 - Belmont", + "tor_group": "vEPC" + } + } + } +} diff --git a/test/ansible-python-dg/success/test.sh b/test/ansible-python-dg/success/test.sh new file mode 100644 index 0000000..105a17f --- /dev/null +++ b/test/ansible-python-dg/success/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="ansible-python-dg" +TEST_NAME="success" +TEST_NUMBER=$RANDOM + +mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" + +REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" +EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" + +echo 'Calling CDS process' +process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert statuscode' +assert_status_code 200 $RESPONSE_HEADERS_FILE + +echo 'Assert payload' +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/test/bootstrap.sh b/test/bootstrap.sh new file mode 100755 index 0000000..f82646a --- /dev/null +++ b/test/bootstrap.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +# Starting from Frankfurt CDS release, we need to bootstrap on the first execution. + +# bootstrap files output filenames +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/bootstrap-response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/bootstrap-response-payload" + +echo "Bootstrapping CDS" +. ./$TEST_DIRECTORY/utils.sh +bootstrap_cds ${RESPONSE_PAYLOAD_FILE} ${RESPONSE_HEADERS_FILE} +echo "DEBUG::: RESPONSE_HEADERS_FILE: ${RESPONSE_HEADERS_FILE}" +cat ${RESPONSE_HEADERS_FILE} +echo "DEBUG::: RESPONSE_PAYLOAD_FILE: ${RESPONSE_PAYLOAD_FILE}" +cat ${RESPONSE_PAYLOAD_FILE} +assert_status_code 200 ${RESPONSE_HEADERS_FILE} diff --git a/test/cli/cli-enrichment-test.sh b/test/cli/cli-enrichment-test.sh new file mode 100755 index 0000000..1051a1b --- /dev/null +++ b/test/cli/cli-enrichment-test.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="cli" +TEST_NAME="$CBA_NAME-enrichment" +TEST_NUMBER=$RANDOM +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Compressing CBA: $CBA_NAME" +compress_cba $CBA_NAME + +echo "Enriching CBA: $CBA_NAME" +enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE + +echo 'Assert status 200' +assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/test/cli/cli-upload-test.sh b/test/cli/cli-upload-test.sh new file mode 100755 index 0000000..b0464ea --- /dev/null +++ b/test/cli/cli-upload-test.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="cli" +TEST_NAME="$CBA_NAME-upload" +TEST_NUMBER=$RANDOM +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" +REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Uploading CBA: $CBA_NAME" +upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert status 200' +assert_status_code 200 $RESPONSE_HEADERS_FILE + +# This step prevents a race-condition for parallel process requests +# when cba has not yet been written to filesystem +echo 'Send process request to force CDS to load CBA to filesystem' +process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/test/cli/command-fail/expected-response.json b/test/cli/command-fail/expected-response.json new file mode 100644 index 0000000..6b71773 --- /dev/null +++ b/test/cli/command-fail/expected-response.json @@ -0,0 +1,34 @@ +{ + "correlationUUID": null, + "commonHeader": { + "timestamp": "2020-06-04T15:05:20.003Z", + "originatorId": "System", + "requestId": "regression-test-cli-command-fail", + "subRequestId": "1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-cli", + "blueprintVersion": "1.0.0", + "actionName": "cli", + "mode": "sync" + }, + "status": { + "code": 200, + "eventType": "EVENT_COMPONENT_EXECUTED", + "timestamp": "2020-06-04T15:05:41.528Z", + "errorMessage": null, + "message": "success" + }, + "payload": { + "cli-response": { + "response-data": [ + { + "command": "nonExistCommand", + "deviceOutput": "nonExistCommand\r\n/ $ nonExistCommand\r\n-ash: nonExistCommand: not found\r\n/ $ \u001b[6n", + "successful": true + } + ] + } + } +} diff --git a/test/cli/command-fail/request-payload.json b/test/cli/command-fail/request-payload.json new file mode 100644 index 0000000..700271e --- /dev/null +++ b/test/cli/command-fail/request-payload.json @@ -0,0 +1,26 @@ +{ + "actionIdentifiers": { + "mode": "sync", + "blueprintName": "RT-cli", + "blueprintVersion": "1.0.0", + "actionName": "cli" + }, + "payload": { + "cli-request": { + "host": "cds-regression-sshmock", + "username": "cdstest", + "password": "testcds", + "port": "22", + "connectionTimeOut": "5000", + "logging": true, + "commands": [ + "nonExistCommand" + ] + } + }, + "commonHeader": { + "subRequestId": "1", + "requestId": "regression-test-cli-command-fail", + "originatorId": "System" + } +} diff --git a/test/cli/command-fail/test.sh b/test/cli/command-fail/test.sh new file mode 100755 index 0000000..e41abff --- /dev/null +++ b/test/cli/command-fail/test.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="cli" +TEST_NAME="command-fail" +TEST_NUMBER=$RANDOM + +mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" + +RESOURCES_DIR="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME" +REQUEST_PAYLOAD_FILE="$RESOURCES_DIR/request-payload.json" +EXPECTED_PAYLOAD_FILE="$RESOURCES_DIR/expected-response.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" + +echo 'Calling CDS process' +process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert statuscode 200' +assert_status_code 200 $RESPONSE_HEADERS_FILE + +echo 'Assert payload' +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/test/cli/dummy-request-payload.json b/test/cli/dummy-request-payload.json new file mode 100644 index 0000000..62d2f92 --- /dev/null +++ b/test/cli/dummy-request-payload.json @@ -0,0 +1,14 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "dummy-request-should-fail", + "subRequestId": "1" + }, + "actionIdentifiers": { + "blueprintName": "RT-cli", + "blueprintVersion": "1.0.0", + "actionName": "dummy", + "mode": "sync" + }, + "payload": {} +} diff --git a/test/cli/success/expected-response.json b/test/cli/success/expected-response.json new file mode 100644 index 0000000..55248cb --- /dev/null +++ b/test/cli/success/expected-response.json @@ -0,0 +1,38 @@ +{ + "commonHeader": { + "timestamp": "2020-05-25T20:54:11.024Z", + "originatorId": "System", + "requestId": "regression-test-cli", + "subRequestId": "1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-cli", + "blueprintVersion": "1.0.0", + "actionName": "cli", + "mode": "sync" + }, + "status": { + "code": 200, + "eventType": "EVENT_COMPONENT_EXECUTED", + "timestamp": "2020-05-25T20:54:21.453Z", + "errorMessage": null, + "message": "success" + }, + "payload": { + "cli-response": { + "response-data": [ + { + "command": "pwd", + "deviceOutput": "pwd\r\n/ $ pwd\r\n/\r\n/ $ \u001b[6n", + "successful": true + }, + { + "command": "ls", + "deviceOutput": "pwd\r\n/ $ pwd\r\n/\r\n/ $ \u001b[6nls\r\n\u001b[1;34mbin\u001b[m \u001b[1;34mdev\u001b[m \u001b[1;34metc\u001b[m \u001b[1;34mlib\u001b[m\r\n/ $ \u001b[6n", + "successful": true + } + ] + } + } +} diff --git a/test/cli/success/request-payload.json b/test/cli/success/request-payload.json new file mode 100644 index 0000000..0438a7c --- /dev/null +++ b/test/cli/success/request-payload.json @@ -0,0 +1,27 @@ +{ + "actionIdentifiers": { + "mode": "sync", + "blueprintName": "RT-cli", + "blueprintVersion": "1.0.0", + "actionName": "cli" + }, + "payload": { + "cli-request": { + "host": "cds-regression-sshmock", + "username": "cdstest", + "password": "testcds", + "port": "22", + "connectionTimeOut": "5000", + "logging": true, + "commands": [ + "pwd", + "ls" + ] + } + }, + "commonHeader": { + "subRequestId": "1", + "requestId": "regression-test-cli", + "originatorId": "System" + } +} diff --git a/test/cli/success/test.sh b/test/cli/success/test.sh new file mode 100755 index 0000000..87b961f --- /dev/null +++ b/test/cli/success/test.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="cli" +TEST_NAME="success" +TEST_NUMBER=$RANDOM + +mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" + +RESOURCES_DIR="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME" +REQUEST_PAYLOAD_FILE="$RESOURCES_DIR/request-payload.json" +EXPECTED_PAYLOAD_FILE="$RESOURCES_DIR/expected-response.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" + +echo 'Calling CDS process' +process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert statuscode 200' +assert_status_code 200 $RESPONSE_HEADERS_FILE + +echo 'Assert payload' +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/test/exit_on_failure.sh b/test/exit_on_failure.sh new file mode 100755 index 0000000..0af01c9 --- /dev/null +++ b/test/exit_on_failure.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +if [ "$(wc -c $FAILED_TESTS_DIRECTORY/*|awk '/total/ {print $1}')" -gt 0 ] +then + echo "exiting due to presence of files in FAILED_TESTS_DIRECTORY" + wc -c $FAILED_TESTS_DIRECTORY/* + exit 1; +fi diff --git a/test/lock-device/dummy-request-payload.json b/test/lock-device/dummy-request-payload.json new file mode 100644 index 0000000..c3ca13c --- /dev/null +++ b/test/lock-device/dummy-request-payload.json @@ -0,0 +1,14 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "dummy-request-should-fail", + "subRequestId": "1" + }, + "actionIdentifiers": { + "blueprintName": "RT-lock-device", + "blueprintVersion": "1.0.0", + "actionName": "dummy", + "mode": "sync" + }, + "payload": {} +} diff --git a/test/lock-device/lock-device-enrichment-test.sh b/test/lock-device/lock-device-enrichment-test.sh new file mode 100644 index 0000000..e478e91 --- /dev/null +++ b/test/lock-device/lock-device-enrichment-test.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="lock-device" +TEST_NAME="$CBA_NAME-enrichment" +TEST_NUMBER=$RANDOM +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Compressing CBA: $CBA_NAME" +compress_cba $CBA_NAME + +echo "Enriching CBA: $CBA_NAME" +enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE + +echo 'Assert status 200' +assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/test/lock-device/lock-device-upload-test.sh b/test/lock-device/lock-device-upload-test.sh new file mode 100644 index 0000000..6c63e28 --- /dev/null +++ b/test/lock-device/lock-device-upload-test.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="lock-device" +TEST_NAME="$CBA_NAME-upload" +TEST_NUMBER=$RANDOM +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" +REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Uploading CBA: $CBA_NAME" +upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert status 200' +assert_status_code 200 $RESPONSE_HEADERS_FILE + +# This step prevents a race-condition for parallel process requests +# when cba has not yet been written to filesystem +echo 'Send process request to force CDS to load CBA to filesystem' +process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/test/lock-device/success/expected-payloads/expected-payload-1.json b/test/lock-device/success/expected-payloads/expected-payload-1.json new file mode 100644 index 0000000..82be771 --- /dev/null +++ b/test/lock-device/success/expected-payloads/expected-payload-1.json @@ -0,0 +1,28 @@ +{ + "correlationUUID": "41176125-5d22-4719-846c-71d6d9e375cd", + "commonHeader": { + "timestamp": "2020-10-21T14:34:24.222Z", + "originatorId": "System", + "requestId": "lock-request-1", + "subRequestId": "1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-lock-device", + "blueprintVersion": "1.0.0", + "actionName": "resolve-deploy-kotlin", + "mode": "sync" + }, + "status": { + "code": 200, + "eventType": "EVENT_COMPONENT_EXECUTED", + "timestamp": "2020-10-21T14:35:22.702Z", + "errorMessage": null, + "message": "success" + }, + "payload": { + "resolve-deploy-kotlin-response": { + "response-data": "Success: lock-request-1" + } + } +} diff --git a/test/lock-device/success/expected-payloads/expected-payload-2.json b/test/lock-device/success/expected-payloads/expected-payload-2.json new file mode 100644 index 0000000..e241a1d --- /dev/null +++ b/test/lock-device/success/expected-payloads/expected-payload-2.json @@ -0,0 +1,26 @@ +{ + "correlationUUID": "699706a7-380b-464b-8c84-6eb7c356099a", + "commonHeader": { + "timestamp": "2020-10-21T14:34:29.157Z", + "originatorId": "System", + "requestId": "lock-request-2", + "subRequestId": "1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-lock-device", + "blueprintVersion": "1.0.0", + "actionName": "resolve-deploy-kotlin", + "mode": "sync" + }, + "status": { + "code": 500, + "eventType": "EVENT_COMPONENT_FAILURE", + "timestamp": "2020-10-21T14:34:40.817Z", + "errorMessage": "Failed in ComponentScriptExecutor : Failed to acquire lock within timeout, failed to get execution property(node_templates/execute-kotlin/attributes/response-data)", + "message": "failure" + }, + "payload": { + "resolve-deploy-kotlin-response": {} + } +} diff --git a/test/lock-device/success/expected-payloads/expected-payload-3.json b/test/lock-device/success/expected-payloads/expected-payload-3.json new file mode 100644 index 0000000..cc03eae --- /dev/null +++ b/test/lock-device/success/expected-payloads/expected-payload-3.json @@ -0,0 +1,28 @@ +{ + "correlationUUID": "846b5cf8-c914-4bb4-abd9-5aae49fce8bd", + "commonHeader": { + "timestamp": "2020-10-21T14:35:29.222Z", + "originatorId": "System", + "requestId": "lock-request-3", + "subRequestId": "1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-lock-device", + "blueprintVersion": "1.0.0", + "actionName": "resolve-deploy-kotlin", + "mode": "sync" + }, + "status": { + "code": 200, + "eventType": "EVENT_COMPONENT_EXECUTED", + "timestamp": "2020-10-21T14:35:59.688Z", + "errorMessage": null, + "message": "success" + }, + "payload": { + "resolve-deploy-kotlin-response": { + "response-data": "Success: lock-request-3" + } + } +} diff --git a/test/lock-device/success/expected-payloads/expected-payload-4.json b/test/lock-device/success/expected-payloads/expected-payload-4.json new file mode 100644 index 0000000..52b5bc7 --- /dev/null +++ b/test/lock-device/success/expected-payloads/expected-payload-4.json @@ -0,0 +1,26 @@ +{ + "correlationUUID": "b6cbef49-7313-4408-b48f-00c996378321", + "commonHeader": { + "timestamp": "2020-10-21T14:35:34.095Z", + "originatorId": "System", + "requestId": "lock-request-4", + "subRequestId": "1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-lock-device", + "blueprintVersion": "1.0.0", + "actionName": "resolve-deploy-kotlin", + "mode": "sync" + }, + "status": { + "code": 500, + "eventType": "EVENT_COMPONENT_FAILURE", + "timestamp": "2020-10-21T14:35:44.813Z", + "errorMessage": "Failed in ComponentScriptExecutor : Failed to acquire lock within timeout, failed to get execution property(node_templates/execute-kotlin/attributes/response-data)", + "message": "failure" + }, + "payload": { + "resolve-deploy-kotlin-response": {} + } +} diff --git a/test/lock-device/success/request-payloads/request-payload-1.json b/test/lock-device/success/request-payloads/request-payload-1.json new file mode 100644 index 0000000..20be12a --- /dev/null +++ b/test/lock-device/success/request-payloads/request-payload-1.json @@ -0,0 +1,20 @@ +{ + "actionIdentifiers": { + "mode": "sync", + "blueprintName": "RT-lock-device", + "blueprintVersion": "1.0.0", + "actionName": "resolve-deploy-kotlin" + }, + "payload": { + "resolve-deploy-kotlin-request": { + "resolve-deploy-kotlin-properties": { + "lock-acquire-timeout": 5 + } + } + }, + "commonHeader": { + "subRequestId": "1", + "requestId": "lock-request-1", + "originatorId": "System" + } +} diff --git a/test/lock-device/success/request-payloads/request-payload-2.json b/test/lock-device/success/request-payloads/request-payload-2.json new file mode 100644 index 0000000..1d1b9b9 --- /dev/null +++ b/test/lock-device/success/request-payloads/request-payload-2.json @@ -0,0 +1,20 @@ +{ + "actionIdentifiers": { + "mode": "sync", + "blueprintName": "RT-lock-device", + "blueprintVersion": "1.0.0", + "actionName": "resolve-deploy-kotlin" + }, + "payload": { + "resolve-deploy-kotlin-request": { + "resolve-deploy-kotlin-properties": { + "lock-acquire-timeout": 10 + } + } + }, + "commonHeader": { + "subRequestId": "1", + "requestId": "lock-request-2", + "originatorId": "System" + } +} diff --git a/test/lock-device/success/request-payloads/request-payload-3.json b/test/lock-device/success/request-payloads/request-payload-3.json new file mode 100644 index 0000000..f2925e7 --- /dev/null +++ b/test/lock-device/success/request-payloads/request-payload-3.json @@ -0,0 +1,20 @@ +{ + "actionIdentifiers": { + "mode": "sync", + "blueprintName": "RT-lock-device", + "blueprintVersion": "1.0.0", + "actionName": "resolve-deploy-kotlin" + }, + "payload": { + "resolve-deploy-kotlin-request": { + "resolve-deploy-kotlin-properties": { + "lock-acquire-timeout": 10 + } + } + }, + "commonHeader": { + "subRequestId": "1", + "requestId": "lock-request-3", + "originatorId": "System" + } +} diff --git a/test/lock-device/success/request-payloads/request-payload-4.json b/test/lock-device/success/request-payloads/request-payload-4.json new file mode 100644 index 0000000..6fc13f5 --- /dev/null +++ b/test/lock-device/success/request-payloads/request-payload-4.json @@ -0,0 +1,20 @@ +{ + "actionIdentifiers": { + "mode": "sync", + "blueprintName": "RT-lock-device", + "blueprintVersion": "1.0.0", + "actionName": "resolve-deploy-kotlin" + }, + "payload": { + "resolve-deploy-kotlin-request": { + "resolve-deploy-kotlin-properties": { + "lock-acquire-timeout": 10 + } + } + }, + "commonHeader": { + "subRequestId": "1", + "requestId": "lock-request-4", + "originatorId": "System" + } +} diff --git a/test/lock-device/success/test.sh b/test/lock-device/success/test.sh new file mode 100644 index 0000000..cf8a42c --- /dev/null +++ b/test/lock-device/success/test.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="lock-device" +TEST_NAME="success" +TEST_NUMBER=$RANDOM +mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" + + +# Request 1: Acquire lock and run for 30 sec +# Sleep 5 - ensure req 1 is processed before req 2 +# Request 2: Wait for lock 10 sec then time out +# Sleep 60 - lock should have been released after this time +# Request 3: Acquire lock and run for 30 sec +# Sleep 5 - ensure req 3 is processed before req 4 +# Request 4: Wait for lock 10 sec then time out +delays=(0 5 60 5 0) + +for i in `seq 1 4` +do + echo "Sending request $i" + RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers-$i" + RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-$i" + REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payloads/request-payload-$i.json" + + process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE & + pids[${i}]=$! + sleep ${delays[$i]} +done + +echo "Waiting for responses - pids: ${pids[*]}" +for pid in ${pids[*]} +do + echo "Waiting for pid $pid" + wait $pid +done + +for i in `seq 1 4` +do + echo "Assert payload - request $i" + RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-$i" + EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-payloads/expected-payload-$i.json" + assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE +done diff --git a/test/netconf/dummy-request-payload.json b/test/netconf/dummy-request-payload.json new file mode 100644 index 0000000..acc4f92 --- /dev/null +++ b/test/netconf/dummy-request-payload.json @@ -0,0 +1,14 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "dummy-request-should-fail", + "subRequestId": "1" + }, + "actionIdentifiers": { + "blueprintName": "RT-netconf", + "blueprintVersion": "1.0.0", + "actionName": "dummy", + "mode": "sync" + }, + "payload": {} +} diff --git a/test/netconf/jython/connect-fail/expected-response.json b/test/netconf/jython/connect-fail/expected-response.json new file mode 100644 index 0000000..ff0cceb --- /dev/null +++ b/test/netconf/jython/connect-fail/expected-response.json @@ -0,0 +1,29 @@ +{ + "commonHeader": { + "timestamp": "2020-02-04T14:16:32.798Z", + "originatorId": "System", + "requestId": "regression-test-netconf-jython-connect-fail", + "subRequestId": "1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-netconf", + "blueprintVersion": "1.0.0", + "actionName": "netconf-jython", + "mode": "sync" + }, + "status": { + "code": 500, + "eventType": "EVENT_COMPONENT_FAILURE", + "timestamp": "2020-02-04T14:16:32.824Z", + "errorMessage": "org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.NetconfException: 127.0.0.1:17830: Failed to establish SSH session", + "message": "failure" + }, + "payload": { + "netconf-jython-response": { + "response-data": { + "deploySuccess": false + } + } + } +} diff --git a/test/netconf/jython/connect-fail/request-payload.json b/test/netconf/jython/connect-fail/request-payload.json new file mode 100644 index 0000000..9a9f240 --- /dev/null +++ b/test/netconf/jython/connect-fail/request-payload.json @@ -0,0 +1,19 @@ +{ + "actionIdentifiers": { + "mode": "sync", + "blueprintName": "RT-netconf", + "blueprintVersion": "1.0.0", + "actionName": "netconf-jython" + }, + "payload": { + "netconf-jython-request": { + "netconf-host": "127.0.0.1", + "netconf-timeout": 5 + } + }, + "commonHeader": { + "subRequestId": "1", + "requestId": "regression-test-netconf-jython-connect-fail", + "originatorId": "System" + } +} diff --git a/test/netconf/jython/connect-fail/test.sh b/test/netconf/jython/connect-fail/test.sh new file mode 100755 index 0000000..40b6056 --- /dev/null +++ b/test/netconf/jython/connect-fail/test.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="netconf" +LANG="jython" +TEST_NAME="connect-fail" +TEST_NUMBER=$RANDOM + +mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/" +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-payload" + +REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/request-payload.json" +EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/expected-response.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" + +echo 'Calling CDS process' +process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert statuscode 500' +assert_status_code 500 $RESPONSE_HEADERS_FILE + +echo 'Assert connect fail payload' +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/test/netconf/jython/success/expected-response.json b/test/netconf/jython/success/expected-response.json new file mode 100644 index 0000000..6408577 --- /dev/null +++ b/test/netconf/jython/success/expected-response.json @@ -0,0 +1,29 @@ +{ + "commonHeader": { + "timestamp": "2020-02-03T13:40:43.697Z", + "originatorId": "System", + "requestId": "regression-test-netconf-jython", + "subRequestId": "1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-netconf", + "blueprintVersion": "1.0.0", + "actionName": "netconf-jython", + "mode": "sync" + }, + "status": { + "code": 200, + "eventType": "EVENT_COMPONENT_EXECUTED", + "timestamp": "2020-02-03T13:40:51.835Z", + "errorMessage": null, + "message": "success" + }, + "payload": { + "netconf-jython-response": { + "response-data": { + "deploySuccess": true + } + } + } +} diff --git a/test/netconf/jython/success/request-payload.json b/test/netconf/jython/success/request-payload.json new file mode 100644 index 0000000..dcaaeb1 --- /dev/null +++ b/test/netconf/jython/success/request-payload.json @@ -0,0 +1,19 @@ +{ + "actionIdentifiers": { + "mode": "sync", + "blueprintName": "RT-netconf", + "blueprintVersion": "1.0.0", + "actionName": "netconf-jython" + }, + "payload": { + "netconf-jython-request": { + "netconf-host": "odl-netconf-testtool", + "netconf-timeout": 30 + } + }, + "commonHeader": { + "subRequestId": "1", + "requestId": "regression-test-netconf-jython", + "originatorId": "System" + } +} diff --git a/test/netconf/jython/success/test.sh b/test/netconf/jython/success/test.sh new file mode 100755 index 0000000..5da46da --- /dev/null +++ b/test/netconf/jython/success/test.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="netconf" +LANG="jython" +TEST_NAME="success" +TEST_NUMBER=$RANDOM + +mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/" +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-payload" + +REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/request-payload.json" +EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/expected-response.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" + +echo 'Calling CDS process' +process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert statuscode 200' +assert_status_code 200 $RESPONSE_HEADERS_FILE + +echo 'Assert payload' +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/test/netconf/kotlin/connect-fail/expected-response.json b/test/netconf/kotlin/connect-fail/expected-response.json new file mode 100644 index 0000000..9334b50 --- /dev/null +++ b/test/netconf/kotlin/connect-fail/expected-response.json @@ -0,0 +1,29 @@ +{ + "commonHeader": { + "timestamp": "2020-02-04T14:16:32.798Z", + "originatorId": "System", + "requestId": "regression-test-netconf-kotlin-connect-fail", + "subRequestId": "1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-netconf", + "blueprintVersion": "1.0.0", + "actionName": "netconf-kotlin", + "mode": "sync" + }, + "status": { + "code": 500, + "eventType": "EVENT_COMPONENT_FAILURE", + "timestamp": "2020-02-04T14:16:32.824Z", + "errorMessage": "org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.NetconfException: 127.0.0.1:17830: Failed to establish SSH session", + "message": "failure" + }, + "payload": { + "netconf-kotlin-response": { + "response-data": { + "deploySuccess": false + } + } + } +} diff --git a/test/netconf/kotlin/connect-fail/request-payload.json b/test/netconf/kotlin/connect-fail/request-payload.json new file mode 100644 index 0000000..8cac64a --- /dev/null +++ b/test/netconf/kotlin/connect-fail/request-payload.json @@ -0,0 +1,19 @@ +{ + "actionIdentifiers": { + "mode": "sync", + "blueprintName": "RT-netconf", + "blueprintVersion": "1.0.0", + "actionName": "netconf-kotlin" + }, + "payload": { + "netconf-kotlin-request": { + "netconf-host": "127.0.0.1", + "netconf-timeout": 5 + } + }, + "commonHeader": { + "subRequestId": "1", + "requestId": "regression-test-netconf-kotlin-connect-fail", + "originatorId": "System" + } +} diff --git a/test/netconf/kotlin/connect-fail/test.sh b/test/netconf/kotlin/connect-fail/test.sh new file mode 100755 index 0000000..0ba3533 --- /dev/null +++ b/test/netconf/kotlin/connect-fail/test.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="netconf" +LANG="kotlin" +TEST_NAME="connect-fail" +TEST_NUMBER=$RANDOM + +mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/" +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-payload" + +REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/request-payload.json" +EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/expected-response.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" + +echo 'Calling CDS process' +process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert statuscode 500' +assert_status_code 500 $RESPONSE_HEADERS_FILE + +echo 'Assert connect fail payload' +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/test/netconf/kotlin/success/expected-response.json b/test/netconf/kotlin/success/expected-response.json new file mode 100644 index 0000000..dfb81d7 --- /dev/null +++ b/test/netconf/kotlin/success/expected-response.json @@ -0,0 +1,29 @@ +{ + "commonHeader": { + "timestamp": "2020-02-03T13:40:43.697Z", + "originatorId": "System", + "requestId": "regression-test-netconf-kotlin", + "subRequestId": "1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-netconf", + "blueprintVersion": "1.0.0", + "actionName": "netconf-kotlin", + "mode": "sync" + }, + "status": { + "code": 200, + "eventType": "EVENT_COMPONENT_EXECUTED", + "timestamp": "2020-02-03T13:40:51.835Z", + "errorMessage": null, + "message": "success" + }, + "payload": { + "netconf-kotlin-response": { + "response-data": { + "deploySuccess": true + } + } + } +} diff --git a/test/netconf/kotlin/success/request-payload.json b/test/netconf/kotlin/success/request-payload.json new file mode 100644 index 0000000..412614f --- /dev/null +++ b/test/netconf/kotlin/success/request-payload.json @@ -0,0 +1,19 @@ +{ + "actionIdentifiers": { + "mode": "sync", + "blueprintName": "RT-netconf", + "blueprintVersion": "1.0.0", + "actionName": "netconf-kotlin" + }, + "payload": { + "netconf-kotlin-request": { + "netconf-host": "odl-netconf-testtool", + "netconf-timeout": 30 + } + }, + "commonHeader": { + "subRequestId": "1", + "requestId": "regression-test-netconf-kotlin", + "originatorId": "System" + } +} diff --git a/test/netconf/kotlin/success/test.sh b/test/netconf/kotlin/success/test.sh new file mode 100755 index 0000000..7e7f3c6 --- /dev/null +++ b/test/netconf/kotlin/success/test.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="netconf" +LANG="kotlin" +TEST_NAME="success" +TEST_NUMBER=$RANDOM + +mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/" +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/$TEST_NUMBER/response-payload" + +REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/request-payload.json" +EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$LANG/$TEST_NAME/expected-response.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" + +echo 'Calling CDS process' +process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert statuscode 200' +assert_status_code 200 $RESPONSE_HEADERS_FILE + +echo 'Assert payload' +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/test/netconf/netconf-enrichment-test.sh b/test/netconf/netconf-enrichment-test.sh new file mode 100755 index 0000000..2b7d3a5 --- /dev/null +++ b/test/netconf/netconf-enrichment-test.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="netconf" +TEST_NAME="$CBA_NAME-enrichment" +TEST_NUMBER=$RANDOM +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Compressing CBA: $CBA_NAME" +compress_cba $CBA_NAME + +echo "Enriching CBA: $CBA_NAME" +enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE + +echo 'Assert status 200' +assert_status_code 200 $RESPONSE_HEADERS_FILE + diff --git a/test/netconf/netconf-upload-test.sh b/test/netconf/netconf-upload-test.sh new file mode 100755 index 0000000..76a4a93 --- /dev/null +++ b/test/netconf/netconf-upload-test.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="netconf" +TEST_NAME="$CBA_NAME-upload" +TEST_NUMBER=$RANDOM +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" +REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Uploading CBA: $CBA_NAME" +upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert status 200' +assert_status_code 200 $RESPONSE_HEADERS_FILE + +# This step prevents a race-condition for parallel process requests +# when cba has not yet been written to filesystem +echo 'Send process request to force CDS to load CBA to filesystem' +process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/test/py-executor/connection-fail/expected-response.json b/test/py-executor/connection-fail/expected-response.json new file mode 100644 index 0000000..93b2598 --- /dev/null +++ b/test/py-executor/connection-fail/expected-response.json @@ -0,0 +1,25 @@ +{ + "commonHeader": { + "timestamp": "2020-05-19T17:26:02.923Z", + "originatorId": "System", + "requestId": "123456", + "subRequestId": "1234-12234", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-py-executor", + "blueprintVersion": "1.0.0", + "actionName": "connection-fail", + "mode": "sync" + }, + "status": { + "code": 500, + "eventType": "EVENT_COMPONENT_FAILURE", + "timestamp": "2020-05-19T17:26:02.926Z", + "errorMessage": "Failed in ComponentRemoteScriptExecutor : UNAVAILABLE: io exception, failed to get execution property(node_templates/execute-connection-fail/attributes/status)", + "message": "failure" + }, + "payload": { + "connection-fail-response": {} + } +} diff --git a/test/py-executor/connection-fail/request-payload.json b/test/py-executor/connection-fail/request-payload.json new file mode 100644 index 0000000..7273340 --- /dev/null +++ b/test/py-executor/connection-fail/request-payload.json @@ -0,0 +1,16 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "123456", + "subRequestId": "1234-12234" + }, + "actionIdentifiers": { + "blueprintName": "RT-py-executor", + "blueprintVersion": "1.0.0", + "actionName": "connection-fail", + "mode": "sync" + }, + "payload": { + "connection-fail-request": {} + } +} diff --git a/test/py-executor/connection-fail/test.sh b/test/py-executor/connection-fail/test.sh new file mode 100644 index 0000000..b2bfe22 --- /dev/null +++ b/test/py-executor/connection-fail/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="py-executor" +TEST_NAME="connection-fail" +TEST_NUMBER=$RANDOM + +mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" + +REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" +EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" + +echo 'Calling CDS process' +process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert statuscode' +assert_status_code 500 $RESPONSE_HEADERS_FILE + +echo 'Assert payload' +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/test/py-executor/dummy-request-payload.json b/test/py-executor/dummy-request-payload.json new file mode 100644 index 0000000..688e5e9 --- /dev/null +++ b/test/py-executor/dummy-request-payload.json @@ -0,0 +1,14 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "dummy-request-should-fail", + "subRequestId": "1" + }, + "actionIdentifiers": { + "blueprintName": "RT-remote-python", + "blueprintVersion": "1.0.0", + "actionName": "dummy", + "mode": "sync" + }, + "payload": {} +} diff --git a/test/py-executor/failing-script/expected-response.json b/test/py-executor/failing-script/expected-response.json new file mode 100644 index 0000000..17148b0 --- /dev/null +++ b/test/py-executor/failing-script/expected-response.json @@ -0,0 +1,25 @@ +{ + "commonHeader": { + "timestamp": "2020-05-19T17:24:33.353Z", + "originatorId": "System", + "requestId": "123456", + "subRequestId": "1234-12234", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-py-executor", + "blueprintVersion": "1.0.0", + "actionName": "failing-remote-python", + "mode": "sync" + }, + "status": { + "code": 500, + "eventType": "EVENT_COMPONENT_FAILURE", + "timestamp": "2020-05-19T17:24:33.370Z", + "errorMessage": "Failed in ComponentRemoteScriptExecutor : UNKNOWN: Exception iterating responses: Script raised an exception, failed to get execution property(node_templates/execute-failing-remote-python/attributes/status)", + "message": "failure" + }, + "payload": { + "failing-remote-python-response": {} + } +} diff --git a/test/py-executor/failing-script/request-payload.json b/test/py-executor/failing-script/request-payload.json new file mode 100644 index 0000000..bacd876 --- /dev/null +++ b/test/py-executor/failing-script/request-payload.json @@ -0,0 +1,16 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "123456", + "subRequestId": "1234-12234" + }, + "actionIdentifiers": { + "blueprintName": "RT-py-executor", + "blueprintVersion": "1.0.0", + "actionName": "failing-remote-python", + "mode": "sync" + }, + "payload": { + "failing-remote-python-request": {} + } +} diff --git a/test/py-executor/failing-script/test.sh b/test/py-executor/failing-script/test.sh new file mode 100644 index 0000000..acf660f --- /dev/null +++ b/test/py-executor/failing-script/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="py-executor" +TEST_NAME="failing-script" +TEST_NUMBER=$RANDOM + +mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" + +REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" +EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" + +echo 'Calling CDS process' +process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert statuscode' +assert_status_code 500 $RESPONSE_HEADERS_FILE + +echo 'Assert payload' +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/test/py-executor/py-executor-enrichment-test.sh b/test/py-executor/py-executor-enrichment-test.sh new file mode 100644 index 0000000..346ee14 --- /dev/null +++ b/test/py-executor/py-executor-enrichment-test.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="py-executor" +TEST_NAME="$CBA_NAME-enrichment" +TEST_NUMBER=$RANDOM +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" + +export PY_EXEC_SVC=${PY_EXEC_SVC:-"cds-py-executor"} +apply_env_to_definition $CBA_NAME +. ./$TEST_DIRECTORY/utils.sh + +echo "Compressing CBA: $CBA_NAME" +compress_cba $CBA_NAME + +echo "Enriching CBA: $CBA_NAME" +enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE + +echo 'Assert status 200' +assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/test/py-executor/py-executor-upload-test.sh b/test/py-executor/py-executor-upload-test.sh new file mode 100644 index 0000000..002bc10 --- /dev/null +++ b/test/py-executor/py-executor-upload-test.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="py-executor" +TEST_NAME="$CBA_NAME-upload" +TEST_NUMBER=$RANDOM +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" +REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Uploading CBA: $CBA_NAME" +upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert status 200' +assert_status_code 200 $RESPONSE_HEADERS_FILE + +# This step prevents a race-condition for parallel process requests +# when cba has not yet been written to filesystem +echo 'Send process request to force CDS to load CBA to filesystem' +process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/test/py-executor/success/expected-response.json b/test/py-executor/success/expected-response.json new file mode 100644 index 0000000..1318508 --- /dev/null +++ b/test/py-executor/success/expected-response.json @@ -0,0 +1,32 @@ +{ + "commonHeader": { + "timestamp": "2020-05-26T13:47:27.143Z", + "originatorId": "System", + "requestId": "123456", + "subRequestId": "1234-12234", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-py-executor", + "blueprintVersion": "1.0.0", + "actionName": "remote-python", + "mode": "sync" + }, + "status": { + "code": 200, + "eventType": "EVENT_COMPONENT_EXECUTED", + "timestamp": "2020-05-26T13:47:27.193Z", + "errorMessage": null, + "message": "success" + }, + "payload": { + "remote-python-response": { + "status": "success", + "response-data": { + "HelloWorld-request": { + "hello": "world" + } + } + } + } +} diff --git a/test/py-executor/success/request-payload.json b/test/py-executor/success/request-payload.json new file mode 100644 index 0000000..f23b0de --- /dev/null +++ b/test/py-executor/success/request-payload.json @@ -0,0 +1,16 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "123456", + "subRequestId": "1234-12234" + }, + "actionIdentifiers": { + "blueprintName": "RT-py-executor", + "blueprintVersion": "1.0.0", + "actionName": "remote-python", + "mode": "sync" + }, + "payload": { + "remote-python-request": {} + } +} diff --git a/test/py-executor/success/test.sh b/test/py-executor/success/test.sh new file mode 100644 index 0000000..ed43d40 --- /dev/null +++ b/test/py-executor/success/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="py-executor" +TEST_NAME="success" +TEST_NUMBER=$RANDOM + +mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" + +REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" +EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" + +echo 'Calling CDS process' +process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert statuscode' +assert_status_code 200 $RESPONSE_HEADERS_FILE + +echo 'Assert payload' +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/test/remote-ansible/connection-failure/expected-response.json b/test/remote-ansible/connection-failure/expected-response.json new file mode 100644 index 0000000..301e70b --- /dev/null +++ b/test/remote-ansible/connection-failure/expected-response.json @@ -0,0 +1,28 @@ +{ + "commonHeader": { + "timestamp": "2020-05-01T19:38:57.529Z", + "originatorId": "System", + "requestId": "remote-ansible-connection-failure", + "subRequestId": "remote-ansible-connection-failure-1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-remote-ansible", + "blueprintVersion": "1.0.0", + "actionName": "connection-fail", + "mode": "sync" + }, + "status": { + "code": 500, + "eventType": "EVENT_COMPONENT_FAILURE", + "timestamp": "2020-05-01T19:38:57.551Z", + "errorMessage": "error : ansible-command-logs : Failed to process on remote executor (Connect to localhost:12345 [localhost/127.0.0.1] failed: Connection refused (Connection refused))", + "message": "failure" + }, + "payload": { + "connection-fail-response": { + "ansible-command-status": "error", + "ansible-command-logs": "Failed to process on remote executor (Connect to localhost:12345 [localhost/127.0.0.1] failed: Connection refused (Connection refused))" + } + } +} diff --git a/test/remote-ansible/connection-failure/request-payload.json b/test/remote-ansible/connection-failure/request-payload.json new file mode 100644 index 0000000..08e39c7 --- /dev/null +++ b/test/remote-ansible/connection-failure/request-payload.json @@ -0,0 +1,27 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "remote-ansible-connection-failure", + "subRequestId": "remote-ansible-connection-failure-1" + }, + "actionIdentifiers": { + "blueprintName": "RT-remote-ansible", + "blueprintVersion": "1.0.0", + "actionName": "connection-fail", + "mode": "sync" + }, + "payload": { + "connection-fail-request": { + "endpoint-selector": "awx", + "job-template-name": "hello_world_job_template", + "inventory": "Demo Inventory", + "limit": "123", + "tags": "some-tag", + "skip-tags": "some-skip-tag", + "extra-vars": { + "site_id": "3 - Belmont", + "tor_group": "vEPC" + } + } + } +} diff --git a/test/remote-ansible/connection-failure/test.sh b/test/remote-ansible/connection-failure/test.sh new file mode 100644 index 0000000..0993d42 --- /dev/null +++ b/test/remote-ansible/connection-failure/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="remote-ansible" +TEST_NAME="connection-failure" +TEST_NUMBER=$RANDOM + +mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" + +REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" +EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" + +echo 'Calling CDS process' +process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert statuscode' +assert_status_code 500 $RESPONSE_HEADERS_FILE + +echo 'Assert payload' +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/test/remote-ansible/dummy-request-payload.json b/test/remote-ansible/dummy-request-payload.json new file mode 100644 index 0000000..5bb8112 --- /dev/null +++ b/test/remote-ansible/dummy-request-payload.json @@ -0,0 +1,14 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "dummy-request-should-fail", + "subRequestId": "1" + }, + "actionIdentifiers": { + "blueprintName": "RT-remote-ansible", + "blueprintVersion": "1.0.0", + "actionName": "dummy", + "mode": "sync" + }, + "payload": {} +} diff --git a/test/remote-ansible/failure/expected-response.json b/test/remote-ansible/failure/expected-response.json new file mode 100644 index 0000000..713b934 --- /dev/null +++ b/test/remote-ansible/failure/expected-response.json @@ -0,0 +1,29 @@ +{ + "correlationUUID": null, + "commonHeader": { + "timestamp": "2020-06-02T21:03:35.836Z", + "originatorId": "System", + "requestId": "remote-ansible-failure", + "subRequestId": "remote-ansible-failure-1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-remote-ansible", + "blueprintVersion": "1.0.0", + "actionName": "execute-remote-ansible-failure", + "mode": "sync" + }, + "status": { + "code": 500, + "eventType": "EVENT_COMPONENT_FAILURE", + "timestamp": "2020-06-02T21:03:38.655Z", + "errorMessage": "error : ansible-command-logs : Workflow/Job template hello_world_job_template does not exists", + "message": "failure" + }, + "payload": { + "execute-remote-ansible-failure-response": { + "ansible-command-status": "error", + "ansible-command-logs": "Workflow/Job template hello_world_job_template does not exists" + } + } +} diff --git a/test/remote-ansible/failure/request-payload.json b/test/remote-ansible/failure/request-payload.json new file mode 100644 index 0000000..a4589ae --- /dev/null +++ b/test/remote-ansible/failure/request-payload.json @@ -0,0 +1,27 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "remote-ansible-failure", + "subRequestId": "remote-ansible-failure-1" + }, + "actionIdentifiers": { + "blueprintName": "RT-remote-ansible", + "blueprintVersion": "1.0.0", + "actionName": "execute-remote-ansible-failure", + "mode": "sync" + }, + "payload": { + "execute-remote-ansible-failure-request": { + "endpoint-selector": "awx", + "job-template-name": "hello_world_job_template", + "inventory": "Demo Inventory", + "limit": "123", + "tags": "some-tag", + "skip-tags": "some-skip-tag", + "extra-vars": { + "site_id": "3 - Belmont", + "tor_group": "vEPC" + } + } + } +} diff --git a/test/remote-ansible/failure/test.sh b/test/remote-ansible/failure/test.sh new file mode 100644 index 0000000..fd53d27 --- /dev/null +++ b/test/remote-ansible/failure/test.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="remote-ansible" +TEST_NAME="failure" +TEST_NUMBER=$RANDOM + +mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" + +RESOURCES_DIR="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME" +REQUEST_PAYLOAD_FILE="$RESOURCES_DIR/request-payload.json" +EXPECTED_PAYLOAD_FILE="$RESOURCES_DIR/expected-response.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" + +echo 'Calling CDS process' +process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert statuscode' +assert_status_code 500 $RESPONSE_HEADERS_FILE + +echo 'Assert payload' +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/test/remote-ansible/init-mockserver.sh b/test/remote-ansible/init-mockserver.sh new file mode 100755 index 0000000..e594ef5 --- /dev/null +++ b/test/remote-ansible/init-mockserver.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +. ./$TEST_DIRECTORY/utils.sh + +CBA_NAME="remote-ansible" +DIR_PAYLOADS="$TEST_DIRECTORY/$CBA_NAME/mock-payloads" + +OP=expectation +if [[ $1 == rm ]]; then + OP=clear +fi + +# JOB TEMPLATE +echo "Mocking Job Template route..." +export PATH_JT_PAYLOAD="/mock-$CI_PIPELINE_ID/remote-ansible/success/api/v2/job_templates/hello_world_job_template/" +JT_PAYLOAD="$DIR_PAYLOADS/job-template.json" +apply_env_to_json_template $JT_PAYLOAD +curl -vLk -X PUT "http://$CLUSTER_IP:$MOCKSERVER_NODEPORT/mockserver/$OP" -d "@$JT_PAYLOAD" + +# JOB TEMPLATE ERROR +echo "Mocking Job Template Error route..." +export PATH_JT_ERR_PAYLOAD="/mock-$CI_PIPELINE_ID/remote-ansible/failure/api/v2/job_templates/hello_world_job_template/" +JT_ERR_PAYLOAD="$DIR_PAYLOADS/job-template-error.json" +apply_env_to_json_template $JT_ERR_PAYLOAD +curl -vLk -X PUT "http://$CLUSTER_IP:$MOCKSERVER_NODEPORT/mockserver/$OP" -d "@$JT_ERR_PAYLOAD" + +# JOB TEMPLATE LAUNCH - GET +echo "Mocking Job Template Launch GET route..." +export PATH_GET_JT_LAUNCH_PAYLOAD="/mock-$CI_PIPELINE_ID/remote-ansible/success/api/v2/job_templates/123/launch/" +GET_JT_LAUNCH_PAYLOAD="$DIR_PAYLOADS/get_job-template-launch.json" +apply_env_to_json_template $GET_JT_LAUNCH_PAYLOAD +curl -vLk -X PUT "http://$CLUSTER_IP:$MOCKSERVER_NODEPORT/mockserver/$OP" -d "@$GET_JT_LAUNCH_PAYLOAD" + +# JOB TEMPLATE LAUNCH +echo "Mocking Inventory route..." +export PATH_INVENTORY_PAYLOAD="/mock-$CI_PIPELINE_ID/remote-ansible/success/api/v2/inventories/" +INVENTORY_PAYLOAD="$DIR_PAYLOADS/inventory.json" +apply_env_to_json_template $INVENTORY_PAYLOAD +curl -vLk -X PUT "http://$CLUSTER_IP:$MOCKSERVER_NODEPORT/mockserver/$OP" -d "@$INVENTORY_PAYLOAD" + +# JOB TEMPLATE LAUNCH - POST +echo "Mocking Job Template Launch POST route..." +export PATH_POST_JT_LAUNCH_PAYLOAD="/mock-$CI_PIPELINE_ID/remote-ansible/success/api/v2/job_templates/123/launch/" +POST_JT_LAUNCH_PAYLOAD="$DIR_PAYLOADS/post_job-template-launch.json" +apply_env_to_json_template $POST_JT_LAUNCH_PAYLOAD +curl -vLk -X PUT "http://$CLUSTER_IP:$MOCKSERVER_NODEPORT/mockserver/$OP" -d "@$POST_JT_LAUNCH_PAYLOAD" + +# JOB EXECUTION +echo "Mocking Job Execution route..." +export PATH_JOB_EXECUTION_PAYLOAD="/mock-$CI_PIPELINE_ID/remote-ansible/success/api/v2/jobs/456/" +JOB_EXECUTION_PAYLOAD="$DIR_PAYLOADS/job-execution.json" +apply_env_to_json_template $JOB_EXECUTION_PAYLOAD +curl -vLk -X PUT "http://$CLUSTER_IP:$MOCKSERVER_NODEPORT/mockserver/$OP" -d "@$JOB_EXECUTION_PAYLOAD" + +# JOB OUTPUT +echo "Mocking Job Output route..." +export PATH_JOB_OUTPUT_PAYLOAD="/mock-$CI_PIPELINE_ID/remote-ansible/success/api/v2/jobs/456/stdout/" +JOB_OUTPUT_PAYLOAD="$DIR_PAYLOADS/job-output.json" +apply_env_to_json_template $JOB_OUTPUT_PAYLOAD +curl -vLk -X PUT "http://$CLUSTER_IP:$MOCKSERVER_NODEPORT/mockserver/$OP" -d "@$JOB_OUTPUT_PAYLOAD" diff --git a/test/remote-ansible/mock-payloads/get_job-template-launch.json b/test/remote-ansible/mock-payloads/get_job-template-launch.json new file mode 100644 index 0000000..ddc9e17 --- /dev/null +++ b/test/remote-ansible/mock-payloads/get_job-template-launch.json @@ -0,0 +1,46 @@ +{ + "httpRequest" : { + "method" : "GET", + "path" : .PATH_GET_JT_LAUNCH_PAYLOAD + }, + "httpResponse" : { + "body" : { + "can_start_without_user_input": false, + "passwords_needed_to_start": [], + "ask_variables_on_launch": true, + "ask_tags_on_launch": true, + "ask_diff_mode_on_launch": false, + "ask_skip_tags_on_launch": true, + "ask_job_type_on_launch": false, + "ask_limit_on_launch": true, + "ask_verbosity_on_launch": false, + "ask_inventory_on_launch": true, + "ask_credential_on_launch": true, + "survey_enabled": true, + "variables_needed_to_start": [ + "tor_group", + "site_id" + ], + "credential_needed_to_start": false, + "inventory_needed_to_start": false, + "job_template_data": { + "name": "hello_world_job_template", + "id": "123", + "description": "hello_world Runner Job Template" + }, + "defaults": { + "extra_vars": "", + "diff_mode": false, + "limit": "", + "job_tags": "", + "skip_tags": "", + "job_type": "run", + "verbosity": 0, + "inventory": { + "name": "Demo Inventory", + "id": 1 + } + } + } + } +} diff --git a/test/remote-ansible/mock-payloads/inventory.json b/test/remote-ansible/mock-payloads/inventory.json new file mode 100644 index 0000000..2795642 --- /dev/null +++ b/test/remote-ansible/mock-payloads/inventory.json @@ -0,0 +1,110 @@ +{ + "httpRequest" : { + "method" : "GET", + "path" : .PATH_INVENTORY_PAYLOAD + }, + "httpResponse" : { + "body" : { + "count": 1, + "next": null, + "previous": null, + "results": [ + { + "id": 1, + "type": "inventory", + "url": "/api/v2/inventories/1/", + "related": { + "created_by": "/api/v2/users/1/", + "modified_by": "/api/v2/users/1/", + "hosts": "/api/v2/inventories/1/hosts/", + "groups": "/api/v2/inventories/1/groups/", + "root_groups": "/api/v2/inventories/1/root_groups/", + "variable_data": "/api/v2/inventories/1/variable_data/", + "script": "/api/v2/inventories/1/script/", + "tree": "/api/v2/inventories/1/tree/", + "inventory_sources": "/api/v2/inventories/1/inventory_sources/", + "update_inventory_sources": "/api/v2/inventories/1/update_inventory_sources/", + "activity_stream": "/api/v2/inventories/1/activity_stream/", + "job_templates": "/api/v2/inventories/1/job_templates/", + "ad_hoc_commands": "/api/v2/inventories/1/ad_hoc_commands/", + "access_list": "/api/v2/inventories/1/access_list/", + "object_roles": "/api/v2/inventories/1/object_roles/", + "instance_groups": "/api/v2/inventories/1/instance_groups/", + "copy": "/api/v2/inventories/1/copy/", + "organization": "/api/v2/organizations/1/" + }, + "summary_fields": { + "organization": { + "id": 1, + "name": "Default", + "description": "" + }, + "created_by": { + "id": 1, + "username": "admin", + "first_name": "", + "last_name": "" + }, + "modified_by": { + "id": 1, + "username": "admin", + "first_name": "", + "last_name": "" + }, + "object_roles": { + "admin_role": { + "description": "Can manage all aspects of the inventory", + "name": "Admin", + "id": 21 + }, + "update_role": { + "description": "May update project or inventory or group using the configured source update system", + "name": "Update", + "id": 22 + }, + "adhoc_role": { + "description": "May run ad hoc commands on an inventory", + "name": "Ad Hoc", + "id": 23 + }, + "use_role": { + "description": "Can use the inventory in a job template", + "name": "Use", + "id": 24 + }, + "read_role": { + "description": "May view settings for the inventory", + "name": "Read", + "id": 25 + } + }, + "user_capabilities": { + "edit": true, + "delete": true, + "copy": true, + "adhoc": true + } + }, + "created": "2019-05-21T15:45:31.954359Z", + "modified": "2019-05-21T15:45:31.954378Z", + "name": "Demo Inventory", + "description": "", + "organization": 1, + "kind": "", + "host_filter": null, + "variables": "", + "has_active_failures": false, + "total_hosts": 1, + "hosts_with_active_failures": 0, + "total_groups": 0, + "groups_with_active_failures": 0, + "has_inventory_sources": false, + "total_inventory_sources": 0, + "inventory_sources_with_failures": 0, + "insights_credential": null, + "pending_deletion": false + } + ] + } + } +} diff --git a/test/remote-ansible/mock-payloads/job-execution.json b/test/remote-ansible/mock-payloads/job-execution.json new file mode 100644 index 0000000..22b152b --- /dev/null +++ b/test/remote-ansible/mock-payloads/job-execution.json @@ -0,0 +1,183 @@ +{ + "httpRequest" : { + "method" : "GET", + "path" : .PATH_JOB_EXECUTION_PAYLOAD + }, + "httpResponse" : { + "body" : { + "id": "456", + "type": "job", + "url": "/api/v2/jobs/456/", + "related": { + "created_by": "/api/v2/users/1/", + "labels": "/api/v2/jobs/456/labels/", + "inventory": "/api/v2/inventories/1/", + "project": "/api/v2/projects/8/", + "extra_credentials": "/api/v2/jobs/456/extra_credentials/", + "credentials": "/api/v2/jobs/456/credentials/", + "unified_job_template": "/api/v2/job_templates/123/", + "stdout": "/api/v2/jobs/456/stdout/", + "job_events": "/api/v2/jobs/456/job_events/", + "job_host_summaries": "/api/v2/jobs/456/job_host_summaries/", + "activity_stream": "/api/v2/jobs/456/activity_stream/", + "notifications": "/api/v2/jobs/456/notifications/", + "job_template": "/api/v2/job_templates/123/", + "cancel": "/api/v2/jobs/456/cancel/", + "create_schedule": "/api/v2/jobs/456/create_schedule/", + "relaunch": "/api/v2/jobs/456/relaunch/" + }, + "summary_fields": { + "inventory": { + "id": 1, + "name": "Demo Inventory", + "description": "", + "has_active_failures": false, + "total_hosts": 1, + "hosts_with_active_failures": 0, + "total_groups": 0, + "groups_with_active_failures": 0, + "has_inventory_sources": false, + "total_inventory_sources": 0, + "inventory_sources_with_failures": 0, + "organization_id": 1, + "kind": "" + }, + "project": { + "id": 8, + "name": "cds_playbooks", + "description": "CDS - cds_playbooks Project", + "status": "ok", + "scm_type": "" + }, + "job_template": { + "id": "123", + "name": "hello_world_job_template", + "description": "hello_world Runner Job Template" + }, + "unified_job_template": { + "id": "123", + "name": "hello_world_job_template", + "description": "hello_world Runner Job Template", + "unified_job_type": "job" + }, + "instance_group": { + "name": "tower", + "id": 1 + }, + "created_by": { + "id": 1, + "username": "admin", + "first_name": "", + "last_name": "" + }, + "user_capabilities": { + "delete": true, + "start": true + }, + "labels": { + "count": 0, + "results": [] + }, + "extra_credentials": [], + "credentials": [] + }, + "created": "2019-06-12T11:21:26.891986Z", + "modified": "2019-06-12T11:21:27.355185Z", + "name": "hello_world_job_template", + "description": "hello_world Runner Job Template", + "job_type": "run", + "inventory": 1, + "project": 8, + "playbook": "hello_world.yml", + "forks": 0, + "limit": "", + "verbosity": 0, + "extra_vars": "{\"tor_group\": \"vEPC\", \"site_id\": \"3 - Belmont\"}", + "job_tags": "", + "force_handlers": false, + "skip_tags": "", + "start_at_task": "", + "timeout": 0, + "use_fact_cache": false, + "unified_job_template": "123", + "launch_type": "manual", + "status": "successful", + "failed": false, + "started": "2019-06-12T11:21:27.510766Z", + "finished": "2019-06-12T11:21:48.993385Z", + "elapsed": 21.483, + "job_args": "[\"ansible-playbook\", \"-u\", \"root\", \"-i\", \"/tmp/awx_223_ft8hu4p4/tmptmtwllu4\", \"-e\", \"@/tmp/awx_223_ft8hu4p4/env/extravars\", \"hello_world.yml\"]", + "job_cwd": "/var/lib/awx/projects/cds_playbooks_folder", + "job_env": { + "HOSTNAME": "awx", + "LC_ALL": "en_US.UTF-8", + "VIRTUAL_ENV": "/var/lib/awx/venv/ansible", + "PATH": "/var/lib/awx/venv/ansible/bin:/var/lib/awx/venv/awx/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", + "SUPERVISOR_GROUP_NAME": "tower-processes", + "PWD": "/var/lib/awx", + "LANG": "en_US.UTF-8", + "PS1": "(awx) ", + "SUPERVISOR_ENABLED": "1", + "HOME": "/var/lib/awx", + "SHLVL": "2", + "LANGUAGE": "en_US.UTF-8", + "LC_CTYPE": "en_US.UTF-8", + "SUPERVISOR_PROCESS_NAME": "dispatcher", + "SUPERVISOR_SERVER_URL": "unix:///tmp/supervisor.sock", + "DJANGO_SETTINGS_MODULE": "awx.settings.production", + "DJANGO_LIVE_TEST_SERVER_ADDRESS": "localhost:9013-9199", + "TZ": "UTC", + "ANSIBLE_FORCE_COLOR": "True", + "ANSIBLE_HOST_KEY_CHECKING": "False", + "ANSIBLE_INVENTORY_UNPARSED_FAILED": "True", + "ANSIBLE_PARAMIKO_RECORD_HOST_KEYS": "False", + "ANSIBLE_VENV_PATH": "/var/lib/awx/venv/ansible", + "AWX_PRIVATE_DATA_DIR": "/tmp/awx_223_ft8hu4p4", + "PYTHONPATH": "/var/lib/awx/venv/ansible/lib/python2.7/site-packages:/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/lib:", + "JOB_ID": "456", + "INVENTORY_ID": "1", + "PROJECT_REVISION": "", + "ANSIBLE_RETRY_FILES_ENABLED": "False", + "MAX_EVENT_RES": "700000", + "ANSIBLE_CALLBACK_PLUGINS": "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/plugins/callback", + "AWX_HOST": "https://towerhost", + "ANSIBLE_SSH_CONTROL_PATH_DIR": "/tmp/awx_223_ft8hu4p4/cp", + "ANSIBLE_STDOUT_CALLBACK": "awx_display", + "AWX_ISOLATED_DATA_DIR": "/tmp/awx_223_ft8hu4p4/artifacts/456" + }, + "job_explanation": "", + "execution_node": "awx", + "controller_node": "", + "result_traceback": "", + "event_processing_finished": true, + "job_template": "123", + "passwords_needed_to_start": [], + "ask_diff_mode_on_launch": false, + "ask_variables_on_launch": true, + "ask_limit_on_launch": true, + "ask_tags_on_launch": true, + "ask_skip_tags_on_launch": true, + "ask_job_type_on_launch": false, + "ask_verbosity_on_launch": false, + "ask_inventory_on_launch": true, + "ask_credential_on_launch": true, + "allow_simultaneous": false, + "artifacts": {}, + "scm_revision": "", + "instance_group": 1, + "diff_mode": false, + "job_slice_number": 0, + "job_slice_count": 1, + "host_status_counts": { + "ok": 1 + }, + "playbook_counts": { + "play_count": 1, + "task_count": 2 + }, + "custom_virtualenv": "/var/lib/awx/venv/ansible", + "credential": null, + "vault_credential": null + } + } +} diff --git a/test/remote-ansible/mock-payloads/job-output.json b/test/remote-ansible/mock-payloads/job-output.json new file mode 100644 index 0000000..cd861c3 --- /dev/null +++ b/test/remote-ansible/mock-payloads/job-output.json @@ -0,0 +1,24 @@ +{ + "httpRequest" : { + "method" : "GET", + "path" : .PATH_JOB_OUTPUT_PAYLOAD + }, + "httpResponse" : { + "body" : " + + PLAY [Hello World Sample] ****************************************************** + + TASK [Gathering Facts] ********************************************************* + ok: [localhost] + + TASK [Hello Message] *********************************************************** + ok: [localhost] => { + \"msg\": \"Hello World!\" + } + + PLAY RECAP ********************************************************************* + localhost : ok=2 changed=0 unreachable=0 failed=0 + +" + } +} diff --git a/test/remote-ansible/mock-payloads/job-template-error.json b/test/remote-ansible/mock-payloads/job-template-error.json new file mode 100644 index 0000000..9b04240 --- /dev/null +++ b/test/remote-ansible/mock-payloads/job-template-error.json @@ -0,0 +1,8 @@ +{ + "httpRequest": { + "path": .PATH_JT_ERR_PAYLOAD + }, + "httpResponse": { + "statusCode": 500 + } +} diff --git a/test/remote-ansible/mock-payloads/job-template.json b/test/remote-ansible/mock-payloads/job-template.json new file mode 100644 index 0000000..942bed2 --- /dev/null +++ b/test/remote-ansible/mock-payloads/job-template.json @@ -0,0 +1,224 @@ +{ + "httpRequest" : { + "method" : "GET", + "path" : .PATH_JT_PAYLOAD + }, + "httpResponse" : { + "body" : { + "id": "123", + "type": "job_template", + "url": "/api/v2/job_templates/123/", + "related": { + "named_url": "/api/v2/job_templates/hello_world_job_template/", + "created_by": "/api/v2/users/1/", + "modified_by": "/api/v2/users/1/", + "labels": "/api/v2/job_templates/123/labels/", + "inventory": "/api/v2/inventories/1/", + "project": "/api/v2/projects/8/", + "extra_credentials": "/api/v2/job_templates/123/extra_credentials/", + "credentials": "/api/v2/job_templates/123/credentials/", + "last_job": "/api/v2/jobs/222/", + "jobs": "/api/v2/job_templates/123/jobs/", + "schedules": "/api/v2/job_templates/123/schedules/", + "activity_stream": "/api/v2/job_templates/123/activity_stream/", + "launch": "/api/v2/job_templates/123/launch/", + "notification_templates_any": "/api/v2/job_templates/123/notification_templates_any/", + "notification_templates_success": "/api/v2/job_templates/123/notification_templates_success/", + "notification_templates_error": "/api/v2/job_templates/123/notification_templates_error/", + "access_list": "/api/v2/job_templates/123/access_list/", + "survey_spec": "/api/v2/job_templates/123/survey_spec/", + "object_roles": "/api/v2/job_templates/123/object_roles/", + "instance_groups": "/api/v2/job_templates/123/instance_groups/", + "slice_workflow_jobs": "/api/v2/job_templates/123/slice_workflow_jobs/", + "copy": "/api/v2/job_templates/123/copy/" + }, + "summary_fields": { + "inventory": { + "id": 1, + "name": "Demo Inventory", + "description": "", + "has_active_failures": false, + "total_hosts": 1, + "hosts_with_active_failures": 0, + "total_groups": 0, + "groups_with_active_failures": 0, + "has_inventory_sources": false, + "total_inventory_sources": 0, + "inventory_sources_with_failures": 0, + "organization_id": 1, + "kind": "" + }, + "project": { + "id": 8, + "name": "cds_playbooks", + "description": "CDS - cds_playbooks Project", + "status": "ok", + "scm_type": "" + }, + "last_job": { + "id": 222, + "name": "hello_world_job_template", + "description": "hello_world Runner Job Template", + "finished": "2019-06-12T11:20:27.892787Z", + "status": "successful", + "failed": false + }, + "last_update": { + "id": 222, + "name": "hello_world_job_template", + "description": "hello_world Runner Job Template", + "status": "successful", + "failed": false + }, + "created_by": { + "id": 1, + "username": "admin", + "first_name": "", + "last_name": "" + }, + "modified_by": { + "id": 1, + "username": "admin", + "first_name": "", + "last_name": "" + }, + "object_roles": { + "admin_role": { + "description": "Can manage all aspects of the job template", + "name": "Admin", + "id": 51 + }, + "execute_role": { + "description": "May run the job template", + "name": "Execute", + "id": 52 + }, + "read_role": { + "description": "May view settings for the job template", + "name": "Read", + "id": 53 + } + }, + "user_capabilities": { + "edit": true, + "delete": true, + "start": true, + "schedule": true, + "copy": true + }, + "labels": { + "count": 0, + "results": [] + }, + "survey": { + "title": "", + "description": "" + }, + "recent_jobs": [ + { + "id": 222, + "status": "successful", + "finished": "2019-06-12T11:20:27.892787Z", + "type": "job" + }, + { + "id": 65, + "status": "successful", + "finished": "2019-06-03T18:27:19.114796Z", + "type": "job" + }, + { + "id": 64, + "status": "successful", + "finished": "2019-06-03T18:26:53.606618Z", + "type": "job" + }, + { + "id": 63, + "status": "successful", + "finished": "2019-06-03T18:24:36.072943Z", + "type": "job" + }, + { + "id": 62, + "status": "successful", + "finished": "2019-06-03T18:17:50.616528Z", + "type": "job" + }, + { + "id": 61, + "status": "successful", + "finished": "2019-06-03T18:04:42.995611Z", + "type": "job" + }, + { + "id": 60, + "status": "successful", + "finished": "2019-06-03T17:47:13.983951Z", + "type": "job" + }, + { + "id": 50, + "status": "successful", + "finished": "2019-05-30T15:47:55.700161Z", + "type": "job" + }, + { + "id": 49, + "status": "successful", + "finished": "2019-05-29T14:46:51.615926Z", + "type": "job" + }, + { + "id": 47, + "status": "successful", + "finished": "2019-05-27T20:23:58.656709Z", + "type": "job" + } + ], + "extra_credentials": [], + "credentials": [] + }, + "created": "2019-05-21T19:28:05.953730Z", + "modified": "2019-05-21T20:06:55.728697Z", + "name": "hello_world_job_template", + "description": "hello_world Runner Job Template", + "job_type": "run", + "inventory": 1, + "project": 8, + "playbook": "hello_world.yml", + "forks": 0, + "limit": "", + "verbosity": 0, + "extra_vars": "", + "job_tags": "", + "force_handlers": false, + "skip_tags": "", + "start_at_task": "", + "timeout": 0, + "use_fact_cache": false, + "last_job_run": "2019-06-12T11:20:27.892787Z", + "last_job_failed": false, + "next_job_run": null, + "status": "successful", + "host_config_key": "", + "ask_diff_mode_on_launch": false, + "ask_variables_on_launch": true, + "ask_limit_on_launch": true, + "ask_tags_on_launch": true, + "ask_skip_tags_on_launch": true, + "ask_job_type_on_launch": false, + "ask_verbosity_on_launch": false, + "ask_inventory_on_launch": true, + "ask_credential_on_launch": true, + "survey_enabled": true, + "become_enabled": false, + "diff_mode": false, + "allow_simultaneous": false, + "custom_virtualenv": null, + "job_slice_count": 1, + "credential": null, + "vault_credential": null + } + } +} diff --git a/test/remote-ansible/mock-payloads/post_job-template-launch.json b/test/remote-ansible/mock-payloads/post_job-template-launch.json new file mode 100644 index 0000000..531e471 --- /dev/null +++ b/test/remote-ansible/mock-payloads/post_job-template-launch.json @@ -0,0 +1,144 @@ +{ + "httpRequest" : { + "method" : "POST", + "path" : .PATH_POST_JT_LAUNCH_PAYLOAD + }, + "httpResponse" : { + "body" : { + "job": "456", + "ignored_fields": {}, + "id": "456", + "type": "job", + "url": "/api/v2/jobs/456/", + "related": { + "created_by": "/api/v2/users/1/", + "modified_by": "/api/v2/users/1/", + "labels": "/api/v2/jobs/456/labels/", + "inventory": "/api/v2/inventories/1/", + "project": "/api/v2/projects/8/", + "extra_credentials": "/api/v2/jobs/456/extra_credentials/", + "credentials": "/api/v2/jobs/456/credentials/", + "unified_job_template": "/api/v2/job_templates/123/", + "stdout": "/api/v2/jobs/456/stdout/", + "job_events": "/api/v2/jobs/456/job_events/", + "job_host_summaries": "/api/v2/jobs/456/job_host_summaries/", + "activity_stream": "/api/v2/jobs/456/activity_stream/", + "notifications": "/api/v2/jobs/456/notifications/", + "job_template": "/api/v2/job_templates/123/", + "cancel": "/api/v2/jobs/456/cancel/", + "create_schedule": "/api/v2/jobs/456/create_schedule/", + "relaunch": "/api/v2/jobs/456/relaunch/" + }, + "summary_fields": { + "inventory": { + "id": 1, + "name": "Demo Inventory", + "description": "", + "has_active_failures": false, + "total_hosts": 1, + "hosts_with_active_failures": 0, + "total_groups": 0, + "groups_with_active_failures": 0, + "has_inventory_sources": false, + "total_inventory_sources": 0, + "inventory_sources_with_failures": 0, + "organization_id": 1, + "kind": "" + }, + "project": { + "id": 8, + "name": "cds_playbooks", + "description": "CDS - cds_playbooks Project", + "status": "ok", + "scm_type": "" + }, + "job_template": { + "id": "123", + "name": "hello_world_job_template", + "description": "hello_world Runner Job Template" + }, + "unified_job_template": { + "id": "123", + "name": "hello_world_job_template", + "description": "hello_world Runner Job Template", + "unified_job_type": "job" + }, + "created_by": { + "id": 1, + "username": "admin", + "first_name": "", + "last_name": "" + }, + "modified_by": { + "id": 1, + "username": "admin", + "first_name": "", + "last_name": "" + }, + "user_capabilities": { + "delete": true, + "start": true + }, + "labels": { + "count": 0, + "results": [] + }, + "extra_credentials": [], + "credentials": [] + }, + "created": "2019-06-12T11:21:26.891986Z", + "modified": "2019-06-12T11:21:27.016410Z", + "name": "hello_world_job_template", + "description": "hello_world Runner Job Template", + "job_type": "run", + "inventory": 1, + "project": 8, + "playbook": "hello_world.yml", + "forks": 0, + "limit": "", + "verbosity": 0, + "extra_vars": "{\"tor_group\": \"vEPC\", \"site_id\": \"3 - Belmont\"}", + "job_tags": "", + "force_handlers": false, + "skip_tags": "", + "start_at_task": "", + "timeout": 0, + "use_fact_cache": false, + "unified_job_template": "123", + "launch_type": "manual", + "status": "pending", + "failed": false, + "started": null, + "finished": null, + "elapsed": 0, + "job_args": "", + "job_cwd": "", + "job_env": {}, + "job_explanation": "", + "execution_node": "", + "controller_node": "", + "result_traceback": "", + "event_processing_finished": false, + "job_template": "123", + "passwords_needed_to_start": [], + "ask_diff_mode_on_launch": false, + "ask_variables_on_launch": true, + "ask_limit_on_launch": true, + "ask_tags_on_launch": true, + "ask_skip_tags_on_launch": true, + "ask_job_type_on_launch": false, + "ask_verbosity_on_launch": false, + "ask_inventory_on_launch": true, + "ask_credential_on_launch": true, + "allow_simultaneous": false, + "artifacts": {}, + "scm_revision": "", + "instance_group": null, + "diff_mode": false, + "job_slice_number": 0, + "job_slice_count": 1, + "credential": null, + "vault_credential": null + } + } +} diff --git a/test/remote-ansible/remote-ansible-enrichment-test.sh b/test/remote-ansible/remote-ansible-enrichment-test.sh new file mode 100755 index 0000000..442ef0a --- /dev/null +++ b/test/remote-ansible/remote-ansible-enrichment-test.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="remote-ansible" +TEST_NAME="$CBA_NAME-enrichment" +TEST_NUMBER=$RANDOM +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" + +. ./$TEST_DIRECTORY/utils.sh + +export MOCK_SRV_SUCCESS="http://cds-regression-mockserver/mock-$CI_PIPELINE_ID/remote-ansible/success" +export MOCK_SRV_FAIL="http://cds-regression-mockserver/mock-$CI_PIPELINE_ID/remote-ansible/failure" +apply_env_to_definition $CBA_NAME + +echo "Compressing CBA: $CBA_NAME" +compress_cba $CBA_NAME + +echo "Enriching CBA: $CBA_NAME" +enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE + +echo 'Assert status 200' +assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/test/remote-ansible/remote-ansible-upload-test.sh b/test/remote-ansible/remote-ansible-upload-test.sh new file mode 100755 index 0000000..b1772b4 --- /dev/null +++ b/test/remote-ansible/remote-ansible-upload-test.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="remote-ansible" +TEST_NAME="$CBA_NAME-upload" +TEST_NUMBER=$RANDOM +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" +REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Uploading CBA: $CBA_NAME" +upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert status 200' +assert_status_code 200 $RESPONSE_HEADERS_FILE + +# This step prevents a race-condition for parallel process requests +# when cba has not yet been written to filesystem +echo 'Send process request to force CDS to load CBA to filesystem' +process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/test/remote-ansible/success/expected-response.json b/test/remote-ansible/success/expected-response.json new file mode 100644 index 0000000..5ade7b7 --- /dev/null +++ b/test/remote-ansible/success/expected-response.json @@ -0,0 +1,29 @@ +{ + "correlationUUID": null, + "commonHeader": { + "timestamp": "2020-06-03T16:20:03.527Z", + "originatorId": "System", + "requestId": "remote-ansible-success", + "subRequestId": "remote-ansible-success-1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-remote-ansible", + "blueprintVersion": "1.0.0", + "actionName": "execute-remote-ansible-success", + "mode": "sync" + }, + "status": { + "code": 200, + "eventType": "EVENT_COMPONENT_EXECUTED", + "timestamp": "2020-06-03T16:20:18.859Z", + "errorMessage": null, + "message": "success" + }, + "payload": { + "execute-remote-ansible-success-response": { + "ansible-command-status": "successful", + "ansible-command-logs": "Output for Job 456 :\n\n\n PLAY [Hello World Sample] ******************************************************\n\n TASK [Gathering Facts] *********************************************************\n ok: [localhost]\n\n TASK [Hello Message] ***********************************************************\n ok: [localhost] => {\n \"msg\": \"Hello World!\"\n }\n\n PLAY RECAP *********************************************************************\n localhost : ok=2 changed=0 unreachable=0 failed=0\n\n\n" + } + } +} diff --git a/test/remote-ansible/success/request-payload.json b/test/remote-ansible/success/request-payload.json new file mode 100644 index 0000000..3718c4d --- /dev/null +++ b/test/remote-ansible/success/request-payload.json @@ -0,0 +1,27 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "remote-ansible-success", + "subRequestId": "remote-ansible-success-1" + }, + "actionIdentifiers": { + "blueprintName": "RT-remote-ansible", + "blueprintVersion": "1.0.0", + "actionName": "execute-remote-ansible-success", + "mode": "sync" + }, + "payload": { + "execute-remote-ansible-success-request": { + "endpoint-selector": "awx", + "job-template-name": "hello_world_job_template", + "inventory": "Demo Inventory", + "limit": "123", + "tags": "some-tag", + "skip-tags": "some-skip-tag", + "extra-vars": { + "site_id": "3 - Belmont", + "tor_group": "vEPC" + } + } + } +} diff --git a/test/remote-ansible/success/test.sh b/test/remote-ansible/success/test.sh new file mode 100644 index 0000000..af75111 --- /dev/null +++ b/test/remote-ansible/success/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="remote-ansible" +TEST_NAME="success" +TEST_NUMBER=$RANDOM + +mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" + +REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" +EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" + +echo 'Calling CDS process' +process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert statuscode' +assert_status_code 200 $RESPONSE_HEADERS_FILE $RESPONSE_PAYLOAD_FILE + +echo 'Assert payload' +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/test/remote-python/connection-fail/expected-response.json b/test/remote-python/connection-fail/expected-response.json new file mode 100644 index 0000000..c9b15bd --- /dev/null +++ b/test/remote-python/connection-fail/expected-response.json @@ -0,0 +1,29 @@ +{ + "correlationUUID": null, + "commonHeader": { + "timestamp": "2020-06-09T21:02:52.783Z", + "originatorId": "System", + "requestId": "remote-python-connection-fail", + "subRequestId": "1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-remote-python", + "blueprintVersion": "1.0.0", + "actionName": "connection-fail", + "mode": "sync" + }, + "status": { + "code": 500, + "eventType": "EVENT_COMPONENT_FAILURE", + "timestamp": "2020-06-09T21:02:53.142Z", + "errorMessage": "FAILURE : prepare-env : Command failed during env. preparation... timeout(120) requestId (remote-python-connection-fail). grpcError: (finishConnect(..) failed: Connection refused: /127.0.0.1:4242)", + "message": "failure" + }, + "payload": { + "connection-fail-response": { + "execute-command-logs": "[]", + "execute-command-payload": "{}" + } + } +} diff --git a/test/remote-python/connection-fail/request-payload.json b/test/remote-python/connection-fail/request-payload.json new file mode 100644 index 0000000..4bcf8e2 --- /dev/null +++ b/test/remote-python/connection-fail/request-payload.json @@ -0,0 +1,16 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "remote-python-connection-fail", + "subRequestId": "1" + }, + "actionIdentifiers": { + "blueprintName": "RT-remote-python", + "blueprintVersion": "1.0.0", + "actionName": "connection-fail", + "mode": "sync" + }, + "payload": { + "connection-fail-request": {} + } +} diff --git a/test/remote-python/connection-fail/test.sh b/test/remote-python/connection-fail/test.sh new file mode 100644 index 0000000..a04fb91 --- /dev/null +++ b/test/remote-python/connection-fail/test.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="remote-python" +TEST_NAME="connection-fail" +TEST_NUMBER=$RANDOM + +mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" + +RESOURCES_DIR="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME" +REQUEST_PAYLOAD_FILE="$RESOURCES_DIR/request-payload.json" +EXPECTED_PAYLOAD_FILE="$RESOURCES_DIR/expected-response.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" + +echo 'Calling CDS process' +process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert statuscode' +assert_status_code 500 $RESPONSE_HEADERS_FILE + +echo 'Assert payload' +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/test/remote-python/dummy-request-payload.json b/test/remote-python/dummy-request-payload.json new file mode 100644 index 0000000..688e5e9 --- /dev/null +++ b/test/remote-python/dummy-request-payload.json @@ -0,0 +1,14 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "dummy-request-should-fail", + "subRequestId": "1" + }, + "actionIdentifiers": { + "blueprintName": "RT-remote-python", + "blueprintVersion": "1.0.0", + "actionName": "dummy", + "mode": "sync" + }, + "payload": {} +} diff --git a/test/remote-python/failing-script/expected-response.json b/test/remote-python/failing-script/expected-response.json new file mode 100644 index 0000000..119b135 --- /dev/null +++ b/test/remote-python/failing-script/expected-response.json @@ -0,0 +1,33 @@ +{ + "correlationUUID": "0ae1f48a-ec91-4573-af76-070ec42e2cdd", + "commonHeader": { + "timestamp": "2020-07-02T23:46:04.959Z", + "originatorId": "System", + "requestId": "remote-python-failing-script", + "subRequestId": "1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-remote-python", + "blueprintVersion": "1.0.0", + "actionName": "failing-remote-python", + "mode": "sync" + }, + "status": { + "code": 500, + "eventType": "EVENT_COMPONENT_FAILURE", + "timestamp": "2020-07-02T23:46:22.167Z", + "errorMessage": "FAILURE : execute-command : [\"Intentionally raised exception!\"]", + "message": "failure" + }, + "payload": { + "failing-remote-python-response": { + "execute-command-payload": { + "errorMessage": "Intentionally raised exception!" + }, + "execute-command-logs": [ + "Intentionally raised exception!" + ] + } + } +} diff --git a/test/remote-python/failing-script/request-payload.json b/test/remote-python/failing-script/request-payload.json new file mode 100644 index 0000000..d4c612c --- /dev/null +++ b/test/remote-python/failing-script/request-payload.json @@ -0,0 +1,16 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "remote-python-failing-script", + "subRequestId": "1" + }, + "actionIdentifiers": { + "blueprintName": "RT-remote-python", + "blueprintVersion": "1.0.0", + "actionName": "failing-remote-python", + "mode": "sync" + }, + "payload": { + "failing-remote-python-request": {} + } +} diff --git a/test/remote-python/failing-script/test.sh b/test/remote-python/failing-script/test.sh new file mode 100755 index 0000000..298c109 --- /dev/null +++ b/test/remote-python/failing-script/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="remote-python" +TEST_NAME="failing-script" +TEST_NUMBER=$RANDOM + +mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" + +REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" +EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" + +echo 'Calling CDS process' +process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert statuscode' +assert_status_code 500 $RESPONSE_HEADERS_FILE + +echo 'Assert payload' +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/test/remote-python/remote-python-enrichment-test.sh b/test/remote-python/remote-python-enrichment-test.sh new file mode 100755 index 0000000..2fa0049 --- /dev/null +++ b/test/remote-python/remote-python-enrichment-test.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="remote-python" +TEST_NAME="$CBA_NAME-enrichment" +TEST_NUMBER=$RANDOM +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" + +. ./$TEST_DIRECTORY/utils.sh + +export CMD_EXEC_SVC=${CMD_EXEC_SVC:-"cds-command-executor"} +apply_env_to_definition $CBA_NAME +echo "Compressing CBA: $CBA_NAME" +compress_cba $CBA_NAME + +echo "Enriching CBA: $CBA_NAME" +enrich_cba $CBA_NAME $RESPONSE_HEADERS_FILE + +echo 'Assert status 200' +assert_status_code 200 $RESPONSE_HEADERS_FILE diff --git a/test/remote-python/remote-python-upload-test.sh b/test/remote-python/remote-python-upload-test.sh new file mode 100755 index 0000000..c06780e --- /dev/null +++ b/test/remote-python/remote-python-upload-test.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="remote-python" +TEST_NAME="$CBA_NAME-upload" +TEST_NUMBER=$RANDOM +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$TEST_NAME-$TEST_NUMBER-response-payload" +REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/dummy-request-payload.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Uploading CBA: $CBA_NAME" +upload_cba $CBA_NAME $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert status 200' +assert_status_code 200 $RESPONSE_HEADERS_FILE + +# This step prevents a race-condition for parallel process requests +# when cba has not yet been written to filesystem +echo 'Send process request to force CDS to load CBA to filesystem' +process_cba $REQUEST_PAYLOAD_FILE '/dev/null' '/dev/null' diff --git a/test/remote-python/success/expected-response.json b/test/remote-python/success/expected-response.json new file mode 100644 index 0000000..8b0149f --- /dev/null +++ b/test/remote-python/success/expected-response.json @@ -0,0 +1,36 @@ +{ + "correlationUUID": "9acac95d-9b17-4224-9fe1-0cdb652d027c", + "commonHeader": { + "timestamp": "2020-07-02T22:52:50.662Z", + "originatorId": "System", + "requestId": "remote-python-request", + "subRequestId": "1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-remote-python", + "blueprintVersion": "1.0.0", + "actionName": "remote-python", + "mode": "sync" + }, + "status": { + "code": 200, + "eventType": "EVENT_COMPONENT_EXECUTED", + "timestamp": "2020-07-02T22:53:05.357Z", + "errorMessage": null, + "message": "success" + }, + "payload": { + "remote-python-response": { + "execute-command-payload": { + "abc": [ + "xyz", + "qqq" + ] + }, + "execute-command-logs": [ + "remote executor regression" + ] + } + } +} diff --git a/test/remote-python/success/request-payload.json b/test/remote-python/success/request-payload.json new file mode 100644 index 0000000..b3b9be8 --- /dev/null +++ b/test/remote-python/success/request-payload.json @@ -0,0 +1,16 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "remote-python-request", + "subRequestId": "1" + }, + "actionIdentifiers": { + "blueprintName": "RT-remote-python", + "blueprintVersion": "1.0.0", + "actionName": "remote-python", + "mode": "sync" + }, + "payload": { + "remote-python-request": {} + } +} diff --git a/test/remote-python/success/test.sh b/test/remote-python/success/test.sh new file mode 100755 index 0000000..8da31dc --- /dev/null +++ b/test/remote-python/success/test.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +CBA_NAME="remote-python" +TEST_NAME="success" +TEST_NUMBER=$RANDOM + +mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" +RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload" + +REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payload.json" +EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-response.json" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" + +echo 'Calling CDS process' +process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE + +echo 'Assert statuscode' +assert_status_code 200 $RESPONSE_HEADERS_FILE + +echo 'Assert payload' +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE diff --git a/test/resource-resolution/data-dict/RT-db.json b/test/resource-resolution/data-dict/RT-db.json new file mode 100644 index 0000000..d8e1daf --- /dev/null +++ b/test/resource-resolution/data-dict/RT-db.json @@ -0,0 +1,30 @@ +{ + "name": "RT-db", + "data_type": "string", + "description": "DB request for regression test", + "tags": "datetime", + "updatedBy": "Selfish", + "definition": { + "name": "RT-db", + "tags": "RT-db", + "updated-by": "Selffish", + "property": { + "description": "DB request for regression test", + "type": "string" + }, + "sources": { + "processor-db": { + "type": "source-db", + "properties": { + "endpoint-selector": "db-endpoint", + "type": "SQL", + "query": "select sdnctl.RESOURCE_RESOLUTION.value from sdnctl.RESOURCE_RESOLUTION where value='ok'", + "input-key-mapping": {}, + "output-key-mapping": { + "value": "value" + } + } + } + } + } +} diff --git a/test/resource-resolution/data-dict/RT-kotlin.json b/test/resource-resolution/data-dict/RT-kotlin.json new file mode 100644 index 0000000..c521792 --- /dev/null +++ b/test/resource-resolution/data-dict/RT-kotlin.json @@ -0,0 +1,26 @@ +{ + "name": "kotlin-script", + "data_type": "string", + "description": "Kotlin script used to read properties.", + "tags": "kotlin-script", + "updatedBy": "Self-fish", + "definition": { + "name": "kotlin-script", + "updated-by": "Selffish", + "tags": "properties-capability-source", + "property": { + "description": "Kotlin script used to read properties.", + "type": "string" + }, + "sources": { + "capability": { + "type": "source-capability", + "properties": { + "script-type": "kotlin", + "script-class-reference": "cba.cds.RT.ResolvPropertiesKt", + "instance-dependencies": [] + } + } + } + } +} diff --git a/test/resource-resolution/data-dict/RT-rest-delete.json b/test/resource-resolution/data-dict/RT-rest-delete.json new file mode 100644 index 0000000..c1cef3b --- /dev/null +++ b/test/resource-resolution/data-dict/RT-rest-delete.json @@ -0,0 +1,32 @@ +{ + "name": "RT-rest-delete", + "data_type": "string", + "description": "Rest DELETE request for regression test", + "tags": "RT-rest-delete", + "updatedBy": "Selfish", + "definition": { + "name": "RT-rest-delete", + "tags": "RT-rest-delete", + "updated-by": "Selffish", + "property": { + "description": "Rest DELETE request for regression test", + "type": "string" + }, + "sources": { + "sdnc": { + "type": "source-rest", + "properties": { + "type": "string", + "verb": "DELETE", + "url-path": "/delete", + "endpoint-selector": "rest-endpoint", + "path": "", + "input-key-mapping": {}, + "output-key-mapping": { + "value": "value" + } + } + } + } + } +} diff --git a/test/resource-resolution/data-dict/RT-rest-get-id.json b/test/resource-resolution/data-dict/RT-rest-get-id.json new file mode 100644 index 0000000..b665027 --- /dev/null +++ b/test/resource-resolution/data-dict/RT-rest-get-id.json @@ -0,0 +1,34 @@ +{ + "name": "RT-rest-get-id", + "data_type": "string", + "description": "Rest GET request using input key mapping", + "tags": "RT-rest-get-id", + "updatedBy": "Selfish", + "definition": { + "name": "RT-rest-get-id", + "tags": "RT-rest-get-id", + "updated-by": "Selffish", + "property": { + "description": "Rest GET request using input key mapping", + "type": "string" + }, + "sources": { + "sdnc": { + "type": "source-rest", + "properties": { + "type": "string", + "verb": "GET", + "url-path": "/get/$id/id", + "endpoint-selector": "rest-endpoint", + "path": "", + "input-key-mapping": { + "id": "j_get" + }, + "output-key-mapping": { + "value": "value" + } + } + } + } + } +} diff --git a/test/resource-resolution/data-dict/RT-rest-get.json b/test/resource-resolution/data-dict/RT-rest-get.json new file mode 100644 index 0000000..210ac27 --- /dev/null +++ b/test/resource-resolution/data-dict/RT-rest-get.json @@ -0,0 +1,32 @@ +{ + "name": "RT-rest-get", + "data_type": "string", + "description": "Rest GET request for regression test", + "tags": "RT-rest-get", + "updatedBy": "Selfish", + "definition": { + "name": "RT-rest-get", + "tags": "RT-rest-get", + "updated-by": "Selffish", + "property": { + "description": "Rest GET request for regression test", + "type": "string" + }, + "sources": { + "sdnc": { + "type": "source-rest", + "properties": { + "type": "string", + "verb": "GET", + "url-path": "/get", + "endpoint-selector": "rest-endpoint", + "path": "", + "input-key-mapping": {}, + "output-key-mapping": { + "value": "value" + } + } + } + } + } +} diff --git a/test/resource-resolution/data-dict/RT-rest-patch.json b/test/resource-resolution/data-dict/RT-rest-patch.json new file mode 100644 index 0000000..41f94da --- /dev/null +++ b/test/resource-resolution/data-dict/RT-rest-patch.json @@ -0,0 +1,32 @@ +{ + "name": "RT-rest-patch", + "data_type": "string", + "description": "Rest PATCH request for regression test", + "tags": "RT-rest-patch", + "updatedBy": "Selfish", + "definition": { + "name": "RT-rest-patch", + "tags": "RT-rest-patch", + "updated-by": "Selffish", + "property": { + "description": "Rest PATCH request for regression test", + "type": "string" + }, + "sources": { + "sdnc": { + "type": "source-rest", + "properties": { + "type": "string", + "verb": "PATCH", + "url-path": "/patch", + "endpoint-selector": "rest-endpoint", + "path": "", + "input-key-mapping": {}, + "output-key-mapping": { + "value": "value" + } + } + } + } + } +} diff --git a/test/resource-resolution/data-dict/RT-rest-post.json b/test/resource-resolution/data-dict/RT-rest-post.json new file mode 100644 index 0000000..63721bb --- /dev/null +++ b/test/resource-resolution/data-dict/RT-rest-post.json @@ -0,0 +1,32 @@ +{ + "name": "RT-rest-post", + "data_type": "string", + "description": "Rest POST request for regression test", + "tags": "RT-rest-post", + "updatedBy": "Selfish", + "definition": { + "name": "RT-rest-post", + "tags": "RT-rest-post", + "updated-by": "Selffish", + "property": { + "description": "Rest POST request for regression test", + "type": "string" + }, + "sources": { + "sdnc": { + "type": "source-rest", + "properties": { + "type": "string", + "verb": "POST", + "url-path": "/post", + "endpoint-selector": "rest-endpoint", + "path": "", + "input-key-mapping": {}, + "output-key-mapping": { + "value": "value" + } + } + } + } + } +} diff --git a/test/resource-resolution/data-dict/RT-rest-put.json b/test/resource-resolution/data-dict/RT-rest-put.json new file mode 100644 index 0000000..cf165d3 --- /dev/null +++ b/test/resource-resolution/data-dict/RT-rest-put.json @@ -0,0 +1,32 @@ +{ + "name": "RT-rest-put", + "data_type": "string", + "description": "Rest PUT request for regression test", + "tags": "RT-rest-put", + "updatedBy": "Selfish", + "definition": { + "name": "RT-rest-put", + "tags": "RT-rest-put", + "updated-by": "Selffish", + "property": { + "description": "Rest PUT request for regression test", + "type": "string" + }, + "sources": { + "sdnc": { + "type": "source-rest", + "properties": { + "type": "string", + "verb": "PUT", + "url-path": "/put", + "endpoint-selector": "rest-endpoint", + "path": "", + "input-key-mapping": {}, + "output-key-mapping": { + "value": "value" + } + } + } + } + } +} diff --git a/test/resource-resolution/dummy-request-payload.json b/test/resource-resolution/dummy-request-payload.json new file mode 100644 index 0000000..60b3442 --- /dev/null +++ b/test/resource-resolution/dummy-request-payload.json @@ -0,0 +1,14 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "dummy-request-should-fail", + "subRequestId": "11" + }, + "actionIdentifiers": { + "blueprintName": "RT-resource-resolution", + "blueprintVersion": "1.0.0", + "actionName": "dummy", + "mode": "sync" + }, + "payload": {} +} diff --git a/test/resource-resolution/init-mockserver.sh b/test/resource-resolution/init-mockserver.sh new file mode 100755 index 0000000..8a75a10 --- /dev/null +++ b/test/resource-resolution/init-mockserver.sh @@ -0,0 +1,93 @@ +#!/bin/bash +# +# Copyright (C) 2020 Bell Canada. +# +# 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. +# + +OP=expectation +if [[ $1 == rm ]]; then + OP=clear +fi + +curl -vLk -X PUT "http://$CLUSTER_IP:$MOCKSERVER_NODEPORT/mockserver/$OP" -d @- < $2 +} + +# Uploads CBA to CDS +# +# Input Arguments: +# 1. CBA name +# 2. filepath for response payload output +# 3. filepath for response header output +upload_cba() { + curl -vLks ${CDS_BASE_URL}${UPLOAD_PATH} \ + -H "$CONTENT_TYPE_FORM_DATA" \ + -H "$AUTHORIZATION_HEADER" \ + -F file="@$CBA_ENRICHED_FOLDER/$1.zip" \ + > $2 \ + 2> $3 +} + +# Uploads DD to CDS +# +# Input Arguments: +# 1. filepath for request payload json file +# 2. filepath for response payload output +# 3. filepath for response header output +upload_dd() { + curl -vLks ${CDS_BASE_URL}${DATA_DICTIONARY_PATH} \ + -H "$CONTENT_TYPE_APPLICATION_JSON" \ + -H "$AUTHORIZATION_HEADER" \ + --data "@$1" \ + >$2 \ + 2> $3 +} + +# Sends process request to CDS +# +# Input Arguments: +# 1. filepath for request payload json file +# 2. filepath for response payload output +# 3. filepath for response header output +process_cba() { + curl -vLks ${CDS_BASE_URL}${PROCESS_PATH} \ + -H "$CONTENT_TYPE_APPLICATION_JSON" \ + -H "$AUTHORIZATION_HEADER" \ + --data "@$1" \ + >$2 \ + 2> $3 +} + +# Bootstrap CDS request (Frankfurt and up) +# Input arguments: +# 1. filepath for response payload output +# 2. filepath for response header output +bootstrap_cds() { + curl -vLks ${CDS_BASE_URL}${BOOTSTRAP_PATH} \ + -H "$CONTENT_TYPE_APPLICATION_JSON" \ + -H "$AUTHORIZATION_HEADER" \ + --data-raw '{ + "loadModelType" : true, + "loadResourceDictionary" : true, + "loadCBA" : false +}'>$1 2>$2 + +} + +# Downloads a model-type from CDS +# Input arguments: +# 1. model-type name +# 2. filepath for response payload output +# 3. filepath for response header output +download_modeltype() { + curl -vLks ${CDS_BASE_URL}${MODEL_TYPE_PATH}/$1 \ + -H "$CONTENT_TYPE_APPLICATION_JSON" \ + -H "$AUTHORIZATION_HEADER" \ + >$2 2>$3 +} + +# ------------------------------------------------------------------ +# Blueprint modifications +# ------------------------------------------------------------------ + + +# Sets a value in the definition json file +# Input arguments +# 1: CBA name +# 1: jq path for value to be set +# 2: value +definition_set_value() { + local BLUEPRINT_DEFINITION_FILE=`grep "Entry" $CBA_DIRECTORY/$1/TOSCA-Metadata/TOSCA.meta|awk '{ print $2 }'` + local TEMPFILE=`mktemp` + jq "$2=$3" < $CBA_DIRECTORY/$1/$BLUEPRINT_DEFINITION_FILE > $TEMPFILE + mv $TEMPFILE $CBA_DIRECTORY/$1/$BLUEPRINT_DEFINITION_FILE +} + +# Applies environment variables to blueprint definition template +# Input arguments +# 1: CBA name +apply_env_to_definition() { + local BLUEPRINT_DEFINITION_FILE=`grep "Entry" $CBA_DIRECTORY/$1/TOSCA-Metadata/TOSCA.meta|awk '{ print $2 }'` + apply_env_to_json_template $CBA_DIRECTORY/$1/$BLUEPRINT_DEFINITION_FILE +} + +# Makes environment variables available for json templating using jq path +# example template { "cds-version": .CDS_VERSION } - will populate value CDS_VERSION from env +# Input arguments +# 1: template file +apply_env_to_json_template() { + local TEMPFILE=`mktemp` + jq -n env|jq -f $1 > $TEMPFILE + mv $TEMPFILE $1 +} + +# ------------------------------------------------------------------ +# Assert Functions +# ------------------------------------------------------------------ + +match() { + local input="$(cat)" + local m="$(grep -o "$1" <<<"$input")" + test "$m" || tee -a $FAILED_TESTS_LOG < $EXPECTED + jq 'del(.correlationUUID,.[].timestamp?)' < $2 > $ACTUAL + assert_json_equals $EXPECTED $ACTUAL +} + +# Asserts response status code +# +# Input arguments: +# 1. expected response code, eg. 200 +# 2. filepath for response header file + +assert_status_code() { match "^< HTTP/.* $1 " < $2; } + +exit_on_errors() { + if [ -s $FAILED_TESTS_LOG ] + then exit 1 + fi +} -- cgit 1.2.3-korg