Support for Floating IPs in PLUMgrid plugin

Implements blueprint plumgrid-plugin-floatingip

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

Change-Id: I8ed5e620e45f026e0673be78971329a93353370d
This commit is contained in:
Edgar Magana 2013-08-22 18:42:04 -07:00
parent 4be6b6e697
commit d3765edf04
3 changed files with 85 additions and 0 deletions

View 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

View 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)

View 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
"""