blob: 745c3e659994f13b28598f5bada7a63e134ed51a [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
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060022Get Power Value
George Keishing69019e12016-10-06 06:29:57 -050023
Chris Austenb29d2e82016-06-07 12:25:35 -050024 [Documentation] ***GOOD PATH***
George Keishing69019e12016-10-06 06:29:57 -050025 ... This test case tries to get the power value and it should be
Chris Austenb29d2e82016-06-07 12:25:35 -050026 ... between ${MIN_POWER_VALUE} and ${MAX_POWER_VALUE}
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060027 [Tags] Get_Power_Value
Chris Austenb29d2e82016-06-07 12:25:35 -050028
George Keishingec807372016-12-05 03:54:51 -060029 ${powerValue}= Read Attribute ${SETTING_HOST} power_cap
Chris Austenb29d2e82016-06-07 12:25:35 -050030 should be true ${powerValue} >= ${MIN_POWER_VALUE} and ${powerValue} <= ${MAX_POWER_VALUE}
31
Chris Austenb29d2e82016-06-07 12:25:35 -050032
George Keishing9aa03422017-01-11 10:26:48 -060033Set Powercap Value With String
34 [Documentation] Set the power values with string and expect error.
35 [Tags] Set_Powercap_Value_With_String
Chris Austenb29d2e82016-06-07 12:25:35 -050036
George Keishing9aa03422017-01-11 10:26:48 -060037 ${valueToBeSet}= Set Variable abcdefg
38 ${error_msg}= Run Keyword And Expect Error
George Keishinge46afd32017-01-17 13:01:42 -060039 ... * Write To Power Attribute power_cap ${valueToBeSet}
40 Should Contain ${error_msg} ${RANGE_MSG_ERR}
George Keishing9aa03422017-01-11 10:26:48 -060041
George Keishingec807372016-12-05 03:54:51 -060042 ${value}= Read Attribute ${SETTING_HOST} power_cap
George Keishing9aa03422017-01-11 10:26:48 -060043 Should Not Be True '${value}'=='${valueToBeSet}'
Chris Austenb29d2e82016-06-07 12:25:35 -050044
Chris Austenb29d2e82016-06-07 12:25:35 -050045
George Keishing9aa03422017-01-11 10:26:48 -060046Set Powercap Value Greater Than Allowed Range
47 [Documentation] Set the power value greater then MAX_ALLOWED_VALUE
48 ... and expect error.
49 [Tags] Set_Powercap_Value_Greater_Than_Allowed_Range
Chris Austenb29d2e82016-06-07 12:25:35 -050050
George Keishing9aa03422017-01-11 10:26:48 -060051 ${valueToBeSet}= Set Variable ${1010}
52 ${error_msg}= Run Keyword And Expect Error
George Keishinge46afd32017-01-17 13:01:42 -060053 ... * Write To Power Attribute power_cap ${valueToBeSet}
54 Should Contain ${error_msg} ${RANGE_MSG_ERR}
George Keishing9aa03422017-01-11 10:26:48 -060055
56 ${value}= Read Attribute ${SETTING_HOST} power_cap
57 Should Not Be Equal ${value} ${valueToBeSet}
58
Chris Austenb29d2e82016-06-07 12:25:35 -050059
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060060Set Power With Min Power Value
Chris Austenb29d2e82016-06-07 12:25:35 -050061
62 [Documentation] ***BAD PATH***
Rahul Maheshwari08fd6172016-09-21 12:04:43 -050063 ... This test case sets the power value less then
Chris Austenb29d2e82016-06-07 12:25:35 -050064 ... MIN_ALLOWED_VALUE,Expectation is it should get error.
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060065 [Tags] Set_Power_With_Min_Power_Value
Chris Austenb29d2e82016-06-07 12:25:35 -050066
67 ${valueToBeSet}= Set Variable ${MIN_POWER_VALUE}
68 ${valueDict}= create dictionary data=${valueToBeSet}
George Keishingec807372016-12-05 03:54:51 -060069 Write Attribute ${SETTING_HOST} power_cap data=${valueDict}
70 ${value}= Read Attribute ${SETTING_HOST} power_cap
Chris Austenb29d2e82016-06-07 12:25:35 -050071 Should Be Equal ${value} ${valueToBeSet}
72
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060073Set Power With Max Power Value
Chris Austenb29d2e82016-06-07 12:25:35 -050074
75 [Documentation] ***GOOD PATH***
76 ... This test case sets the power value with MAX_POWER_VALUE
77 ... and it should be set.
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060078 [Tags] Set_Power_With_Max_Power_Value
Rahul Maheshwari08fd6172016-09-21 12:04:43 -050079
Chris Austenb29d2e82016-06-07 12:25:35 -050080 ${valueToBeSet}= Set Variable ${MAX_POWER_VALUE}
81 ${valueDict}= create dictionary data=${valueToBeSet}
George Keishingec807372016-12-05 03:54:51 -060082 Write Attribute ${SETTING_HOST} power_cap data=${valueDict}
83 ${value}= Read Attribute ${SETTING_HOST} power_cap
Chris Austenb29d2e82016-06-07 12:25:35 -050084 Should Be Equal ${value} ${valueToBeSet}
85
Chris Austenb29d2e82016-06-07 12:25:35 -050086
George Keishing9aa03422017-01-11 10:26:48 -060087*** Keywords ***
88
George Keishinge46afd32017-01-17 13:01:42 -060089Write To Power Attribute
George Keishing9aa03422017-01-11 10:26:48 -060090 [Documentation] Write to Powercap value.
George Keishinge46afd32017-01-17 13:01:42 -060091 [Arguments] ${attrib} ${args}
George Keishing9aa03422017-01-11 10:26:48 -060092 ${value}= Create Dictionary data=${args}
93 ${resp}= OpenBMC Put Request
George Keishinge46afd32017-01-17 13:01:42 -060094 ... ${SETTING_HOST}/attr/${attrib} data=${value}
George Keishing9aa03422017-01-11 10:26:48 -060095 ${jsondata}= To JSON ${resp.content}
96 Should Be Equal ${jsondata['status']} ${HTTP_OK}
97 ... msg=${jsondata}
98