Use global variables for tests (usefull for local tests) + robotidy

This commit is contained in:
Sophie Depassio 2024-07-10 16:21:28 +02:00 committed by sfarouq-ext
parent 434aea8b4c
commit bf44aa0c6b
27 changed files with 126 additions and 355 deletions

View File

@ -1,5 +1,6 @@
*** Settings *** *** Settings ***
Documentation This is the documentation for the import resource file. Documentation This is the documentation for the import resource file.
Library Examples Library Examples
Library OperatingSystem Library OperatingSystem
Library String Library String

View File

@ -1,12 +1,19 @@
*** Settings *** *** Settings ***
Documentation Centreon Plugins for Robot Framework Documentation Centreon Plugins for Robot Framework
Library Process Library Process
*** Variables *** *** Variables ***
${CENTREON_PLUGINS} perl ${CURDIR}${/}..${/}..${/}src${/}centreon_plugins.pl ${CENTREON_PLUGINS} perl ${CURDIR}${/}..${/}..${/}src${/}centreon_plugins.pl
# one we use package, we need to remove the "perl" part to be sure the plugin is executable and is correctly formated # one we use package, we need to remove the "perl" part to be sure the plugin is executable and is correctly formated
# with a shebang at the top. # with a shebang at the top.
${PERCENT} % ${HOSTNAME} 127.0.0.1
${APIPORT} 3000
${SNMPPORT} 2024
${SNMPVERSION} 2c
${PERCENT} %
*** Keywords *** *** Keywords ***
Start Mockoon Start Mockoon
@ -19,5 +26,6 @@ Start Mockoon
... --port ... --port
... 3000 ... 3000
Sleep 10s Sleep 10s
Stop Mockoon Stop Mockoon
Terminate All Processes Terminate All Processes

View File

