MRI version bumpup for Aluminium
[netvirt.git] / elanmanager / impl / src / main / java / org / opendaylight / netvirt / elan / utils / ElanItmUtils.java
index db9fd89eca802d2acb709211bfda67377a57f20f..0334efcf7ee0a4abad9c72a8ab7c11ab3cac41f1 100644 (file)
@@ -7,15 +7,16 @@
  */
 package org.opendaylight.netvirt.elan.utils;
 
-import java.math.BigInteger;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import javax.inject.Inject;
 import javax.inject.Singleton;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
+import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
 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.interfaces.rev140508.interfaces.Interface;
@@ -40,6 +41,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.G
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.Uint64;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -75,7 +77,7 @@ public class ElanItmUtils {
      *            Vni to be stamped on the VxLAN Header.
      * @return the external itm egress action
      */
-    public List<Action> getExternalTunnelItmEgressAction(BigInteger srcDpnId, NodeId torNode, long vni) {
+    public List<Action> getExternalTunnelItmEgressAction(Uint64 srcDpnId, NodeId torNode, long vni) {
         List<Action> result = Collections.emptyList();
 
         GetExternalTunnelInterfaceNameInput input = new GetExternalTunnelInterfaceNameInputBuilder()
@@ -93,13 +95,13 @@ public class ElanItmUtils {
             }
 
         } catch (InterruptedException | ExecutionException e) {
-            LOG.error("Error in RPC call getTunnelInterfaceName {}", e);
+            LOG.error("Error in RPC call getTunnelInterfaceName", e);
         }
 
         return result;
     }
 
-    public List<Action> getExternalTunnelItmEgressAction(BigInteger srcDpnId, String nexthopIP, long vni) {
+    public List<Action> getExternalTunnelItmEgressAction(Uint64 srcDpnId, String nexthopIP, long vni) {
         List<Action> result = Collections.emptyList();
 
         GetExternalTunnelInterfaceNameInput input = new GetExternalTunnelInterfaceNameInputBuilder()
@@ -117,7 +119,7 @@ public class ElanItmUtils {
             }
 
         } catch (InterruptedException | ExecutionException e) {
-            LOG.error("Error in RPC call getTunnelInterfaceName {}", e);
+            LOG.error("Error in RPC call getTunnelInterfaceName", e);
         }
 
         return result;
@@ -137,7 +139,7 @@ public class ElanItmUtils {
      *            Tunnel key to be sent on the VxLAN header.
      * @return the internal itm egress action
      */
-    public List<Action> getInternalTunnelItmEgressAction(BigInteger sourceDpnId, BigInteger destinationDpnId, long
+    public List<Action> getInternalTunnelItmEgressAction(Uint64 sourceDpnId, Uint64 destinationDpnId, long
             tunnelKey) {
         List<Action> result = Collections.emptyList();
         LOG.trace("In getInternalItmEgressAction Action source {}, destination {}, serviceTag/Vni {}", sourceDpnId,
@@ -157,7 +159,7 @@ public class ElanItmUtils {
                         destinationDpnId);
             }
         } catch (InterruptedException | ExecutionException e) {
-            LOG.error("Error in RPC call getTunnelInterfaceName {}", e);
+            LOG.error("Error in RPC call getTunnelInterfaceName", e);
         }
         return result;
     }
@@ -203,7 +205,7 @@ public class ElanItmUtils {
      * @return the list
      */
     @SuppressWarnings("checkstyle:IllegalCatch")
-    public List<Action> buildItmEgressActions(String interfaceName, Long tunnelKey, boolean internal) {
+    public List<Action> buildItmEgressActions(String interfaceName, @Nullable Long tunnelKey, boolean internal) {
         try {
             if (internal && interfaceManager.isItmDirectTunnelsEnabled()) {
                 GetEgressActionsForTunnelInput getEgressActInputItm = new GetEgressActionsForTunnelInputBuilder()
@@ -211,7 +213,7 @@ public class ElanItmUtils {
                 Future<RpcResult<GetEgressActionsForTunnelOutput>> egressActionsOutputItm =
                         itmRpcService.getEgressActionsForTunnel(getEgressActInputItm);
                 if (egressActionsOutputItm.get().isSuccessful()) {
-                    return egressActionsOutputItm.get().getResult().getAction();
+                    return new ArrayList<Action>(egressActionsOutputItm.get().getResult().getAction().values());
                 }
             } else {
                 GetEgressActionsForInterfaceInput getEgressActInput = new GetEgressActionsForInterfaceInputBuilder()
@@ -219,11 +221,11 @@ public class ElanItmUtils {
                 Future<RpcResult<GetEgressActionsForInterfaceOutput>> egressActionsOutputFuture =
                         interfaceManagerRpcService.getEgressActionsForInterface(getEgressActInput);
                 if (egressActionsOutputFuture.get().isSuccessful()) {
-                    return egressActionsOutputFuture.get().getResult().getAction();
+                    return new ArrayList<Action>(egressActionsOutputFuture.get().getResult().getAction().values());
                 }
             }
         } catch (Exception e) {
-            LOG.error("Error in RPC call getEgressActionsForInterface {}", e);
+            LOG.error("Error in RPC call getEgressActionsForInterface", e);
         }
         LOG.warn("Could not build Egress actions for interface {} and tunnelId {}", interfaceName, tunnelKey);
         return Collections.emptyList();
@@ -238,10 +240,10 @@ public class ElanItmUtils {
      *            the dst hw vtep node id
      * @return the dpn tep ip
      */
-    public IpAddress getSourceDpnTepIp(BigInteger srcDpnId,
+    public IpAddress getSourceDpnTepIp(Uint64 srcDpnId,
             org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId dstHwVtepNodeId) {
         IpAddress dpnTepIp = null;
-        String tunnelInterfaceName = getExternalTunnelInterfaceName(String.valueOf(srcDpnId),
+        String tunnelInterfaceName = getExternalTunnelInterfaceName(srcDpnId.toString(),
                 dstHwVtepNodeId.getValue());
         if (tunnelInterfaceName != null) {
             Interface tunnelInterface =