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 | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame^] | 17 | ${VALUE_ERROR} ValueError: Invalid input. Data not in allowed range |
| 18 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 19 | *** Test Cases *** |
| 20 | |
| 21 | |
| 22 | Get the boot_flags |
| 23 | |
| 24 | [Documentation] ***GOOD PATH*** |
| 25 | ... This test case tries to get the boot flags |
George Keishing | 69019e1 | 2016-10-06 06:29:57 -0500 | [diff] [blame] | 26 | ... |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 27 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 28 | ${resp}= Read Attribute ${SETTING_HOST} boot_flags |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 29 | should not be empty ${resp} |
| 30 | |
| 31 | Get the power |
George Keishing | 69019e1 | 2016-10-06 06:29:57 -0500 | [diff] [blame] | 32 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 33 | [Documentation] ***GOOD PATH*** |
George Keishing | 69019e1 | 2016-10-06 06:29:57 -0500 | [diff] [blame] | 34 | ... 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] | 35 | ... between ${MIN_POWER_VALUE} and ${MAX_POWER_VALUE} |
| 36 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 37 | ${powerValue}= Read Attribute ${SETTING_HOST} power_cap |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 38 | should be true ${powerValue} >= ${MIN_POWER_VALUE} and ${powerValue} <= ${MAX_POWER_VALUE} |
| 39 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 40 | |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame^] | 41 | Set Powercap Value With String |
| 42 | [Documentation] Set the power values with string and expect error. |
| 43 | [Tags] Set_Powercap_Value_With_String |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 44 | |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame^] | 45 | ${valueToBeSet}= Set Variable abcdefg |
| 46 | ${error_msg}= Run Keyword And Expect Error |
| 47 | ... * Write To Powercap Attribute ${valueToBeSet} |
| 48 | Should Contain ${error_msg} ${VALUE_ERROR} |
| 49 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 50 | ${value}= Read Attribute ${SETTING_HOST} power_cap |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame^] | 51 | Should Not Be True '${value}'=='${valueToBeSet}' |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 52 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 53 | |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame^] | 54 | Set Powercap Value Greater Than Allowed Range |
| 55 | [Documentation] Set the power value greater then MAX_ALLOWED_VALUE |
| 56 | ... and expect error. |
| 57 | [Tags] Set_Powercap_Value_Greater_Than_Allowed_Range |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 58 | |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame^] | 59 | ${valueToBeSet}= Set Variable ${1010} |
| 60 | ${error_msg}= Run Keyword And Expect Error |
| 61 | ... * Write To Powercap Attribute ${valueToBeSet} |
| 62 | Should Contain ${error_msg} ${VALUE_ERROR} |
| 63 | |
| 64 | ${value}= Read Attribute ${SETTING_HOST} power_cap |
| 65 | Should Not Be Equal ${value} ${valueToBeSet} |
| 66 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 67 | |
| 68 | Set the power with MIN_POWER_VALUE |
| 69 | |
| 70 | [Documentation] ***BAD PATH*** |
Rahul Maheshwari | 08fd617 | 2016-09-21 12:04:43 -0500 | [diff] [blame] | 71 | ... This test case sets the power value less then |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 72 | ... MIN_ALLOWED_VALUE,Expectation is it should get error. |
| 73 | |
| 74 | ${valueToBeSet}= Set Variable ${MIN_POWER_VALUE} |
| 75 | ${valueDict}= create dictionary data=${valueToBeSet} |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 76 | Write Attribute ${SETTING_HOST} power_cap data=${valueDict} |
| 77 | ${value}= Read Attribute ${SETTING_HOST} power_cap |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 78 | Should Be Equal ${value} ${valueToBeSet} |
| 79 | |
| 80 | Set the power with MAX_POWER_VALUE |
| 81 | |
| 82 | [Documentation] ***GOOD PATH*** |
| 83 | ... This test case sets the power value with MAX_POWER_VALUE |
| 84 | ... and it should be set. |
Rahul Maheshwari | 08fd617 | 2016-09-21 12:04:43 -0500 | [diff] [blame] | 85 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 86 | ${valueToBeSet}= Set Variable ${MAX_POWER_VALUE} |
| 87 | ${valueDict}= create dictionary data=${valueToBeSet} |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 88 | Write Attribute ${SETTING_HOST} power_cap data=${valueDict} |
| 89 | ${value}= Read Attribute ${SETTING_HOST} power_cap |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 90 | Should Be Equal ${value} ${valueToBeSet} |
| 91 | |
| 92 | Set the boot flags with string |
| 93 | |
| 94 | [Documentation] ***BAD PATH*** |
Rahul Maheshwari | 08fd617 | 2016-09-21 12:04:43 -0500 | [diff] [blame] | 95 | ... This test case sets the boot flag with some invalid string |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 96 | ... Expectation is it should not be set. |
Rahul Maheshwari | 08fd617 | 2016-09-21 12:04:43 -0500 | [diff] [blame] | 97 | ... Existing Issue: https://github.com/openbmc/openbmc/issues/552 |
| 98 | [Tags] known_issue |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 99 | |
| 100 | ${valueToBeSet}= Set Variable 3ab56f |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 101 | ${valueDict}= create dictionary data=${valueToBeSet} |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 102 | Write Attribute ${SETTING_HOST} boot_flags data=${valueDict} |
| 103 | ${value}= Read Attribute ${SETTING_HOST} boot_flags |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 104 | Should not Be Equal ${value} ${valueToBeSet} |
| 105 | |
George Keishing | 9aa0342 | 2017-01-11 10:26:48 -0600 | [diff] [blame^] | 106 | |
| 107 | *** Keywords *** |
| 108 | |
| 109 | Write To Powercap Attribute |
| 110 | [Documentation] Write to Powercap value. |
| 111 | [Arguments] ${args} |
| 112 | ${value}= Create Dictionary data=${args} |
| 113 | ${resp}= OpenBMC Put Request |
| 114 | ... ${SETTING_HOST}/attr/power_cap data=${value} |
| 115 | ${jsondata}= To JSON ${resp.content} |
| 116 | Should Be Equal ${jsondata['status']} ${HTTP_OK} |
| 117 | ... msg=${jsondata} |
| 118 | |