Elan Junits fixes 41/71541/2
authorEdw7n <n.edwin.anthony@ericsson.com>
Sat, 28 Apr 2018 14:24:42 +0000 (19:54 +0530)
committerSam Hague <shague@redhat.com>
Sat, 28 Apr 2018 19:51:19 +0000 (19:51 +0000)
follow up to:https://git.opendaylight.org/gerrit/#/c/68187/

Change-Id: Ia20fa0493bfacd1d7ef231d17a28e9ff9017ebbd
Signed-off-by:Edw7n <n.edwin.anthony@ericsson.com>

elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/utils/ElanL2GatewayMulticastUtils.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/utils/ElanItmUtils.java

index 244d423d9f9be8a03570b1dcadb4ec0cf5e2d9bd..62cc8e7b438eacde479d61f0e61cfe7555b0800a 100644 (file)
@@ -345,7 +345,7 @@ public class ElanL2GatewayMulticastUtils {
                 continue;
             }
             List<Action> listActionInfo = elanItmUtils.buildTunnelItmEgressActions(interfaceName,
-                    ElanUtils.getVxlanSegmentationId(elanInfo));
+                    ElanUtils.getVxlanSegmentationId(elanInfo), true);
             listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId,
                     MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
             bucketId++;
@@ -382,7 +382,7 @@ public class ElanL2GatewayMulticastUtils {
                 continue;
             }
             List<Action> listActionInfo = elanItmUtils.buildTunnelItmEgressActions(interfaceName,
-                    elanUtils.getVxlanSegmentationId(elanInfo));
+                    elanUtils.getVxlanSegmentationId(elanInfo), false);
             listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId,
                     MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
             bucketId++;
index 791f3209a07c2f8da8075de9a918c3d1e5fb8bbb..eb22c38c43fd8161e6df9ec8b5b496f287fd9e4c 100644 (file)
@@ -89,7 +89,7 @@ public class ElanItmUtils {
                 String tunnelIfaceName = tunnelInterfaceNameOutput.getInterfaceName();
                 LOG.debug("Received tunnelInterfaceName from getTunnelInterfaceName RPC {}", tunnelIfaceName);
 
-                result = buildTunnelItmEgressActions(tunnelIfaceName, vni);
+                result = buildTunnelItmEgressActions(tunnelIfaceName, vni, false);
             }
 
         } catch (InterruptedException | ExecutionException e) {
@@ -113,7 +113,7 @@ public class ElanItmUtils {
                 String tunnelIfaceName = tunnelInterfaceNameOutput.getInterfaceName();
                 LOG.debug("Received tunnelInterfaceName from getTunnelInterfaceName RPC {}", tunnelIfaceName);
 
-                result = buildTunnelItmEgressActions(tunnelIfaceName, vni);
+                result = buildTunnelItmEgressActions(tunnelIfaceName, vni, false);
             }
 
         } catch (InterruptedException | ExecutionException e) {
@@ -151,7 +151,7 @@ public class ElanItmUtils {
                 GetTunnelInterfaceNameOutput tunnelInterfaceNameOutput = output.get().getResult();
                 String tunnelIfaceName = tunnelInterfaceNameOutput.getInterfaceName();
                 LOG.info("Received tunnelInterfaceName from getTunnelInterfaceName RPC {}", tunnelIfaceName);
-                result = buildTunnelItmEgressActions(tunnelIfaceName, tunnelKey);
+                result = buildTunnelItmEgressActions(tunnelIfaceName, tunnelKey, true);
             } else {
                 LOG.trace("Tunnel interface doesn't exist between srcDpId {} dstDpId {}", sourceDpnId,
                         destinationDpnId);
@@ -172,11 +172,10 @@ public class ElanItmUtils {
      *            the tunnel key
      * @return the list
      */
-    public List<Action> buildTunnelItmEgressActions(String tunnelIfaceName, Long tunnelKey) {
+    public List<Action> buildTunnelItmEgressActions(String tunnelIfaceName, Long tunnelKey, boolean ineternal) {
         if (tunnelIfaceName != null && !tunnelIfaceName.isEmpty()) {
-            return buildItmEgressActions(tunnelIfaceName, tunnelKey);
+            return buildItmEgressActions(tunnelIfaceName, tunnelKey, ineternal);
         }
-
         return Collections.emptyList();
     }
 
@@ -189,7 +188,7 @@ public class ElanItmUtils {
      * @return the external port itm egress actions
      */
     public List<Action> getExternalPortItmEgressAction(String interfaceName) {
-        return buildItmEgressActions(interfaceName, null);
+        return buildItmEgressActions(interfaceName, null, false);
     }
 
     /**
@@ -204,23 +203,24 @@ public class ElanItmUtils {
      * @return the list
      */
     @SuppressWarnings("checkstyle:IllegalCatch")
-    public List<Action> buildItmEgressActions(String interfaceName, Long tunnelKey) {
+    public List<Action> buildItmEgressActions(String interfaceName, Long tunnelKey, boolean internal) {
         try {
-            GetEgressActionsForInterfaceInput getEgressActInput = new GetEgressActionsForInterfaceInputBuilder()
-                    .setIntfName(interfaceName).setTunnelKey(tunnelKey).build();
-
-            Future<RpcResult<GetEgressActionsForInterfaceOutput>> egressActionsOutputFuture = interfaceManagerRpcService
-                    .getEgressActionsForInterface(getEgressActInput);
-
-            GetEgressActionsForTunnelInput getEgressActInputItm = new GetEgressActionsForTunnelInputBuilder()
-                    .setIntfName(interfaceName).setTunnelKey(tunnelKey).build();
-
-            Future<RpcResult<GetEgressActionsForTunnelOutput>> egressActionsOutputItm =
-                    itmRpcService.getEgressActionsForTunnel(getEgressActInputItm);
-            if (egressActionsOutputFuture.get().isSuccessful() && !interfaceManager.isItmDirectTunnelsEnabled()) {
-                return egressActionsOutputFuture.get().getResult().getAction();
-            } else if (egressActionsOutputItm.get().isSuccessful() && interfaceManager.isItmDirectTunnelsEnabled()) {
-                return egressActionsOutputItm.get().getResult().getAction();
+            if (internal && interfaceManager.isItmDirectTunnelsEnabled()) {
+                GetEgressActionsForTunnelInput getEgressActInputItm = new GetEgressActionsForTunnelInputBuilder()
+                        .setIntfName(interfaceName).setTunnelKey(tunnelKey).build();
+                Future<RpcResult<GetEgressActionsForTunnelOutput>> egressActionsOutputItm =
+                        itmRpcService.getEgressActionsForTunnel(getEgressActInputItm);
+                if (egressActionsOutputItm.get().isSuccessful()) {
+                    return egressActionsOutputItm.get().getResult().getAction();
+                }
+            } else {
+                GetEgressActionsForInterfaceInput getEgressActInput = new GetEgressActionsForInterfaceInputBuilder()
+                        .setIntfName(interfaceName).setTunnelKey(tunnelKey).build();
+                Future<RpcResult<GetEgressActionsForInterfaceOutput>> egressActionsOutputFuture =
+                        interfaceManagerRpcService.getEgressActionsForInterface(getEgressActInput);
+                if (egressActionsOutputFuture.get().isSuccessful()) {
+                    return egressActionsOutputFuture.get().getResult().getAction();
+                }
             }
         } catch (Exception e) {
             LOG.error("Error in RPC call getEgressActionsForInterface {}", e);