From 81391595dca425ae58e2294898f09f11d9a32dbc Mon Sep 17 00:00:00 2001 From: Ashlee Young Date: Tue, 22 Sep 2015 12:49:09 -0700 Subject: bringing src to commit tag 65d551b50e782b0c1ea76c1a9ed1c5a801a5a7e4 Change-Id: Ib2da78962eaef856f418636c31b0f5c84286244f --- framework/src/onos/apps/segmentrouting/pom.xml | 2 +- .../segmentrouting/DeviceConfiguration.java | 25 ++++++++++++++----- .../segmentrouting/ECMPShortestPathGraph.java | 26 ++++++++----------- .../org/onosproject/segmentrouting/IpHandler.java | 4 +-- .../segmentrouting/RoutingRulePopulator.java | 2 +- .../segmentrouting/config/NetworkConfig.java | 19 ++++++++++++-- .../config/NetworkConfigException.java | 15 +++++++++++ .../config/NetworkConfigManager.java | 29 ++++++++++++++++------ .../config/NetworkConfigService.java | 15 +++++++++++ .../segmentrouting/config/PktLinkConfig.java | 17 ++++++++++++- .../segmentrouting/config/SegmentRouterConfig.java | 23 ++++++++++++++--- .../grouphandler/DefaultEdgeGroupHandler.java | 6 ++--- .../grouphandler/DefaultGroupHandler.java | 16 ++++++------ .../grouphandler/DefaultTransitGroupHandler.java | 8 +++--- .../segmentrouting/grouphandler/NeighborSet.java | 6 ++--- 15 files changed, 156 insertions(+), 57 deletions(-) (limited to 'framework/src/onos/apps/segmentrouting') diff --git a/framework/src/onos/apps/segmentrouting/pom.xml b/framework/src/onos/apps/segmentrouting/pom.xml index 3ed4c4fe..83ae76db 100644 --- a/framework/src/onos/apps/segmentrouting/pom.xml +++ b/framework/src/onos/apps/segmentrouting/pom.xml @@ -21,7 +21,7 @@ onos-apps org.onosproject - 1.3.0-SNAPSHOT + 1.4.0-SNAPSHOT ../pom.xml diff --git a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/DeviceConfiguration.java b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/DeviceConfiguration.java index d82eb5ec..ef9d444a 100644 --- a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/DeviceConfiguration.java +++ b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/DeviceConfiguration.java @@ -1,3 +1,18 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.onosproject.segmentrouting; import com.google.common.collect.Lists; @@ -33,7 +48,7 @@ public class DeviceConfiguration implements DeviceProperties { private static final Logger log = LoggerFactory .getLogger(DeviceConfiguration.class); - private final List allSegmentIds = new ArrayList(); + private final List allSegmentIds = new ArrayList<>(); private final HashMap deviceConfigMap = new HashMap<>(); private final NetworkConfigManager configService; @@ -73,7 +88,7 @@ public class DeviceConfiguration implements DeviceProperties { info.ip = prefix.address(); info.isEdge = ((SegmentRouterConfig) cfg).isEdgeRouter(); info.subnets = new HashMap<>(); - info.gatewayIps = new HashMap(); + info.gatewayIps = new HashMap<>(); for (Subnet s: ((SegmentRouterConfig) cfg).getSubnets()) { info.subnets.put(PortNumber.portNumber(s.getPortNo()), Ip4Prefix.valueOf(s.getSubnetIp())); @@ -264,8 +279,7 @@ public class DeviceConfiguration implements DeviceProperties { log.debug("getSubnetGatewayIps for device{} is {}", deviceId, deviceConfigMap.get(deviceId).gatewayIps.values()); - return new ArrayList(deviceConfigMap. - get(deviceId).gatewayIps.values()); + return new ArrayList<>(deviceConfigMap.get(deviceId).gatewayIps.values()); } else { return null; } @@ -282,8 +296,7 @@ public class DeviceConfiguration implements DeviceProperties { log.debug("getSubnets for device{} is {}", deviceId, deviceConfigMap.get(deviceId).subnets.values()); - return new ArrayList(deviceConfigMap. - get(deviceId).subnets.values()); + return new ArrayList<>(deviceConfigMap.get(deviceId).subnets.values()); } else { return null; } diff --git a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/ECMPShortestPathGraph.java b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/ECMPShortestPathGraph.java index cd28fcf9..2e2041c4 100644 --- a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/ECMPShortestPathGraph.java +++ b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/ECMPShortestPathGraph.java @@ -97,7 +97,7 @@ public class ECMPShortestPathGraph { } Integer distance = deviceSearched.get(reachedDevice); - if ((distance != null) && (distance.intValue() < (currDistance + 1))) { + if ((distance != null) && (distance < (currDistance + 1))) { continue; } if (distance == null) { @@ -109,7 +109,7 @@ public class ECMPShortestPathGraph { ArrayList distanceSwArray = distanceDeviceMap .get(currDistance + 1); if (distanceSwArray == null) { - distanceSwArray = new ArrayList(); + distanceSwArray = new ArrayList<>(); distanceSwArray.add(reachedDevice); distanceDeviceMap.put(currDistance + 1, distanceSwArray); } else { @@ -120,7 +120,7 @@ public class ECMPShortestPathGraph { ArrayList upstreamLinkArray = upstreamLinks.get(reachedDevice); if (upstreamLinkArray == null) { - upstreamLinkArray = new ArrayList(); + upstreamLinkArray = new ArrayList<>(); upstreamLinkArray.add(copyDefaultLink(link)); //upstreamLinkArray.add(link); upstreamLinks.put(reachedDevice, upstreamLinkArray); @@ -171,7 +171,7 @@ public class ECMPShortestPathGraph { } Integer distance = deviceSearched.get(reachedDevice); - if ((distance != null) && (distance.intValue() < (currDistance + 1))) { + if ((distance != null) && (distance < (currDistance + 1))) { continue; } if (distance == null) { @@ -183,7 +183,7 @@ public class ECMPShortestPathGraph { ArrayList distanceSwArray = distanceDeviceMap .get(currDistance + 1); if (distanceSwArray == null) { - distanceSwArray = new ArrayList(); + distanceSwArray = new ArrayList<>(); distanceSwArray.add(reachedDevice); distanceDeviceMap.put(currDistance + 1, distanceSwArray); } else { @@ -194,7 +194,7 @@ public class ECMPShortestPathGraph { ArrayList upstreamLinkArray = upstreamLinks.get(reachedDevice); if (upstreamLinkArray == null) { - upstreamLinkArray = new ArrayList(); + upstreamLinkArray = new ArrayList<>(); upstreamLinkArray.add(copyDefaultLink(link)); upstreamLinks.put(reachedDevice, upstreamLinkArray); } else { @@ -234,7 +234,7 @@ public class ECMPShortestPathGraph { for (Link upstreamLink : upstreamLinks.get(dstDeviceDeviceId)) { /* Deep clone the path object */ Path sofarPath; - ArrayList sofarLinks = new ArrayList(); + ArrayList sofarLinks = new ArrayList<>(); if (path != null && !path.links().isEmpty()) { sofarLinks.addAll(path.links()); } @@ -288,12 +288,10 @@ public class ECMPShortestPathGraph { public HashMap>> getCompleteLearnedDeviceesAndPaths() { - HashMap>> pathGraph = new - HashMap>>(); + HashMap>> pathGraph = new HashMap<>(); for (Integer itrIndx : distanceDeviceMap.keySet()) { - HashMap> swMap = new - HashMap>(); + HashMap> swMap = new HashMap<>(); for (DeviceId sw : distanceDeviceMap.get(itrIndx)) { swMap.put(sw, getECMPPaths(sw)); } @@ -314,12 +312,10 @@ public class ECMPShortestPathGraph { public HashMap>>> getAllLearnedSwitchesAndVia() { - HashMap>>> deviceViaMap = - new HashMap>>>(); + HashMap>>> deviceViaMap = new HashMap<>(); for (Integer itrIndx : distanceDeviceMap.keySet()) { - HashMap>> swMap = - new HashMap>>(); + HashMap>> swMap = new HashMap<>(); for (DeviceId sw : distanceDeviceMap.get(itrIndx)) { ArrayList> swViaArray = new ArrayList<>(); diff --git a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/IpHandler.java b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/IpHandler.java index 81d00f50..e37fe52a 100644 --- a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/IpHandler.java +++ b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/IpHandler.java @@ -50,7 +50,7 @@ public class IpHandler { public IpHandler(SegmentRoutingManager srManager) { this.srManager = srManager; this.config = checkNotNull(srManager.deviceConfiguration); - ipPacketQueue = new ConcurrentHashMap>(); + ipPacketQueue = new ConcurrentHashMap<>(); } /** @@ -104,7 +104,7 @@ public class IpHandler { Ip4Address destIpAddress = Ip4Address.valueOf(ipPacket.getDestinationAddress()); if (ipPacketQueue.get(destIpAddress) == null) { - ConcurrentLinkedQueue queue = new ConcurrentLinkedQueue(); + ConcurrentLinkedQueue queue = new ConcurrentLinkedQueue<>(); queue.add(ipPacket); ipPacketQueue.put(destIpAddress, queue); } else { diff --git a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java index 59fc4ca7..d802be91 100644 --- a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java +++ b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java @@ -221,7 +221,7 @@ public class RoutingRulePopulator { Set nextHops) { TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder(); - List fwdObjBuilders = new ArrayList(); + List fwdObjBuilders = new ArrayList<>(); // TODO Handle the case of Bos == false sbuilder.matchMplsLabel(MplsLabel.mplsLabel(config.getSegmentId(destSwId))); diff --git a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfig.java b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfig.java index 6ae0779e..0c7749e6 100644 --- a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfig.java +++ b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfig.java @@ -1,3 +1,18 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.onosproject.segmentrouting.config; import java.util.ArrayList; @@ -30,8 +45,8 @@ public class NetworkConfig { * Default constructor. */ public NetworkConfig() { - switches = new ArrayList(); - links = new ArrayList(); + switches = new ArrayList<>(); + links = new ArrayList<>(); } @JsonProperty("comment") diff --git a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigException.java b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigException.java index 91942216..0c0dac86 100644 --- a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigException.java +++ b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigException.java @@ -1,3 +1,18 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.onosproject.segmentrouting.config; import org.onosproject.net.DeviceId; diff --git a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigManager.java b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigManager.java index 44e4f1c6..f034f372 100644 --- a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigManager.java +++ b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigManager.java @@ -1,3 +1,18 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.onosproject.segmentrouting.config; import java.io.File; @@ -135,7 +150,7 @@ public class NetworkConfigManager implements NetworkConfigService { @Override public List getConfiguredAllowedSwitches() { - List allowed = new ArrayList(); + List allowed = new ArrayList<>(); for (SwitchConfig swc : configuredSwitches.values()) { if (swc.isAllowed()) { allowed.add(swc); @@ -146,7 +161,7 @@ public class NetworkConfigManager implements NetworkConfigService { @Override public List getConfiguredAllowedLinks() { - List allowed = new ArrayList(); + List allowed = new ArrayList<>(); for (LinkConfig lkc : configuredLinks.values()) { if (lkc.isAllowed()) { allowed.add(lkc); @@ -244,8 +259,8 @@ public class NetworkConfigManager implements NetworkConfigService { } private void validateSwitchConfig(List swConfList) { - Set swDpids = new HashSet(); - Set swNames = new HashSet(); + Set swDpids = new HashSet<>(); + Set swNames = new HashSet<>(); for (SwitchConfig swc : swConfList) { if (swc.getNodeDpid() == null || swc.getDpid() == null) { throw new NetworkConfigException.DpidNotSpecified(swc.getName()); @@ -315,9 +330,9 @@ public class NetworkConfigManager implements NetworkConfigService { */ public void init() { loadNetworkConfig(); - configuredSwitches = new ConcurrentHashMap(); - configuredLinks = new ConcurrentHashMap(); - nameToDpid = new HashMap(); + configuredSwitches = new ConcurrentHashMap<>(); + configuredLinks = new ConcurrentHashMap<>(); + nameToDpid = new HashMap<>(); parseNetworkConfig(); } } diff --git a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigService.java b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigService.java index 56855271..afbb0fcc 100644 --- a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigService.java +++ b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigService.java @@ -1,3 +1,18 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.onosproject.segmentrouting.config; import java.util.List; diff --git a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/PktLinkConfig.java b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/PktLinkConfig.java index c66ac3c7..3c51fa9d 100644 --- a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/PktLinkConfig.java +++ b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/PktLinkConfig.java @@ -1,3 +1,18 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.onosproject.segmentrouting.config; import java.util.List; @@ -33,7 +48,7 @@ public class PktLinkConfig extends LinkConfig { type = lkc.getType(); allowed = lkc.isAllowed(); params = lkc.getParams(); - publishAttributes = new ConcurrentHashMap(); + publishAttributes = new ConcurrentHashMap<>(); parseParams(); validateParams(); setPublishAttributes(); diff --git a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/SegmentRouterConfig.java b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/SegmentRouterConfig.java index 4775c77f..c8d4a54a 100644 --- a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/SegmentRouterConfig.java +++ b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/SegmentRouterConfig.java @@ -1,3 +1,18 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.onosproject.segmentrouting.config; import java.io.IOException; @@ -52,9 +67,9 @@ public class SegmentRouterConfig extends SwitchConfig { this.setLongitude(swc.getLongitude()); this.setParams(swc.getParams()); this.setAllowed(swc.isAllowed()); - publishAttributes = new ConcurrentHashMap(); - adjacencySids = new ArrayList(); - subnets = new ArrayList(); + publishAttributes = new ConcurrentHashMap<>(); + adjacencySids = new ArrayList<>(); + subnets = new ArrayList<>(); parseParams(); validateParams(); setPublishAttributes(); @@ -267,7 +282,7 @@ public class SegmentRouterConfig extends SwitchConfig { } else if (fe.getKey().equals("ports")) { if (fe.getValue().isArray()) { Iterator i = fe.getValue().elements(); - ports = new ArrayList(); + ports = new ArrayList<>(); while (i.hasNext()) { ports.add(i.next().asInt()); } diff --git a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultEdgeGroupHandler.java b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultEdgeGroupHandler.java index 41cf8acc..3dc312df 100644 --- a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultEdgeGroupHandler.java +++ b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultEdgeGroupHandler.java @@ -69,7 +69,7 @@ public class DefaultEdgeGroupHandler extends DefaultGroupHandler { Set> powerSet = getPowerSetOfNeighbors(neighbors); log.trace("createGroupsAtEdgeRouter: The size of neighbor powerset " + "for sw {} is {}", deviceId, powerSet.size()); - Set nsSet = new HashSet(); + Set nsSet = new HashSet<>(); for (Set combo : powerSet) { if (combo.isEmpty()) { continue; @@ -148,7 +148,7 @@ public class DefaultEdgeGroupHandler extends DefaultGroupHandler { Set updatedNeighbors) { Set> powerSet = getPowerSetOfNeighbors(updatedNeighbors); - Set tmp = new HashSet(); + Set tmp = new HashSet<>(); tmp.addAll(updatedNeighbors); tmp.remove(impactedNeighbor); Set> tmpPowerSet = getPowerSetOfNeighbors(tmp); @@ -156,7 +156,7 @@ public class DefaultEdgeGroupHandler extends DefaultGroupHandler { // Compute the impacted neighbor sets powerSet.removeAll(tmpPowerSet); - Set nsSet = new HashSet(); + Set nsSet = new HashSet<>(); for (Set combo : powerSet) { if (combo.isEmpty()) { continue; diff --git a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java index a43a0f09..9bbde2f3 100644 --- a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java +++ b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java @@ -313,13 +313,13 @@ public class DefaultGroupHandler { return -1; } else { log.debug("getNextObjectiveId in device{}: Next objective id {} " - + "created for {}", deviceId, nextId.intValue(), ns); + + "created for {}", deviceId, nextId, ns); } } else { log.trace("getNextObjectiveId in device{}: Next objective id {} " - + "found for {}", deviceId, nextId.intValue(), ns); + + "found for {}", deviceId, nextId, ns); } - return nextId.intValue(); + return nextId; } /** @@ -371,7 +371,7 @@ public class DefaultGroupHandler { if (devicePortMap.get(neighborId) != null) { devicePortMap.get(neighborId).add(portToNeighbor); } else { - Set ports = new HashSet(); + Set ports = new HashSet<>(); ports.add(portToNeighbor); devicePortMap.put(neighborId, ports); } @@ -383,8 +383,8 @@ public class DefaultGroupHandler { } protected Set> getPowerSetOfNeighbors(Set neighbors) { - List list = new ArrayList(neighbors); - Set> sets = new HashSet>(); + List list = new ArrayList<>(neighbors); + Set> sets = new HashSet<>(); // get the number of elements in the neighbors int elements = list.size(); // the number of members of a power set is 2^n @@ -394,7 +394,7 @@ public class DefaultGroupHandler { // run a binary counter for the number of power elements // NOTE: Exclude empty set for (long i = 1; i < powerElements; i++) { - Set neighborSubSet = new HashSet(); + Set neighborSubSet = new HashSet<>(); for (int j = 0; j < elements; j++) { if ((i >> j) % 2 == 1) { neighborSubSet.add(list.get(j)); @@ -411,7 +411,7 @@ public class DefaultGroupHandler { protected List getSegmentIdsTobePairedWithNeighborSet(Set neighbors) { - List nsSegmentIds = new ArrayList(); + List nsSegmentIds = new ArrayList<>(); // Always pair up with no edge label // If (neighbors.size() == 1) { diff --git a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultTransitGroupHandler.java b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultTransitGroupHandler.java index e12426c2..3cb73aba 100644 --- a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultTransitGroupHandler.java +++ b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultTransitGroupHandler.java @@ -63,7 +63,7 @@ public class DefaultTransitGroupHandler extends DefaultGroupHandler { sets = filterEdgeRouterOnlyPairings(sets); log.debug("createGroupsAtTransitRouter: The size of neighbor powerset " + "for sw {} is {}", deviceId, sets.size()); - Set nsSet = new HashSet(); + Set nsSet = new HashSet<>(); for (Set combo : sets) { if (combo.isEmpty()) { continue; @@ -137,7 +137,7 @@ public class DefaultTransitGroupHandler extends DefaultGroupHandler { Set updatedNeighbors) { Set> powerSet = getPowerSetOfNeighbors(updatedNeighbors); - Set tmp = new HashSet(); + Set tmp = new HashSet<>(); tmp.addAll(updatedNeighbors); tmp.remove(impactedNeighbor); Set> tmpPowerSet = getPowerSetOfNeighbors(tmp); @@ -146,7 +146,7 @@ public class DefaultTransitGroupHandler extends DefaultGroupHandler { powerSet.removeAll(tmpPowerSet); powerSet = filterEdgeRouterOnlyPairings(powerSet); - Set nsSet = new HashSet(); + Set nsSet = new HashSet<>(); for (Set combo : powerSet) { if (combo.isEmpty()) { continue; @@ -163,7 +163,7 @@ public class DefaultTransitGroupHandler extends DefaultGroupHandler { } private Set> filterEdgeRouterOnlyPairings(Set> sets) { - Set> fiteredSets = new HashSet>(); + Set> fiteredSets = new HashSet<>(); for (Set deviceSubSet : sets) { if (deviceSubSet.size() > 1) { boolean avoidEdgeRouterPairing = true; diff --git a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/NeighborSet.java b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/NeighborSet.java index 7ada3224..44715d24 100644 --- a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/NeighborSet.java +++ b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/NeighborSet.java @@ -44,7 +44,7 @@ public class NeighborSet { public NeighborSet(Set neighbors) { checkNotNull(neighbors); this.edgeLabel = NO_EDGE_LABEL; - this.neighbors = new HashSet(); + this.neighbors = new HashSet<>(); this.neighbors.addAll(neighbors); } @@ -57,7 +57,7 @@ public class NeighborSet { public NeighborSet(Set neighbors, int edgeLabel) { checkNotNull(neighbors); this.edgeLabel = edgeLabel; - this.neighbors = new HashSet(); + this.neighbors = new HashSet<>(); this.neighbors.addAll(neighbors); } @@ -66,7 +66,7 @@ public class NeighborSet { */ public NeighborSet() { this.edgeLabel = NO_EDGE_LABEL; - this.neighbors = new HashSet(); + this.neighbors = new HashSet<>(); } /** -- cgit 1.2.3-korg