Remove GENIUS UTIL references in Elanmanager Module
[netvirt.git] / elanmanager / impl / src / main / java / org / opendaylight / netvirt / elan / evpn / utils / EvpnUtils.java
index 9b1127f12ee304fc132c2dcea64e845b77585897..1e433d1e4383a5aa4ab9a936e56fc0a8bcd6b326 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.netvirt.elan.evpn.utils;
 
-import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
+import static org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION;
 
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.MoreExecutors;
@@ -25,8 +25,6 @@ import java.util.function.Predicate;
 import javax.inject.Inject;
 import javax.inject.Singleton;
 import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
-import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
 import org.opendaylight.genius.interfacemanager.globals.InterfaceInfo;
 import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
 import org.opendaylight.genius.itm.globals.ITMConstants;
@@ -44,7 +42,8 @@ import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
 import org.opendaylight.infrautils.utils.concurrent.LoggingFutures;
 import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.mdsal.binding.api.ReadTransaction;
-import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner;
+import org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.netvirt.bgpmanager.api.IBgpManager;
 import org.opendaylight.netvirt.elan.cache.ElanInstanceCache;
@@ -351,14 +350,16 @@ public class EvpnUtils {
             LOG.info("No DC gateways configured while programming the l2vni table.");
             return tunnelInterfaceNameList;
         }
-        List<DcGatewayIp> dcGatewayIps = dcGatewayIpListOptional.get().nonnullDcGatewayIp();
+        List<DcGatewayIp> dcGatewayIps
+                = new ArrayList<DcGatewayIp>(dcGatewayIpListOptional.get().nonnullDcGatewayIp().values());
 
         Optional<ExternalTunnelList> externalTunnelListOptional = getExternalTunnelList();
         if (!externalTunnelListOptional.isPresent()) {
             LOG.info("No External Tunnel Configured while programming the l2vni table.");
             return tunnelInterfaceNameList;
         }
-        List<ExternalTunnel> externalTunnels = externalTunnelListOptional.get().nonnullExternalTunnel();
+        List<ExternalTunnel> externalTunnels
+                = new ArrayList<ExternalTunnel>(externalTunnelListOptional.get().nonnullExternalTunnel().values());
 
         dcGatewayIps.forEach(dcIp -> externalTunnels
                 .stream()
@@ -383,7 +384,7 @@ public class EvpnUtils {
                     NwConstants.ELAN_SERVICE_INDEX, NwConstants.COOKIE_ELAN_INGRESS_TABLE, instructions);
             InstanceIdentifier<BoundServices> bindServiceId = ElanUtils.buildServiceId(interfaceName, elanServiceIndex);
             if (!tx.read(bindServiceId).get().isPresent()) {
-                tx.put(bindServiceId, serviceInfo, WriteTransaction.CREATE_MISSING_PARENTS);
+                tx.mergeParentStructurePut(bindServiceId, serviceInfo);
             }
         }), LOG, "Error binding an ELAN service to an external tunnel");
     }