blob: 7ba12fd0c662c77354289cb975c46a12857500bf [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 Keishinge46afd32017-01-17 13:01:42 -060017${RANGE_MSG_ERR} ValueError: Invalid input. Data not in allowed range
18${VALUE_MSG_ERR} ValueError: Invalid input. Data not in allowed values
George Keishing9aa03422017-01-11 10:26:48 -060019
Chris Austenb29d2e82016-06-07 12:25:35 -050020*** Test Cases ***
21
22
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060023Get Boot Flags
Chris Austenb29d2e82016-06-07 12:25:35 -050024
25 [Documentation] ***GOOD PATH***
26 ... This test case tries to get the boot flags
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060027 [Tags] Get_Boot_Flags
Chris Austenb29d2e82016-06-07 12:25:35 -050028
George Keishingec807372016-12-05 03:54:51 -060029 ${resp}= Read Attribute ${SETTING_HOST} boot_flags
Chris Austenb29d2e82016-06-07 12:25:35 -050030 should not be empty ${resp}
31
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060032Get Power Value
George Keishing69019e12016-10-06 06:29:57 -050033
Chris Austenb29d2e82016-06-07 12:25:35 -050034 [Documentation] ***GOOD PATH***
George Keishing69019e12016-10-06 06:29:57 -050035 ... This test case tries to get the power value and it should be
Chris Austenb29d2e82016-06-07 12:25:35 -050036 ... between ${MIN_POWER_VALUE} and ${MAX_POWER_VALUE}
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060037 [Tags] Get_Power_Value
Chris Austenb29d2e82016-06-07 12:25:35 -050038
George Keishingec807372016-12-05 03:54:51 -060039 ${powerValue}= Read Attribute ${SETTING_HOST} power_cap
Chris Austenb29d2e82016-06-07 12:25:35 -050040 should be true ${powerValue} >= ${MIN_POWER_VALUE} and ${powerValue} <= ${MAX_POWER_VALUE}
41
Chris Austenb29d2e82016-06-07 12:25:35 -050042
George Keishing9aa03422017-01-11 10:26:48 -060043Set Powercap Value With String
44 [Documentation] Set the power values with string and expect error.
45 [Tags] Set_Powercap_Value_With_String
Chris Austenb29d2e82016-06-07 12:25:35 -050046
George Keishing9aa03422017-01-11 10:26:48 -060047 ${valueToBeSet}= Set Variable abcdefg
48 ${error_msg}= Run Keyword And Expect Error
George Keishinge46afd32017-01-17 13:01:42 -060049 ... * Write To Power Attribute power_cap ${valueToBeSet}
50 Should Contain ${error_msg} ${RANGE_MSG_ERR}
George Keishing9aa03422017-01-11 10:26:48 -060051
George Keishingec807372016-12-05 03:54:51 -060052 ${value}= Read Attribute ${SETTING_HOST} power_cap
George Keishing9aa03422017-01-11 10:26:48 -060053 Should Not Be True '${value}'=='${valueToBeSet}'
Chris Austenb29d2e82016-06-07 12:25:35 -050054
Chris Austenb29d2e82016-06-07 12:25:35 -050055
George Keishing9aa03422017-01-11 10:26:48 -060056Set 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 Austenb29d2e82016-06-07 12:25:35 -050060
George Keishing9aa03422017-01-11 10:26:48 -060061 ${valueToBeSet}= Set Variable ${1010}
62 ${error_msg}= Run Keyword And Expect Error
George Keishinge46afd32017-01-17 13:01:42 -060063 ... * Write To Power Attribute power_cap ${valueToBeSet}
64 Should Contain ${error_msg} ${RANGE_MSG_ERR}
George Keishing9aa03422017-01-11 10:26:48 -060065
66 ${value}= Read Attribute ${SETTING_HOST} power_cap
67 Should Not Be Equal ${value} ${valueToBeSet}
68
Chris Austenb29d2e82016-06-07 12:25:35 -050069
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060070Set Power With Min Power Value
Chris Austenb29d2e82016-06-07 12:25:35 -050071
72 [Documentation] ***BAD PATH***
Rahul Maheshwari08fd6172016-09-21 12:04:43 -050073 ... This test case sets the power value less then
Chris Austenb29d2e82016-06-07 12:25:35 -050074 ... MIN_ALLOWED_VALUE,Expectation is it should get error.
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060075 [Tags] Set_Power_With_Min_Power_Value
Chris Austenb29d2e82016-06-07 12:25:35 -050076
77 ${valueToBeSet}= Set Variable ${MIN_POWER_VALUE}
78 ${valueDict}= create dictionary data=${valueToBeSet}
George Keishingec807372016-12-05 03:54:51 -060079 Write Attribute ${SETTING_HOST} power_cap data=${valueDict}
80 ${value}= Read Attribute ${SETTING_HOST} power_cap
Chris Austenb29d2e82016-06-07 12:25:35 -050081 Should Be Equal ${value} ${valueToBeSet}
82
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060083Set Power With Max Power Value
Chris Austenb29d2e82016-06-07 12:25:35 -050084
85 [Documentation] ***GOOD PATH***
86 ... This test case sets the power value with MAX_POWER_VALUE
87 ... and it should be set.
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060088 [Tags] Set_Power_With_Max_Power_Value
Rahul Maheshwari08fd6172016-09-21 12:04:43 -050089
Chris Austenb29d2e82016-06-07 12:25:35 -050090 ${valueToBeSet}= Set Variable ${MAX_POWER_VALUE}
91 ${valueDict}= create dictionary data=${valueToBeSet}
George Keishingec807372016-12-05 03:54:51 -060092 Write Attribute ${SETTING_HOST} power_cap data=${valueDict}
93 ${value}= Read Attribute ${SETTING_HOST} power_cap
Chris Austenb29d2e82016-06-07 12:25:35 -050094 Should Be Equal ${value} ${valueToBeSet}
95
Chris Austenb29d2e82016-06-07 12:25:35 -050096
George Keishinge46afd32017-01-17 13:01:42 -060097Set Boot Flag With String
98 [Documentation] Set boot flag with invalid string and expect error.
99 [Tags] Set_Boot_Flag_With_String
Chris Austenb29d2e82016-06-07 12:25:35 -0500100
101 ${valueToBeSet}= Set Variable 3ab56f
George Keishinge46afd32017-01-17 13:01:42 -0600102 ${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 Austenb29d2e82016-06-07 12:25:35 -0500107
George Keishing9aa03422017-01-11 10:26:48 -0600108
109*** Keywords ***
110
George Keishinge46afd32017-01-17 13:01:42 -0600111Write To Power Attribute
George Keishing9aa03422017-01-11 10:26:48 -0600112 [Documentation] Write to Powercap value.
George Keishinge46afd32017-01-17 13:01:42 -0600113 [Arguments] ${attrib} ${args}
George Keishing9aa03422017-01-11 10:26:48 -0600114 ${value}= Create Dictionary data=${args}
115 ${resp}= OpenBMC Put Request
George Keishinge46afd32017-01-17 13:01:42 -0600116 ... ${SETTING_HOST}/attr/${attrib} data=${value}
George Keishing9aa03422017-01-11 10:26:48 -0600117 ${jsondata}= To JSON ${resp.content}
118 Should Be Equal ${jsondata['status']} ${HTTP_OK}
119 ... msg=${jsondata}
120