Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
George Keishing | d55a4be | 2016-08-26 03:28:17 -0500 | [diff] [blame] | 2 | Documentation This suite will verifiy the Generic Configuration Rest Interfaces |
| 3 | ... Details of valid interfaces can be found here... |
| 4 | ... https://github.com/openbmc/docs/blob/master/rest-api.md |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 5 | |
George Keishing | d55a4be | 2016-08-26 03:28:17 -0500 | [diff] [blame] | 6 | Resource ../lib/rest_client.robot |
| 7 | Resource ../lib/openbmc_ffdc.robot |
Gunnar Mills | eac1af2 | 2016-11-14 15:30:09 -0600 | [diff] [blame] | 8 | Test Teardown FFDC On Test Case Fail |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 9 | |
| 10 | |
| 11 | *** Variables *** |
George Keishing | 69019e1 | 2016-10-06 06:29:57 -0500 | [diff] [blame] | 12 | ${MIN_POWER_VALUE} ${0} |
| 13 | ${MAX_POWER_VALUE} ${1000} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 14 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 15 | ${SETTING_HOST} ${SETTINGS_URI}host0 |
| 16 | |
George Keishing | e46afd3 | 2017-01-17 13:01:42 -0600 | [diff] [blame] | 17 | ${RANGE_MSG_ERR} ValueError: Invalid input. Data not in allowed range |
| 18 | ${VALUE_MSG_ERR} ValueError: Invalid input. Data not in allowed values |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 19 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 20 | *** Test Cases *** |
| 21 | |
| 22 | |
| 23 | Get the boot_flags |
| 24 | |
| 25 | [Documentation] ***GOOD PATH*** |
| 26 | ... This test case tries to get the boot flags |
George Keishing | 69019e1 | 2016-10-06 06:29:57 -0500 | [diff] [blame] | 27 | ... |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 28 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 29 | ${resp}= Read Attribute ${SETTING_HOST} boot_flags |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 30 | should not be empty ${resp} |
| 31 | |
| 32 | Get the power |
George Keishing | 69019e1 | 2016-10-06 06:29:57 -0500 | [diff] [blame] | 33 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 34 | [Documentation] ***GOOD PATH*** |
George Keishing | 69019e1 | 2016-10-06 06:29:57 -0500 | [diff] [blame] | 35 | ... This test case tries to get the power value and it should be |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 36 | ... between ${MIN_POWER_VALUE} and ${MAX_POWER_VALUE} |
| 37 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 38 | ${powerValue}= Read Attribute ${SETTING_HOST} power_cap |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 39 | should be true ${powerValue} >= ${MIN_POWER_VALUE} and ${powerValue} <= ${MAX_POWER_VALUE} |
| 40 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 41 | |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 42 | Set Powercap Value With String |
| 43 | [Documentation] Set the power values with string and expect error. |
| 44 | [Tags] Set_Powercap_Value_With_String |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 45 | |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 46 | ${valueToBeSet}= Set Variable abcdefg |
| 47 | ${error_msg}= Run Keyword And Expect Error |
George Keishing | e46afd3 | 2017-01-17 13:01:42 -0600 | [diff] [blame] | 48 | ... * Write To Power Attribute power_cap ${valueToBeSet} |
| 49 | Should Contain ${error_msg} ${RANGE_MSG_ERR} |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 50 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 51 | ${value}= Read Attribute ${SETTING_HOST} power_cap |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 52 | Should Not Be True '${value}'=='${valueToBeSet}' |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 53 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 54 | |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 55 | Set Powercap Value Greater Than Allowed Range |
| 56 | [Documentation] Set the power value greater then MAX_ALLOWED_VALUE |
| 57 | ... and expect error. |
| 58 | [Tags] Set_Powercap_Value_Greater_Than_Allowed_Range |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 59 | |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 60 | ${valueToBeSet}= Set Variable ${1010} |
| 61 | ${error_msg}= Run Keyword And Expect Error |
George Keishing | e46afd3 | 2017-01-17 13:01:42 -0600 | [diff] [blame] | 62 | ... * Write To Power Attribute power_cap ${valueToBeSet} |
| 63 | Should Contain ${error_msg} ${RANGE_MSG_ERR} |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 64 | |
| 65 | ${value}= Read Attribute ${SETTING_HOST} power_cap |
| 66 | Should Not Be Equal ${value} ${valueToBeSet} |
| 67 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 68 | |
| 69 | Set the power with MIN_POWER_VALUE |
| 70 | |
| 71 | [Documentation] ***BAD PATH*** |
Rahul Maheshwari | 08fd617 | 2016-09-21 12:04:43 -0500 | [diff] [blame] | 72 | ... This test case sets the power value less then |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 73 | ... MIN_ALLOWED_VALUE,Expectation is it should get error. |
| 74 | |
| 75 | ${valueToBeSet}= Set Variable ${MIN_POWER_VALUE} |
| 76 | ${valueDict}= create dictionary data=${valueToBeSet} |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 77 | Write Attribute ${SETTING_HOST} power_cap data=${valueDict} |
| 78 | ${value}= Read Attribute ${SETTING_HOST} power_cap |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 79 | Should Be Equal ${value} ${valueToBeSet} |
| 80 | |
| 81 | Set the power with MAX_POWER_VALUE |
| 82 | |
| 83 | [Documentation] ***GOOD PATH*** |
| 84 | ... This test case sets the power value with MAX_POWER_VALUE |
| 85 | ... and it should be set. |
Rahul Maheshwari | 08fd617 | 2016-09-21 12:04:43 -0500 | [diff] [blame] | 86 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 87 | ${valueToBeSet}= Set Variable ${MAX_POWER_VALUE} |
| 88 | ${valueDict}= create dictionary data=${valueToBeSet} |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 89 | Write Attribute ${SETTING_HOST} power_cap data=${valueDict} |
| 90 | ${value}= Read Attribute ${SETTING_HOST} power_cap |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 91 | Should Be Equal ${value} ${valueToBeSet} |
| 92 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 93 | |
George Keishing | e46afd3 | 2017-01-17 13:01:42 -0600 | [diff] [blame] | 94 | Set Boot Flag With String |
| 95 | [Documentation] Set boot flag with invalid string and expect error. |
| 96 | [Tags] Set_Boot_Flag_With_String |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 97 | |
| 98 | ${valueToBeSet}= Set Variable 3ab56f |
George Keishing | e46afd3 | 2017-01-17 13:01:42 -0600 | [diff] [blame] | 99 | ${error_msg}= Run Keyword And Expect Error |
| 100 | ... * Write To Power Attribute boot_flags ${valueToBeSet} |
| 101 | Should Contain ${error_msg} ${VALUE_MSG_ERR} |
| 102 | ${value}= Read Attribute ${SETTING_HOST} boot_flags |
| 103 | Should Not Be Equal ${value} ${valueToBeSet} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 104 | |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 105 | |
| 106 | *** Keywords *** |
| 107 | |
George Keishing | e46afd3 | 2017-01-17 13:01:42 -0600 | [diff] [blame] | 108 | Write To Power Attribute |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 109 | [Documentation] Write to Powercap value. |
George Keishing | e46afd3 | 2017-01-17 13:01:42 -0600 | [diff] [blame] | 110 | [Arguments] ${attrib} ${args} |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 111 | ${value}= Create Dictionary data=${args} |
| 112 | ${resp}= OpenBMC Put Request |
George Keishing | e46afd3 | 2017-01-17 13:01:42 -0600 | [diff] [blame] | 113 | ... ${SETTING_HOST}/attr/${attrib} data=${value} |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 114 | ${jsondata}= To JSON ${resp.content} |
| 115 | Should Be Equal ${jsondata['status']} ${HTTP_OK} |
| 116 | ... msg=${jsondata} |
| 117 | |