more error-prone issue fix

Change-Id: I49f2cc0459cfddddc6a99e2ebb8ad52d547e2909
This commit is contained in:
Yuta HIGUCHI 2018-01-26 17:24:09 -08:00 committed by Ray Milkey
parent 96b896d043
commit 488a94c31e
36 changed files with 391 additions and 153 deletions

View File

@ -124,18 +124,6 @@
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>3.0.5</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>

View File

@ -124,18 +124,6 @@
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>3.0.5</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>

View File

@ -198,7 +198,7 @@ public class EvpnInstanceRoute {
EvpnInstanceRoute that = (EvpnInstanceRoute) other;
return Objects.equals(prefix, prefix)
return Objects.equals(prefix, that.prefix)
&& Objects.equals(nextHop, that.nextHop)
&& Objects.equals(evpnName, that.evpnName)
&& Objects.equals(rd, that.rd)

View File

@ -115,7 +115,6 @@ public class EvpnRoute {
checkNotNull(prefixMac);
checkNotNull(prefix);
//checkNotNull(nextHop); //next hop can be null in case of MP un reach.
checkNotNull(labelToInt);
this.source = checkNotNull(source);
this.prefix = prefix;
this.prefixMac = prefixMac;
@ -258,7 +257,7 @@ public class EvpnRoute {
EvpnRoute that = (EvpnRoute) other;
return Objects.equals(prefixMac, prefixMac)
return Objects.equals(prefixMac, that.prefixMac)
&& Objects.equals(prefix, that.prefix)
&& Objects.equals(nextHop, that.nextHop)
&& Objects.equals(this.rd, that.rd)

View File

@ -81,7 +81,9 @@ public class EvpnRouteManager implements EvpnRouteService,
@Deactivate
protected void deactivate() {
evpnRouteStore.unsetDelegate(evpnRouteStoreDelegate);
listeners.values().forEach(EvpnListenerQueue::stop);
synchronized (this) {
listeners.values().forEach(EvpnListenerQueue::stop);
}
}
/**
@ -148,6 +150,7 @@ public class EvpnRouteManager implements EvpnRouteService,
}
@Override
public Collection<EvpnRouteTableId> getRouteTables() {
return evpnRouteStore.getRouteTables();
}

View File

@ -48,13 +48,6 @@ public class GraphiteMetricsReporterTest {
gmr = new DefaultGraphiteMetricsReporter();
}
/**
* Tears down graphite metrics reporter instance.
*/
public void tearDown() {
gmr.deactivate();
}
/**
* Tests whether the containsName method can always return the correct result
* with the given metric name and a set of prefixes.

View File

@ -67,7 +67,6 @@ public final class DefaultInfluxMetric implements InfluxMetric {
@Override
public InfluxMetric build() {
checkNotNull(oneMinRate, ONE_MIN_RATE_MSG);
checkNotNull(timestamp, TIMESTAMP_MSG);
return new DefaultInfluxMetric(oneMinRate, parseTime(timestamp));

View File

@ -125,18 +125,6 @@
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>3.0.5</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>

View File

@ -1,57 +0,0 @@
/*
* Copyright 2017-present Open Networking Foundation
*
* 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.netconf.client;
import org.onosproject.config.DynamicConfigEvent;
import org.onosproject.net.DeviceId;
import org.onosproject.yang.model.ResourceId;
/**
* Event details.
*/
public class EventData {
private DeviceId devId;
private ResourceId key;
private DynamicConfigEvent.Type type;
/**
* Creates an instance of EventData.
*
* @param devId device id
* @param key device key
* @param type event type
*/
public EventData(DeviceId devId, ResourceId key, DynamicConfigEvent.Type type) {
devId = devId;
key = key;
type = type;
}
public DeviceId getDevId() {
return devId;
}
public ResourceId getKey() {
return key;
}
public DynamicConfigEvent.Type getType() {
return type;
}
}

View File

@ -398,7 +398,7 @@ public class PceManager implements PceService {
//Log.info("computeExplicitPath :: finalComputedPath " + finalComputedPath);
if (finalComputedPath != null && !finalComputedPath.get(finalComputedPath.size() - 1).links()
.contains((Link) info.value())) {
.contains(info.value())) {
finalComputedPath = null;
}
}
@ -913,7 +913,6 @@ public class PceManager implements PceService {
private boolean releaseSharedBwForNewTunnel(Path computedPath, double bandwidthConstraint,
SharedBandwidthConstraint shBwConstraint) {
checkNotNull(computedPath);
checkNotNull(bandwidthConstraint);
double bwToAllocate;
Double additionalBwValue = null;
@ -1071,7 +1070,6 @@ public class PceManager implements PceService {
private boolean reserveBandwidth(Path computedPath, double bandwidthConstraint,
SharedBandwidthConstraint shBwConstraint) {
checkNotNull(computedPath);
checkNotNull(bandwidthConstraint);
Resource resource = null;
double bwToAllocate = 0;
Map<Link, Double> linkMap = new HashMap<>();

View File

@ -772,7 +772,7 @@ public class PceWebTopovMessageHandler extends UiMessageHandler {
private void findTunnelAndHighlights() {
Collection<Tunnel> tunnelSet = null;
Highlights highlights = new Highlights();
paths.removeAll(paths);
paths.clear();
tunnelSet = tunnelService.queryTunnel(MPLS);
if (tunnelSet.size() == 0) {
log.warn("Tunnel does not exist");
@ -819,7 +819,7 @@ public class PceWebTopovMessageHandler extends UiMessageHandler {
*/
private void highlightsForTunnel(List<Tunnel> tunnels) {
Highlights highlights = new Highlights();
paths.removeAll(paths);
paths.clear();
if (tunnels.isEmpty()) {
log.error("path does not exist");

View File

@ -113,7 +113,9 @@ public class RouteManager implements RouteService, RouteAdminService {
@Deactivate
protected void deactivate() {
routeMonitor.shutdown();
listeners.values().forEach(ListenerQueue::stop);
synchronized (this) {
listeners.values().forEach(ListenerQueue::stop);
}
routeStore.unsetDelegate(delegate);
hostService.removeListener(hostListener);
@ -176,6 +178,7 @@ public class RouteManager implements RouteService, RouteAdminService {
return routeSets.stream().flatMap(r -> r.routes().stream()).collect(Collectors.toList());
}
@Override
public Collection<RouteTableId> getRouteTables() {
return routeStore.getRouteTables();
}

View File

@ -160,14 +160,17 @@ public class RouterAdvertisementManager implements RoutingAdvertisementService {
private final Map<ConnectPoint, Map.Entry<ScheduledFuture<?>, List<InterfaceIpAddress>>> transmitters =
new LinkedHashMap<>();
// TODO: should consider using concurrent variants
@GuardedBy(value = "this")
private final Map<DeviceId, List<InterfaceIpAddress>> globalPrefixes = new LinkedHashMap<>();
@Override
public ImmutableMap<DeviceId, List<InterfaceIpAddress>> getGlobalPrefixes() {
public synchronized ImmutableMap<DeviceId, List<InterfaceIpAddress>> getGlobalPrefixes() {
return ImmutableMap.copyOf(globalPrefixes);
}
@SuppressWarnings("GuardedBy")
@GuardedBy(value = "this")
private Function<Interface, Map.Entry<ConnectPoint, List<InterfaceIpAddress>>> prefixGenerator =
i -> {
Map.Entry<ConnectPoint, List<InterfaceIpAddress>> prefixEntry;
@ -282,6 +285,7 @@ public class RouterAdvertisementManager implements RoutingAdvertisementService {
clearThreadPool();
}
@SuppressWarnings("GuardedBy")
// Loading global prefixes for devices from network configuration
private synchronized void loadGlobalPrefixConfig() {
globalPrefixes.clear();
@ -507,6 +511,7 @@ public class RouterAdvertisementManager implements RoutingAdvertisementService {
solicitHostAddress = ipv6Address;
}
@Override
public void run() {
// Router Advertisement header filling. Please refer RFC-2461.
RouterAdvertisement ra = new RouterAdvertisement();

View File

@ -62,4 +62,33 @@
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-XepDisableAllChecks</arg>
<arg>-Xep:BetaApi:OFF</arg>
</compilerArgs>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<compilerArgs>
<arg>-XepDisableAllChecks</arg>
<arg>-Xep:BetaApi:OFF</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -90,6 +90,32 @@
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-XepDisableAllChecks</arg>
<arg>-Xep:BetaApi:OFF</arg>
</compilerArgs>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<compilerArgs>
<arg>-XepDisableAllChecks</arg>
<arg>-Xep:BetaApi:OFF</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@ -51,4 +51,34 @@
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-XepDisableAllChecks</arg>
<arg>-Xep:BetaApi:OFF</arg>
</compilerArgs>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<compilerArgs>
<arg>-XepDisableAllChecks</arg>
<arg>-Xep:BetaApi:OFF</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -44,6 +44,33 @@
<build>
<plugins>
<!-- FIXME: YANG tool generates problematic code -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-XepDisableAllChecks</arg>
<arg>-Xep:BetaApi:OFF</arg>
</compilerArgs>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<compilerArgs>
<arg>-XepDisableAllChecks</arg>
<arg>-Xep:BetaApi:OFF</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.onosproject</groupId>
<artifactId>onos-yang-maven-plugin</artifactId>

View File

@ -1316,7 +1316,7 @@ public class DistributedTeTopologyStore
TeNodeKey myTeNodeKey;
InternalNetworkNode intNode = null;
if (!parentUpdate) {
intNode = networkNodeMap.get(tpKey.nodeId());
intNode = networkNodeMap.get(tpKey);
if (intNode == null) {
log.error(" node is not in dataStore for tp update {}", tpKey);
return;
@ -1351,7 +1351,7 @@ public class DistributedTeTopologyStore
@Override
public void removeTerminationPoint(TerminationPointKey tpKey) {
// Update InternalNetworkNode
InternalNetworkNode intNode = networkNodeMap.get(tpKey.nodeId());
InternalNetworkNode intNode = networkNodeMap.get(tpKey);
if (intNode != null && CollectionUtils.isNotEmpty(intNode.tpIds())) {
intNode.setChildUpdate(true);
intNode.tpIds().remove(tpKey.tpId());

View File

@ -143,7 +143,7 @@ public final class DefaultBuilder {
for (long i = 0; i < numTtps; i++) {
ttps.put(i, ttpBuilder(i));
}
ttp = ttps.get(FIRST_INDEX);
ttp = ttps.get((long) FIRST_INDEX);
//TeNode
teNode = new DefaultTeNode(teNodeId, underlayTopologyId,
supportTeNodeId, sourceTeNodeId,

View File

@ -697,7 +697,7 @@ public class SimpleTeTopologyStore
if (intNework != null
&& CollectionUtils.isNotEmpty(intNework.nodeIds())) {
intNework.setChildUpdate(true);
intNework.nodeIds().remove(nodeKey.nodeId());
intNework.nodeIds().remove(nodeKey);
}
InternalNetworkNode intNode = networkNodeMap.remove(nodeKey);
if (intNode != null && CollectionUtils.isNotEmpty(intNode.tpIds())) {
@ -905,7 +905,7 @@ public class SimpleTeTopologyStore
if (intNework != null
&& CollectionUtils.isNotEmpty(intNework.linkIds())) {
intNework.setChildUpdate(true);
intNework.linkIds().remove(linkKey.linkId());
intNework.linkIds().remove(linkKey);
}
// Remove it from networkLinkMap
InternalNetworkLink intLink = networkLinkMap.remove(linkKey);
@ -937,7 +937,7 @@ public class SimpleTeTopologyStore
TeNodeKey myTeNodeKey;
InternalNetworkNode intNode = null;
if (!parentUpdate) {
intNode = networkNodeMap.get(tpKey.nodeId());
intNode = networkNodeMap.get(tpKey);
if (intNode == null) {
log.error(" node is not in dataStore for tp update {}", tpKey);
return;
@ -974,7 +974,7 @@ public class SimpleTeTopologyStore
@Override
public void removeTerminationPoint(TerminationPointKey tpKey) {
// Update InternalNetworkNode
InternalNetworkNode intNode = networkNodeMap.get(tpKey.nodeId());
InternalNetworkNode intNode = networkNodeMap.get(tpKey);
if (intNode != null && CollectionUtils.isNotEmpty(intNode.tpIds())) {
intNode.setChildUpdate(true);
intNode.tpIds().remove(tpKey.tpId());

View File

@ -52,6 +52,7 @@ import org.onosproject.net.config.NetworkConfigServiceAdapter;
import org.onosproject.net.host.HostEvent;
import org.onosproject.net.host.HostListener;
import org.onosproject.net.host.HostServiceAdapter;
import org.onosproject.net.host.InterfaceIpAddress;
import org.onosproject.net.intent.Intent;
import org.onosproject.net.intent.IntentData;
import org.onosproject.net.intent.IntentEvent;
@ -396,7 +397,11 @@ public abstract class VplsTest {
@Override
public Set<Interface> getInterfacesByIp(IpAddress ip) {
return AVAILABLE_INTERFACES.stream()
.filter(intf -> intf.ipAddressesList().contains(ip))
.filter(intf -> intf.ipAddressesList().stream()
.map(InterfaceIpAddress::ipAddress)
.filter(ip::equals)
.findAny()
.isPresent())
.collect(Collectors.toSet());
}
@ -410,7 +415,11 @@ public abstract class VplsTest {
@Override
public Interface getMatchingInterface(IpAddress ip) {
return AVAILABLE_INTERFACES.stream()
.filter(intf -> intf.ipAddressesList().contains(ip))
.filter(intf -> intf.ipAddressesList().stream()
.map(InterfaceIpAddress::ipAddress)
.filter(ip::equals)
.findAny()
.isPresent())
.findFirst()
.orElse(null);
}
@ -418,7 +427,11 @@ public abstract class VplsTest {
@Override
public Set<Interface> getMatchingInterfaces(IpAddress ip) {
return AVAILABLE_INTERFACES.stream()
.filter(intf -> intf.ipAddressesList().contains(ip))
.filter(intf -> intf.ipAddressesList().stream()
.map(InterfaceIpAddress::ipAddress)
.filter(ip::equals)
.findAny()
.isPresent())
.collect(Collectors.toSet());
}
}

View File

@ -89,6 +89,7 @@ public final class VtnEventuallyConsistentMapTest<K, V> extends VtnEventuallyCon
return map.get(key);
}
@SuppressWarnings("ReturnValueIgnored")
@Override
public void put(K key, V value) {
map.put(key, value);

View File

@ -66,7 +66,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.2.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
@ -79,6 +78,32 @@
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-XepDisableAllChecks</arg>
<arg>-Xep:BetaApi:OFF</arg>
</compilerArgs>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<compilerArgs>
<arg>-XepDisableAllChecks</arg>
<arg>-Xep:BetaApi:OFF</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -115,6 +115,31 @@
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-XepDisableAllChecks</arg>
<arg>-Xep:BetaApi:OFF</arg>
</compilerArgs>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<compilerArgs>
<arg>-XepDisableAllChecks</arg>
<arg>-Xep:BetaApi:OFF</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -147,18 +147,6 @@
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>3.0.5</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>

View File

@ -857,6 +857,14 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>${karaf.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>

View File

@ -116,6 +116,17 @@
</executions>
</plugin>
<!-- FIXME: YANG tool generates problematic code -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-XepDisableAllChecks</arg>
<arg>-Xep:BetaApi:OFF</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>

View File

@ -123,6 +123,17 @@
</executions>
</plugin>
<!-- FIXME: YANG tool generates problematic code -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-XepDisableAllChecks</arg>
<arg>-Xep:BetaApi:OFF</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>

View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
YANG_ROOT=$1
CONFDC_ARGS=' -c'
# YANGPATHS
for path in $(find $YANG_ROOT -type d); do
CONFDC_ARGS+=" --yangpath $path"
done
# create output dir
mkdir -p fxs
# compile .yang s
for yang in $(find $YANG_ROOT -type f -name '*.yang'); do
BASE=$(basename $yang)
OUT="${BASE%.yang}.fxs"
echo "Compiling..$yang"
confdc $CONFDC_ARGS -o fxs/$OUT -- $yang
done

View File

@ -117,6 +117,17 @@
</executions>
</plugin>
<!-- FIXME: YANG tool generates problematic code -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-XepDisableAllChecks</arg>
<arg>-Xep:BetaApi:OFF</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>

63
pom.xml
View File

@ -240,4 +240,67 @@
</dependencies>
</dependencyManagement>
<properties>
<errorprone.version>2.2.0</errorprone.version>
<betachecker.version>1.0</betachecker.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerId>javac-with-errorprone</compilerId>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<annotationProcessorPaths>
<path>
<groupId>com.google.guava</groupId>
<artifactId>guava-beta-checker</artifactId>
<version>${betachecker.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-Xep:BetaApi:WARN</arg>
<!-- <arg>-Xep:BetaApi:ERROR</arg> -->
<!-- Add following to disable error-prone -->
<!-- <arg>-XepDisableAllChecks</arg> -->
</compilerArgs>
</configuration>
<executions>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<!-- Disable Beta Checker for tests -->
<compilerArgs>
<arg>-Xep:BetaApi:OFF</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-javac-errorprone</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<!-- override plexus-compiler-javac-errorprone's dependency with the
latest Error Prone version -->
<version>${errorprone.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>

View File

@ -218,6 +218,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @return the IP address of this neighbor
*/
@Override
public Ip4Address neighborIpAddr() {
return neighborIpAddr;
}
@ -227,6 +228,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @return true if the neighbor is opaque enabled else false.
*/
@Override
public boolean isOpaqueCapable() {
return isOpaqueCapable;
}
@ -236,6 +238,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @param isOpaqueCapable true if the neighbor is opaque enabledelse false
*/
@Override
public void setIsOpaqueCapable(boolean isOpaqueCapable) {
this.isOpaqueCapable = isOpaqueCapable;
}
@ -245,6 +248,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @param routerDeadInterval router dead interval
*/
@Override
public void setRouterDeadInterval(int routerDeadInterval) {
this.routerDeadInterval = routerDeadInterval;
}
@ -386,7 +390,7 @@ public class OspfNbrImpl implements OspfNbr {
state = OspfNeighborState.EXCHANGE;
boolean excludeMaxAgeLsa = true;
//list of contents of area wise LSA
ddSummaryList = (CopyOnWriteArrayList) ospfArea.getLsaHeaders(excludeMaxAgeLsa, isOpaqueCapable);
ddSummaryList = ospfArea.getLsaHeaders(excludeMaxAgeLsa, isOpaqueCapable);
if (neighborIsMaster) {
processLsas(payload);
@ -558,6 +562,7 @@ public class OspfNbrImpl implements OspfNbr {
* @param ch netty channel instance
* @throws Exception on error
*/
@Override
public void badLSReq(Channel ch) throws Exception {
log.debug("OSPFNbr::badLSReq...!!!");
@ -837,6 +842,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @param ch netty channel instance
*/
@Override
public void adjOk(Channel ch) {
log.debug("OSPFNbr::adjOk...!!!");
if (ospfInterface.interfaceType() != OspfInterfaceType.POINT_TO_POINT.value()) {
@ -1176,7 +1182,7 @@ public class OspfNbrImpl implements OspfNbr {
}
}
// RFC 2328 Section 13 (6)
if (lsReqList.contains(key)) {
if (lsReqList.containsValue(key)) {
badLSReq(ch);
}
if (status.equals("same")) { //13 (7)
@ -1397,6 +1403,7 @@ public class OspfNbrImpl implements OspfNbr {
/**
* Starts the inactivity timer.
*/
@Override
public void startInactivityTimeCheck() {
if (!inActivityTimerScheduled) {
log.debug("OSPFNbr::startInactivityTimeCheck");
@ -1411,6 +1418,7 @@ public class OspfNbrImpl implements OspfNbr {
/**
* Stops the inactivity timer.
*/
@Override
public void stopInactivityTimeCheck() {
if (inActivityTimerScheduled) {
log.debug("OSPFNbr::stopInactivityTimeCheck ");
@ -1440,6 +1448,7 @@ public class OspfNbrImpl implements OspfNbr {
/**
* Stops the flooding timer.
*/
@Override
public void stopFloodingTimer() {
if (floodingTimerScheduled) {
log.debug("OSPFNbr::stopFloodingTimer ");
@ -1467,6 +1476,7 @@ public class OspfNbrImpl implements OspfNbr {
/**
* Stops the Dd Retransmission executor task.
*/
@Override
public void stopRxMtDdTimer() {
if (rxmtDdPacketTimerScheduled) {
exServiceRxmtDDPacket.shutdown();
@ -1494,6 +1504,7 @@ public class OspfNbrImpl implements OspfNbr {
/**
* Stops Ls request retransmission executor task.
*/
@Override
public void stopRxMtLsrTimer() {
if (rxmtLsrTimerScheduled) {
exServiceRxmtLsr.shutdown();
@ -1524,6 +1535,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @return neighbor id
*/
@Override
public Ip4Address neighborId() {
return neighborId;
}
@ -1533,6 +1545,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @param neighborId neighbor id
*/
@Override
public void setNeighborId(Ip4Address neighborId) {
this.neighborId = neighborId;
}
@ -1542,6 +1555,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @return neighbor DR address
*/
@Override
public Ip4Address neighborDr() {
return neighborDr;
}
@ -1551,6 +1565,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @param neighborDr neighbor DR address
*/
@Override
public void setNeighborDr(Ip4Address neighborDr) {
this.neighborDr = neighborDr;
}
@ -1560,6 +1575,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @return neighbor BDR address
*/
@Override
public Ip4Address neighborBdr() {
return neighborBdr;
}
@ -1569,6 +1585,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @param neighborBdr neighbor BDR address
*/
@Override
public void setNeighborBdr(Ip4Address neighborBdr) {
this.neighborBdr = neighborBdr;
}
@ -1578,6 +1595,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @return router priority
*/
@Override
public int routerPriority() {
return routerPriority;
}
@ -1587,6 +1605,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @param routerPriority router priority
*/
@Override
public void setRouterPriority(int routerPriority) {
this.routerPriority = routerPriority;
}
@ -1596,6 +1615,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @return options value
*/
@Override
public int options() {
return options;
}
@ -1605,6 +1625,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @param options options value
*/
@Override
public void setOptions(int options) {
this.options = options;
}
@ -1614,6 +1635,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @return DD sequence number
*/
@Override
public long ddSeqNum() {
return ddSeqNum;
}
@ -1623,6 +1645,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @param ddSeqNum DD sequence number
*/
@Override
public void setDdSeqNum(long ddSeqNum) {
this.ddSeqNum = ddSeqNum;
}
@ -1632,6 +1655,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @return true if neighbor is master else false
*/
@Override
public int isMaster() {
return isMaster;
}
@ -1677,6 +1701,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @return neighbors state
*/
@Override
public OspfNeighborState getState() {
return state;
}
@ -1695,6 +1720,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @param isMaster neighbor is master or not
*/
@Override
public void setIsMaster(int isMaster) {
this.isMaster = isMaster;
}
@ -1704,6 +1730,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @return ls request list
*/
@Override
public Hashtable getLsReqList() {
return lsReqList;
}
@ -1713,6 +1740,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @return reTxList instance
*/
@Override
public Map getReTxList() {
return reTxList;
}
@ -1722,6 +1750,7 @@ public class OspfNbrImpl implements OspfNbr {
*
* @return pendingReTxList instance
*/
@Override
public Map<String, OspfLsa> getPendingReTxList() {
return pendingReTxList;
}

View File

@ -217,7 +217,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
TunnelProviderService service;
HashMap<String, TunnelId> tunnelMap = new HashMap<String, TunnelId>();
HashMap<String, TunnelId> tunnelMap = new HashMap<>();
HashMap<TunnelId, TunnelStatistics> tunnelStatisticsMap = new HashMap<>();
private HashMap<String, TunnelStatsCollector> collectors = Maps.newHashMap();
@ -885,7 +885,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
* @return list of ERO subobjects
*/
private LinkedList<PcepValueType> createPcepPath(Path path) {
LinkedList<PcepValueType> llSubObjects = new LinkedList<PcepValueType>();
LinkedList<PcepValueType> llSubObjects = new LinkedList<>();
List<Link> listLink = path.links();
ConnectPoint source = null;
ConnectPoint destination = null;
@ -952,7 +952,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
return null;
}
LinkedList<PcepValueType> llOptionalTlv = new LinkedList<PcepValueType>();
LinkedList<PcepValueType> llOptionalTlv = new LinkedList<>();
// set PathSetupTypeTlv of SRP object
tlv = new PathSetupTypeTlv(lspType.type());
@ -962,8 +962,8 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
PcepSrpObject srpobj = pc.factory().buildSrpObject().setSrpID(srpId).setRFlag(false)
.setOptionalTlv(llOptionalTlv).build();
llOptionalTlv = new LinkedList<PcepValueType>();
LinkedList<PcInitiatedLspRequest> llPcInitiatedLspRequestList = new LinkedList<PcInitiatedLspRequest>();
llOptionalTlv = new LinkedList<>();
LinkedList<PcInitiatedLspRequest> llPcInitiatedLspRequestList = new LinkedList<>();
// set LSP identifiers TLV
short localLspId = 0;
@ -1089,7 +1089,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
int srpId = SrpIdGenerators.create();
PcepValueType tlv;
LinkedList<PcepValueType> llOptionalTlv = new LinkedList<PcepValueType>();
LinkedList<PcepValueType> llOptionalTlv = new LinkedList<>();
// set PathSetupTypeTlv of SRP object
tlv = new PathSetupTypeTlv(LspType.valueOf(tunnel.annotations().value(LSP_SIG_TYPE))
@ -1100,8 +1100,8 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
PcepSrpObject srpobj = pc.factory().buildSrpObject().setSrpID(srpId).setRFlag(true)
.setOptionalTlv(llOptionalTlv).build();
llOptionalTlv = new LinkedList<PcepValueType>();
LinkedList<PcInitiatedLspRequest> llPcInitiatedLspRequestList = new LinkedList<PcInitiatedLspRequest>();
llOptionalTlv = new LinkedList<>();
LinkedList<PcInitiatedLspRequest> llPcInitiatedLspRequestList = new LinkedList<>();
tlv = new SymbolicPathNameTlv(tunnel.tunnelName().value().getBytes());
llOptionalTlv.add(tlv);
@ -1183,8 +1183,8 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
llSubObjects = createPcepPath(path);
}
LinkedList<PcepValueType> llOptionalTlv = new LinkedList<PcepValueType>();
LinkedList<PcepUpdateRequest> llUpdateRequestList = new LinkedList<PcepUpdateRequest>();
LinkedList<PcepValueType> llOptionalTlv = new LinkedList<>();
LinkedList<PcepUpdateRequest> llUpdateRequestList = new LinkedList<>();
// set PathSetupTypeTlv of SRP object
tlv = new PathSetupTypeTlv(lspSigType.type());
@ -1194,7 +1194,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
PcepSrpObject srpobj = pc.factory().buildSrpObject().setSrpID(srpId).setRFlag(false)
.setOptionalTlv(llOptionalTlv).build();
llOptionalTlv = new LinkedList<PcepValueType>();
llOptionalTlv = new LinkedList<>();
// Lsp Identifier tlv is required for all modes of lsp
String localLspIdString = tunnel.annotations().value(LOCAL_LSP_ID);
@ -1661,7 +1661,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
if (mastershipService.isLocalMaster(deviceId)) {
TunnelId tId = tunnelAdded(td, tunnelState);
Tunnel tunnelInserted = new DefaultTunnel(providerId, tunnelEndPointSrc, tunnelEndPointDst, MPLS,
tunnelState, new GroupId(0), tId, TunnelName.tunnelName(String.valueOf(pathNameTlv
tunnelState, new GroupId(0), tId, TunnelName.tunnelName(Arrays.toString(pathNameTlv
.getValue())), path, labelStack, annotations);
PcepTunnelData pcepTunnelData = new PcepTunnelData(tunnelInserted, path, LSP_STATE_RPT);

View File

@ -53,4 +53,20 @@
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-Xep:BetaApi:OFF</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -31,7 +31,6 @@
<description>Miscellaneous ON.Lab utilities</description>
<properties>
<metrics.version>3.1.2</metrics.version>
</properties>
<dependencies>
@ -77,12 +76,10 @@
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
<version>${metrics.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-json</artifactId>
<version>${metrics.version}</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>

View File

@ -162,7 +162,7 @@ public abstract class Tools {
* @param collection collection to test
* @return true if null or empty; false otherwise
*/
public static boolean isNullOrEmpty(Collection collection) {
public static boolean isNullOrEmpty(Collection<?> collection) {
return collection == null || collection.isEmpty();
}