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,
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):
# 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):