Bug 8014 l2gw connection broken 99/56599/2
authorRiyazahmed D Talikoti <riyazahmed.d.talikoti@ericsson.com>
Fri, 5 May 2017 12:50:08 +0000 (18:20 +0530)
committerVivekanandan Narasimhan <n.vivekanandan@ericsson.com>
Tue, 9 May 2017 06:20:05 +0000 (06:20 +0000)
listener registration is broken in previous async datachange listener
refactoring change.

Adding the remote ucast macs immediately instead of waiting for mcast
to appear in operational datastore.

creating logical switch in config datastore , irrespective of if it is
found in operational datastore or not.

Change-Id: I7916ec4d457e189d28bf48eb3c11836dd6c311f6
Signed-off-by: Riyazahmed D Talikoti <riyazahmed.d.talikoti@ericsson.com>
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/jobs/AssociateHwvtepToElanJob.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/jobs/LogicalSwitchAddedJob.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/listeners/L2GatewayConnectionListener.java
vpnservice/elanmanager/elanmanager-impl/src/main/resources/org/opendaylight/blueprint/elanmanager.xml

index 525f83cebae60e76ab1f95539367499930e174b6..d9392720778e2611718535c9c872ba7df123c2cf 100644 (file)
@@ -80,6 +80,7 @@ public class AssociateHwvtepToElanJob implements Callable<List<ListenableFuture<
             ListenableFuture<Void> lsCreateFuture = createLogicalSwitch(l2GatewayDevice, elanInstance);
             futures.add(lsCreateFuture);
         } else {
+            createLogicalSwitch(l2GatewayDevice, elanInstance);
             String logicalSwitchName = ElanL2GatewayUtils.getLogicalSwitchFromElan(elanInstanceName);
             LOG.info("{} is already created in {}; adding remaining configurations", logicalSwitchName, hwvtepNodeId);
 
index 2f895858b6c56cdc536a5cbe2be21377801813ff..a3189c2749b60d01e720cd512167a977653ce60f 100644 (file)
@@ -12,12 +12,10 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.Callable;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.netvirt.elan.l2gw.listeners.HwvtepRemoteMcastMacListener;
 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils;
 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
 import org.opendaylight.netvirt.elan.utils.ElanUtils;
 import org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.attributes.Devices;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
 import org.slf4j.Logger;
@@ -77,19 +75,8 @@ public class LogicalSwitchAddedJob implements Callable<List<ListenableFuture<Voi
             new NodeId(elanL2GwDevice.getHwvtepNodeId()), logicalSwitchName, physicalDevice, defaultVlanId));
         LOG.info("creating mast mac entries for {} {}", logicalSwitchName, elanL2GwDevice.getHwvtepNodeId());
         futures.add(elanL2GatewayMulticastUtils.handleMcastForElanL2GwDeviceAdd(logicalSwitchName, elanL2GwDevice));
-
-        List<IpAddress> expectedPhyLocatorIps = new ArrayList<>();
-        HwvtepRemoteMcastMacListener list = new HwvtepRemoteMcastMacListener(broker,
-                elanUtils, logicalSwitchName, elanL2GwDevice, expectedPhyLocatorIps,
-            () -> {
-                LOG.info("adding remote ucast macs for {} {}", logicalSwitchName,
-                    elanL2GwDevice.getHwvtepNodeId());
-                List<ListenableFuture<Void>> futures1 = new ArrayList<>();
-                futures1.add(elanL2GatewayUtils.installElanMacsInL2GatewayDevice(
-                    logicalSwitchName, elanL2GwDevice));
-                return futures1;
-            });
-
+        futures.add(elanL2GatewayUtils.installElanMacsInL2GatewayDevice(
+                logicalSwitchName, elanL2GwDevice));
         return futures;
     }
 
index 3cc2a76535ce9952e689e86361d0b41a2eb0e182..78e856d0d23e06e05b88c88d96f9450970806733 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.netvirt.elan.l2gw.listeners;
 
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.genius.datastoreutils.AsyncClusteredDataTreeChangeListenerBase;
 import org.opendaylight.netvirt.elan.l2gw.utils.L2GatewayConnectionUtils;
 import org.opendaylight.netvirt.elan.utils.ElanUtils;
@@ -26,10 +27,15 @@ public class L2GatewayConnectionListener extends AsyncClusteredDataTreeChangeLis
     private final L2GatewayConnectionUtils l2GatewayConnectionUtils;
 
     public L2GatewayConnectionListener(final DataBroker db, ElanUtils elanUtils) {
+        super(L2gatewayConnection.class, L2GatewayConnectionListener.class);
         this.broker = db;
         this.l2GatewayConnectionUtils = elanUtils.getL2GatewayConnectionUtils();
     }
 
+    public void init() {
+        registerListener(LogicalDatastoreType.CONFIGURATION, broker);
+    }
+
     @Override
     protected void add(final InstanceIdentifier<L2gatewayConnection> identifier, final L2gatewayConnection input) {
         LOG.trace("Adding L2gatewayConnection: {}", input);
index 7828e20423881826f7c1e6dfef2c9f16acb29f78..4d05f139186639569049bcca66e04dc914ab253c 100644 (file)
 
   <bean id="l2GatewayConnectionListener"
     class="org.opendaylight.netvirt.elan.l2gw.listeners.L2GatewayConnectionListener"
-    destroy-method="close">
+    init-method="init" destroy-method="close">
     <argument ref="dataBroker" />
     <argument ref="elanUtils" />
   </bean>