Adding BMC nodes, Power on/off using XCAT
This change includes:
Adding BMC nodes to XCAT
Verify added BMC nodes
Powering on BMC nodes via XCAT
Powering off BMC nodes via XCAT
Checking power status of BMC nodes
This resolves openbmc/openbmc-test-automation#620
Change-Id: Iaf73ab6142a09723b59317fd735004ca1bd0ff83
Signed-off-by: Prashanth Katti <prkatti1@in.ibm.com>
diff --git a/xcat/xcat_testing.robot b/xcat/xcat_testing.robot
index dfee1f8..7a6fb1f 100644
--- a/xcat/xcat_testing.robot
+++ b/xcat/xcat_testing.robot
@@ -5,20 +5,43 @@
Resource ../lib/xcat/xcat_utils.robot
Library OperatingSystem
+Library String
Suite Setup Validate XCAT Setup
+*** Variables ***
+
+${poweron_flag} ON
+${poweroff_flag} OFF
+
*** Test Cases ***
Add BMC Nodes To XCAT
[Documentation] Connect and add BMC nodes.
[Tags] Add_BMC_Nodes_To_XCAT
- # It reads out file having list of BMC nodes and adds
- # those nodes into XCAT.
+ # Add BMC nodes one by one and check whether it is successfully added.
+ : FOR ${bmc} IN @{BMC_LIST}
+ \ Add Nodes To XCAT ${bmc}
+ \ Validate Added Node ${bmc}
- # TBD- Adding BMC nodes to XCAT
- # https://github.com/openbmc/openbmc-test-automation/issues/620
+Power On Via XCAT And Validate
+ [Documentation] Power on via XCAT and validate.
+ [Tags] Power_On_Via_XCAT_And_Validate
+
+ # Power on each BMC node and validate the power status.
+ : FOR ${bmc} IN @{BMC_LIST}
+ \ Power On Via XCAT ${bmc}
+ \ Validate Power Status Via XCAT ${bmc} ${poweron_flag}
+
+Power Off Via XCAT And Validate
+ [Documentation] Power off via XCAT and validate.
+ [Tags] Power_Off_Via_XCAT_And_Validate
+
+ # Power off each BMC node and validate the power status.
+ : FOR ${bmc} IN @{BMC_LIST}
+ \ Power Off Via XCAT ${bmc}
+ \ Validate Power Status Via XCAT ${bmc} ${poweroff_flag}
*** Keywords ***
@@ -32,3 +55,19 @@
Should Not Be Empty ${cmd_output} msg=XCAT not installed.
Log \n XCAT Version is: \n${cmd_output}
+
+ # Get all the BMC nodes from the config file.
+ ${nodes}= Get List Of BMC Nodes
+ # Make a list of BMC nodes.
+ @{BMC_LIST}= Split To Lines ${nodes}
+ Log To Console BMC nodes to be added:\n ${BMC_LIST}
+ Set Suite Variable @{BMC_LIST}
+
+Validate Power Status Via XCAT
+ [Documentation] Validate power status.
+ [Arguments] ${node} ${flag}=ON
+
+ ${status}= Get Power Status ${node}
+ Run Keyword If '${flag}' == 'ON'
+ ... Should Contain ${status} on msg=Host is off.
+ ... ELSE Should Contain ${status} off msg=Host is on.