Sho SHIMIZU
Committed by Gerrit Code Review

Use Collection#forEach() instead of Stream#forEach() for simplicity

Change-Id: I0a1aea4bdb5d305c50273e6ff749fe71bd2a295a
Showing 48 changed files with 128 additions and 149 deletions
...@@ -37,7 +37,7 @@ public class GetAllActiveAlarms extends AbstractShellCommand { ...@@ -37,7 +37,7 @@ public class GetAllActiveAlarms extends AbstractShellCommand {
37 } 37 }
38 38
39 void printAlarms(Set<Alarm> alarms) { 39 void printAlarms(Set<Alarm> alarms) {
40 - alarms.stream().forEach((alarm) -> { 40 + alarms.forEach((alarm) -> {
41 print(ToStringBuilder.reflectionToString(alarm, ToStringStyle.SHORT_PREFIX_STYLE)); 41 print(ToStringBuilder.reflectionToString(alarm, ToStringStyle.SHORT_PREFIX_STYLE));
42 }); 42 });
43 } 43 }
......
...@@ -36,7 +36,7 @@ public class GetAllAlarms extends AbstractShellCommand { ...@@ -36,7 +36,7 @@ public class GetAllAlarms extends AbstractShellCommand {
36 } 36 }
37 37
38 void printAlarms(Set<Alarm> alarms) { 38 void printAlarms(Set<Alarm> alarms) {
39 - alarms.stream().forEach((alarm) -> { 39 + alarms.forEach((alarm) -> {
40 print(ToStringBuilder.reflectionToString(alarm, ToStringStyle.SHORT_PREFIX_STYLE)); 40 print(ToStringBuilder.reflectionToString(alarm, ToStringStyle.SHORT_PREFIX_STYLE));
41 }); 41 });
42 } 42 }
......
...@@ -36,7 +36,7 @@ public class GetAllAlarmsCounts extends AbstractShellCommand { ...@@ -36,7 +36,7 @@ public class GetAllAlarmsCounts extends AbstractShellCommand {
36 } 36 }
37 37
38 void printCounts(Map<Alarm.SeverityLevel, Long> alarmCounts) { 38 void printCounts(Map<Alarm.SeverityLevel, Long> alarmCounts) {
39 - alarmCounts.entrySet().stream().forEach((countEntry) -> { 39 + alarmCounts.entrySet().forEach((countEntry) -> {
40 print(String.format("%s, %d", 40 print(String.format("%s, %d",
41 countEntry.getKey(), countEntry.getValue())); 41 countEntry.getKey(), countEntry.getValue()));
42 42
......
...@@ -42,9 +42,9 @@ public class GetDeviceAlarmsCounts extends AbstractShellCommand { ...@@ -42,9 +42,9 @@ public class GetDeviceAlarmsCounts extends AbstractShellCommand {
42 } 42 }
43 43
44 void printCounts(Map<Alarm.SeverityLevel, Long> alarmCounts) { 44 void printCounts(Map<Alarm.SeverityLevel, Long> alarmCounts) {
45 - alarmCounts.entrySet().stream().forEach((countEntry) -> { 45 + alarmCounts.entrySet().forEach((countEntry) -> {
46 print(String.format("%s, %d", 46 print(String.format("%s, %d",
47 - countEntry.getKey(), countEntry.getValue())); 47 + countEntry.getKey(), countEntry.getValue()));
48 48
49 }); 49 });
50 } 50 }
......
...@@ -113,7 +113,7 @@ public class AlarmTableMessageHandler extends UiMessageHandler { ...@@ -113,7 +113,7 @@ public class AlarmTableMessageHandler extends UiMessageHandler {
113 AlarmServiceUtil.lookUpAlarms() : 113 AlarmServiceUtil.lookUpAlarms() :
114 AlarmServiceUtil.lookUpAlarms(DeviceId.deviceId(devId)); 114 AlarmServiceUtil.lookUpAlarms(DeviceId.deviceId(devId));
115 115
116 - alarms.stream().forEach((alarm) -> { 116 + alarms.forEach((alarm) -> {
117 populateRow(tm.addRow(), alarm); 117 populateRow(tm.addRow(), alarm);
118 }); 118 });
119 119
......
...@@ -195,7 +195,7 @@ public class DefaultInfluxDbMetricsReporter implements InfluxDbMetricsReporter { ...@@ -195,7 +195,7 @@ public class DefaultInfluxDbMetricsReporter implements InfluxDbMetricsReporter {
195 MetricRegistry moddedRegistry = new MetricRegistry(); 195 MetricRegistry moddedRegistry = new MetricRegistry();
196 ControllerNode node = clusterService.getLocalNode(); 196 ControllerNode node = clusterService.getLocalNode();
197 String prefix = node.id().id() + "."; 197 String prefix = node.id().id() + ".";
198 - metricRegistry.getNames().stream().forEach(name -> 198 + metricRegistry.getNames().forEach(name ->
199 moddedRegistry.register(prefix + name, metricRegistry.getMetrics().get(name))); 199 moddedRegistry.register(prefix + name, metricRegistry.getMetrics().get(name)));
200 200
201 return moddedRegistry; 201 return moddedRegistry;
......
...@@ -215,7 +215,7 @@ public class OpenstackRoutingManager extends AbstractVmHandler implements Openst ...@@ -215,7 +215,7 @@ public class OpenstackRoutingManager extends AbstractVmHandler implements Openst
215 .filter(h -> routableNetIds.contains(h.annotations().value(NETWORK_ID))) 215 .filter(h -> routableNetIds.contains(h.annotations().value(NETWORK_ID)))
216 .collect(Collectors.toSet()); 216 .collect(Collectors.toSet());
217 217
218 - hosts.stream().forEach(h -> populateRoutingRules(h, routableNets)); 218 + hosts.forEach(h -> populateRoutingRules(h, routableNets));
219 } 219 }
220 220
221 private void unsetRoutes(OpenstackRouter osRouter, OpenstackNetwork osNet) { 221 private void unsetRoutes(OpenstackRouter osRouter, OpenstackNetwork osNet) {
...@@ -226,7 +226,7 @@ public class OpenstackRoutingManager extends AbstractVmHandler implements Openst ...@@ -226,7 +226,7 @@ public class OpenstackRoutingManager extends AbstractVmHandler implements Openst
226 h.annotations().value(NETWORK_ID), osNet.id())) 226 h.annotations().value(NETWORK_ID), osNet.id()))
227 .forEach(h -> removeRoutingRules(h, routableNets)); 227 .forEach(h -> removeRoutingRules(h, routableNets));
228 228
229 - routableNets.stream().forEach(n -> { 229 + routableNets.forEach(n -> {
230 Tools.stream(hostService.getHosts()) 230 Tools.stream(hostService.getHosts())
231 .filter(h -> Objects.equals( 231 .filter(h -> Objects.equals(
232 h.annotations().value(NETWORK_ID), 232 h.annotations().value(NETWORK_ID),
...@@ -269,7 +269,7 @@ public class OpenstackRoutingManager extends AbstractVmHandler implements Openst ...@@ -269,7 +269,7 @@ public class OpenstackRoutingManager extends AbstractVmHandler implements Openst
269 .matchTunnelId(Long.valueOf(osNet.segmentId())) 269 .matchTunnelId(Long.valueOf(osNet.segmentId()))
270 .matchEthDst(Constants.DEFAULT_GATEWAY_MAC); 270 .matchEthDst(Constants.DEFAULT_GATEWAY_MAC);
271 271
272 - nodeService.completeNodes().stream().forEach(node -> { 272 + nodeService.completeNodes().forEach(node -> {
273 ForwardingObjective.Flag flag = node.type().equals(GATEWAY) ? 273 ForwardingObjective.Flag flag = node.type().equals(GATEWAY) ?
274 ForwardingObjective.Flag.VERSATILE : 274 ForwardingObjective.Flag.VERSATILE :
275 ForwardingObjective.Flag.SPECIFIC; 275 ForwardingObjective.Flag.SPECIFIC;
...@@ -359,8 +359,7 @@ public class OpenstackRoutingManager extends AbstractVmHandler implements Openst ...@@ -359,8 +359,7 @@ public class OpenstackRoutingManager extends AbstractVmHandler implements Openst
359 .fromApp(appId) 359 .fromApp(appId)
360 .add(); 360 .add();
361 361
362 - gatewayService.getGatewayDeviceIds().stream() 362 + gatewayService.getGatewayDeviceIds().forEach(deviceId -> flowObjectiveService.forward(deviceId, fo));
363 - .forEach(deviceId -> flowObjectiveService.forward(deviceId, fo));
364 } 363 }
365 364
366 private void populateCnodeToGateway(long vni) { 365 private void populateCnodeToGateway(long vni) {
......
...@@ -121,7 +121,7 @@ public class OpenstackSecurityGroupManager extends AbstractVmHandler ...@@ -121,7 +121,7 @@ public class OpenstackSecurityGroupManager extends AbstractVmHandler
121 .filter(entry -> getTenantId(entry.getKey()).equals(tenantId)) 121 .filter(entry -> getTenantId(entry.getKey()).equals(tenantId))
122 .forEach(entry -> { 122 .forEach(entry -> {
123 Host local = entry.getKey(); 123 Host local = entry.getKey();
124 - entry.getValue().stream().forEach(sgRule -> { 124 + entry.getValue().forEach(sgRule -> {
125 setSecurityGroupRule(local.location().deviceId(), 125 setSecurityGroupRule(local.location().deviceId(),
126 sgRule.rule(), 126 sgRule.rule(),
127 getIp(local), 127 getIp(local),
...@@ -250,10 +250,10 @@ public class OpenstackSecurityGroupManager extends AbstractVmHandler ...@@ -250,10 +250,10 @@ public class OpenstackSecurityGroupManager extends AbstractVmHandler
250 } 250 }
251 251
252 Set<SecurityGroupRule> rules = Sets.newHashSet(); 252 Set<SecurityGroupRule> rules = Sets.newHashSet();
253 - osPort.securityGroups().stream().forEach(sgId -> { 253 + osPort.securityGroups().forEach(sgId -> {
254 OpenstackSecurityGroup osSecGroup = openstackService.securityGroup(sgId); 254 OpenstackSecurityGroup osSecGroup = openstackService.securityGroup(sgId);
255 if (osSecGroup != null) { 255 if (osSecGroup != null) {
256 - osSecGroup.rules().stream().forEach(rule -> rules.addAll(getSgRules(rule))); 256 + osSecGroup.rules().forEach(rule -> rules.addAll(getSgRules(rule)));
257 } else { 257 } else {
258 // TODO handle the case that the security group removed 258 // TODO handle the case that the security group removed
259 log.warn("Failed to get security group {}", sgId); 259 log.warn("Failed to get security group {}", sgId);
......
...@@ -194,8 +194,7 @@ public final class OpenstackSwitchingArpHandler extends AbstractVmHandler { ...@@ -194,8 +194,7 @@ public final class OpenstackSwitchingArpHandler extends AbstractVmHandler {
194 log.warn("Failed to get OpenStack network for {}", host); 194 log.warn("Failed to get OpenStack network for {}", host);
195 return; 195 return;
196 } 196 }
197 - osNet.subnets().stream() 197 + osNet.subnets().forEach(subnet -> gateways.add(Ip4Address.valueOf(subnet.gatewayIp())));
198 - .forEach(subnet -> gateways.add(Ip4Address.valueOf(subnet.gatewayIp())));
199 } 198 }
200 199
201 @Override 200 @Override
......
...@@ -530,7 +530,7 @@ public class VtnManager implements VtnService { ...@@ -530,7 +530,7 @@ public class VtnManager implements VtnService {
530 Iterable<Host> allHosts = hostService.getHosts(); 530 Iterable<Host> allHosts = hostService.getHosts();
531 String tunnelName = "vxlan-" + DEFAULT_IP; 531 String tunnelName = "vxlan-" + DEFAULT_IP;
532 if (allHosts != null) { 532 if (allHosts != null) {
533 - Sets.newHashSet(allHosts).stream().forEach(host -> { 533 + Sets.newHashSet(allHosts).forEach(host -> {
534 MacAddress hostMac = host.mac(); 534 MacAddress hostMac = host.mac();
535 String ifaceId = host.annotations().value(IFACEID); 535 String ifaceId = host.annotations().value(IFACEID);
536 if (ifaceId == null) { 536 if (ifaceId == null) {
...@@ -549,7 +549,7 @@ public class VtnManager implements VtnService { ...@@ -549,7 +549,7 @@ public class VtnManager implements VtnService {
549 .getControllerIpOfSwitch(remoteDevice); 549 .getControllerIpOfSwitch(remoteDevice);
550 if (remoteControllerIp == null) { 550 if (remoteControllerIp == null) {
551 log.error("Can't find remote controller of device: {}", 551 log.error("Can't find remote controller of device: {}",
552 - remoteDeviceId.toString()); 552 + remoteDeviceId.toString());
553 return; 553 return;
554 } 554 }
555 IpAddress remoteIpAddress = IpAddress 555 IpAddress remoteIpAddress = IpAddress
...@@ -557,10 +557,10 @@ public class VtnManager implements VtnService { ...@@ -557,10 +557,10 @@ public class VtnManager implements VtnService {
557 ports.stream() 557 ports.stream()
558 .filter(p -> p.name().equalsIgnoreCase(tunnelName)) 558 .filter(p -> p.name().equalsIgnoreCase(tunnelName))
559 .forEach(p -> { 559 .forEach(p -> {
560 - l2ForwardService 560 + l2ForwardService
561 - .programTunnelOut(device.id(), segmentationId, p, 561 + .programTunnelOut(device.id(), segmentationId, p,
562 - hostMac, type, remoteIpAddress); 562 + hostMac, type, remoteIpAddress);
563 - }); 563 + });
564 }); 564 });
565 } 565 }
566 } 566 }
...@@ -899,7 +899,7 @@ public class VtnManager implements VtnService { ...@@ -899,7 +899,7 @@ public class VtnManager implements VtnService {
899 programRouterInterface(routerInf, operation); 899 programRouterInterface(routerInf, operation);
900 if (interfacesSet.size() == 1) { 900 if (interfacesSet.size() == 1) {
901 routerInfFlagOfTenantRouter.remove(tenantRouter); 901 routerInfFlagOfTenantRouter.remove(tenantRouter);
902 - interfacesSet.stream().forEach(r -> { 902 + interfacesSet.forEach(r -> {
903 programRouterInterface(r, operation); 903 programRouterInterface(r, operation);
904 }); 904 });
905 } 905 }
...@@ -961,7 +961,7 @@ public class VtnManager implements VtnService { ...@@ -961,7 +961,7 @@ public class VtnManager implements VtnService {
961 TenantRouter tenantRouter = TenantRouter 961 TenantRouter tenantRouter = TenantRouter
962 .tenantRouter(r.tenantId(), r.routerId()); 962 .tenantRouter(r.tenantId(), r.routerId());
963 routerInfFlagOfTenantRouter.put(tenantRouter, true); 963 routerInfFlagOfTenantRouter.put(tenantRouter, true);
964 - interfacesSet.stream().forEach(f -> { 964 + interfacesSet.forEach(f -> {
965 programRouterInterface(f, operation); 965 programRouterInterface(f, operation);
966 }); 966 });
967 break; 967 break;
...@@ -977,7 +977,7 @@ public class VtnManager implements VtnService { ...@@ -977,7 +977,7 @@ public class VtnManager implements VtnService {
977 SegmentationId l3vni = vtnRscService.getL3vni(tenantRouter); 977 SegmentationId l3vni = vtnRscService.getL3vni(tenantRouter);
978 // Get all the host of the subnet 978 // Get all the host of the subnet
979 Map<HostId, Host> hosts = hostsOfSubnet.get(routerInf.subnetId()); 979 Map<HostId, Host> hosts = hostsOfSubnet.get(routerInf.subnetId());
980 - hosts.values().stream().forEach(h -> { 980 + hosts.values().forEach(h -> {
981 applyEastWestL3Flows(h, l3vni, operation); 981 applyEastWestL3Flows(h, l3vni, operation);
982 }); 982 });
983 } 983 }
...@@ -1292,7 +1292,7 @@ public class VtnManager implements VtnService { ...@@ -1292,7 +1292,7 @@ public class VtnManager implements VtnService {
1292 .stream().filter(r -> r.tenantId().equals(tenantId)) 1292 .stream().filter(r -> r.tenantId().equals(tenantId))
1293 .filter(r -> r.subnetId().equals(subnetId)) 1293 .filter(r -> r.subnetId().equals(subnetId))
1294 .collect(Collectors.toSet()); 1294 .collect(Collectors.toSet());
1295 - hostInterfaces.stream().forEach(routerInf -> { 1295 + hostInterfaces.forEach(routerInf -> {
1296 Set<RouterInterface> interfacesSet = Sets.newHashSet(interfaces) 1296 Set<RouterInterface> interfacesSet = Sets.newHashSet(interfaces)
1297 .stream().filter(r -> r.tenantId().equals(tenantId)) 1297 .stream().filter(r -> r.tenantId().equals(tenantId))
1298 .filter(r -> r.routerId().equals(routerInf.routerId())) 1298 .filter(r -> r.routerId().equals(routerInf.routerId()))
......
...@@ -105,7 +105,7 @@ public class ClassifierServiceImpl implements ClassifierService { ...@@ -105,7 +105,7 @@ public class ClassifierServiceImpl implements ClassifierService {
105 log.info("No tunnel port in device"); 105 log.info("No tunnel port in device");
106 return; 106 return;
107 } 107 }
108 - Sets.newHashSet(localTunnelPorts).stream().forEach(tp -> { 108 + Sets.newHashSet(localTunnelPorts).forEach(tp -> {
109 TrafficSelector selector = DefaultTrafficSelector.builder() 109 TrafficSelector selector = DefaultTrafficSelector.builder()
110 .matchInPort(tp).add(Criteria.matchTunnelId(Long 110 .matchInPort(tp).add(Criteria.matchTunnelId(Long
111 .parseLong(segmentationId.toString()))) 111 .parseLong(segmentationId.toString())))
......
...@@ -83,7 +83,7 @@ public final class L2ForwardServiceImpl implements L2ForwardService { ...@@ -83,7 +83,7 @@ public final class L2ForwardServiceImpl implements L2ForwardService {
83 log.info("No other host port and tunnel in the device"); 83 log.info("No other host port and tunnel in the device");
84 return; 84 return;
85 } 85 }
86 - Sets.newHashSet(localVmPorts).stream().forEach(lp -> { 86 + Sets.newHashSet(localVmPorts).forEach(lp -> {
87 TrafficSelector selector = DefaultTrafficSelector.builder() 87 TrafficSelector selector = DefaultTrafficSelector.builder()
88 .matchInPort(lp).matchEthDst(MacAddress.BROADCAST) 88 .matchInPort(lp).matchEthDst(MacAddress.BROADCAST)
89 .add(Criteria.matchTunnelId(Long 89 .add(Criteria.matchTunnelId(Long
...@@ -124,7 +124,7 @@ public final class L2ForwardServiceImpl implements L2ForwardService { ...@@ -124,7 +124,7 @@ public final class L2ForwardServiceImpl implements L2ForwardService {
124 log.info("No other host port or tunnel ports in the device"); 124 log.info("No other host port or tunnel ports in the device");
125 return; 125 return;
126 } 126 }
127 - Sets.newHashSet(localTunnelPorts).stream().forEach(tp -> { 127 + Sets.newHashSet(localTunnelPorts).forEach(tp -> {
128 TrafficSelector selector = DefaultTrafficSelector.builder() 128 TrafficSelector selector = DefaultTrafficSelector.builder()
129 .matchInPort(tp) 129 .matchInPort(tp)
130 .add(Criteria.matchTunnelId(Long 130 .add(Criteria.matchTunnelId(Long
......
...@@ -128,7 +128,7 @@ public final class VtnData { ...@@ -128,7 +128,7 @@ public final class VtnData {
128 FixedIp fixedIP) { 128 FixedIp fixedIP) {
129 if (vPortStore != null) { 129 if (vPortStore != null) {
130 List<VirtualPort> vPorts = new ArrayList<>(); 130 List<VirtualPort> vPorts = new ArrayList<>();
131 - vPortStore.values().stream().forEach(p -> { 131 + vPortStore.values().forEach(p -> {
132 Iterator<FixedIp> fixedIps = p.fixedIps().iterator(); 132 Iterator<FixedIp> fixedIps = p.fixedIps().iterator();
133 while (fixedIps.hasNext()) { 133 while (fixedIps.hasNext()) {
134 if (fixedIps.next().equals(fixedIP)) { 134 if (fixedIps.next().equals(fixedIP)) {
......
...@@ -150,7 +150,7 @@ implements VirtualPortService { ...@@ -150,7 +150,7 @@ implements VirtualPortService {
150 public VirtualPort getPort(FixedIp fixedIP) { 150 public VirtualPort getPort(FixedIp fixedIP) {
151 checkNotNull(fixedIP, FIXEDIP_NOT_NULL); 151 checkNotNull(fixedIP, FIXEDIP_NOT_NULL);
152 List<VirtualPort> vPorts = new ArrayList<>(); 152 List<VirtualPort> vPorts = new ArrayList<>();
153 - vPortStore.values().stream().forEach(p -> { 153 + vPortStore.values().forEach(p -> {
154 Iterator<FixedIp> fixedIps = p.fixedIps().iterator(); 154 Iterator<FixedIp> fixedIps = p.fixedIps().iterator();
155 while (fixedIps.hasNext()) { 155 while (fixedIps.hasNext()) {
156 if (fixedIps.next().equals(fixedIP)) { 156 if (fixedIps.next().equals(fixedIP)) {
......
...@@ -129,7 +129,7 @@ public class SfcViewMessageHandler extends UiMessageHandler { ...@@ -129,7 +129,7 @@ public class SfcViewMessageHandler extends UiMessageHandler {
129 StringBuffer srcipbuf = new StringBuffer(); 129 StringBuffer srcipbuf = new StringBuffer();
130 StringBuffer dstipbuf = new StringBuffer(); 130 StringBuffer dstipbuf = new StringBuffer();
131 if (flowClassifierList != null) { 131 if (flowClassifierList != null) {
132 - flowClassifierList.stream().forEach(fcid -> { 132 + flowClassifierList.forEach(fcid -> {
133 FlowClassifier fc = fcs.getFlowClassifier(fcid); 133 FlowClassifier fc = fcs.getFlowClassifier(fcid);
134 String srcip = fc.srcIpPrefix().toString(); 134 String srcip = fc.srcIpPrefix().toString();
135 String dstip = fc.dstIpPrefix().toString(); 135 String dstip = fc.dstIpPrefix().toString();
...@@ -157,11 +157,11 @@ public class SfcViewMessageHandler extends UiMessageHandler { ...@@ -157,11 +157,11 @@ public class SfcViewMessageHandler extends UiMessageHandler {
157 VirtualPortService vps = get(VirtualPortService.class); 157 VirtualPortService vps = get(VirtualPortService.class);
158 List<VirtualPort> vpList = new ArrayList<VirtualPort>(); 158 List<VirtualPort> vpList = new ArrayList<VirtualPort>();
159 if (portPairGroupList != null) { 159 if (portPairGroupList != null) {
160 - portPairGroupList.stream().forEach(ppgid -> { 160 + portPairGroupList.forEach(ppgid -> {
161 PortPairGroup ppg = ppgs.getPortPairGroup(ppgid); 161 PortPairGroup ppg = ppgs.getPortPairGroup(ppgid);
162 List<PortPairId> portPairList = ppg.portPairs(); 162 List<PortPairId> portPairList = ppg.portPairs();
163 if (portPairList != null) { 163 if (portPairList != null) {
164 - portPairList.stream().forEach(ppid -> { 164 + portPairList.forEach(ppid -> {
165 PortPair pp = pps.getPortPair(ppid); 165 PortPair pp = pps.getPortPair(ppid);
166 VirtualPort vp = vps.getPort(VirtualPortId.portId(pp.ingress())); 166 VirtualPort vp = vps.getPort(VirtualPortId.portId(pp.ingress()));
167 vpList.add(vp); 167 vpList.add(vp);
......
...@@ -115,9 +115,9 @@ public final class DefaultVtnPortApi extends XosApi implements VtnPortApi { ...@@ -115,9 +115,9 @@ public final class DefaultVtnPortApi extends XosApi implements VtnPortApi {
115 } 115 }
116 116
117 Map<IpAddress, MacAddress> addressPairs = Maps.newHashMap(); 117 Map<IpAddress, MacAddress> addressPairs = Maps.newHashMap();
118 - osPort.getAllowedAddressPairs().stream().forEach( 118 + osPort.getAllowedAddressPairs().forEach(
119 pair -> addressPairs.put(IpAddress.valueOf(pair.getIpAddress()), 119 pair -> addressPairs.put(IpAddress.valueOf(pair.getIpAddress()),
120 - MacAddress.valueOf(pair.getMacAddress()))); 120 + MacAddress.valueOf(pair.getMacAddress())));
121 121
122 return VtnPort.builder() 122 return VtnPort.builder()
123 .id(VtnPortId.of(osPort.getId())) 123 .id(VtnPortId.of(osPort.getId()))
......
...@@ -60,13 +60,12 @@ public class MapsListCommand extends AbstractShellCommand { ...@@ -60,13 +60,12 @@ public class MapsListCommand extends AbstractShellCommand {
60 ArrayNode maps = mapper.createArrayNode(); 60 ArrayNode maps = mapper.createArrayNode();
61 61
62 // Create a JSON node for each map 62 // Create a JSON node for each map
63 - mapInfo.stream() 63 + mapInfo.forEach(info -> {
64 - .forEach(info -> { 64 + ObjectNode map = mapper.createObjectNode();
65 - ObjectNode map = mapper.createObjectNode(); 65 + map.put("name", info.name())
66 - map.put("name", info.name()) 66 + .put("size", info.size());
67 - .put("size", info.size()); 67 + maps.add(map);
68 - maps.add(map); 68 + });
69 - });
70 69
71 return maps; 70 return maps;
72 } 71 }
......
...@@ -123,23 +123,20 @@ public class PartitionsListCommand extends AbstractShellCommand { ...@@ -123,23 +123,20 @@ public class PartitionsListCommand extends AbstractShellCommand {
123 ArrayNode partitions = mapper.createArrayNode(); 123 ArrayNode partitions = mapper.createArrayNode();
124 124
125 // Create a JSON node for each partition 125 // Create a JSON node for each partition
126 - partitionInfo.stream() 126 + partitionInfo.forEach(info -> {
127 - .forEach(info -> { 127 + ObjectNode partition = mapper.createObjectNode();
128 - ObjectNode partition = mapper.createObjectNode();
129 128
130 - // Add each member to the "members" array for this partition 129 + // Add each member to the "members" array for this partition
131 - ArrayNode members = partition.putArray("members"); 130 + ArrayNode members = partition.putArray("members");
132 - info.members() 131 + info.members().forEach(members::add);
133 - .stream()
134 - .forEach(members::add);
135 132
136 - // Complete the partition attributes and add it to the array 133 + // Complete the partition attributes and add it to the array
137 - partition.put("name", info.name()) 134 + partition.put("name", info.name())
138 - .put("term", info.term()) 135 + .put("term", info.term())
139 - .put("leader", info.leader()); 136 + .put("leader", info.leader());
140 - partitions.add(partition); 137 + partitions.add(partition);
141 138
142 - }); 139 + });
143 140
144 return partitions; 141 return partitions;
145 } 142 }
...@@ -155,25 +152,24 @@ public class PartitionsListCommand extends AbstractShellCommand { ...@@ -155,25 +152,24 @@ public class PartitionsListCommand extends AbstractShellCommand {
155 ClusterService clusterService = get(ClusterService.class); 152 ClusterService clusterService = get(ClusterService.class);
156 153
157 // Create a JSON node for each partition client 154 // Create a JSON node for each partition client
158 - partitionClientInfo.stream() 155 + partitionClientInfo.forEach(info -> {
159 - .forEach(info -> { 156 + ObjectNode partition = mapper.createObjectNode();
160 - ObjectNode partition = mapper.createObjectNode(); 157 +
161 - 158 + // Add each member to the "servers" array for this partition
162 - // Add each member to the "servers" array for this partition 159 + ArrayNode servers = partition.putArray("servers");
163 - ArrayNode servers = partition.putArray("servers"); 160 + info.servers()
164 - info.servers() 161 + .stream()
165 - .stream() 162 + .map(clusterService::getNode)
166 - .map(clusterService::getNode) 163 + .map(node -> String.format("%s:%d", node.ip(), node.tcpPort()))
167 - .map(node -> String.format("%s:%d", node.ip(), node.tcpPort())) 164 + .forEach(servers::add);
168 - .forEach(servers::add); 165 +
169 - 166 + // Complete the partition attributes and add it to the array
170 - // Complete the partition attributes and add it to the array 167 + partition.put("partitionId", info.partitionId().toString())
171 - partition.put("partitionId", info.partitionId().toString()) 168 + .put("sessionId", info.sessionId())
172 - .put("sessionId", info.sessionId()) 169 + .put("status", info.status().toString());
173 - .put("status", info.status().toString()); 170 + partitions.add(partition);
174 - partitions.add(partition); 171 +
175 - 172 + });
176 - });
177 173
178 return partitions; 174 return partitions;
179 } 175 }
......
...@@ -72,7 +72,7 @@ public class VirtualHostCreateCommand extends AbstractShellCommand { ...@@ -72,7 +72,7 @@ public class VirtualHostCreateCommand extends AbstractShellCommand {
72 72
73 Set<IpAddress> hostIps = new HashSet<>(); 73 Set<IpAddress> hostIps = new HashSet<>();
74 if (hostIpStrings != null) { 74 if (hostIpStrings != null) {
75 - Arrays.asList(hostIpStrings).stream().forEach(s -> hostIps.add(IpAddress.valueOf(s))); 75 + Arrays.stream(hostIpStrings).forEach(s -> hostIps.add(IpAddress.valueOf(s)));
76 } 76 }
77 HostLocation hostLocation = new HostLocation(DeviceId.deviceId(hostLocationDeviceId), 77 HostLocation hostLocation = new HostLocation(DeviceId.deviceId(hostLocationDeviceId),
78 PortNumber.portNumber(hostLocationPortNumber), 78 PortNumber.portNumber(hostLocationPortNumber),
......
...@@ -400,7 +400,6 @@ public class DefaultFlowRule implements FlowRule { ...@@ -400,7 +400,6 @@ public class DefaultFlowRule implements FlowRule {
400 400
401 private int hash() { 401 private int hash() {
402 Funnel<TrafficSelector> selectorFunnel = (from, into) -> from.criteria() 402 Funnel<TrafficSelector> selectorFunnel = (from, into) -> from.criteria()
403 - .stream()
404 .forEach(c -> into.putString(c.toString(), Charsets.UTF_8)); 403 .forEach(c -> into.putString(c.toString(), Charsets.UTF_8));
405 404
406 HashFunction hashFunction = Hashing.murmur3_32(); 405 HashFunction hashFunction = Hashing.murmur3_32();
......
...@@ -360,7 +360,6 @@ public class FlowRuleCodecTest { ...@@ -360,7 +360,6 @@ public class FlowRuleCodecTest {
360 checkCommonData(rule); 360 checkCommonData(rule);
361 361
362 rule.treatment().allInstructions() 362 rule.treatment().allInstructions()
363 - .stream()
364 .forEach(instruction -> 363 .forEach(instruction ->
365 { 364 {
366 String subType; 365 String subType;
...@@ -551,7 +550,6 @@ public class FlowRuleCodecTest { ...@@ -551,7 +550,6 @@ public class FlowRuleCodecTest {
551 assertThat(rule.selector().criteria().size(), is(35)); 550 assertThat(rule.selector().criteria().size(), is(35));
552 551
553 rule.selector().criteria() 552 rule.selector().criteria()
554 - .stream()
555 .forEach(criterion -> 553 .forEach(criterion ->
556 criteria.put(criterion.type().name(), criterion)); 554 criteria.put(criterion.type().name(), criterion));
557 555
......
...@@ -518,7 +518,7 @@ public class FlowRuleManager ...@@ -518,7 +518,7 @@ public class FlowRuleManager
518 switch (event.type()) { 518 switch (event.type()) {
519 case BATCH_OPERATION_REQUESTED: 519 case BATCH_OPERATION_REQUESTED:
520 // Request has been forwarded to MASTER Node, and was 520 // Request has been forwarded to MASTER Node, and was
521 - request.ops().stream().forEach( 521 + request.ops().forEach(
522 op -> { 522 op -> {
523 switch (op.operator()) { 523 switch (op.operator()) {
524 524
...@@ -652,7 +652,7 @@ public class FlowRuleManager ...@@ -652,7 +652,7 @@ public class FlowRuleManager
652 if (context != null) { 652 if (context != null) {
653 final FlowRuleOperations.Builder failedOpsBuilder = 653 final FlowRuleOperations.Builder failedOpsBuilder =
654 FlowRuleOperations.builder(); 654 FlowRuleOperations.builder();
655 - failures.stream().forEach(failedOpsBuilder::add); 655 + failures.forEach(failedOpsBuilder::add);
656 656
657 context.onError(failedOpsBuilder.build()); 657 context.onError(failedOpsBuilder.build());
658 } 658 }
......
...@@ -112,8 +112,7 @@ public class LinkCollectionIntentCompiler implements IntentCompiler<LinkCollecti ...@@ -112,8 +112,7 @@ public class LinkCollectionIntentCompiler implements IntentCompiler<LinkCollecti
112 private List<FlowRule> createRules(LinkCollectionIntent intent, DeviceId deviceId, 112 private List<FlowRule> createRules(LinkCollectionIntent intent, DeviceId deviceId,
113 Set<PortNumber> inPorts, Set<PortNumber> outPorts) { 113 Set<PortNumber> inPorts, Set<PortNumber> outPorts) {
114 TrafficTreatment.Builder defaultTreatmentBuilder = DefaultTrafficTreatment.builder(); 114 TrafficTreatment.Builder defaultTreatmentBuilder = DefaultTrafficTreatment.builder();
115 - outPorts.stream() 115 + outPorts.forEach(defaultTreatmentBuilder::setOutput);
116 - .forEach(defaultTreatmentBuilder::setOutput);
117 TrafficTreatment outputOnlyTreatment = defaultTreatmentBuilder.build(); 116 TrafficTreatment outputOnlyTreatment = defaultTreatmentBuilder.build();
118 Set<PortNumber> ingressPorts = Collections.emptySet(); 117 Set<PortNumber> ingressPorts = Collections.emptySet();
119 Set<PortNumber> egressPorts = Collections.emptySet(); 118 Set<PortNumber> egressPorts = Collections.emptySet();
...@@ -138,8 +137,7 @@ public class LinkCollectionIntentCompiler implements IntentCompiler<LinkCollecti ...@@ -138,8 +137,7 @@ public class LinkCollectionIntentCompiler implements IntentCompiler<LinkCollecti
138 137
139 if (!intent.applyTreatmentOnEgress()) { 138 if (!intent.applyTreatmentOnEgress()) {
140 TrafficTreatment.Builder ingressTreatmentBuilder = DefaultTrafficTreatment.builder(intent.treatment()); 139 TrafficTreatment.Builder ingressTreatmentBuilder = DefaultTrafficTreatment.builder(intent.treatment());
141 - outPorts.stream() 140 + outPorts.forEach(ingressTreatmentBuilder::setOutput);
142 - .forEach(ingressTreatmentBuilder::setOutput);
143 intentTreatment = ingressTreatmentBuilder.build(); 141 intentTreatment = ingressTreatmentBuilder.build();
144 142
145 if (ingressPorts.contains(inPort)) { 143 if (ingressPorts.contains(inPort)) {
...@@ -153,8 +151,7 @@ public class LinkCollectionIntentCompiler implements IntentCompiler<LinkCollecti ...@@ -153,8 +151,7 @@ public class LinkCollectionIntentCompiler implements IntentCompiler<LinkCollecti
153 if (outPorts.stream().allMatch(egressPorts::contains)) { 151 if (outPorts.stream().allMatch(egressPorts::contains)) {
154 TrafficTreatment.Builder egressTreatmentBuilder = 152 TrafficTreatment.Builder egressTreatmentBuilder =
155 DefaultTrafficTreatment.builder(intent.treatment()); 153 DefaultTrafficTreatment.builder(intent.treatment());
156 - outPorts.stream() 154 + outPorts.forEach(egressTreatmentBuilder::setOutput);
157 - .forEach(egressTreatmentBuilder::setOutput);
158 155
159 selectorBuilder = DefaultTrafficSelector.builder(intent.selector()); 156 selectorBuilder = DefaultTrafficSelector.builder(intent.selector());
160 treatment = egressTreatmentBuilder.build(); 157 treatment = egressTreatmentBuilder.build();
...@@ -343,4 +340,4 @@ public class LinkCollectionIntentCompiler implements IntentCompiler<LinkCollecti ...@@ -343,4 +340,4 @@ public class LinkCollectionIntentCompiler implements IntentCompiler<LinkCollecti
343 }); 340 });
344 return defaultSelectorBuilder; 341 return defaultSelectorBuilder;
345 } 342 }
346 -}
...\ No newline at end of file ...\ No newline at end of file
343 +}
......
...@@ -120,13 +120,11 @@ public class LinkCollectionIntentFlowObjectivesCompiler implements IntentCompile ...@@ -120,13 +120,11 @@ public class LinkCollectionIntentFlowObjectivesCompiler implements IntentCompile
120 .collect(Collectors.toSet()); 120 .collect(Collectors.toSet());
121 121
122 TrafficTreatment.Builder defaultTreatmentBuilder = DefaultTrafficTreatment.builder(); 122 TrafficTreatment.Builder defaultTreatmentBuilder = DefaultTrafficTreatment.builder();
123 - outPorts.stream() 123 + outPorts.forEach(defaultTreatmentBuilder::setOutput);
124 - .forEach(defaultTreatmentBuilder::setOutput);
125 TrafficTreatment defaultTreatment = defaultTreatmentBuilder.build(); 124 TrafficTreatment defaultTreatment = defaultTreatmentBuilder.build();
126 125
127 TrafficTreatment.Builder ingressTreatmentBuilder = DefaultTrafficTreatment.builder(intent.treatment()); 126 TrafficTreatment.Builder ingressTreatmentBuilder = DefaultTrafficTreatment.builder(intent.treatment());
128 - outPorts.stream() 127 + outPorts.forEach(ingressTreatmentBuilder::setOutput);
129 - .forEach(ingressTreatmentBuilder::setOutput);
130 TrafficTreatment ingressTreatment = ingressTreatmentBuilder.build(); 128 TrafficTreatment ingressTreatment = ingressTreatmentBuilder.build();
131 129
132 List<Objective> objectives = new ArrayList<>(inPorts.size()); 130 List<Objective> objectives = new ArrayList<>(inPorts.size());
......
...@@ -601,7 +601,7 @@ public class FlowStatisticManager implements FlowStatisticService { ...@@ -601,7 +601,7 @@ public class FlowStatisticManager implements FlowStatisticService {
601 } 601 }
602 602
603 private void checkLoadValidity(Set<FlowEntry> current, Set<FlowEntry> previous) { 603 private void checkLoadValidity(Set<FlowEntry> current, Set<FlowEntry> previous) {
604 - current.stream().forEach(c -> { 604 + current.forEach(c -> {
605 FlowEntry f = previous.stream().filter(p -> c.equals(p)). 605 FlowEntry f = previous.stream().filter(p -> c.equals(p)).
606 findAny().orElse(null); 606 findAny().orElse(null);
607 if (f != null && c.bytes() < f.bytes()) { 607 if (f != null && c.bytes() < f.bytes()) {
......
...@@ -307,7 +307,7 @@ public class MastershipManagerTest { ...@@ -307,7 +307,7 @@ public class MastershipManagerTest {
307 private void checkDeviceMasters(Set<DeviceId> deviceIds, Set<NodeId> expectedMasters, 307 private void checkDeviceMasters(Set<DeviceId> deviceIds, Set<NodeId> expectedMasters,
308 Consumer<DeviceId> checkRole) { 308 Consumer<DeviceId> checkRole) {
309 // each device's master must be contained in the list of expectedMasters 309 // each device's master must be contained in the list of expectedMasters
310 - deviceIds.stream().forEach(deviceId -> { 310 + deviceIds.forEach(deviceId -> {
311 assertTrue("wrong master:", expectedMasters.contains(mgr.getMasterFor(deviceId))); 311 assertTrue("wrong master:", expectedMasters.contains(mgr.getMasterFor(deviceId)));
312 if (checkRole != null) { 312 if (checkRole != null) {
313 checkRole.accept(deviceId); 313 checkRole.accept(deviceId);
......
...@@ -861,7 +861,7 @@ public class DistributedFlowRuleStore ...@@ -861,7 +861,7 @@ public class DistributedFlowRuleStore
861 try { 861 try {
862 // compute a mapping from node to the set of devices whose flow entries it should backup 862 // compute a mapping from node to the set of devices whose flow entries it should backup
863 Map<NodeId, Set<DeviceId>> devicesToBackupByNode = Maps.newHashMap(); 863 Map<NodeId, Set<DeviceId>> devicesToBackupByNode = Maps.newHashMap();
864 - flowEntries.keySet().stream().forEach(deviceId -> { 864 + flowEntries.keySet().forEach(deviceId -> {
865 List<NodeId> backupNodes = getBackupNodes(deviceId); 865 List<NodeId> backupNodes = getBackupNodes(deviceId);
866 backupNodes.forEach(backupNode -> { 866 backupNodes.forEach(backupNode -> {
867 if (lastBackupTimes.getOrDefault(new BackupOperation(backupNode, deviceId), 0L) 867 if (lastBackupTimes.getOrDefault(new BackupOperation(backupNode, deviceId), 0L)
......
...@@ -321,7 +321,7 @@ public class DistributedGroupStoreTest { ...@@ -321,7 +321,7 @@ public class DistributedGroupStoreTest {
321 321
322 List<GroupEvent> eventsAfterAdds = delegate.eventsSeen(); 322 List<GroupEvent> eventsAfterAdds = delegate.eventsSeen();
323 assertThat(eventsAfterAdds, hasSize(2)); 323 assertThat(eventsAfterAdds, hasSize(2));
324 - eventsAfterAdds.stream().forEach(event -> assertThat(event.type(), is(GroupEvent.Type.GROUP_ADD_REQUESTED))); 324 + eventsAfterAdds.forEach(event -> assertThat(event.type(), is(GroupEvent.Type.GROUP_ADD_REQUESTED)));
325 delegate.resetEvents(); 325 delegate.resetEvents();
326 326
327 GroupOperation opAdd = 327 GroupOperation opAdd =
......
...@@ -89,7 +89,6 @@ public class PartitionManager extends AbstractListenerManager<PartitionEvent, Pa ...@@ -89,7 +89,6 @@ public class PartitionManager extends AbstractListenerManager<PartitionEvent, Pa
89 metadataService.addListener(metadataListener); 89 metadataService.addListener(metadataListener);
90 currentClusterMetadata.get() 90 currentClusterMetadata.get()
91 .getPartitions() 91 .getPartitions()
92 - .stream()
93 .forEach(partition -> partitions.put(partition.getId(), new StoragePartition(partition, 92 .forEach(partition -> partitions.put(partition.getId(), new StoragePartition(partition,
94 messagingService, 93 messagingService,
95 clusterService, 94 clusterService,
......
...@@ -169,7 +169,7 @@ public class Bti7000SnmpAlarmConsumer extends AbstractHandlerBehaviour implement ...@@ -169,7 +169,7 @@ public class Bti7000SnmpAlarmConsumer extends AbstractHandlerBehaviour implement
169 if ((deviceAlarms != null) && (deviceAlarms.getActAlarmEntry() != null) 169 if ((deviceAlarms != null) && (deviceAlarms.getActAlarmEntry() != null)
170 && (!deviceAlarms.getActAlarmEntry().isEmpty())) { 170 && (!deviceAlarms.getActAlarmEntry().isEmpty())) {
171 171
172 - deviceAlarms.getActAlarmEntry().values().stream().forEach((alarm) -> { 172 + deviceAlarms.getActAlarmEntry().values().forEach((alarm) -> {
173 DefaultAlarm.Builder alarmBuilder = new DefaultAlarm.Builder( 173 DefaultAlarm.Builder alarmBuilder = new DefaultAlarm.Builder(
174 deviceId, alarm.getActAlarmDescription(), 174 deviceId, alarm.getActAlarmDescription(),
175 mapAlarmSeverity(alarm.getActAlarmSeverity()), 175 mapAlarmSeverity(alarm.getActAlarmSeverity()),
......
...@@ -67,7 +67,7 @@ public class NetSnmpAlarmConsumer extends AbstractHandlerBehaviour implements Al ...@@ -67,7 +67,7 @@ public class NetSnmpAlarmConsumer extends AbstractHandlerBehaviour implements Al
67 IfTable interfaceTable = (IfTable) networkDevice.getRootObject() 67 IfTable interfaceTable = (IfTable) networkDevice.getRootObject()
68 .getEntity(CLASS_REGISTRY.getClassToOidMap().get(IfTable.class)); 68 .getEntity(CLASS_REGISTRY.getClassToOidMap().get(IfTable.class));
69 if (interfaceTable != null) { 69 if (interfaceTable != null) {
70 - interfaceTable.getEntries().values().stream().forEach((ifEntry) -> { 70 + interfaceTable.getEntries().values().forEach((ifEntry) -> {
71 if (ifEntry.getIfAdminStatus() == 1 && ifEntry.getIfOperStatus() == 2) { 71 if (ifEntry.getIfAdminStatus() == 1 && ifEntry.getIfOperStatus() == 2) {
72 alarms.add(new DefaultAlarm.Builder(deviceId, "Link Down.", 72 alarms.add(new DefaultAlarm.Builder(deviceId, "Link Down.",
73 Alarm.SeverityLevel.CRITICAL, 73 Alarm.SeverityLevel.CRITICAL,
......
...@@ -103,7 +103,7 @@ public class CienaWaveserverDeviceDescription extends AbstractHandlerBehaviour ...@@ -103,7 +103,7 @@ public class CienaWaveserverDeviceDescription extends AbstractHandlerBehaviour
103 loadXml(controller.get(deviceId, GENERAL_PORT_REQUEST, XML)); 103 loadXml(controller.get(deviceId, GENERAL_PORT_REQUEST, XML));
104 List<HierarchicalConfiguration> portsConfig = 104 List<HierarchicalConfiguration> portsConfig =
105 parseWaveServerCienaPorts(config); 105 parseWaveServerCienaPorts(config);
106 - portsConfig.stream().forEach(sub -> { 106 + portsConfig.forEach(sub -> {
107 String portId = sub.getString(PORT_ID); 107 String portId = sub.getString(PORT_ID);
108 String name = sub.getString(NAME); 108 String name = sub.getString(NAME);
109 if (LINESIDE_PORT_ID.contains(portId)) { 109 if (LINESIDE_PORT_ID.contains(portId)) {
......
...@@ -177,7 +177,7 @@ public abstract class AbstractCorsaPipeline extends AbstractHandlerBehaviour imp ...@@ -177,7 +177,7 @@ public abstract class AbstractCorsaPipeline extends AbstractHandlerBehaviour imp
177 .filter(key -> groupService.getGroup(deviceId, key) != null) 177 .filter(key -> groupService.getGroup(deviceId, key) != null)
178 .collect(Collectors.toSet()); 178 .collect(Collectors.toSet());
179 179
180 - keys.stream().forEach(key -> { 180 + keys.forEach(key -> {
181 NextObjective obj = pendingGroups.getIfPresent(key); 181 NextObjective obj = pendingGroups.getIfPresent(key);
182 if (obj == null) { 182 if (obj == null) {
183 return; 183 return;
......
...@@ -602,7 +602,7 @@ public class CentecV350Pipeline extends AbstractHandlerBehaviour implements Pipe ...@@ -602,7 +602,7 @@ public class CentecV350Pipeline extends AbstractHandlerBehaviour implements Pipe
602 .filter(key -> groupService.getGroup(deviceId, key) != null) 602 .filter(key -> groupService.getGroup(deviceId, key) != null)
603 .collect(Collectors.toSet()); 603 .collect(Collectors.toSet());
604 604
605 - keys.stream().forEach(key -> { 605 + keys.forEach(key -> {
606 NextObjective obj = pendingGroups.getIfPresent(key); 606 NextObjective obj = pendingGroups.getIfPresent(key);
607 if (obj == null) { 607 if (obj == null) {
608 return; 608 return;
......
...@@ -114,7 +114,7 @@ public class DefaultSingleTablePipeline extends AbstractHandlerBehaviour impleme ...@@ -114,7 +114,7 @@ public class DefaultSingleTablePipeline extends AbstractHandlerBehaviour impleme
114 114
115 TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); 115 TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
116 116
117 - filter.conditions().stream().forEach(selector::add); 117 + filter.conditions().forEach(selector::add);
118 118
119 if (filter.key() != null) { 119 if (filter.key() != null) {
120 selector.add(filter.key()); 120 selector.add(filter.key());
......
...@@ -1099,7 +1099,7 @@ public class Ofdpa2GroupHandler { ...@@ -1099,7 +1099,7 @@ public class Ofdpa2GroupHandler {
1099 .collect(Collectors.toSet()); 1099 .collect(Collectors.toSet());
1100 keys.addAll(otherkeys); 1100 keys.addAll(otherkeys);
1101 1101
1102 - keys.stream().forEach(key -> 1102 + keys.forEach(key ->
1103 processPendingAddGroupsOrNextObjs(key, false)); 1103 processPendingAddGroupsOrNextObjs(key, false));
1104 } 1104 }
1105 } 1105 }
......
...@@ -1158,23 +1158,22 @@ public class SpringOpenTTP extends AbstractHandlerBehaviour ...@@ -1158,23 +1158,22 @@ public class SpringOpenTTP extends AbstractHandlerBehaviour
1158 .filter(key -> groupService.getGroup(deviceId, key) != null) 1158 .filter(key -> groupService.getGroup(deviceId, key) != null)
1159 .collect(Collectors.toSet()); 1159 .collect(Collectors.toSet());
1160 1160
1161 - keys.stream() 1161 + keys.forEach(key -> {
1162 - .forEach(key -> { 1162 + NextObjective obj = pendingGroups
1163 - NextObjective obj = pendingGroups 1163 + .getIfPresent(key);
1164 - .getIfPresent(key); 1164 + if (obj == null) {
1165 - if (obj == null) { 1165 + return;
1166 - return; 1166 + }
1167 - } 1167 + log.debug("Group verified: dev:{} gid:{} <<->> nextId:{}",
1168 - log.debug("Group verified: dev:{} gid:{} <<->> nextId:{}", 1168 + deviceId,
1169 - deviceId, 1169 + groupService.getGroup(deviceId, key).id(),
1170 - groupService.getGroup(deviceId, key).id(), 1170 + obj.id());
1171 - obj.id()); 1171 + pass(obj);
1172 - pass(obj); 1172 + pendingGroups.invalidate(key);
1173 - pendingGroups.invalidate(key); 1173 + flowObjectiveStore.putNextGroup(
1174 - flowObjectiveStore.putNextGroup( 1174 + obj.id(),
1175 - obj.id(), 1175 + new SpringOpenGroup(key, null));
1176 - new SpringOpenGroup(key, null)); 1176 + });
1177 - });
1178 1177
1179 if (!pendingGroups.asMap().isEmpty()) { 1178 if (!pendingGroups.asMap().isEmpty()) {
1180 // Periodically execute only if entry remains in pendingGroups. 1179 // Periodically execute only if entry remains in pendingGroups.
......
...@@ -65,7 +65,7 @@ public class LumentumAlarmConsumer extends AbstractHandlerBehaviour implements A ...@@ -65,7 +65,7 @@ public class LumentumAlarmConsumer extends AbstractHandlerBehaviour implements A
65 } 65 }
66 66
67 // Gets the alarm table and for each entry get the ID and create the proper alarm. 67 // Gets the alarm table and for each entry get the ID and create the proper alarm.
68 - snmp.get(ALARMS_TABLE_OID).stream() 68 + snmp.get(ALARMS_TABLE_OID)
69 .forEach(alarm -> snmp.get(ALARMS_ID_OID).forEach(alarmIdEvent -> { 69 .forEach(alarm -> snmp.get(ALARMS_ID_OID).forEach(alarmIdEvent -> {
70 int alarmId = getAlarmId(alarmIdEvent); 70 int alarmId = getAlarmId(alarmIdEvent);
71 alarms.add(new DefaultAlarm.Builder(deviceId, getMessage(alarmId), 71 alarms.add(new DefaultAlarm.Builder(deviceId, getMessage(alarmId),
......
...@@ -153,11 +153,10 @@ public class LumentumFlowRuleProgrammable extends AbstractHandlerBehaviour imple ...@@ -153,11 +153,10 @@ public class LumentumFlowRuleProgrammable extends AbstractHandlerBehaviour imple
153 153
154 // Cache the cookie/priority 154 // Cache the cookie/priority
155 CrossConnectCache cache = this.handler().get(CrossConnectCache.class); 155 CrossConnectCache cache = this.handler().get(CrossConnectCache.class);
156 - added.stream() 156 + added.forEach(xc -> cache.set(
157 - .forEach(xc -> cache.set( 157 + Objects.hash(data().deviceId(), xc.selector(), xc.treatment()),
158 - Objects.hash(data().deviceId(), xc.selector(), xc.treatment()), 158 + xc.id(),
159 - xc.id(), 159 + xc.priority()));
160 - xc.priority()));
161 160
162 return added; 161 return added;
163 } 162 }
...@@ -185,9 +184,8 @@ public class LumentumFlowRuleProgrammable extends AbstractHandlerBehaviour imple ...@@ -185,9 +184,8 @@ public class LumentumFlowRuleProgrammable extends AbstractHandlerBehaviour imple
185 184
186 // Remove flow rule from cache 185 // Remove flow rule from cache
187 CrossConnectCache cache = this.handler().get(CrossConnectCache.class); 186 CrossConnectCache cache = this.handler().get(CrossConnectCache.class);
188 - removed.stream() 187 + removed.forEach(xc -> cache.remove(
189 - .forEach(xc -> cache.remove( 188 + Objects.hash(data().deviceId(), xc.selector(), xc.treatment())));
190 - Objects.hash(data().deviceId(), xc.selector(), xc.treatment())));
191 189
192 return removed; 190 return removed;
193 } 191 }
......
...@@ -69,7 +69,7 @@ public class YangXmlUtils { ...@@ -69,7 +69,7 @@ public class YangXmlUtils {
69 XMLConfiguration complete = new XMLConfiguration(); 69 XMLConfiguration complete = new XMLConfiguration();
70 List<String> paths = new ArrayList<>(); 70 List<String> paths = new ArrayList<>();
71 Map<String, String> valuesWithKey = new HashMap<>(); 71 Map<String, String> valuesWithKey = new HashMap<>();
72 - values.keySet().stream().forEach(path -> { 72 + values.keySet().forEach(path -> {
73 List<String> allPaths = findPaths(cfg, path); 73 List<String> allPaths = findPaths(cfg, path);
74 String key = nullIsNotFound(allPaths.isEmpty() ? null : allPaths.get(0), 74 String key = nullIsNotFound(allPaths.isEmpty() ? null : allPaths.get(0),
75 "Yang model does not contain desired path"); 75 "Yang model does not contain desired path");
...@@ -163,7 +163,7 @@ public class YangXmlUtils { ...@@ -163,7 +163,7 @@ public class YangXmlUtils {
163 HierarchicalConfiguration originalCfg, String path, 163 HierarchicalConfiguration originalCfg, String path,
164 String originalKey) { 164 String originalKey) {
165 //consider each sub configuration 165 //consider each sub configuration
166 - configurations.stream().forEach(config -> { 166 + configurations.forEach(config -> {
167 167
168 YangElement element = new YangElement(path, new HashMap<>()); 168 YangElement element = new YangElement(path, new HashMap<>());
169 //for each of the keys of the sub configuration 169 //for each of the keys of the sub configuration
......
...@@ -106,7 +106,7 @@ public class YangXmlUtilsTest { ...@@ -106,7 +106,7 @@ public class YangXmlUtilsTest {
106 List<ControllerInfo> controllers = 106 List<ControllerInfo> controllers =
107 ImmutableList.of(new ControllerInfo(IpAddress.valueOf("1.1.1.1"), 1, "tcp"), 107 ImmutableList.of(new ControllerInfo(IpAddress.valueOf("1.1.1.1"), 1, "tcp"),
108 new ControllerInfo(IpAddress.valueOf("2.2.2.2"), 2, "tcp")); 108 new ControllerInfo(IpAddress.valueOf("2.2.2.2"), 2, "tcp"));
109 - controllers.stream().forEach(cInfo -> { 109 + controllers.forEach(cInfo -> {
110 elements.add(new YangElement("controller", ImmutableMap.of("id", cInfo.target(), 110 elements.add(new YangElement("controller", ImmutableMap.of("id", cInfo.target(),
111 "ip-address", cInfo.ip().toString()))); 111 "ip-address", cInfo.ip().toString())));
112 }); 112 });
...@@ -162,4 +162,4 @@ public class YangXmlUtilsTest { ...@@ -162,4 +162,4 @@ public class YangXmlUtilsTest {
162 return YangXmlUtilsAdap.class.getResourceAsStream(file); 162 return YangXmlUtilsAdap.class.getResourceAsStream(file);
163 } 163 }
164 } 164 }
165 -}
...\ No newline at end of file ...\ No newline at end of file
165 +}
......
...@@ -216,7 +216,7 @@ public class MeterManager extends AbstractListenerProviderRegistry<MeterEvent, M ...@@ -216,7 +216,7 @@ public class MeterManager extends AbstractListenerProviderRegistry<MeterEvent, M
216 .filter(m -> storedMeterMap.remove(Pair.of(m.deviceId(), m.id())) != null) 216 .filter(m -> storedMeterMap.remove(Pair.of(m.deviceId(), m.id())) != null)
217 .forEach(m -> store.updateMeterState(m)); 217 .forEach(m -> store.updateMeterState(m));
218 218
219 - storedMeterMap.values().stream().forEach(m -> { 219 + storedMeterMap.values().forEach(m -> {
220 if (m.state() == MeterState.PENDING_ADD) { 220 if (m.state() == MeterState.PENDING_ADD) {
221 provider().performMeterOperation(m.deviceId(), 221 provider().performMeterOperation(m.deviceId(),
222 new MeterOperation(m, 222 new MeterOperation(m,
......
...@@ -78,8 +78,7 @@ public class GrpcRemoteServiceProvider implements RemoteServiceContextProvider { ...@@ -78,8 +78,7 @@ public class GrpcRemoteServiceProvider implements RemoteServiceContextProvider {
78 rpcRegistry.unregister(this); 78 rpcRegistry.unregister(this);
79 79
80 // shutdown all channels 80 // shutdown all channels
81 - channels.values().stream() 81 + channels.values().forEach(ManagedChannel::shutdown);
82 - .forEach(ManagedChannel::shutdown);
83 // Should we wait for shutdown? How? 82 // Should we wait for shutdown? How?
84 channels.clear(); 83 channels.clear();
85 log.info("Stopped"); 84 log.info("Stopped");
......
...@@ -143,8 +143,7 @@ public class GrpcRemoteServiceServer { ...@@ -143,8 +143,7 @@ public class GrpcRemoteServiceServer {
143 Thread.currentThread().interrupt(); 143 Thread.currentThread().interrupt();
144 } 144 }
145 145
146 - registeredProviders.stream() 146 + registeredProviders.forEach(deviceProviderRegistry::unregister);
147 - .forEach(deviceProviderRegistry::unregister);
148 147
149 server.shutdown(); 148 server.shutdown();
150 // Should we wait for shutdown? 149 // Should we wait for shutdown?
......
...@@ -307,7 +307,7 @@ public class NetconfDeviceProvider extends AbstractProvider ...@@ -307,7 +307,7 @@ public class NetconfDeviceProvider extends AbstractProvider
307 NetconfProviderConfig cfg = cfgService.getConfig(appId, NetconfProviderConfig.class); 307 NetconfProviderConfig cfg = cfgService.getConfig(appId, NetconfProviderConfig.class);
308 if (cfg != null) { 308 if (cfg != null) {
309 try { 309 try {
310 - cfg.getDevicesAddresses().stream().forEach(addr -> { 310 + cfg.getDevicesAddresses().forEach(addr -> {
311 DeviceId deviceId = getDeviceId(addr.ip().toString(), addr.port()); 311 DeviceId deviceId = getDeviceId(addr.ip().toString(), addr.port());
312 Preconditions.checkNotNull(deviceId, ISNULL); 312 Preconditions.checkNotNull(deviceId, ISNULL);
313 //Netconf configuration object 313 //Netconf configuration object
...@@ -375,7 +375,7 @@ public class NetconfDeviceProvider extends AbstractProvider ...@@ -375,7 +375,7 @@ public class NetconfDeviceProvider extends AbstractProvider
375 if (cfg != null) { 375 if (cfg != null) {
376 log.info("Checking connection to devices in configuration"); 376 log.info("Checking connection to devices in configuration");
377 try { 377 try {
378 - cfg.getDevicesAddresses().stream().forEach(addr -> { 378 + cfg.getDevicesAddresses().forEach(addr -> {
379 DeviceId deviceId = getDeviceId(addr.ip().toString(), addr.port()); 379 DeviceId deviceId = getDeviceId(addr.ip().toString(), addr.port());
380 Preconditions.checkNotNull(deviceId, ISNULL); 380 Preconditions.checkNotNull(deviceId, ISNULL);
381 //Netconf configuration object 381 //Netconf configuration object
......
...@@ -212,7 +212,7 @@ public class RestDeviceProvider extends AbstractProvider ...@@ -212,7 +212,7 @@ public class RestDeviceProvider extends AbstractProvider
212 deviceAdded(device); 212 deviceAdded(device);
213 }); 213 });
214 //Removing devices not wanted anymore 214 //Removing devices not wanted anymore
215 - toBeRemoved.stream().forEach(device -> deviceRemoved(device.deviceId())); 215 + toBeRemoved.forEach(device -> deviceRemoved(device.deviceId()));
216 216
217 } 217 }
218 } catch (ConfigException e) { 218 } catch (ConfigException e) {
......
...@@ -137,7 +137,7 @@ public class SnmpDeviceProvider extends AbstractProvider ...@@ -137,7 +137,7 @@ public class SnmpDeviceProvider extends AbstractProvider
137 public void deactivate(ComponentContext context) { 137 public void deactivate(ComponentContext context) {
138 138
139 try { 139 try {
140 - controller.getDevices().stream().forEach(device -> { 140 + controller.getDevices().forEach(device -> {
141 deviceBuilderExecutor.execute(new DeviceFactory(device, false)); 141 deviceBuilderExecutor.execute(new DeviceFactory(device, false));
142 }); 142 });
143 deviceBuilderExecutor.awaitTermination(1000, TimeUnit.MILLISECONDS); 143 deviceBuilderExecutor.awaitTermination(1000, TimeUnit.MILLISECONDS);
...@@ -161,7 +161,7 @@ public class SnmpDeviceProvider extends AbstractProvider ...@@ -161,7 +161,7 @@ public class SnmpDeviceProvider extends AbstractProvider
161 SnmpProviderConfig cfg = netCfgService.getConfig(appId, SnmpProviderConfig.class); 161 SnmpProviderConfig cfg = netCfgService.getConfig(appId, SnmpProviderConfig.class);
162 if (cfg != null) { 162 if (cfg != null) {
163 try { 163 try {
164 - cfg.getDevicesInfo().stream().forEach(info -> { 164 + cfg.getDevicesInfo().forEach(info -> {
165 SnmpDevice device = new DefaultSnmpDevice(info.ip().toString(), 165 SnmpDevice device = new DefaultSnmpDevice(info.ip().toString(),
166 info.port(), info.username(), info.password()); 166 info.port(), info.username(), info.password());
167 buildDevice(device); 167 buildDevice(device);
......
...@@ -290,7 +290,7 @@ public class OnosSwaggerMojo extends AbstractMojo { ...@@ -290,7 +290,7 @@ public class OnosSwaggerMojo extends AbstractMojo {
290 private void addJsonSchemaDefinition(ObjectNode definitions, DocletTag tag) { 290 private void addJsonSchemaDefinition(ObjectNode definitions, DocletTag tag) {
291 File definitionsDirectory = new File(srcDirectory + "/src/main/resources/definitions"); 291 File definitionsDirectory = new File(srcDirectory + "/src/main/resources/definitions");
292 if (tag != null) { 292 if (tag != null) {
293 - tag.getParameters().stream().forEach(param -> { 293 + tag.getParameters().forEach(param -> {
294 try { 294 try {
295 File config = new File(definitionsDirectory.getAbsolutePath() + "/" 295 File config = new File(definitionsDirectory.getAbsolutePath() + "/"
296 + param + ".json"); 296 + param + ".json");
...@@ -340,7 +340,7 @@ public class OnosSwaggerMojo extends AbstractMojo { ...@@ -340,7 +340,7 @@ public class OnosSwaggerMojo extends AbstractMojo {
340 responses.set("200", success); 340 responses.set("200", success);
341 if (tag != null && responseJson) { 341 if (tag != null && responseJson) {
342 ObjectNode schema = mapper.createObjectNode(); 342 ObjectNode schema = mapper.createObjectNode();
343 - tag.getParameters().stream().forEach( 343 + tag.getParameters().forEach(
344 param -> schema.put("$ref", "#/definitions/" + param)); 344 param -> schema.put("$ref", "#/definitions/" + param));
345 success.set("schema", schema); 345 success.set("schema", schema);
346 } 346 }
...@@ -403,7 +403,7 @@ public class OnosSwaggerMojo extends AbstractMojo { ...@@ -403,7 +403,7 @@ public class OnosSwaggerMojo extends AbstractMojo {
403 if (tag != null && (method.toLowerCase().equals("post") || 403 if (tag != null && (method.toLowerCase().equals("post") ||
404 method.toLowerCase().equals("put"))) { 404 method.toLowerCase().equals("put"))) {
405 ObjectNode schema = mapper.createObjectNode(); 405 ObjectNode schema = mapper.createObjectNode();
406 - tag.getParameters().stream().forEach(param -> { 406 + tag.getParameters().forEach(param -> {
407 schema.put("$ref", "#/definitions/" + param); 407 schema.put("$ref", "#/definitions/" + param);
408 }); 408 });
409 individualParameterNode.set("schema", schema); 409 individualParameterNode.set("schema", schema);
......