vrfEntry.getDestPrefix(), vpnId, localDpnId, remoteDpnId);
String rd = vrfTableKey.getRouteDistinguisher();
- if (localDpnId != null && localDpnId != BigInteger.ZERO) {
+ if (localDpnId != null && !BigInteger.ZERO.equals(localDpnId)) {
// localDpnId is not known when clean up happens for last vm for a vpn on a dpn
if (extraRouteOptional.isPresent()) {
nextHopManager.deleteLoadBalancingNextHop(vpnId, remoteDpnId, vrfEntry.getDestPrefix());
vrfEntry.getDestPrefix(), vpnId, localDpnId, remoteDpnId);
String rd = vrfTableKey.getRouteDistinguisher();
- if (localDpnId != null && localDpnId != BigInteger.ZERO) {
+ if (localDpnId != null && !BigInteger.ZERO.equals(localDpnId)) {
// localDpnId is not known when clean up happens for last vm for a vpn on a dpn
if (extraRouteOptional.isPresent()) {
nexthopManager.deleteLoadBalancingNextHop(vpnId, remoteDpnId, vrfEntry.getDestPrefix());
import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
import java.math.BigInteger;
-
import java.time.Duration;
+import java.util.Objects;
import java.util.concurrent.ExecutionException;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
ListenableFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, confTx -> {
Routers origRouter = NatUtil.getRoutersFromConfigDS(confTx, origRouterToNaptSwitch.getRouterName());
Routers updatedRouter = NatUtil.getRoutersFromConfigDS(confTx, updatedRouterToNaptSwitch.getRouterName());
- if (origPrimarySwitchId != updatedPrimarySwitchId) {
+ if (!Objects.equals(origPrimarySwitchId, updatedPrimarySwitchId)) {
if (origRouter != null) {
snatServiceManger.notify(confTx, origRouter, null, origPrimarySwitchId, null,
SnatServiceManager.Action.CNT_ROUTER_ALL_SWITCH_DISBL);
import static org.opendaylight.genius.infra.Datastore.OPERATIONAL;
import com.google.common.base.Optional;
-
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
-
import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Singleton;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
public boolean scheduleCentralizedSwitch(Routers router) {
String providerNet = NatUtil.getElanInstancePhysicalNetwok(router.getNetworkId().getValue(),dataBroker);
BigInteger nextSwitchId = getSwitchWithLowestWeight(providerNet);
- if (nextSwitchId == BigInteger.valueOf(0)) {
+ if (BigInteger.ZERO.equals(nextSwitchId)) {
LOG.error("In scheduleCentralizedSwitch, unable to schedule the router {} as there is no available switch.",
router.getRouterName());
return false;
String providerNet = NatUtil.getElanInstancePhysicalNetwok(router.getNetworkId().getValue(),dataBroker);
String routerName = router.getRouterName();
BigInteger primarySwitchId = NatUtil.getPrimaryNaptfromRouterName(dataBroker, routerName);
- if (primarySwitchId == null || primarySwitchId == BigInteger.valueOf(0)) {
+ if (primarySwitchId == null || BigInteger.ZERO.equals(primarySwitchId)) {
LOG.info("releaseCentralizedSwitch: NAPT Switch is not allocated for router {}", router.getRouterName());
return false;
}
List<BigInteger> switches = naptSwitchSelector.getDpnsForVpn(routerName);
addCentralizedRouter(confTx, routers, primarySwitchId, primarySwitchId);
for (BigInteger dpnId : switches) {
- if (primarySwitchId != dpnId) {
+ if (!Objects.equals(primarySwitchId, dpnId)) {
addCentralizedRouter(confTx, routers, primarySwitchId, dpnId);
}
}
String routerName = routers.getRouterName();
List<BigInteger> switches = naptSwitchSelector.getDpnsForVpn(routerName);
for (BigInteger dpnId : switches) {
- if (primarySwitchId != dpnId) {
+ if (!Objects.equals(primarySwitchId, dpnId)) {
removeCentralizedRouter(confTx, routers, primarySwitchId, dpnId);
}
}
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
*/
addCentralizedRouter(confTx, routers, primarySwitchId, primarySwitchId);
for (BigInteger dpnId : switches) {
- if (primarySwitchId != dpnId) {
+ if (!Objects.equals(primarySwitchId, dpnId)) {
addCentralizedRouter(confTx, routers, primarySwitchId, dpnId);
}
}
*/
removeCentralizedRouter(confTx, routers, primarySwitchId, primarySwitchId);
for (BigInteger dpnId : switches) {
- if (primarySwitchId != dpnId) {
+ if (!Objects.equals(primarySwitchId, dpnId)) {
removeCentralizedRouter(confTx, routers, primarySwitchId, dpnId);
}
}
if (!routerHasIpv6ExtSubnet(origRouter) && routerHasIpv6ExtSubnet(updatedRouter)) {
List<BigInteger> switches = naptSwitchSelector.getDpnsForVpn(routerName);
for (BigInteger dpnId : switches) {
- if (primarySwitchId != dpnId) {
+ if (!Objects.equals(primarySwitchId, dpnId)) {
LOG.info("handleRouterUpdate (non-NAPTSwitch) : Installing flows on switch {} for router {}",
dpnId, routerName);
addIpv6PsNatMissEntryNonNaptSwitch(confTx, dpnId, routerId, routerName,