IPMI Sensor ID related test cases.
Resolves openbmc/openbmc-test-automation#1142
Change-Id: Ie70d44ebf2ff106376ecf40c92446e7221489875
Signed-off-by: Sweta Potthuri <spotthur@in.ibm.com>
diff --git a/tests/ipmi/test_sensors_ipmi.robot b/tests/ipmi/test_sensors_ipmi.robot
new file mode 100644
index 0000000..f549d4d
--- /dev/null
+++ b/tests/ipmi/test_sensors_ipmi.robot
@@ -0,0 +1,226 @@
+*** Settings ***
+Documentation Test IPMI sensor IDs
+
+Resource ../../lib/rest_client.robot
+Resource ../../lib/ipmi_client.robot
+Resource ../../lib/openbmc_ffdc.robot
+Resource ../../lib/state_manager.robot
+Library ../../data/model.py
+Resource ../../lib/boot_utils.robot
+Resource ../../lib/utils.robot
+
+Test Setup Open Connection And Log In
+Test Teardown Test Teardown Execution
+
+*** Test Cases ***
+
+DIMM Present And Not Present
+ [Documentation] Verify the IPMI sensor for present and not present.
+ [Tags] DIMM_Present_And_Not_Present
+
+ # Set the dimm3 Present to 1
+ Run IPMI Command
+ ... 0x04 0x30 0xac 0xa9 0x00 0x40 0x00 0x00 0x00 0x00 0x20 0x00
+ Verify The Attribute
+ ... ${HOST_INVENTORY_URI}system/chassis/motherboard/dimm3 Present ${1}
+
+ # Set the dimm3 Present to 0
+ Run IPMI Command
+ ... 0x04 0x30 0xac 0xa9 0xff 0x00 0x00 0x40 0x00 0x00 0x20 0x00
+ Verify The Attribute
+ ... ${HOST_INVENTORY_URI}system/chassis/motherboard/dimm3 Present ${0}
+
+DIMM Functional And Not Functional
+ [Documentation] Verify that the DIMM is Functional.
+ [Tags] DIMM_Functional_And_Not_Functional
+
+ # Set the dimm3 Functional to 0
+ Run IPMI Command
+ ... 0x04 0x30 0xac 0x00 0x00 0x10 0x00 0x00 0x00 0x00 0x20 0x00
+ Verify The Attribute
+ ... ${HOST_INVENTORY_URI}system/chassis/motherboard/dimm3
+ ... Functional ${0}
+
+ # Set the dimm3 Functional to 1
+ Run IPMI Command
+ ... 0x04 0x30 0xac 0x00 0x00 0x00 0x00 0x10 0x00 0x00 0x20 0x00
+ Verify The Attribute
+ ... ${HOST_INVENTORY_URI}system/chassis/motherboard/dimm3
+ ... Functional ${1}
+
+CPU Present And Not Present
+ [Documentation] Verify the IPMI sensor for present and not present.
+ [Tags] CPU_Present_And_Not_Present
+
+ # Set the cpu0 Present to 1
+ Run IPMI Command
+ ... 0x04 0x30 0x5a 0xa9 0x00 0x80 0x00 0x00 0x00 0x00 0x20 0x00
+ Verify The Attribute
+ ... ${HOST_INVENTORY_URI}system/chassis/motherboard/cpu0 Present ${1}
+
+ # Set the cpu0 Present to 0
+ Run IPMI Command
+ ... 0x04 0x30 0x5a 0xa9 0x00 0x00 0x00 0x80 0x00 0x00 0x20 0x00
+ Verify The Attribute
+ ... ${HOST_INVENTORY_URI}system/chassis/motherboard/cpu0 Present ${0}
+
+CPU Functional And Not Functional
+ [Documentation] Verify that the CPU is Functional.
+ [Tags] CPU_Functional_And_Not_Functional
+
+ # Set the cpu0 Functional to 0
+ Run IPMI Command
+ ... 0x04 0x30 0x5a 0xa9 0xff 0x00 0x01 0x00 0x00 0x00 0x20 0x00
+ Verify The Attribute
+ ... ${HOST_INVENTORY_URI}system/chassis/motherboard/cpu0
+ ... Functional ${0}
+
+ # Set the cpu0 Functional to 1
+ Run IPMI Command
+ ... 0x04 0x30 0x5a 0x00 0x00 0x00 0x00 0x00 0x01 0x00 0x20 0x00
+ Verify The Attribute
+ ... ${HOST_INVENTORY_URI}system/chassis/motherboard/cpu0
+ ... Functional ${1}
+
+Core Present And Not Present
+ [Documentation] Verify the IPMI sensor for present and not present.
+ [Tags] Core_Present_And_Not_Present
+
+ # Set the Core Present to 1
+ Run IPMI Command
+ ... 0x04 0x30 0x1e 0xa9 0x00 0x80 0x00 0x00 0x00 0x00 0x20 0x00
+ Verify The Attribute
+ ... ${HOST_INVENTORY_URI}system/chassis/motherboard/cpu0/core4
+ ... Present ${1}
+
+ # Set the core4 of cpu0 Present to 0
+ Run IPMI Command
+ ... 0x04 0x30 0x1e 0xa9 0x00 0x00 0x00 0x80 0x00 0x00 0x20 0x00
+ Verify The Attribute
+ ... ${HOST_INVENTORY_URI}system/chassis/motherboard/cpu0/core4
+ ... Present ${0}
+
+Core Functional And Not Functional
+ [Documentation] Verify that the Core is Functional.
+ [Tags] Core_Functional_And_Not_Functional
+
+ # Set the core4 of cpu0 Functional to 0
+ Run IPMI Command
+ ... 0x04 0x30 0x1e 0xa9 0xff 0x00 0x01 0x00 0x00 0x00 0x20 0x00
+ Verify The Attribute
+ ... ${HOST_INVENTORY_URI}system/chassis/motherboard/cpu0/core4
+ ... Functional ${0}
+
+ # Set the core4 of cpu0 Functional to 1
+ Run IPMI Command
+ ... 0x04 0x30 0x1e 0x00 0x00 0x00 0x00 0x00 0x01 0x00 0x20 0x00
+ Verify The Attribute
+ ... ${HOST_INVENTORY_URI}system/chassis/motherboard/cpu0/core4
+ ... Functional ${1}
+
+GPU Present And Not Present
+ [Documentation] Verify the IPMI sensor for present and not present.
+ [Tags] GPU_Present_And_Not_Present
+
+ # Set GPU card0 Present to 1
+ Run IPMI Command
+ ... 0x04 0x30 0xC5 0xa9 0x00 0x80 0x00 0x00 0x00 0x00 0x20 0x00
+ Verify The Attribute
+ ... ${HOST_INVENTORY_URI}system/chassis/motherboard/gv100card0
+ ... Present ${1}
+
+ # Set the GPU card0 Present to 0
+ Run IPMI Command
+ ... 0x04 0x30 0xC5 0xa9 0x00 0x00 0x00 0x80 0x00 0x00 0x20 0x00
+ Verify The Attribute
+ ... ${HOST_INVENTORY_URI}system/chassis/motherboard/gv100card0
+ ... Present ${0}
+
+GPU Functional And Not Functional
+ [Documentation] Verify that the GPU is Functional.
+ [Tags] GPU_Functional_And_Not_Functional
+
+ # Set the GPU card0 Functional to 0
+ Run IPMI Command
+ ... 0x04 0x30 0xC5 0xa9 0xff 0x00 0x01 0x00 0x00 0x00 0x20 0x00
+ Verify The Attribute
+ ... ${HOST_INVENTORY_URI}system/chassis/motherboard/gv100card0
+ ... Functional ${0}
+
+ # Set the GPU card0 Functional to 1
+ Run IPMI Command
+ ... 0x04 0x30 0xC5 0x00 0x00 0x00 0x00 0x00 0x01 0x00 0x20 0x00
+ Verify The Attribute
+ ... ${HOST_INVENTORY_URI}system/chassis/motherboard/gv100card0
+ ... Functional ${1}
+
+TPM Enable and Disable
+ [Documentation] Enable and disable TPM.
+ [Tags] TPM_Enable_and_Disable
+
+ # Set the TPMEnable to 0
+ Run IPMI Command
+ ... 0x04 0x30 0xD7 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x20 0x00
+ Verify The Attribute ${CONTROL_URI}/host0/TPMEnable TPMEnable ${0}
+
+ # Set the TPMEnable to 1
+ Run IPMI Command
+ ... 0x04 0x30 0xD7 0x00 0x00 0x02 0x00 0x00 0x00 0x00 0x20 0x00
+ Verify The Attribute ${CONTROL_URI}/host0/TPMEnable TPMEnable ${1}
+
+Autoreboot Enable and Disable
+ [Documentation] Enable and disable Autoreboot.
+ [Tags] Autoreboot_Enable_and_Disable
+
+ # Set the TPMEnable to 0
+ Run IPMI Command
+ ... 0x04 0x30 0xDA 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x20 0x00
+ Verify The Attribute ${CONTROL_URI}/host0/auto_reboot AutoReboot ${0}
+
+ # Set the TPMEnable to 1
+ Run IPMI Command
+ ... 0x04 0x30 0xDA 0x00 0x00 0x02 0x00 0x00 0x00 0x00 0x20 0x00
+ Verify The Attribute ${CONTROL_URI}/host0/auto_reboot AutoReboot ${1}
+
+OS Status Sensor Progress
+ [Documentation] OS Status Sensor Progress.
+ [Tags] OS_Status_Sensor_Progress
+
+ # Set the OS Sensor Progress to PXEBoot
+ Run IPMI Command
+ ... 0x04 0x30 0x05 0x00 0x00 0x04 0x00 0x00 0x00 0x00 0x20 0x00
+ ${resp}= Read Attribute ${SYSTEM_STATE_URI}/host0 OperatingSystemState
+ Should Be Equal
+ ... xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.PXEBoot
+ ... ${resp}
+
+Boot Progress Sensor Unspecified Error
+ [Documentation] Boot Progress Sensor Unspecified Error.
+ [Tags] Boot_Progress_Sensor_Unspecified_Error
+
+ # Set the Boot Progress as Unspecified
+ Run IPMI Command
+ ... 0x04 0x30 0x03 0xa9 0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x00
+ ${resp}= Read Attribute ${SYSTEM_STATE_URI}/host0 BootProgress
+ Should Be Equal ${OS_BOOT_OFF} ${resp}
+
+*** Keywords ***
+
+Verify The Attribute
+ [Arguments] ${uri} ${parm} ${value}
+ # Description of arguments:
+ # ${uri} URI path.
+ # ${parm} Attribute.
+ # ${value} Output to be compared.
+
+ ${output}= Read Attribute ${uri} ${parm}
+ Should Be Equal ${value} ${output}
+
+Test Teardown Execution
+ [Documentation] Do the post test teardown.
+ ... 1. Capture FFDC on test failure.
+ ... 2. Close all open SSH connections.
+
+ FFDC On Test Case Fail
+ Close All Connections
+
diff --git a/tests/test_sensors.robot b/tests/test_sensors.robot
index fd1e99d..50f86b9 100644
--- a/tests/test_sensors.robot
+++ b/tests/test_sensors.robot
@@ -26,24 +26,22 @@
Verify IPMI BT Capabilities Command
[Documentation] Verify IPMI BT capability command response.
- [Tags] Verify_IPMI BT_Capabilities_Command
+ [Tags] Verify_IPMI_BT_Capabilities_Command
[Setup] REST Power On
- ${output} = Run IPMI command 0x06 0x36
- Should Be Equal As Strings "${output}" " 01 3f 3f 0a 01"
-
+ ${output}= Run IPMI command 0x06 0x36
+ Should Be True "${output}" == " 01 3f 3f 0a 01"
+ ... msg=Incorrect Output
io_board Present
[Tags] io_board_Present
- ${uri}= Get System component io_board
- Read The Attribute ${uri} present
- Response Should Be Equal True
+ ${uri}= Get System component io_board
+ Verify The Attribute ${uri} Present ${True}
io_board Fault
[Tags] io_board_Fault
- ${uri}= Get System component io_board
- Read The Attribute ${uri} fault
- Response Should Be Equal False
+ ${uri}= Get System component io_board
+ Verify The Attribute ${uri} fault ${False}
*** Keywords ***
@@ -65,15 +63,15 @@
${url}= Get From List ${resp} 0
[Return] ${url}
+Verify The Attribute
+ [Arguments] ${uri} ${parm} ${value}
+ # Description of arguments:
+ # ${uri} URI path.
+ # ${parm} Attribute.
+ # ${value} Output to be compared.
-response Should Be Equal
- [Arguments] ${args}
- Should Be Equal ${OUTPUT} ${args}
-
-Read the Attribute
- [Arguments] ${uri} ${parm}
- ${output}= Read Attribute ${uri} ${parm}
- set test variable ${OUTPUT} ${output}
+ ${output}= Read Attribute ${uri} ${parm}
+ Should Be Equal ${value} ${output}
Post Test Case Execution
[Documentation] Do the post test teardown.