Debian Codegraph @

tests/hardware/ups/inmatics/sputnik/snmp/hardware-ups-sputnik-snmp.robot

raw
1 *** Settings ***
2 Documentation Hardware UPS Sputnik SNMP plugin
3
4 Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource
5
6 Test Timeout 120s
7
8
9 *** Variables ***
10 ${CMD} ${CENTREON_PLUGINS} --plugin=hardware::ups::inmatics::sputnik::snmp::plugin
11
12
13 *** Test Cases ***
14 Sputnik UPS - Environment ${tc}/9
15 [Tags] hardware ups snmp
16 ${command} Catenate
17 ... ${CMD}
18 ... --mode=environment
19 ... --hostname=${HOSTNAME}
20 ... --snmp-version=${SNMPVERSION}
21 ... --snmp-port=${SNMPPORT}
22 ... --snmp-community=hardware/ups/inmatics/sputnik/snmp/hardware-ups-sputnik
23
24 # Append options to command
25 ${opt} Append Option --warning-temperature ${w_temperature}
26 ${command} Catenate ${command} ${opt}
27 ${opt} Append Option --critical-temperature ${c_temperature}
28 ${command} Catenate ${command} ${opt}
29 ${opt} Append Option --warning-humidity ${w_humidity}
30 ${command} Catenate ${command} ${opt}
31 ${opt} Append Option --critical-humidity ${c_humidity}
32 ${command} Catenate ${command} ${opt}
33 ${opt} Append Option --filter-id ${filter_id}
34 ${command} Catenate ${command} ${opt}
35
36 Ctn Run Command And Check Result As Strings ${command} ${expected_result}
37
38 Examples: tc filter_id w_temperature c_temperature w_humidity c_humidity expected_result --
39 ... 1 1 30 50 50 70 OK: 'Sensor 1': temperature 20.06 C, humidity 33 % | 'Sensor 1#environment.temperature.celsius'=20.06C;0:30;0:50;; 'Sensor 1#environment.humidity.percentage'=33%;0:50;0:70;0;100
40 ... 2 1 20 50 50 70 WARNING: 'Sensor 1': temperature 20.06 C | 'Sensor 1#environment.temperature.celsius'=20.06C;0:20;0:50;; 'Sensor 1#environment.humidity.percentage'=33%;0:50;0:70;0;100
41 ... 3 1 10 20 50 70 CRITICAL: 'Sensor 1': temperature 20.06 C | 'Sensor 1#environment.temperature.celsius'=20.06C;0:10;0:20;; 'Sensor 1#environment.humidity.percentage'=33%;0:50;0:70;0;100
42 ... 4 1 30 50 20 70 WARNING: 'Sensor 1': humidity 33 % | 'Sensor 1#environment.temperature.celsius'=20.06C;0:30;0:50;; 'Sensor 1#environment.humidity.percentage'=33%;0:20;0:70;0;100
43 ... 5 1 30 50 20 30 CRITICAL: 'Sensor 1': humidity 33 % | 'Sensor 1#environment.temperature.celsius'=20.06C;0:30;0:50;; 'Sensor 1#environment.humidity.percentage'=33%;0:20;0:30;0;100
44 ... 6 1 10 50 20 70 WARNING: 'Sensor 1': temperature 20.06 C, humidity 33 % | 'Sensor 1#environment.temperature.celsius'=20.06C;0:10;0:50;; 'Sensor 1#environment.humidity.percentage'=33%;0:20;0:70;0;100
45 ... 7 1 10 20 20 30 CRITICAL: 'Sensor 1': temperature 20.06 C, humidity 33 % | 'Sensor 1#environment.temperature.celsius'=20.06C;0:10;0:20;; 'Sensor 1#environment.humidity.percentage'=33%;0:20;0:30;0;100
46 ... 8 2 30 50 50 70 UNKNOWN: No sensors found.
47 ... 9 1 _empty_ _empty_ _empty_ _empty_ OK: 'Sensor 1': temperature 20.06 C, humidity 33 % | 'Sensor 1#environment.temperature.celsius'=20.06C;;;; 'Sensor 1#environment.humidity.percentage'=33%;;;0;100
48
49
50 *** Keywords ***
51 Append Option
52 [Documentation] Concatenates the first argument (option) with the second (value) after having replaced the value with "" if its content is '_empty_'
53 [Arguments] ${option} ${value}
54 ${value} Set Variable If '${value}' == '_empty_' '' ${value}
55 RETURN ${option}=${value}