summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarkirat Singh <reachharkirat@gmail.com>2015-06-17 18:47:14 +0530
committerHarkirat Singh <reachharkirat@gmail.com>2015-06-17 18:48:58 +0530
commit17786b869b43b77607ed211890432f4b1c15f472 (patch)
treeed5a59ece4e53847a4924cc23c847a2c035f6d4f
parentf601c0051064c7aab9a2a9eef0ef75cacb616a2a (diff)
fix l3 plugin to work for 5600 router
Notes
Notes (review): Verified+2: Jenkins Code-Review+2: Karthik Natarajan <natarajk@brocade.com> Workflow+1: Karthik Natarajan <natarajk@brocade.com> Submitted-by: Jenkins Submitted-at: Wed, 17 Jun 2015 17:36:44 +0000 Reviewed-on: https://review.openstack.org/192660 Project: stackforge/networking-brocade Branch: refs/heads/master
-rw-r--r--networking_brocade/vyatta/tests/test_vrouter_driver.py2
-rw-r--r--networking_brocade/vyatta/vrouter/client.py11
-rw-r--r--networking_brocade/vyatta/vrouter/neutron_plugin.py13
3 files changed, 18 insertions, 8 deletions
diff --git a/networking_brocade/vyatta/tests/test_vrouter_driver.py b/networking_brocade/vyatta/tests/test_vrouter_driver.py
index ff084a6..0f401b2 100644
--- a/networking_brocade/vyatta/tests/test_vrouter_driver.py
+++ b/networking_brocade/vyatta/tests/test_vrouter_driver.py
@@ -602,7 +602,7 @@ class TestVRouterRestAPIClient(n_base.BaseTestCase,
602 def test_sync_cache(self): 602 def test_sync_cache(self):
603 603
604 client = self._create_client() 604 client = self._create_client()
605 605 client._vrouter_model = client._VROUTER_VSE_MODEL
606 with mock.patch.object( 606 with mock.patch.object(
607 vyatta_client.VRouterRestAPIClient, '_show_cmd') as show_cmd: 607 vyatta_client.VRouterRestAPIClient, '_show_cmd') as show_cmd:
608 show_cmd.return_value = SHOW_CONFIG_OUTPUT 608 show_cmd.return_value = SHOW_CONFIG_OUTPUT
diff --git a/networking_brocade/vyatta/vrouter/client.py b/networking_brocade/vyatta/vrouter/client.py
index 1cfffaf..1bb06a2 100644
--- a/networking_brocade/vyatta/vrouter/client.py
+++ b/networking_brocade/vyatta/vrouter/client.py
@@ -15,6 +15,7 @@
15 15
16import logging 16import logging
17import re 17import re
18import six
18import urllib 19import urllib
19 20
20import netaddr 21import netaddr
@@ -382,7 +383,7 @@ class VRouterRestAPIClient(object):
382 self._external_gw_info = given_gw_info 383 self._external_gw_info = given_gw_info
383 384
384 # Cache the nat rules 385 # Cache the nat rules
385 for router_if_subnet, rule_num in nat_rules.iteritems(): 386 for router_if_subnet, rule_num in six.iteritems(nat_rules):
386 self._router_if_subnet_dict[router_if_subnet] = rule_num 387 self._router_if_subnet_dict[router_if_subnet] = rule_num
387 388
388 def _clear_gw_configuration(self, cmd_list): 389 def _clear_gw_configuration(self, cmd_list):
@@ -968,10 +969,16 @@ class VRouterRestAPIClient(object):
968 969
969 def _process_interfaces(self, search_str, system_gw_ip): 970 def _process_interfaces(self, search_str, system_gw_ip):
970 971
971 for paragraph in search_str.split('}'): 972 if self._vrouter_model == self._VROUTER_VSE_MODEL:
972 ma = re.compile( 973 ma = re.compile(
973 ".+ethernet (eth\d+).+address ([^ \n]+).+description ([^ \n]+)" 974 ".+ethernet (eth\d+).+address ([^ \n]+).+description ([^ \n]+)"
974 ".+", re.DOTALL) 975 ".+", re.DOTALL)
976 else:
977 ma = re.compile(
978 ".+dataplane (dp\d+s\d+).+address ([^ \n]+).+description"
979 " ([^ \n]+).+", re.DOTALL)
980
981 for paragraph in search_str.split('}'):
975 result = ma.match(paragraph) 982 result = ma.match(paragraph)
976 if result is not None: 983 if result is not None:
977 eth_if_id = result.group(1) 984 eth_if_id = result.group(1)
diff --git a/networking_brocade/vyatta/vrouter/neutron_plugin.py b/networking_brocade/vyatta/vrouter/neutron_plugin.py
index 306d19e..413f0a9 100644
--- a/networking_brocade/vyatta/vrouter/neutron_plugin.py
+++ b/networking_brocade/vyatta/vrouter/neutron_plugin.py
@@ -179,7 +179,8 @@ class VyattaVRouterMixin(common_db_mixin.CommonDbMixin,
179 context.session.add(router) 179 context.session.add(router)
180 180
181 if gw_port: 181 if gw_port:
182 self._delete_router_port(context, router_id, gw_port) 182 self._delete_router_port(context, router_id, gw_port,
183 external_gw=True)
183 184
184 with context.session.begin(subtransactions=True): 185 with context.session.begin(subtransactions=True):
185 context.session.delete(router) 186 context.session.delete(router)
@@ -386,9 +387,11 @@ class VyattaVRouterMixin(common_db_mixin.CommonDbMixin,
386 LOG.debug("Vyatta vRouter Plugin::Delete router port. " 387 LOG.debug("Vyatta vRouter Plugin::Delete router port. "
387 "router: %s; port: %s", router_id, port) 388 "router: %s; port: %s", router_id, port)
388 389
389 self.driver.deconfigure_interface( 390 if external_gw:
390 context, router_id, self._get_interface_infos(context.elevated(), 391 self.driver.clear_gateway(context, router_id)
391 port)) 392 else:
393 self.driver.deconfigure_interface(context, router_id,
394 self._get_interface_infos(context.elevated(), port))
392 395
393 self._core_plugin.update_port(context.elevated(), port['id'], 396 self._core_plugin.update_port(context.elevated(), port['id'],
394 {'port': {'device_owner': '', 397 {'port': {'device_owner': '',
@@ -474,7 +477,7 @@ class VyattaVRouterMixin(common_db_mixin.CommonDbMixin,
474 router_id=router_id, net_id=router.gw_port['network_id']) 477 router_id=router_id, net_id=router.gw_port['network_id'])
475 478
476 gw_port = router.gw_port 479 gw_port = router.gw_port
477 self.driver.clear_gateway(context, router_id) 480
478 with context.session.begin(subtransactions=True): 481 with context.session.begin(subtransactions=True):
479 router.gw_port = None 482 router.gw_port = None
480 context.session.add(router) 483 context.session.add(router)