Test power supply redundancy using IPMI.

Added:
    - Test cases to enable and disable using IPMI.
    - Update existing test names and tags and minor fixes.
    - Update test_lists/CT_basic_run tag names.

Resolves  openbmc/openbmc-test-automation#1226

Change-Id: I8e68a1b30e23feec04e3d9e365902b91ab0d098c
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/data/ipmi_raw_cmd_table.py b/data/ipmi_raw_cmd_table.py
index 441fe45..48c135c 100644
--- a/data/ipmi_raw_cmd_table.py
+++ b/data/ipmi_raw_cmd_table.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 r"""
-IPMI raw commands table.
+IPMI raw commands table:
 
    - Define IPMI interface index, commands and expected output.
 
diff --git a/test_lists/CT_basic_run b/test_lists/CT_basic_run
index 36b58a3..4006b04 100644
--- a/test_lists/CT_basic_run
+++ b/test_lists/CT_basic_run
@@ -27,5 +27,5 @@
 -i Escale_Power_Setting_Via_REST_And_Verify
 -i Escale_Deactivation_Test_Via_REST
 #Power redundancy
--i Disable_Power_Redundancy_And_Verify
--i Enable_Power_Redundancy_And_Verify
+-i Disable_Power_Redundancy_And_Verify_Using_REST
+-i Enable_Power_Redundancy_And_Verify_Using_REST
diff --git a/tests/test_hardware_sensors.robot b/tests/test_hardware_sensors.robot
index 4289ab4..ccd1d82 100644
--- a/tests/test_hardware_sensors.robot
+++ b/tests/test_hardware_sensors.robot
@@ -5,6 +5,8 @@
 Resource        ../lib/boot_utils.robot
 Resource        ../lib/state_manager.robot
 Resource        ../lib/openbmc_ffdc.robot
+Resource        ../lib/ipmi_client.robot
+Variables       ../data/ipmi_raw_cmd_table.py
 
 Suite Setup     Suite Setup Execution
 Test Teardown   Test Teardown Execution
@@ -227,9 +229,9 @@
    \  ${vddr_temp}=  Evaluate  ${json["data"]["Value"]} / 1000
    \  Should Be True  ${vddr_temp} > 0
 
-Disable Power Redundancy And Verify
+Disable Power Redundancy And Verify Using REST
    [Documentation]  Disable power redundancy and verify that it is disabled.
-   [Tags]  Disable_Power_Redundancy_And_Verify
+   [Tags]  Disable_Power_Redundancy_And_Verify_Using_REST
 
    # Example:
    # /xyz/openbmc_project/sensors/chassis/PowerSupplyRedundancy
@@ -246,9 +248,9 @@
    Should Be Equal As Strings  ${content["data"]}  Disabled
 
 
-Enable Power Redundancy And Verify
+Enable Power Redundancy And Verify Using REST
    [Documentation]  Enable power redundancy and verify that it is enabled.
-   [Tags]  Enable_Power_Redundancy_And_Verify
+   [Tags]  Enable_Power_Redundancy_And_Verify_Using REST
 
    # Example:
    # /xyz/openbmc_project/sensors/chassis/PowerSupplyRedundancy
@@ -265,6 +267,42 @@
    Should Be Equal As Strings  ${content["data"]}  Enabled
 
 
+Disable Power Redundancy And Verify Using IPMI
+    [Documentation]  Disable power redundancy and verify that it is disabled.
+    [Tags]  Disable_Power_Redundancy_And_Verify_Using_IPMI
+
+    # Refer to data/ipmi_raw_cmd_table.py for command definition.
+
+    Run IPMI Standard Command
+    ...  raw ${IPMI_RAW_CMD['power_supply_redundancy']['Disabled'][0]}
+
+    ${output}=  Run IPMI Standard Command
+    ...  raw ${IPMI_RAW_CMD['power_supply_redundancy']['Get'][0]}
+
+    Should Be Equal As Strings
+    ...  ${output.lstrip()}
+    ...  ${IPMI_RAW_CMD['power_supply_redundancy']['Get'][1]}
+    ...  msg=${IPMI_RAW_CMD['power_supply_redundancy']['Get'][1]} = ${output}.
+
+
+Enable Power Redundancy And Verify Using IPMI
+    [Documentation]  Enable power redundancy and verify that it is enabled.
+    [Tags]  Enable_Power_Redundancy_And_Verify_Using_IPMI
+
+    # Refer to data/ipmi_raw_cmd_table.py for command definition.
+
+    Run IPMI Standard Command
+    ...  raw ${IPMI_RAW_CMD['power_supply_redundancy']['Enabled'][0]}
+
+    ${output}=  Run IPMI Standard Command
+    ...  raw ${IPMI_RAW_CMD['power_supply_redundancy']['Get'][0]}
+
+    Should Be Equal As Strings
+    ...  ${output.lstrip()}
+    ...  ${IPMI_RAW_CMD['power_supply_redundancy']['Get'][3]}
+    ...  msg=${IPMI_RAW_CMD['power_supply_redundancy']['Get'][3]} = ${output}.
+
+
 *** Keywords ***
 
 Suite Setup Execution