Committed by
Gerrit Code Review
[ONOS-3659] Submit the modified content of onos-1.4 to onos-master.
Change-Id: Ibdb9897cde6bc7622276178a6087f02c49da2a48
Showing
6 changed files
with
84 additions
and
31 deletions
| ... | @@ -20,6 +20,7 @@ import java.util.Iterator; | ... | @@ -20,6 +20,7 @@ import java.util.Iterator; |
| 20 | import org.onlab.packet.MacAddress; | 20 | import org.onlab.packet.MacAddress; |
| 21 | import org.onosproject.net.Device; | 21 | import org.onosproject.net.Device; |
| 22 | import org.onosproject.net.DeviceId; | 22 | import org.onosproject.net.DeviceId; |
| 23 | +import org.onosproject.net.Host; | ||
| 23 | import org.onosproject.net.HostId; | 24 | import org.onosproject.net.HostId; |
| 24 | import org.onosproject.vtnrsc.SegmentationId; | 25 | import org.onosproject.vtnrsc.SegmentationId; |
| 25 | import org.onosproject.vtnrsc.TenantId; | 26 | import org.onosproject.vtnrsc.TenantId; |
| ... | @@ -69,4 +70,14 @@ public class VtnRscManagerTestImpl implements VtnRscService { | ... | @@ -69,4 +70,14 @@ public class VtnRscManagerTestImpl implements VtnRscService { |
| 69 | public DeviceId getSFToSFFMaping(VirtualPortId portId) { | 70 | public DeviceId getSFToSFFMaping(VirtualPortId portId) { |
| 70 | return DeviceId.deviceId("www.google.com"); | 71 | return DeviceId.deviceId("www.google.com"); |
| 71 | } | 72 | } |
| 73 | + | ||
| 74 | + @Override | ||
| 75 | + public void addDeviceIdOfOvsMap(VirtualPortId virtualPortId, | ||
| 76 | + TenantId tenantId, DeviceId deviceId) { | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + @Override | ||
| 80 | + public void removeDeviceIdOfOvsMap(Host host, TenantId tenantId, | ||
| 81 | + DeviceId deviceId) { | ||
| 82 | + } | ||
| 72 | } | 83 | } | ... | ... |
| ... | @@ -19,6 +19,7 @@ import static org.onosproject.net.flow.instructions.ExtensionTreatmentType.Exten | ... | @@ -19,6 +19,7 @@ import static org.onosproject.net.flow.instructions.ExtensionTreatmentType.Exten |
| 19 | import static org.slf4j.LoggerFactory.getLogger; | 19 | import static org.slf4j.LoggerFactory.getLogger; |
| 20 | 20 | ||
| 21 | import java.util.ArrayList; | 21 | import java.util.ArrayList; |
| 22 | +import java.util.Arrays; | ||
| 22 | import java.util.Collection; | 23 | import java.util.Collection; |
| 23 | import java.util.HashMap; | 24 | import java.util.HashMap; |
| 24 | import java.util.HashSet; | 25 | import java.util.HashSet; |
| ... | @@ -75,9 +76,12 @@ import org.onosproject.net.host.HostEvent; | ... | @@ -75,9 +76,12 @@ import org.onosproject.net.host.HostEvent; |
| 75 | import org.onosproject.net.host.HostListener; | 76 | import org.onosproject.net.host.HostListener; |
| 76 | import org.onosproject.net.host.HostService; | 77 | import org.onosproject.net.host.HostService; |
| 77 | import org.onosproject.store.serializers.KryoNamespaces; | 78 | import org.onosproject.store.serializers.KryoNamespaces; |
| 79 | +import org.onosproject.store.service.ConsistentMap; | ||
| 78 | import org.onosproject.store.service.EventuallyConsistentMap; | 80 | import org.onosproject.store.service.EventuallyConsistentMap; |
| 79 | import org.onosproject.store.service.LogicalClockService; | 81 | import org.onosproject.store.service.LogicalClockService; |
| 82 | +import org.onosproject.store.service.Serializer; | ||
| 80 | import org.onosproject.store.service.StorageService; | 83 | import org.onosproject.store.service.StorageService; |
| 84 | +import org.onosproject.store.service.Versioned; | ||
| 81 | import org.onosproject.vtn.manager.VTNService; | 85 | import org.onosproject.vtn.manager.VTNService; |
| 82 | import org.onosproject.vtn.table.ArpService; | 86 | import org.onosproject.vtn.table.ArpService; |
| 83 | import org.onosproject.vtn.table.ClassifierService; | 87 | import org.onosproject.vtn.table.ClassifierService; |
| ... | @@ -188,7 +192,7 @@ public class VTNManager implements VTNService { | ... | @@ -188,7 +192,7 @@ public class VTNManager implements VTNService { |
| 188 | private final DeviceListener deviceListener = new InnerDeviceListener(); | 192 | private final DeviceListener deviceListener = new InnerDeviceListener(); |
| 189 | private final VtnRscListener l3EventListener = new VtnL3EventListener(); | 193 | private final VtnRscListener l3EventListener = new VtnL3EventListener(); |
| 190 | 194 | ||
| 191 | - private static String exPortName = "eth0"; | 195 | + private static final String EX_PORT_KEY = "exPortKey"; |
| 192 | private static final String IFACEID = "ifaceid"; | 196 | private static final String IFACEID = "ifaceid"; |
| 193 | private static final String CONTROLLER_IP_KEY = "ipaddress"; | 197 | private static final String CONTROLLER_IP_KEY = "ipaddress"; |
| 194 | public static final String DRIVER_NAME = "onosfw"; | 198 | public static final String DRIVER_NAME = "onosfw"; |
| ... | @@ -198,6 +202,7 @@ public class VTNManager implements VTNService { | ... | @@ -198,6 +202,7 @@ public class VTNManager implements VTNService { |
| 198 | private static final String ROUTERINF_FLAG_OF_TENANT = "routerInfFlagOfTenant"; | 202 | private static final String ROUTERINF_FLAG_OF_TENANT = "routerInfFlagOfTenant"; |
| 199 | private static final String HOSTS_OF_SUBNET = "hostsOfSubnet"; | 203 | private static final String HOSTS_OF_SUBNET = "hostsOfSubnet"; |
| 200 | private static final String EX_PORT_OF_DEVICE = "exPortOfDevice"; | 204 | private static final String EX_PORT_OF_DEVICE = "exPortOfDevice"; |
| 205 | + private static final String EX_PORT_MAP = "exPortMap"; | ||
| 201 | private static final String DEFAULT_IP = "0.0.0.0"; | 206 | private static final String DEFAULT_IP = "0.0.0.0"; |
| 202 | private static final int SUBNET_NUM = 2; | 207 | private static final int SUBNET_NUM = 2; |
| 203 | 208 | ||
| ... | @@ -207,6 +212,7 @@ public class VTNManager implements VTNService { | ... | @@ -207,6 +212,7 @@ public class VTNManager implements VTNService { |
| 207 | private EventuallyConsistentMap<SubnetId, Map<HostId, Host>> hostsOfSubnet; | 212 | private EventuallyConsistentMap<SubnetId, Map<HostId, Host>> hostsOfSubnet; |
| 208 | private EventuallyConsistentMap<TenantId, Boolean> routerInfFlagOfTenant; | 213 | private EventuallyConsistentMap<TenantId, Boolean> routerInfFlagOfTenant; |
| 209 | private EventuallyConsistentMap<DeviceId, Port> exPortOfDevice; | 214 | private EventuallyConsistentMap<DeviceId, Port> exPortOfDevice; |
| 215 | + private static ConsistentMap<String, String> exPortMap; | ||
| 210 | 216 | ||
| 211 | @Activate | 217 | @Activate |
| 212 | public void activate() { | 218 | public void activate() { |
| ... | @@ -275,6 +281,14 @@ public class VTNManager implements VTNService { | ... | @@ -275,6 +281,14 @@ public class VTNManager implements VTNService { |
| 275 | .withTimestampProvider((k, v) -> clockService.getTimestamp()) | 281 | .withTimestampProvider((k, v) -> clockService.getTimestamp()) |
| 276 | .build(); | 282 | .build(); |
| 277 | 283 | ||
| 284 | + exPortMap = storageService | ||
| 285 | + .<String, String>consistentMapBuilder() | ||
| 286 | + .withName(EX_PORT_MAP) | ||
| 287 | + .withApplicationId(appId) | ||
| 288 | + .withPurgeOnUninstall() | ||
| 289 | + .withSerializer(Serializer.using(Arrays.asList(KryoNamespaces.API))) | ||
| 290 | + .build(); | ||
| 291 | + | ||
| 278 | log.info("Started"); | 292 | log.info("Started"); |
| 279 | } | 293 | } |
| 280 | 294 | ||
| ... | @@ -310,8 +324,11 @@ public class VTNManager implements VTNService { | ... | @@ -310,8 +324,11 @@ public class VTNManager implements VTNService { |
| 310 | config.driver(DRIVER_NAME); | 324 | config.driver(DRIVER_NAME); |
| 311 | configService.applyConfig(deviceId, BasicDeviceConfig.class, config.node()); | 325 | configService.applyConfig(deviceId, BasicDeviceConfig.class, config.node()); |
| 312 | // Add Bridge | 326 | // Add Bridge |
| 313 | - VtnConfig.applyBridgeConfig(handler, dpid, exPortName); | 327 | + Versioned<String> exPortVersioned = exPortMap.get(EX_PORT_KEY); |
| 328 | + if (exPortVersioned != null) { | ||
| 329 | + VtnConfig.applyBridgeConfig(handler, dpid, exPortVersioned.value()); | ||
| 314 | log.info("A new ovs is created in node {}", localIp.toString()); | 330 | log.info("A new ovs is created in node {}", localIp.toString()); |
| 331 | + } | ||
| 315 | switchesOfController.put(localIp, true); | 332 | switchesOfController.put(localIp, true); |
| 316 | } | 333 | } |
| 317 | // Create tunnel in br-int on all controllers | 334 | // Create tunnel in br-int on all controllers |
| ... | @@ -330,8 +347,6 @@ public class VTNManager implements VTNService { | ... | @@ -330,8 +347,6 @@ public class VTNManager implements VTNService { |
| 330 | if (mastershipService.isLocalMaster(controllerDeviceId)) { | 347 | if (mastershipService.isLocalMaster(controllerDeviceId)) { |
| 331 | switchesOfController.remove(dstIpAddress); | 348 | switchesOfController.remove(dstIpAddress); |
| 332 | } | 349 | } |
| 333 | - // remove tunnel in br-int on other controllers | ||
| 334 | - programTunnelConfig(controllerDeviceId, dstIpAddress, null); | ||
| 335 | } | 350 | } |
| 336 | 351 | ||
| 337 | @Override | 352 | @Override |
| ... | @@ -357,6 +372,7 @@ public class VTNManager implements VTNService { | ... | @@ -357,6 +372,7 @@ public class VTNManager implements VTNService { |
| 357 | log.error("The ifaceId of Host is null"); | 372 | log.error("The ifaceId of Host is null"); |
| 358 | return; | 373 | return; |
| 359 | } | 374 | } |
| 375 | + programSffAndClassifierHost(host, Objective.Operation.ADD); | ||
| 360 | // apply L2 openflow rules | 376 | // apply L2 openflow rules |
| 361 | applyHostMonitoredL2Rules(host, Objective.Operation.ADD); | 377 | applyHostMonitoredL2Rules(host, Objective.Operation.ADD); |
| 362 | // apply L3 openflow rules | 378 | // apply L3 openflow rules |
| ... | @@ -374,6 +390,7 @@ public class VTNManager implements VTNService { | ... | @@ -374,6 +390,7 @@ public class VTNManager implements VTNService { |
| 374 | log.error("The ifaceId of Host is null"); | 390 | log.error("The ifaceId of Host is null"); |
| 375 | return; | 391 | return; |
| 376 | } | 392 | } |
| 393 | + programSffAndClassifierHost(host, Objective.Operation.REMOVE); | ||
| 377 | // apply L2 openflow rules | 394 | // apply L2 openflow rules |
| 378 | applyHostMonitoredL2Rules(host, Objective.Operation.REMOVE); | 395 | applyHostMonitoredL2Rules(host, Objective.Operation.REMOVE); |
| 379 | // apply L3 openflow rules | 396 | // apply L3 openflow rules |
| ... | @@ -463,6 +480,22 @@ public class VTNManager implements VTNService { | ... | @@ -463,6 +480,22 @@ public class VTNManager implements VTNService { |
| 463 | } | 480 | } |
| 464 | } | 481 | } |
| 465 | 482 | ||
| 483 | + private void programSffAndClassifierHost(Host host, Objective.Operation type) { | ||
| 484 | + DeviceId deviceId = host.location().deviceId(); | ||
| 485 | + String ifaceId = host.annotations().value(IFACEID); | ||
| 486 | + VirtualPortId virtualPortId = VirtualPortId.portId(ifaceId); | ||
| 487 | + VirtualPort virtualPort = virtualPortService.getPort(virtualPortId); | ||
| 488 | + if (virtualPort == null) { | ||
| 489 | + virtualPort = VtnData.getPort(vPortStore, virtualPortId); | ||
| 490 | + } | ||
| 491 | + TenantId tenantId = virtualPort.tenantId(); | ||
| 492 | + if (Objective.Operation.ADD == type) { | ||
| 493 | + vtnRscService.addDeviceIdOfOvsMap(virtualPortId, tenantId, deviceId); | ||
| 494 | + } else if (Objective.Operation.REMOVE == type) { | ||
| 495 | + vtnRscService.removeDeviceIdOfOvsMap(host, tenantId, deviceId); | ||
| 496 | + } | ||
| 497 | + } | ||
| 498 | + | ||
| 466 | private void applyHostMonitoredL2Rules(Host host, Objective.Operation type) { | 499 | private void applyHostMonitoredL2Rules(Host host, Objective.Operation type) { |
| 467 | DeviceId deviceId = host.location().deviceId(); | 500 | DeviceId deviceId = host.location().deviceId(); |
| 468 | if (!mastershipService.isLocalMaster(deviceId)) { | 501 | if (!mastershipService.isLocalMaster(deviceId)) { |
| ... | @@ -971,7 +1004,9 @@ public class VTNManager implements VTNService { | ... | @@ -971,7 +1004,9 @@ public class VTNManager implements VTNService { |
| 971 | Port exPort = null; | 1004 | Port exPort = null; |
| 972 | for (Port port : ports) { | 1005 | for (Port port : ports) { |
| 973 | String portName = port.annotations().value(AnnotationKeys.PORT_NAME); | 1006 | String portName = port.annotations().value(AnnotationKeys.PORT_NAME); |
| 974 | - if (portName != null && portName.equals(exPortName)) { | 1007 | + Versioned<String> exPortVersioned = exPortMap.get(EX_PORT_KEY); |
| 1008 | + if (portName != null && exPortVersioned != null && portName. | ||
| 1009 | + equals(exPortVersioned.value())) { | ||
| 975 | exPort = port; | 1010 | exPort = port; |
| 976 | break; | 1011 | break; |
| 977 | } | 1012 | } |
| ... | @@ -1071,6 +1106,6 @@ public class VTNManager implements VTNService { | ... | @@ -1071,6 +1106,6 @@ public class VTNManager implements VTNService { |
| 1071 | } | 1106 | } |
| 1072 | 1107 | ||
| 1073 | public static void setExPortName(String name) { | 1108 | public static void setExPortName(String name) { |
| 1074 | - exPortName = name; | 1109 | + exPortMap.put(EX_PORT_KEY, name); |
| 1075 | } | 1110 | } |
| 1076 | } | 1111 | } | ... | ... |
| ... | @@ -176,24 +176,12 @@ public class FloatingIpManager implements FloatingIpService { | ... | @@ -176,24 +176,12 @@ public class FloatingIpManager implements FloatingIpService { |
| 176 | boolean result = true; | 176 | boolean result = true; |
| 177 | for (FloatingIp floatingIp : floatingIps) { | 177 | for (FloatingIp floatingIp : floatingIps) { |
| 178 | verifyFloatingIpData(floatingIp); | 178 | verifyFloatingIpData(floatingIp); |
| 179 | - if (floatingIp.portId() != null) { | ||
| 180 | floatingIpStore.put(floatingIp.id(), floatingIp); | 179 | floatingIpStore.put(floatingIp.id(), floatingIp); |
| 181 | if (!floatingIpStore.containsKey(floatingIp.id())) { | 180 | if (!floatingIpStore.containsKey(floatingIp.id())) { |
| 182 | log.debug("The floating Ip is created failed whose identifier is {}", | 181 | log.debug("The floating Ip is created failed whose identifier is {}", |
| 183 | floatingIp.id().toString()); | 182 | floatingIp.id().toString()); |
| 184 | result = false; | 183 | result = false; |
| 185 | } | 184 | } |
| 186 | - } else { | ||
| 187 | - FloatingIp oldFloatingIp = floatingIpStore.get(floatingIp.id()); | ||
| 188 | - if (oldFloatingIp != null) { | ||
| 189 | - floatingIpStore.remove(floatingIp.id(), oldFloatingIp); | ||
| 190 | - if (floatingIpStore.containsKey(floatingIp.id())) { | ||
| 191 | - log.debug("The floating Ip is created failed whose identifier is {}", | ||
| 192 | - floatingIp.id().toString()); | ||
| 193 | - result = false; | ||
| 194 | - } | ||
| 195 | - } | ||
| 196 | - } | ||
| 197 | } | 185 | } |
| 198 | return result; | 186 | return result; |
| 199 | } | 187 | } |
| ... | @@ -204,24 +192,12 @@ public class FloatingIpManager implements FloatingIpService { | ... | @@ -204,24 +192,12 @@ public class FloatingIpManager implements FloatingIpService { |
| 204 | boolean result = true; | 192 | boolean result = true; |
| 205 | for (FloatingIp floatingIp : floatingIps) { | 193 | for (FloatingIp floatingIp : floatingIps) { |
| 206 | verifyFloatingIpData(floatingIp); | 194 | verifyFloatingIpData(floatingIp); |
| 207 | - if (floatingIp.portId() != null) { | ||
| 208 | floatingIpStore.put(floatingIp.id(), floatingIp); | 195 | floatingIpStore.put(floatingIp.id(), floatingIp); |
| 209 | if (!floatingIpStore.containsKey(floatingIp.id())) { | 196 | if (!floatingIpStore.containsKey(floatingIp.id())) { |
| 210 | log.debug("The floating Ip is updated failed whose identifier is {}", | 197 | log.debug("The floating Ip is updated failed whose identifier is {}", |
| 211 | floatingIp.id().toString()); | 198 | floatingIp.id().toString()); |
| 212 | result = false; | 199 | result = false; |
| 213 | } | 200 | } |
| 214 | - } else { | ||
| 215 | - FloatingIp oldFloatingIp = floatingIpStore.get(floatingIp.id()); | ||
| 216 | - if (oldFloatingIp != null) { | ||
| 217 | - floatingIpStore.remove(floatingIp.id(), oldFloatingIp); | ||
| 218 | - if (floatingIpStore.containsKey(floatingIp.id())) { | ||
| 219 | - log.debug("The floating Ip is updated failed whose identifier is {}", | ||
| 220 | - floatingIp.id().toString()); | ||
| 221 | - result = false; | ||
| 222 | - } | ||
| 223 | - } | ||
| 224 | - } | ||
| 225 | } | 201 | } |
| 226 | return result; | 202 | return result; |
| 227 | } | 203 | } |
| ... | @@ -238,6 +214,11 @@ public class FloatingIpManager implements FloatingIpService { | ... | @@ -238,6 +214,11 @@ public class FloatingIpManager implements FloatingIpService { |
| 238 | "FloatingIP ID doesn't exist"); | 214 | "FloatingIP ID doesn't exist"); |
| 239 | } | 215 | } |
| 240 | FloatingIp floatingIp = floatingIpStore.get(floatingIpId); | 216 | FloatingIp floatingIp = floatingIpStore.get(floatingIpId); |
| 217 | + if (floatingIp.portId() != null) { | ||
| 218 | + log.debug("The floating Ip is uesd by the port whose identifier is {}", | ||
| 219 | + floatingIp.portId().toString()); | ||
| 220 | + return false; | ||
| 221 | + } | ||
| 241 | floatingIpStore.remove(floatingIpId, floatingIp); | 222 | floatingIpStore.remove(floatingIpId, floatingIp); |
| 242 | if (floatingIpStore.containsKey(floatingIpId)) { | 223 | if (floatingIpStore.containsKey(floatingIpId)) { |
| 243 | log.debug("The floating Ip is deleted failed whose identifier is {}", | 224 | log.debug("The floating Ip is deleted failed whose identifier is {}", | ... | ... |
| ... | @@ -21,6 +21,7 @@ import org.onlab.packet.MacAddress; | ... | @@ -21,6 +21,7 @@ import org.onlab.packet.MacAddress; |
| 21 | import org.onosproject.event.ListenerService; | 21 | import org.onosproject.event.ListenerService; |
| 22 | import org.onosproject.net.Device; | 22 | import org.onosproject.net.Device; |
| 23 | import org.onosproject.net.DeviceId; | 23 | import org.onosproject.net.DeviceId; |
| 24 | +import org.onosproject.net.Host; | ||
| 24 | import org.onosproject.net.HostId; | 25 | import org.onosproject.net.HostId; |
| 25 | import org.onosproject.vtnrsc.SegmentationId; | 26 | import org.onosproject.vtnrsc.SegmentationId; |
| 26 | import org.onosproject.vtnrsc.TenantId; | 27 | import org.onosproject.vtnrsc.TenantId; |
| ... | @@ -79,4 +80,24 @@ public interface VtnRscService extends ListenerService<VtnRscEvent, VtnRscListen | ... | @@ -79,4 +80,24 @@ public interface VtnRscService extends ListenerService<VtnRscEvent, VtnRscListen |
| 79 | * @return device identifier | 80 | * @return device identifier |
| 80 | */ | 81 | */ |
| 81 | DeviceId getSFToSFFMaping(VirtualPortId portId); | 82 | DeviceId getSFToSFFMaping(VirtualPortId portId); |
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * Adds specify Device identifier to Service Function Forward OvsMap | ||
| 86 | + * or Classifier OvsMap. | ||
| 87 | + * | ||
| 88 | + * @param virtualPortId the VirtualPort identifier | ||
| 89 | + * @param tenantId the tenant identifier | ||
| 90 | + * @param deviceId the device identifier | ||
| 91 | + */ | ||
| 92 | + void addDeviceIdOfOvsMap(VirtualPortId virtualPortId, TenantId tenantId, DeviceId deviceId); | ||
| 93 | + | ||
| 94 | + /** | ||
| 95 | + * Removes specify Device identifier from Service Function Forward OvsMap | ||
| 96 | + * or Classifier OvsMap. | ||
| 97 | + * | ||
| 98 | + * @param host Host | ||
| 99 | + * @param tenantId the tenant identifier | ||
| 100 | + * @param deviceId the device identifier | ||
| 101 | + */ | ||
| 102 | + void removeDeviceIdOfOvsMap(Host host, TenantId tenantId, DeviceId deviceId); | ||
| 82 | } | 103 | } | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -70,6 +70,7 @@ public class FloatingIpWebResource extends AbstractWebResource { | ... | @@ -70,6 +70,7 @@ public class FloatingIpWebResource extends AbstractWebResource { |
| 70 | .getLogger(FloatingIpWebResource.class); | 70 | .getLogger(FloatingIpWebResource.class); |
| 71 | public static final String CREATE_FAIL = "Floating IP is failed to create!"; | 71 | public static final String CREATE_FAIL = "Floating IP is failed to create!"; |
| 72 | public static final String UPDATE_FAIL = "Floating IP is failed to update!"; | 72 | public static final String UPDATE_FAIL = "Floating IP is failed to update!"; |
| 73 | + public static final String DELETE_FAIL = "Floating IP is failed to delete!"; | ||
| 73 | public static final String GET_FAIL = "Floating IP is failed to get!"; | 74 | public static final String GET_FAIL = "Floating IP is failed to get!"; |
| 74 | public static final String NOT_EXIST = "Floating IP does not exist!"; | 75 | public static final String NOT_EXIST = "Floating IP does not exist!"; |
| 75 | public static final String DELETE_SUCCESS = "Floating IP delete success!"; | 76 | public static final String DELETE_SUCCESS = "Floating IP delete success!"; |
| ... | @@ -157,7 +158,11 @@ public class FloatingIpWebResource extends AbstractWebResource { | ... | @@ -157,7 +158,11 @@ public class FloatingIpWebResource extends AbstractWebResource { |
| 157 | try { | 158 | try { |
| 158 | FloatingIpId floatingIpId = FloatingIpId.of(id); | 159 | FloatingIpId floatingIpId = FloatingIpId.of(id); |
| 159 | Set<FloatingIpId> floatingIpIds = Sets.newHashSet(floatingIpId); | 160 | Set<FloatingIpId> floatingIpIds = Sets.newHashSet(floatingIpId); |
| 160 | - get(FloatingIpService.class).removeFloatingIps(floatingIpIds); | 161 | + Boolean result = nullIsNotFound(get(FloatingIpService.class) |
| 162 | + .removeFloatingIps(floatingIpIds), DELETE_FAIL); | ||
| 163 | + if (!result) { | ||
| 164 | + return Response.status(CONFLICT).entity(DELETE_FAIL).build(); | ||
| 165 | + } | ||
| 161 | return Response.status(NO_CONTENT).entity(DELETE_SUCCESS).build(); | 166 | return Response.status(NO_CONTENT).entity(DELETE_SUCCESS).build(); |
| 162 | } catch (Exception e) { | 167 | } catch (Exception e) { |
| 163 | return Response.status(NOT_FOUND).entity(e.getMessage()).build(); | 168 | return Response.status(NOT_FOUND).entity(e.getMessage()).build(); | ... | ... |
-
Please register or login to post a comment