Merge "Fixes argument mismatch in l3-agent"

This commit is contained in:
Jenkins 2013-07-17 09:06:11 +00:00 committed by Gerrit Code Review
commit 68a866e3cc
2 changed files with 20 additions and 2 deletions

View File

@ -399,7 +399,7 @@ class L3NATAgent(manager.Manager):
ri.iptables_manager.ipv4['nat'].empty_chain('POSTROUTING')
ri.iptables_manager.ipv4['nat'].empty_chain('snat')
# And add them back if the action if add_rules
if action == 'add_rules':
if action == 'add_rules' and ex_gw_port:
# ex_gw_port should not be None in this case
ex_gw_ip = ex_gw_port['fixed_ips'][0]['ip_address']
for rule in self.external_gateway_nat_rules(ex_gw_ip,
@ -690,7 +690,7 @@ class L3NATAgent(manager.Manager):
def _process_router_delete(self):
current_removed_routers = list(self.removed_routers)
for router_id in current_removed_routers:
self._router_removed(context, router_id)
self._router_removed(router_id)
self.removed_routers.remove(router_id)
def _router_ids(self):

View File

@ -533,6 +533,24 @@ class TestBasicRouterOperations(base.BaseTestCase):
# verify that will set fullsync
self.assertTrue(FAKE_ID in agent.updated_routers)
def test_process_router_delete(self):
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
ex_gw_port = {'id': _uuid(),
'network_id': _uuid(),
'fixed_ips': [{'ip_address': '19.4.4.4',
'subnet_id': _uuid()}],
'subnet': {'cidr': '19.4.4.0/24',
'gateway_ip': '19.4.4.1'}}
router = {
'id': _uuid(),
'enable_snat': True,
'routes': [],
'gw_port': ex_gw_port}
agent._router_added(router['id'], router)
agent.router_deleted(None, router['id'])
agent._process_router_delete()
self.assertFalse(list(agent.removed_routers))
def testDestroyNamespace(self):
class FakeDev(object):