@ -36,12 +36,45 @@
} }
], ],
"responseMode": null "responseMode": null
},
{
"uuid": "f912f745-85f5-4313-9852-682f55b256bb",
"type": "http",
"documentation": "",
"method": "get",
"endpoint": "api/v2/unified_jobs",
"responses": [
{
"uuid": "158d9bce-bc86-4411-8977-afac4a1eaedd",
"body": "{\n \"count\": 1,\n \"next\": {{#if (lt (queryParam 'page') 2)}}\"/api/v2/unified_jobs\"{{else}}null{{/if}},\n \"previous\": {{#if (gte (queryParam 'page') 2)}}\"/api/v2/unified_jobs\"{{else}}null{{/if}},\n \"results\": [\n {\n \"allow_simultaneous\": false,\n \"artifacts\": {},\n \"canceled_on\": null,\n \"controller_node\": \"\",\n \"created\": \"2018-02-01T08:00:00.000000Z\",\n \"description\": \"\",\n \"diff_mode\": false,\n \"elapsed\": 0,\n \"execution_node\": \"\",\n \"extra_vars\": \"{}\",\n \"failed\": false,\n \"finished\": null,\n \"force_handlers\": false,\n \"forks\": 0,\n \"id\": 1,\n \"instance_group\": null,\n \"inventory\": null,\n \"job_explanation\": \"\",\n \"job_slice_count\": 1,\n \"job_slice_number\": 0,\n \"job_tags\": \"\",\n \"job_template\": 1,\n \"job_type\": \"run\",\n \"launch_type\": \"manual\",\n \"limit\": \"\",\n \"modified\": \"2018-02-01T08:00:00.000000Z\",\n \"name\": \"\",\n \"organization\": null,\n \"passwords_needed_to_start\": [],\n \"playbook\": \"\",\n \"project\": null,\n \"related\": {\n \"activity_stream\": \"/api/v2/jobs/1/activity_stream/\",\n \"cancel\": \"/api/v2/jobs/1/cancel/\",\n \"create_schedule\": \"/api/v2/jobs/1/create_schedule/\",\n \"credentials\": \"/api/v2/jobs/1/credentials/\",\n \"job_events\": \"/api/v2/jobs/1/job_events/\",\n \"job_host_summaries\": \"/api/v2/jobs/1/job_host_summaries/\",\n \"job_template\": \"/api/v2/job_templates/1/\",\n \"labels\": \"/api/v2/jobs/1/labels/\",\n \"notifications\": \"/api/v2/jobs/1/notifications/\",\n \"relaunch\": \"/api/v2/jobs/1/relaunch/\",\n \"stdout\": \"/api/v2/jobs/1/stdout/\",\n \"unified_job_template\": \"/api/v2/job_templates/1/\"\n },\n \"scm_branch\": \"\",\n \"scm_revision\": \"\",\n \"skip_tags\": \"\",\n \"start_at_task\": \"\",\n \"started\": null,\n \"status\": \"new\",\n \"summary_fields\": {\n \"credentials\": [],\n \"job_template\": {\n \"description\": \"\",\n \"id\": 1,\n \"name\": \"\"\n },\n \"labels\": {\n \"count\": 0,\n \"results\": []\n },\n \"unified_job_template\": {\n \"description\": \"\",\n \"id\": 1,\n \"name\": \"\",\n \"unified_job_type\": \"job\"\n },\n \"user_capabilities\": {\n \"delete\": true,\n \"start\": false\n }\n },\n \"timeout\": 0,\n \"type\": \"job\",\n \"unified_job_template\": 1,\n \"url\": \"/api/v2/jobs/1/\",\n \"use_fact_cache\": false,\n \"verbosity\": 0,\n \"webhook_credential\": null,\n \"webhook_guid\": \"\",\n \"webhook_service\": \"\"\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": [ "rootChildren": [
{ {
"type": "route", "type": "route",
"uuid": "781bf78c-43f7-4da1-9515-1d324b7a59d1" "uuid": "781bf78c-43f7-4da1-9515-1d324b7a59d1"
},
{
"type": "route",
"uuid": "f912f745-85f5-4313-9852-682f55b256bb"
} }
], ],
"proxyMode": false, "proxyMode": false,

View File

@ -3,21 +3,21 @@ Documentation Check the hosts mode with api custom mode
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource
Suite Setup Start Mockoon ${MOCKOON_JSON}
Suite Teardown Stop Mockoon
Test Timeout 120s Test Timeout 120s
Test Setup Set Test Variable ${cnt} ${1}
Test Teardown Set Test Variable ${cnt} ${cnt + 1}
*** Variables *** *** Variables ***
${CMD} ${CENTREON_PLUGINS} ${MOCKOON_JSON} ${CURDIR}${/}ansible_tower.json
... --plugin=apps::automation::ansible::tower::plugin
... --custommode=api ${CMD} ${CENTREON_PLUGINS}
... --hostname=host.docker.internal ... --plugin=apps::automation::ansible::tower::plugin
... --username=username ... --custommode=api
... --password=password ... --hostname=${HOSTNAME}
... --port=3000 ... --username=username
... --password=password
... --port=${APIPORT}
*** Test Cases *** *** Test Cases ***

View File

@ -15,6 +15,7 @@ ${CMD} ${CENTREON_PLUGINS}
... --no-ps ... --no-ps
... --command-options=${CURDIR}/nodeintegrationservice-2022.json ... --command-options=${CURDIR}/nodeintegrationservice-2022.json
*** Test Cases *** *** Test Cases ***
HyperV 2022 ${tc}/3 HyperV 2022 ${tc}/3
[Documentation] Apps Microsoft HyperV 2022 [Documentation] Apps Microsoft HyperV 2022
@ -34,4 +35,3 @@ HyperV 2022 ${tc}/3
... 1 ${EMPTY} CRITICAL: 1 problem(s) detected ... 1 ${EMPTY} CRITICAL: 1 problem(s) detected
... 2 VSERVER05 OK: VM 'VSERVER05' 0 problem(s) detected - VM 'VSERVER05' 0 problem(s) detected ... 2 VSERVER05 OK: VM 'VSERVER05' 0 problem(s) detected - VM 'VSERVER05' 0 problem(s) detected
... 3 VSERVER07 CRITICAL: VM 'VSERVER07' 1 problem(s) detected ... 3 VSERVER07 CRITICAL: VM 'VSERVER07' 1 problem(s) detected

View File

@ -11,9 +11,13 @@ Test Timeout 120s
*** Variables *** *** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}collection-centreon-web.mockoon.json ${MOCKOON_JSON} ${CURDIR}${/}collection-centreon-web.mockoon.json
${CMD} ${CENTREON_PLUGINS} --plugin apps::protocols::http::plugin --mode collection ${CMD} ${CENTREON_PLUGINS} --plugin=apps::protocols::http::plugin
... --constant='hostname=127.0.0.1' --constant='protocol=http' --constant='port=3000' ... --mode collection
... --constant='username=admin' --constant='password=myPassword' ... --constant='hostname=${HOSTNAME}'
... --constant='protocol=http'
... --constant='port=${APIPORT}'
... --constant='username=admin'
... --constant='password=myPassword'
*** Test Cases *** *** Test Cases ***

View File

@ -16,9 +16,9 @@ SNMP Collection - Sputnik Environment ${tc}/3
${command} Catenate ${command} Catenate
... ${CMD} ... ${CMD}
... --mode=collection ... --mode=collection
... --hostname=127.0.0.1 ... --hostname=${HOSTNAME}
... --snmp-version=2c ... --snmp-version=${SNMPVERSION}
... --snmp-port=2024 ... --snmp-port=${SNMPPORT}
... --snmp-community=apps/protocols/snmp/collection-sputnik ... --snmp-community=apps/protocols/snmp/collection-sputnik
... --config=${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}src/contrib/collection/snmp/sputnik-environment.json ... --config=${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}src/contrib/collection/snmp/sputnik-environment.json

View File

@ -9,7 +9,7 @@ Test Timeout 120s
*** Variables *** *** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}vault-authentication-hashicorp.json ${MOCKOON_JSON} ${CURDIR}${/}vault-authentication-hashicorp.json
${CMD} ${CENTREON_PLUGINS} --plugin apps::protocols::snmp::plugin --hostname=127.0.0.1 ${CMD} ${CENTREON_PLUGINS} --plugin apps::protocols::snmp::plugin --hostname=${HOSTNAME}
*** Test Cases *** *** Test Cases ***
@ -19,16 +19,16 @@ check hashicorp vault manager${Name}
${cmd_hashicorp} Catenate ${cmd_hashicorp} Catenate
... ${CMD} ... ${CMD}
... --pass-manager=hashicorpvault ... --pass-manager=hashicorpvault
... --vault-address=127.0.0.1 ... --vault-address=${HOSTNAME}
... --vault-port=3000 ... --vault-port=${APIPORT}
... --vault-protocol=http ... --vault-protocol=http
... --auth-method=userpass ... --auth-method=userpass
... --auth-settings="username=hcvaultuser" ... --auth-settings="username=hcvaultuser"
... --secret-path="path/of/the/secret" ... --secret-path="path/of/the/secret"
... --snmp-port=2024 ... --snmp-port=${SNMPPORT}
... --map-option="snmp_community=\\%{value_path/of/the/secret}" ... --map-option="snmp_community=\\%{value_path/of/the/secret}"
... --mode=string-value ... --mode=string-value
... --snmp-version=2c ... --snmp-version=${SNMPVERSION}
... --snmp-community=apps/protocols/snmp/snmp-single-oid ... --snmp-community=apps/protocols/snmp/snmp-single-oid
... --oid='.1.3.6.1.2.1.1.1.0' ${path-param} ... --oid='.1.3.6.1.2.1.1.1.0' ${path-param}
... --format-ok='current value is: \\%{details_ok}' ... --format-ok='current value is: \\%{details_ok}'

View File

@ -11,29 +11,30 @@ Test Timeout 120s
*** Variables *** *** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}cloud-azure-policyinsights-policystates.json ${MOCKOON_JSON} ${CURDIR}${/}cloud-azure-policyinsights-policystates.json
${LOGIN_ENDPOINT} http://localhost:3000/login ${BASE_URL} http://${HOSTNAME}:${APIPORT}
${LOGIN_ENDPOINT} ${BASE_URL}/login
${CMD} ${CENTREON_PLUGINS} --plugin=cloud::azure::policyinsights::policystates::plugin --subscription=subscription --tenant=tenant --client-id=client_id --client-secret=secret --statefile-dir=/tmp/cache/ --login-endpoint=${LOGIN_ENDPOINT} ${CMD} ${CENTREON_PLUGINS} --plugin=cloud::azure::policyinsights::policystates::plugin --subscription=subscription --tenant=tenant --client-id=client_id --client-secret=secret --statefile-dir=/tmp/cache/ --login-endpoint=${LOGIN_ENDPOINT}
&{compliance_value1} &{compliance_value1}
... endpoint=http://localhost:3000/ok ... endpoint=${BASE_URL}/ok
... policyname= ... policyname=
... resourcelocation= ... resourcelocation=
... resourcetype= ... resourcetype=
... result=OK: Number of non compliant policies: 0 - All compliances states are ok | 'policies.non_compliant.count'=0;;;0; ... result=OK: Number of non compliant policies: 0 - All compliances states are ok | 'policies.non_compliant.count'=0;;;0;
&{compliance_value2} &{compliance_value2}
... endpoint=http://localhost:3000/oknextlink ... endpoint=${BASE_URL}/oknextlink
... policyname=9daedab3-fb2d-461e-b861-71790eead4f6 ... policyname=9daedab3-fb2d-461e-b861-71790eead4f6
... resourcelocation= ... resourcelocation=
... resourcetype= ... resourcetype=
... result=OK: Number of non compliant policies: 0 - All compliances states are ok | 'policies.non_compliant.count'=0;;;0; ... result=OK: Number of non compliant policies: 0 - All compliances states are ok | 'policies.non_compliant.count'=0;;;0;
&{compliance_value3} &{compliance_value3}
... endpoint=http://localhost:3000/nok1 ... endpoint=${BASE_URL}/nok1
... policyname=9daedab3-fb2d-461e-b861-71790eead4f6 ... policyname=9daedab3-fb2d-461e-b861-71790eead4f6
... resourcelocation=fr ... resourcelocation=fr
... resourcetype= ... resourcetype=
... result=CRITICAL: Compliance state for policy '9daedab3-fb2d-461e-b861-71790eead4f6' on resource 'mypubip1' is 'NonCompliant' | 'policies.non_compliant.count'=1;;;0; ... result=CRITICAL: Compliance state for policy '9daedab3-fb2d-461e-b861-71790eead4f6' on resource 'mypubip1' is 'NonCompliant' | 'policies.non_compliant.count'=1;;;0;
&{compliance_value4} &{compliance_value4}
... endpoint=http://localhost:3000/nok2 ... endpoint=${BASE_URL}/nok2
... policyname=9daedab3-fb2d-461e-b861-71790eead4f6 ... policyname=9daedab3-fb2d-461e-b861-71790eead4f6
... resourcelocation=fr ... resourcelocation=fr
... resourcetype=ip ... resourcetype=ip

