Floating IP association without subnet gateway IP
Neutron throws an exception when we try to attach the floating ip to the instances that are launched in a network whose subnet is connected to the external router by an Ip address otherthan its gateway-ip. Now the neutron will execute the request with no exception/warning. Closes-Bug: #1515990 Change-Id: If212c36d918ed57400a53f4b5fa1925b3d1fa6fd
This commit is contained in:
parent
dc84e891ca
commit
d5556a5e4e
|
@ -1033,11 +1033,6 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
|
|||
internal_subnet_id,
|
||||
external_network_id):
|
||||
subnet = self._core_plugin.get_subnet(context, internal_subnet_id)
|
||||
if not subnet['gateway_ip']:
|
||||
msg = (_('Cannot add floating IP to port on subnet %s '
|
||||
'which has no gateway_ip') % internal_subnet_id)
|
||||
raise n_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
|
||||
return self.get_router_for_floatingip(context,
|
||||
internal_port, subnet, external_network_id)
|
||||
|
||||
|
|
|
@ -2142,6 +2142,39 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
|
|||
self.assertEqual(ip_address,
|
||||
body['floatingip']['fixed_ip_address'])
|
||||
|
||||
def test_floatingip_update_subnet_gateway_disabled(
|
||||
self, expected_status=lib_constants.FLOATINGIP_STATUS_ACTIVE):
|
||||
"""Attach a floating IP to an instance
|
||||
|
||||
Verify that the floating IP can be associated to a port whose subnet's
|
||||
gateway ip is not connected to the external router, but the router
|
||||
has an ip in that subnet.
|
||||
"""
|
||||
with self.subnet(cidr='30.0.0.0/24', gateway_ip=None) as private_sub:
|
||||
with self.port(private_sub) as p:
|
||||
subnet_id = p['port']['fixed_ips'][0]['subnet_id']
|
||||
private_sub = {'subnet': {'id': subnet_id}}
|
||||
port_id = p['port']['id']
|
||||
with self.router() as r:
|
||||
self._router_interface_action('add', r['router']['id'],
|
||||
None, port_id)
|
||||
with self.subnet(cidr='12.0.0.0/24') as public_sub:
|
||||
self._set_net_external(public_sub['subnet']['network_id'])
|
||||
self._add_external_gateway_to_router(
|
||||
r['router']['id'], public_sub['subnet']['network_id'])
|
||||
fip = self._make_floatingip(self.fmt,
|
||||
public_sub['subnet']['network_id'])
|
||||
body = self._show('floatingips', fip['floatingip']['id'])
|
||||
self.assertEqual(expected_status,
|
||||
body['floatingip']['status'])
|
||||
body = self._update('floatingips', fip['floatingip']['id'],
|
||||
{'floatingip': {'port_id': port_id}})
|
||||
self.assertEqual(port_id, body['floatingip']['port_id'])
|
||||
self.assertEqual(p['port']['fixed_ips'][0]['ip_address'],
|
||||
body['floatingip']['fixed_ip_address'])
|
||||
self.assertEqual(r['router']['id'],
|
||||
body['floatingip']['router_id'])
|
||||
|
||||
def test_floatingip_create_different_fixed_ip_same_port(self):
|
||||
'''This tests that it is possible to delete a port that has
|
||||
multiple floating ip addresses associated with it (each floating
|
||||
|
|
Loading…
Reference in New Issue