*/
package org.opendaylight.netvirt.fibmanager;
+import static java.util.Objects.requireNonNull;
import static java.util.stream.Collectors.toList;
-import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
-import static org.opendaylight.genius.infra.Datastore.OPERATIONAL;
import static org.opendaylight.genius.mdsalutil.NWUtil.isIpv4Address;
+import static org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION;
+import static org.opendaylight.mdsal.binding.util.Datastore.OPERATIONAL;
-import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.Arrays;
import javax.inject.Singleton;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
-import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
-import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.genius.itm.globals.ITMConstants;
import org.opendaylight.genius.mdsalutil.ActionInfo;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner;
+import org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.mdsal.common.api.ReadFailedException;
import org.opendaylight.netvirt.elanmanager.api.IElanService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelListKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.DcGatewayIpList;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetEgressActionsForTunnelInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetEgressActionsForTunnelOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetInternalOrExternalInterfaceNameInputBuilder;
ifName, rpcResult.getErrors());
return Collections.emptyList();
} else {
- actions = rpcResult.getResult().nonnullAction();
+ actions = new ArrayList<Action>(rpcResult.getResult().nonnullAction().values());
}
} else {
RpcResult<GetEgressActionsForInterfaceOutput> rpcResult = odlInterfaceRpcService
+ "Errors {}", ifName, vpnId, destIpPrefix, rpcResult.getErrors());
return Collections.emptyList();
} else {
- actions = rpcResult.getResult().nonnullAction();
+ actions = new ArrayList<Action>(rpcResult.getResult().nonnullAction().values());
}
}
List<ActionInfo> listActionInfo = new ArrayList<>();
} else {
// Ignore adding new prefix , if it already exists
- List<IpAdjacencies> prefixesList = nexthop.getIpAdjacencies();
+ Map<IpAdjacenciesKey, IpAdjacencies> keyIpAdjacenciesMap = nexthop.getIpAdjacencies();
IpAdjacencies prefix = new IpAdjacenciesBuilder().setIpAdjacency(currDestIpPrefix).build();
- if (prefixesList != null && prefixesList.contains(prefix)) {
+ if (keyIpAdjacenciesMap != null && keyIpAdjacenciesMap.values().contains(prefix)) {
LOG.trace("Prefix {} is already present in l3nextHop {} ", currDestIpPrefix, nexthop);
} else {
IpAdjacenciesBuilder ipPrefixesBuilder =
return null;
}
if (vpnNexthops.isPresent()) {
- // get nexthops list for vpn
- List<VpnNexthop> nexthops = vpnNexthops.get().nonnullVpnNexthop();
- for (VpnNexthop nexthop : nexthops) {
+ // get keyVpnNexthopMap list for vpn
+ Map<VpnNexthopKey, VpnNexthop> keyVpnNexthopMap = vpnNexthops.get().nonnullVpnNexthop();
+ for (VpnNexthop nexthop : keyVpnNexthopMap.values()) {
if (Objects.equals(nexthop.getIpAddress(), ipAddress)) {
// return nexthop
LOG.trace("VpnNextHop : {}", nexthop);
if (FibUtil.lockCluster(lockManager, nextHopLockStr, WAIT_TIME_TO_ACQUIRE_LOCK)) {
VpnNexthop nh = getVpnNexthop(vpnId, primaryIpAddress);
if (nh != null) {
- List<IpAdjacencies> prefixesList = new ArrayList<>(nh.nonnullIpAdjacencies());
+ List<IpAdjacencies> prefixesList = new ArrayList<IpAdjacencies>(nh.nonnullIpAdjacencies().values());
IpAdjacencies prefix = new IpAdjacenciesBuilder().setIpAdjacency(currDestIpPrefix).build();
prefixesList.remove(prefix);
if (prefixesList.isEmpty()) { //remove the group only if there are no more flows using this group
public void createDcGwLoadBalancingGroup(Uint64 dpnId, String destinationIp,
Class<? extends TunnelTypeBase> tunnelType) {
jobCoordinator.enqueueJob(FibHelper.getJobKeyForDcGwLoadBalancingGroup(dpnId), () -> {
- List<ListenableFuture<Void>> futures = new ArrayList<>();
+ List<ListenableFuture<?>> futures = new ArrayList<>();
futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(OPERATIONAL, operationalTx -> {
synchronized (getDcGateWaySyncKey(destinationIp)) {
FibUtil.addL3vpnDcGateWay(destinationIp, operationalTx);
}
futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, configTx -> {
List<String> availableDcGws = getDcGwIps();
- Preconditions.checkNotNull(availableDcGws, "There are no dc-gws present");
+ requireNonNull(availableDcGws, "There are no dc-gws present");
int noOfDcGws = availableDcGws.size();
if (noOfDcGws == 1) {
LOG.trace("There are no enough DC GateWays {} present to program LB group", availableDcGws);
if (dcGatewayIpListConfig == null) {
return Collections.emptyList();
}
- return dcGatewayIpListConfig.getDcGatewayIp()
+ return new ArrayList<DcGatewayIp>(dcGatewayIpListConfig.nonnullDcGatewayIp().values())
.stream()
.filter(dcGwIp -> dcGwIp.getTunnnelType().equals(TunnelTypeMplsOverGre.class))
.map(dcGwIp -> dcGwIp.getIpAddress().stringValue()).sorted()
LOG.warn("RPC Call to Get egress actions for interface {} returned with Errors {}",
interfaceName, rpcResult.getErrors());
} else {
- actions = rpcResult.getResult().nonnullAction();
+ actions = new ArrayList<Action>(rpcResult.getResult().nonnullAction().values());
}
} catch (InterruptedException | ExecutionException e) {
LOG.warn("Exception when egress actions for interface {}", interfaceName, e);
if (availableDcGws.contains(destinationIp)) {
availableDcGws.remove(destinationIp);
}
- List<ListenableFuture<Void>> futures = new ArrayList<>();
+ List<ListenableFuture<?>> futures = new ArrayList<>();
futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(OPERATIONAL, operationalTx -> {
futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, configTx -> {
availableDcGws.forEach(dcGwIp -> {
if (availableDcGws.contains(destinationIp)) {
availableDcGws.remove(destinationIp);
}
- List<ListenableFuture<Void>> futures = new ArrayList<>();
+ List<ListenableFuture<?>> futures = new ArrayList<>();
futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, configTx -> {
availableDcGws.forEach(dcGwIp -> {
List<String> dcGws = Arrays.asList(dcGwIp, destinationIp);