View File

@ -10,8 +10,8 @@ Test Timeout 120s
${CMD} ${CENTREON_PLUGINS} ${CMD} ${CENTREON_PLUGINS}
... --plugin=hardware::devices::camera::avigilon::snmp::plugin ... --plugin=hardware::devices::camera::avigilon::snmp::plugin
... --mode=memory ... --mode=memory
... --hostname=127.0.0.1 ... --hostname=${HOSTNAME}
... --snmp-port=2024 ... --snmp-port=${SNMPPORT}
*** Test Cases *** *** Test Cases ***

View File

@ -10,8 +10,8 @@ Test Timeout 120s
${CMD} ${CENTREON_PLUGINS} ${CMD} ${CENTREON_PLUGINS}
... --plugin=hardware::devices::camera::avigilon::snmp::plugin ... --plugin=hardware::devices::camera::avigilon::snmp::plugin
... --mode=storage ... --mode=storage
... --hostname=127.0.0.1 ... --hostname=${HOSTNAME}
... --snmp-port=2024 ... --snmp-port=${SNMPPORT}
*** Test Cases *** *** Test Cases ***

View File

@ -10,8 +10,8 @@ Test Timeout 120s
${CMD} ${CENTREON_PLUGINS} ${CMD} ${CENTREON_PLUGINS}
... --plugin=hardware::devices::camera::avigilon::snmp::plugin ... --plugin=hardware::devices::camera::avigilon::snmp::plugin
... --mode=temperature ... --mode=temperature
... --hostname=127.0.0.1 ... --hostname=${HOSTNAME}
... --snmp-port=2024 ... --snmp-port=${SNMPPORT}
*** Test Cases *** *** Test Cases ***

