Sho SHIMIZU
Committed by Ray Milkey

Simplify lambda expression by removing braces

Change-Id: Ifb8d1a3e465fc8de9737a8834ceb07c89dfb8029
...@@ -289,12 +289,10 @@ public class VTNManager implements VTNService { ...@@ -289,12 +289,10 @@ public class VTNManager implements VTNService {
289 ports.stream() 289 ports.stream()
290 .filter(p -> p.name() 290 .filter(p -> p.name()
291 .equalsIgnoreCase(tunnelName)) 291 .equalsIgnoreCase(tunnelName))
292 - .forEach(p -> { 292 + .forEach(p -> programTunnelOut(sw.deviceId(),
293 - programTunnelOut(sw.deviceId(), 293 + network.segmentationId(), p,
294 - network.segmentationId(), p, 294 + host.mac(), appId,
295 - host.mac(), appId, 295 + Objective.Operation.ADD));
296 - Objective.Operation.ADD);
297 - });
298 } 296 }
299 }); 297 });
300 programLocalIn(deviceId, network.segmentationId(), inPort, host.mac(), 298 programLocalIn(deviceId, network.segmentationId(), inPort, host.mac(),
...@@ -355,12 +353,10 @@ public class VTNManager implements VTNService { ...@@ -355,12 +353,10 @@ public class VTNManager implements VTNService {
355 ports.stream() 353 ports.stream()
356 .filter(p -> p.name() 354 .filter(p -> p.name()
357 .equalsIgnoreCase(tunnelName)) 355 .equalsIgnoreCase(tunnelName))
358 - .forEach(p -> { 356 + .forEach(p -> programTunnelOut(sw.deviceId(),
359 - programTunnelOut(sw.deviceId(), 357 + segId, p,
360 - segId, p, 358 + host.mac(), appId,
361 - host.mac(), appId, 359 + Objective.Operation.REMOVE));
362 - Objective.Operation.REMOVE);
363 - });
364 } 360 }
365 }); 361 });
366 programLocalIn(deviceId, segId, inPort, host.mac(), 362 programLocalIn(deviceId, segId, inPort, host.mac(),
...@@ -379,26 +375,18 @@ public class VTNManager implements VTNService { ...@@ -379,26 +375,18 @@ public class VTNManager implements VTNService {
379 Device device = event.subject(); 375 Device device = event.subject();
380 if (Device.Type.CONTROLLER == device.type() 376 if (Device.Type.CONTROLLER == device.type()
381 && DeviceEvent.Type.DEVICE_ADDED == event.type()) { 377 && DeviceEvent.Type.DEVICE_ADDED == event.type()) {
382 - backgroundService.execute(() -> { 378 + backgroundService.execute(() -> onServerDetected(device));
383 - onServerDetected(device);
384 - });
385 } else if (Device.Type.CONTROLLER == device.type() 379 } else if (Device.Type.CONTROLLER == device.type()
386 && DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED == event 380 && DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED == event
387 .type()) { 381 .type()) {
388 - backgroundService.execute(() -> { 382 + backgroundService.execute(() -> onServerVanished(device));
389 - onServerVanished(device);
390 - });
391 } else if (Device.Type.SWITCH == device.type() 383 } else if (Device.Type.SWITCH == device.type()
392 && DeviceEvent.Type.DEVICE_ADDED == event.type()) { 384 && DeviceEvent.Type.DEVICE_ADDED == event.type()) {
393 - backgroundService.execute(() -> { 385 + backgroundService.execute(() -> onOvsDetected(device));
394 - onOvsDetected(device);
395 - });
396 } else if (Device.Type.SWITCH == device.type() 386 } else if (Device.Type.SWITCH == device.type()
397 && DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED == event 387 && DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED == event
398 .type()) { 388 .type()) {
399 - backgroundService.execute(() -> { 389 + backgroundService.execute(() -> onOvsVanished(device));
400 - onOvsVanished(device);
401 - });
402 } else { 390 } else {
403 log.info("Do nothing for this device type"); 391 log.info("Do nothing for this device type");
404 } 392 }
...@@ -412,13 +400,9 @@ public class VTNManager implements VTNService { ...@@ -412,13 +400,9 @@ public class VTNManager implements VTNService {
412 public void event(HostEvent event) { 400 public void event(HostEvent event) {
413 Host host = event.subject(); 401 Host host = event.subject();
414 if (HostEvent.Type.HOST_ADDED == event.type()) { 402 if (HostEvent.Type.HOST_ADDED == event.type()) {
415 - backgroundService.execute(() -> { 403 + backgroundService.execute(() -> onHostDetected(host));
416 - onHostDetected(host);
417 - });
418 } else if (HostEvent.Type.HOST_REMOVED == event.type()) { 404 } else if (HostEvent.Type.HOST_REMOVED == event.type()) {
419 - backgroundService.execute(() -> { 405 + backgroundService.execute(() -> onHostVanished(host));
420 - onHostVanished(host);
421 - });
422 } else if (HostEvent.Type.HOST_UPDATED == event.type()) { 406 } else if (HostEvent.Type.HOST_UPDATED == event.type()) {
423 backgroundService.execute(() -> { 407 backgroundService.execute(() -> {
424 onHostVanished(host); 408 onHostVanished(host);
......
...@@ -375,14 +375,10 @@ public class SimpleMastershipStore ...@@ -375,14 +375,10 @@ public class SimpleMastershipStore
375 .filter(entry -> entry.getValue().contains(nodeId)) 375 .filter(entry -> entry.getValue().contains(nodeId))
376 .forEach(entry -> toRelinquish.add(entry.getKey())); 376 .forEach(entry -> toRelinquish.add(entry.getKey()));
377 377
378 - toRelinquish.forEach(deviceId -> { 378 + toRelinquish.forEach(deviceId -> eventFutures.add(relinquishRole(nodeId, deviceId)));
379 - eventFutures.add(relinquishRole(nodeId, deviceId));
380 - });
381 379
382 eventFutures.forEach(future -> { 380 eventFutures.forEach(future -> {
383 - future.whenComplete((event, error) -> { 381 + future.whenComplete((event, error) -> notifyDelegate(event));
384 - notifyDelegate(event);
385 - });
386 }); 382 });
387 } 383 }
388 } 384 }
......