blob: ce019a2d0a57b414bc18d4fc7312e78c2d17bd4b [file] [log] [blame]
Matthew Treinish2324e6b2013-10-21 20:25:17 +00001# Copyright 2013 IBM Corp.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16
17from tempest.api.volume import base
Matthew Treinish4d352bc2014-01-29 18:29:18 +000018from tempest import config
Christian Schwede1acc63a2013-12-27 15:21:32 +000019from tempest.openstack.common import log as logging
Masayuki Igawa1edf94f2014-03-04 18:34:16 +090020from tempest import test
Matthew Treinish2324e6b2013-10-21 20:25:17 +000021
Matthew Treinish4d352bc2014-01-29 18:29:18 +000022CONF = config.CONF
23
Matthew Treinish2324e6b2013-10-21 20:25:17 +000024
Christian Schwede1acc63a2013-12-27 15:21:32 +000025LOG = logging.getLogger(__name__)
26
27
Zhi Kun Liu02a99062014-01-02 19:00:08 +080028class ExtensionsTestJSON(base.BaseVolumeV1Test):
Matthew Treinish2324e6b2013-10-21 20:25:17 +000029 _interface = 'json'
30
Masayuki Igawa1edf94f2014-03-04 18:34:16 +090031 @test.attr(type='gate')
Matthew Treinish2324e6b2013-10-21 20:25:17 +000032 def test_list_extensions(self):
33 # List of all extensions
34 resp, extensions = self.volumes_extension_client.list_extensions()
35 self.assertEqual(200, resp.status)
Matthew Treinish4d352bc2014-01-29 18:29:18 +000036 if len(CONF.volume_feature_enabled.api_extensions) == 0:
Matthew Treinish2324e6b2013-10-21 20:25:17 +000037 raise self.skipException('There are not any extensions configured')
Christian Schwede1acc63a2013-12-27 15:21:32 +000038 extension_list = [extension.get('alias') for extension in extensions]
39 LOG.debug("Cinder extensions: %s" % ','.join(extension_list))
Matthew Treinish4d352bc2014-01-29 18:29:18 +000040 ext = CONF.volume_feature_enabled.api_extensions[0]
Matthew Treinish2324e6b2013-10-21 20:25:17 +000041 if ext == 'all':
42 self.assertIn('Hosts', map(lambda x: x['name'], extensions))
43 elif ext:
44 self.assertIn(ext, map(lambda x: x['name'], extensions))
45 else:
46 raise self.skipException('There are not any extensions configured')
47
48
49class ExtensionsTestXML(ExtensionsTestJSON):
50 _interface = 'xml'