commit | 427811e42b2405571b9b3f658334b4e4338d1838 | [log] [tgz] |
---|---|---|
author | Jian Li <pyguni@gmail.com> | Tue Aug 28 17:35:16 2018 +0900 |
committer | Jian Li <pyguni@gmail.com> | Tue Aug 28 09:22:05 2018 +0000 |
tree | 788293edbf6c52c0286d58a5ef0edb059aee4db4 | |
parent | 8d2d1b2cb103f0e6323d017850a5bad1563f30a6 [diff] |
Purge instance port when removing osPort which is not bound to fip Change-Id: I3b4edb9cd447889727c2ea1c3da155a1e97f3f79
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackRoutingFloatingIpHandler.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackRoutingFloatingIpHandler.java index 26be07e..95cdd93 100644 --- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackRoutingFloatingIpHandler.java +++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/impl/OpenstackRoutingFloatingIpHandler.java
@@ -937,9 +937,17 @@ public void event(OpenstackNetworkEvent event) { switch (event.type()) { case OPENSTACK_PORT_PRE_REMOVE: - eventExecutor.execute(() -> - updateFipStore(instancePortService.instancePort(event.port().getId())) - ); + InstancePort instPort = + instancePortService.instancePort(event.port().getId()); + NetFloatingIP fip = + associatedFloatingIp(instPort, osRouterAdminService.floatingIps()); + + if (fip != null) { + eventExecutor.execute(() -> + updateFipStore(instancePortService.instancePort(event.port().getId()))); + } else { + instancePortService.removeInstancePort(instPort.portId()); + } break; default: break;