Handle nullable lists
[genius.git] / itm / itm-impl / src / main / java / org / opendaylight / genius / itm / itmdirecttunnels / renderer / ovs / utilities / DirectTunnelUtils.java
index ee5bb17685ef7b0c85623bf1605602fe63ff02d4..f74ed8a570d8e699b7ba2ac531ecb4741aed23fb 100644 (file)
@@ -39,6 +39,7 @@ import org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
 import org.opendaylight.genius.mdsalutil.matches.MatchInPort;
+import org.opendaylight.infrautils.utils.concurrent.KeyedLocks;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
@@ -150,6 +151,8 @@ public final class DirectTunnelUtils {
     private static final TopologyId OVSDB_TOPOLOGY_ID = new TopologyId(new Uri("ovsdb:1"));
 
     private static final long INVALID_ID = 0;
+    private final KeyedLocks<String> tunnelLocks = new KeyedLocks<>();
+
     // To keep the mapping between Tunnel Types and Tunnel Interfaces
 
     public static final ImmutableMap<Class<? extends TunnelTypeBase>,
@@ -173,6 +176,10 @@ public final class DirectTunnelUtils {
         this.mdsalApiManager = mdsalApiManager;
     }
 
+    public KeyedLocks<String> getTunnelLocks() {
+        return tunnelLocks;
+    }
+
     public BigInteger getDpnId(DatapathId datapathId) {
         if (datapathId != null) {
             String dpIdStr = datapathId.getValue().replace(":", "");
@@ -394,7 +401,7 @@ public final class DirectTunnelUtils {
         options.put(DirectTunnelUtils.TUNNEL_OPTIONS_TOS, DirectTunnelUtils.TUNNEL_OPTIONS_TOS_VALUE_INHERIT);
 
         // Specific options for each type of tunnel
-        if (ifTunnel.getTunnelInterfaceType().equals(TunnelTypeVxlanGpe.class)) {
+        if (TunnelTypeVxlanGpe.class.equals(ifTunnel.getTunnelInterfaceType())) {
             options.put(DirectTunnelUtils.TUNNEL_OPTIONS_EXTS, DirectTunnelUtils.TUNNEL_OPTIONS_VALUE_GPE);
             options.put(DirectTunnelUtils.TUNNEL_OPTIONS_NSI, DirectTunnelUtils.TUNNEL_OPTIONS_VALUE_FLOW);
             options.put(DirectTunnelUtils.TUNNEL_OPTIONS_NSP, DirectTunnelUtils.TUNNEL_OPTIONS_VALUE_FLOW);