blob: 9bac7a6668857d5a74bf6b847520196be95e6deb [file] [log] [blame]
Joe Gordonc97f5c72013-02-14 01:15:57 +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
Joe Gordonc97f5c72013-02-14 01:15:57 +000016import testtools
17
Joe Gordon7a2cf012014-07-18 11:34:39 +020018from tempest import cli
Matthew Treinishe2b56b52014-01-29 19:25:50 +000019from tempest import config
Matthew Treinishaeb52742014-07-25 18:38:56 -040020from tempest import exceptions
Matthew Treinishf4a9b0f2013-07-26 16:58:26 -040021from tempest.openstack.common import log as logging
Giulio Fidente386ac8f2013-10-07 14:29:27 +020022import tempest.test
Joe Gordonc97f5c72013-02-14 01:15:57 +000023
Matthew Treinishe2b56b52014-01-29 19:25:50 +000024CONF = config.CONF
Joe Gordonc97f5c72013-02-14 01:15:57 +000025
26LOG = logging.getLogger(__name__)
27
28
Joe Gordon7a2cf012014-07-18 11:34:39 +020029class SimpleReadOnlyNovaClientTest(cli.ClientTestBase):
Joe Gordonc97f5c72013-02-14 01:15:57 +000030
31 """
32 This is a first pass at a simple read only python-novaclient test. This
33 only exercises client commands that are read only.
34
35 This should test commands:
36 * as a regular user
37 * as a admin user
38 * with and without optional parameters
39 * initially just check return codes, and later test command outputs
40
41 """
42
Matthew Treinishd52645a2014-01-21 23:44:44 +000043 @classmethod
44 def setUpClass(cls):
45 if not CONF.service_available.nova:
46 msg = ("%s skipped as Nova is not available" % cls.__name__)
47 raise cls.skipException(msg)
48 super(SimpleReadOnlyNovaClientTest, cls).setUpClass()
49
Joe Gordonc97f5c72013-02-14 01:15:57 +000050 def test_admin_fake_action(self):
Matthew Treinishaeb52742014-07-25 18:38:56 -040051 self.assertRaises(exceptions.CommandFailed,
Joe Gordonc97f5c72013-02-14 01:15:57 +000052 self.nova,
53 'this-does-nova-exist')
54
Attila Fazekasc3a095b2013-08-17 09:15:44 +020055 # NOTE(jogo): Commands in order listed in 'nova help'
Joe Gordon34dc84d2013-02-21 02:19:23 +000056
57 # Positional arguments:
58
59 def test_admin_absolute_limites(self):
60 self.nova('absolute-limits')
Joe Gordon4edb6452013-03-05 21:18:59 +000061 self.nova('absolute-limits', params='--reserved')
Joe Gordon34dc84d2013-02-21 02:19:23 +000062
Joe Gordonc97f5c72013-02-14 01:15:57 +000063 def test_admin_aggregate_list(self):
64 self.nova('aggregate-list')
65
Joe Gordon34dc84d2013-02-21 02:19:23 +000066 def test_admin_availability_zone_list(self):
Joe Gordon4edb6452013-03-05 21:18:59 +000067 self.assertIn("internal", self.nova('availability-zone-list'))
Joe Gordon34dc84d2013-02-21 02:19:23 +000068
Joe Gordonc97f5c72013-02-14 01:15:57 +000069 def test_admin_cloudpipe_list(self):
70 self.nova('cloudpipe-list')
71
Joe Gordon34dc84d2013-02-21 02:19:23 +000072 def test_admin_credentials(self):
73 self.nova('credentials')
Joe Gordonc97f5c72013-02-14 01:15:57 +000074
Matthew Treinishfaa340d2013-07-19 16:26:21 -040075 @testtools.skipIf(CONF.service_available.neutron,
Ala Rezmerita15373b02013-07-19 15:45:10 +020076 "Neutron does not provide this feature")
Joe Gordonc97f5c72013-02-14 01:15:57 +000077 def test_admin_dns_domains(self):
78 self.nova('dns-domains')
79
Giulio Fidente386ac8f2013-10-07 14:29:27 +020080 @tempest.test.skip_because(bug="1157349")
Joe Gordon34dc84d2013-02-21 02:19:23 +000081 def test_admin_dns_list(self):
82 self.nova('dns-list')
83
84 def test_admin_endpoints(self):
85 self.nova('endpoints')
86
87 def test_admin_flavor_acces_list(self):
Matthew Treinishaeb52742014-07-25 18:38:56 -040088 self.assertRaises(exceptions.CommandFailed,
Joe Gordon34dc84d2013-02-21 02:19:23 +000089 self.nova,
90 'flavor-access-list')
91 # Failed to get access list for public flavor type
Matthew Treinishaeb52742014-07-25 18:38:56 -040092 self.assertRaises(exceptions.CommandFailed,
Joe Gordon34dc84d2013-02-21 02:19:23 +000093 self.nova,
94 'flavor-access-list',
95 params='--flavor m1.tiny')
96
Joe Gordonc97f5c72013-02-14 01:15:57 +000097 def test_admin_flavor_list(self):
Joe Gordon4edb6452013-03-05 21:18:59 +000098 self.assertIn("Memory_MB", self.nova('flavor-list'))
Joe Gordonc97f5c72013-02-14 01:15:57 +000099
Joe Gordon34dc84d2013-02-21 02:19:23 +0000100 def test_admin_floating_ip_bulk_list(self):
101 self.nova('floating-ip-bulk-list')
102
103 def test_admin_floating_ip_list(self):
104 self.nova('floating-ip-list')
105
106 def test_admin_floating_ip_pool_list(self):
107 self.nova('floating-ip-pool-list')
108
109 def test_admin_host_list(self):
110 self.nova('host-list')
111
112 def test_admin_hypervisor_list(self):
113 self.nova('hypervisor-list')
114
115 def test_admin_image_list(self):
116 self.nova('image-list')
117
Giulio Fidente386ac8f2013-10-07 14:29:27 +0200118 @tempest.test.skip_because(bug="1157349")
Joe Gordon34dc84d2013-02-21 02:19:23 +0000119 def test_admin_interface_list(self):
120 self.nova('interface-list')
121
122 def test_admin_keypair_list(self):
123 self.nova('keypair-list')
124
125 def test_admin_list(self):
126 self.nova('list')
127 self.nova('list', params='--all-tenants 1')
128 self.nova('list', params='--all-tenants 0')
Matthew Treinishaeb52742014-07-25 18:38:56 -0400129 self.assertRaises(exceptions.CommandFailed,
Joe Gordon34dc84d2013-02-21 02:19:23 +0000130 self.nova,
131 'list',
132 params='--all-tenants bad')
133
134 def test_admin_network_list(self):
135 self.nova('network-list')
136
137 def test_admin_rate_limits(self):
138 self.nova('rate-limits')
139
140 def test_admin_secgroup_list(self):
141 self.nova('secgroup-list')
142
Giulio Fidente386ac8f2013-10-07 14:29:27 +0200143 @tempest.test.skip_because(bug="1157349")
Joe Gordon34dc84d2013-02-21 02:19:23 +0000144 def test_admin_secgroup_list_rules(self):
145 self.nova('secgroup-list-rules')
146
Matt Riedemann27bdb052014-07-30 14:57:55 -0700147 @tempest.cli.min_client_version(client='nova', version='2.18')
Ajay Yadav75ecdfb2014-06-03 18:55:41 +0530148 def test_admin_server_group_list(self):
149 self.nova('server-group-list')
150
Joe Gordon34dc84d2013-02-21 02:19:23 +0000151 def test_admin_servce_list(self):
152 self.nova('service-list')
153
154 def test_admin_usage(self):
155 self.nova('usage')
156
157 def test_admin_usage_list(self):
158 self.nova('usage-list')
159
Eric Windisch36ab3d32014-03-05 13:09:27 -0500160 @testtools.skipIf(not CONF.service_available.cinder,
161 "Skipped as Cinder is not available")
Joe Gordon34dc84d2013-02-21 02:19:23 +0000162 def test_admin_volume_list(self):
163 self.nova('volume-list')
164
Eric Windisch36ab3d32014-03-05 13:09:27 -0500165 @testtools.skipIf(not CONF.service_available.cinder,
166 "Skipped as Cinder is not available")
Joe Gordon34dc84d2013-02-21 02:19:23 +0000167 def test_admin_volume_snapshot_list(self):
168 self.nova('volume-snapshot-list')
169
Eric Windisch36ab3d32014-03-05 13:09:27 -0500170 @testtools.skipIf(not CONF.service_available.cinder,
171 "Skipped as Cinder is not available")
Joe Gordon34dc84d2013-02-21 02:19:23 +0000172 def test_admin_volume_type_list(self):
173 self.nova('volume-type-list')
174
175 def test_admin_help(self):
176 self.nova('help')
177
178 def test_admin_list_extensions(self):
179 self.nova('list-extensions')
180
181 def test_admin_net_list(self):
182 self.nova('net-list')
183
wingwje5e318f2013-10-08 17:07:02 +0800184 def test_agent_list(self):
185 self.nova('agent-list')
186 self.nova('agent-list', flags='--debug')
187
Joe Gordon3dd3be82014-02-07 13:29:50 -0800188 def test_migration_list(self):
189 self.nova('migration-list')
190 self.nova('migration-list', flags='--debug')
191
Joe Gordon34dc84d2013-02-21 02:19:23 +0000192 # Optional arguments:
193
194 def test_admin_version(self):
195 self.nova('', flags='--version')
196
197 def test_admin_debug_list(self):
198 self.nova('list', flags='--debug')
199
200 def test_admin_timeout(self):
Matt Riedemannab038c92013-08-06 06:56:48 -0700201 self.nova('list', flags='--timeout %d' % CONF.cli.timeout)
Joe Gordon34dc84d2013-02-21 02:19:23 +0000202
203 def test_admin_timing(self):
204 self.nova('list', flags='--timing')