blob: 6b487281e9d9bd913c35bcbbfee45f7dca4a2d9b [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
George Keishingd55a4be2016-08-26 03:28:17 -05002Documentation 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 Austenb29d2e82016-06-07 12:25:35 -05005
George Keishingd55a4be2016-08-26 03:28:17 -05006Resource ../lib/rest_client.robot
7Resource ../lib/openbmc_ffdc.robot
Gunnar Millseac1af22016-11-14 15:30:09 -06008Test Teardown FFDC On Test Case Fail
Chris Austenb29d2e82016-06-07 12:25:35 -05009
10
11*** Variables ***
George Keishing69019e12016-10-06 06:29:57 -050012${MIN_POWER_VALUE} ${0}
13${MAX_POWER_VALUE} ${1000}
Chris Austenb29d2e82016-06-07 12:25:35 -050014
George Keishingec807372016-12-05 03:54:51 -060015${SETTING_HOST} ${SETTINGS_URI}host0
16
George Keishing9aa03422017-01-11 10:26:48 -060017${VALUE_ERROR} ValueError: Invalid input. Data not in allowed range
18
Chris Austenb29d2e82016-06-07 12:25:35 -050019*** Test Cases ***
20
21
22Get the boot_flags
23
24 [Documentation] ***GOOD PATH***
25 ... This test case tries to get the boot flags
George Keishing69019e12016-10-06 06:29:57 -050026 ...
Chris Austenb29d2e82016-06-07 12:25:35 -050027
George Keishingec807372016-12-05 03:54:51 -060028 ${resp}= Read Attribute ${SETTING_HOST} boot_flags
Chris Austenb29d2e82016-06-07 12:25:35 -050029 should not be empty ${resp}
30
31Get the power
George Keishing69019e12016-10-06 06:29:57 -050032
Chris Austenb29d2e82016-06-07 12:25:35 -050033 [Documentation] ***GOOD PATH***
George Keishing69019e12016-10-06 06:29:57 -050034 ... This test case tries to get the power value and it should be
Chris Austenb29d2e82016-06-07 12:25:35 -050035 ... between ${MIN_POWER_VALUE} and ${MAX_POWER_VALUE}
36
George Keishingec807372016-12-05 03:54:51 -060037 ${powerValue}= Read Attribute ${SETTING_HOST} power_cap
Chris Austenb29d2e82016-06-07 12:25:35 -050038 should be true ${powerValue} >= ${MIN_POWER_VALUE} and ${powerValue} <= ${MAX_POWER_VALUE}
39
Chris Austenb29d2e82016-06-07 12:25:35 -050040
George Keishing9aa03422017-01-11 10:26:48 -060041Set Powercap Value With String
42 [Documentation] Set the power values with string and expect error.
43 [Tags] Set_Powercap_Value_With_String
Chris Austenb29d2e82016-06-07 12:25:35 -050044
George Keishing9aa03422017-01-11 10:26:48 -060045 ${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 Keishingec807372016-12-05 03:54:51 -060050 ${value}= Read Attribute ${SETTING_HOST} power_cap
George Keishing9aa03422017-01-11 10:26:48 -060051 Should Not Be True '${value}'=='${valueToBeSet}'
Chris Austenb29d2e82016-06-07 12:25:35 -050052
Chris Austenb29d2e82016-06-07 12:25:35 -050053
George Keishing9aa03422017-01-11 10:26:48 -060054Set 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 Austenb29d2e82016-06-07 12:25:35 -050058
George Keishing9aa03422017-01-11 10:26:48 -060059 ${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 Austenb29d2e82016-06-07 12:25:35 -050067
68Set the power with MIN_POWER_VALUE
69
70 [Documentation] ***BAD PATH***
Rahul Maheshwari08fd6172016-09-21 12:04:43 -050071 ... This test case sets the power value less then
Chris Austenb29d2e82016-06-07 12:25:35 -050072 ... MIN_ALLOWED_VALUE,Expectation is it should get error.
73
74 ${valueToBeSet}= Set Variable ${MIN_POWER_VALUE}
75 ${valueDict}= create dictionary data=${valueToBeSet}
George Keishingec807372016-12-05 03:54:51 -060076 Write Attribute ${SETTING_HOST} power_cap data=${valueDict}
77 ${value}= Read Attribute ${SETTING_HOST} power_cap
Chris Austenb29d2e82016-06-07 12:25:35 -050078 Should Be Equal ${value} ${valueToBeSet}
79
80Set 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 Maheshwari08fd6172016-09-21 12:04:43 -050085
Chris Austenb29d2e82016-06-07 12:25:35 -050086 ${valueToBeSet}= Set Variable ${MAX_POWER_VALUE}
87 ${valueDict}= create dictionary data=${valueToBeSet}
George Keishingec807372016-12-05 03:54:51 -060088 Write Attribute ${SETTING_HOST} power_cap data=${valueDict}
89 ${value}= Read Attribute ${SETTING_HOST} power_cap
Chris Austenb29d2e82016-06-07 12:25:35 -050090 Should Be Equal ${value} ${valueToBeSet}
91
92Set the boot flags with string
93
94 [Documentation] ***BAD PATH***
Rahul Maheshwari08fd6172016-09-21 12:04:43 -050095 ... This test case sets the boot flag with some invalid string
Chris Austenb29d2e82016-06-07 12:25:35 -050096 ... Expectation is it should not be set.
Rahul Maheshwari08fd6172016-09-21 12:04:43 -050097 ... Existing Issue: https://github.com/openbmc/openbmc/issues/552
98 [Tags] known_issue
Chris Austenb29d2e82016-06-07 12:25:35 -050099
100 ${valueToBeSet}= Set Variable 3ab56f
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600101 ${valueDict}= create dictionary data=${valueToBeSet}
George Keishingec807372016-12-05 03:54:51 -0600102 Write Attribute ${SETTING_HOST} boot_flags data=${valueDict}
103 ${value}= Read Attribute ${SETTING_HOST} boot_flags
Chris Austenb29d2e82016-06-07 12:25:35 -0500104 Should not Be Equal ${value} ${valueToBeSet}
105
George Keishing9aa03422017-01-11 10:26:48 -0600106
107*** Keywords ***
108
109Write 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