diff --git a/tests/robot/apps/automation/ansible/tower/ansible_tower.json b/tests/robot/apps/automation/ansible/tower/ansible_tower.json new file mode 100644 index 000000000..deab256bf --- /dev/null +++ b/tests/robot/apps/automation/ansible/tower/ansible_tower.json @@ -0,0 +1,92 @@ +{ + "uuid": "54ff47ec-292e-487b-ab22-42c08b05dd91", + "lastMigration": 32, + "name": "Ansible tower", + "endpointPrefix": "", + "latency": 0, + "port": 3000, + "hostname": "", + "folders": [], + "routes": [ + { + "uuid": "781bf78c-43f7-4da1-9515-1d324b7a59d1", + "type": "http", + "documentation": "", + "method": "get", + "endpoint": "api/v2/hosts", + "responses": [ + { + "uuid": "a4edd4f6-d560-44d5-8faf-3e6d532e22b4", + "body": "{\n \"count\": 20,\n \"next\": {{#if (lt (queryParam 'page') 2)}}\"/api/v2/hosts\"{{else}}null{{/if}},\n \"previous\": {{#if (gte (queryParam 'page') 2)}}\"/api/v2/hosts\"{{else}}null{{/if}},\n \"results\": [\n {\n \"ansible_facts_modified\": null,\n \"created\": \"2018-02-01T08:00:00.000000Z\",\n \"description\": \"\",\n \"enabled\": true,\n \"has_active_failures\": false,\n \"has_inventory_sources\": false,\n \"id\": 14,\n \"insights_system_id\": null,\n \"instance_id\": \"\",\n \"inventory\": 1,\n \"last_job\": null,\n \"last_job_host_summary\": null,\n \"modified\": \"2018-02-01T08:00:00.000000Z\",\n \"name\": \"host-13\",\n \"related\": {\n \"activity_stream\": \"/api/v2/hosts/14/activity_stream/\",\n \"ad_hoc_command_events\": \"/api/v2/hosts/14/ad_hoc_command_events/\",\n \"ad_hoc_commands\": \"/api/v2/hosts/14/ad_hoc_commands/\",\n \"all_groups\": \"/api/v2/hosts/14/all_groups/\",\n \"ansible_facts\": \"/api/v2/hosts/14/ansible_facts/\",\n \"groups\": \"/api/v2/hosts/14/groups/\",\n \"insights\": \"/api/v2/hosts/14/insights/\",\n \"inventory\": \"/api/v2/inventories/1/\",\n \"inventory_sources\": \"/api/v2/hosts/14/inventory_sources/\",\n \"job_events\": \"/api/v2/hosts/14/job_events/\",\n \"job_host_summaries\": \"/api/v2/hosts/14/job_host_summaries/\",\n \"smart_inventories\": \"/api/v2/hosts/14/smart_inventories/\",\n \"variable_data\": \"/api/v2/hosts/14/variable_data/\"\n },\n \"summary_fields\": {\n \"groups\": {\n \"count\": 0,\n \"results\": []\n },\n \"inventory\": {\n \"description\": \"\",\n \"has_active_failures\": false,\n \"has_inventory_sources\": false,\n \"hosts_with_active_failures\": 0,\n \"id\": 1,\n \"inventory_sources_with_failures\": 0,\n \"kind\": \"\",\n \"name\": \"test-inv\",\n \"organization_id\": 1,\n \"total_groups\": 0,\n \"total_hosts\": 0,\n \"total_inventory_sources\": 0\n },\n \"recent_jobs\": [],\n \"user_capabilities\": {\n \"delete\": true,\n \"edit\": true\n }\n },\n \"type\": \"host\",\n \"url\": \"/api/v2/hosts/14/\",\n \"variables\": \"\"\n },\n {\n \"ansible_facts_modified\": null,\n \"created\": \"2018-02-01T08:00:00.000000Z\",\n \"description\": \"\",\n \"enabled\": true,\n \"has_active_failures\": false,\n \"has_inventory_sources\": false,\n \"id\": 15,\n \"insights_system_id\": null,\n \"instance_id\": \"\",\n \"inventory\": 1,\n \"last_job\": null,\n \"last_job_host_summary\": null,\n \"modified\": \"2018-02-01T08:00:00.000000Z\",\n \"name\": \"host-14\",\n \"related\": {\n \"activity_stream\": \"/api/v2/hosts/15/activity_stream/\",\n \"ad_hoc_command_events\": \"/api/v2/hosts/15/ad_hoc_command_events/\",\n \"ad_hoc_commands\": \"/api/v2/hosts/15/ad_hoc_commands/\",\n \"all_groups\": \"/api/v2/hosts/15/all_groups/\",\n \"ansible_facts\": \"/api/v2/hosts/15/ansible_facts/\",\n \"groups\": \"/api/v2/hosts/15/groups/\",\n \"insights\": \"/api/v2/hosts/15/insights/\",\n \"inventory\": \"/api/v2/inventories/1/\",\n \"inventory_sources\": \"/api/v2/hosts/15/inventory_sources/\",\n \"job_events\": \"/api/v2/hosts/15/job_events/\",\n \"job_host_summaries\": \"/api/v2/hosts/15/job_host_summaries/\",\n \"smart_inventories\": \"/api/v2/hosts/15/smart_inventories/\",\n \"variable_data\": \"/api/v2/hosts/15/variable_data/\"\n },\n \"summary_fields\": {\n \"groups\": {\n \"count\": 0,\n \"results\": []\n },\n \"inventory\": {\n \"description\": \"\",\n \"has_active_failures\": false,\n \"has_inventory_sources\": false,\n \"hosts_with_active_failures\": 0,\n \"id\": 1,\n \"inventory_sources_with_failures\": 0,\n \"kind\": \"\",\n \"name\": \"test-inv\",\n \"organization_id\": 1,\n \"total_groups\": 0,\n \"total_hosts\": 0,\n \"total_inventory_sources\": 0\n },\n \"recent_jobs\": [],\n \"user_capabilities\": {\n \"delete\": true,\n \"edit\": true\n }\n },\n \"type\": \"host\",\n \"url\": \"/api/v2/hosts/15/\",\n \"variables\": \"\"\n },\n {\n \"ansible_facts_modified\": null,\n \"created\": \"2018-02-01T08:00:00.000000Z\",\n \"description\": \"\",\n \"enabled\": true,\n \"has_active_failures\": false,\n \"has_inventory_sources\": false,\n \"id\": 16,\n \"insights_system_id\": null,\n \"instance_id\": \"\",\n \"inventory\": 1,\n \"last_job\": null,\n \"last_job_host_summary\": null,\n \"modified\": \"2018-02-01T08:00:00.000000Z\",\n \"name\": \"host-15\",\n \"related\": {\n \"activity_stream\": \"/api/v2/hosts/16/activity_stream/\",\n \"ad_hoc_command_events\": \"/api/v2/hosts/16/ad_hoc_command_events/\",\n \"ad_hoc_commands\": \"/api/v2/hosts/16/ad_hoc_commands/\",\n \"all_groups\": \"/api/v2/hosts/16/all_groups/\",\n \"ansible_facts\": \"/api/v2/hosts/16/ansible_facts/\",\n \"groups\": \"/api/v2/hosts/16/groups/\",\n \"insights\": \"/api/v2/hosts/16/insights/\",\n \"inventory\": \"/api/v2/inventories/1/\",\n \"inventory_sources\": \"/api/v2/hosts/16/inventory_sources/\",\n \"job_events\": \"/api/v2/hosts/16/job_events/\",\n \"job_host_summaries\": \"/api/v2/hosts/16/job_host_summaries/\",\n \"smart_inventories\": \"/api/v2/hosts/16/smart_inventories/\",\n \"variable_data\": \"/api/v2/hosts/16/variable_data/\"\n },\n \"summary_fields\": {\n \"groups\": {\n \"count\": 0,\n \"results\": []\n },\n \"inventory\": {\n \"description\": \"\",\n \"has_active_failures\": false,\n \"has_inventory_sources\": false,\n \"hosts_with_active_failures\": 0,\n \"id\": 1,\n \"inventory_sources_with_failures\": 0,\n \"kind\": \"\",\n \"name\": \"test-inv\",\n \"organization_id\": 1,\n \"total_groups\": 0,\n \"total_hosts\": 0,\n \"total_inventory_sources\": 0\n },\n \"recent_jobs\": [],\n \"user_capabilities\": {\n \"delete\": true,\n \"edit\": true\n }\n },\n \"type\": \"host\",\n \"url\": \"/api/v2/hosts/16/\",\n \"variables\": \"\"\n },\n {\n \"ansible_facts_modified\": null,\n \"created\": \"2018-02-01T08:00:00.000000Z\",\n \"description\": \"\",\n \"enabled\": true,\n \"has_active_failures\": false,\n \"has_inventory_sources\": false,\n \"id\": 17,\n \"insights_system_id\": null,\n \"instance_id\": \"\",\n \"inventory\": 1,\n \"last_job\": null,\n \"last_job_host_summary\": null,\n \"modified\": \"2018-02-01T08:00:00.000000Z\",\n \"name\": \"host-16\",\n \"related\": {\n \"activity_stream\": \"/api/v2/hosts/17/activity_stream/\",\n \"ad_hoc_command_events\": \"/api/v2/hosts/17/ad_hoc_command_events/\",\n \"ad_hoc_commands\": \"/api/v2/hosts/17/ad_hoc_commands/\",\n \"all_groups\": \"/api/v2/hosts/17/all_groups/\",\n \"ansible_facts\": \"/api/v2/hosts/17/ansible_facts/\",\n \"groups\": \"/api/v2/hosts/17/groups/\",\n \"insights\": \"/api/v2/hosts/17/insights/\",\n \"inventory\": \"/api/v2/inventories/1/\",\n \"inventory_sources\": \"/api/v2/hosts/17/inventory_sources/\",\n \"job_events\": \"/api/v2/hosts/17/job_events/\",\n \"job_host_summaries\": \"/api/v2/hosts/17/job_host_summaries/\",\n \"smart_inventories\": \"/api/v2/hosts/17/smart_inventories/\",\n \"variable_data\": \"/api/v2/hosts/17/variable_data/\"\n },\n \"summary_fields\": {\n \"groups\": {\n \"count\": 0,\n \"results\": []\n },\n \"inventory\": {\n \"description\": \"\",\n \"has_active_failures\": false,\n \"has_inventory_sources\": false,\n \"hosts_with_active_failures\": 0,\n \"id\": 1,\n \"inventory_sources_with_failures\": 0,\n \"kind\": \"\",\n \"name\": \"test-inv\",\n \"organization_id\": 1,\n \"total_groups\": 0,\n \"total_hosts\": 0,\n \"total_inventory_sources\": 0\n },\n \"recent_jobs\": [],\n \"user_capabilities\": {\n \"delete\": true,\n \"edit\": true\n }\n },\n \"type\": \"host\",\n \"url\": \"/api/v2/hosts/17/\",\n \"variables\": \"\"\n },\n {\n \"ansible_facts_modified\": null,\n \"created\": \"2018-02-01T08:00:00.000000Z\",\n \"description\": \"\",\n \"enabled\": true,\n \"has_active_failures\": false,\n \"has_inventory_sources\": false,\n \"id\": 18,\n \"insights_system_id\": null,\n \"instance_id\": \"\",\n \"inventory\": 1,\n \"last_job\": null,\n \"last_job_host_summary\": null,\n \"modified\": \"2018-02-01T08:00:00.000000Z\",\n \"name\": \"host-17\",\n \"related\": {\n \"activity_stream\": \"/api/v2/hosts/18/activity_stream/\",\n \"ad_hoc_command_events\": \"/api/v2/hosts/18/ad_hoc_command_events/\",\n \"ad_hoc_commands\": \"/api/v2/hosts/18/ad_hoc_commands/\",\n \"all_groups\": \"/api/v2/hosts/18/all_groups/\",\n \"ansible_facts\": \"/api/v2/hosts/18/ansible_facts/\",\n \"groups\": \"/api/v2/hosts/18/groups/\",\n \"insights\": \"/api/v2/hosts/18/insights/\",\n \"inventory\": \"/api/v2/inventories/1/\",\n \"inventory_sources\": \"/api/v2/hosts/18/inventory_sources/\",\n \"job_events\": \"/api/v2/hosts/18/job_events/\",\n \"job_host_summaries\": \"/api/v2/hosts/18/job_host_summaries/\",\n \"smart_inventories\": \"/api/v2/hosts/18/smart_inventories/\",\n \"variable_data\": \"/api/v2/hosts/18/variable_data/\"\n },\n \"summary_fields\": {\n \"groups\": {\n \"count\": 0,\n \"results\": []\n },\n \"inventory\": {\n \"description\": \"\",\n \"has_active_failures\": false,\n \"has_inventory_sources\": false,\n \"hosts_with_active_failures\": 0,\n \"id\": 1,\n \"inventory_sources_with_failures\": 0,\n \"kind\": \"\",\n \"name\": \"test-inv\",\n \"organization_id\": 1,\n \"total_groups\": 0,\n \"total_hosts\": 0,\n \"total_inventory_sources\": 0\n },\n \"recent_jobs\": [],\n \"user_capabilities\": {\n \"delete\": true,\n \"edit\": true\n }\n },\n \"type\": \"host\",\n \"url\": \"/api/v2/hosts/18/\",\n \"variables\": \"\"\n }\n ]\n}", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": true, + "crudKey": "id", + "callbacks": [] + } + ], + "responseMode": null + } + ], + "rootChildren": [ + { + "type": "route", + "uuid": "781bf78c-43f7-4da1-9515-1d324b7a59d1" + } + ], + "proxyMode": false, + "proxyHost": "", + "proxyRemovePrefix": false, + "tlsOptions": { + "enabled": false, + "type": "CERT", + "pfxPath": "", + "certPath": "", + "keyPath": "", + "caPath": "", + "passphrase": "" + }, + "cors": true, + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Access-Control-Allow-Origin", + "value": "*" + }, + { + "key": "Access-Control-Allow-Methods", + "value": "GET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS" + }, + { + "key": "Access-Control-Allow-Headers", + "value": "Content-Type, Origin, Accept, Authorization, Content-Length, X-Requested-With" + } + ], + "proxyReqHeaders": [ + { + "key": "", + "value": "" + } + ], + "proxyResHeaders": [ + { + "key": "", + "value": "" + } + ], + "data": [], + "callbacks": [] +} \ No newline at end of file diff --git a/tests/robot/apps/automation/ansible/tower/hosts.robot b/tests/robot/apps/automation/ansible/tower/hosts.robot new file mode 100644 index 000000000..6812f9980 --- /dev/null +++ b/tests/robot/apps/automation/ansible/tower/hosts.robot @@ -0,0 +1,38 @@ +*** Settings *** +Documentation Check the hosts mode with api custom mode + +Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource + +Test Timeout 120s + +Test Setup Set Test Variable ${cnt} ${1} +Test Teardown Set Test Variable ${cnt} ${cnt + 1} + + + +*** Variables *** +${CMD} ${CENTREON_PLUGINS} +... --plugin=apps::automation::ansible::tower::plugin +... --custommode=api +... --hostname=host.docker.internal +... --username=username +... --password=password +... --port=3000 + + +*** Test Cases *** +Hosts ${tc} + [Documentation] Check the number of returned hosts + [Tags] apps automation ansible service-disco + ${command} Catenate + ... ${CMD} + ... --mode=hosts + ${output} Run ${command} + ${output} Strip String ${output} + Should Be Equal As Strings + ... ${expected_result} + ... ${output} + ... Wrong output result for command:{\n}{\n}${command}{\n}{\n}Command output:{\n}{\n}${output} + + Examples: tc snmpcommunity expected_result -- + ... 1 os/linux/snmp/list-diskio OK: Hosts total: 10, failed: 0 - All hosts are ok | 'hosts.total.count'=10;;;0; 'hosts.failed.count'=0;;;0;10 diff --git a/tests/robot/apps/microsoft/hyperv/2012/local/nodeintegrationservice.robot b/tests/robot/apps/microsoft/hyperv/2012/local/nodeintegrationservice.robot index 7cd3da3d8..6edc44e22 100644 --- a/tests/robot/apps/microsoft/hyperv/2012/local/nodeintegrationservice.robot +++ b/tests/robot/apps/microsoft/hyperv/2012/local/nodeintegrationservice.robot @@ -13,7 +13,7 @@ ${CMD} ${CENTREON_PLUGINS} ... --command=cat ... --command-path=/usr/bin ... --no-ps -... --command-options=nodeintegrationservice-2022.json +... --command-options=${CURDIR}/nodeintegrationservice-2022.json *** Test Cases *** HyperV 2022 ${tc}/3