]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Merge "Move the assignment of existing_floating_ips before try block"
authorJenkins <jenkins@review.openstack.org>
Fri, 20 Mar 2015 21:16:55 +0000 (21:16 +0000)
committerGerrit Code Review <review@openstack.org>
Fri, 20 Mar 2015 21:16:55 +0000 (21:16 +0000)
1  2 
neutron/agent/l3/agent.py
neutron/agent/linux/iptables_manager.py
neutron/tests/unit/test_l3_agent.py

Simple merge
index 9736f5b1e4024f1d5e7033e4d75cb643fb5a8f53,0bccd1d6ff9d4f445d0c34f41fa646e8bfc9a68e..a88be818342f109d992d3f39905a14c08ccafc49
@@@ -1286,10 -1290,32 +1286,34 @@@ class TestBasicRouterOperations(BasicRo
                  mock.ANY, ri.router_id,
                  {fip_id: l3_constants.FLOATINGIP_STATUS_ERROR})
  
+     def test_process_external_iptables_exception(self):
+         agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
+         with mock.patch.object(
+             agent.plugin_rpc,
+             'update_floatingip_statuses') as mock_update_fip_status:
+             fip_id = _uuid()
+             router = 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 = l3router.RouterInfo(router['id'], router, **self.ri_kwargs)
+             ri.iptables_manager._apply = mock.Mock(side_effect=Exception)
+             agent._process_external(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})
+             self.assertEqual(ri.iptables_manager._apply.call_count, 1)
      def test_handle_router_snat_rules_distributed_without_snat_manager(self):
 +        agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
          ri = dvr_router.DvrRouter(
 +            agent,
              HOSTNAME,
              'foo_router_id',
              {'distributed': True},