blob: 1381f805d712472649765f15a2de49eb673942f4 [file] [log] [blame]
YuikoTakadaac0879a2015-01-22 02:40:03 +00001# Copyright 2015 NEC Corporation. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15from tempest.api.compute import base
16from tempest import config
17from tempest import test
18
19CONF = config.CONF
20
21
22class BaremetalNodesAdminTestJSON(base.BaseV2ComputeAdminTest):
23 """
24 Tests Baremetal API
25 """
26
27 @classmethod
28 def resource_setup(cls):
29 super(BaremetalNodesAdminTestJSON, cls).resource_setup()
30 if not CONF.service_available.ironic:
31 skip_msg = ('%s skipped as Ironic is not available' % cls.__name__)
32 raise cls.skipException(skip_msg)
33 cls.client = cls.os_adm.baremetal_nodes_client
34
35 @test.attr(type='smoke')
Chris Hoge7579c1a2015-02-26 14:12:15 -080036 @test.idempotent_id('e475aa6e-416d-4fa4-b3af-28d5e84250fb')
YuikoTakadaac0879a2015-01-22 02:40:03 +000037 def test_list_baremetal_nodes(self):
38 # List all baremetal nodes.
39 baremetal_nodes = self.client.list_baremetal_nodes()
40 self.assertNotEmpty(baremetal_nodes, "No baremetal nodes found.")
41
42 for node in baremetal_nodes:
43 baremetal_node = self.client.get_baremetal_node(node['id'])
44 self.assertEqual(node['id'], baremetal_node['id'])