XCAT- Add nodes to group and get list of nodes added in a group.

This change includes:
    Adding BMC nodes to a group
    Verify added BMC nodes
    Get list of nodes added in a group.

This resolves openbmc/openbmc-test-automation#657

Change-Id: I9bd9668cfe8605728113d9f4f92cf5f7b64f4a68
Signed-off-by: Prashanth Katti <prkatti1@in.ibm.com>
diff --git a/lib/xcat/xcat_utils.robot b/lib/xcat/xcat_utils.robot
index 9af70e4..19802a1 100644
--- a/lib/xcat/xcat_utils.robot
+++ b/lib/xcat/xcat_utils.robot
@@ -93,3 +93,47 @@
     Should Be Empty  ${stderr}
 
     [Return]  ${stdout}
+
+Add Nodes To Group
+    [Documentation]  Add BMC nodes to group.
+    [Arguments]  ${node}  ${group}=${GROUP}
+
+    # Description of argument(s):
+    # node   Name of the node (e.g. "node1").
+    # group  Name of the group (e.g. "openbmc").
+
+    ${stdout}  ${stderr}=  Execute Command
+    ...  ${XCAT_DIR_PATH}/chdef ${node} groups=${group}  return_stderr=True
+    Should Be Empty  ${stderr}
+
+Get List Of Nodes In Group
+    [Documentation]  Get list of nodes in BMC.
+    [Arguments]  ${group}=${GROUP}
+
+    # Description of argument(s):
+    # group  Name of the group (e.g. "openbmc").
+
+    # Sample output of this keyword:
+    # XXX.XXX.XXX.XXX
+    # YYY.YYY.YYY.YYY
+    # ZZZ.ZZZ.ZZZ.ZZZ
+
+    ${stdout}  ${stderr}=  Execute Command
+    ...  ${XCAT_DIR_PATH}/nodels ${group}  return_stderr=True
+    Should Be Empty  ${stderr}
+
+    [Return]  ${stdout}
+
+Validate Node Added In Group
+    [Documentation]  Validate whether node is added in group.
+    [Arguments]  ${node}  ${group}
+
+    # Description of argument(s):
+    # node   Name of the node (e.g. "node1").
+    # group  Name of the group (e.g. "openbmc").
+
+    ${nodes_in_group}=  Get List Of Nodes In Group  ${group}
+    Should Contain  ${nodes_in_group}  ${node}
+    ...  msg=BMC node is not added in a group.
+
+# TBD  openbmc/openbmc-test-automation/issues/647