MPIPL test cases

Change-Id: I76ecaaefc6baee0e30fa2be4aba413b75f51f319
Signed-off-by: Sandhya Somashekar <sansomas@in.ibm.com>
diff --git a/data/variables.py b/data/variables.py
index 1cb5e28..5361228 100755
--- a/data/variables.py
+++ b/data/variables.py
@@ -198,6 +198,7 @@
 # EventLog variables.
 SYSTEM_BASE_URI = REDFISH_BASE_URI + 'Systems/system/'
 EVENT_LOG_URI = SYSTEM_BASE_URI + 'LogServices/EventLog/'
+DUMP_URI = SYSTEM_BASE_URI + 'LogServices/Dump/'
 
 '''
   QEMU HTTPS variable:
diff --git a/mpipl/test_mpipl_basic.robot b/mpipl/test_mpipl_basic.robot
new file mode 100644
index 0000000..ffb7e21
--- /dev/null
+++ b/mpipl/test_mpipl_basic.robot
@@ -0,0 +1,80 @@
+*** Settings ***
+Documentation    Test MPIPL.
+
+Resource         ../gui/lib/resource.robot
+Resource         ../lib/openbmc_ffdc.robot
+Resource         ../lib/bmc_redfish_utils.robot
+Resource         ../lib/bmc_redfish_resource.robot
+Resource         ../lib/resource.robot
+Resource         ../lib/boot_utils.robot
+Test Teardown    Test Teardown Execution
+
+*** Variables ***
+
+${user_initated_mpipl}  systemctl start obmc-host-crash@0.target
+
+** Test Cases **
+
+Trigger And Verify User Initiated Dump Using Diagnostic Mode Target
+    [Documentation]  Trigger And Verify user initiated dump using diagnostic mode target
+    [Tags]  Trigger_And_Verify_User_Initiated_Dump_Using_Diagnostic_Mode_Target
+
+    Redfish.Login
+
+    # Power off
+    Redfish Power Off
+
+    # Power on
+    Redfish Power On
+
+    # Trigger MPIPL
+    BMC Execute Command  ${user_initated_mpipl}
+    Sleep  240
+
+    # Confirm boot after MPIPL
+    ${res}  ${stderr}  ${rc} =  BMC Execute Command  obmcutil state
+    Should Contain  ${res}  OSStatus.Standby
+
+    ${p0_cfam}  ${stderr}  ${rc} =  BMC Execute Command  pdbg -p0 getcfam 0x2809
+    Should Contain  ${p0_cfam}  0x854
+    Printn  ${p0_cfam}
+
+    ${p1_cfam}  ${stderr}  ${rc} =  BMC Execute Command  pdbg -p1 getcfam 0x2809
+    Should Contain  ${p1_cfam}  0x854
+    Printn  ${p1_cfam}
+
+Trigger And Verify User Initiated Dump Using Redfish
+    [Documentation]  Verify redfish triggered MPIPL flow
+    [Tags]  Trigger_And_Verify_User_Initiated_Dump_Using_Redfish
+
+    Redfish.Login
+
+    # Power off
+    Redfish Power Off
+
+    # Power on
+    Redfish Power On
+
+    # Trigger MPIPL
+    ${payload} =  Create Dictionary
+    ...  DiagnosticDataType=OEM  OEMDiagnosticDataType=System
+    Redfish.Post  ${DUMP_URI}/Dump/Actions/LogService.CollectDiagnosticData  body=&{payload}
+    ...  valid_status_codes=[${HTTP_ACCEPTED}]
+
+    ${p0_cfam}  ${stderr}  ${rc} =  BMC Execute Command  pdbg -p0 getcfam 0x2809
+    Should Contain  ${p0_cfam}  0x854
+    Printn  ${p0_cfam}
+
+    ${p1_cfam}  ${stderr}  ${rc} =  BMC Execute Command  pdbg -p1 getcfam 0x2809
+    Should Contain  ${p1_cfam}  0x854
+    Printn  ${p1_cfam}
+
+
+*** Keywords ***
+
+Test Teardown Execution
+    [Documentation]  Do the post test teardown.
+
+    Run Keyword And Ignore Error  Redfish.Logout
+    FFDC On Test Case Fail
+