1*** Settings ***
2Documentation    This suite test various boot types with boot source.
3Resource         ../../lib/resource.robot
4Resource         ../../lib/bmc_redfish_resource.robot
5Resource         ../../lib/common_utils.robot
6Resource         ../../lib/openbmc_ffdc.robot
7
8Test Setup       Test Setup Execution
9Test Teardown    Test Teardown Execution
10Suite Teardown   Suite Teardown Execution
11
12*** Test Cases ***
13
14Verify BMC Redfish Boot Types With BootSource As Once
15    [Documentation]  Verify BMC Redfish Boot Types With BootSource As Once.
16    [Tags]           Verify_BMC_Redfish_Boot_Types_With_BootSource_As_Once
17    [Template]  Set And Verify BootSource And BootType
18
19    #BootSourceEnableType    BootTargetType
20    Once                     Hdd
21    Once                     Pxe
22    Once                     Diags
23    Once                     Cd
24    Once                     BiosSetup
25
26Verify BMC Redfish Boot Types With BootSource As Continuous
27    [Documentation]  Verify BMC Redfish Boot Types With BootSource As Continuous.
28    [Tags]           Verify_BMC_Redfish_Boot_Types_With_BootSource_As_Continuous
29    [Template]  Set And Verify BootSource And BootType
30
31    #BootSourceEnable    BootTargetType
32    Continuous           Hdd
33    Continuous           Pxe
34    Continuous           Diags
35    Continuous           Cd
36    Continuous           BiosSetup
37
38*** Keywords ***
39
40Set And Verify BootSource And BootType
41    [Documentation]  Set And Verify BootSource And BootType.
42    [Arguments]      ${override_enabled}  ${override_target}
43
44    # Description of argument(s):
45    # override_enabled    Boot source enable type.
46    #                     ('Once', 'Continuous', 'Disabled').
47    # override_target     Boot target type.
48    #                     ('Pxe', 'Cd', 'Hdd', 'Diags', 'BiosSetup', 'None').
49
50    # Example:
51    # "Boot": {
52    # "BootSourceOverrideEnabled": "Disabled",
53    # "BootSourceOverrideMode": "Legacy",
54    # "BootSourceOverrideTarget": "None",
55    # "BootSourceOverrideTarget@Redfish.AllowableValues": [
56    # "None",
57    # "Pxe",
58    # "Hdd",
59    # "Cd",
60    # "Diags",
61    # "BiosSetup"]}
62
63    ${data}=  Create Dictionary  BootSourceOverrideEnabled=${override_enabled}
64    ...  BootSourceOverrideTarget=${override_target}
65    ${payload}=  Create Dictionary  Boot=${data}
66
67    Redfish.Patch  /redfish/v1/Systems/system  body=&{payload}
68
69    ${resp}=  Redfish.Get  /redfish/v1/Systems/system
70    Should Be Equal As Strings  ${resp.dict["Boot"]["BootSourceOverrideEnabled"]}
71    ...  ${override_enabled}
72    Should Be Equal As Strings  ${resp.dict["Boot"]["BootSourceOverrideTarget"]}
73    ...  ${override_target}
74
75
76Suite Teardown Execution
77    [Documentation]  Do the post suite teardown.
78
79    Redfish.Login
80    Set And Verify BootSource And BootType  Disabled  None
81    Redfish.Logout
82
83
84Test Setup Execution
85    [Documentation]  Do test case setup tasks.
86
87    Redfish.Login
88
89
90Test Teardown Execution
91    [Documentation]  Do the post test teardown.
92
93    FFDC On Test Case Fail
94    Redfish.Logout
95
96