View File

@ -7,9 +7,6 @@ Test Timeout 120s
*** Variables *** *** Variables ***
${HOSTADDRESS} 127.0.0.1
${SNMPPORT} 2024
${SNMPVERSION} 2c
${SNMPCOMMUNITY} hardware/kvm/avocent/acs/8000/avocent8000 ${SNMPCOMMUNITY} hardware/kvm/avocent/acs/8000/avocent8000
@ -93,7 +90,7 @@ Run Avocent 8000 Plugin
... ${CENTREON_PLUGINS} ... ${CENTREON_PLUGINS}
... --plugin=hardware::kvm::avocent::acs::8000::snmp::plugin ... --plugin=hardware::kvm::avocent::acs::8000::snmp::plugin
... --mode=${mode} ... --mode=${mode}
... --hostname=${HOSTADDRESS} ... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION} ... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT} ... --snmp-port=${SNMPPORT}
... --snmp-community=${SNMPCOMMUNITY} ... --snmp-community=${SNMPCOMMUNITY}

View File

@ -7,7 +7,7 @@ Test Timeout 120s
*** Variables *** *** Variables ***
${CMD} ${CENTREON_PLUGINS} --plugin=hardware::sensors::apc::snmp::plugin --mode=sensors --hostname=127.0.0.1 --snmp-version=2c --snmp-port=2024 ${CMD} ${CENTREON_PLUGINS} --plugin=hardware::sensors::apc::snmp::plugin --mode=sensors --hostname=${HOSTNAME} --snmp-version=${SNMPVERSION} --snmp-port=${SNMPPORT}
*** Test Cases *** *** Test Cases ***

View File

@ -16,9 +16,9 @@ Sputnik UPS - Environment ${tc}/9
${command} Catenate ${command} Catenate
... ${CMD} ... ${CMD}
... --mode=environment ... --mode=environment
... --hostname=127.0.0.1 ... --hostname=${HOSTNAME}
... --snmp-version=2c ... --snmp-version=${SNMPVERSION}
... --snmp-port=2024 ... --snmp-port=${SNMPPORT}
... --snmp-community=hardware/ups/inmatics/sputnik/snmp/hardware-ups-sputnik ... --snmp-community=hardware/ups/inmatics/sputnik/snmp/hardware-ups-sputnik
# Append options to command # Append options to command

View File

@ -16,9 +16,9 @@ Battery ${tc}/4
${command} Catenate ${command} Catenate
... ${CMD} ... ${CMD}
... --mode=battery ... --mode=battery
... --hostname=127.0.0.1 ... --hostname=${HOSTNAME}
... --snmp-version=2c ... --snmp-version=${SNMPVERSION}
... --snmp-port=2024 ... --snmp-port=${SNMPPORT}
... --snmp-community=hardware/ups/socomec/netvision/snmp/battery ... --snmp-community=hardware/ups/socomec/netvision/snmp/battery
# Append options to command # Append options to command

View File

@ -65,9 +65,9 @@ Hardware UPS Standard SNMP input lines
${command} Catenate ${command} Catenate
... ${CMD} ... ${CMD}
... --mode=input-lines ... --mode=input-lines
... --hostname=127.0.0.1 ... --hostname=${HOSTNAME}
... --snmp-version=2c ... --snmp-version=${SNMPVERSION}
... --snmp-port=2024 ... --snmp-port=${SNMPPORT}
... --snmp-community=${ups_standard_test.snmpcommunity} ... --snmp-community=${ups_standard_test.snmpcommunity}
${length} Get Length ${ups_standard_test.warningpower} ${length} Get Length ${ups_standard_test.warningpower}
IF ${length} > 0 IF ${length} > 0

View File

@ -7,7 +7,7 @@ Test Timeout 120s
*** Variables *** *** Variables ***
${CMD} ${CENTREON_PLUGINS} --plugin=network::aruba::instant::snmp::plugin --mode=ap-usage --hostname=127.0.0.1 --snmp-version=2c --snmp-port=2024 ${CMD} ${CENTREON_PLUGINS} --plugin=network::aruba::instant::snmp::plugin --mode=ap-usage --hostname=${HOSTNAME} --snmp-version=${SNMPVERSION} --snmp-port=${SNMPPORT}
&{ap_usage_test_1} &{ap_usage_test_1}
... documentation=Test AP usage without filters ... documentation=Test AP usage without filters

View File

