Reject router-interface-add with a port which doesn't have any addresses
Fix a regression in commit I7d4e8194815e626f1cfa267f77a3f2475fdfa3d1 . Closes-Bug: #1466750 Related-Bug: #1439824 Change-Id: Ic0c4c0adbffe14b1f08d4b2dee91e1dff41cc770
This commit is contained in:
parent
acf78cc3c8
commit
c27e66cc7c
|
@ -513,6 +513,10 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase):
|
|||
port_id=port['id'],
|
||||
device_id=port['device_id'])
|
||||
|
||||
if not port['fixed_ips']:
|
||||
msg = _LE('Router port must have at least one fixed IP')
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
|
||||
# Only allow one router port with IPv6 subnets per network id
|
||||
if self._port_has_ipv6_address(port):
|
||||
for existing_port in (rp.port for rp in router.attached_ports):
|
||||
|
|
|
@ -1292,6 +1292,18 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
|
|||
expected_code=err_code,
|
||||
tenant_id='bad_tenant')
|
||||
|
||||
def test_router_add_interface_port_without_ips(self):
|
||||
with self.network() as network, self.router() as r:
|
||||
# Create a router port without ips
|
||||
p = self._make_port(self.fmt, network['network']['id'],
|
||||
device_owner=l3_constants.DEVICE_OWNER_ROUTER_INTF)
|
||||
err_code = exc.HTTPBadRequest.code
|
||||
self._router_interface_action('add',
|
||||
r['router']['id'],
|
||||
None,
|
||||
p['port']['id'],
|
||||
expected_code=err_code)
|
||||
|
||||
def test_router_add_interface_dup_subnet1_returns_400(self):
|
||||
with self.router() as r:
|
||||
with self.subnet() as s:
|
||||
|
|
Loading…
Reference in New Issue