aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/apps/segmentrouting
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/apps/segmentrouting')
-rw-r--r--framework/src/onos/apps/segmentrouting/pom.xml2
-rw-r--r--framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/DeviceConfiguration.java25
-rw-r--r--framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/ECMPShortestPathGraph.java26
-rw-r--r--framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/IpHandler.java4
-rw-r--r--framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java2
-rw-r--r--framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfig.java19
-rw-r--r--framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigException.java15
-rw-r--r--framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigManager.java29
-rw-r--r--framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/NetworkConfigService.java15
-rw-r--r--framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/PktLinkConfig.java17
-rw-r--r--framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/SegmentRouterConfig.java23
-rw-r--r--framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultEdgeGroupHandler.java6
-rw-r--r--framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java16
-rw-r--r--framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultTransitGroupHandler.java8
-rw-r--r--framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/NeighborSet.java6
15 files changed, 156 insertions, 57 deletions
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 @@
<parent>
<artifactId>onos-apps</artifactId>
<groupId>org.onosproject</groupId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
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<Integer> allSegmentIds = new ArrayList<Integer>();
+ private final List<Integer> allSegmentIds = new ArrayList<>();
private final HashMap<DeviceId, SegmentRouterInfo> 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<PortNumber, Ip4Address>();
+ 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<Ip4Address>(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<Ip4Prefix>(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<DeviceId> distanceSwArray = distanceDeviceMap
.get(currDistance + 1);
if (distanceSwArray == null) {
- distanceSwArray = new ArrayList<DeviceId>();
+ distanceSwArray = new ArrayList<>();
distanceSwArray.add(reachedDevice);
distanceDeviceMap.put(currDistance + 1, distanceSwArray);
} else {
@@ -120,7 +120,7 @@ public class ECMPShortestPathGraph {
ArrayList<Link> upstreamLinkArray =
upstreamLinks.get(reachedDevice);
if (upstreamLinkArray == null) {
- upstreamLinkArray = new ArrayList<Link>();
+ 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<DeviceId> distanceSwArray = distanceDeviceMap
.get(currDistance + 1);
if (distanceSwArray == null) {
- distanceSwArray = new ArrayList<DeviceId>();
+ distanceSwArray = new ArrayList<>();
distanceSwArray.add(reachedDevice);
distanceDeviceMap.put(currDistance + 1, distanceSwArray);
} else {
@@ -194,7 +194,7 @@ public class ECMPShortestPathGraph {
ArrayList<Link> upstreamLinkArray =
upstreamLinks.get(reachedDevice);
if (upstreamLinkArray == null) {
- upstreamLinkArray = new ArrayList<Link>();
+ 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<Link> sofarLinks = new ArrayList<Link>();
+ ArrayList<Link> sofarLinks = new ArrayList<>();
if (path != null && !path.links().isEmpty()) {
sofarLinks.addAll(path.links());
}
@@ -288,12 +288,10 @@ public class ECMPShortestPathGraph {
public HashMap<Integer, HashMap<DeviceId,
ArrayList<Path>>> getCompleteLearnedDeviceesAndPaths() {
- HashMap<Integer, HashMap<DeviceId, ArrayList<Path>>> pathGraph = new
- HashMap<Integer, HashMap<DeviceId, ArrayList<Path>>>();
+ HashMap<Integer, HashMap<DeviceId, ArrayList<Path>>> pathGraph = new HashMap<>();
for (Integer itrIndx : distanceDeviceMap.keySet()) {
- HashMap<DeviceId, ArrayList<Path>> swMap = new
- HashMap<DeviceId, ArrayList<Path>>();
+ HashMap<DeviceId, ArrayList<Path>> swMap = new HashMap<>();
for (DeviceId sw : distanceDeviceMap.get(itrIndx)) {
swMap.put(sw, getECMPPaths(sw));
}
@@ -314,12 +312,10 @@ public class ECMPShortestPathGraph {
public HashMap<Integer, HashMap<DeviceId,
ArrayList<ArrayList<DeviceId>>>> getAllLearnedSwitchesAndVia() {
- HashMap<Integer, HashMap<DeviceId, ArrayList<ArrayList<DeviceId>>>> deviceViaMap =
- new HashMap<Integer, HashMap<DeviceId, ArrayList<ArrayList<DeviceId>>>>();
+ HashMap<Integer, HashMap<DeviceId, ArrayList<ArrayList<DeviceId>>>> deviceViaMap = new HashMap<>();
for (Integer itrIndx : distanceDeviceMap.keySet()) {
- HashMap<DeviceId, ArrayList<ArrayList<DeviceId>>> swMap =
- new HashMap<DeviceId, ArrayList<ArrayList<DeviceId>>>();
+ HashMap<DeviceId, ArrayList<ArrayList<DeviceId>>> swMap = new HashMap<>();
for (DeviceId sw : distanceDeviceMap.get(itrIndx)) {
ArrayList<ArrayList<DeviceId>> 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<Ip4Address, ConcurrentLinkedQueue<IPv4>>();
+ ipPacketQueue = new ConcurrentHashMap<>();
}
/**
@@ -104,7 +104,7 @@ public class IpHandler {
Ip4Address destIpAddress = Ip4Address.valueOf(ipPacket.getDestinationAddress());
if (ipPacketQueue.get(destIpAddress) == null) {
- ConcurrentLinkedQueue<IPv4> queue = new ConcurrentLinkedQueue<IPv4>();
+ ConcurrentLinkedQueue<IPv4> 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<DeviceId> nextHops) {
TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder();
- List<ForwardingObjective.Builder> fwdObjBuilders = new ArrayList<ForwardingObjective.Builder>();
+ List<ForwardingObjective.Builder> 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<SwitchConfig>();
- links = new ArrayList<LinkConfig>();
+ 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<SwitchConfig> getConfiguredAllowedSwitches() {
- List<SwitchConfig> allowed = new ArrayList<SwitchConfig>();
+ List<SwitchConfig> 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<LinkConfig> getConfiguredAllowedLinks() {
- List<LinkConfig> allowed = new ArrayList<LinkConfig>();
+ List<LinkConfig> 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<SwitchConfig> swConfList) {
- Set<DeviceId> swDpids = new HashSet<DeviceId>();
- Set<String> swNames = new HashSet<String>();
+ Set<DeviceId> swDpids = new HashSet<>();
+ Set<String> 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<DeviceId, SwitchConfig>();
- configuredLinks = new ConcurrentHashMap<Link, LinkConfig>();
- nameToDpid = new HashMap<String, DeviceId>();
+ 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<String, String>();
+ 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<String, String>();
- adjacencySids = new ArrayList<AdjacencySid>();
- subnets = new ArrayList<Subnet>();
+ 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<JsonNode> i = fe.getValue().elements();
- ports = new ArrayList<Integer>();
+ 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<Set<DeviceId>> powerSet = getPowerSetOfNeighbors(neighbors);
log.trace("createGroupsAtEdgeRouter: The size of neighbor powerset "
+ "for sw {} is {}", deviceId, powerSet.size());
- Set<NeighborSet> nsSet = new HashSet<NeighborSet>();
+ Set<NeighborSet> nsSet = new HashSet<>();
for (Set<DeviceId> combo : powerSet) {
if (combo.isEmpty()) {
continue;
@@ -148,7 +148,7 @@ public class DefaultEdgeGroupHandler extends DefaultGroupHandler {
Set<DeviceId> updatedNeighbors) {
Set<Set<DeviceId>> powerSet = getPowerSetOfNeighbors(updatedNeighbors);
- Set<DeviceId> tmp = new HashSet<DeviceId>();
+ Set<DeviceId> tmp = new HashSet<>();
tmp.addAll(updatedNeighbors);
tmp.remove(impactedNeighbor);
Set<Set<DeviceId>> tmpPowerSet = getPowerSetOfNeighbors(tmp);
@@ -156,7 +156,7 @@ public class DefaultEdgeGroupHandler extends DefaultGroupHandler {
// Compute the impacted neighbor sets
powerSet.removeAll(tmpPowerSet);
- Set<NeighborSet> nsSet = new HashSet<NeighborSet>();
+ Set<NeighborSet> nsSet = new HashSet<>();
for (Set<DeviceId> 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<PortNumber> ports = new HashSet<PortNumber>();
+ Set<PortNumber> ports = new HashSet<>();
ports.add(portToNeighbor);
devicePortMap.put(neighborId, ports);
}
@@ -383,8 +383,8 @@ public class DefaultGroupHandler {
}
protected Set<Set<DeviceId>> getPowerSetOfNeighbors(Set<DeviceId> neighbors) {
- List<DeviceId> list = new ArrayList<DeviceId>(neighbors);
- Set<Set<DeviceId>> sets = new HashSet<Set<DeviceId>>();
+ List<DeviceId> list = new ArrayList<>(neighbors);
+ Set<Set<DeviceId>> 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<DeviceId> neighborSubSet = new HashSet<DeviceId>();
+ Set<DeviceId> 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<Integer> getSegmentIdsTobePairedWithNeighborSet(Set<DeviceId> neighbors) {
- List<Integer> nsSegmentIds = new ArrayList<Integer>();
+ List<Integer> 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<NeighborSet> nsSet = new HashSet<NeighborSet>();
+ Set<NeighborSet> nsSet = new HashSet<>();
for (Set<DeviceId> combo : sets) {
if (combo.isEmpty()) {
continue;
@@ -137,7 +137,7 @@ public class DefaultTransitGroupHandler extends DefaultGroupHandler {
Set<DeviceId> updatedNeighbors) {
Set<Set<DeviceId>> powerSet = getPowerSetOfNeighbors(updatedNeighbors);
- Set<DeviceId> tmp = new HashSet<DeviceId>();
+ Set<DeviceId> tmp = new HashSet<>();
tmp.addAll(updatedNeighbors);
tmp.remove(impactedNeighbor);
Set<Set<DeviceId>> tmpPowerSet = getPowerSetOfNeighbors(tmp);
@@ -146,7 +146,7 @@ public class DefaultTransitGroupHandler extends DefaultGroupHandler {
powerSet.removeAll(tmpPowerSet);
powerSet = filterEdgeRouterOnlyPairings(powerSet);
- Set<NeighborSet> nsSet = new HashSet<NeighborSet>();
+ Set<NeighborSet> nsSet = new HashSet<>();
for (Set<DeviceId> combo : powerSet) {
if (combo.isEmpty()) {
continue;
@@ -163,7 +163,7 @@ public class DefaultTransitGroupHandler extends DefaultGroupHandler {
}
private Set<Set<DeviceId>> filterEdgeRouterOnlyPairings(Set<Set<DeviceId>> sets) {
- Set<Set<DeviceId>> fiteredSets = new HashSet<Set<DeviceId>>();
+ Set<Set<DeviceId>> fiteredSets = new HashSet<>();
for (Set<DeviceId> 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<DeviceId> neighbors) {
checkNotNull(neighbors);
this.edgeLabel = NO_EDGE_LABEL;
- this.neighbors = new HashSet<DeviceId>();
+ this.neighbors = new HashSet<>();
this.neighbors.addAll(neighbors);
}
@@ -57,7 +57,7 @@ public class NeighborSet {
public NeighborSet(Set<DeviceId> neighbors, int edgeLabel) {
checkNotNull(neighbors);
this.edgeLabel = edgeLabel;
- this.neighbors = new HashSet<DeviceId>();
+ 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<DeviceId>();
+ this.neighbors = new HashSet<>();
}
/**