Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Resource ../xcat/resource.txt |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 4 | Resource ../../lib/resource.txt |
Prashanth Katti | 1dcd539 | 2017-05-12 04:35:53 -0500 | [diff] [blame] | 5 | |
| 6 | Library SSHLibrary |
| 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 | *** Keywords *** |
| 11 | |
| 12 | Open Connection And Login To XCAT |
| 13 | [Documentation] Open connection and login to xCAT server. |
| 14 | [Arguments] ${xcat_host}=${XCAT_HOST} ${xcat_port}=${XCAT_PORT} |
| 15 | |
| 16 | # Description of argument(s): |
| 17 | # xcat_host IP address of the XCAT server. |
| 18 | # xcat_port Network port on which XCAT server accepts ssh session. |
| 19 | |
| 20 | Open Connection ${xcat_host} port=${xcat_port} |
| 21 | Login ${XCAT_USERNAME} ${XCAT_PASSWORD} |
| 22 | |
| 23 | Get List Of BMC Nodes |
| 24 | [Documentation] Get list of BMC nodes. |
| 25 | [Arguments] ${node_cfg_file_path}=${NODE_CFG_FILE_PATH} |
| 26 | |
| 27 | # Get the list of BMC nodes to be added. |
| 28 | # This keyword expects file having list of BMC nodes |
| 29 | # as an input. |
| 30 | # File should have IP addresses of BMC nodes. |
| 31 | |
| 32 | OperatingSystem.File Should Exist ${node_cfg_file_path} msg=cfg file missing. |
| 33 | File Should Not Be Empty ${node_cfg_file_path} msg=Empty config file. |
| 34 | |
| 35 | ${bmc_list} = OperatingSystem.Get File ${node_cfg_file_path} |
| 36 | [Return] ${bmc_list} |
Prashanth Katti | 477debc | 2017-05-19 03:01:04 -0500 | [diff] [blame] | 37 | |
| 38 | Add Nodes To XCAT |
| 39 | [Documentation] Add nodes to XCAT configuration. |
| 40 | [Arguments] ${node} ${username}=${OPENBMC_USERNAME} |
| 41 | ... ${password}=${OPENBMC_PASSWORD} |
| 42 | |
| 43 | # Description of the argument(s): |
| 44 | # node Name of the node to be added. |
| 45 | |
| 46 | ${cmd_buf}= Catenate ${XCAT_DIR_PATH}/mkdef ${node} bmc=${node} |
| 47 | ... bmcusername=${username} bmcpassword=${password} mgt=openbmc groups=all |
| 48 | Execute Command ${cmd_buf} |
| 49 | |
| 50 | Validate Added Node |
| 51 | [Documentation] Validate added node. |
| 52 | [Arguments] ${node} |
| 53 | |
| 54 | # Description of the argument(s): |
| 55 | # node Name of the node. |
| 56 | |
| 57 | ${stdout} ${stderr}= Execute Command ${XCAT_DIR_PATH}/nodels |
| 58 | ... return_stderr=True |
| 59 | Should Be Empty ${stderr} |
| 60 | Should Contain ${std_out} ${node} msg=Node is not added. |
| 61 | |
| 62 | Power On Via XCAT |
| 63 | [Documentation] Power on via XCAT. |
| 64 | [Arguments] ${node} |
| 65 | |
| 66 | # Description of the argument(s): |
| 67 | # node Name of the node. |
| 68 | |
| 69 | ${stdout} ${stderr}= Execute Command ${XCAT_DIR_PATH}/rpower ${node} on |
| 70 | ... return_stderr=True |
| 71 | Should Be Empty ${stderr} |
| 72 | |
| 73 | Power Off Via XCAT |
| 74 | [Documentation] Power off via XCAT. |
| 75 | [Arguments] ${node} |
| 76 | |
| 77 | # Description of the argument(s): |
| 78 | # node Name of the node. |
| 79 | |
| 80 | ${stdout} ${stderr}= Execute Command ${XCAT_DIR_PATH}/rpower ${node} off |
| 81 | ... return_stderr=True |
| 82 | Should Be Empty ${stderr} |
| 83 | |
| 84 | Get Power Status |
| 85 | [Documentation] Get power status via XCAT. |
| 86 | [Arguments] ${node} |
| 87 | |
| 88 | # Description of the argument(s): |
| 89 | # node Name of the node. |
| 90 | |
| 91 | ${stdout} ${stderr}= Execute Command |
| 92 | ... ${XCAT_DIR_PATH}/rpower ${node} state return_stderr=True |
| 93 | Should Be Empty ${stderr} |
| 94 | |
| 95 | [Return] ${stdout} |
Prashanth Katti | b974a74 | 2017-05-25 06:52:29 -0500 | [diff] [blame] | 96 | |
| 97 | Add Nodes To Group |
| 98 | [Documentation] Add BMC nodes to group. |
| 99 | [Arguments] ${node} ${group}=${GROUP} |
| 100 | |
| 101 | # Description of argument(s): |
| 102 | # node Name of the node (e.g. "node1"). |
| 103 | # group Name of the group (e.g. "openbmc"). |
| 104 | |
| 105 | ${stdout} ${stderr}= Execute Command |
| 106 | ... ${XCAT_DIR_PATH}/chdef ${node} groups=${group} return_stderr=True |
| 107 | Should Be Empty ${stderr} |
| 108 | |
| 109 | Get List Of Nodes In Group |
| 110 | [Documentation] Get list of nodes in BMC. |
| 111 | [Arguments] ${group}=${GROUP} |
| 112 | |
| 113 | # Description of argument(s): |
| 114 | # group Name of the group (e.g. "openbmc"). |
| 115 | |
| 116 | # Sample output of this keyword: |
| 117 | # XXX.XXX.XXX.XXX |
| 118 | # YYY.YYY.YYY.YYY |
| 119 | # ZZZ.ZZZ.ZZZ.ZZZ |
| 120 | |
| 121 | ${stdout} ${stderr}= Execute Command |
| 122 | ... ${XCAT_DIR_PATH}/nodels ${group} return_stderr=True |
| 123 | Should Be Empty ${stderr} |
| 124 | |
| 125 | [Return] ${stdout} |
| 126 | |
| 127 | Validate Node Added In Group |
| 128 | [Documentation] Validate whether node is added in group. |
| 129 | [Arguments] ${node} ${group} |
| 130 | |
| 131 | # Description of argument(s): |
| 132 | # node Name of the node (e.g. "node1"). |
| 133 | # group Name of the group (e.g. "openbmc"). |
| 134 | |
| 135 | ${nodes_in_group}= Get List Of Nodes In Group ${group} |
| 136 | Should Contain ${nodes_in_group} ${node} |
| 137 | ... msg=BMC node is not added in a group. |
| 138 | |
| 139 | # TBD openbmc/openbmc-test-automation/issues/647 |