blob: b83d2b08bc16e41940356ff174ee7757da067803 [file] [log] [blame]
Nayna Pateld0b02ae2013-09-04 10:09:08 +00001# Copyright 2013 OpenStack, Foundation
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.network import base
armando-migliaccio328d45d2013-12-13 13:46:20 -080018from tempest import test
Nayna Pateld0b02ae2013-09-04 10:09:08 +000019
20
21class ExtensionsTestJSON(base.BaseNetworkTest):
Ken'ichi Ohmichie03bea92015-11-19 07:45:58 +000022 """Tests the following operations in the Neutron API:
Nayna Pateld0b02ae2013-09-04 10:09:08 +000023
24 List all available extensions
25
26 v2.0 of the Neutron API is assumed. It is also assumed that the following
27 options are defined in the [network] section of etc/tempest.conf:
28
29 """
30
armando-migliaccio328d45d2013-12-13 13:46:20 -080031 @test.attr(type='smoke')
Chris Hoge7579c1a2015-02-26 14:12:15 -080032 @test.idempotent_id('ef28c7e6-e646-4979-9d67-deb207bc5564')
Nayna Pateld0b02ae2013-09-04 10:09:08 +000033 def test_list_show_extensions(self):
34 # List available extensions for the tenant
35 expected_alias = ['security-group', 'l3_agent_scheduler',
36 'ext-gw-mode', 'binding', 'quotas',
37 'agent', 'dhcp_agent_scheduler', 'provider',
38 'router', 'extraroute', 'external-net',
Takeaki Matsumotoabeb07f2015-08-11 20:52:53 +090039 'allowed-address-pairs', 'extra_dhcp_opt',
Sean Dague42b9e872015-09-02 06:31:54 -040040 'metering', 'dvr']
Yoshihiro Kaneko05670262014-01-18 19:22:44 +090041 expected_alias = [ext for ext in expected_alias if
42 test.is_extension_enabled(ext, 'network')]
Nayna Pateld0b02ae2013-09-04 10:09:08 +000043 actual_alias = list()
David Kranz34e88122014-12-11 15:24:05 -050044 extensions = self.client.list_extensions()
Nayna Pateld0b02ae2013-09-04 10:09:08 +000045 list_extensions = extensions['extensions']
46 # Show and verify the details of the available extensions
47 for ext in list_extensions:
48 ext_name = ext['name']
49 ext_alias = ext['alias']
50 actual_alias.append(ext['alias'])
David Kranz34e88122014-12-11 15:24:05 -050051 ext_details = self.client.show_extension(ext_alias)
Nayna Pateld0b02ae2013-09-04 10:09:08 +000052 ext_details = ext_details['extension']
53
54 self.assertIsNotNone(ext_details)
55 self.assertIn('updated', ext_details.keys())
56 self.assertIn('name', ext_details.keys())
57 self.assertIn('description', ext_details.keys())
Nayna Pateld0b02ae2013-09-04 10:09:08 +000058 self.assertIn('links', ext_details.keys())
59 self.assertIn('alias', ext_details.keys())
60 self.assertEqual(ext_details['name'], ext_name)
61 self.assertEqual(ext_details['alias'], ext_alias)
62 self.assertEqual(ext_details, ext)
63 # Verify if expected extensions are present in the actual list
armando-migliaccio328d45d2013-12-13 13:46:20 -080064 # of extensions returned, but only for those that have been
65 # enabled via configuration
Nayna Pateld0b02ae2013-09-04 10:09:08 +000066 for e in expected_alias:
armando-migliaccio328d45d2013-12-13 13:46:20 -080067 if test.is_extension_enabled(e, 'network'):
68 self.assertIn(e, actual_alias)