lishuai

[ONOS-3788] Update floatingip's bug:according to our logic, when a

floatingip bind a vm, it can not be deleted and return a error status
code to openstack, but openstack do not deal with the error status code
and delete the floatingip, and this lead to APEX'functiontest does not
pass, so we have modified the code logic and allowed to delete the
floatingip which have bind a vm.

Change-Id: Ic4473ed4ee170be62f95c4168b39a507e6aea8b0
...@@ -933,6 +933,7 @@ public class VTNManager implements VTNService { ...@@ -933,6 +933,7 @@ public class VTNManager implements VTNService {
933 .getL3vni(vmPort.tenantId()); 933 .getL3vni(vmPort.tenantId());
934 // Floating ip BIND 934 // Floating ip BIND
935 if (type == VtnRscEvent.Type.FLOATINGIP_BIND) { 935 if (type == VtnRscEvent.Type.FLOATINGIP_BIND) {
936 + vPortStore.put(fipPort.portId(), fipPort);
936 applyNorthSouthL3Flows(deviceId, host, vmPort, fipPort, 937 applyNorthSouthL3Flows(deviceId, host, vmPort, fipPort,
937 floaingIp, l3vni, exPort, 938 floaingIp, l3vni, exPort,
938 Objective.Operation.ADD); 939 Objective.Operation.ADD);
...@@ -941,6 +942,7 @@ public class VTNManager implements VTNService { ...@@ -941,6 +942,7 @@ public class VTNManager implements VTNService {
941 applyNorthSouthL3Flows(deviceId, host, vmPort, fipPort, 942 applyNorthSouthL3Flows(deviceId, host, vmPort, fipPort,
942 floaingIp, l3vni, exPort, 943 floaingIp, l3vni, exPort,
943 Objective.Operation.REMOVE); 944 Objective.Operation.REMOVE);
945 + vPortStore.remove(fipPort.portId());
944 } 946 }
945 } 947 }
946 } 948 }
......
...@@ -224,11 +224,6 @@ public class FloatingIpManager implements FloatingIpService { ...@@ -224,11 +224,6 @@ public class FloatingIpManager implements FloatingIpService {
224 "FloatingIP ID doesn't exist"); 224 "FloatingIP ID doesn't exist");
225 } 225 }
226 FloatingIp floatingIp = floatingIpStore.get(floatingIpId); 226 FloatingIp floatingIp = floatingIpStore.get(floatingIpId);
227 - if (floatingIp.portId() != null) {
228 - log.debug("The floating Ip is uesd by the port whose identifier is {}",
229 - floatingIp.portId().toString());
230 - return false;
231 - }
232 floatingIpStore.remove(floatingIpId, floatingIp); 227 floatingIpStore.remove(floatingIpId, floatingIp);
233 floatingIpBindStore.remove(floatingIpId); 228 floatingIpBindStore.remove(floatingIpId);
234 if (floatingIpStore.containsKey(floatingIpId)) { 229 if (floatingIpStore.containsKey(floatingIpId)) {
...@@ -331,6 +326,11 @@ public class FloatingIpManager implements FloatingIpService { ...@@ -331,6 +326,11 @@ public class FloatingIpManager implements FloatingIpService {
331 notifyListeners(new FloatingIpEvent( 326 notifyListeners(new FloatingIpEvent(
332 FloatingIpEvent.Type.FLOATINGIP_DELETE, 327 FloatingIpEvent.Type.FLOATINGIP_DELETE,
333 floatingIp)); 328 floatingIp));
329 + if (floatingIp.portId() != null) {
330 + notifyListeners(new FloatingIpEvent(
331 + FloatingIpEvent.Type.FLOATINGIP_UNBIND,
332 + floatingIp));
333 + }
334 } 334 }
335 } 335 }
336 } 336 }
......