Correct several equals() bugs 77/53377/3
authorAlon Kochba <alonko@hpe.com>
Wed, 15 Mar 2017 12:20:22 +0000 (14:20 +0200)
committerSam Hague <shague@redhat.com>
Sat, 8 Apr 2017 16:39:08 +0000 (16:39 +0000)
Change-Id: I8f008515dc79cdd0c38e957a3917db1ce8d9ab86
Signed-off-by: Alon Kochba <alonko@hpe.com>
vpnservice/cloud-servicechain/cloud-servicechain-impl/src/main/java/org/opendaylight/netvirt/cloudservicechain/VPNServiceChainHandler.java
vpnservice/cloud-servicechain/cloud-servicechain-impl/src/test/java/org/opendaylight/netvirt/cloudservicechain/VPNServiceChainHandlerTest.java
vpnservice/dhcpservice/dhcpservice-impl/src/main/java/org/opendaylight/netvirt/dhcpservice/DhcpExternalTunnelManager.java

index 2264549b376a00e05d1856161c65665bfd58639b..4b839698013eec7f0a6d160db1ef815eb1c57ad3 100755 (executable)
@@ -227,7 +227,7 @@ public class VPNServiceChainHandler implements AutoCloseable {
                     for (VpnToDpnList dpnInVpn : vpnToDpnList ) {
                         dpns.add(dpnInVpn.getDpnId());
                     }
-                    if ( !dpns.contains(dpnId) ) {
+                    if (!dpns.contains(BigInteger.valueOf(dpnId))) {
                         LOG.debug("Dpn {} is not included in the current VPN Footprint", dpnId);
                         dpns.add(BigInteger.valueOf(dpnId));
                     }
index df0e9c8a205bababb470a769eb6267f3b7dab0ed..fdddc49eb1ef42c3fe52c04b78d8c7a813a8139c 100755 (executable)
@@ -318,9 +318,9 @@ public class VPNServiceChainHandlerTest {
 
         // Verifying installed flows
         ArgumentCaptor<Flow> argumentCaptor = ArgumentCaptor.forClass(Flow.class);
-        verify(mdsalMgr, times(2)).installFlow((BigInteger)anyObject(), argumentCaptor.capture());
+        verify(mdsalMgr, times(1)).installFlow((BigInteger)anyObject(), argumentCaptor.capture());
         List<Flow> installedFlowsCaptured = argumentCaptor.getAllValues();
-        assert (installedFlowsCaptured.size() == 2);
+        assert (installedFlowsCaptured.size() == 1);
         Flow expectedLportDispatcherFlowEntity =
             VpnServiceChainUtils.buildLPortDispFromScfToL3VpnFlow(VPN_ID, DPN_ID, LPORT_TAG, NwConstants.ADD_FLOW);
         assert (new FlowMatcher(expectedLportDispatcherFlowEntity).matches(installedFlowsCaptured.get(0)));
index 5983e2c50375ea485ddb8045033aabc44b5a8c67..55bd40bba89e1612f882190be3271d6c1f402b15 100644 (file)
@@ -121,7 +121,8 @@ public class DhcpExternalTunnelManager {
                     designatedSwitchForTunnelOptional.get().getDesignatedSwitchForTunnel();
             for (DesignatedSwitchForTunnel designatedSwitchForTunnel : list) {
                 Set<Pair<IpAddress, String>> setOfTunnelIpElanNamePair =
-                        designatedDpnsToTunnelIpElanNameCache.get(designatedSwitchForTunnel.getDpId());
+                        designatedDpnsToTunnelIpElanNameCache
+                                .get(BigInteger.valueOf(designatedSwitchForTunnel.getDpId()));
                 if (setOfTunnelIpElanNamePair == null) {
                     setOfTunnelIpElanNamePair = new CopyOnWriteArraySet<>();
                 }