Browse Source

fix l3 plugin to work for 5600 router

Change-Id: Ie32b8c9dcadd8b9bf6996a211f2069c95de42f45
tags/kilo-eol
Harkirat Singh 4 years ago
parent
commit
17786b869b

+ 1
- 1
networking_brocade/vyatta/tests/test_vrouter_driver.py View File

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

+ 9
- 2
networking_brocade/vyatta/vrouter/client.py View File

@@ -15,6 +15,7 @@
15 15
 
16 16
 import logging
17 17
 import re
18
+import six
18 19
 import urllib
19 20
 
20 21
 import netaddr
@@ -382,7 +383,7 @@ class VRouterRestAPIClient(object):
382 383
         self._external_gw_info = given_gw_info
383 384
 
384 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 387
             self._router_if_subnet_dict[router_if_subnet] = rule_num
387 388
 
388 389
     def _clear_gw_configuration(self, cmd_list):
@@ -968,10 +969,16 @@ class VRouterRestAPIClient(object):
968 969
 
969 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 973
             ma = re.compile(
973 974
                 ".+ethernet (eth\d+).+address ([^ \n]+).+description ([^ \n]+)"
974 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 982
             result = ma.match(paragraph)
976 983
             if result is not None:
977 984
                 eth_if_id = result.group(1)

+ 8
- 5
networking_brocade/vyatta/vrouter/neutron_plugin.py View File

@@ -179,7 +179,8 @@ class VyattaVRouterMixin(common_db_mixin.CommonDbMixin,
179 179
                 context.session.add(router)
180 180
 
181 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 185
         with context.session.begin(subtransactions=True):
185 186
             context.session.delete(router)
@@ -386,9 +387,11 @@ class VyattaVRouterMixin(common_db_mixin.CommonDbMixin,
386 387
         LOG.debug("Vyatta vRouter Plugin::Delete router port. "
387 388
                   "router: %s; port: %s", router_id, port)
388 389
 
389
-        self.driver.deconfigure_interface(
390
-            context, router_id, self._get_interface_infos(context.elevated(),
391
-                                                          port))
390
+        if external_gw:
391
+            self.driver.clear_gateway(context, router_id)
392
+        else:
393
+            self.driver.deconfigure_interface(context, router_id,
394
+                        self._get_interface_infos(context.elevated(), port))
392 395
 
393 396
         self._core_plugin.update_port(context.elevated(), port['id'],
394 397
                                       {'port': {'device_owner': '',
@@ -474,7 +477,7 @@ class VyattaVRouterMixin(common_db_mixin.CommonDbMixin,
474 477
                 router_id=router_id, net_id=router.gw_port['network_id'])
475 478
 
476 479
         gw_port = router.gw_port
477
-        self.driver.clear_gateway(context, router_id)
480
+
478 481
         with context.session.begin(subtransactions=True):
479 482
             router.gw_port = None
480 483
             context.session.add(router)

Loading…
Cancel
Save