@ -10,15 +10,16 @@ Test Timeout 120s
*** Variables *** *** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}meraki.mockoon.json ${MOCKOON_JSON} ${CURDIR}${/}meraki.mockoon.json
${CMD} ${CENTREON_PLUGINS} --plugin=network::cisco::meraki::cloudcontroller::restapi::plugin ${CMD} ${CENTREON_PLUGINS} --plugin=network::cisco::meraki::cloudcontroller::restapi::plugin
... --api-token=EEECGFCGFCGF ... --api-token=EEECGFCGFCGF
... --statefile-dir=/dev/shm/ ... --statefile-dir=/dev/shm/
*** Test Cases *** *** Test Cases ***
Create cache from API Create cache from API
[Tags] meraki api vpn network cache [Tags] meraki api vpn network cache
${output} Run ${output} Run
... ${CMD} --mode=cache --proto http --port 3000 --hostname=127.0.0.1 ... ${CMD} --mode=cache --proto=http --port=${APIPORT} --hostname=${HOSTNAME}
${output} Strip String ${output} ${output} Strip String ${output}
Should Be Equal As Strings Should Be Equal As Strings
@ -43,4 +44,3 @@ Check if ${test_desc} works
... all links .* OK: vpn tunnel 'C3PO-R2P2-BB88' status: dormant [mode: spoke] | 'vpn.tunnels.online.count'=0;;;0;1 'vpn.tunnels.offline.count'=0;;;0;1 'vpn.tunnels.dormant.count'=1;;1:;0;1 ... all links .* OK: vpn tunnel 'C3PO-R2P2-BB88' status: dormant [mode: spoke] | 'vpn.tunnels.online.count'=0;;;0;1 'vpn.tunnels.offline.count'=0;;;0;1 'vpn.tunnels.dormant.count'=1;;1:;0;1
... empty filter ${EMPTY} OK: vpn tunnel 'C3PO-R2P2-BB88' status: dormant [mode: spoke] | 'vpn.tunnels.online.count'=0;;;0;1 'vpn.tunnels.offline.count'=0;;;0;1 'vpn.tunnels.dormant.count'=1;;1:;0;1 ... empty filter ${EMPTY} OK: vpn tunnel 'C3PO-R2P2-BB88' status: dormant [mode: spoke] | 'vpn.tunnels.online.count'=0;;;0;1 'vpn.tunnels.offline.count'=0;;;0;1 'vpn.tunnels.dormant.count'=1;;1:;0;1
... absurd filter toto CRITICAL: Vpn tunnels dormant: 0 | 'vpn.tunnels.online.count'=0;;;0;0 'vpn.tunnels.offline.count'=0;;;0;0 'vpn.tunnels.dormant.count'=0;;1:;0;0 ... absurd filter toto CRITICAL: Vpn tunnels dormant: 0 | 'vpn.tunnels.online.count'=0;;;0;0 'vpn.tunnels.offline.count'=0;;;0;0 'vpn.tunnels.dormant.count'=0;;1:;0;0

View File

@ -17,8 +17,8 @@ check psu components ${tc}/2
${command} Catenate ${command} Catenate
... ${CMD} ... ${CMD}
... --mode=health ... --mode=health
... --hostname='127.0.0.1' ... --hostname=${HOSTNAME}
... --snmp-port='2024' ... --snmp-port=${SNMPPORT}
... --snmp-community='network/citrix/netscaler/snmp/mode/components/${community}' ... --snmp-community='network/citrix/netscaler/snmp/mode/components/${community}'
... --component=psu ... --component=psu
... --alternative-status-mapping='${alternative_status_mapping}' ... --alternative-status-mapping='${alternative_status_mapping}'

View File

@ -306,9 +306,9 @@ Network Fortinet Fortigate SNMP link monitor
${command} Catenate ${command} Catenate
... ${CMD} ... ${CMD}
... --mode=link-monitor ... --mode=link-monitor
... --hostname=127.0.0.1 ... --hostname=${HOSTNAME}
... --snmp-version=2c ... --snmp-version=${SNMPVERSION}
... --snmp-port=2024 ... --snmp-port=${SNMPPORT}
... --snmp-community=network/fortinet/fortigate/snmp/linkmonitor ... --snmp-community=network/fortinet/fortigate/snmp/linkmonitor
${length} Get Length ${fortinet_fortigate_linkmonitor_test.filterid} ${length} Get Length ${fortinet_fortigate_linkmonitor_test.filterid}
IF ${length} > 0 IF ${length} > 0
@ -399,9 +399,9 @@ Network Fortinet Fortigate SNMP list link monitor
${command} Catenate ${command} Catenate
... ${CMD} ... ${CMD}
... --mode=list-link-monitors ... --mode=list-link-monitors
... --hostname=127.0.0.1 ... --hostname=${HOSTNAME}
... --snmp-version=2c ... --snmp-version=${SNMPVERSION}
... --snmp-port=2024 ... --snmp-port=${SNMPPORT}
... --snmp-community=network/fortinet/fortigate/snmp/linkmonitor ... --snmp-community=network/fortinet/fortigate/snmp/linkmonitor
${length} Get Length ${fortinet_fortigate_listlinkmonitors_test.filterstate} ${length} Get Length ${fortinet_fortigate_listlinkmonitors_test.filterstate}
IF ${length} > 0 IF ${length} > 0

View File

