use floatingip's ID as key instead of itself
Change-Id: I267f174a0e2e611ec007404c7b44e2c73a359c38 Closes-Bug: 1294526
This commit is contained in:
parent
e75f4854a6
commit
7120325d37
@ -473,7 +473,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback, manager.Manager):
|
||||
# TODO(salv-orlando): Less broad catching
|
||||
# All floating IPs must be put in error state
|
||||
for fip in ri.router.get(l3_constants.FLOATINGIP_KEY, []):
|
||||
fip_statuses[fip] = l3_constants.FLOATINGIP_STATUS_ERROR
|
||||
fip_statuses[fip['id']] = l3_constants.FLOATINGIP_STATUS_ERROR
|
||||
|
||||
if ex_gw_port:
|
||||
# Identify floating IPs which were disabled
|
||||
|
@ -744,6 +744,31 @@ class TestBasicRouterOperations(base.BaseTestCase):
|
||||
mock.ANY, ri.router_id,
|
||||
{fip_id: l3_constants.FLOATINGIP_STATUS_DOWN})
|
||||
|
||||
def test_process_router_floatingip_exception(self):
|
||||
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
|
||||
agent.process_router_floating_ip_addresses = mock.Mock()
|
||||
agent.process_router_floating_ip_addresses.side_effect = RuntimeError
|
||||
with mock.patch.object(
|
||||
agent.plugin_rpc,
|
||||
'update_floatingip_statuses') as mock_update_fip_status:
|
||||
fip_id = _uuid()
|
||||
router = self._prepare_router_data(num_internal_ports=1)
|
||||
router[l3_constants.FLOATINGIP_KEY] = [
|
||||
{'id': fip_id,
|
||||
'floating_ip_address': '8.8.8.8',
|
||||
'fixed_ip_address': '7.7.7.7',
|
||||
'port_id': router[l3_constants.INTERFACE_KEY][0]['id']}]
|
||||
|
||||
ri = l3_agent.RouterInfo(router['id'], self.conf.root_helper,
|
||||
self.conf.use_namespaces, router=router)
|
||||
agent.external_gateway_added = mock.Mock()
|
||||
agent.process_router(ri)
|
||||
# Assess the call for putting the floating IP into Error
|
||||
# was performed
|
||||
mock_update_fip_status.assert_called_once_with(
|
||||
mock.ANY, ri.router_id,
|
||||
{fip_id: l3_constants.FLOATINGIP_STATUS_ERROR})
|
||||
|
||||
def test_handle_router_snat_rules_add_back_jump(self):
|
||||
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
|
||||
ri = mock.MagicMock()
|
||||
|
Loading…
Reference in New Issue
Block a user