Adding BC group update job.
[netvirt.git] / elanmanager / impl / src / main / java / org / opendaylight / netvirt / elan / l2gw / listeners / HwvtepLogicalSwitchListener.java
index 75b2c8e6e7d6cbb4be8ba184309655958a70f029..62e8796cdb420fd49fd80a4c16249a0e434da1e1 100644 (file)
@@ -8,8 +8,9 @@
 package org.opendaylight.netvirt.elan.l2gw.listeners;
 
 import org.opendaylight.genius.datastoreutils.hwvtep.HwvtepClusteredDataTreeChangeListener;
+import org.opendaylight.genius.utils.hwvtep.HwvtepNodeHACache;
 import org.opendaylight.genius.utils.hwvtep.HwvtepSouthboundUtils;
-import org.opendaylight.netvirt.elan.internal.ElanInstanceManager;
+import org.opendaylight.netvirt.elan.cache.ElanInstanceCache;
 import org.opendaylight.netvirt.elan.l2gw.jobs.LogicalSwitchAddedJob;
 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils;
 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
@@ -55,7 +56,7 @@ public class HwvtepLogicalSwitchListener extends
     // Id of L2 Gateway connection responsible for this logical switch creation
     private final Uuid l2GwConnId;
 
-    private final ElanInstanceManager elanInstanceManager;
+    private final ElanInstanceCache elanInstanceCache;
     private final ElanL2GatewayUtils elanL2GatewayUtils;
     private final ElanClusterUtils elanClusterUtils;
     private final ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils;
@@ -64,12 +65,13 @@ public class HwvtepLogicalSwitchListener extends
     /**
      * Instantiates a new hardware vtep logical switch listener.
      */
-    public HwvtepLogicalSwitchListener(ElanInstanceManager elanInstanceManager, ElanL2GatewayUtils elanL2GatewayUtils,
+    public HwvtepLogicalSwitchListener(ElanInstanceCache elanInstanceCache, ElanL2GatewayUtils elanL2GatewayUtils,
             ElanClusterUtils elanClusterUtils, ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils,
             L2GatewayConnectionUtils l2GatewayConnectionUtils, L2GatewayDevice l2GatewayDevice,
-            String logicalSwitchName, Devices physicalDevice, Integer defaultVlanId, Uuid l2GwConnId) {
-        super(LogicalSwitches.class, HwvtepLogicalSwitchListener.class);
-        this.elanInstanceManager = elanInstanceManager;
+            String logicalSwitchName, Devices physicalDevice, Integer defaultVlanId, Uuid l2GwConnId,
+            HwvtepNodeHACache hwvtepNodeHACache) {
+        super(LogicalSwitches.class, HwvtepLogicalSwitchListener.class, hwvtepNodeHACache);
+        this.elanInstanceCache = elanInstanceCache;
         this.elanL2GatewayUtils = elanL2GatewayUtils;
         this.elanClusterUtils = elanClusterUtils;
         this.elanL2GatewayMulticastUtils = elanL2GatewayMulticastUtils;
@@ -141,7 +143,7 @@ public class HwvtepLogicalSwitchListener extends
 
             LogicalSwitchAddedJob logicalSwitchAddedWorker = new LogicalSwitchAddedJob(
                     elanL2GatewayUtils, elanL2GatewayMulticastUtils, logicalSwitchName, physicalDevice, elanDevice,
-                    defaultVlanId, () -> elanInstanceManager.getElanInstanceByName(logicalSwitchName));
+                    defaultVlanId);
             elanClusterUtils.runOnlyInOwnerNode(logicalSwitchAddedWorker.getJobKey(),
                     "create vlan mappings and mcast configurations", logicalSwitchAddedWorker);
         } catch (RuntimeException e) {