@ -1,273 +0,0 @@
*** Settings ***
Documentation Network Teldat SNMP plugin
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource
Test Timeout 120s
*** Variables ***
${CMD} ${CENTREON_PLUGINS} --plugin=network::teldat::snmp::plugin
# Test simple usage of the CPU mode
&{teldat_cpu_test1}
... warningcpuutilization5s=
... criticalcpuutilization5s=
... warningcpuutilization1m=
... criticalcpuutilization1m=
... warningcpuutilization5m=
... criticalcpuutilization5m=
... result=OK: cpu average usage: 1.00 % (5s), 1.00 % (1m), 1.00 % (5m) | 'cpu.utilization.5s.percentage'=1.00%;;;0;100 'cpu.utilization.1m.percentage'=1.00%;;;0;100 'cpu.utilization.15m.percentage'=1.00%;;;0;100
# Test CPU mode with warning-cpu-utilization-5s option set to a 0.5
&{teldat_cpu_test2}
... warningcpuutilization5s=0.5
... criticalcpuutilization5s=
... warningcpuutilization1m=
... criticalcpuutilization1m=
... warningcpuutilization5m=
... criticalcpuutilization5m=
... result=WARNING: cpu average usage: 1.00 % (5s) | 'cpu.utilization.5s.percentage'=1.00%;0:0.5;;0;100 'cpu.utilization.1m.percentage'=1.00%;;;0;100 'cpu.utilization.15m.percentage'=1.00%;;;0;100
# Test CPU mode with critical-cpu-utilization-5s option set to a 0.5
&{teldat_cpu_test3}
... warningcpuutilization5s=
... criticalcpuutilization5s=0.5
... warningcpuutilization1m=
... criticalcpuutilization1m=
... warningcpuutilization5m=
... criticalcpuutilization5m=
... result=CRITICAL: cpu average usage: 1.00 % (5s) | 'cpu.utilization.5s.percentage'=1.00%;;0:0.5;0;100 'cpu.utilization.1m.percentage'=1.00%;;;0;100 'cpu.utilization.15m.percentage'=1.00%;;;0;100
# Test CPU mode with warning-cpu-utilization-1m option set to a 0.5
&{teldat_cpu_test4}
... warningcpuutilization5s=
... criticalcpuutilization5s=
... warningcpuutilization1m=0.5
... criticalcpuutilization1m=
... warningcpuutilization5m=
... criticalcpuutilization5m=
... result=WARNING: cpu average usage: 1.00 % (1m) | 'cpu.utilization.5s.percentage'=1.00%;;;0;100 'cpu.utilization.1m.percentage'=1.00%;0:0.5;;0;100 'cpu.utilization.15m.percentage'=1.00%;;;0;100
# Test CPU mode with critical-cpu-utilization-1m option set to a 0.5
&{teldat_cpu_test5}
... warningcpuutilization5s=
... criticalcpuutilization5s=
... warningcpuutilization1m=
... criticalcpuutilization1m=0.5
... warningcpuutilization5m=
... criticalcpuutilization5m=
... result=CRITICAL: cpu average usage: 1.00 % (1m) | 'cpu.utilization.5s.percentage'=1.00%;;;0;100 'cpu.utilization.1m.percentage'=1.00%;;0:0.5;0;100 'cpu.utilization.15m.percentage'=1.00%;;;0;100
# Test CPU mode with warning-cpu-utilization-5m option set to a 0.5
&{teldat_cpu_test6}
... warningcpuutilization5s=
... criticalcpuutilization5s=
... warningcpuutilization1m=
... criticalcpuutilization1m=
... warningcpuutilization5m=0.5
... criticalcpuutilization5m=
... result=WARNING: cpu average usage: 1.00 % (5m) | 'cpu.utilization.5s.percentage'=1.00%;;;0;100 'cpu.utilization.1m.percentage'=1.00%;;;0;100 'cpu.utilization.15m.percentage'=1.00%;0:0.5;;0;100
# Test CPU mode with critical-cpu-utilization-5m option set to a 0.5
&{teldat_cpu_test7}
... warningcpuutilization5s=
... criticalcpuutilization5s=
... warningcpuutilization1m=
... criticalcpuutilization1m=
... warningcpuutilization5m=
... criticalcpuutilization5m=0.5
... result=CRITICAL: cpu average usage: 1.00 % (5m) | 'cpu.utilization.5s.percentage'=1.00%;;;0;100 'cpu.utilization.1m.percentage'=1.00%;;;0;100 'cpu.utilization.15m.percentage'=1.00%;;0:0.5;0;100
@{teldat_cpu_tests}
... &{teldat_cpu_test1}
... &{teldat_cpu_test2}
... &{teldat_cpu_test3}
... &{teldat_cpu_test4}
... &{teldat_cpu_test5}
... &{teldat_cpu_test6}
... &{teldat_cpu_test7}
# Test simple usage of the memory mode
&{teldat_memory_test1}
... warningusage=
... criticalusage=
... warningusagefree=
... criticalusagefree=
... warningusageprct=
... criticalusageprct=
... result=OK: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;;;0;268435456 'system#memory.free.bytes'=163015856B;;;0;268435456 'system#memory.usage.percentage'=39.27%;;;0;100
# Test memory mode with warning-usage option set to a 100
&{teldat_memory_test2}
... warningusage=100
... criticalusage=
... warningusagefree=
... criticalusagefree=
... warningusageprct=
... criticalusageprct=
... result=WARNING: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;0:100;;0;268435456 'system#memory.free.bytes'=163015856B;;;0;268435456 'system#memory.usage.percentage'=39.27%;;;0;100
# Test memory mode with critical-usage option set to a 100
&{teldat_memory_test3}
... warningusage=
... criticalusage=100
... warningusagefree=
... criticalusagefree=
... warningusageprct=
... criticalusageprct=
... result=CRITICAL: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;;0:100;0;268435456 'system#memory.free.bytes'=163015856B;;;0;268435456 'system#memory.usage.percentage'=39.27%;;;0;100
# Test memory mode with warning-usage-free option set to a 100
&{teldat_memory_test4}
... warningusage=
... criticalusage=
... warningusagefree=100
... criticalusagefree=
... warningusageprct=
... criticalusageprct=
... result=WARNING: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;;;0;268435456 'system#memory.free.bytes'=163015856B;0:100;;0;268435456 'system#memory.usage.percentage'=39.27%;;;0;100
# Test memory mode with critical-usage-free option set to a 100
&{teldat_memory_test5}
... warningusage=
... criticalusage=
... warningusagefree=
... criticalusagefree=100
... warningusageprct=
... criticalusageprct=
... result=CRITICAL: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;;;0;268435456 'system#memory.free.bytes'=163015856B;;0:100;0;268435456 'system#memory.usage.percentage'=39.27%;;;0;100
# Test memory mode with warning-usage-prct option set to a 30
&{teldat_memory_test6}
... warningusage=
... criticalusage=
... warningusagefree=
... criticalusagefree=
... warningusageprct=30
... criticalusageprct=
... result=WARNING: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;;;0;268435456 'system#memory.free.bytes'=163015856B;;;0;268435456 'system#memory.usage.percentage'=39.27%;0:30;;0;100
# Test memory mode with critical-usage-prct option set to a 30
&{teldat_memory_test7}
... warningusage=
... criticalusage=
... warningusagefree=
... criticalusagefree=
... warningusageprct=
... criticalusageprct=30
... result=CRITICAL: Memory 'system' total: 256.00 MB used: 100.54 MB (39.27%) free: 155.46 MB (60.73%) | 'system#memory.usage.bytes'=105419600B;;;0;268435456 'system#memory.free.bytes'=163015856B;;;0;268435456 'system#memory.usage.percentage'=39.27%;;0:30;0;100
@{teldat_memory_tests}
... &{teldat_memory_test1}
... &{teldat_memory_test2}
... &{teldat_memory_test3}
... &{teldat_memory_test4}
... &{teldat_memory_test5}
... &{teldat_memory_test6}
... &{teldat_memory_test7}
*** Test Cases ***
Network Teldat SNMP CPU
[Documentation] Network Teldat SNMP CPU
[Tags] network teldat snmp
FOR ${teldat_cpu_test} IN @{teldat_cpu_tests}
${command} Catenate
... ${CMD}
... --mode=cpu
... --hostname=127.0.0.1
... --snmp-version=2c
... --snmp-port=2024
... --snmp-community=network/teldat/snmp/teldat
${length} Get Length ${teldat_cpu_test.warningcpuutilization5s}
IF ${length} > 0
${command} Catenate
... ${command}
... --warning-cpu-utilization-5s=${teldat_cpu_test.warningcpuutilization5s}
END
${length} Get Length ${teldat_cpu_test.criticalcpuutilization5s}
IF ${length} > 0
${command} Catenate
... ${command}
... --critical-cpu-utilization-5s=${teldat_cpu_test.criticalcpuutilization5s}
END
${length} Get Length ${teldat_cpu_test.warningcpuutilization1m}
IF ${length} > 0
${command} Catenate
... ${command}
... --warning-cpu-utilization-1m=${teldat_cpu_test.warningcpuutilization1m}
END
${length} Get Length ${teldat_cpu_test.criticalcpuutilization1m}
IF ${length} > 0
${command} Catenate
... ${command}
... --critical-cpu-utilization-1m=${teldat_cpu_test.criticalcpuutilization1m}
END
${length} Get Length ${teldat_cpu_test.warningcpuutilization5m}
IF ${length} > 0
${command} Catenate
... ${command}
... --warning-cpu-utilization-5m=${teldat_cpu_test.warningcpuutilization5m}
END
${length} Get Length ${teldat_cpu_test.criticalcpuutilization5m}
IF ${length} > 0
${command} Catenate
... ${command}
... --critical-cpu-utilization-5m=${teldat_cpu_test.criticalcpuutilization5m}
END
${output} Run ${command}
Log To Console . no_newline=true
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${teldat_cpu_test.result}
... Wrong result output for:${\n}Command: ${\n}${command}${\n}${\n}Expected output: ${\n}${teldat_cpu_test.result}${\n}${\n}Obtained output:${\n}${output}${\n}${\n}${\n}
... values=False
END
Network Teldat SNMP Memory
[Documentation] Network Teldat SNMP memory
[Tags] network teldat snmp
FOR ${teldat_memory_test} IN @{teldat_memory_tests}
${command} Catenate
... ${CMD}
... --mode=memory
... --hostname=127.0.0.1
... --snmp-version=2c
... --snmp-port=2024
... --snmp-community=network/teldat/snmp/teldat
${length} Get Length ${teldat_memory_test.warningusage}
IF ${length} > 0
${command} Catenate ${command} --warning-usage=${teldat_memory_test.warningusage}
END
${length} Get Length ${teldat_memory_test.criticalusage}
IF ${length} > 0
${command} Catenate ${command} --critical-usage=${teldat_memory_test.criticalusage}
END
${length} Get Length ${teldat_memory_test.warningusagefree}
IF ${length} > 0
${command} Catenate ${command} --warning-usage-free=${teldat_memory_test.warningusagefree}
END
${length} Get Length ${teldat_memory_test.criticalusagefree}
IF ${length} > 0
${command} Catenate ${command} --critical-usage-free=${teldat_memory_test.criticalusagefree}
END
${length} Get Length ${teldat_memory_test.warningusageprct}
IF ${length} > 0
${command} Catenate ${command} --warning-usage-prct=${teldat_memory_test.warningusageprct}
END
${length} Get Length ${teldat_memory_test.criticalusageprct}
IF ${length} > 0
${command} Catenate ${command} --critical-usage-prct=${teldat_memory_test.criticalusageprct}
END
${output} Run ${command}
Log To Console . no_newline=true
${output} Strip String ${output}
Should Be Equal As Strings
... ${output}
... ${teldat_memory_test.result}
... Wrong result output for:${\n}Command: ${\n}${command}${\n}${\n}Expected output: ${\n}${teldat_memory_test.result}${\n}${\n}Obtained output:${\n}${output}${\n}${\n}${\n}
... values=False
END

