1*** Settings ***
2Documentation    Verify that firmware update properties.
3
4Resource         ../../lib/resource.robot
5Resource         ../../lib/bmc_redfish_resource.robot
6Resource         ../../lib/openbmc_ffdc.robot
7Library          ../../lib/gen_robot_valid.py
8
9Suite Setup      Redfish.Login
10Suite Teardown   Redfish.Logout
11Test Setup       Printn
12Test Teardown    FFDC On Test Case Fail
13
14*** Test Cases ***
15
16Verify Firmware Update ApplyTime Immediate
17    [Documentation]  Verify supported apply time "Immediate" property.
18    [Tags]  Verify_Firmware_Update_ApplyTime_Immediate
19
20    # Example:
21    # /redfish/v1/UpdateService
22    # "HttpPushUriOptions": {
23    #    "HttpPushUriApplyTime": {
24    #        "ApplyTime": "Immediate"
25    #    }
26    # }
27
28    Redfish.Patch  ${REDFISH_BASE_URI}UpdateService
29    ...  body={'HttpPushUriOptions' : {'HttpPushUriApplyTime' : {'ApplyTime' : 'Immediate'}}}
30
31    ${http_push_uri_options}=  Redfish.Get Attribute  ${REDFISH_BASE_URI}UpdateService  HttpPushUriOptions
32    Rprint Vars  http_push_uri_options
33    Valid Value  http_push_uri_options["HttpPushUriApplyTime"]["ApplyTime"]  ['Immediate']
34
35
36Verify Firmware Update ApplyTime OnReset
37    [Documentation]  Verify supported apply time "OnReset" property.
38    [Tags]  Verify_Firmware_Update_ApplyTime_OnReset
39
40    # Example:
41    # /redfish/v1/UpdateService
42    # "HttpPushUriOptions": {
43    #    "HttpPushUriApplyTime": {
44    #        "ApplyTime": "OnReset"
45    #    }
46    # }
47
48    Redfish.Patch  ${REDFISH_BASE_URI}UpdateService
49    ...  body={'HttpPushUriOptions' : {'HttpPushUriApplyTime' : {'ApplyTime' : 'OnReset'}}}
50
51    ${http_push_uri_options}=  Redfish.Get Attribute  ${REDFISH_BASE_URI}UpdateService  HttpPushUriOptions
52    Rprint Vars  http_push_uri_options
53    Valid Value  http_push_uri_options["HttpPushUriApplyTime"]["ApplyTime"]  ['OnReset']
54
55
56Verify Firmware Update ApplyTime Invalid
57    [Documentation]  Verify supported apply time returns error on invalid value.
58    [Tags]  Verify_Firmware_Update_ApplyTime_Invalid
59
60    Redfish.Patch  ${REDFISH_BASE_URI}UpdateService
61    ...  body={'HttpPushUriOptions' : {'HttpPushUriApplyTime' : {'ApplyTime' : 'Invalid'}}}
62    ...  valid_status_codes=[${HTTP_BAD_REQUEST}]
63