Mauro S. M. Rodrigues | f516640 | 2013-04-01 10:25:26 -0400 | [diff] [blame] | 1 | # 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 Dague | 1937d09 | 2013-05-17 16:36:38 -0400 | [diff] [blame] | 16 | from tempest.api.compute import base |
Matthew Treinish | b0a78fc | 2014-01-29 16:49:12 +0000 | [diff] [blame] | 17 | from tempest import config |
Masayuki Igawa | 394d8d9 | 2014-03-04 17:21:56 +0900 | [diff] [blame] | 18 | from tempest import test |
Mauro S. M. Rodrigues | f516640 | 2013-04-01 10:25:26 -0400 | [diff] [blame] | 19 | |
Matthew Treinish | b0a78fc | 2014-01-29 16:49:12 +0000 | [diff] [blame] | 20 | CONF = config.CONF |
| 21 | |
Mauro S. M. Rodrigues | f516640 | 2013-04-01 10:25:26 -0400 | [diff] [blame] | 22 | |
ivan-zhu | f2b0050 | 2013-10-18 10:06:52 +0800 | [diff] [blame] | 23 | class FixedIPsTestJson(base.BaseV2ComputeAdminTest): |
Mauro S. M. Rodrigues | f516640 | 2013-04-01 10:25:26 -0400 | [diff] [blame] | 24 | |
Attila Fazekas | 2265bc4 | 2013-09-16 14:22:56 +0200 | [diff] [blame] | 25 | @classmethod |
Rohan Kanade | 60b7309 | 2015-02-04 17:58:19 +0530 | [diff] [blame] | 26 | def skip_checks(cls): |
| 27 | super(FixedIPsTestJson, cls).skip_checks() |
Matthew Treinish | b0a78fc | 2014-01-29 16:49:12 +0000 | [diff] [blame] | 28 | if CONF.service_available.neutron: |
Attila Fazekas | 2265bc4 | 2013-09-16 14:22:56 +0200 | [diff] [blame] | 29 | msg = ("%s skipped as neutron is available" % cls.__name__) |
| 30 | raise cls.skipException(msg) |
Rohan Kanade | 60b7309 | 2015-02-04 17:58:19 +0530 | [diff] [blame] | 31 | |
| 32 | @classmethod |
| 33 | def setup_clients(cls): |
| 34 | super(FixedIPsTestJson, cls).setup_clients() |
Attila Fazekas | 2265bc4 | 2013-09-16 14:22:56 +0200 | [diff] [blame] | 35 | cls.client = cls.os_adm.fixed_ips_client |
Rohan Kanade | 60b7309 | 2015-02-04 17:58:19 +0530 | [diff] [blame] | 36 | |
| 37 | @classmethod |
| 38 | def resource_setup(cls): |
| 39 | super(FixedIPsTestJson, cls).resource_setup() |
David Kranz | 0fb1429 | 2015-02-11 15:55:20 -0500 | [diff] [blame] | 40 | server = cls.create_test_server(wait_until='ACTIVE') |
Ken'ichi Ohmichi | 7680024 | 2015-07-03 05:12:31 +0000 | [diff] [blame] | 41 | server = cls.servers_client.show_server(server['id']) |
Attila Fazekas | 2265bc4 | 2013-09-16 14:22:56 +0200 | [diff] [blame] | 42 | 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 Hoge | 7579c1a | 2015-02-26 14:12:15 -0800 | [diff] [blame] | 50 | @test.idempotent_id('16b7d848-2f7c-4709-85a3-2dfb4576cc52') |
Matthew Treinish | 2df9748 | 2014-06-13 15:02:26 -0400 | [diff] [blame] | 51 | @test.services('network') |
Mauro S. M. Rodrigues | f516640 | 2013-04-01 10:25:26 -0400 | [diff] [blame] | 52 | def test_list_fixed_ip_details(self): |
Ken'ichi Ohmichi | 5628f3f | 2015-05-22 20:17:56 +0000 | [diff] [blame] | 53 | fixed_ip = self.client.show_fixed_ip(self.ip) |
ghanshyam | aa5ce1f | 2015-08-04 16:03:51 +0900 | [diff] [blame] | 54 | self.assertEqual(fixed_ip['fixed_ip']['address'], self.ip) |
Mauro S. M. Rodrigues | f516640 | 2013-04-01 10:25:26 -0400 | [diff] [blame] | 55 | |
Chris Hoge | 7579c1a | 2015-02-26 14:12:15 -0800 | [diff] [blame] | 56 | @test.idempotent_id('5485077b-7e46-4cec-b402-91dc3173433b') |
Matthew Treinish | 2df9748 | 2014-06-13 15:02:26 -0400 | [diff] [blame] | 57 | @test.services('network') |
Mauro S. M. Rodrigues | f516640 | 2013-04-01 10:25:26 -0400 | [diff] [blame] | 58 | def test_set_reserve(self): |
Ken'ichi Ohmichi | 1589574 | 2015-07-17 05:34:36 +0000 | [diff] [blame] | 59 | self.client.reserve_fixed_ip(self.ip, reserve="None") |
Mauro S. M. Rodrigues | f516640 | 2013-04-01 10:25:26 -0400 | [diff] [blame] | 60 | |
Chris Hoge | 7579c1a | 2015-02-26 14:12:15 -0800 | [diff] [blame] | 61 | @test.idempotent_id('7476e322-b9ff-4710-bf82-49d51bac6e2e') |
Matthew Treinish | 2df9748 | 2014-06-13 15:02:26 -0400 | [diff] [blame] | 62 | @test.services('network') |
Mauro S. M. Rodrigues | f516640 | 2013-04-01 10:25:26 -0400 | [diff] [blame] | 63 | def test_set_unreserve(self): |
Ken'ichi Ohmichi | 1589574 | 2015-07-17 05:34:36 +0000 | [diff] [blame] | 64 | self.client.reserve_fixed_ip(self.ip, unreserve="None") |