View File

@ -7,7 +7,7 @@ Test Timeout 120s
*** Variables *** *** Variables ***
${CMD} ${CENTREON_PLUGINS} --plugin=os::linux::snmp::plugin ${CMD} ${CENTREON_PLUGINS} --plugin=os::linux::snmp::plugin
*** Test Cases *** *** Test Cases ***
@ -17,9 +17,9 @@ List diskio ${tc}
${command} Catenate ${command} Catenate
... ${CMD} ... ${CMD}
... --mode=list-diskio ... --mode=list-diskio
... --hostname=127.0.0.1 ... --hostname=${HOSTNAME}
... --snmp-version=2 ... --snmp-version=${SNMPVERSION}
... --snmp-port=2024 ... --snmp-port=${SNMPPORT}
... --disco-show ... --disco-show
... --snmp-community=${snmpcommunity} ... --snmp-community=${snmpcommunity}
${output} Run ${command} ${output} Run ${command}
@ -32,5 +32,5 @@ List diskio ${tc}
... Wrong output result for command:{\n}{\n}${command}{\n}{\n}Command output:{\n}{\n}${output} ... Wrong output result for command:{\n}{\n}${command}{\n}{\n}Command output:{\n}{\n}${output}
Examples: tc snmpcommunity expected_result -- Examples: tc snmpcommunity expected_result --
... 1 os/linux/snmp/list-diskio 10 ... 1 os/linux/snmp/list-diskio 10
... 2 os/linux/snmp/list-diskio-2 4 ... 2 os/linux/snmp/list-diskio-2 4

