Bug 7878: provider interface MACs are installed on remote DPNs 23/53023/2
authorKoby Aizer <koby.aizer@hpe.com>
Wed, 1 Mar 2017 10:02:16 +0000 (12:02 +0200)
committerAlon Kochba <alonko@hpe.com>
Mon, 13 Mar 2017 15:27:01 +0000 (15:27 +0000)
MACs learnt on provider interfaces must not be installed on remote
DPNs.

This change includes 2 fixes:

1. handleInternalTunnelState event initiated installation on remote
DMAC flows for all elans in the remote DPN, without verifying that
this elan is not Flat/Vlan.

2. Protection on setupRemoteDmacFlow to make sure no other code flows
will install remote DMAC flows on MACs learnt on provider interfaces.

Change-Id: I5ae288ed525dc1ae2f5be1bec5215f2e8f01f8c5
Signed-off-by: Koby Aizer <koby.aizer@hpe.com>
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/internal/ElanInterfaceManager.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/utils/ElanUtils.java

index fe19ccdc327c3e6833d625278c1f72f5d7b9832d..b04703c54f4ce9efabb079a4117a9f142f64e753 100644 (file)
@@ -1513,6 +1513,16 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
         for (ElanDpnInterfacesList elanDpns : elanDpnIf) {
             int cnt = 0;
             String elanName = elanDpns.getElanInstanceName();
+            ElanInstance elanInfo = ElanUtils.getElanInstanceByName(broker, elanName);
+            if (elanInfo == null) {
+                LOG.warn("ELAN Info is null for elanName {} that does exist in elanDpnInterfaceList, "
+                        + "skipping this ELAN for tunnel handling", elanName);
+                continue;
+            }
+            if (ElanUtils.isFlat(elanInfo) || ElanUtils.isVlan(elanInfo)) {
+                LOG.debug("Ignoring internal tunnel state event for Flat/Vlan elan {}", elanName);
+                continue;
+            }
             List<DpnInterfaces> dpnInterfaces = elanDpns.getDpnInterfaces();
             if (dpnInterfaces == null) {
                 continue;
@@ -1524,7 +1534,6 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
             }
             if (cnt == 2) {
                 LOG.debug("Elan instance:{} is present b/w srcDpn:{} and dstDpn:{}", elanName, srcDpId, dstDpId);
-                ElanInstance elanInfo = ElanUtils.getElanInstanceByName(broker, elanName);
                 DataStoreJobCoordinator dataStoreCoordinator = DataStoreJobCoordinator.getInstance();
                 dataStoreCoordinator.enqueueJob(elanName, () -> {
                     // update Remote BC Group
index e42bbc0b0b512d60dcf31dc11d945022f4ca9582..aae2606edda2e13dfe49b82d0d544700c863289c 100755 (executable)
@@ -1083,6 +1083,12 @@ public class ElanUtils {
     public void setupRemoteDmacFlow(BigInteger srcDpId, BigInteger destDpId, int lportTag, long elanTag,
             String macAddress, String displayName, WriteTransaction writeFlowGroupTx, String interfaceName,
             ElanInstance elanInstance) throws ElanException {
+        if (interfaceManager.isExternalInterface(interfaceName)) {
+            LOG.debug("Ignoring install remote DMAC {} flow on provider interface {} elan {}",
+                    macAddress, interfaceName, elanInstance.getElanInstanceName());
+            return;
+        }
+
         Flow flowEntity = buildRemoteDmacFlowEntry(srcDpId, destDpId, lportTag, elanTag, macAddress, displayName,
                 elanInstance);
         mdsalManager.addFlowToTx(srcDpId, flowEntity, writeFlowGroupTx);