XCAT Automation
This change includes:
1. Opening Connection & Login to XCAT server
2. Get the list of BMC nodes to be added to XCAT server.
Resolves openbmc/openbmc-test-automation#597
Change-Id: If2411a3178793575ff9412ea9fa0a69e622fb91f
Signed-off-by: Prashanth Katti <prkatti1@in.ibm.com>
diff --git a/lib/xcat/resource.txt b/lib/xcat/resource.txt
new file mode 100644
index 0000000..66a184f
--- /dev/null
+++ b/lib/xcat/resource.txt
@@ -0,0 +1,13 @@
+*** Variables ***
+
+# XCAT related parameters
+
+${XCAT_HOST} ${EMPTY}
+${XCAT_USERNAME} ${EMPTY}
+${XCAT_PASSWORD} ${EMPTY}
+${XCAT_PORT} 31578
+${XCAT_DIR_PATH} /opt/xcat/bin/
+
+# Default BMC nodes config file.
+
+${NODE_CFG_FILE_PATH} ../lib/xcat/bmc_nodes.cfg
diff --git a/lib/xcat/xcat_utils.robot b/lib/xcat/xcat_utils.robot
new file mode 100644
index 0000000..505ef80
--- /dev/null
+++ b/lib/xcat/xcat_utils.robot
@@ -0,0 +1,34 @@
+*** Settings ***
+
+Resource ../xcat/resource.txt
+
+Library SSHLibrary
+Library OperatingSystem
+
+*** Keywords ***
+
+Open Connection And Login To XCAT
+ [Documentation] Open connection and login to xCAT server.
+ [Arguments] ${xcat_host}=${XCAT_HOST} ${xcat_port}=${XCAT_PORT}
+
+ # Description of argument(s):
+ # xcat_host IP address of the XCAT server.
+ # xcat_port Network port on which XCAT server accepts ssh session.
+
+ Open Connection ${xcat_host} port=${xcat_port}
+ Login ${XCAT_USERNAME} ${XCAT_PASSWORD}
+
+Get List Of BMC Nodes
+ [Documentation] Get list of BMC nodes.
+ [Arguments] ${node_cfg_file_path}=${NODE_CFG_FILE_PATH}
+
+ # Get the list of BMC nodes to be added.
+ # This keyword expects file having list of BMC nodes
+ # as an input.
+ # File should have IP addresses of BMC nodes.
+
+ OperatingSystem.File Should Exist ${node_cfg_file_path} msg=cfg file missing.
+ File Should Not Be Empty ${node_cfg_file_path} msg=Empty config file.
+
+ ${bmc_list} = OperatingSystem.Get File ${node_cfg_file_path}
+ [Return] ${bmc_list}
diff --git a/xcat/xcat_testing.robot b/xcat/xcat_testing.robot
new file mode 100644
index 0000000..dfee1f8
--- /dev/null
+++ b/xcat/xcat_testing.robot
@@ -0,0 +1,34 @@
+*** Settings ***
+Documentation Module for testing BMC via XCAT.
+
+Resource ../lib/xcat/resource.txt
+Resource ../lib/xcat/xcat_utils.robot
+
+Library OperatingSystem
+
+Suite Setup Validate XCAT Setup
+
+*** 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.
+
+ # TBD- Adding BMC nodes to XCAT
+ # https://github.com/openbmc/openbmc-test-automation/issues/620
+
+*** Keywords ***
+
+Validate XCAT Setup
+ [Documentation] Validate XCAT setup.
+
+ Open Connection And Login To XCAT
+
+ # Check if XCAT is installed.
+ ${cmd_output}= Execute Command ${XCAT_DIR_PATH}/lsxcatd -v
+ Should Not Be Empty ${cmd_output} msg=XCAT not installed.
+
+ Log \n XCAT Version is: \n${cmd_output}