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 | |
Sridevi Ramesh | 83f5c59 | 2017-01-20 04:35:13 -0600 | [diff] [blame] | 23 | Get Boot Flags |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 24 | |
| 25 | [Documentation] ***GOOD PATH*** |
| 26 | ... This test case tries to get the boot flags |
Sridevi Ramesh | 83f5c59 | 2017-01-20 04:35:13 -0600 | [diff] [blame] | 27 | [Tags] Get_Boot_Flags |
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 | |
Sridevi Ramesh | 83f5c59 | 2017-01-20 04:35:13 -0600 | [diff] [blame] | 32 | Get Power Value |
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} |
Sridevi Ramesh | 83f5c59 | 2017-01-20 04:35:13 -0600 | [diff] [blame] | 37 | [Tags] Get_Power_Value |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 38 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 39 | ${powerValue}= Read Attribute ${SETTING_HOST} power_cap |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 40 | should be true ${powerValue} >= ${MIN_POWER_VALUE} and ${powerValue} <= ${MAX_POWER_VALUE} |
| 41 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 42 | |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 43 | Set Powercap Value With String |
| 44 | [Documentation] Set the power values with string and expect error. |
| 45 | [Tags] Set_Powercap_Value_With_String |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 46 | |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 47 | ${valueToBeSet}= Set Variable abcdefg |
| 48 | ${error_msg}= Run Keyword And Expect Error |
George Keishing | e46afd3 | 2017-01-17 13:01:42 -0600 | [diff] [blame] | 49 | ... * Write To Power Attribute power_cap ${valueToBeSet} |
| 50 | Should Contain ${error_msg} ${RANGE_MSG_ERR} |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 51 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 52 | ${value}= Read Attribute ${SETTING_HOST} power_cap |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 53 | Should Not Be True '${value}'=='${valueToBeSet}' |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 54 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 55 | |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 56 | Set Powercap Value Greater Than Allowed Range |
| 57 | [Documentation] Set the power value greater then MAX_ALLOWED_VALUE |
| 58 | ... and expect error. |
| 59 | [Tags] Set_Powercap_Value_Greater_Than_Allowed_Range |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 60 | |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 61 | ${valueToBeSet}= Set Variable ${1010} |
| 62 | ${error_msg}= Run Keyword And Expect Error |
George Keishing | e46afd3 | 2017-01-17 13:01:42 -0600 | [diff] [blame] | 63 | ... * Write To Power Attribute power_cap ${valueToBeSet} |
| 64 | Should Contain ${error_msg} ${RANGE_MSG_ERR} |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 65 | |
| 66 | ${value}= Read Attribute ${SETTING_HOST} power_cap |
| 67 | Should Not Be Equal ${value} ${valueToBeSet} |
| 68 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 69 | |
Sridevi Ramesh | 83f5c59 | 2017-01-20 04:35:13 -0600 | [diff] [blame] | 70 | Set Power With Min Power Value |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 71 | |
| 72 | [Documentation] ***BAD PATH*** |
Rahul Maheshwari | 08fd617 | 2016-09-21 12:04:43 -0500 | [diff] [blame] | 73 | ... This test case sets the power value less then |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 74 | ... MIN_ALLOWED_VALUE,Expectation is it should get error. |
Sridevi Ramesh | 83f5c59 | 2017-01-20 04:35:13 -0600 | [diff] [blame] | 75 | [Tags] Set_Power_With_Min_Power_Value |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 76 | |
| 77 | ${valueToBeSet}= Set Variable ${MIN_POWER_VALUE} |
| 78 | ${valueDict}= create dictionary data=${valueToBeSet} |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 79 | Write Attribute ${SETTING_HOST} power_cap data=${valueDict} |
| 80 | ${value}= Read Attribute ${SETTING_HOST} power_cap |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 81 | Should Be Equal ${value} ${valueToBeSet} |
| 82 | |
Sridevi Ramesh | 83f5c59 | 2017-01-20 04:35:13 -0600 | [diff] [blame] | 83 | Set Power With Max Power Value |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 84 | |
| 85 | [Documentation] ***GOOD PATH*** |
| 86 | ... This test case sets the power value with MAX_POWER_VALUE |
| 87 | ... and it should be set. |
Sridevi Ramesh | 83f5c59 | 2017-01-20 04:35:13 -0600 | [diff] [blame] | 88 | [Tags] Set_Power_With_Max_Power_Value |
Rahul Maheshwari | 08fd617 | 2016-09-21 12:04:43 -0500 | [diff] [blame] | 89 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 90 | ${valueToBeSet}= Set Variable ${MAX_POWER_VALUE} |
| 91 | ${valueDict}= create dictionary data=${valueToBeSet} |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 92 | Write Attribute ${SETTING_HOST} power_cap data=${valueDict} |
| 93 | ${value}= Read Attribute ${SETTING_HOST} power_cap |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 94 | Should Be Equal ${value} ${valueToBeSet} |
| 95 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 96 | |
George Keishing | e46afd3 | 2017-01-17 13:01:42 -0600 | [diff] [blame] | 97 | Set Boot Flag With String |
| 98 | [Documentation] Set boot flag with invalid string and expect error. |
| 99 | [Tags] Set_Boot_Flag_With_String |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 100 | |
| 101 | ${valueToBeSet}= Set Variable 3ab56f |
George Keishing | e46afd3 | 2017-01-17 13:01:42 -0600 | [diff] [blame] | 102 | ${error_msg}= Run Keyword And Expect Error |
| 103 | ... * Write To Power Attribute boot_flags ${valueToBeSet} |
| 104 | Should Contain ${error_msg} ${VALUE_MSG_ERR} |
| 105 | ${value}= Read Attribute ${SETTING_HOST} boot_flags |
| 106 | Should Not Be Equal ${value} ${valueToBeSet} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 107 | |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 108 | |
| 109 | *** Keywords *** |
| 110 | |
George Keishing | e46afd3 | 2017-01-17 13:01:42 -0600 | [diff] [blame] | 111 | Write To Power Attribute |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 112 | [Documentation] Write to Powercap value. |
George Keishing | e46afd3 | 2017-01-17 13:01:42 -0600 | [diff] [blame] | 113 | [Arguments] ${attrib} ${args} |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 114 | ${value}= Create Dictionary data=${args} |
| 115 | ${resp}= OpenBMC Put Request |
George Keishing | e46afd3 | 2017-01-17 13:01:42 -0600 | [diff] [blame] | 116 | ... ${SETTING_HOST}/attr/${attrib} data=${value} |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame] | 117 | ${jsondata}= To JSON ${resp.content} |
| 118 | Should Be Equal ${jsondata['status']} ${HTTP_OK} |
| 119 | ... msg=${jsondata} |
| 120 | |