Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
George Keishing | 47335a7 | 2017-05-09 04:02:18 -0500 | [diff] [blame] | 2 | Documentation Test module for testing fan interface. |
| 3 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 4 | Resource ../lib/rest_client.robot |
George Keishing | d55a4be | 2016-08-26 03:28:17 -0500 | [diff] [blame] | 5 | Resource ../lib/openbmc_ffdc.robot |
George Keishing | 47335a7 | 2017-05-09 04:02:18 -0500 | [diff] [blame] | 6 | |
Gunnar Mills | eac1af2 | 2016-11-14 15:30:09 -0600 | [diff] [blame] | 7 | Test Teardown FFDC On Test Case Fail |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 8 | |
| 9 | *** Test Cases *** |
George Keishing | 47335a7 | 2017-05-09 04:02:18 -0500 | [diff] [blame] | 10 | |
| 11 | Verify Fan Sensors Atrributes |
| 12 | [Documentation] Check fan attributes. |
| 13 | [Tags] Verify_Fan_Sensor_Attributes |
| 14 | |
| 15 | ${fans}= Get Fan Sensor List |
| 16 | |
| 17 | # Access the properties of the fan and it should contain |
| 18 | # the following entries: |
| 19 | # /xyz/openbmc_project/sensors/fan_tach/fan0 |
| 20 | # { |
| 21 | # "Scale": 0, |
| 22 | # "Target": 0, |
| 23 | # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.RPMS", |
| 24 | # "Value": 0 |
| 25 | # } |
| 26 | |
| 27 | :FOR ${entry} IN @{fans} |
| 28 | \ ${resp}= OpenBMC Get Request ${entry} |
| 29 | \ ${json}= To Json ${resp.content} |
| 30 | \ Should Be True ${json["data"]["Scale"]} >= 0 |
George Keishing | 16294f6 | 2017-05-12 14:48:50 -0500 | [diff] [blame] | 31 | \ Run Keyword And Ignore Error |
| 32 | ... Should Be True ${json["data"]["Target"]} >= 0 |
George Keishing | 47335a7 | 2017-05-09 04:02:18 -0500 | [diff] [blame] | 33 | \ Should Be Equal As Strings |
| 34 | ... ${json["data"]["Unit"]} xyz.openbmc_project.Sensor.Value.Unit.RPMS |
| 35 | \ Should Be True ${json["data"]["Value"]} >= 0 |
| 36 | |
| 37 | |
| 38 | *** Keywords *** |
| 39 | |
| 40 | Get Fan Sensor List |
| 41 | [Documentation] Get a list of fan sensor URLs. |
| 42 | # Example: |
| 43 | # /xyz/openbmc_project/sensors/fan_tach/fan0 |
| 44 | # /xyz/openbmc_project/sensors/fan_tach/fan1 |
| 45 | # /xyz/openbmc_project/sensors/fan_tach/fan2 |
| 46 | # /xyz/openbmc_project/sensors/fan_tach/fan3 |
| 47 | |
| 48 | ${resp}= Openbmc Get Request |
| 49 | ... /xyz/openbmc_project/sensors/fan_tach/list |
| 50 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 51 | ${jsondata}= To JSON ${resp.content} |
| 52 | Should Not Be Empty ${jsondata["data"]} |
| 53 | [Return] ${jsondata["data"]} |