Nayna Patel | f1a2915 | 2013-08-09 07:18:13 +0000 | [diff] [blame] | 1 | # Copyright 2013 OpenStack Foundation |
| 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 | |
| 16 | from tempest.api.network import base |
Andrea Frittoli | cd36841 | 2017-08-14 21:37:56 +0100 | [diff] [blame] | 17 | from tempest.common import utils |
deepak_mourya | b4fb438 | 2018-06-04 10:11:32 +0530 | [diff] [blame] | 18 | from tempest.common.utils import data_utils |
Ryan Tidwell | 1964a26 | 2016-05-04 15:13:23 -0700 | [diff] [blame] | 19 | from tempest.common.utils import net_utils |
Matthew Treinish | 03b48df | 2014-01-29 16:59:49 +0000 | [diff] [blame] | 20 | from tempest import config |
Ken'ichi Ohmichi | 53b9a63 | 2017-01-27 18:04:39 -0800 | [diff] [blame] | 21 | from tempest.lib import decorators |
Nayna Patel | f1a2915 | 2013-08-09 07:18:13 +0000 | [diff] [blame] | 22 | |
Matthew Treinish | 03b48df | 2014-01-29 16:59:49 +0000 | [diff] [blame] | 23 | CONF = config.CONF |
| 24 | |
Nayna Patel | f1a2915 | 2013-08-09 07:18:13 +0000 | [diff] [blame] | 25 | |
Attila Fazekas | c74aede | 2013-09-11 13:04:02 +0200 | [diff] [blame] | 26 | class FloatingIPTestJSON(base.BaseNetworkTest): |
Ken'ichi Ohmichi | e03bea9 | 2015-11-19 07:45:58 +0000 | [diff] [blame] | 27 | """Tests the following operations in the Neutron API: |
Nayna Patel | f1a2915 | 2013-08-09 07:18:13 +0000 | [diff] [blame] | 28 | |
| 29 | Create a Floating IP |
| 30 | Update a Floating IP |
| 31 | Delete a Floating IP |
| 32 | List all Floating IPs |
| 33 | Show Floating IP details |
rossella | b24ec38 | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 34 | Associate a Floating IP with a port and then delete that port |
| 35 | Associate a Floating IP with a port and then with a port on another |
| 36 | router |
Nayna Patel | f1a2915 | 2013-08-09 07:18:13 +0000 | [diff] [blame] | 37 | |
rossella | bc9b4bd | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 38 | v2.0 of the Neutron API is assumed. It is also assumed that the following |
Nayna Patel | f1a2915 | 2013-08-09 07:18:13 +0000 | [diff] [blame] | 39 | options are defined in the [network] section of etc/tempest.conf: |
| 40 | |
| 41 | public_network_id which is the id for the external network present |
| 42 | """ |
| 43 | |
| 44 | @classmethod |
Rohan Kanade | a565e45 | 2015-01-27 14:00:13 +0530 | [diff] [blame] | 45 | def skip_checks(cls): |
| 46 | super(FloatingIPTestJSON, cls).skip_checks() |
Andrea Frittoli | cd36841 | 2017-08-14 21:37:56 +0100 | [diff] [blame] | 47 | if not utils.is_extension_enabled('router', 'network'): |
Yoshihiro Kaneko | 0567026 | 2014-01-18 19:22:44 +0900 | [diff] [blame] | 48 | msg = "router extension not enabled." |
| 49 | raise cls.skipException(msg) |
zhufl | 6b7040a | 2017-01-18 16:38:34 +0800 | [diff] [blame] | 50 | if not CONF.network.public_network_id: |
| 51 | msg = "The public_network_id option must be specified." |
| 52 | raise cls.skipException(msg) |
Matthew Treinish | 3312de3 | 2017-05-19 12:08:17 -0400 | [diff] [blame] | 53 | if not CONF.network_feature_enabled.floating_ips: |
| 54 | raise cls.skipException("Floating ips are not available") |
Rohan Kanade | a565e45 | 2015-01-27 14:00:13 +0530 | [diff] [blame] | 55 | |
| 56 | @classmethod |
| 57 | def resource_setup(cls): |
| 58 | super(FloatingIPTestJSON, cls).resource_setup() |
Matthew Treinish | 03b48df | 2014-01-29 16:59:49 +0000 | [diff] [blame] | 59 | cls.ext_net_id = CONF.network.public_network_id |
Nayna Patel | f1a2915 | 2013-08-09 07:18:13 +0000 | [diff] [blame] | 60 | |
| 61 | # Create network, subnet, router and add interface |
| 62 | cls.network = cls.create_network() |
Kevin Benton | a70710b | 2016-07-08 15:24:38 -0700 | [diff] [blame] | 63 | cls.subnet = cls.create_subnet(cls.network, enable_dhcp=False) |
zhufl | d2c40ca | 2016-10-18 17:03:07 +0800 | [diff] [blame] | 64 | cls.router = cls.create_router(external_network_id=cls.ext_net_id) |
rossella | bc9b4bd | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 65 | cls.create_router_interface(cls.router['id'], cls.subnet['id']) |
Nayna Patel | f1a2915 | 2013-08-09 07:18:13 +0000 | [diff] [blame] | 66 | # Create two ports one each for Creation and Updating of floatingIP |
| 67 | for i in range(2): |
rossella | bc9b4bd | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 68 | cls.create_port(cls.network) |
Nayna Patel | f1a2915 | 2013-08-09 07:18:13 +0000 | [diff] [blame] | 69 | |
Jordan Pittier | 3b46d27 | 2017-04-12 16:17:28 +0200 | [diff] [blame] | 70 | @decorators.attr(type='smoke') |
Ken'ichi Ohmichi | 53b9a63 | 2017-01-27 18:04:39 -0800 | [diff] [blame] | 71 | @decorators.idempotent_id('62595970-ab1c-4b7f-8fcc-fddfe55e8718') |
Nayna Patel | f1a2915 | 2013-08-09 07:18:13 +0000 | [diff] [blame] | 72 | def test_create_list_show_update_delete_floating_ip(self): |
| 73 | # Creates a floating IP |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 74 | body = self.floating_ips_client.create_floatingip( |
Rohan Kanade | eeb2164 | 2014-08-14 12:00:26 +0200 | [diff] [blame] | 75 | floating_network_id=self.ext_net_id, |
| 76 | port_id=self.ports[0]['id']) |
Ann Kamyshnikova | 47a4ff8 | 2014-03-17 12:48:57 +0400 | [diff] [blame] | 77 | created_floating_ip = body['floatingip'] |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 78 | self.addCleanup(self.floating_ips_client.delete_floatingip, |
Ann Kamyshnikova | 47a4ff8 | 2014-03-17 12:48:57 +0400 | [diff] [blame] | 79 | created_floating_ip['id']) |
rossella | bc9b4bd | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 80 | self.assertIsNotNone(created_floating_ip['id']) |
| 81 | self.assertIsNotNone(created_floating_ip['tenant_id']) |
| 82 | self.assertIsNotNone(created_floating_ip['floating_ip_address']) |
| 83 | self.assertEqual(created_floating_ip['port_id'], self.ports[0]['id']) |
| 84 | self.assertEqual(created_floating_ip['floating_network_id'], |
Nayna Patel | f1a2915 | 2013-08-09 07:18:13 +0000 | [diff] [blame] | 85 | self.ext_net_id) |
Ann Kamyshnikova | 7d2275b | 2013-12-19 16:38:42 +0400 | [diff] [blame] | 86 | self.assertIn(created_floating_ip['fixed_ip_address'], |
| 87 | [ip['ip_address'] for ip in self.ports[0]['fixed_ips']]) |
Nayna Patel | f1a2915 | 2013-08-09 07:18:13 +0000 | [diff] [blame] | 88 | # Verifies the details of a floating_ip |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 89 | floating_ip = self.floating_ips_client.show_floatingip( |
| 90 | created_floating_ip['id']) |
rossella | bc9b4bd | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 91 | shown_floating_ip = floating_ip['floatingip'] |
| 92 | self.assertEqual(shown_floating_ip['id'], created_floating_ip['id']) |
| 93 | self.assertEqual(shown_floating_ip['floating_network_id'], |
Nayna Patel | f1a2915 | 2013-08-09 07:18:13 +0000 | [diff] [blame] | 94 | self.ext_net_id) |
rossella | bc9b4bd | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 95 | self.assertEqual(shown_floating_ip['tenant_id'], |
| 96 | created_floating_ip['tenant_id']) |
| 97 | self.assertEqual(shown_floating_ip['floating_ip_address'], |
| 98 | created_floating_ip['floating_ip_address']) |
| 99 | self.assertEqual(shown_floating_ip['port_id'], self.ports[0]['id']) |
Nayna Patel | f1a2915 | 2013-08-09 07:18:13 +0000 | [diff] [blame] | 100 | |
| 101 | # Verify the floating ip exists in the list of all floating_ips |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 102 | floating_ips = self.floating_ips_client.list_floatingips() |
Nayna Patel | f1a2915 | 2013-08-09 07:18:13 +0000 | [diff] [blame] | 103 | floatingip_id_list = list() |
| 104 | for f in floating_ips['floatingips']: |
| 105 | floatingip_id_list.append(f['id']) |
rossella | bc9b4bd | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 106 | self.assertIn(created_floating_ip['id'], floatingip_id_list) |
Nayna Patel | f1a2915 | 2013-08-09 07:18:13 +0000 | [diff] [blame] | 107 | # Associate floating IP to the other port |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 108 | floating_ip = self.floating_ips_client.update_floatingip( |
Rohan Kanade | eeb2164 | 2014-08-14 12:00:26 +0200 | [diff] [blame] | 109 | created_floating_ip['id'], |
| 110 | port_id=self.ports[1]['id']) |
rossella | bc9b4bd | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 111 | updated_floating_ip = floating_ip['floatingip'] |
| 112 | self.assertEqual(updated_floating_ip['port_id'], self.ports[1]['id']) |
| 113 | self.assertEqual(updated_floating_ip['fixed_ip_address'], |
| 114 | self.ports[1]['fixed_ips'][0]['ip_address']) |
| 115 | self.assertEqual(updated_floating_ip['router_id'], self.router['id']) |
Nayna Patel | f1a2915 | 2013-08-09 07:18:13 +0000 | [diff] [blame] | 116 | |
| 117 | # Disassociate floating IP from the port |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 118 | floating_ip = self.floating_ips_client.update_floatingip( |
Rohan Kanade | eeb2164 | 2014-08-14 12:00:26 +0200 | [diff] [blame] | 119 | created_floating_ip['id'], |
| 120 | port_id=None) |
rossella | bc9b4bd | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 121 | updated_floating_ip = floating_ip['floatingip'] |
| 122 | self.assertIsNone(updated_floating_ip['port_id']) |
| 123 | self.assertIsNone(updated_floating_ip['fixed_ip_address']) |
| 124 | self.assertIsNone(updated_floating_ip['router_id']) |
Attila Fazekas | c74aede | 2013-09-11 13:04:02 +0200 | [diff] [blame] | 125 | |
Ken'ichi Ohmichi | 53b9a63 | 2017-01-27 18:04:39 -0800 | [diff] [blame] | 126 | @decorators.idempotent_id('e1f6bffd-442f-4668-b30e-df13f2705e77') |
rossella | b24ec38 | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 127 | def test_floating_ip_delete_port(self): |
| 128 | # Create a floating IP |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 129 | body = self.floating_ips_client.create_floatingip( |
Ann Kamyshnikova | 47a4ff8 | 2014-03-17 12:48:57 +0400 | [diff] [blame] | 130 | floating_network_id=self.ext_net_id) |
Ann Kamyshnikova | 47a4ff8 | 2014-03-17 12:48:57 +0400 | [diff] [blame] | 131 | created_floating_ip = body['floatingip'] |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 132 | self.addCleanup(self.floating_ips_client.delete_floatingip, |
Ann Kamyshnikova | 47a4ff8 | 2014-03-17 12:48:57 +0400 | [diff] [blame] | 133 | created_floating_ip['id']) |
rossella | b24ec38 | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 134 | # Create a port |
John Warren | 49c0fe5 | 2015-10-22 12:35:54 -0400 | [diff] [blame] | 135 | port = self.ports_client.create_port(network_id=self.network['id']) |
rossella | b24ec38 | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 136 | created_port = port['port'] |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 137 | floating_ip = self.floating_ips_client.update_floatingip( |
Rohan Kanade | eeb2164 | 2014-08-14 12:00:26 +0200 | [diff] [blame] | 138 | created_floating_ip['id'], |
| 139 | port_id=created_port['id']) |
rossella | b24ec38 | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 140 | # Delete port |
John Warren | 49c0fe5 | 2015-10-22 12:35:54 -0400 | [diff] [blame] | 141 | self.ports_client.delete_port(created_port['id']) |
rossella | b24ec38 | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 142 | # Verifies the details of the floating_ip |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 143 | floating_ip = self.floating_ips_client.show_floatingip( |
| 144 | created_floating_ip['id']) |
rossella | b24ec38 | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 145 | shown_floating_ip = floating_ip['floatingip'] |
| 146 | # Confirm the fields are back to None |
| 147 | self.assertEqual(shown_floating_ip['id'], created_floating_ip['id']) |
| 148 | self.assertIsNone(shown_floating_ip['port_id']) |
| 149 | self.assertIsNone(shown_floating_ip['fixed_ip_address']) |
| 150 | self.assertIsNone(shown_floating_ip['router_id']) |
| 151 | |
Ken'ichi Ohmichi | 53b9a63 | 2017-01-27 18:04:39 -0800 | [diff] [blame] | 152 | @decorators.idempotent_id('1bb2f731-fe5a-4b8c-8409-799ade1bed4d') |
rossella | b24ec38 | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 153 | def test_floating_ip_update_different_router(self): |
| 154 | # Associate a floating IP to a port on a router |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 155 | body = self.floating_ips_client.create_floatingip( |
Rohan Kanade | eeb2164 | 2014-08-14 12:00:26 +0200 | [diff] [blame] | 156 | floating_network_id=self.ext_net_id, |
| 157 | port_id=self.ports[1]['id']) |
Ann Kamyshnikova | 47a4ff8 | 2014-03-17 12:48:57 +0400 | [diff] [blame] | 158 | created_floating_ip = body['floatingip'] |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 159 | self.addCleanup(self.floating_ips_client.delete_floatingip, |
Ann Kamyshnikova | 47a4ff8 | 2014-03-17 12:48:57 +0400 | [diff] [blame] | 160 | created_floating_ip['id']) |
rossella | b24ec38 | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 161 | self.assertEqual(created_floating_ip['router_id'], self.router['id']) |
deepak_mourya | b4fb438 | 2018-06-04 10:11:32 +0530 | [diff] [blame] | 162 | network_name = data_utils.rand_name(self.__class__.__name__) |
| 163 | network2 = self.networks_client.create_network( |
| 164 | name=network_name)['network'] |
| 165 | self.addCleanup(self.networks_client.delete_network, |
| 166 | network2['id']) |
rossella | b24ec38 | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 167 | subnet2 = self.create_subnet(network2) |
deepak_mourya | b4fb438 | 2018-06-04 10:11:32 +0530 | [diff] [blame] | 168 | self.addCleanup(self.subnets_client.delete_subnet, subnet2['id']) |
zhufl | d2c40ca | 2016-10-18 17:03:07 +0800 | [diff] [blame] | 169 | router2 = self.create_router(external_network_id=self.ext_net_id) |
deepak_mourya | b4fb438 | 2018-06-04 10:11:32 +0530 | [diff] [blame] | 170 | self.addCleanup(self.routers_client.delete_router, router2['id']) |
rossella | b24ec38 | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 171 | self.create_router_interface(router2['id'], subnet2['id']) |
deepak_mourya | b4fb438 | 2018-06-04 10:11:32 +0530 | [diff] [blame] | 172 | self.addCleanup(self.routers_client.remove_router_interface, |
| 173 | router2['id'], subnet_id=subnet2['id']) |
rossella | b24ec38 | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 174 | port_other_router = self.create_port(network2) |
deepak_mourya | b4fb438 | 2018-06-04 10:11:32 +0530 | [diff] [blame] | 175 | self.addCleanup(self.ports_client.delete_port, |
| 176 | port_other_router['id']) |
rossella | b24ec38 | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 177 | # Associate floating IP to the other port on another router |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 178 | floating_ip = self.floating_ips_client.update_floatingip( |
Rohan Kanade | eeb2164 | 2014-08-14 12:00:26 +0200 | [diff] [blame] | 179 | created_floating_ip['id'], |
| 180 | port_id=port_other_router['id']) |
rossella | b24ec38 | 2013-11-13 10:21:59 +0100 | [diff] [blame] | 181 | updated_floating_ip = floating_ip['floatingip'] |
| 182 | self.assertEqual(updated_floating_ip['router_id'], router2['id']) |
| 183 | self.assertEqual(updated_floating_ip['port_id'], |
| 184 | port_other_router['id']) |
| 185 | self.assertIsNotNone(updated_floating_ip['fixed_ip_address']) |
| 186 | |
Jordan Pittier | 3b46d27 | 2017-04-12 16:17:28 +0200 | [diff] [blame] | 187 | @decorators.attr(type='smoke') |
Ken'ichi Ohmichi | 53b9a63 | 2017-01-27 18:04:39 -0800 | [diff] [blame] | 188 | @decorators.idempotent_id('36de4bd0-f09c-43e3-a8e1-1decc1ffd3a5') |
Ann Kamyshnikova | 7d2275b | 2013-12-19 16:38:42 +0400 | [diff] [blame] | 189 | def test_create_floating_ip_specifying_a_fixed_ip_address(self): |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 190 | body = self.floating_ips_client.create_floatingip( |
Ann Kamyshnikova | 7d2275b | 2013-12-19 16:38:42 +0400 | [diff] [blame] | 191 | floating_network_id=self.ext_net_id, |
| 192 | port_id=self.ports[1]['id'], |
| 193 | fixed_ip_address=self.ports[1]['fixed_ips'][0]['ip_address']) |
Ann Kamyshnikova | 7d2275b | 2013-12-19 16:38:42 +0400 | [diff] [blame] | 194 | created_floating_ip = body['floatingip'] |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 195 | self.addCleanup(self.floating_ips_client.delete_floatingip, |
Ann Kamyshnikova | 7d2275b | 2013-12-19 16:38:42 +0400 | [diff] [blame] | 196 | created_floating_ip['id']) |
| 197 | self.assertIsNotNone(created_floating_ip['id']) |
| 198 | self.assertEqual(created_floating_ip['fixed_ip_address'], |
| 199 | self.ports[1]['fixed_ips'][0]['ip_address']) |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 200 | floating_ip = self.floating_ips_client.update_floatingip( |
Rohan Kanade | eeb2164 | 2014-08-14 12:00:26 +0200 | [diff] [blame] | 201 | created_floating_ip['id'], |
| 202 | port_id=None) |
Ann Kamyshnikova | 7d2275b | 2013-12-19 16:38:42 +0400 | [diff] [blame] | 203 | self.assertIsNone(floating_ip['floatingip']['port_id']) |
| 204 | |
Ken'ichi Ohmichi | 53b9a63 | 2017-01-27 18:04:39 -0800 | [diff] [blame] | 205 | @decorators.idempotent_id('45c4c683-ea97-41ef-9c51-5e9802f2f3d7') |
Ann Kamyshnikova | df10284 | 2014-02-05 13:52:57 +0400 | [diff] [blame] | 206 | def test_create_update_floatingip_with_port_multiple_ip_address(self): |
| 207 | # Find out ips that can be used for tests |
Ryan Tidwell | 1964a26 | 2016-05-04 15:13:23 -0700 | [diff] [blame] | 208 | list_ips = net_utils.get_unused_ip_addresses( |
| 209 | self.ports_client, |
| 210 | self.subnets_client, |
| 211 | self.subnet['network_id'], |
| 212 | self.subnet['id'], |
| 213 | 2) |
Ann Kamyshnikova | df10284 | 2014-02-05 13:52:57 +0400 | [diff] [blame] | 214 | fixed_ips = [{'ip_address': list_ips[0]}, {'ip_address': list_ips[1]}] |
| 215 | # Create port |
John Warren | 49c0fe5 | 2015-10-22 12:35:54 -0400 | [diff] [blame] | 216 | body = self.ports_client.create_port(network_id=self.network['id'], |
| 217 | fixed_ips=fixed_ips) |
Ann Kamyshnikova | df10284 | 2014-02-05 13:52:57 +0400 | [diff] [blame] | 218 | port = body['port'] |
John Warren | 49c0fe5 | 2015-10-22 12:35:54 -0400 | [diff] [blame] | 219 | self.addCleanup(self.ports_client.delete_port, port['id']) |
Ann Kamyshnikova | df10284 | 2014-02-05 13:52:57 +0400 | [diff] [blame] | 220 | # Create floating ip |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 221 | body = self.floating_ips_client.create_floatingip( |
Rohan Kanade | eeb2164 | 2014-08-14 12:00:26 +0200 | [diff] [blame] | 222 | floating_network_id=self.ext_net_id, |
| 223 | port_id=port['id'], |
Ann Kamyshnikova | df10284 | 2014-02-05 13:52:57 +0400 | [diff] [blame] | 224 | fixed_ip_address=list_ips[0]) |
Ann Kamyshnikova | df10284 | 2014-02-05 13:52:57 +0400 | [diff] [blame] | 225 | floating_ip = body['floatingip'] |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 226 | self.addCleanup(self.floating_ips_client.delete_floatingip, |
| 227 | floating_ip['id']) |
Ann Kamyshnikova | df10284 | 2014-02-05 13:52:57 +0400 | [diff] [blame] | 228 | self.assertIsNotNone(floating_ip['id']) |
| 229 | self.assertEqual(floating_ip['fixed_ip_address'], list_ips[0]) |
| 230 | # Update floating ip |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 231 | body = self.floating_ips_client.update_floatingip( |
| 232 | floating_ip['id'], port_id=port['id'], |
| 233 | fixed_ip_address=list_ips[1]) |
Ann Kamyshnikova | df10284 | 2014-02-05 13:52:57 +0400 | [diff] [blame] | 234 | update_floating_ip = body['floatingip'] |
| 235 | self.assertEqual(update_floating_ip['fixed_ip_address'], |
| 236 | list_ips[1]) |