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