Various small fixes
Change-Id: I83802169d0d968f7b88d4be2cedba74b15fdd7da
diff --git a/apps/cpman/api/src/main/java/org/onosproject/cpman/ControlLoadSnapshot.java b/apps/cpman/api/src/main/java/org/onosproject/cpman/ControlLoadSnapshot.java
index b3f34ea..532297d 100644
--- a/apps/cpman/api/src/main/java/org/onosproject/cpman/ControlLoadSnapshot.java
+++ b/apps/cpman/api/src/main/java/org/onosproject/cpman/ControlLoadSnapshot.java
@@ -99,7 +99,7 @@
@Override
public int hashCode() {
- return Objects.hash(latest, average, time, recent);
+ return Objects.hash(latest, average, time, Arrays.hashCode(recent));
}
@Override
diff --git a/apps/dhcp/api/src/main/java/org/onosproject/dhcp/IpAssignment.java b/apps/dhcp/api/src/main/java/org/onosproject/dhcp/IpAssignment.java
index d4beda2..7b83f0c 100644
--- a/apps/dhcp/api/src/main/java/org/onosproject/dhcp/IpAssignment.java
+++ b/apps/dhcp/api/src/main/java/org/onosproject/dhcp/IpAssignment.java
@@ -310,7 +310,6 @@
private void validateInputs() {
checkNotNull(ipAddress, "IP Address must be specified");
checkNotNull(assignmentStatus, "Assignment Status must be specified");
- checkNotNull(leasePeriod, "Lease Period must be specified");
checkNotNull(timeStamp, "Timestamp must be specified");
switch (assignmentStatus) {
diff --git a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/store/DistributedFpmPrefixStore.java b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/store/DistributedFpmPrefixStore.java
index b82aac9..bc95d0b 100644
--- a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/store/DistributedFpmPrefixStore.java
+++ b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/store/DistributedFpmPrefixStore.java
@@ -91,7 +91,7 @@
@Override
public void setDelegate(StoreDelegate<FpmPrefixStoreEvent> delegate) {
- checkNotNull("Delegate can't be null", delegate);
+ checkNotNull(delegate, "Delegate can't be null");
this.delegate = delegate;
}
@@ -122,6 +122,7 @@
* @param prefix the route prefix in the advertisement
* @param fpmRecord the route for fpm
**/
+ @Override
public void addFpmRecord(IpPrefix prefix, FpmRecord fpmRecord) {
checkNotNull(prefix, "Prefix can't be null");
checkNotNull(fpmRecord, "Fpm record can't be null");
@@ -134,6 +135,7 @@
* @param prefix the route prefix in the advertisement
* @return none
**/
+ @Override
public Optional<FpmRecord> removeFpmRecord(IpPrefix prefix) {
checkNotNull(prefix, "Prefix can't be null");
return Optional.ofNullable(dhcpFpmRecords.remove(prefix));
diff --git a/apps/faultmanagement/fmmgr/src/test/java/org/onosproject/faultmanagement/impl/PollingAlarmProviderTest.java b/apps/faultmanagement/fmmgr/src/test/java/org/onosproject/faultmanagement/impl/PollingAlarmProviderTest.java
index b8fa17f..b2f2469 100644
--- a/apps/faultmanagement/fmmgr/src/test/java/org/onosproject/faultmanagement/impl/PollingAlarmProviderTest.java
+++ b/apps/faultmanagement/fmmgr/src/test/java/org/onosproject/faultmanagement/impl/PollingAlarmProviderTest.java
@@ -120,7 +120,7 @@
@Test
public void activate() throws Exception {
- assertFalse("Provider should be registered", providerRegistry.getProviders().contains(provider));
+ assertFalse("Provider should be registered", providerRegistry.getProviders().contains(provider.id()));
assertEquals("Device listener should be added", 1, deviceListeners.size());
assertEquals("Incorrect alarm provider service", alarmProviderService, provider.providerService);
assertEquals("Mastership listener should be added", 1, mastershipListeners.size());
@@ -135,7 +135,7 @@
provider.deactivate();
assertEquals("Device listener should be removed", 0, deviceListeners.size());
assertEquals("Mastership listener should be removed", 0, mastershipListeners.size());
- assertFalse("Provider should not be registered", providerRegistry.getProviders().contains(provider));
+ assertFalse("Provider should not be registered", providerRegistry.getProviders().contains(provider.id()));
assertTrue(provider.alarmsExecutor.isShutdown());
assertNull(provider.providerService);
}
diff --git a/apps/mappingmanagement/api/src/main/java/org/onosproject/mapping/addresses/UnresolvedExtensionMappingAddress.java b/apps/mappingmanagement/api/src/main/java/org/onosproject/mapping/addresses/UnresolvedExtensionMappingAddress.java
index a1db59f..3a07879 100644
--- a/apps/mappingmanagement/api/src/main/java/org/onosproject/mapping/addresses/UnresolvedExtensionMappingAddress.java
+++ b/apps/mappingmanagement/api/src/main/java/org/onosproject/mapping/addresses/UnresolvedExtensionMappingAddress.java
@@ -18,8 +18,6 @@
import org.onosproject.net.flow.AbstractExtension;
import java.util.Arrays;
-import java.util.Objects;
-
import static com.google.common.base.MoreObjects.toStringHelper;
import static org.onosproject.mapping.addresses.ExtensionMappingAddressType
.ExtensionMappingAddressTypes.UNRESOLVED_TYPE;
@@ -63,7 +61,7 @@
@Override
public int hashCode() {
- return Objects.hash(bytes);
+ return Arrays.hashCode(bytes);
}
@Override
diff --git a/apps/routing-api/src/main/java/org/onosproject/routing/RouterInfo.java b/apps/routing-api/src/main/java/org/onosproject/routing/RouterInfo.java
index 99a6af4..6f2347f 100644
--- a/apps/routing-api/src/main/java/org/onosproject/routing/RouterInfo.java
+++ b/apps/routing-api/src/main/java/org/onosproject/routing/RouterInfo.java
@@ -43,7 +43,7 @@
*/
public RouterInfo(ConnectPoint controlPlaneConnectPoint, boolean ospfEnabled, Set<String> interfaces) {
this.controlPlaneConnectPoint = checkNotNull(controlPlaneConnectPoint);
- this.ospfEnabled = checkNotNull(ospfEnabled);
+ this.ospfEnabled = ospfEnabled;
this.interfaces = ImmutableSet.copyOf(checkNotNull(interfaces));
}
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/McastHandler.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/McastHandler.java
index 80affc1..b0be4e3 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/McastHandler.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/McastHandler.java
@@ -411,7 +411,7 @@
log.info("NextObj for {}/{} already exists. Abort", deviceId, port);
return;
}
- portBuilder.addAll(existingPorts).add(port).build();
+ portBuilder.addAll(existingPorts).add(port);
}
// Create, store and apply the new nextObj and fwdObj
ObjectiveContext context = new DefaultObjectiveContext(
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/PwaasConfig.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/PwaasConfig.java
index f9ab36c..18fc738 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/PwaasConfig.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/config/PwaasConfig.java
@@ -204,9 +204,9 @@
tunnelId)));
}
- if (((!ingressOuter.equals(VlanId.NONE) && !ingressOuter.equals(VlanId.NONE)) &&
+ if (((!ingressOuter.equals(VlanId.NONE) && !ingressInner.equals(VlanId.NONE)) &&
(egressOuter.equals(VlanId.NONE) && egressInner.equals(VlanId.NONE)))
- || ((ingressOuter.equals(VlanId.NONE) && ingressOuter.equals(VlanId.NONE)) &&
+ || ((ingressOuter.equals(VlanId.NONE) && ingressInner.equals(VlanId.NONE)) &&
(!egressOuter.equals(VlanId.NONE) && !egressInner.equals(VlanId.NONE)))) {
throw new IllegalArgumentException(String.valueOf(String.format("Support for double tag <-> untag is not" +
"supported for pseudowire %d.",
diff --git a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultRouter.java b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultRouter.java
index f31aed1..fc8bbe5 100644
--- a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultRouter.java
+++ b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultRouter.java
@@ -55,9 +55,9 @@
List<String> routes) {
this.id = checkNotNull(id, "id cannot be null");
this.name = routerName;
- this.adminStateUp = checkNotNull(adminStateUp, "adminStateUp cannot be null");
+ this.adminStateUp = adminStateUp;
this.status = checkNotNull(status, "status cannot be null");
- this.distributed = checkNotNull(distributed, "distributed cannot be null");
+ this.distributed = distributed;
this.externalGatewayInfo = externalGatewayInfo;
this.gatewayPortId = gatewayPortId;
this.tenantId = checkNotNull(tenantId, "tenantId cannot be null");
diff --git a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterGateway.java b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterGateway.java
index 27e1473..6aef24e 100644
--- a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterGateway.java
+++ b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterGateway.java
@@ -35,7 +35,7 @@
private RouterGateway(TenantNetworkId networkId, boolean enableSnat,
Set<FixedIp> externalFixedIps) {
this.networkId = checkNotNull(networkId, "networkId cannot be null");
- this.enableSnat = checkNotNull(enableSnat, "enableSnat cannot be null");
+ this.enableSnat = enableSnat;
this.externalFixedIps = checkNotNull(externalFixedIps, "externalFixedIps cannot be null");
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/FlowsListCommand.java b/cli/src/main/java/org/onosproject/cli/net/FlowsListCommand.java
index ec6178b..331431a 100644
--- a/cli/src/main/java/org/onosproject/cli/net/FlowsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/FlowsListCommand.java
@@ -39,6 +39,7 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -303,7 +304,7 @@
print(LONG_FORMAT, Long.toHexString(f.id().value()), f.state(),
f.bytes(), f.packets(), f.life(), f.liveType(), f.priority(), f.table(),
appId != null ? appId.name() : "<none>",
- f.payLoad() == null ? null : f.payLoad().payLoad().toString(),
+ f.payLoad() == null ? null : Arrays.toString(f.payLoad().payLoad()),
f.selector().criteria(), f.treatment());
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/IntentsListCommand.java b/cli/src/main/java/org/onosproject/cli/net/IntentsListCommand.java
index fa504df..8fb3714 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IntentsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IntentsListCommand.java
@@ -553,8 +553,9 @@
builder.append('\n').append(format("bidirectional=%s", ci.isBidirectional()));
}
- List<Intent> installable = service.getInstallableIntents(intent.key());
- installable.stream().filter(i -> contentFilter.filter(i));
+ List<Intent> installable = service.getInstallableIntents(intent.key())
+ .stream().filter(i -> contentFilter.filter(i))
+ .collect(Collectors.toList());
if (showInstallable && installable != null && !installable.isEmpty()) {
builder.append('\n').append(format(INSTALLABLE, installable));
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualFlowsListCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualFlowsListCommand.java
index 8959389..ff0cf7d 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualFlowsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualFlowsListCommand.java
@@ -38,6 +38,7 @@
import org.onosproject.utils.Comparators;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -237,7 +238,7 @@
print(LONG_FORMAT, Long.toHexString(f.id().value()), f.state(),
f.bytes(), f.packets(), f.life(), f.liveType(), f.priority(), f.tableId(),
appId != null ? appId.name() : "<none>",
- f.payLoad() == null ? null : f.payLoad().payLoad().toString(),
+ f.payLoad() == null ? null : Arrays.toString(f.payLoad().payLoad()),
f.selector().criteria(), f.treatment());
}
}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/UnresolvedExtensionSelector.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/UnresolvedExtensionSelector.java
index 17f527b..22bf95c 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/UnresolvedExtensionSelector.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/UnresolvedExtensionSelector.java
@@ -17,7 +17,6 @@
import org.onosproject.net.flow.AbstractExtension;
import java.util.Arrays;
-import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
@@ -57,7 +56,7 @@
@Override
public int hashCode() {
- return Objects.hash(bytes);
+ return Arrays.hashCode(bytes);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
index 9bd7df5..33b7482 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
@@ -101,7 +101,6 @@
* @return set-queue instruction
*/
public static SetQueueInstruction setQueue(final long queueId, final PortNumber port) {
- checkNotNull(queueId, "queue ID cannot be null");
return new SetQueueInstruction(queueId, port);
}
@@ -328,7 +327,6 @@
* @return a l3 modification
*/
public static L3ModificationInstruction modL3ArpOp(short op) {
- checkNotNull(op, "Arp operation cannot be null");
return new ModArpOpInstruction(L3SubType.ARP_OP, op);
}
@@ -428,7 +426,6 @@
* @return a L2 modification
*/
public static L2ModificationInstruction modTunnelId(long tunnelId) {
- checkNotNull(tunnelId, "Tunnel id cannot be null");
return new L2ModificationInstruction.ModTunnelIdInstruction(tunnelId);
}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/UnresolvedExtensionTreatment.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/UnresolvedExtensionTreatment.java
index bbe1d33..6c4a8c2 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/UnresolvedExtensionTreatment.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/UnresolvedExtensionTreatment.java
@@ -19,7 +19,6 @@
import com.google.common.base.MoreObjects;
import org.onosproject.net.flow.AbstractExtension;
import java.util.Arrays;
-import java.util.Objects;
/**
* Unresolved extension treatment.
@@ -57,7 +56,7 @@
@Override
public int hashCode() {
- return Objects.hash(bytes);
+ return Arrays.hashCode(bytes);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/intent/IntentOperationContext.java b/core/api/src/main/java/org/onosproject/net/intent/IntentOperationContext.java
index 6fc3f2e..528f4ba 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/IntentOperationContext.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentOperationContext.java
@@ -103,7 +103,7 @@
IntentOperationContext that = (IntentOperationContext) obj;
return Objects.equals(intentsToInstall, that.intentsToInstall) &&
Objects.equals(intentsToUninstall, that.intentsToUninstall) &&
- Objects.equals(intentInstallationContext, intentInstallationContext);
+ Objects.equals(intentInstallationContext, that.intentInstallationContext);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/store/cluster/messaging/ClusterMessage.java b/core/api/src/main/java/org/onosproject/store/cluster/messaging/ClusterMessage.java
index 4c03699..5327d48 100644
--- a/core/api/src/main/java/org/onosproject/store/cluster/messaging/ClusterMessage.java
+++ b/core/api/src/main/java/org/onosproject/store/cluster/messaging/ClusterMessage.java
@@ -155,6 +155,6 @@
@Override
public int hashCode() {
- return Objects.hash(sender, subject, payload);
+ return Objects.hash(sender, subject, Arrays.hashCode(payload));
}
}
diff --git a/core/api/src/test/java/org/onosproject/net/link/LinkProviderRegistryAdapter.java b/core/api/src/test/java/org/onosproject/net/link/LinkProviderRegistryAdapter.java
index d2cfec2..c0ee902 100644
--- a/core/api/src/test/java/org/onosproject/net/link/LinkProviderRegistryAdapter.java
+++ b/core/api/src/test/java/org/onosproject/net/link/LinkProviderRegistryAdapter.java
@@ -36,11 +36,18 @@
@Override
public void unregister(LinkProvider provider) {
+ if (providerService != null && provider.id().equals(providerService.provider().id())) {
+ providerService = null;
+ }
}
@Override
public Set<ProviderId> getProviders() {
- return ImmutableSet.of(providerService.provider().id());
+ if (providerService != null) {
+ return ImmutableSet.of(providerService.provider().id());
+ } else {
+ return ImmutableSet.of();
+ }
}
public LinkProviderServiceAdapter registeredProvider() {
diff --git a/core/api/src/test/java/org/onosproject/security/PermissionTest.java b/core/api/src/test/java/org/onosproject/security/PermissionTest.java
index 191d868..bdab240 100644
--- a/core/api/src/test/java/org/onosproject/security/PermissionTest.java
+++ b/core/api/src/test/java/org/onosproject/security/PermissionTest.java
@@ -17,8 +17,6 @@
package org.onosproject.security;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
import org.junit.Test;
/**
@@ -70,7 +68,7 @@
public void testEqualsObject() {
Permission permissionA = new Permission("classname", "name", "actions");
Permission permissionB = new Permission("classname", "name", "actions");
- assertSame(permissionA, permissionA);
+ assertEquals(permissionA, permissionB);
assertEquals(permissionA.getClassName(), permissionB.getClassName());
assertEquals(permissionA.getName(), permissionB.getName());
assertEquals(permissionA.getActions(), permissionB.getActions());
diff --git a/core/api/src/test/java/org/onosproject/store/service/DocumentPathTest.java b/core/api/src/test/java/org/onosproject/store/service/DocumentPathTest.java
index c0137c8..19c34bd 100644
--- a/core/api/src/test/java/org/onosproject/store/service/DocumentPathTest.java
+++ b/core/api/src/test/java/org/onosproject/store/service/DocumentPathTest.java
@@ -73,6 +73,7 @@
DocumentPath path1 = exceptions("node|name", parentPath);
}
+ @SuppressWarnings("SelfComparison")
@Test
public void comparePaths() {
DocumentPath one = path("root");
diff --git a/core/api/src/test/java/org/onosproject/store/service/TestEventuallyConsistentMap.java b/core/api/src/test/java/org/onosproject/store/service/TestEventuallyConsistentMap.java
index 4a8dc47..280cffb 100644
--- a/core/api/src/test/java/org/onosproject/store/service/TestEventuallyConsistentMap.java
+++ b/core/api/src/test/java/org/onosproject/store/service/TestEventuallyConsistentMap.java
@@ -86,6 +86,7 @@
return map.get(key);
}
+ @SuppressWarnings("ReturnValueIgnored")
@Override
public void put(K key, V value) {
map.put(key, value);
diff --git a/core/api/src/test/java/org/onosproject/store/service/WallClockTimestampTest.java b/core/api/src/test/java/org/onosproject/store/service/WallClockTimestampTest.java
index 3f02fef..8ea04fd 100644
--- a/core/api/src/test/java/org/onosproject/store/service/WallClockTimestampTest.java
+++ b/core/api/src/test/java/org/onosproject/store/service/WallClockTimestampTest.java
@@ -30,6 +30,7 @@
*/
public class WallClockTimestampTest {
+ @SuppressWarnings("SelfComparison")
@Test
public final void testBasic() throws InterruptedException {
WallClockTimestamp ts1 = new WallClockTimestamp();
diff --git a/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java b/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java
index 09d3a24..c623bf2 100644
--- a/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java
+++ b/core/net/src/main/java/org/onosproject/net/flowobjective/impl/FlowObjectiveManager.java
@@ -208,7 +208,7 @@
public ObjectiveInstaller(DeviceId deviceId, Objective objective, int attemps) {
this.deviceId = checkNotNull(deviceId);
this.objective = checkNotNull(objective);
- this.numAttempts = checkNotNull(attemps);
+ this.numAttempts = attemps;
}
@Override
diff --git a/core/net/src/main/java/org/onosproject/net/flowobjective/impl/composition/FlowObjectiveCompositionManager.java b/core/net/src/main/java/org/onosproject/net/flowobjective/impl/composition/FlowObjectiveCompositionManager.java
index be90cb5..a765648 100644
--- a/core/net/src/main/java/org/onosproject/net/flowobjective/impl/composition/FlowObjectiveCompositionManager.java
+++ b/core/net/src/main/java/org/onosproject/net/flowobjective/impl/composition/FlowObjectiveCompositionManager.java
@@ -177,7 +177,7 @@
public ObjectiveInstaller(DeviceId deviceId, Objective objective, int attemps) {
this.deviceId = checkNotNull(deviceId);
this.objective = checkNotNull(objective);
- this.numAttempts = checkNotNull(attemps);
+ this.numAttempts = attemps;
}
@Override
diff --git a/core/net/src/test/java/org/onosproject/net/config/basics/PortAnnotationConfigTest.java b/core/net/src/test/java/org/onosproject/net/config/basics/PortAnnotationConfigTest.java
index dd3211c..df6ce7b 100644
--- a/core/net/src/test/java/org/onosproject/net/config/basics/PortAnnotationConfigTest.java
+++ b/core/net/src/test/java/org/onosproject/net/config/basics/PortAnnotationConfigTest.java
@@ -126,6 +126,7 @@
assertThat(annotations.get(key), is(value));
}
+ @Test
public void writeEntryTest() throws JsonProcessingException, IOException {
PortAnnotationConfig w = new PortAnnotationConfig();
@@ -146,6 +147,7 @@
assertThat(annotations.get(key), is(value));
}
+ @Test
public void writeMapTest() throws JsonProcessingException, IOException {
PortAnnotationConfig w = new PortAnnotationConfig();
diff --git a/core/net/src/test/java/org/onosproject/net/pi/impl/PiPipeconfManagerTest.java b/core/net/src/test/java/org/onosproject/net/pi/impl/PiPipeconfManagerTest.java
index ff3b119..b269751 100644
--- a/core/net/src/test/java/org/onosproject/net/pi/impl/PiPipeconfManagerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/pi/impl/PiPipeconfManagerTest.java
@@ -138,7 +138,7 @@
@Test
public void register() {
piPipeconfService.register(piPipeconf);
- assertTrue("PiPipeconf should be registered", piPipeconfService.piPipeconfs.contains(piPipeconf));
+ assertTrue("PiPipeconf should be registered", piPipeconfService.piPipeconfs.containsValue(piPipeconf));
}
@Test
diff --git a/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java b/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java
index e8864c5..ded0f31 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java
@@ -317,7 +317,7 @@
? deviceClockService.getTimestamp(deviceId)
: removalRequest.getOrDefault(deviceId, DEFAULT_TIMESTAMP);
} catch (IllegalStateException e) {
- newTimestamp = removalRequest.getOrDefault(deviceDescription, DEFAULT_TIMESTAMP);
+ newTimestamp = removalRequest.getOrDefault(deviceId, DEFAULT_TIMESTAMP);
isMaster = false;
}
final Timestamped<DeviceDescription> deltaDesc = new Timestamped<>(deviceDescription, newTimestamp);
diff --git a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentResourceStore.java b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentResourceStore.java
index 14ed0ed..e5ed75b 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentResourceStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/ConsistentResourceStore.java
@@ -63,6 +63,7 @@
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
+import static java.util.stream.Collectors.groupingBy;
import static org.onosproject.net.resource.ResourceEvent.Type.RESOURCE_ADDED;
import static org.onosproject.net.resource.ResourceEvent.Type.RESOURCE_REMOVED;
@@ -132,7 +133,7 @@
// the order is preserved by LinkedHashMap
Map<DiscreteResource, List<Resource>> resourceMap = resources.stream()
.filter(x -> x.parent().isPresent())
- .collect(Collectors.groupingBy(x -> x.parent().get(), LinkedHashMap::new, Collectors.toList()));
+ .collect(groupingBy(x -> x.parent().get(), LinkedHashMap::new, Collectors.<Resource>toList()));
TransactionalDiscreteResourceSubStore discreteTxStore = discreteStore.transactional(tx);
TransactionalContinuousResourceSubStore continuousTxStore = continuousStore.transactional(tx);
diff --git a/core/store/dist/src/test/java/org/onosproject/store/impl/MastershipBasedTimestampTest.java b/core/store/dist/src/test/java/org/onosproject/store/impl/MastershipBasedTimestampTest.java
index 605de95..bbbc616 100644
--- a/core/store/dist/src/test/java/org/onosproject/store/impl/MastershipBasedTimestampTest.java
+++ b/core/store/dist/src/test/java/org/onosproject/store/impl/MastershipBasedTimestampTest.java
@@ -47,6 +47,7 @@
assertEquals(sequenceNumber, ts.sequenceNumber());
}
+ @SuppressWarnings("SelfComparison")
@Test
public final void testCompareTo() {
assertTrue(TS_1_1.compareTo(TS_1_1) == 0);
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/DefaultDocumentTree.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/DefaultDocumentTree.java
index 82098d3..2d5832c 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/DefaultDocumentTree.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/DefaultDocumentTree.java
@@ -21,6 +21,7 @@
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
+import java.util.Optional;
import java.util.concurrent.atomic.AtomicLong;
import org.onosproject.store.service.DocumentPath;
@@ -148,13 +149,17 @@
}
@Override
- public boolean replace(DocumentPath path, V newValue, V currentValue) {
+ public boolean replace(DocumentPath path, V newValue, V expectedValue) {
checkRootModification(path);
- if (Objects.equals(newValue, currentValue)) {
+ if (Objects.equals(newValue, expectedValue)) {
return false;
}
DocumentTreeNode<V> node = getNode(path);
- if (node != null && Objects.equals(Versioned.valueOrNull(node.value()), currentValue)) {
+ V prevValue = Optional.ofNullable(node)
+ .map(DocumentTreeNode::value)
+ .map(Versioned::valueOrNull)
+ .orElse(null);
+ if (Objects.equals(prevValue, expectedValue)) {
set(path, newValue);
return true;
}
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/impl/MapValueTest.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/impl/MapValueTest.java
index 70c33e1..cfad4e4 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/impl/MapValueTest.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/impl/MapValueTest.java
@@ -48,6 +48,7 @@
assertEquals(actual, expected);
}
+ @SuppressWarnings("SelfComparison")
@Test
public void testComparison() {
Timestamp ts1 = new LogicalTimestamp(9);
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/impl/TranscodingAsyncConsistentMapTest.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/impl/TranscodingAsyncConsistentMapTest.java
index 2cc9631..6466c12 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/impl/TranscodingAsyncConsistentMapTest.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/impl/TranscodingAsyncConsistentMapTest.java
@@ -115,6 +115,7 @@
assertFalse(transcodingMap.containsValue(DEV1).join());
}
+ @Test
public void testGet() throws Exception {
assertNull(transcodingMap.get(KEY1).join().value());
transcodingMap.put(KEY2, DEV1).join();
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentSetMultimapServiceTest.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentSetMultimapServiceTest.java
index c05ebcb..66173d0 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentSetMultimapServiceTest.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentSetMultimapServiceTest.java
@@ -15,8 +15,8 @@
*/
package org.onosproject.store.primitives.resources.impl;
-import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import io.atomix.protocols.raft.service.ServiceId;
import io.atomix.protocols.raft.service.impl.DefaultCommit;
@@ -57,7 +57,7 @@
2,
PUT,
new AtomixConsistentSetMultimapOperations.Put(
- "foo", Arrays.asList("Hello world!".getBytes()), Match.ANY),
+ "foo", Collections.singletonList("Hello world!".getBytes()), Match.ANY),
mock(RaftSessionContext.class),
System.currentTimeMillis()));
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixDocumentTreeTest.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixDocumentTreeTest.java
index 18746a7..7a41395 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixDocumentTreeTest.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixDocumentTreeTest.java
@@ -27,6 +27,7 @@
import com.google.common.base.Throwables;
import io.atomix.protocols.raft.proxy.RaftProxy;
import io.atomix.protocols.raft.service.RaftService;
+
import org.junit.Test;
import org.onosproject.store.primitives.NodeUpdate;
import org.onosproject.store.primitives.TransactionId;
@@ -219,6 +220,9 @@
assertArrayEquals("newAB".getBytes(), tree.get(path("root.a.b")).join().value());
assertFalse(tree.replace(path("root.a.d"), "bar".getBytes(), "foo".getBytes()).join());
+
+ assertTrue(tree.replace(path("root.x"), "beta".getBytes(), null).join());
+
}
/**
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixWorkQueueServiceTest.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixWorkQueueServiceTest.java
index 919d3c9..2529523 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixWorkQueueServiceTest.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixWorkQueueServiceTest.java
@@ -15,8 +15,8 @@
*/
package org.onosproject.store.primitives.resources.impl;
-import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import io.atomix.protocols.raft.ReadConsistency;
import io.atomix.protocols.raft.cluster.MemberId;
@@ -93,7 +93,7 @@
service.add(new DefaultCommit<>(
2,
ADD,
- new AtomixWorkQueueOperations.Add(Arrays.asList("Hello world!".getBytes())),
+ new AtomixWorkQueueOperations.Add(Collections.singletonList("Hello world!".getBytes())),
session,
System.currentTimeMillis()));
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/DefaultDocumentTreeTest.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/DefaultDocumentTreeTest.java
index 5505e0d..1398300 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/DefaultDocumentTreeTest.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/DefaultDocumentTreeTest.java
@@ -148,6 +148,7 @@
tree.set(path("root.a.b"), "alpha");
}
+ @Test
public void testReplaceWithVersion() {
DocumentTree<String> tree = new DefaultDocumentTree<>();
tree.create(path("root.a"), "bar");
@@ -158,6 +159,7 @@
Assert.assertFalse(tree.replace(path("root.x"), "beta", 1));
}
+ @Test
public void testReplaceWithValue() {
DocumentTree<String> tree = new DefaultDocumentTree<>();
tree.create(path("root.a"), "bar");
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/TestClusterCommunicationService.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/TestClusterCommunicationService.java
index a15bba4..791a488 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/TestClusterCommunicationService.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/TestClusterCommunicationService.java
@@ -72,9 +72,9 @@
@Override
public <M> void multicast(M message, MessageSubject subject, Function<M, byte[]> encoder, Set<NodeId> nodeIds) {
- nodes.values().stream()
- .filter(n -> nodeIds.contains(n))
- .forEach(n -> n.handle(subject, encoder.apply(message)));
+ nodes.entrySet().stream()
+ .filter(e -> nodeIds.contains(e.getKey()))
+ .forEach(e -> e.getValue().handle(subject, encoder.apply(message)));
}
@Override
diff --git a/drivers/default/src/main/java/org/onosproject/driver/extensions/NiciraResubmitTable.java b/drivers/default/src/main/java/org/onosproject/driver/extensions/NiciraResubmitTable.java
index bb6347e..3e1dd05 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/extensions/NiciraResubmitTable.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/extensions/NiciraResubmitTable.java
@@ -65,7 +65,6 @@
*/
public NiciraResubmitTable(PortNumber inPort, short table) {
checkNotNull(inPort);
- checkNotNull(table);
this.inPort = inPort;
this.table = table;
}
@@ -76,7 +75,6 @@
* @param table table
*/
public NiciraResubmitTable(short table) {
- checkNotNull(table);
this.inPort = DEFAULT_IN_PORT;
this.table = table;
}
diff --git a/drivers/default/src/main/java/org/onosproject/driver/extensions/Ofdpa3SetMplsType.java b/drivers/default/src/main/java/org/onosproject/driver/extensions/Ofdpa3SetMplsType.java
index ca0f03d..a160b3a 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/extensions/Ofdpa3SetMplsType.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/extensions/Ofdpa3SetMplsType.java
@@ -49,7 +49,6 @@
* @param mplsType MPLS type in short
*/
public Ofdpa3SetMplsType(short mplsType) {
- checkNotNull(mplsType);
this.mplsType = mplsType;
}
diff --git a/drivers/hp/src/main/java/org/onosproject/drivers/hp/HPPipelineV3500.java b/drivers/hp/src/main/java/org/onosproject/drivers/hp/HPPipelineV3500.java
index a488439..06e01c1 100644
--- a/drivers/hp/src/main/java/org/onosproject/drivers/hp/HPPipelineV3500.java
+++ b/drivers/hp/src/main/java/org/onosproject/drivers/hp/HPPipelineV3500.java
@@ -252,7 +252,7 @@
* */
if (instruction.type() == Instruction.Type.L2MODIFICATION) {
- if (!this.hardwareInstructionsL3mod.contains(((L2ModificationInstruction) instruction).subtype())) {
+ if (!this.hardwareInstructionsL2mod.contains(((L2ModificationInstruction) instruction).subtype())) {
log.warn("HP V3500 Driver - L2MODIFICATION.subtype {} only supported in SOFTWARE",
((L2ModificationInstruction) instruction).subtype());
diff --git a/drivers/optical/src/test/java/org/onosproject/driver/optical/config/FlowTableConfigTest.java b/drivers/optical/src/test/java/org/onosproject/driver/optical/config/FlowTableConfigTest.java
index b6e6d95..0dbdbcc 100644
--- a/drivers/optical/src/test/java/org/onosproject/driver/optical/config/FlowTableConfigTest.java
+++ b/drivers/optical/src/test/java/org/onosproject/driver/optical/config/FlowTableConfigTest.java
@@ -51,11 +51,11 @@
private static final DeviceId DID = DeviceId.deviceId("of:0000000000000001");
private static final PortNumber PN_1 = portNumber(1);
private static final PortNumber PN_2 = portNumber(2);
- private static final int FLOW_ID_3 = 3;
+ private static final long FLOW_ID_3 = 3;
private static final int PRIO_4 = 4;
private static final DefaultApplicationId APP_ID =
- new DefaultApplicationId(FLOW_ID_3 >>> 48, "test");
+ new DefaultApplicationId((int) (FLOW_ID_3 >>> 48), "test");
private static final OchSignal LAMBDA_42 = OchSignal.newFlexGridSlot(42);
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarm.java b/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarm.java
index 1422dde..fd4bad0 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarm.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarm.java
@@ -427,8 +427,6 @@
checkNotNull(id, "Must specify an alarm id");
checkNotNull(deviceId, "Must specify a device");
checkNotNull(description, "Must specify a description");
- checkNotNull(timeRaised, "Must specify a time raised");
- checkNotNull(timeUpdated, "Must specify a time updated");
checkNotNull(severity, "Must specify a severity");
return new DefaultAlarm(id, deviceId, description, source, timeRaised, timeUpdated, timeCleared,
diff --git a/incubator/net/src/main/java/org/onosproject/incubator/net/resource/label/impl/LabelResourceManager.java b/incubator/net/src/main/java/org/onosproject/incubator/net/resource/label/impl/LabelResourceManager.java
index 259dce0..56c308e 100644
--- a/incubator/net/src/main/java/org/onosproject/incubator/net/resource/label/impl/LabelResourceManager.java
+++ b/incubator/net/src/main/java/org/onosproject/incubator/net/resource/label/impl/LabelResourceManager.java
@@ -130,13 +130,11 @@
public Collection<LabelResource> applyFromDevicePool(DeviceId deviceId,
long applyNum) {
checkNotNull(deviceId, "deviceId is not null");
- checkNotNull(applyNum, "applyNum is not null");
return store.applyFromDevicePool(deviceId, applyNum);
}
@Override
public Collection<LabelResource> applyFromGlobalPool(long applyNum) {
- checkNotNull(applyNum, "applyNum is not null");
return store.applyFromGlobalPool(applyNum);
}
diff --git a/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkFlowObjectiveManager.java b/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkFlowObjectiveManager.java
index 1816bb4..2a5bc26 100644
--- a/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkFlowObjectiveManager.java
+++ b/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkFlowObjectiveManager.java
@@ -317,7 +317,7 @@
public ObjectiveInstaller(DeviceId deviceId, Objective objective, int attemps) {
this.deviceId = checkNotNull(deviceId);
this.objective = checkNotNull(objective);
- this.numAttempts = checkNotNull(attemps);
+ this.numAttempts = attemps;
}
@Override
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpEvpnEsi.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpEvpnEsi.java
index b6816e8..883be89 100644
--- a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpEvpnEsi.java
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpEvpnEsi.java
@@ -16,7 +16,7 @@
package org.onosproject.bgpio.types;
-import java.util.Objects;
+import java.util.Arrays;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.common.base.MoreObjects;
@@ -78,7 +78,7 @@
@Override
public int hashCode() {
- return Objects.hash(ethernetSegmentidentifier);
+ return Arrays.hashCode(ethernetSegmentidentifier);
};
@Override
@@ -89,9 +89,7 @@
if (obj instanceof BgpEvpnEsi) {
BgpEvpnEsi that = (BgpEvpnEsi) obj;
- if (this.ethernetSegmentidentifier == that.ethernetSegmentidentifier) {
- return true;
- }
+ return Arrays.equals(this.ethernetSegmentidentifier, that.ethernetSegmentidentifier);
}
return false;
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpEvpnLabel.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpEvpnLabel.java
index 60348ac..b6a2e87 100644
--- a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpEvpnLabel.java
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BgpEvpnLabel.java
@@ -16,7 +16,7 @@
package org.onosproject.bgpio.types;
-import java.util.Objects;
+import java.util.Arrays;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.common.base.MoreObjects;
@@ -87,9 +87,7 @@
BgpEvpnLabel that = (BgpEvpnLabel) obj;
- if (this.mplsLabel == that.mplsLabel) {
- return true;
- }
+ return Arrays.equals(this.mplsLabel, that.mplsLabel);
}
return false;
@@ -97,7 +95,7 @@
@Override
public int hashCode() {
- return Objects.hashCode(mplsLabel);
+ return Arrays.hashCode(mplsLabel);
}
@Override
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/RouteTarget.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/RouteTarget.java
index 5a009f9..2d48788 100644
--- a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/RouteTarget.java
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/RouteTarget.java
@@ -17,7 +17,10 @@
package org.onosproject.bgpio.types;
import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
+
+import java.util.Arrays;
+import java.util.Objects;
+
import org.jboss.netty.buffer.ChannelBuffer;
/**
@@ -107,7 +110,7 @@
if (obj instanceof RouteTarget) {
RouteTarget that = (RouteTarget) obj;
if (this.type == that.type
- && this.routeTarget == that.routeTarget) {
+ && Arrays.equals(this.routeTarget, that.routeTarget)) {
return true;
}
}
@@ -116,7 +119,7 @@
@Override
public int hashCode() {
- return Objects.hashCode(routeTarget);
+ return Objects.hash(type, Arrays.hashCode(routeTarget));
}
@Override
diff --git a/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapReplyTest.java b/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapReplyTest.java
index e984ced..8bd7b2e 100644
--- a/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapReplyTest.java
+++ b/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapReplyTest.java
@@ -27,6 +27,8 @@
import org.onosproject.lisp.msg.exceptions.LispWriterException;
import org.onosproject.lisp.msg.protocols.DefaultLispMapReply.ReplyReader;
import org.onosproject.lisp.msg.protocols.DefaultLispMapReply.ReplyWriter;
+import org.onosproject.lisp.msg.protocols.LispMapRecord.MapRecordBuilder;
+import org.onosproject.lisp.msg.protocols.LispMapReply.ReplyBuilder;
import org.onosproject.lisp.msg.types.LispIpv4Address;
import java.util.List;
@@ -34,9 +36,7 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.onosproject.lisp.msg.protocols.DefaultLispMapRecord.DefaultMapRecordBuilder;
-import static org.onosproject.lisp.msg.protocols.DefaultLispMapRecord.MapRecordBuilder;
import static org.onosproject.lisp.msg.protocols.DefaultLispMapReply.DefaultReplyBuilder;
-import static org.onosproject.lisp.msg.protocols.DefaultLispMapReply.ReplyBuilder;
/**
* Unit tests for DefaultLispMapReply class.
diff --git a/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfDeviceInfo.java b/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfDeviceInfo.java
index d05acc3..3ebb982 100644
--- a/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfDeviceInfo.java
+++ b/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfDeviceInfo.java
@@ -67,7 +67,7 @@
public NetconfDeviceInfo(String name, String password, IpAddress ipAddress,
int port) {
checkArgument(!name.equals(""), "Empty device username");
- checkNotNull(port > 0, "Negative port");
+ checkArgument(port > 0, "Negative port");
checkNotNull(ipAddress, "Null ip address");
this.name = name;
this.password = password;
@@ -96,7 +96,7 @@
public NetconfDeviceInfo(String name, String password, IpAddress ipAddress,
int port, String keyString) {
checkArgument(!name.equals(""), "Empty device name");
- checkNotNull(port > 0, "Negative port");
+ checkArgument(port > 0, "Negative port");
checkNotNull(ipAddress, "Null ip address");
this.name = name;
this.password = password;
@@ -116,7 +116,7 @@
*/
public NetconfDeviceInfo(NetconfDeviceConfig netconfConfig) {
checkArgument(!netconfConfig.username().isEmpty(), "Empty device name");
- checkNotNull(netconfConfig.port() > 0, "Negative port");
+ checkArgument(netconfConfig.port() > 0, "Negative port");
checkNotNull(netconfConfig.ip(), "Null ip address");
this.name = netconfConfig.username();
diff --git a/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/ThirdPartyMessage.java b/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/ThirdPartyMessage.java
index b00da85..dbb1d53 100644
--- a/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/ThirdPartyMessage.java
+++ b/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/ThirdPartyMessage.java
@@ -75,7 +75,7 @@
@Override
public int hashCodeIgnoreXid() {
- return payLoad.hashCode();
+ return Arrays.hashCode(payLoad);
}
@Override
diff --git a/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OFChannelHandler.java b/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OFChannelHandler.java
index b75e8b1..414bd89 100644
--- a/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OFChannelHandler.java
+++ b/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OFChannelHandler.java
@@ -1447,7 +1447,7 @@
if (dispatcherHandle.isDone()) {
// dispatcher terminated for some reason, restart
- dispatcherHandle = dispatcher.submit(() -> {
+ dispatcherHandle = dispatcher.submit((Runnable) () -> {
try {
List<OFMessage> msgs = new ArrayList<>();
for (;;) {
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfInterfaceImpl.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfInterfaceImpl.java
index 79b613a..7c1626b 100644
--- a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfInterfaceImpl.java
+++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfInterfaceImpl.java
@@ -138,6 +138,7 @@
*
* @return OSPF area instance
*/
+ @Override
public OspfArea ospfArea() {
return ospfArea;
}
@@ -156,6 +157,7 @@
*
* @param ospfArea OSPF area instance
*/
+ @Override
public void setOspfArea(OspfArea ospfArea) {
this.ospfArea = ospfArea;
}
@@ -188,6 +190,7 @@
*
* @return network mask
*/
+ @Override
public Ip4Address ipNetworkMask() {
return ipNetworkMask;
}
@@ -207,6 +210,7 @@
*
* @param ospfNbr ospfNbr instance
*/
+ @Override
public void addNeighbouringRouter(OspfNbr ospfNbr) {
listOfNeighbors.put(ospfNbr.neighborId().toString(), ospfNbr);
}
@@ -217,6 +221,7 @@
* @param neighborId neighbors id
* @return ospfNbr neighbor instance
*/
+ @Override
public OspfNbr neighbouringRouter(String neighborId) {
return listOfNeighbors.get(neighborId);
}
@@ -224,6 +229,7 @@
/**
* Removes all the neighbors.
*/
+ @Override
public void removeNeighbors() {
Set<String> neighbors = listOfNeighbors.keySet();
for (String neighborId : neighbors) {
@@ -245,7 +251,7 @@
ospfNeighbor.stopRxMtDdTimer();
ospfNeighbor.stopRxMtLsrTimer();
- listOfNeighbors.remove(ospfNeighbor.neighborId());
+ listOfNeighbors.remove(ospfNeighbor.neighborId().toString());
}
@@ -274,6 +280,7 @@
*
* @param lsaKey key used to store LSA in map
*/
+ @Override
public void removeLsaFromNeighborMap(String lsaKey) {
listOfNeighborMap.remove(lsaKey);
}
@@ -284,6 +291,7 @@
* @param neighborId neighbors id
* @return true if neighbor in list else false
*/
+ @Override
public boolean isNeighborInList(String neighborId) {
return listOfNeighbors.containsKey(neighborId);
}
@@ -293,6 +301,7 @@
*
* @return listOfNeighbors as key value pair
*/
+ @Override
public Map<String, OspfNbr> listOfNeighbors() {
return listOfNeighbors;
}
@@ -311,6 +320,7 @@
*
* @return interface index
*/
+ @Override
public int interfaceIndex() {
return interfaceIndex;
}
@@ -320,6 +330,7 @@
*
* @param interfaceIndex interface index
*/
+ @Override
public void setInterfaceIndex(int interfaceIndex) {
this.interfaceIndex = interfaceIndex;
}
@@ -329,6 +340,7 @@
*
* @return IP address
*/
+ @Override
public Ip4Address ipAddress() {
return ipAddress;
}
@@ -338,6 +350,7 @@
*
* @param ipAddress interface IP address
*/
+ @Override
public void setIpAddress(Ip4Address ipAddress) {
this.ipAddress = ipAddress;
}
@@ -347,6 +360,7 @@
*
* @return routerPriority value
*/
+ @Override
public int routerPriority() {
return routerPriority;
}
@@ -356,6 +370,7 @@
*
* @param routerPriority value
*/
+ @Override
public void setRouterPriority(int routerPriority) {
this.routerPriority = routerPriority;
}
@@ -365,6 +380,7 @@
*
* @return hello interval time
*/
+ @Override
public int helloIntervalTime() {
return helloIntervalTime;
}
@@ -374,6 +390,7 @@
*
* @param helloIntervalTime an integer interval time
*/
+ @Override
public void setHelloIntervalTime(int helloIntervalTime) {
this.helloIntervalTime = helloIntervalTime;
}
@@ -383,6 +400,7 @@
*
* @return router dead interval time
*/
+ @Override
public int routerDeadIntervalTime() {
return routerDeadIntervalTime;
}
@@ -392,6 +410,7 @@
*
* @param routerDeadIntervalTime router dead interval time
*/
+ @Override
public void setRouterDeadIntervalTime(int routerDeadIntervalTime) {
this.routerDeadIntervalTime = routerDeadIntervalTime;
}
@@ -401,6 +420,7 @@
*
* @return interfaceType an integer represents interface type
*/
+ @Override
public int interfaceType() {
return interfaceType;
}
@@ -410,6 +430,7 @@
*
* @param interfaceType interface type
*/
+ @Override
public void setInterfaceType(int interfaceType) {
this.interfaceType = interfaceType;
}
@@ -419,6 +440,7 @@
*
* @return mtu an integer represents max transfer unit
*/
+ @Override
public int mtu() {
return mtu;
}
@@ -428,6 +450,7 @@
*
* @param mtu max transfer unit
*/
+ @Override
public void setMtu(int mtu) {
this.mtu = mtu;
}
@@ -437,6 +460,7 @@
*
* @return retransmit interval
*/
+ @Override
public int reTransmitInterval() {
return reTransmitInterval;
}
@@ -446,6 +470,7 @@
*
* @param reTransmitInterval retransmit interval
*/
+ @Override
public void setReTransmitInterval(int reTransmitInterval) {
this.reTransmitInterval = reTransmitInterval;
}
@@ -455,6 +480,7 @@
*
* @return dr designated routers IP address
*/
+ @Override
public Ip4Address dr() {
return dr;
}
@@ -464,6 +490,7 @@
*
* @param dr designated routers IP address
*/
+ @Override
public void setDr(Ip4Address dr) {
this.dr = dr;
}
@@ -473,6 +500,7 @@
*
* @return bdr backup designated routers IP address
*/
+ @Override
public Ip4Address bdr() {
return bdr;
}
@@ -482,6 +510,7 @@
*
* @param bdr backup designated routers IP address
*/
+ @Override
public void setBdr(Ip4Address bdr) {
this.bdr = bdr;
}
@@ -491,6 +520,7 @@
*
* @throws Exception might throws exception
*/
+ @Override
public void interfaceUp() throws Exception {
log.debug("OSPFInterfaceChannelHandler::interfaceUp...!!!");
if (interfaceType() == OspfInterfaceType.POINT_TO_POINT.value()) {
@@ -578,6 +608,7 @@
* All interface variables are reset, and interface timers disabled.
* Also all neighbor connections associated with the interface are destroyed.
*/
+ @Override
public void interfaceDown() {
log.debug("OSPFInterfaceChannelHandler::interfaceDown ");
stopHelloTimer();
@@ -594,6 +625,7 @@
* @param ctx channel handler context instance.
* @throws Exception might throws exception
*/
+ @Override
public void processOspfMessage(OspfMessage ospfMessage, ChannelHandlerContext ctx) throws Exception {
log.debug("OspfChannelHandler::processOspfMessage...!!!");
@@ -1078,7 +1110,7 @@
OspfUtil.LSA_HEADER_LENGTH; // subtract a normal IP header.
int noLsa = 0;
while (listItr.hasNext()) {
- LsRequestPacket lsRequest = (LsRequestPacket) listItr.next();
+ LsRequestPacket lsRequest = listItr.next();
// to verify length of the LSA
LsaWrapper wrapper = ospfArea.getLsa(lsRequest.lsType(), lsRequest.linkStateId(),
lsRequest.ownRouterId());
@@ -1168,7 +1200,7 @@
LsaHeader lsRequest = (LsaHeader) itr.next();
OspfLsa ospfLsa =
- (OspfLsa) nbr.getPendingReTxList().get(((OspfAreaImpl) ospfArea).getLsaKey(lsRequest));
+ nbr.getPendingReTxList().get(((OspfAreaImpl) ospfArea).getLsaKey(lsRequest));
if (ospfLsa != null) {
String isSame = ((OspfLsdbImpl) ospfArea.database()).isNewerOrSameLsa(
lsRequest, (LsaHeader) ospfLsa);
@@ -1206,6 +1238,7 @@
/**
* Starts the hello timer which sends hello packet every configured seconds.
*/
+ @Override
public void startHelloTimer() {
log.debug("OSPFInterfaceChannelHandler::startHelloTimer");
exServiceHello = Executors.newSingleThreadScheduledExecutor();
@@ -1217,6 +1250,7 @@
/**
* Stops the hello timer.
*/
+ @Override
public void stopHelloTimer() {
log.debug("OSPFInterfaceChannelHandler::stopHelloTimer ");
exServiceHello.shutdown();
@@ -1244,6 +1278,7 @@
/**
* Starts the timer which waits for configured seconds and sends Delayed Ack Packet.
*/
+ @Override
public void startDelayedAckTimer() {
if (!isDelayedAckTimerScheduled) {
log.debug("Started DelayedAckTimer...!!!");
@@ -1259,6 +1294,7 @@
/**
* Stops the delayed acknowledge timer.
*/
+ @Override
public void stopDelayedAckTimer() {
if (isDelayedAckTimerScheduled) {
log.debug("Stopped DelayedAckTimer...!!!");
diff --git a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/lsdb/LsdbAgeImpl.java b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/lsdb/LsdbAgeImpl.java
index 636e75c..794d623 100644
--- a/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/lsdb/LsdbAgeImpl.java
+++ b/protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/lsdb/LsdbAgeImpl.java
@@ -80,7 +80,7 @@
return Objects.equal(ageBins, that.ageBins) &&
Objects.equal(ageCounter, that.ageCounter) &&
Objects.equal(ageCounterRollOver, that.ageCounterRollOver) &&
- Objects.equal(lsaQueue, lsaQueue);
+ Objects.equal(lsaQueue, that.lsaQueue);
}
@Override
@@ -94,6 +94,7 @@
* @param binKey key to store in bin
* @param lsaBin LSA bin instance
*/
+ @Override
public void addLsaBin(Integer binKey, LsaBin lsaBin) {
if (!ageBins.containsKey(binKey)) {
ageBins.put(binKey, lsaBin);
@@ -106,6 +107,7 @@
* @param binKey key
* @return bin instance
*/
+ @Override
public LsaBin getLsaBin(Integer binKey) {
return ageBins.get(binKey);
@@ -117,6 +119,7 @@
* @param key key
* @param wrapper wrapper instance
*/
+ @Override
public void addLsaToMaxAgeBin(String key, LsaWrapper wrapper) {
maxAgeBin.addOspfLsa(key, wrapper);
}
@@ -126,6 +129,7 @@
*
* @param lsaWrapper wrapper instance
*/
+ @Override
public void removeLsaFromBin(LsaWrapper lsaWrapper) {
if (ageBins.containsKey(lsaWrapper.binNumber())) {
LsaBin lsaBin = ageBins.get(lsaWrapper.binNumber());
@@ -137,6 +141,7 @@
/**
* Starts the aging timer and queue consumer.
*/
+ @Override
public void startDbAging() {
startDbAgeTimer();
queueConsumer = new LsaQueueConsumer(lsaQueue, channel, ospfArea);
@@ -147,6 +152,7 @@
/**
* Gets called every 1 second as part of the timer.
*/
+ @Override
public void ageLsaAndFlood() {
//every 5 mins checksum validation
checkAges();
@@ -167,6 +173,7 @@
/**
* If the LSA have completed the MaxAge - they are moved called stop aging and flooded.
*/
+ @Override
public void maxAgeLsa() {
if (ageCounter == 0) {
return;
@@ -178,7 +185,7 @@
}
Map lsaBinMap = lsaBin.listOfLsa();
for (Object key : lsaBinMap.keySet()) {
- LsaWrapper lsa = (LsaWrapper) lsaBinMap.get((String) key);
+ LsaWrapper lsa = (LsaWrapper) lsaBinMap.get(key);
if (lsa.currentAge() == OspfParameters.MAXAGE) {
lsa.setLsaProcessing(OspfParameters.MAXAGELSA);
log.debug("Lsa picked for maxage flooding. Age Counter: {}, AgeCounterRollover: {}, " +
@@ -198,7 +205,7 @@
//Get from maxAgeBin
Map lsaMaxAgeBinMap = maxAgeBin.listOfLsa();
for (Object key : lsaMaxAgeBinMap.keySet()) {
- LsaWrapper lsa = (LsaWrapper) lsaMaxAgeBinMap.get((String) key);
+ LsaWrapper lsa = (LsaWrapper) lsaMaxAgeBinMap.get(key);
lsa.setLsaProcessing(OspfParameters.MAXAGELSA);
log.debug("Lsa picked for maxage flooding. Age Counter: {}, LSA Type: {}, LSA Key: {}",
ageCounter, lsa.lsaType(), key);
@@ -217,6 +224,7 @@
/*
* If the LSA is in age bin of 1800 - it's pushed into refresh list.
*/
+ @Override
public void refreshLsa() {
int binNumber;
if (ageCounter < OspfParameters.LSREFRESHTIME) {
@@ -230,7 +238,7 @@
}
Map lsaBinMap = lsaBin.listOfLsa();
for (Object key : lsaBinMap.keySet()) {
- LsaWrapper lsa = (LsaWrapper) lsaBinMap.get((String) key);
+ LsaWrapper lsa = (LsaWrapper) lsaBinMap.get(key);
try {
if (lsa.isSelfOriginated()) {
log.debug("Lsa picked for refreshLsa. binNumber: {}, LSA Type: {}, LSA Key: {}",
@@ -259,7 +267,7 @@
}
Map lsaBinMap = lsaBin.listOfLsa();
for (Object key : lsaBinMap.keySet()) {
- LsaWrapper lsa = (LsaWrapper) lsaBinMap.get((String) key);
+ LsaWrapper lsa = (LsaWrapper) lsaBinMap.get(key);
lsa.setLsaProcessing(OspfParameters.VERIFYCHECKSUM);
try {
lsaQueue.put(lsa);
@@ -319,6 +327,7 @@
*
* @return ageCounter
*/
+ @Override
public int getAgeCounter() {
return ageCounter;
}
@@ -328,6 +337,7 @@
*
* @return the age counter roll over value
*/
+ @Override
public int getAgeCounterRollOver() {
return ageCounterRollOver;
}
@@ -337,6 +347,7 @@
*
* @return lsa bin instance
*/
+ @Override
public LsaBin getMaxAgeBin() {
return maxAgeBin;
}
@@ -347,6 +358,7 @@
* @param x Can be either age or ageCounter
* @return bin number.
*/
+ @Override
public int age2Bin(int x) {
if (x <= ageCounter) {
return (ageCounter - x);
diff --git a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6InterfaceAddressSubTlv.java b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6InterfaceAddressSubTlv.java
index 934c786..d318ca3 100644
--- a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6InterfaceAddressSubTlv.java
+++ b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6InterfaceAddressSubTlv.java
@@ -80,7 +80,7 @@
boolean bFoundNoMask = true;
//value starts from 3rd byte.
for (int i = 2; i < 20; ++i) {
- if (0xFF != raw[i]) {
+ if ((byte) 0xFF != raw[i]) {
bFoundNoMask = false;
}
}
diff --git a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6NeighborAddressSubTlv.java b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6NeighborAddressSubTlv.java
index 6eedfa5..7b2f5e5 100644
--- a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6NeighborAddressSubTlv.java
+++ b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6NeighborAddressSubTlv.java
@@ -78,7 +78,7 @@
boolean bFoundNoMask = true;
//value starts from 3rd byte.
for (int i = 2; i < 20; ++i) {
- if (0xFF != raw[i]) {
+ if ((byte) 0xFF != raw[i]) {
bFoundNoMask = false;
}
}
diff --git a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6RouterIdofLocalNodeSubTlv.java b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6RouterIdofLocalNodeSubTlv.java
index b269803..186f56d 100644
--- a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6RouterIdofLocalNodeSubTlv.java
+++ b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6RouterIdofLocalNodeSubTlv.java
@@ -78,7 +78,7 @@
boolean bFoundNoMask = true;
//value starts from 3rd byte.
for (int i = 2; i < 20; ++i) {
- if (0xFF != raw[i]) {
+ if ((byte) 0xFF != raw[i]) {
bFoundNoMask = false;
}
}
diff --git a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6RouterIdofRemoteNodeSubTlv.java b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6RouterIdofRemoteNodeSubTlv.java
index 1512aa2..021da71 100644
--- a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6RouterIdofRemoteNodeSubTlv.java
+++ b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6RouterIdofRemoteNodeSubTlv.java
@@ -79,7 +79,7 @@
boolean bFoundNoMask = true;
//value starts from 3rd byte.
for (int i = 2; i < 20; ++i) {
- if (0xFF != raw[i]) {
+ if ((byte) 0xFF != raw[i]) {
bFoundNoMask = false;
}
}
diff --git a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6SubObject.java b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6SubObject.java
index e570255..808b1e8 100644
--- a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6SubObject.java
+++ b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/IPv6SubObject.java
@@ -130,7 +130,7 @@
boolean bFoundNoMask = true;
//value starts from 3rd byte.
for (int i = 2; i < 20; ++i) {
- if (0xFF != raw[i]) {
+ if ((byte) 0xFF != raw[i]) {
bFoundNoMask = false;
}
}
diff --git a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/NexthopIPv6addressTlv.java b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/NexthopIPv6addressTlv.java
index fdcf9e7..2c031ab 100644
--- a/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/NexthopIPv6addressTlv.java
+++ b/protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/types/NexthopIPv6addressTlv.java
@@ -99,7 +99,7 @@
boolean bFoundNoMask = true;
//value starts from 3rd byte.
for (int i = 5; i < 20; ++i) {
- if (0xFF != raw[i]) {
+ if ((byte) 0xFF != raw[i]) {
bFoundNoMask = false;
}
}
diff --git a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestEventuallyConsistentMap.java b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestEventuallyConsistentMap.java
index 6c34554..9184352 100644
--- a/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestEventuallyConsistentMap.java
+++ b/protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/util/TestEventuallyConsistentMap.java
@@ -90,6 +90,7 @@
return map.get(key);
}
+ @SuppressWarnings("ReturnValueIgnored")
@Override
public void put(K key, V value) {
map.put(key, value);
diff --git a/protocols/snmp/ctl/src/main/java/org/onosproject/snmp/ctl/DefaultSnmpDevice.java b/protocols/snmp/ctl/src/main/java/org/onosproject/snmp/ctl/DefaultSnmpDevice.java
index 5e1f867..b15277c 100644
--- a/protocols/snmp/ctl/src/main/java/org/onosproject/snmp/ctl/DefaultSnmpDevice.java
+++ b/protocols/snmp/ctl/src/main/java/org/onosproject/snmp/ctl/DefaultSnmpDevice.java
@@ -50,7 +50,7 @@
public DefaultSnmpDevice(String snmpHost, int snmpPort, String username, String community) {
this.snmpHost = checkNotNull(snmpHost, "SNMP Device IP cannot be null");
- this.snmpPort = checkNotNull(snmpPort, "SNMP Device port cannot be null");
+ this.snmpPort = snmpPort;
this.username = username;
this.community = community;
this.deviceId = createDeviceId();
diff --git a/providers/link/src/test/java/org/onosproject/provider/linkdiscovery/impl/LinkDiscoveryProviderTest.java b/providers/link/src/test/java/org/onosproject/provider/linkdiscovery/impl/LinkDiscoveryProviderTest.java
index a1872c8..30ddf2a 100644
--- a/providers/link/src/test/java/org/onosproject/provider/linkdiscovery/impl/LinkDiscoveryProviderTest.java
+++ b/providers/link/src/test/java/org/onosproject/provider/linkdiscovery/impl/LinkDiscoveryProviderTest.java
@@ -149,7 +149,7 @@
@Test
public void activate() throws Exception {
- assertFalse("Provider should be registered", linkRegistry.getProviders().contains(provider));
+ assertTrue("Provider should be registered", linkRegistry.getProviders().contains(provider.id()));
assertEquals("Device service should be registered", provider.deviceService, deviceService);
assertEquals("Device listener should be added", 1, deviceListeners.size());
assertNotNull("Registration expected", providerService);
@@ -177,7 +177,7 @@
public void deactivate() throws Exception {
provider.deactivate();
assertEquals("Device listener should be removed", 0, deviceListeners.size());
- assertFalse("Provider should not be registered", linkRegistry.getProviders().contains(provider));
+ assertFalse("Provider should not be registered", linkRegistry.getProviders().contains(provider.id()));
assertTrue(provider.executor.isShutdown());
assertNull(provider.providerService);
}
diff --git a/providers/lisp/device/src/test/java/org/onosproject/provider/lisp/device/impl/LispDeviceProviderTest.java b/providers/lisp/device/src/test/java/org/onosproject/provider/lisp/device/impl/LispDeviceProviderTest.java
index 74a28f0..90a15fa 100644
--- a/providers/lisp/device/src/test/java/org/onosproject/provider/lisp/device/impl/LispDeviceProviderTest.java
+++ b/providers/lisp/device/src/test/java/org/onosproject/provider/lisp/device/impl/LispDeviceProviderTest.java
@@ -97,7 +97,7 @@
provider.deactivate();
assertFalse("Provider should not be registered",
- providerRegistry.getProviders().contains(provider));
+ providerRegistry.getProviders().contains(provider.id()));
assertNull("Provider service should be null",
provider.providerService);
assertEquals("Controller listener should be removed", 0,
diff --git a/providers/lisp/mapping/src/test/java/org/onosproject/provider/lisp/mapping/impl/LispMappingProviderTest.java b/providers/lisp/mapping/src/test/java/org/onosproject/provider/lisp/mapping/impl/LispMappingProviderTest.java
index 17c758c..8424454 100644
--- a/providers/lisp/mapping/src/test/java/org/onosproject/provider/lisp/mapping/impl/LispMappingProviderTest.java
+++ b/providers/lisp/mapping/src/test/java/org/onosproject/provider/lisp/mapping/impl/LispMappingProviderTest.java
@@ -78,7 +78,7 @@
provider.deactivate();
assertFalse("Provider should not be registered",
- providerRegistry.getProviders().contains(provider));
+ providerRegistry.getProviders().contains(provider.id()));
assertNull("Provider service should be null",
provider.providerService);
assertEquals("Controller listener should be removed", 0,
diff --git a/providers/netconf/device/src/test/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProviderTest.java b/providers/netconf/device/src/test/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProviderTest.java
index f37d41e..802c002 100644
--- a/providers/netconf/device/src/test/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProviderTest.java
+++ b/providers/netconf/device/src/test/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProviderTest.java
@@ -225,7 +225,7 @@
public void deactivate() throws Exception {
provider.deactivate();
assertNull("Device listener should be removed", deviceService.listener);
- assertFalse("Provider should not be registered", deviceRegistry.getProviders().contains(provider));
+ assertFalse("Provider should not be registered", deviceRegistry.getProviders().contains(provider.id()));
assertTrue("Thread to connect device should be shutdown", provider.executor.isShutdown());
assertTrue("Scheduled task to update device should be shutdown", provider.scheduledTask.isCancelled());
assertNull("Provider service should be null", provider.providerService);