View File

@ -10,8 +10,8 @@ Test Timeout 120s
${CMD} ${CENTREON_PLUGINS} ${CMD} ${CENTREON_PLUGINS}
... --plugin=os::linux::snmp::plugin ... --plugin=os::linux::snmp::plugin
... --mode=interfaces ... --mode=interfaces
... --hostname=127.0.0.1 ... --hostname=${HOSTNAME}
... --snmp-port=2024 ... --snmp-port=${SNMPPORT}
... --snmp-community=os/linux/snmp/network-interfaces ... --snmp-community=os/linux/snmp/network-interfaces
... --statefile-dir=/tmp/cache/ ... --statefile-dir=/tmp/cache/

View File

@ -10,8 +10,8 @@ Test Timeout 120s
${CMD} ${CENTREON_PLUGINS} ${CMD} ${CENTREON_PLUGINS}
... --plugin=os::windows::snmp::plugin ... --plugin=os::windows::snmp::plugin
... --mode=service ... --mode=service
... --hostname=127.0.0.1 ... --hostname=${HOSTNAME}
... --snmp-port=2024 ... --snmp-port=${SNMPPORT}
*** Test Cases *** *** Test Cases ***

View File

@ -11,7 +11,7 @@ Test Timeout 120s
*** Variables *** *** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}storage-datacore-api.json ${MOCKOON_JSON} ${CURDIR}${/}storage-datacore-api.json
${CMD} ${CENTREON_PLUGINS} --plugin=storage::datacore::restapi::plugin --password=pass --username=user --port=3000 --hostname=127.0.0.1 --proto=http ${CMD} ${CENTREON_PLUGINS} --plugin=storage::datacore::restapi::plugin --password=pass --username=user --port=${APIPORT} --hostname=${HOSTNAME} --proto=http
*** Test Cases *** *** Test Cases ***

View File

@ -63,9 +63,9 @@ Components
${command} Catenate ${command} Catenate
... ${CMD} ... ${CMD}
... --mode=components ... --mode=components
... --hostname=127.0.0.1 ... --hostname=${HOSTNAME}
... --snmp-version=2 ... --snmp-version=${SNMPVERSION}
... --snmp-port=2024 ... --snmp-port=${SNMPPORT}
... --snmp-community=${check_components_test.snmpcommunity} ... --snmp-community=${check_components_test.snmpcommunity}
${output} Run ${command} ${output} Run ${command}
@ -81,9 +81,9 @@ Uptime
${command} Catenate ${command} Catenate
... ${CMD} ... ${CMD}
... --mode=uptime ... --mode=uptime
... --hostname=127.0.0.1 ... --hostname=${HOSTNAME}
... --snmp-version=2 ... --snmp-version=${SNMPVERSION}
... --snmp-port=2024 ... --snmp-port=${SNMPPORT}
... --snmp-community=${test_item.snmpcommunity} ... --snmp-community=${test_item.snmpcommunity}
... --warning-uptime=${test_item.warning} ... --warning-uptime=${test_item.warning}
... --critical-uptime=${test_item.critical} ... --critical-uptime=${test_item.critical}