blob: 3c3c74d23cf4f1e1bcd00bcdb0ef6e3a89e0aaa4 [file] [log] [blame]
ZhiQiang Fan39f97222013-09-20 04:49:44 +08001# Copyright 2012 OpenStack Foundation
Attila Fazekasa23f5002012-10-23 19:32:45 +02002# 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
Matthew Treinish481466b2012-12-20 17:16:01 -050016from tempest import clients
Chris Yeoh01cb2792013-02-09 22:25:37 +103017from tempest.test import attr
Giulio Fidente83181a92013-10-01 06:02:24 +020018from tempest.test import skip_because
Sean Dague09761f62013-05-13 15:20:40 -040019from tempest.thirdparty.boto.test import BotoTestCase
Attila Fazekasa23f5002012-10-23 19:32:45 +020020
21
Attila Fazekasa23f5002012-10-23 19:32:45 +020022class EC2NetworkTest(BotoTestCase):
23
24 @classmethod
25 def setUpClass(cls):
26 super(EC2NetworkTest, cls).setUpClass()
Matthew Treinish481466b2012-12-20 17:16:01 -050027 cls.os = clients.Manager()
Attila Fazekasa23f5002012-10-23 19:32:45 +020028 cls.client = cls.os.ec2api_client
29
Giulio Fidente83181a92013-10-01 06:02:24 +020030 # Note(afazekas): these tests for things duable without an instance
31 @skip_because(bug="1080406")
Attila Fazekasa23f5002012-10-23 19:32:45 +020032 @attr(type='smoke')
33 def test_disassociate_not_associated_floating_ip(self):
Sean Dague64ef48d2013-01-03 17:54:36 -050034 # EC2 disassociate not associated floating ip
Attila Fazekasa23f5002012-10-23 19:32:45 +020035 ec2_codes = self.ec2_error_code
36 address = self.client.allocate_address()
37 public_ip = address.public_ip
38 rcuk = self.addResourceCleanUp(self.client.release_address, public_ip)
39 addresses_get = self.client.get_all_addresses(addresses=(public_ip,))
40 self.assertEqual(len(addresses_get), 1)
41 self.assertEqual(addresses_get[0].public_ip, public_ip)
42 self.assertBotoError(ec2_codes.client.InvalidAssociationID.NotFound,
43 address.disassociate)
44 self.client.release_address(public_ip)
45 self.cancelResourceCleanUp(rcuk)
Attila Fazekasfa756cb2013-02-12 10:52:42 +010046 self.assertAddressReleasedWait(address)