13075ff32SSathyajith M S*** Settings ***
23075ff32SSathyajith M SDocumentation   Test Non-maskable interrupt functionality.
33075ff32SSathyajith M S
43075ff32SSathyajith M SResource        ../lib/bmc_redfish_resource.robot
53075ff32SSathyajith M SResource        ../lib/boot_utils.robot
63075ff32SSathyajith M SResource        ../lib/openbmc_ffdc.robot
73075ff32SSathyajith M SResource        ../lib/secureboot/secureboot.robot
83075ff32SSathyajith M SResource        ../lib/state_manager.robot
93075ff32SSathyajith M SLibrary         ../lib/bmc_ssh_utils.py
103075ff32SSathyajith M SLibrary         ../syslib/utils_os.py
113075ff32SSathyajith M S
123075ff32SSathyajith M STest Teardown   FFDC On Test Case Fail
133075ff32SSathyajith M SSuite Teardown  Redfish.Logout
143075ff32SSathyajith M S
153075ff32SSathyajith M S
163075ff32SSathyajith M S*** Test Cases ***
173075ff32SSathyajith M S
183075ff32SSathyajith M STrigger NMI When OPAL/Host OS Is Not Up
193075ff32SSathyajith M S    [Documentation]  Verify return error code from Redfish
203075ff32SSathyajith M S    ...  while injecting NMI when HOST OS is not up.
213075ff32SSathyajith M S    [Tags]  Trigger_NMI_When_OPAL/Host_OS_Is_Not_Up
223075ff32SSathyajith M S
233075ff32SSathyajith M S    Redfish Power Off
243075ff32SSathyajith M S    Trigger NMI
253075ff32SSathyajith M S
263075ff32SSathyajith M S
273075ff32SSathyajith M STrigger NMI When OPAL/Host OS Is Running And Secureboot Is Disabled
283075ff32SSathyajith M S    [Documentation]  Verify valid return status code from Redfish
293075ff32SSathyajith M S    ...  while injecting NMI, when HOST OS is running and
303075ff32SSathyajith M S    ...  secureboot is disabled.
313075ff32SSathyajith M S    [Tags]  Trigger_NMI_When_OPAL/Host_OS_Is_Running_And_Secureboot_Is_Disabled
323075ff32SSathyajith M S    [Setup]  Test Setup Execution  ${0}
333075ff32SSathyajith M S
343075ff32SSathyajith M S    Trigger NMI  valid_status_codes=[${HTTP_OK}]
35*4898c50aSSathyajith M S    Verify Crash Dump Directory After NMI Inject
36*4898c50aSSathyajith M S
37*4898c50aSSathyajith M S
38*4898c50aSSathyajith M S*** Keywords ***
39*4898c50aSSathyajith M S
40*4898c50aSSathyajith M SVerify Crash Dump Directory After NMI Inject
41*4898c50aSSathyajith M S    [Documentation]  Verification of crash dump directory after NMI inject.
42*4898c50aSSathyajith M S
433075ff32SSathyajith M S    Wait Until Keyword Succeeds  10 min  1 min  Is Host Rebooted
443075ff32SSathyajith M S    Is OS Booted
453075ff32SSathyajith M S    Wait Until Keyword Succeeds  1 min  10 sec  Verify Crash Dump Directory
463075ff32SSathyajith M S
473075ff32SSathyajith M S
483075ff32SSathyajith M STest Setup Execution
493075ff32SSathyajith M S    [Documentation]  Test setup execution.
503075ff32SSathyajith M S    [Arguments]  ${secure_boot_mode}=${1}
513075ff32SSathyajith M S
523075ff32SSathyajith M S    # Description of argument(s):
533075ff32SSathyajith M S    # secure_boot_mode  Secure boot -> Enable-1 or Disable-0.
543075ff32SSathyajith M S
553075ff32SSathyajith M S    Redfish Power Off  stack_mode=skip
563075ff32SSathyajith M S    Set Auto Reboot  ${1}
573075ff32SSathyajith M S    # Set and verify secure boot policy as disabled.
583075ff32SSathyajith M S    Set And Verify TPM Policy  ${secure_boot_mode}
593075ff32SSathyajith M S    Redfish Power On
603075ff32SSathyajith M S    # Delete any pre-existing dump files.
613075ff32SSathyajith M S    OS Execute Command  rm -rf /var/crash/*
623075ff32SSathyajith M S    ${os_release_info}=  Get OS Release Info
633075ff32SSathyajith M S    # Start crash dump utility on OS.
643075ff32SSathyajith M S    ${cmd}=  Set Variable If
653075ff32SSathyajith M S    ...  '${os_release_info['id']}' == 'ubuntu'  kdump-config show  kdumpctl start
663075ff32SSathyajith M S    OS Execute Command  ${cmd}  print_out=1
673075ff32SSathyajith M S
683075ff32SSathyajith M S
693075ff32SSathyajith M STrigger NMI
703075ff32SSathyajith M S    [Documentation]  Inject non-maskable interrupt Redfish URI.
713075ff32SSathyajith M S    [Arguments]  ${valid_status_codes}=[${HTTP_INTERNAL_SERVER_ERROR}]
723075ff32SSathyajith M S
733075ff32SSathyajith M S    # Description of argument(s):
743075ff32SSathyajith M S    # valid_status_codes  A list of status codes that the
753075ff32SSathyajith M S    #                     caller considers acceptable.
763075ff32SSathyajith M S    #                     See lib/redfish_plus.py for details.
773075ff32SSathyajith M S
783075ff32SSathyajith M S    Redfish.Login
793075ff32SSathyajith M S    Redfish.Post  ${SYSTEM_BASE_URI}Actions/ComputerSystem.Reset
803075ff32SSathyajith M S    ...  body={"ResetType": "Nmi"}  valid_status_codes=${valid_status_codes}
813075ff32SSathyajith M S
82*4898c50aSSathyajith M S
833075ff32SSathyajith M SVerify Crash Dump Directory
843075ff32SSathyajith M S    [Documentation]  Verify that the crash dump directory is not empty.
853075ff32SSathyajith M S
863075ff32SSathyajith M S    # As per the requirement, there should be a crash dump file
873075ff32SSathyajith M S    # after successful NMI injection.
88*4898c50aSSathyajith M S
893075ff32SSathyajith M S    ${output}  ${stderr}  ${rc}=
903075ff32SSathyajith M S    ...  OS Execute Command  ls -ltr /var/crash/*  print_out=1
91