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 {
.getL3vni(vmPort.tenantId());
// Floating ip BIND
if (type == VtnRscEvent.Type.FLOATINGIP_BIND) {
vPortStore.put(fipPort.portId(), fipPort);
applyNorthSouthL3Flows(deviceId, host, vmPort, fipPort,
floaingIp, l3vni, exPort,
Objective.Operation.ADD);
......@@ -941,6 +942,7 @@ public class VTNManager implements VTNService {
applyNorthSouthL3Flows(deviceId, host, vmPort, fipPort,
floaingIp, l3vni, exPort,
Objective.Operation.REMOVE);
vPortStore.remove(fipPort.portId());
}
}
}
......
......@@ -224,11 +224,6 @@ public class FloatingIpManager implements FloatingIpService {
"FloatingIP ID doesn't exist");
}
FloatingIp floatingIp = floatingIpStore.get(floatingIpId);
if (floatingIp.portId() != null) {
log.debug("The floating Ip is uesd by the port whose identifier is {}",
floatingIp.portId().toString());
return false;
}
floatingIpStore.remove(floatingIpId, floatingIp);
floatingIpBindStore.remove(floatingIpId);
if (floatingIpStore.containsKey(floatingIpId)) {
......@@ -331,6 +326,11 @@ public class FloatingIpManager implements FloatingIpService {
notifyListeners(new FloatingIpEvent(
FloatingIpEvent.Type.FLOATINGIP_DELETE,
floatingIp));
if (floatingIp.portId() != null) {
notifyListeners(new FloatingIpEvent(
FloatingIpEvent.Type.FLOATINGIP_UNBIND,
floatingIp));
}
}
}
}
......