blob: 9af70e4906036f22489f2944b45cb31b4d8ee634 [file] [log] [blame]
Prashanth Katti1dcd5392017-05-12 04:35:53 -05001*** Settings ***
2
3Resource ../xcat/resource.txt
Prashanth Katti477debc2017-05-19 03:01:04 -05004Resource ../../lib/resource.txt
Prashanth Katti1dcd5392017-05-12 04:35:53 -05005
6Library SSHLibrary
7Library OperatingSystem
Prashanth Katti477debc2017-05-19 03:01:04 -05008Library String
Prashanth Katti1dcd5392017-05-12 04:35:53 -05009
10*** Keywords ***
11
12Open 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
23Get 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 Katti477debc2017-05-19 03:01:04 -050037
38Add 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
50Validate 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
62Power 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
73Power 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
84Get 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}