Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 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 |
| 5 | |
| 6 | Resource ../lib/rest_client.robot |
| 7 | |
| 8 | |
| 9 | *** Variables *** |
| 10 | ${MIN_POWER_VALUE} 0 |
| 11 | ${MAX_POWER_VALUE} 1000 |
| 12 | |
| 13 | *** Test Cases *** |
| 14 | |
| 15 | |
| 16 | Get the boot_flags |
| 17 | |
| 18 | [Documentation] ***GOOD PATH*** |
| 19 | ... This test case tries to get the boot flags |
| 20 | ... |
| 21 | |
| 22 | ${resp}= Read Attribute /org/openbmc/settings/host0/ boot_flags |
| 23 | should not be empty ${resp} |
| 24 | |
| 25 | Get the power |
| 26 | |
| 27 | [Documentation] ***GOOD PATH*** |
| 28 | ... This test case tries to get the power value and it should be |
| 29 | ... between ${MIN_POWER_VALUE} and ${MAX_POWER_VALUE} |
| 30 | |
| 31 | ${powerValue}= Read Attribute /org/openbmc/settings/host0/ power_cap |
| 32 | should be true ${powerValue} >= ${MIN_POWER_VALUE} and ${powerValue} <= ${MAX_POWER_VALUE} |
| 33 | |
| 34 | Set the power with string of characters |
| 35 | |
| 36 | [Documentation] ***BAD PATH*** |
| 37 | ... This test case set the power values with string of characters |
| 38 | ... Expectation is to return error. |
| 39 | |
| 40 | ${valueToBeSet}= Set Variable abcdefg |
| 41 | ${valueDict}= create dictionary data=${valueToBeSet} |
| 42 | Write Attribute /org/openbmc/settings/host0 power_cap data=${valueDict} |
| 43 | ${value}= Read Attribute /org/openbmc/settings/host0 power_cap |
| 44 | should not be true '${value}'=='${valueToBeSet}' |
| 45 | |
| 46 | Set the power with greater then MAX_POWER_VALUE |
| 47 | |
| 48 | [Documentation] ***BAD PATH*** |
| 49 | ... This test case sets the power value which is greater |
| 50 | ... then MAX_ALLOWED_VALUE,Expectation is to return error |
| 51 | |
| 52 | ${valueToBeSet}= Set Variable ${1010} |
| 53 | ${valueDict}= create dictionary data=${valueToBeSet} |
| 54 | Write Attribute /org/openbmc/settings/host0 power_cap data=${valueDict} |
| 55 | ${value}= Read Attribute /org/openbmc/settings/host0 power_cap |
| 56 | should not be equal ${value} ${valueToBeSet} |
| 57 | |
| 58 | Set the power with MIN_POWER_VALUE |
| 59 | |
| 60 | [Documentation] ***BAD PATH*** |
| 61 | ... This test case sets the power value less then |
| 62 | ... MIN_ALLOWED_VALUE,Expectation is it should get error. |
| 63 | |
| 64 | ${valueToBeSet}= Set Variable ${MIN_POWER_VALUE} |
| 65 | ${valueDict}= create dictionary data=${valueToBeSet} |
| 66 | Write Attribute /org/openbmc/settings/host0 power_cap data=${valueDict} |
| 67 | ${value}= Read Attribute /org/openbmc/settings/host0 power_cap |
| 68 | Should Be Equal ${value} ${valueToBeSet} |
| 69 | |
| 70 | Set the power with MAX_POWER_VALUE |
| 71 | |
| 72 | [Documentation] ***GOOD PATH*** |
| 73 | ... This test case sets the power value with MAX_POWER_VALUE |
| 74 | ... and it should be set. |
| 75 | |
| 76 | ${valueToBeSet}= Set Variable ${MAX_POWER_VALUE} |
| 77 | ${valueDict}= create dictionary data=${valueToBeSet} |
| 78 | Write Attribute /org/openbmc/settings/host0 power_cap data=${valueDict} |
| 79 | ${value}= Read Attribute /org/openbmc/settings/host0 power_cap |
| 80 | Should Be Equal ${value} ${valueToBeSet} |
| 81 | |
| 82 | Set the boot flags with string |
| 83 | |
| 84 | [Documentation] ***BAD PATH*** |
| 85 | ... This test case sets the boot flag with some invalid string |
| 86 | ... Expectation is it should not be set. |
| 87 | |
| 88 | ${valueToBeSet}= Set Variable 3ab56f |
| 89 | ${valueDict} = create dictionary data=${valueToBeSet} |
| 90 | Write Attribute /org/openbmc/settings/host0 boot_flags data=${valueDict} |
| 91 | ${value}= Read Attribute /org/openbmc/settings/host0 boot_flags |
| 92 | Should not Be Equal ${value} ${valueToBeSet} |
| 93 | |