blob: 032d526b0581ed29cb4725ff49d8feba45f293b5 [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
Rahul Maheshwari99c092f2017-07-31 02:32:14 -050023
24Execute Command On XCAT
25 [Documentation] Execute command using XCAT.
26 [Arguments] ${command} ${command_option}=${EMPTY}
27 ... ${node}=${OPENBMC_HOST}
28
29 # Description of argument(s):
30 # command Command to be run(e.g. "rinv").
31 # command_option Command's option to be run(e.g. "dimm").
32 # node Name of the node(e.g. "node1").
33
34 ${xcat_cmd}= Catenate SEPARATOR=
35 ... ${XCAT_DIR_PATH}/${command} ${node} ${command_option}
36 ${stdout} ${stderr}= Execute Command ${xcat_cmd} return_stderr=True
37 Should Be Empty ${stderr}
38
39 [Return] ${stdout}
40
41
Prashanth Katti1dcd5392017-05-12 04:35:53 -050042Get List Of BMC Nodes
43 [Documentation] Get list of BMC nodes.
44 [Arguments] ${node_cfg_file_path}=${NODE_CFG_FILE_PATH}
45
46 # Get the list of BMC nodes to be added.
47 # This keyword expects file having list of BMC nodes
48 # as an input.
49 # File should have IP addresses of BMC nodes.
50
51 OperatingSystem.File Should Exist ${node_cfg_file_path} msg=cfg file missing.
52 File Should Not Be Empty ${node_cfg_file_path} msg=Empty config file.
53
54 ${bmc_list} = OperatingSystem.Get File ${node_cfg_file_path}
55 [Return] ${bmc_list}
Prashanth Katti477debc2017-05-19 03:01:04 -050056
57Add Nodes To XCAT
58 [Documentation] Add nodes to XCAT configuration.
59 [Arguments] ${node} ${username}=${OPENBMC_USERNAME}
60 ... ${password}=${OPENBMC_PASSWORD}
61
62 # Description of the argument(s):
63 # node Name of the node to be added.
64
65 ${cmd_buf}= Catenate ${XCAT_DIR_PATH}/mkdef ${node} bmc=${node}
66 ... bmcusername=${username} bmcpassword=${password} mgt=openbmc groups=all
67 Execute Command ${cmd_buf}
68
69Validate Added Node
70 [Documentation] Validate added node.
71 [Arguments] ${node}
72
73 # Description of the argument(s):
74 # node Name of the node.
75
76 ${stdout} ${stderr}= Execute Command ${XCAT_DIR_PATH}/nodels
77 ... return_stderr=True
78 Should Be Empty ${stderr}
79 Should Contain ${std_out} ${node} msg=Node is not added.
80
81Power On Via XCAT
82 [Documentation] Power on via XCAT.
83 [Arguments] ${node}
84
85 # Description of the argument(s):
86 # node Name of the node.
87
88 ${stdout} ${stderr}= Execute Command ${XCAT_DIR_PATH}/rpower ${node} on
89 ... return_stderr=True
90 Should Be Empty ${stderr}
91
92Power Off Via XCAT
93 [Documentation] Power off via XCAT.
94 [Arguments] ${node}
95
96 # Description of the argument(s):
97 # node Name of the node.
98
99 ${stdout} ${stderr}= Execute Command ${XCAT_DIR_PATH}/rpower ${node} off
100 ... return_stderr=True
101 Should Be Empty ${stderr}
102
103Get Power Status
104 [Documentation] Get power status via XCAT.
105 [Arguments] ${node}
106
107 # Description of the argument(s):
108 # node Name of the node.
109
110 ${stdout} ${stderr}= Execute Command
111 ... ${XCAT_DIR_PATH}/rpower ${node} state return_stderr=True
112 Should Be Empty ${stderr}
113
114 [Return] ${stdout}
Prashanth Kattib974a742017-05-25 06:52:29 -0500115
116Add Nodes To Group
117 [Documentation] Add BMC nodes to group.
118 [Arguments] ${node} ${group}=${GROUP}
119
120 # Description of argument(s):
121 # node Name of the node (e.g. "node1").
122 # group Name of the group (e.g. "openbmc").
123
124 ${stdout} ${stderr}= Execute Command
125 ... ${XCAT_DIR_PATH}/chdef ${node} groups=${group} return_stderr=True
126 Should Be Empty ${stderr}
127
128Get List Of Nodes In Group
129 [Documentation] Get list of nodes in BMC.
130 [Arguments] ${group}=${GROUP}
131
132 # Description of argument(s):
133 # group Name of the group (e.g. "openbmc").
134
135 # Sample output of this keyword:
136 # XXX.XXX.XXX.XXX
137 # YYY.YYY.YYY.YYY
138 # ZZZ.ZZZ.ZZZ.ZZZ
139
140 ${stdout} ${stderr}= Execute Command
141 ... ${XCAT_DIR_PATH}/nodels ${group} return_stderr=True
142 Should Be Empty ${stderr}
143
144 [Return] ${stdout}
145
146Validate Node Added In Group
147 [Documentation] Validate whether node is added in group.
148 [Arguments] ${node} ${group}
149
150 # Description of argument(s):
151 # node Name of the node (e.g. "node1").
152 # group Name of the group (e.g. "openbmc").
153
154 ${nodes_in_group}= Get List Of Nodes In Group ${group}
155 Should Contain ${nodes_in_group} ${node}
156 ... msg=BMC node is not added in a group.
157
Prashanth Katti56cbd172017-07-07 05:38:12 -0500158Get Hardware Vitals Via XCAT
159 [Documentation] Get hardware vitals via XCAT.
160 [Arguments] ${node} ${option}
161
162 # Description of argument(s):
163 # node Name of the node (e.g. "node1").
164 # option Hardware vitals option (e.g. "temp", "voltage", "fanspeed", etc.).
165
166 ${cmd_buf}= Catenate ${XCAT_DIR_PATH}/rvitals ${node} ${option}
167 ${stdout} ${stderr}= Execute Command ${cmd_buf} return_stderr=True
168 Should Be Empty ${stderr}
169
170 [Return] ${stdout}