blob: a65fda61fc38017f215b5f503da5224ab8f428ad [file] [log] [blame]
Mauro S. M. Rodriguesf5166402013-04-01 10:25:26 -04001# 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
Sean Dague1937d092013-05-17 16:36:38 -040016from tempest.api.compute import base
Matthew Treinishb0a78fc2014-01-29 16:49:12 +000017from tempest import config
Masayuki Igawa394d8d92014-03-04 17:21:56 +090018from tempest import test
Mauro S. M. Rodriguesf5166402013-04-01 10:25:26 -040019
Matthew Treinishb0a78fc2014-01-29 16:49:12 +000020CONF = config.CONF
21
Mauro S. M. Rodriguesf5166402013-04-01 10:25:26 -040022
ivan-zhuf2b00502013-10-18 10:06:52 +080023class FixedIPsTestJson(base.BaseV2ComputeAdminTest):
Mauro S. M. Rodriguesf5166402013-04-01 10:25:26 -040024
Attila Fazekas2265bc42013-09-16 14:22:56 +020025 @classmethod
Rohan Kanade60b73092015-02-04 17:58:19 +053026 def skip_checks(cls):
27 super(FixedIPsTestJson, cls).skip_checks()
Matthew Treinishb0a78fc2014-01-29 16:49:12 +000028 if CONF.service_available.neutron:
Attila Fazekas2265bc42013-09-16 14:22:56 +020029 msg = ("%s skipped as neutron is available" % cls.__name__)
30 raise cls.skipException(msg)
Rohan Kanade60b73092015-02-04 17:58:19 +053031
32 @classmethod
33 def setup_clients(cls):
34 super(FixedIPsTestJson, cls).setup_clients()
Attila Fazekas2265bc42013-09-16 14:22:56 +020035 cls.client = cls.os_adm.fixed_ips_client
Rohan Kanade60b73092015-02-04 17:58:19 +053036
37 @classmethod
38 def resource_setup(cls):
39 super(FixedIPsTestJson, cls).resource_setup()
David Kranz0fb14292015-02-11 15:55:20 -050040 server = cls.create_test_server(wait_until='ACTIVE')
41 server = cls.servers_client.get_server(server['id'])
Attila Fazekas2265bc42013-09-16 14:22:56 +020042 for ip_set in server['addresses']:
43 for ip in server['addresses'][ip_set]:
44 if ip['OS-EXT-IPS:type'] == 'fixed':
45 cls.ip = ip['addr']
46 break
47 if cls.ip:
48 break
49
Chris Hoge7579c1a2015-02-26 14:12:15 -080050 @test.idempotent_id('16b7d848-2f7c-4709-85a3-2dfb4576cc52')
Matthew Treinish2df97482014-06-13 15:02:26 -040051 @test.services('network')
Mauro S. M. Rodriguesf5166402013-04-01 10:25:26 -040052 def test_list_fixed_ip_details(self):
Ken'ichi Ohmichi5628f3f2015-05-22 20:17:56 +000053 fixed_ip = self.client.show_fixed_ip(self.ip)
Mauro S. M. Rodriguesf5166402013-04-01 10:25:26 -040054 self.assertEqual(fixed_ip['address'], self.ip)
55
Chris Hoge7579c1a2015-02-26 14:12:15 -080056 @test.idempotent_id('5485077b-7e46-4cec-b402-91dc3173433b')
Matthew Treinish2df97482014-06-13 15:02:26 -040057 @test.services('network')
Mauro S. M. Rodriguesf5166402013-04-01 10:25:26 -040058 def test_set_reserve(self):
59 body = {"reserve": "None"}
David Kranze4e3b412015-02-10 10:50:42 -050060 self.client.reserve_fixed_ip(self.ip, body)
Mauro S. M. Rodriguesf5166402013-04-01 10:25:26 -040061
Chris Hoge7579c1a2015-02-26 14:12:15 -080062 @test.idempotent_id('7476e322-b9ff-4710-bf82-49d51bac6e2e')
Matthew Treinish2df97482014-06-13 15:02:26 -040063 @test.services('network')
Mauro S. M. Rodriguesf5166402013-04-01 10:25:26 -040064 def test_set_unreserve(self):
65 body = {"unreserve": "None"}
David Kranze4e3b412015-02-10 10:50:42 -050066 self.client.reserve_fixed_ip(self.ip, body)