Sho SHIMIZU
Committed by Gerrit Code Review

Replace Stream#forEach() with Collection#forEach()

Change-Id: I2b261c3d91d345907b165bd61eb7b6c45011c247
......@@ -231,7 +231,7 @@ public class OpenstackFloatingIpManager extends AbstractVmHandler implements Ope
sIncomingBuilder.matchEthType(Ethernet.TYPE_IPV4)
.matchIPDst(floatingIp.toIpPrefix());
gatewayService.getGatewayDeviceIds().stream().forEach(deviceId -> {
gatewayService.getGatewayDeviceIds().forEach(deviceId -> {
TrafficSelector.Builder sForTrafficFromVmBuilder = DefaultTrafficSelector.builder()
.matchEthType(Ethernet.TYPE_IPV4)
.matchIPDst(floatingIp.toIpPrefix())
......@@ -278,8 +278,8 @@ public class OpenstackFloatingIpManager extends AbstractVmHandler implements Ope
.matchIPDst(floatingIp.toIpPrefix())
.build();
gatewayService.getGatewayDeviceIds().stream().forEach(gnodeId -> {
TrafficTreatment treatmentForTrafficFromExternal = DefaultTrafficTreatment.builder()
gatewayService.getGatewayDeviceIds().forEach(gnodeId -> {
TrafficTreatment treatmentForTrafficFromExternal = DefaultTrafficTreatment.builder()
.setEthSrc(Constants.DEFAULT_GATEWAY_MAC)
.setEthDst(associatedVm.mac())
.setIpDst(associatedVm.ipAddresses().stream().findFirst().get())
......@@ -336,7 +336,7 @@ public class OpenstackFloatingIpManager extends AbstractVmHandler implements Ope
.matchIPSrc(associatedVm.ipAddresses().stream().findFirst().get().toIpPrefix())
.build();
gatewayService.getGatewayDeviceIds().stream().forEach(gnodeId -> {
gatewayService.getGatewayDeviceIds().forEach(gnodeId -> {
TrafficTreatment treatment = DefaultTrafficTreatment.builder()
.setIpSrc(floatingIp)
.setEthSrc(Constants.DEFAULT_GATEWAY_MAC)
......
......@@ -125,7 +125,7 @@ public class OpenstackIcmpHandler {
.matchIPProtocol(IPv4.PROTOCOL_ICMP)
.build();
gatewayService.getGatewayDeviceIds().stream().forEach(gateway -> {
gatewayService.getGatewayDeviceIds().forEach(gateway -> {
packetService.requestPackets(icmpSelector,
PacketPriority.CONTROL,
appId,
......
......@@ -315,7 +315,7 @@ public class OpenstackPnatHandler {
}
tBuilder.setIpSrc(externalIp);
gatewayService.getGatewayNodes().stream().forEach(gateway -> {
gatewayService.getGatewayNodes().forEach(gateway -> {
TrafficTreatment.Builder tmpBuilder = DefaultTrafficTreatment.builder(tBuilder.build());
tmpBuilder.setOutput(gatewayService.getUplinkPort(gateway.getGatewayDeviceId()));
ForwardingObjective fo = DefaultForwardingObjective.builder()
......@@ -374,7 +374,7 @@ public class OpenstackPnatHandler {
return;
}
gatewayService.getGatewayDeviceIds().stream().forEach(deviceId -> {
gatewayService.getGatewayDeviceIds().forEach(deviceId -> {
DeviceId srcDeviceId = srcVm.get().location().deviceId();
TrafficTreatment.Builder tmpBuilder = DefaultTrafficTreatment.builder(tBuilder.build());
tmpBuilder.extension(RulePopulatorUtil.buildExtension(
......@@ -431,4 +431,4 @@ public class OpenstackPnatHandler {
}
}
}
}
\ No newline at end of file
}
......
......@@ -197,9 +197,7 @@ public class OpenstackRoutingManager extends AbstractVmHandler implements Openst
if (gatewayIp == null) {
return;
}
gatewayService.getGatewayDeviceIds().stream().forEach(deviceId -> {
populateGatewayIcmpRule(gatewayIp, deviceId);
});
gatewayService.getGatewayDeviceIds().forEach(deviceId -> populateGatewayIcmpRule(gatewayIp, deviceId));
}
private void populateGatewayIcmpRule(Ip4Address gatewayIp, DeviceId deviceId) {
......@@ -371,7 +369,7 @@ public class OpenstackRoutingManager extends AbstractVmHandler implements Openst
}
Map<String, String> vniMap = new HashMap<>();
openstackService.networks().stream().forEach(n -> vniMap.put(n.id(), n.segmentId()));
openstackService.networks().forEach(n -> vniMap.put(n.id(), n.segmentId()));
// TODO improve pipeline, do we have to install access rules between networks
// for every single VMs?
......@@ -402,7 +400,7 @@ public class OpenstackRoutingManager extends AbstractVmHandler implements Openst
}
Map<String, String> vniMap = new HashMap<>();
openstackService.networks().stream().forEach(n -> vniMap.put(n.id(), n.segmentId()));
openstackService.networks().forEach(n -> vniMap.put(n.id(), n.segmentId()));
osSubNets.stream().filter(osSubNet -> !osSubNet.id().equals(osSubNetId)).forEach(osSubNet -> {
TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder();
......
......@@ -663,7 +663,7 @@ public final class OpenstackNodeManager extends ListenerRegistry<OpenstackNodeEv
prevNodeMap.remove(node.hostname());
addOrUpdateNode(node);
});
prevNodeMap.values().stream().forEach(this::deleteNode);
prevNodeMap.values().forEach(this::deleteNode);
}
private class InternalConfigListener implements NetworkConfigListener {
......
......@@ -166,17 +166,16 @@ public class SdnIpFib {
Set<FilteredConnectPoint> ingressFilteredCPs = Sets.newHashSet();
// TODO this should be only peering interfaces
interfaceService.getInterfaces().stream()
.forEach(intf -> {
// Get ony ingress interfaces with IPs configured
if (validIngressIntf(intf, egressInterface)) {
TrafficSelector.Builder selector =
buildIngressTrafficSelector(intf, prefix);
FilteredConnectPoint ingressFilteredCP =
new FilteredConnectPoint(intf.connectPoint(), selector.build());
ingressFilteredCPs.add(ingressFilteredCP);
}
});
interfaceService.getInterfaces().forEach(intf -> {
// Get ony ingress interfaces with IPs configured
if (validIngressIntf(intf, egressInterface)) {
TrafficSelector.Builder selector =
buildIngressTrafficSelector(intf, prefix);
FilteredConnectPoint ingressFilteredCP =
new FilteredConnectPoint(intf.connectPoint(), selector.build());
ingressFilteredCPs.add(ingressFilteredCP);
}
});
// Build treatment: rewrite the destination MAC address
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder()
......
......@@ -191,7 +191,7 @@ implements VirtualPortService {
public VirtualPort getPort(MacAddress mac) {
checkNotNull(mac, MAC_NOT_NULL);
List<VirtualPort> vPorts = new ArrayList<>();
vPortStore.values().stream().forEach(p -> {
vPortStore.values().forEach(p -> {
if (p.macAddress().equals(mac)) {
vPorts.add(p);
}
......
......@@ -137,7 +137,7 @@ public class PredictableExecutor
@Override
public void shutdown() {
backends.stream().forEach(ExecutorService::shutdown);
backends.forEach(ExecutorService::shutdown);
}
@Override
......