Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Module for testing BMC via XCAT. |
| 3 | |
| 4 | Resource ../lib/xcat/resource.txt |
| 5 | Resource ../lib/xcat/xcat_utils.robot |
| 6 | |
| 7 | Library OperatingSystem |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 8 | Library String |
Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 9 | |
| 10 | Suite Setup Validate XCAT Setup |
| 11 | |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 12 | *** Variables *** |
| 13 | |
| 14 | ${poweron_flag} ON |
| 15 | ${poweroff_flag} OFF |
| 16 | |
Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 17 | *** Test Cases *** |
| 18 | |
| 19 | Add BMC Nodes To XCAT |
| 20 | [Documentation] Connect and add BMC nodes. |
| 21 | [Tags] Add_BMC_Nodes_To_XCAT |
| 22 | |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 23 | # Add BMC nodes one by one and check whether it is successfully added. |
| 24 | : FOR ${bmc} IN @{BMC_LIST} |
| 25 | \ Add Nodes To XCAT ${bmc} |
| 26 | \ Validate Added Node ${bmc} |
Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 27 | |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 28 | Power On Via XCAT And Validate |
| 29 | [Documentation] Power on via XCAT and validate. |
| 30 | [Tags] Power_On_Via_XCAT_And_Validate |
| 31 | |
| 32 | # Power on each BMC node and validate the power status. |
| 33 | : FOR ${bmc} IN @{BMC_LIST} |
| 34 | \ Power On Via XCAT ${bmc} |
| 35 | \ Validate Power Status Via XCAT ${bmc} ${poweron_flag} |
| 36 | |
| 37 | Power Off Via XCAT And Validate |
| 38 | [Documentation] Power off via XCAT and validate. |
| 39 | [Tags] Power_Off_Via_XCAT_And_Validate |
| 40 | |
| 41 | # Power off each BMC node and validate the power status. |
| 42 | : FOR ${bmc} IN @{BMC_LIST} |
| 43 | \ Power Off Via XCAT ${bmc} |
| 44 | \ Validate Power Status Via XCAT ${bmc} ${poweroff_flag} |
Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 45 | |
Prashanth Katti | b974a74 | 2017-05-25 06:52:29 -0500 | [diff] [blame] | 46 | Add Nodes To Group List |
| 47 | [Documentation] Add BMC nodes into group. |
| 48 | [Tags] Move_Added_Nodes_To_Group |
| 49 | |
| 50 | # Add BMC nodes to group and validate. |
| 51 | : FOR ${bmc} IN @{BMC_LIST} |
| 52 | / Add Nodes To Group ${bmc} ${GROUP} |
| 53 | / Validate Node Added In Group ${bmc} ${GROUP} |
| 54 | |
Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 55 | *** Keywords *** |
| 56 | |
| 57 | Validate XCAT Setup |
| 58 | [Documentation] Validate XCAT setup. |
| 59 | |
| 60 | Open Connection And Login To XCAT |
| 61 | |
| 62 | # Check if XCAT is installed. |
| 63 | ${cmd_output}= Execute Command ${XCAT_DIR_PATH}/lsxcatd -v |
| 64 | Should Not Be Empty ${cmd_output} msg=XCAT not installed. |
| 65 | |
| 66 | Log \n XCAT Version is: \n${cmd_output} |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 67 | |
| 68 | # Get all the BMC nodes from the config file. |
| 69 | ${nodes}= Get List Of BMC Nodes |
| 70 | # Make a list of BMC nodes. |
| 71 | @{BMC_LIST}= Split To Lines ${nodes} |
| 72 | Log To Console BMC nodes to be added:\n ${BMC_LIST} |
| 73 | Set Suite Variable @{BMC_LIST} |
| 74 | |
| 75 | Validate Power Status Via XCAT |
| 76 | [Documentation] Validate power status. |
| 77 | [Arguments] ${node} ${flag}=ON |
| 78 | |
| 79 | ${status}= Get Power Status ${node} |
| 80 | Run Keyword If '${flag}' == 'ON' |
| 81 | ... Should Contain ${status} on msg=Host is off. |
| 82 | ... ELSE Should Contain ${status} off msg=Host is on. |