]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Support for Floating IPs in PLUMgrid plugin
authorEdgar Magana <emagana@gmail.com>
Fri, 23 Aug 2013 01:42:04 +0000 (18:42 -0700)
committerEdgar Magana <emagana@gmail.com>
Sat, 24 Aug 2013 00:46:13 +0000 (17:46 -0700)
Implements blueprint plumgrid-plugin-floatingip

Include operations supporting create, update and delete of Floating IPs
Drivers been updated properly

Change-Id: I8ed5e620e45f026e0673be78971329a93353370d

neutron/plugins/plumgrid/drivers/fake_plumlib.py
neutron/plugins/plumgrid/drivers/plumlib.py
neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py

index 20dc8c39a23204f7406c79f823ad5f61391fc5e8..3a6445ca5be7d636431ba24f90019e781a67637e 100644 (file)
@@ -77,3 +77,12 @@ class Plumlib():
 
     def remove_router_interface(self, tenant_id, net_id, router_id):
         pass
+
+    def create_floatingip(self, net_db, floating_ip):
+        pass
+
+    def update_floatingip(self, net_db, floating_ip, id):
+        pass
+
+    def delete_floatingip(self, net_db, floating_ip_org, id):
+        pass
index e9ea6c50c6f08e97c2c15a2cef8aabf753a08c84..03aaafa4b4a2eb30a454882761da9565d00939cf 100644 (file)
@@ -83,3 +83,12 @@ class Plumlib(object):
 
     def remove_router_interface(self, tenant_id, net_id, router_id):
         self.plumlib.remove_router_interface(tenant_id, net_id, router_id)
+
+    def create_floatingip(self, net_db, floating_ip):
+        self.plumlib.create_floatingip(net_db, floating_ip)
+
+    def update_floatingip(self, net_db, floating_ip):
+        self.plumlib.update_floatingip(net_db, floating_ip, id)
+
+    def delete_floatingip(self, net_db, floating_ip_org, id):
+        self.plumlib.delete_floatingip(net_db, floating_ip_org, id)
index cd33b707d7f0b74584d84093818b835d127a61c7..1dddf6fb685b36440f3ba28a21cbeb4d4e262bf2 100644 (file)
@@ -241,6 +241,7 @@ class NeutronPluginPLUMgridV2(db_base_plugin_v2.NeutronDbPluginV2,
             # Plugin DB - Port Create and Return port
             port_db = super(NeutronPluginPLUMgridV2,
                             self).get_port(context, port_id)
+            self.disassociate_floatingips(context, port_id)
             super(NeutronPluginPLUMgridV2, self).delete_port(context, port_id)
 
             if port_db["device_owner"] == "network:router_gateway":
@@ -483,6 +484,72 @@ class NeutronPluginPLUMgridV2(db_base_plugin_v2.NeutronDbPluginV2,
 
         return del_int_router
 
+    def create_floatingip(self, context, floatingip):
+        LOG.debug(_("Neutron PLUMgrid Director: create_floatingip() called"))
+
+        with context.session.begin(subtransactions=True):
+
+            floating_ip = super(NeutronPluginPLUMgridV2,
+                                self).create_floatingip(context, floatingip)
+
+            net_id = floating_ip['floating_network_id']
+            net_db = super(NeutronPluginPLUMgridV2,
+                           self).get_network(context, net_id)
+
+            try:
+                LOG.debug(_("PLUMgrid Library: create_floatingip() called"))
+                self._plumlib.create_floatingip(net_db, floating_ip)
+
+            except Exception:
+                LOG.error(ERR_MESSAGE)
+                raise plum_excep.PLUMgridException(err_msg=ERR_MESSAGE)
+
+        return floating_ip
+
+    def update_floatingip(self, context, id, floatingip):
+        LOG.debug(_("Neutron PLUMgrid Director: update_floatingip() called"))
+
+        with context.session.begin(subtransactions=True):
+
+            floating_ip = super(NeutronPluginPLUMgridV2,
+                                self).update_floatingip(context, id,
+                                                        floatingip)
+
+            net_id = floating_ip['floating_network_id']
+            net_db = super(NeutronPluginPLUMgridV2,
+                           self).get_network(context, net_id)
+
+            try:
+                LOG.debug(_("PLUMgrid Library: update_floatingip() called"))
+                self._plumlib.update_floatingip(net_db, floating_ip, id)
+
+            except Exception:
+                LOG.error(ERR_MESSAGE)
+                raise plum_excep.PLUMgridException(err_msg=ERR_MESSAGE)
+
+        return floating_ip
+
+    def delete_floatingip(self, context, id):
+        LOG.debug(_("Neutron PLUMgrid Director: delete_floatingip() called"))
+
+        with context.session.begin(subtransactions=True):
+
+            floating_ip_org = super(NeutronPluginPLUMgridV2,
+                                    self).get_floatingip(context, id)
+
+            net_id = floating_ip_org['floating_network_id']
+            net_db = super(NeutronPluginPLUMgridV2,
+                           self).get_network(context, net_id)
+            super(NeutronPluginPLUMgridV2, self).delete_floatingip(context, id)
+
+            try:
+                LOG.debug(_("PLUMgrid Library: delete_floatingip() called"))
+                self._plumlib.delete_floatingip(net_db, floating_ip_org, id)
+
+            except Exception:
+                LOG.error(ERR_MESSAGE)
+                raise plum_excep.PLUMgridException(err_msg=ERR_MESSAGE)
+
     """
     Internal PLUMgrid Fuctions
     """