1d6ec8369SGeorge Keishing*** Settings ***
29480af52SGeorge KeishingDocumentation    Test MPIPL (Memory preserving IPL).
39480af52SGeorge Keishing
49480af52SGeorge Keishing#------------------------------------------------------------------
59480af52SGeorge Keishing# This boot path will generated a BMC dump followed by system dump.
69480af52SGeorge 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
149480af52SGeorge KeishingSuite Setup      Redfish.Login
159480af52SGeorge KeishingTest Setup       Test Setup Execution
16d6ec8369SGeorge KeishingTest Teardown    Test Teardown Execution
179480af52SGeorge KeishingSuite Teardown   Suite Teardown Execution
18d6ec8369SGeorge Keishing
19*6fb70d98SMatt FischerTest Tags       MPIPL_Basic
207c32f30fSGeorge Keishing
21d6ec8369SGeorge Keishing*** Variables ***
22d6ec8369SGeorge Keishing
239480af52SGeorge Keishing# By default 1 iteration, user can key in nth number of iteration to control
249480af52SGeorge Keishing# how many time it needs MPIPL test runs.
259480af52SGeorge Keishing${MPIPL_LOOP_COUNT}     ${1}
269480af52SGeorge Keishing
27d6ec8369SGeorge Keishing
28d6ec8369SGeorge Keishing** Test Cases **
29d6ec8369SGeorge Keishing
309480af52SGeorge KeishingTrigger User Tool Initiated MPIPL
319480af52SGeorge Keishing    [Documentation]  Trigger And Verify user tool initiated dump using
329480af52SGeorge Keishing    ...              obmc-host-crash target.
339480af52SGeorge Keishing    [Tags]  Trigger_User_Tool_Initiated_MPIPL
34d6ec8369SGeorge Keishing
359480af52SGeorge Keishing    FOR  ${count}  IN RANGE  0  ${MPIPL_LOOP_COUNT}
369480af52SGeorge Keishing        Log To Console   MPIPL LOOP_COUNT:${count} execution.
379480af52SGeorge Keishing        Tool Initd MP Reboot
385e009799SGeorge Keishing        Wait Until Keyword Succeeds  5 min  10 sec  Required Dumps Should Exist
399480af52SGeorge Keishing    END
40d6ec8369SGeorge Keishing
41d6ec8369SGeorge Keishing
429480af52SGeorge KeishingTrigger User Initiated MPIPL Using Redfish
439480af52SGeorge Keishing    [Documentation]  Verify redfish triggered MPIPL flow using diagnostic
449480af52SGeorge Keishing    ...              mode target.
459480af52SGeorge Keishing    [Tags]  Trigger_User_Initiated_MPIPL_Using_Redfish
46d6ec8369SGeorge Keishing
479480af52SGeorge Keishing    FOR  ${count}  IN RANGE  0  ${MPIPL_LOOP_COUNT}
489480af52SGeorge Keishing        Log To Console   MPIPL LOOP_COUNT:${count} execution.
499480af52SGeorge Keishing        Redfish Initiated MPIPL
505e009799SGeorge Keishing        Wait Until Keyword Succeeds  5 min  10 sec  Required Dumps Should Exist
519480af52SGeorge Keishing    END
52d6ec8369SGeorge Keishing
53d6ec8369SGeorge Keishing
549480af52SGeorge Keishing*** Keywords ***
55d6ec8369SGeorge Keishing
56d6ec8369SGeorge Keishing
579480af52SGeorge KeishingTest Setup Execution
589480af52SGeorge Keishing    [Documentation]  Do the post test setup cleanup.
59d6ec8369SGeorge Keishing
609480af52SGeorge Keishing    Test System Cleanup
6140abba25SGeorge Keishing    Run Keyword And Ignore Error  Clear All Subscriptions
62d6ec8369SGeorge Keishing
639480af52SGeorge Keishing
649480af52SGeorge KeishingTest Teardown Execution
659480af52SGeorge Keishing    [Documentation]  Do the post test teardown.
669480af52SGeorge Keishing
679480af52SGeorge Keishing    FFDC On Test Case Fail
689480af52SGeorge Keishing
699480af52SGeorge Keishing
709480af52SGeorge KeishingSuite Teardown Execution
719480af52SGeorge Keishing    [Documentation]  Do the post suite teardown.
729480af52SGeorge Keishing
739480af52SGeorge Keishing    Test System Cleanup
749480af52SGeorge Keishing    Run Keyword And Ignore Error  Delete All Redfish Sessions
759480af52SGeorge Keishing
769480af52SGeorge Keishing
779480af52SGeorge KeishingTest System Cleanup
789480af52SGeorge Keishing    [Documentation]  Cleanup errors before exiting.
799480af52SGeorge Keishing
809480af52SGeorge Keishing    Run Keyword And Ignore Error  Redfish Purge Event Log
819480af52SGeorge Keishing    Run Keyword And Ignore Error  Redfish Delete All BMC Dumps
829480af52SGeorge Keishing    Run Keyword And Ignore Error  Redfish Delete All System Dumps
839480af52SGeorge Keishing
849480af52SGeorge Keishing
859480af52SGeorge KeishingRedfish Initiated MPIPL
869480af52SGeorge Keishing    [Documentation]  Trigger redfish triggered MPIPL flow.
87d6ec8369SGeorge Keishing
88d6ec8369SGeorge Keishing    # Power on
89d6ec8369SGeorge Keishing    Redfish Power On
90d6ec8369SGeorge Keishing
91d6ec8369SGeorge Keishing    # Trigger MPIPL
9240abba25SGeorge Keishing    Log To Console  Trigger System dump
93d6ec8369SGeorge Keishing    ${payload} =  Create Dictionary
94d6ec8369SGeorge Keishing    ...  DiagnosticDataType=OEM  OEMDiagnosticDataType=System
959480af52SGeorge Keishing    Redfish.Post  ${DUMP_URI}/Actions/LogService.CollectDiagnosticData  body=&{payload}
96d6ec8369SGeorge Keishing    ...  valid_status_codes=[${HTTP_ACCEPTED}]
97d6ec8369SGeorge Keishing
9840abba25SGeorge Keishing    Sleep  10s
9940abba25SGeorge Keishing
1009480af52SGeorge Keishing    Log To Console  Wait for system to transition DiagnosticMode
10140abba25SGeorge Keishing    Wait Until Keyword Succeeds  2 min  3 sec  Is Boot Progress Changed
102d6ec8369SGeorge Keishing
1039480af52SGeorge Keishing    Log To Console  Wait for system to transition path DiagnosticMode to Runtime.
1049480af52SGeorge Keishing    Wait Until Keyword Succeeds  10 min  20 sec  Is Boot Progress Runtime Matched
105d6ec8369SGeorge Keishing
106d6ec8369SGeorge Keishing
1079480af52SGeorge KeishingIs Boot Progress Runtime Matched
1089480af52SGeorge Keishing    [Documentation]  Get BootProgress state and expect boot state mismatch.
109d6ec8369SGeorge Keishing
1109480af52SGeorge Keishing    # Match any of the BootProgress state SystemHardwareInitializationComplete|OSBootStarted|OSRunning
1119480af52SGeorge Keishing    ${boot_progress}  ${host_state}=  Redfish Get Boot Progress
1129480af52SGeorge Keishing    Should Contain Any  ${boot_progress}  SystemHardwareInitializationComplete  OSBootStarted  OSRunning
113d6ec8369SGeorge Keishing
114d6ec8369SGeorge Keishing
1159480af52SGeorge KeishingRequired Dumps Should Exist
1169480af52SGeorge Keishing    [Documentation]  Check for BMC and system dump.
1179480af52SGeorge Keishing
1189480af52SGeorge Keishing    #   {
1194d430283Sganesanb    #       "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries/4",
1209480af52SGeorge Keishing    #       "@odata.type": "#LogEntry.v1_8_0.LogEntry",
1219480af52SGeorge Keishing    #       "AdditionalDataSizeBytes": 914254,
1224d430283Sganesanb    #       "AdditionalDataURI": "/redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries/4/attachment",
1239480af52SGeorge Keishing    #       "Created": "2022-07-22T03:36:23+00:00",
1249480af52SGeorge Keishing    #       "DiagnosticDataType": "Manager",
1259480af52SGeorge Keishing    #       "EntryType": "Event",
1269480af52SGeorge Keishing    #       "Id": "4",
1279480af52SGeorge Keishing    #       "Name": "BMC Dump Entry"
1289480af52SGeorge Keishing    #   }
1294d430283Sganesanb    ${bmc_dump}=  Redfish.Get Properties  /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries
1309480af52SGeorge Keishing    Log To Console  BMC dumps generated: ${bmc_dump['Members@odata.count']}
1319480af52SGeorge Keishing    Should Be True  ${bmc_dump['Members@odata.count']} >= 1  msg=No BMC dump generated.
1329480af52SGeorge Keishing
1339480af52SGeorge Keishing    #"Members": [
1349480af52SGeorge Keishing    #   {
1359480af52SGeorge Keishing    #       "@odata.id": "/redfish/v1/Systems/system/LogServices/Dump/Entries/System_1",
1369480af52SGeorge Keishing    #       "@odata.type": "#LogEntry.v1_8_0.LogEntry",
1379480af52SGeorge Keishing    #       "AdditionalDataSizeBytes": 2363839216,
1389480af52SGeorge Keishing    #       "AdditionalDataURI": "/redfish/v1/Systems/system/LogServices/Dump/Entries/System_1/attachment",
1399480af52SGeorge Keishing    #       "Created": "2022-07-22T03:38:58+00:00",
1409480af52SGeorge Keishing    #       "DiagnosticDataType": "OEM",
1419480af52SGeorge Keishing    #       "EntryType": "Event",
1429480af52SGeorge Keishing    #       "Id": "System_1",
1439480af52SGeorge Keishing    #       "Name": "System Dump Entry",
1449480af52SGeorge Keishing    #       "OEMDiagnosticDataType": "System"
1459480af52SGeorge Keishing    #   }
146c32434a3SYi Hu    ${sys_dump}=  Redfish.Get Properties  /redfish/v1/Systems/${SYSTEM_ID}/LogServices/Dump/Entries
1479480af52SGeorge Keishing    Log To Console  System dump generated: ${sys_dump['Members@odata.count']}
1489480af52SGeorge Keishing    Should Be True  ${sys_dump['Members@odata.count']} == 1  msg=No system dump generated.
149c69c45a6SGeorge Keishing
150c69c45a6SGeorge Keishing
151c69c45a6SGeorge KeishingClear All Subscriptions
152c69c45a6SGeorge Keishing    [Documentation]  Delete all subscriptions.
153c69c45a6SGeorge Keishing
154c69c45a6SGeorge Keishing    ${subscriptions}=  Redfish.Get Attribute  /redfish/v1/EventService/Subscriptions  Members
155c69c45a6SGeorge Keishing    FOR  ${subscription}  IN  @{subscriptions}
156c69c45a6SGeorge Keishing        Redfish.Delete  ${subscription['@odata.id']}
157c69c45a6SGeorge Keishing    END
158