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
7Resource         ../../lib/ipmi_client.robot
8
9Test Setup       Test Setup Execution
10Test Teardown    Test Teardown Execution
11Suite Teardown   Suite Teardown Execution
12
13*** Variables ***
14# Maps for correlating redfish data values to IPMI data values.
15# The redfish values are obtained with Redfish.Get or Redfish.Get Properties.
16# The corresponding IPMI values are obtained with the "chassis bootparam get
17# 5" IPMI command.
18
19# This dictionary maps the redfish 'BootSourceOverrideEnabled' value to the
20# corresponding IPMI output value.
21&{redfish_ipmi_enabled_map}  Once=Options apply to only next boot
22...                          Continuous=Options apply to all future boots
23...                          Disabled=Options apply to all future boots
24
25# This dictionary maps the redfish 'BootSourceOverrideTarget' value to the
26# corresponding IPMI output value.
27&{redfish_ipmi_target_map}  Hdd=Force Boot from default Hard-Drive
28...                         Pxe=Force PXE
29...                         Diags=Force Boot from default Hard-Drive, request Safe-Mode
30...                         Cd=Force Boot from CD/DVD
31...                         BiosSetup=Force Boot into BIOS Setup
32...                         None=No override
33
34*** Test Cases ***
35
36Verify BMC Redfish Boot Types With BootSource As Once
37    [Documentation]  Verify BMC Redfish Boot Types With BootSource As Once.
38    [Tags]           Verify_BMC_Redfish_Boot_Types_With_BootSource_As_Once
39    [Template]  Set And Verify BootSource And BootType
40
41    #BootSourceEnableType    BootTargetType
42    Once                     Hdd
43    Once                     Pxe
44    Once                     Diags
45    Once                     Cd
46    Once                     BiosSetup
47
48Verify BMC Redfish Boot Types With BootSource As Continuous
49    [Documentation]  Verify BMC Redfish Boot Types With BootSource As Continuous.
50    [Tags]           Verify_BMC_Redfish_Boot_Types_With_BootSource_As_Continuous
51    [Template]  Set And Verify BootSource And BootType
52
53    #BootSourceEnable    BootTargetType
54    Continuous           Hdd
55    Continuous           Pxe
56    Continuous           Diags
57    Continuous           Cd
58    Continuous           BiosSetup
59
60*** Keywords ***
61
62Set And Verify BootSource And BootType
63    [Documentation]  Set And Verify BootSource And BootType.
64    [Arguments]      ${override_enabled}  ${override_target}
65
66    # Description of argument(s):
67    # override_enabled    Boot source enable type.
68    #                     ('Once', 'Continuous', 'Disabled').
69    # override_target     Boot target type.
70    #                     ('Pxe', 'Cd', 'Hdd', 'Diags', 'BiosSetup', 'None').
71
72    # Example:
73    # "Boot": {
74    # "BootSourceOverrideEnabled": "Disabled",
75    # "BootSourceOverrideMode": "Legacy",
76    # "BootSourceOverrideTarget": "None",
77    # "BootSourceOverrideTarget@Redfish.AllowableValues": [
78    # "None",
79    # "Pxe",
80    # "Hdd",
81    # "Cd",
82    # "Diags",
83    # "BiosSetup"]}
84
85    # The values set using Redfish are verified via IPMI using the command:
86    # chassis bootparam get 5
87    # Option 5 returns the boot parameters.
88    #
89    # Sample output:
90    # Boot parameter version: 1
91    # Boot parameter 5 is valid/unlocked
92    # Boot parameter data: c000000000
93    # Boot Flags :
94    # - Boot Flag Valid
95    # - Options apply to all future boots
96    # - BIOS PC Compatible (legacy) boot
97    # - Boot Device Selector : No override
98    # - Console Redirection control : System Default
99    # - BIOS verbosity : Console redirection occurs per BIOS configuration
100    #   setting (default)
101    # - BIOS Mux Control Override : BIOS uses recommended setting of the mux at
102    #   the end of POST
103
104    Redfish Set Boot Default  ${override_enabled}  ${override_target}
105
106    ${output}=  Run IPMI Standard Command  chassis bootparam get 5
107    Should Contain  ${output}  ${redfish_ipmi_enabled_map['${override_enabled}']}
108    Should Contain  ${output}  ${redfish_ipmi_target_map['${override_target}']}
109
110Suite Teardown Execution
111    [Documentation]  Do the post suite teardown.
112
113    Redfish.Login
114    Set And Verify BootSource And BootType  Disabled  None
115    Redfish.Logout
116
117
118Test Setup Execution
119    [Documentation]  Do test case setup tasks.
120
121    Redfish.Login
122
123
124Test Teardown Execution
125    [Documentation]  Do the post test teardown.
126
127    FFDC On Test Case Fail
128    Redfish.Logout
129