fix l3 plugin to work for 5600 router

Change-Id: Ie32b8c9dcadd8b9bf6996a211f2069c95de42f45
changes/60/192660/1
Harkirat Singh 8 years ago
parent f601c00510
commit 17786b869b

@ -602,7 +602,7 @@ class TestVRouterRestAPIClient(n_base.BaseTestCase,
def test_sync_cache(self):
client = self._create_client()
client._vrouter_model = client._VROUTER_VSE_MODEL
with mock.patch.object(
vyatta_client.VRouterRestAPIClient, '_show_cmd') as show_cmd:
show_cmd.return_value = SHOW_CONFIG_OUTPUT

@ -15,6 +15,7 @@
import logging
import re
import six
import urllib
import netaddr
@ -382,7 +383,7 @@ class VRouterRestAPIClient(object):
self._external_gw_info = given_gw_info
# Cache the nat rules
for router_if_subnet, rule_num in nat_rules.iteritems():
for router_if_subnet, rule_num in six.iteritems(nat_rules):
self._router_if_subnet_dict[router_if_subnet] = rule_num
def _clear_gw_configuration(self, cmd_list):
@ -968,10 +969,16 @@ class VRouterRestAPIClient(object):
def _process_interfaces(self, search_str, system_gw_ip):
for paragraph in search_str.split('}'):
if self._vrouter_model == self._VROUTER_VSE_MODEL:
ma = re.compile(
".+ethernet (eth\d+).+address ([^ \n]+).+description ([^ \n]+)"
".+", re.DOTALL)
else:
ma = re.compile(
".+dataplane (dp\d+s\d+).+address ([^ \n]+).+description"
" ([^ \n]+).+", re.DOTALL)
for paragraph in search_str.split('}'):
result = ma.match(paragraph)
if result is not None:
eth_if_id = result.group(1)

@ -179,7 +179,8 @@ class VyattaVRouterMixin(common_db_mixin.CommonDbMixin,
context.session.add(router)
if gw_port:
self._delete_router_port(context, router_id, gw_port)
self._delete_router_port(context, router_id, gw_port,
external_gw=True)
with context.session.begin(subtransactions=True):
context.session.delete(router)
@ -386,9 +387,11 @@ class VyattaVRouterMixin(common_db_mixin.CommonDbMixin,
LOG.debug("Vyatta vRouter Plugin::Delete router port. "
"router: %s; port: %s", router_id, port)
self.driver.deconfigure_interface(
context, router_id, self._get_interface_infos(context.elevated(),
port))
if external_gw:
self.driver.clear_gateway(context, router_id)
else:
self.driver.deconfigure_interface(context, router_id,
self._get_interface_infos(context.elevated(), port))
self._core_plugin.update_port(context.elevated(), port['id'],
{'port': {'device_owner': '',
@ -474,7 +477,7 @@ class VyattaVRouterMixin(common_db_mixin.CommonDbMixin,
router_id=router_id, net_id=router.gw_port['network_id'])
gw_port = router.gw_port
self.driver.clear_gateway(context, router_id)
with context.session.begin(subtransactions=True):
router.gw_port = None
context.session.add(router)

Loading…
Cancel
Save