Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 2 | # not use this file except in compliance with the License. You may obtain |
| 3 | # a copy of the License at |
| 4 | # |
| 5 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | # |
| 7 | # Unless required by applicable law or agreed to in writing, software |
| 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 10 | # License for the specific language governing permissions and limitations |
| 11 | # under the License. |
| 12 | |
| 13 | from tempest.services.baremetal import base |
| 14 | |
| 15 | |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 16 | class BaremetalClient(base.BaremetalClient): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 17 | """Base Tempest REST client for Ironic API v1.""" |
Ken'ichi Ohmichi | 1f88ece | 2015-01-23 03:33:11 +0000 | [diff] [blame] | 18 | version = '1' |
| 19 | uri_prefix = 'v1' |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 20 | |
| 21 | @base.handle_errors |
Adam Gandelman | 0068261 | 2014-09-02 17:10:36 -0700 | [diff] [blame] | 22 | def list_nodes(self, **kwargs): |
Lv Fumei | 2edbc3c | 2016-07-08 14:36:25 +0800 | [diff] [blame] | 23 | """List all existing nodes. |
| 24 | |
| 25 | Available params: see http://developer.openstack.org/api-ref/ |
| 26 | baremetal/index.html#list-nodes |
| 27 | """ |
Adam Gandelman | 0068261 | 2014-09-02 17:10:36 -0700 | [diff] [blame] | 28 | return self._list_request('nodes', **kwargs) |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 29 | |
| 30 | @base.handle_errors |
| 31 | def list_chassis(self): |
| 32 | """List all existing chassis.""" |
| 33 | return self._list_request('chassis') |
| 34 | |
| 35 | @base.handle_errors |
Adam Gandelman | 0068261 | 2014-09-02 17:10:36 -0700 | [diff] [blame] | 36 | def list_chassis_nodes(self, chassis_uuid): |
| 37 | """List all nodes associated with a chassis.""" |
| 38 | return self._list_request('/chassis/%s/nodes' % chassis_uuid) |
| 39 | |
| 40 | @base.handle_errors |
Sergey Nikitin | 0d43eb5 | 2014-02-03 14:50:02 +0400 | [diff] [blame] | 41 | def list_ports(self, **kwargs): |
Lv Fumei | 2edbc3c | 2016-07-08 14:36:25 +0800 | [diff] [blame] | 42 | """List all existing ports. |
| 43 | |
| 44 | Available params: see http://developer.openstack.org/api-ref/ |
| 45 | baremetal/index.html?expanded=#list-ports |
| 46 | """ |
Sergey Nikitin | 0d43eb5 | 2014-02-03 14:50:02 +0400 | [diff] [blame] | 47 | return self._list_request('ports', **kwargs) |
| 48 | |
| 49 | @base.handle_errors |
Adam Gandelman | 0068261 | 2014-09-02 17:10:36 -0700 | [diff] [blame] | 50 | def list_node_ports(self, uuid): |
| 51 | """List all ports associated with the node.""" |
| 52 | return self._list_request('/nodes/%s/ports' % uuid) |
| 53 | |
| 54 | @base.handle_errors |
Mh Raies | fbe5451 | 2014-04-08 12:25:15 +0530 | [diff] [blame] | 55 | def list_nodestates(self, uuid): |
| 56 | """List all existing states.""" |
| 57 | return self._list_request('/nodes/%s/states' % uuid) |
| 58 | |
| 59 | @base.handle_errors |
Yuiko Takada | 3083fca | 2014-04-25 11:52:33 +0000 | [diff] [blame] | 60 | def list_ports_detail(self, **kwargs): |
Lv Fumei | 2edbc3c | 2016-07-08 14:36:25 +0800 | [diff] [blame] | 61 | """Details list all existing ports. |
| 62 | |
| 63 | Available params: see http://developer.openstack.org/api-ref/baremetal/ |
| 64 | index.html?expanded=#list-detailed-ports |
| 65 | """ |
Yuiko Takada | 3083fca | 2014-04-25 11:52:33 +0000 | [diff] [blame] | 66 | return self._list_request('/ports/detail', **kwargs) |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 67 | |
| 68 | @base.handle_errors |
Mh Raies | b71cb7f | 2014-03-28 10:51:31 +0530 | [diff] [blame] | 69 | def list_drivers(self): |
| 70 | """List all existing drivers.""" |
| 71 | return self._list_request('drivers') |
| 72 | |
| 73 | @base.handle_errors |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 74 | def show_node(self, uuid): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 75 | """Gets a specific node. |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 76 | |
| 77 | :param uuid: Unique identifier of the node in UUID format. |
| 78 | :return: Serialized node as a dictionary. |
| 79 | |
| 80 | """ |
| 81 | return self._show_request('nodes', uuid) |
| 82 | |
| 83 | @base.handle_errors |
Adam Gandelman | 0068261 | 2014-09-02 17:10:36 -0700 | [diff] [blame] | 84 | def show_node_by_instance_uuid(self, instance_uuid): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 85 | """Gets a node associated with given instance uuid. |
Adam Gandelman | 0068261 | 2014-09-02 17:10:36 -0700 | [diff] [blame] | 86 | |
| 87 | :param uuid: Unique identifier of the node in UUID format. |
| 88 | :return: Serialized node as a dictionary. |
| 89 | |
| 90 | """ |
| 91 | uri = '/nodes/detail?instance_uuid=%s' % instance_uuid |
| 92 | |
| 93 | return self._show_request('nodes', |
| 94 | uuid=None, |
| 95 | uri=uri) |
| 96 | |
| 97 | @base.handle_errors |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 98 | def show_chassis(self, uuid): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 99 | """Gets a specific chassis. |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 100 | |
| 101 | :param uuid: Unique identifier of the chassis in UUID format. |
| 102 | :return: Serialized chassis as a dictionary. |
| 103 | |
| 104 | """ |
| 105 | return self._show_request('chassis', uuid) |
| 106 | |
| 107 | @base.handle_errors |
| 108 | def show_port(self, uuid): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 109 | """Gets a specific port. |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 110 | |
| 111 | :param uuid: Unique identifier of the port in UUID format. |
| 112 | :return: Serialized port as a dictionary. |
| 113 | |
| 114 | """ |
| 115 | return self._show_request('ports', uuid) |
| 116 | |
Kan | 3fd5d89 | 2015-01-26 01:36:01 -0800 | [diff] [blame] | 117 | @base.handle_errors |
| 118 | def show_port_by_address(self, address): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 119 | """Gets a specific port by address. |
Kan | 3fd5d89 | 2015-01-26 01:36:01 -0800 | [diff] [blame] | 120 | |
| 121 | :param address: MAC address of the port. |
| 122 | :return: Serialized port as a dictionary. |
| 123 | |
| 124 | """ |
| 125 | uri = '/ports/detail?address=%s' % address |
| 126 | |
| 127 | return self._show_request('ports', uuid=None, uri=uri) |
| 128 | |
Yuiko Takada | 8e2dfca | 2014-04-24 18:10:52 +0000 | [diff] [blame] | 129 | def show_driver(self, driver_name): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 130 | """Gets a specific driver. |
Yuiko Takada | 8e2dfca | 2014-04-24 18:10:52 +0000 | [diff] [blame] | 131 | |
| 132 | :param driver_name: Name of driver. |
| 133 | :return: Serialized driver as a dictionary. |
| 134 | """ |
| 135 | return self._show_request('drivers', driver_name) |
| 136 | |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 137 | @base.handle_errors |
Adam Gandelman | 118cd39 | 2015-03-09 14:41:36 -0700 | [diff] [blame] | 138 | def create_node(self, chassis_id=None, **kwargs): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 139 | """Create a baremetal node with the specified parameters. |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 140 | |
| 141 | :param cpu_arch: CPU architecture of the node. Default: x86_64. |
Adam Gandelman | 3ea1eb8 | 2015-02-18 19:13:25 -0800 | [diff] [blame] | 142 | :param cpus: Number of CPUs. Default: 8. |
| 143 | :param local_gb: Disk size. Default: 1024. |
| 144 | :param memory_mb: Available RAM. Default: 4096. |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 145 | :param driver: Driver name. Default: "fake" |
| 146 | :return: A tuple with the server response and the created node. |
| 147 | |
| 148 | """ |
| 149 | node = {'chassis_uuid': chassis_id, |
| 150 | 'properties': {'cpu_arch': kwargs.get('cpu_arch', 'x86_64'), |
Adam Gandelman | 3ea1eb8 | 2015-02-18 19:13:25 -0800 | [diff] [blame] | 151 | 'cpus': kwargs.get('cpus', 8), |
| 152 | 'local_gb': kwargs.get('local_gb', 1024), |
| 153 | 'memory_mb': kwargs.get('memory_mb', 4096)}, |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 154 | 'driver': kwargs.get('driver', 'fake')} |
| 155 | |
Ken'ichi Ohmichi | 19b6ff5 | 2015-01-23 02:45:50 +0000 | [diff] [blame] | 156 | return self._create_request('nodes', node) |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 157 | |
| 158 | @base.handle_errors |
| 159 | def create_chassis(self, **kwargs): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 160 | """Create a chassis with the specified parameters. |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 161 | |
| 162 | :param description: The description of the chassis. |
| 163 | Default: test-chassis |
| 164 | :return: A tuple with the server response and the created chassis. |
| 165 | |
| 166 | """ |
| 167 | chassis = {'description': kwargs.get('description', 'test-chassis')} |
| 168 | |
Ken'ichi Ohmichi | 19b6ff5 | 2015-01-23 02:45:50 +0000 | [diff] [blame] | 169 | return self._create_request('chassis', chassis) |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 170 | |
| 171 | @base.handle_errors |
| 172 | def create_port(self, node_id, **kwargs): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 173 | """Create a port with the specified parameters. |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 174 | |
| 175 | :param node_id: The ID of the node which owns the port. |
Sergey Nikitin | 0d43eb5 | 2014-02-03 14:50:02 +0400 | [diff] [blame] | 176 | :param address: MAC address of the port. |
| 177 | :param extra: Meta data of the port. Default: {'foo': 'bar'}. |
| 178 | :param uuid: UUID of the port. |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 179 | :return: A tuple with the server response and the created port. |
| 180 | |
| 181 | """ |
Sergey Nikitin | 0d43eb5 | 2014-02-03 14:50:02 +0400 | [diff] [blame] | 182 | port = {'extra': kwargs.get('extra', {'foo': 'bar'}), |
| 183 | 'uuid': kwargs['uuid']} |
| 184 | |
| 185 | if node_id is not None: |
| 186 | port['node_uuid'] = node_id |
| 187 | |
| 188 | if kwargs['address'] is not None: |
| 189 | port['address'] = kwargs['address'] |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 190 | |
Ken'ichi Ohmichi | 19b6ff5 | 2015-01-23 02:45:50 +0000 | [diff] [blame] | 191 | return self._create_request('ports', port) |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 192 | |
| 193 | @base.handle_errors |
| 194 | def delete_node(self, uuid): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 195 | """Deletes a node having the specified UUID. |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 196 | |
| 197 | :param uuid: The unique identifier of the node. |
| 198 | :return: A tuple with the server response and the response body. |
| 199 | |
| 200 | """ |
| 201 | return self._delete_request('nodes', uuid) |
| 202 | |
| 203 | @base.handle_errors |
| 204 | def delete_chassis(self, uuid): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 205 | """Deletes a chassis having the specified UUID. |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 206 | |
| 207 | :param uuid: The unique identifier of the chassis. |
| 208 | :return: A tuple with the server response and the response body. |
| 209 | |
| 210 | """ |
| 211 | return self._delete_request('chassis', uuid) |
| 212 | |
| 213 | @base.handle_errors |
| 214 | def delete_port(self, uuid): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 215 | """Deletes a port having the specified UUID. |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 216 | |
| 217 | :param uuid: The unique identifier of the port. |
| 218 | :return: A tuple with the server response and the response body. |
| 219 | |
| 220 | """ |
| 221 | return self._delete_request('ports', uuid) |
| 222 | |
| 223 | @base.handle_errors |
| 224 | def update_node(self, uuid, **kwargs): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 225 | """Update the specified node. |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 226 | |
| 227 | :param uuid: The unique identifier of the node. |
| 228 | :return: A tuple with the server response and the updated node. |
| 229 | |
| 230 | """ |
| 231 | node_attributes = ('properties/cpu_arch', |
Adam Gandelman | 3ea1eb8 | 2015-02-18 19:13:25 -0800 | [diff] [blame] | 232 | 'properties/cpus', |
| 233 | 'properties/local_gb', |
| 234 | 'properties/memory_mb', |
Adam Gandelman | 0068261 | 2014-09-02 17:10:36 -0700 | [diff] [blame] | 235 | 'driver', |
| 236 | 'instance_uuid') |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 237 | |
| 238 | patch = self._make_patch(node_attributes, **kwargs) |
| 239 | |
| 240 | return self._patch_request('nodes', uuid, patch) |
| 241 | |
| 242 | @base.handle_errors |
| 243 | def update_chassis(self, uuid, **kwargs): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 244 | """Update the specified chassis. |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 245 | |
| 246 | :param uuid: The unique identifier of the chassis. |
| 247 | :return: A tuple with the server response and the updated chassis. |
| 248 | |
| 249 | """ |
| 250 | chassis_attributes = ('description',) |
| 251 | patch = self._make_patch(chassis_attributes, **kwargs) |
| 252 | |
| 253 | return self._patch_request('chassis', uuid, patch) |
| 254 | |
| 255 | @base.handle_errors |
Sergey Nikitin | 0d43eb5 | 2014-02-03 14:50:02 +0400 | [diff] [blame] | 256 | def update_port(self, uuid, patch): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 257 | """Update the specified port. |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 258 | |
| 259 | :param uuid: The unique identifier of the port. |
Sergey Nikitin | 0d43eb5 | 2014-02-03 14:50:02 +0400 | [diff] [blame] | 260 | :param patch: List of dicts representing json patches. |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 261 | :return: A tuple with the server response and the updated port. |
| 262 | |
| 263 | """ |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 264 | |
| 265 | return self._patch_request('ports', uuid, patch) |
Mh Raies | f8ecf23 | 2014-04-17 12:43:55 +0530 | [diff] [blame] | 266 | |
| 267 | @base.handle_errors |
| 268 | def set_node_power_state(self, node_uuid, state): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 269 | """Set power state of the specified node. |
Mh Raies | f8ecf23 | 2014-04-17 12:43:55 +0530 | [diff] [blame] | 270 | |
| 271 | :param node_uuid: The unique identifier of the node. |
| 272 | :state: desired state to set (on/off/reboot). |
| 273 | |
| 274 | """ |
| 275 | target = {'target': state} |
| 276 | return self._put_request('nodes/%s/states/power' % node_uuid, |
| 277 | target) |
raiesmh08 | e5d8457 | 2014-06-23 09:49:03 +0530 | [diff] [blame] | 278 | |
| 279 | @base.handle_errors |
| 280 | def validate_driver_interface(self, node_uuid): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 281 | """Get all driver interfaces of a specific node. |
raiesmh08 | e5d8457 | 2014-06-23 09:49:03 +0530 | [diff] [blame] | 282 | |
| 283 | :param uuid: Unique identifier of the node in UUID format. |
| 284 | |
| 285 | """ |
| 286 | |
| 287 | uri = '{pref}/{res}/{uuid}/{postf}'.format(pref=self.uri_prefix, |
| 288 | res='nodes', |
| 289 | uuid=node_uuid, |
| 290 | postf='validate') |
| 291 | |
| 292 | return self._show_request('nodes', node_uuid, uri=uri) |
Lucas Alvares Gomes | 5d236cf | 2014-08-11 15:23:12 +0100 | [diff] [blame] | 293 | |
| 294 | @base.handle_errors |
| 295 | def set_node_boot_device(self, node_uuid, boot_device, persistent=False): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 296 | """Set the boot device of the specified node. |
Lucas Alvares Gomes | 5d236cf | 2014-08-11 15:23:12 +0100 | [diff] [blame] | 297 | |
| 298 | :param node_uuid: The unique identifier of the node. |
| 299 | :param boot_device: The boot device name. |
| 300 | :param persistent: Boolean value. True if the boot device will |
| 301 | persist to all future boots, False if not. |
| 302 | Default: False. |
| 303 | |
| 304 | """ |
| 305 | request = {'boot_device': boot_device, 'persistent': persistent} |
| 306 | resp, body = self._put_request('nodes/%s/management/boot_device' % |
| 307 | node_uuid, request) |
| 308 | self.expected_success(204, resp.status) |
| 309 | return body |
| 310 | |
| 311 | @base.handle_errors |
| 312 | def get_node_boot_device(self, node_uuid): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 313 | """Get the current boot device of the specified node. |
Lucas Alvares Gomes | 5d236cf | 2014-08-11 15:23:12 +0100 | [diff] [blame] | 314 | |
| 315 | :param node_uuid: The unique identifier of the node. |
| 316 | |
| 317 | """ |
| 318 | path = 'nodes/%s/management/boot_device' % node_uuid |
| 319 | resp, body = self._list_request(path) |
| 320 | self.expected_success(200, resp.status) |
| 321 | return body |
| 322 | |
| 323 | @base.handle_errors |
| 324 | def get_node_supported_boot_devices(self, node_uuid): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 325 | """Get the supported boot devices of the specified node. |
Lucas Alvares Gomes | 5d236cf | 2014-08-11 15:23:12 +0100 | [diff] [blame] | 326 | |
| 327 | :param node_uuid: The unique identifier of the node. |
| 328 | |
| 329 | """ |
| 330 | path = 'nodes/%s/management/boot_device/supported' % node_uuid |
| 331 | resp, body = self._list_request(path) |
| 332 | self.expected_success(200, resp.status) |
| 333 | return body |
Yuiko Takada | bbf5cff | 2014-08-29 17:09:06 +0900 | [diff] [blame] | 334 | |
| 335 | @base.handle_errors |
| 336 | def get_console(self, node_uuid): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 337 | """Get connection information about the console. |
Yuiko Takada | bbf5cff | 2014-08-29 17:09:06 +0900 | [diff] [blame] | 338 | |
| 339 | :param node_uuid: Unique identifier of the node in UUID format. |
| 340 | |
| 341 | """ |
| 342 | |
| 343 | resp, body = self._show_request('nodes/states/console', node_uuid) |
| 344 | self.expected_success(200, resp.status) |
| 345 | return resp, body |
| 346 | |
| 347 | @base.handle_errors |
| 348 | def set_console_mode(self, node_uuid, enabled): |
Ken'ichi Ohmichi | b279084 | 2015-11-17 11:46:13 +0000 | [diff] [blame] | 349 | """Start and stop the node console. |
Yuiko Takada | bbf5cff | 2014-08-29 17:09:06 +0900 | [diff] [blame] | 350 | |
| 351 | :param node_uuid: Unique identifier of the node in UUID format. |
| 352 | :param enabled: Boolean value; whether to enable or disable the |
| 353 | console. |
| 354 | |
| 355 | """ |
| 356 | |
| 357 | enabled = {'enabled': enabled} |
| 358 | resp, body = self._put_request('nodes/%s/states/console' % node_uuid, |
| 359 | enabled) |
| 360 | self.expected_success(202, resp.status) |
| 361 | return resp, body |