XCAT Automation - Group Power on/off

This change includes:
    1. Group power on using XCAT
    2. Group power off using XCAT
    3. Group power status using XCAT

This resolves openbmc/openbmc-test-automation#600

Change-Id: I16bcbc1e33d3946ee0902b78c08a0cf088c4ecf0
Signed-off-by: Prashanth Katti <prkatti1@in.ibm.com>
diff --git a/xcat/xcat_testing.robot b/xcat/xcat_testing.robot
index 22c1898..ce3dd54 100644
--- a/xcat/xcat_testing.robot
+++ b/xcat/xcat_testing.robot
@@ -49,8 +49,49 @@
 
     # Add BMC nodes to group and validate.
     : FOR  ${bmc}  IN  @{BMC_LIST}
-    /  Add Nodes To Group  ${bmc}  ${GROUP}
-    /  Validate Node Added In Group  ${bmc}  ${GROUP}
+    \  Add Nodes To Group  ${bmc}  ${GROUP}
+    \  Validate Node Added In Group  ${bmc}  ${GROUP}
+
+Power On Group And Validate
+    [Documentation]  Power on all BMCs in group and validate.
+    [Tags]  Power_On_Group_And_Validate
+
+    # Sample output of this keyword:
+    # XXX.XXX.XXX.XXX
+    # YYY.YYY.YYY.YYY
+    # ZZZ.ZZZ.ZZZ.ZZZ
+
+    ${nodes}=  Get List Of Nodes In Group  ${GROUP}
+    Should Not Be Empty  ${nodes}  msg=Group is empty.
+    Power On Via XCAT  ${GROUP}
+
+    # List the BMC nodes.
+
+    @{bmc_nodes}=  Split String  ${nodes}
+
+    # Validate power status on each BMC node one by one.
+    : FOR  ${bmc_node}  IN  @{bmc_nodes}
+    \  Validate Power Status Via XCAT  ${bmc_node}  ${poweron_flag}
+
+Power Off Group And Validate
+    [Documentation]  Power off all BMCs in group and validate.
+    [Tags]  Power_Off_Group_And_Validate
+
+    # Sample output of this keyword:
+    # XXX.XXX.XXX.XXX
+    # YYY.YYY.YYY.YYY
+    # ZZZ.ZZZ.ZZZ.ZZZ
+
+    ${nodes}=  Get List Of Nodes In Group  ${GROUP}
+    Should Not Be Empty  ${nodes}  msg=Group is empty.
+    Power Off Via XCAT  ${GROUP}
+
+    # List the BMC nodes.
+    @{bmc_nodes}=  Split String  ${nodes}
+
+    # Validate power status on each BMC node one by one.
+    : FOR  ${bmc_node}  IN  @{bmc_nodes}
+    \  Validate Power Status Via XCAT  ${bmc_node}  ${poweroff_flag}
 
 *** Keywords ***
 
@@ -72,6 +113,9 @@
     Log To Console  BMC nodes to be added:\n ${BMC_LIST}
     Set Suite Variable  @{BMC_LIST}
 
+    # GROUP should not be empty.
+    Should Not Be EMPTY  ${GROUP}  msg=Group does not exist.
+
 Validate Power Status Via XCAT
     [Documentation]  Validate power status.
     [Arguments]  ${node}  ${flag}=ON