1d6ec8369SGeorge Keishing*** Settings ***
2*9480af52SGeorge KeishingDocumentation    Test MPIPL (Memory preserving IPL).
3*9480af52SGeorge Keishing
4*9480af52SGeorge Keishing#------------------------------------------------------------------
5*9480af52SGeorge Keishing# This boot path will generated a BMC dump followed by system dump.
6*9480af52SGeorge Keishing#------------------------------------------------------------------
7d6ec8369SGeorge Keishing
8d6ec8369SGeorge KeishingResource         ../../lib/resource.robot
9d6ec8369SGeorge KeishingResource         ../../lib/openbmc_ffdc.robot
10d6ec8369SGeorge KeishingResource         ../../lib/bmc_redfish_utils.robot
11d6ec8369SGeorge KeishingResource         ../../lib/bmc_redfish_resource.robot
12d6ec8369SGeorge KeishingResource         ../../lib/boot_utils.robot
13d6ec8369SGeorge Keishing
14*9480af52SGeorge KeishingSuite Setup      Redfish.Login
15*9480af52SGeorge KeishingTest Setup       Test SetupExecution
16d6ec8369SGeorge KeishingTest Teardown    Test Teardown Execution
17*9480af52SGeorge KeishingSuite Teardown   Suite Teardown Execution
18d6ec8369SGeorge Keishing
19d6ec8369SGeorge Keishing*** Variables ***
20d6ec8369SGeorge Keishing
21*9480af52SGeorge Keishing# By default 1 iteration, user can key in nth number of iteration to control
22*9480af52SGeorge Keishing# how many time it needs MPIPL test runs.
23*9480af52SGeorge Keishing${MPIPL_LOOP_COUNT}     ${1}
24*9480af52SGeorge Keishing
25d6ec8369SGeorge Keishing
26d6ec8369SGeorge Keishing** Test Cases **
27d6ec8369SGeorge Keishing
28*9480af52SGeorge KeishingTrigger User Tool Initiated MPIPL
29*9480af52SGeorge Keishing    [Documentation]  Trigger And Verify user tool initiated dump using
30*9480af52SGeorge Keishing    ...              obmc-host-crash target.
31*9480af52SGeorge Keishing    [Tags]  Trigger_User_Tool_Initiated_MPIPL
32d6ec8369SGeorge Keishing
33*9480af52SGeorge Keishing    FOR  ${count}  IN RANGE  0  ${MPIPL_LOOP_COUNT}
34*9480af52SGeorge Keishing        Log To Console   MPIPL LOOP_COUNT:${count} execution.
35*9480af52SGeorge Keishing        Tool Initd MP Reboot
36*9480af52SGeorge Keishing        Required Dumps Should Exist
37*9480af52SGeorge Keishing    END
38d6ec8369SGeorge Keishing
39d6ec8369SGeorge Keishing
40*9480af52SGeorge KeishingTrigger User Initiated MPIPL Using Redfish
41*9480af52SGeorge Keishing    [Documentation]  Verify redfish triggered MPIPL flow using diagnostic
42*9480af52SGeorge Keishing    ...              mode target.
43*9480af52SGeorge Keishing    [Tags]  Trigger_User_Initiated_MPIPL_Using_Redfish
44d6ec8369SGeorge Keishing
45*9480af52SGeorge Keishing    FOR  ${count}  IN RANGE  0  ${MPIPL_LOOP_COUNT}
46*9480af52SGeorge Keishing        Log To Console   MPIPL LOOP_COUNT:${count} execution.
47*9480af52SGeorge Keishing        Redfish Initiated MPIPL
48*9480af52SGeorge Keishing        Required Dumps Should Exist
49*9480af52SGeorge Keishing    END
50d6ec8369SGeorge Keishing
51d6ec8369SGeorge Keishing
52*9480af52SGeorge Keishing*** Keywords ***
53d6ec8369SGeorge Keishing
54d6ec8369SGeorge Keishing
55*9480af52SGeorge KeishingTest Setup Execution
56*9480af52SGeorge Keishing    [Documentation]  Do the post test setup cleanup.
57d6ec8369SGeorge Keishing
58*9480af52SGeorge Keishing    Test System Cleanup
59d6ec8369SGeorge Keishing
60*9480af52SGeorge Keishing
61*9480af52SGeorge KeishingTest Teardown Execution
62*9480af52SGeorge Keishing    [Documentation]  Do the post test teardown.
63*9480af52SGeorge Keishing
64*9480af52SGeorge Keishing    FFDC On Test Case Fail
65*9480af52SGeorge Keishing
66*9480af52SGeorge Keishing
67*9480af52SGeorge KeishingSuite Teardown Execution
68*9480af52SGeorge Keishing    [Documentation]  Do the post suite teardown.
69*9480af52SGeorge Keishing
70*9480af52SGeorge Keishing    Test System Cleanup
71*9480af52SGeorge Keishing    Run Keyword And Ignore Error  Delete All Redfish Sessions
72*9480af52SGeorge Keishing
73*9480af52SGeorge Keishing
74*9480af52SGeorge KeishingTest System Cleanup
75*9480af52SGeorge Keishing    [Documentation]  Cleanup errors before exiting.
76*9480af52SGeorge Keishing
77*9480af52SGeorge Keishing    Run Keyword And Ignore Error  Redfish Purge Event Log
78*9480af52SGeorge Keishing    Run Keyword And Ignore Error  Redfish Delete All BMC Dumps
79*9480af52SGeorge Keishing    Run Keyword And Ignore Error  Redfish Delete All System Dumps
80*9480af52SGeorge Keishing
81*9480af52SGeorge Keishing
82*9480af52SGeorge KeishingRedfish Initiated MPIPL
83*9480af52SGeorge Keishing    [Documentation]  Trigger redfish triggered MPIPL flow.
84d6ec8369SGeorge Keishing
85d6ec8369SGeorge Keishing    # Power on
86d6ec8369SGeorge Keishing    Redfish Power On
87d6ec8369SGeorge Keishing
88d6ec8369SGeorge Keishing    # Trigger MPIPL
89d6ec8369SGeorge Keishing    ${payload} =  Create Dictionary
90d6ec8369SGeorge Keishing    ...  DiagnosticDataType=OEM  OEMDiagnosticDataType=System
91*9480af52SGeorge Keishing    Redfish.Post  ${DUMP_URI}/Actions/LogService.CollectDiagnosticData  body=&{payload}
92d6ec8369SGeorge Keishing    ...  valid_status_codes=[${HTTP_ACCEPTED}]
93d6ec8369SGeorge Keishing
94*9480af52SGeorge Keishing    Log To Console  Wait for system to transition DiagnosticMode
95*9480af52SGeorge Keishing    Wait Until Keyword Succeeds  2 min  5 sec  Is Boot Progress Changed
96d6ec8369SGeorge Keishing
97*9480af52SGeorge Keishing    Log To Console  Wait for system to transition path DiagnosticMode to Runtime.
98*9480af52SGeorge Keishing    Wait Until Keyword Succeeds  10 min  20 sec  Is Boot Progress Runtime Matched
99d6ec8369SGeorge Keishing
100d6ec8369SGeorge Keishing
101*9480af52SGeorge KeishingIs Boot Progress Runtime Matched
102*9480af52SGeorge Keishing    [Documentation]  Get BootProgress state and expect boot state mismatch.
103d6ec8369SGeorge Keishing
104*9480af52SGeorge Keishing    # Match any of the BootProgress state SystemHardwareInitializationComplete|OSBootStarted|OSRunning
105*9480af52SGeorge Keishing    ${boot_progress}  ${host_state}=  Redfish Get Boot Progress
106*9480af52SGeorge Keishing    Should Contain Any  ${boot_progress}  SystemHardwareInitializationComplete  OSBootStarted  OSRunning
107d6ec8369SGeorge Keishing
108d6ec8369SGeorge Keishing
109*9480af52SGeorge KeishingRequired Dumps Should Exist
110*9480af52SGeorge Keishing    [Documentation]  Check for BMC and system dump.
111*9480af52SGeorge Keishing
112*9480af52SGeorge Keishing    #   {
113*9480af52SGeorge Keishing    #       "@odata.id": "/redfish/v1/Managers/bmc/LogServices/Dump/Entries/4",
114*9480af52SGeorge Keishing    #       "@odata.type": "#LogEntry.v1_8_0.LogEntry",
115*9480af52SGeorge Keishing    #       "AdditionalDataSizeBytes": 914254,
116*9480af52SGeorge Keishing    #       "AdditionalDataURI": "/redfish/v1/Managers/bmc/LogServices/Dump/Entries/4/attachment",
117*9480af52SGeorge Keishing    #       "Created": "2022-07-22T03:36:23+00:00",
118*9480af52SGeorge Keishing    #       "DiagnosticDataType": "Manager",
119*9480af52SGeorge Keishing    #       "EntryType": "Event",
120*9480af52SGeorge Keishing    #       "Id": "4",
121*9480af52SGeorge Keishing    #       "Name": "BMC Dump Entry"
122*9480af52SGeorge Keishing    #   }
123*9480af52SGeorge Keishing    ${bmc_dump}=  Redfish.Get Properties  /redfish/v1/Managers/bmc/LogServices/Dump/Entries
124*9480af52SGeorge Keishing    Log To Console  BMC dumps generated: ${bmc_dump['Members@odata.count']}
125*9480af52SGeorge Keishing    Should Be True  ${bmc_dump['Members@odata.count']} >= 1  msg=No BMC dump generated.
126*9480af52SGeorge Keishing
127*9480af52SGeorge Keishing    #"Members": [
128*9480af52SGeorge Keishing    #   {
129*9480af52SGeorge Keishing    #       "@odata.id": "/redfish/v1/Systems/system/LogServices/Dump/Entries/System_1",
130*9480af52SGeorge Keishing    #       "@odata.type": "#LogEntry.v1_8_0.LogEntry",
131*9480af52SGeorge Keishing    #       "AdditionalDataSizeBytes": 2363839216,
132*9480af52SGeorge Keishing    #       "AdditionalDataURI": "/redfish/v1/Systems/system/LogServices/Dump/Entries/System_1/attachment",
133*9480af52SGeorge Keishing    #       "Created": "2022-07-22T03:38:58+00:00",
134*9480af52SGeorge Keishing    #       "DiagnosticDataType": "OEM",
135*9480af52SGeorge Keishing    #       "EntryType": "Event",
136*9480af52SGeorge Keishing    #       "Id": "System_1",
137*9480af52SGeorge Keishing    #       "Name": "System Dump Entry",
138*9480af52SGeorge Keishing    #       "OEMDiagnosticDataType": "System"
139*9480af52SGeorge Keishing    #   }
140*9480af52SGeorge Keishing    ${sys_dump}=  Redfish.Get Properties  /redfish/v1/Systems/system/LogServices/Dump/Entries
141*9480af52SGeorge Keishing    Log To Console  System dump generated: ${sys_dump['Members@odata.count']}
142*9480af52SGeorge Keishing    Should Be True  ${sys_dump['Members@odata.count']} == 1  msg=No system dump generated.
143