blob: 0c368371d034eec2349275bd8592f52c2e80dc32 [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
Mauro S. M. Rodriguesf5166402013-04-01 10:25:26 -040017from tempest.test import attr
Mauro S. M. Rodriguesf5166402013-04-01 10:25:26 -040018
19
ivan-zhuf2b00502013-10-18 10:06:52 +080020class FixedIPsTestJson(base.BaseV2ComputeAdminTest):
Mauro S. M. Rodriguesf5166402013-04-01 10:25:26 -040021 _interface = 'json'
22
Attila Fazekas2265bc42013-09-16 14:22:56 +020023 @classmethod
24 def setUpClass(cls):
25 super(FixedIPsTestJson, cls).setUpClass()
26 if cls.config.service_available.neutron:
27 msg = ("%s skipped as neutron is available" % cls.__name__)
28 raise cls.skipException(msg)
29 cls.client = cls.os_adm.fixed_ips_client
Ken'ichi Ohmichicfc052e2013-10-23 11:50:04 +090030 resp, server = cls.create_test_server(wait_until='ACTIVE')
Attila Fazekas2265bc42013-09-16 14:22:56 +020031 resp, server = cls.servers_client.get_server(server['id'])
32 for ip_set in server['addresses']:
33 for ip in server['addresses'][ip_set]:
34 if ip['OS-EXT-IPS:type'] == 'fixed':
35 cls.ip = ip['addr']
36 break
37 if cls.ip:
38 break
39
Giulio Fidenteba3985a2013-05-29 01:46:36 +020040 @attr(type='gate')
Mauro S. M. Rodriguesf5166402013-04-01 10:25:26 -040041 def test_list_fixed_ip_details(self):
42 resp, fixed_ip = self.client.get_fixed_ip_details(self.ip)
43 self.assertEqual(fixed_ip['address'], self.ip)
44
Giulio Fidenteba3985a2013-05-29 01:46:36 +020045 @attr(type='gate')
Mauro S. M. Rodriguesf5166402013-04-01 10:25:26 -040046 def test_set_reserve(self):
47 body = {"reserve": "None"}
48 resp, body = self.client.reserve_fixed_ip(self.ip, body)
49 self.assertEqual(resp.status, 202)
50
Giulio Fidenteba3985a2013-05-29 01:46:36 +020051 @attr(type='gate')
Mauro S. M. Rodriguesf5166402013-04-01 10:25:26 -040052 def test_set_unreserve(self):
53 body = {"unreserve": "None"}
54 resp, body = self.client.reserve_fixed_ip(self.ip, body)
55 self.assertEqual(resp.status, 202)
56
Mauro S. M. Rodriguesf5166402013-04-01 10:25:26 -040057
58class FixedIPsTestXml(FixedIPsTestJson):
59 _interface = 'xml'