]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Add l3 attribute to network
authorKanzhe Jiang <kanzhe@gmail.com>
Fri, 17 May 2013 21:35:29 +0000 (14:35 -0700)
committerKanzhe Jiang <kanzhe@gmail.com>
Fri, 17 May 2013 22:52:17 +0000 (15:52 -0700)
The fix is to add l3 attribute(s) to the returned objects in get_network() and get_networks()

Fixes: bug #1180971
Change-Id: I4b9c932fae90a169ad1c0119f45e90a2ee260acd

quantum/plugins/bigswitch/plugin.py

index 4d9a5eefcc2b0b4f856cfbfc332d7dcc76b7775f..4477250873978fdf58c88301e00cc7c6ee2e74f5 100644 (file)
@@ -486,6 +486,27 @@ class QuantumRestProxyV2(db_base_plugin_v2.QuantumDbPluginV2,
                         "network: %s"), e.message)
             raise
 
+    def get_network(self, context, id, fields=None):
+        session = context.session
+        with session.begin(subtransactions=True):
+            net = super(QuantumRestProxyV2, self).get_network(context,
+                                                              id, None)
+            self._extend_network_dict_l3(context, net)
+        return self._fields(net, fields)
+
+    def get_networks(self, context, filters=None, fields=None,
+                     sorts=None,
+                     limit=None, marker=None, page_reverse=False):
+        session = context.session
+        with session.begin(subtransactions=True):
+            nets = super(QuantumRestProxyV2,
+                         self).get_networks(context, filters, None, sorts,
+                                            limit, marker, page_reverse)
+            for net in nets:
+                self._extend_network_dict_l3(context, net)
+
+        return [self._fields(net, fields) for net in nets]
+
     def create_port(self, context, port):
         """Create a port, which is a connection point of a device
         (e.g., a VM NIC) to attach to a L2 Quantum network.