blob: 7acd9407c0db5a29fb2bd0b5248927a3016f297b [file] [log] [blame]
Nayna Pateld0b02ae2013-09-04 10:09:08 +00001# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
3# Copyright 2013 OpenStack, Foundation
4# All Rights Reserved.
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17
18
19from tempest.api.network import base
20from tempest.test import attr
21
22
23class ExtensionsTestJSON(base.BaseNetworkTest):
24 _interface = 'json'
25
26 """
27 Tests the following operations in the Neutron API using the REST client for
28 Neutron:
29
30 List all available extensions
31
32 v2.0 of the Neutron API is assumed. It is also assumed that the following
33 options are defined in the [network] section of etc/tempest.conf:
34
35 """
36
37 @classmethod
38 def setUpClass(cls):
39 super(ExtensionsTestJSON, cls).setUpClass()
40
41 @attr(type='smoke')
42 def test_list_show_extensions(self):
43 # List available extensions for the tenant
44 expected_alias = ['security-group', 'l3_agent_scheduler',
45 'ext-gw-mode', 'binding', 'quotas',
46 'agent', 'dhcp_agent_scheduler', 'provider',
47 'router', 'extraroute', 'external-net',
48 'allowed-address-pairs', 'extra_dhcp_opt']
49 actual_alias = list()
50 resp, extensions = self.client.list_extensions()
51 self.assertEqual('200', resp['status'])
52 list_extensions = extensions['extensions']
53 # Show and verify the details of the available extensions
54 for ext in list_extensions:
55 ext_name = ext['name']
56 ext_alias = ext['alias']
57 actual_alias.append(ext['alias'])
Eugene Nikanorov909ded12013-12-15 17:45:37 +040058 resp, ext_details = self.client.show_extension(ext_alias)
Nayna Pateld0b02ae2013-09-04 10:09:08 +000059 self.assertEqual('200', resp['status'])
60 ext_details = ext_details['extension']
61
62 self.assertIsNotNone(ext_details)
63 self.assertIn('updated', ext_details.keys())
64 self.assertIn('name', ext_details.keys())
65 self.assertIn('description', ext_details.keys())
66 self.assertIn('namespace', ext_details.keys())
67 self.assertIn('links', ext_details.keys())
68 self.assertIn('alias', ext_details.keys())
69 self.assertEqual(ext_details['name'], ext_name)
70 self.assertEqual(ext_details['alias'], ext_alias)
71 self.assertEqual(ext_details, ext)
72 # Verify if expected extensions are present in the actual list
73 # of extensions returned
74 for e in expected_alias:
75 self.assertIn(e, actual_alias)
76
77
78class ExtensionsTestXML(ExtensionsTestJSON):
79 _interface = 'xml'