ZhiQiang Fan | 39f9722 | 2013-09-20 04:49:44 +0800 | [diff] [blame] | 1 | # Copyright 2012 OpenStack Foundation |
Attila Fazekas | a23f500 | 2012-10-23 19:32:45 +0200 | [diff] [blame] | 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 | |
Matthew Treinish | 481466b | 2012-12-20 17:16:01 -0500 | [diff] [blame] | 16 | from tempest import clients |
Chris Yeoh | 01cb279 | 2013-02-09 22:25:37 +1030 | [diff] [blame] | 17 | from tempest.test import attr |
Giulio Fidente | 83181a9 | 2013-10-01 06:02:24 +0200 | [diff] [blame] | 18 | from tempest.test import skip_because |
Sean Dague | 09761f6 | 2013-05-13 15:20:40 -0400 | [diff] [blame] | 19 | from tempest.thirdparty.boto.test import BotoTestCase |
Attila Fazekas | a23f500 | 2012-10-23 19:32:45 +0200 | [diff] [blame] | 20 | |
| 21 | |
Attila Fazekas | a23f500 | 2012-10-23 19:32:45 +0200 | [diff] [blame] | 22 | class EC2NetworkTest(BotoTestCase): |
| 23 | |
| 24 | @classmethod |
| 25 | def setUpClass(cls): |
| 26 | super(EC2NetworkTest, cls).setUpClass() |
Matthew Treinish | 481466b | 2012-12-20 17:16:01 -0500 | [diff] [blame] | 27 | cls.os = clients.Manager() |
Attila Fazekas | a23f500 | 2012-10-23 19:32:45 +0200 | [diff] [blame] | 28 | cls.client = cls.os.ec2api_client |
| 29 | |
Giulio Fidente | 83181a9 | 2013-10-01 06:02:24 +0200 | [diff] [blame] | 30 | # Note(afazekas): these tests for things duable without an instance |
| 31 | @skip_because(bug="1080406") |
Attila Fazekas | a23f500 | 2012-10-23 19:32:45 +0200 | [diff] [blame] | 32 | @attr(type='smoke') |
| 33 | def test_disassociate_not_associated_floating_ip(self): |
Sean Dague | 64ef48d | 2013-01-03 17:54:36 -0500 | [diff] [blame] | 34 | # EC2 disassociate not associated floating ip |
Attila Fazekas | a23f500 | 2012-10-23 19:32:45 +0200 | [diff] [blame] | 35 | 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 Fazekas | fa756cb | 2013-02-12 10:52:42 +0100 | [diff] [blame] | 46 | self.assertAddressReleasedWait(address) |