cleanup elanmanager blueprint 60/43760/3
authorSam Hague <shague@redhat.com>
Thu, 11 Aug 2016 18:22:49 +0000 (14:22 -0400)
committerSam Hague <shague@redhat.com>
Fri, 12 Aug 2016 11:34:41 +0000 (11:34 +0000)
Change-Id: I40049c85a8ec8740983a0382d7240cbc79edab71
Signed-off-by: Sam Hague <shague@redhat.com>
Signed-off-by: Stephen Kitt <skitt@redhat.com>
18 files changed:
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/cli/etree/EtreeInterfaceDelete.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/cli/etree/EtreeInterfaceGet.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/internal/ElanDpnInterfaceClusteredListener.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/internal/ElanInstanceManager.java
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/internal/ElanPacketInHandler.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/internal/ElanServiceProvider.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/listeners/HwvtepLocalUcastMacListener.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/listeners/HwvtepPhysicalSwitchListener.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/listeners/HwvtepTerminationPointListener.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/listeners/L2GatewayConnectionListener.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/utils/ElanL2GatewayMulticastUtils.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/utils/L2GatewayConnectionUtils.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/utils/ElanForwardingEntriesHandler.java
vpnservice/elanmanager/elanmanager-impl/src/main/java/org/opendaylight/netvirt/elan/utils/ElanUtils.java
vpnservice/elanmanager/elanmanager-impl/src/main/resources/org/opendaylight/blueprint/commands.xml
vpnservice/elanmanager/elanmanager-impl/src/main/resources/org/opendaylight/blueprint/elanmanager.xml
vpnservice/statemanager/impl/src/main/java/org/opendaylight/netvirt/statemanager/StateManager.java

index a674e735ed1cc3e4288f2f07f4c90f1f5cd0cab8..67493fa1e99534c6bcd09ee55c02141af38ebf8e 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.netvirt.elan.cli.etree;
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.netvirt.elan.internal.ElanServiceProvider;
 import org.opendaylight.netvirt.elan.utils.ElanUtils;
 import org.opendaylight.netvirt.elanmanager.api.IElanService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface;
@@ -26,21 +27,22 @@ public class EtreeInterfaceDelete extends OsgiCommandSupport {
     private String interfaceName;
     private static final Logger logger = LoggerFactory.getLogger(EtreeInterfaceDelete.class);
     private IElanService elanProvider;
-    private ElanUtils elanUtils;
+    //private ElanUtils elanUtils;
 
     public void setElanProvider(IElanService elanServiceProvider) {
         this.elanProvider = elanServiceProvider;
     }
 
-    public void setElanUtils(ElanUtils elanUtils) {
+    /*public void setElanUtils(ElanUtils elanUtils) {
         this.elanUtils = elanUtils;
-    }
+    }*/
 
     @Override
     protected Object doExecute() {
         try {
             logger.debug("Deleting EtreeInterface command" + "\t" + etreeName + "\t" + interfaceName + "\t");
-            ElanInterface existingInterface = elanUtils.getElanInterfaceByElanInterfaceName(interfaceName);
+            ElanInterface existingInterface =
+                    ElanServiceProvider.getElanutils().getElanInterfaceByElanInterfaceName(interfaceName);
             if (existingInterface == null || existingInterface.getAugmentation(EtreeInterface.class) == null) {
                 System.out.println("Etree interface doesn't exist or isn't configured as etree: " + interfaceName);
             }
index 934b34f5efbaaf6e5394010d26d231049c31d570..dd6e49dc846032259c2811f7d7307b9d32f5154a 100644 (file)
@@ -13,6 +13,7 @@ import org.apache.karaf.shell.commands.Command;
 import org.apache.karaf.shell.console.OsgiCommandSupport;
 import org.opendaylight.genius.interfacemanager.globals.InterfaceInfo;
 import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
+import org.opendaylight.netvirt.elan.internal.ElanServiceProvider;
 import org.opendaylight.netvirt.elan.utils.ElanCLIUtils;
 import org.opendaylight.netvirt.elan.utils.ElanUtils;
 import org.opendaylight.netvirt.elanmanager.api.IElanService;
@@ -32,7 +33,7 @@ public class EtreeInterfaceGet extends OsgiCommandSupport {
     private IInterfaceManager interfaceManager;
     public static int MAX_LENGTH = 31;
     private IElanService elanProvider;
-    private ElanUtils elanUtils;
+    //private ElanUtils elanUtils;
     public static boolean isDisplay = true;
 
     public void setElanProvider(IElanService elanServiceProvider) {
@@ -43,9 +44,9 @@ public class EtreeInterfaceGet extends OsgiCommandSupport {
         this.interfaceManager = interfaceManager;
     }
 
-    public void setElanUtils(ElanUtils elanUtils) {
+    /*public void setElanUtils(ElanUtils elanUtils) {
         this.elanUtils = elanUtils;
-    }
+    }*/
 
     @Override
     protected Object doExecute() {
@@ -99,7 +100,8 @@ public class EtreeInterfaceGet extends OsgiCommandSupport {
         if (!interfaceList.isEmpty()) {
             for (String elanInterface : interfaceList) {
                 InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(elanInterface);
-                EtreeInterface etreeInterface = elanUtils.getEtreeInterfaceByElanInterfaceName(elanInterface);
+                EtreeInterface etreeInterface =
+                        ElanServiceProvider.getElanutils().getEtreeInterfaceByElanInterfaceName(elanInterface);
                 if (interfaceInfo != null) {
                     System.out.println(String.format(ElanCLIUtils.ETREE_INTERFACE_CLI_FORMAT,
                             elanInstance.getElanInstanceName() + "/" + elanInstance.getElanTag(),
index d1a1d301f28595924a15f36486f978d684f1a422..26e46c319ab7c7ef01efce05a593e1e70db1f059 100644 (file)
@@ -18,6 +18,7 @@ import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils;
 import org.opendaylight.netvirt.elan.utils.ElanClusterUtils;
 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
+import org.opendaylight.netvirt.elan.utils.ElanUtils;
 import org.opendaylight.netvirt.elanmanager.utils.ElanL2GwCacheUtils;
 import org.opendaylight.genius.datastoreutils.AsyncClusteredDataChangeListenerBase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces;
@@ -43,13 +44,12 @@ public class ElanDpnInterfaceClusteredListener
     private final ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils;
 
     public ElanDpnInterfaceClusteredListener(DataBroker broker, EntityOwnershipService entityOwnershipService,
-                                             ElanL2GatewayUtils elanL2GatewayUtils,
-                                             ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils) {
+                                             ElanUtils elanUtils) {
         super(DpnInterfaces.class, ElanDpnInterfaceClusteredListener.class);
         this.broker = broker;
         this.entityOwnershipService = entityOwnershipService;
-        this.elanL2GatewayUtils = elanL2GatewayUtils;
-        this.elanL2GatewayMulticastUtils = elanL2GatewayMulticastUtils;
+        this.elanL2GatewayUtils = elanUtils.getElanL2GatewayUtils();
+        this.elanL2GatewayMulticastUtils = elanUtils.getElanL2GatewayMulticastUtils();
     }
 
     public void init() {
index 49e16ff2e972ee1e6f8b7feea0ed2434e71f6ac2..dd9e0e36a1bf4ebc00761114caba7e049e1ed408 100644 (file)
@@ -44,18 +44,21 @@ public class ElanInstanceManager extends AsyncDataTreeChangeListenerBase<ElanIns
 
     private final DataBroker broker;
     private final IdManagerService idManager;
-    private final ElanInterfaceManager elanInterfaceManager;
     private final IInterfaceManager interfaceManager;
-    private final ElanUtils elanUtils;
+    private final ElanInterfaceManager elanInterfaceManager;
+    private ElanUtils elanUtils;
 
     public ElanInstanceManager(final DataBroker dataBroker, final IdManagerService managerService,
                                final ElanInterfaceManager elanInterfaceManager,
-                               final IInterfaceManager interfaceManager, ElanUtils elanUtils) {
+                               final IInterfaceManager interfaceManager) {
         super(ElanInstance.class, ElanInstanceManager.class);
         this.broker = dataBroker;
         this.idManager = managerService;
         this.elanInterfaceManager = elanInterfaceManager;
         this.interfaceManager = interfaceManager;
+    }
+
+    public void setElanUtils(ElanUtils elanUtils) {
         this.elanUtils = elanUtils;
     }
 
index 0b4ed49ed6a015fdf2df7e06421bda3d46a97c90..64d729d1bc941f96bc34184817631d70f76ed916 100644 (file)
@@ -107,8 +107,8 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
     private final IInterfaceManager interfaceManager;
     private final IdManagerService idManager;
     private final ElanForwardingEntriesHandler elanForwardingEntriesHandler;
-    private final ElanL2GatewayUtils elanL2GatewayUtils;
-    private final ElanUtils elanUtils;
+    private ElanL2GatewayUtils elanL2GatewayUtils;
+    private ElanUtils elanUtils;
 
     private static final long waitTimeForSyncInstall = Long.getLong("wait.time.sync.install", 300L);
 
@@ -120,16 +120,19 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
                                 final IdManagerService managerService,
                                 final IMdsalApiManager mdsalApiManager,
                                 IInterfaceManager interfaceManager,
-                                final ElanForwardingEntriesHandler elanForwardingEntriesHandler,
-                                final ElanL2GatewayUtils elanL2GatewayUtils, ElanUtils elanUtils) {
+                                final ElanForwardingEntriesHandler elanForwardingEntriesHandler) {
         super(ElanInterface.class, ElanInterfaceManager.class);
         this.broker = dataBroker;
         this.idManager = managerService;
         this.mdsalManager = mdsalApiManager;
         this.interfaceManager = interfaceManager;
         this.elanForwardingEntriesHandler = elanForwardingEntriesHandler;
-        this.elanL2GatewayUtils = elanL2GatewayUtils;
+    }
+
+    public void setElanUtils(ElanUtils elanUtils) {
         this.elanUtils = elanUtils;
+        this.elanL2GatewayUtils = elanUtils.getElanL2GatewayUtils();
+        this.elanForwardingEntriesHandler.setElanUtils(elanUtils);
     }
 
     public void init() {
index 56211d9c5f7b4901a8e177e330bec01f6cca4abc..8754656d5e04b5c969dc229e42d19769b6465c66 100755 (executable)
@@ -48,12 +48,11 @@ public class ElanPacketInHandler implements PacketProcessingListener {
     private final ElanUtils elanUtils;
     private final ElanL2GatewayUtils elanL2GatewayUtils;
 
-    public ElanPacketInHandler(DataBroker dataBroker, final IInterfaceManager interfaceManager, ElanUtils elanUtils,
-                               ElanL2GatewayUtils elanL2GatewayUtils) {
+    public ElanPacketInHandler(DataBroker dataBroker, final IInterfaceManager interfaceManager, ElanUtils elanUtils) {
         broker = dataBroker;
         this.interfaceManager = interfaceManager;
         this.elanUtils = elanUtils;
-        this.elanL2GatewayUtils = elanL2GatewayUtils;
+        this.elanL2GatewayUtils = elanUtils.getElanL2GatewayUtils();
     }
 
     @Override
index e25de272a1828938fb1afebe1d2a5177e9acb194..fd1f90cff8730c93b0e5b87bde91bd080993e68d 100644 (file)
@@ -20,12 +20,16 @@ import java.util.Set;
 import java.util.concurrent.Future;
 import java.util.function.BiFunction;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.genius.interfacemanager.exceptions.InterfaceAlreadyExistsException;
 import org.opendaylight.genius.interfacemanager.globals.IfmConstants;
 import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils;
+import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
+import org.opendaylight.netvirt.elan.l2gw.utils.L2GatewayConnectionUtils;
 import org.opendaylight.netvirt.elan.statusanddiag.ElanStatusMonitor;
 import org.opendaylight.netvirt.elan.utils.ElanConstants;
 import org.opendaylight.netvirt.elan.utils.ElanForwardingEntriesHandler;
@@ -41,6 +45,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstanceBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface;
@@ -74,20 +79,28 @@ public class ElanServiceProvider implements IElanService {
     private final ElanBridgeManager bridgeMgr;
     private final DataBroker broker;
     private final ElanStatusMonitor elanStatusMonitor;
-    private final ElanUtils elanUtils;
+    private static ElanUtils elanUtils;
 
     private boolean generateIntBridgeMac = true;
 
     public ElanServiceProvider(IdManagerService idManager, IInterfaceManager interfaceManager,
-                               ElanInstanceManager elanInstanceManager, ElanBridgeManager bridgeMgr, DataBroker broker,
+                               ElanInstanceManager elanInstanceManager, ElanBridgeManager bridgeMgr,
+                               DataBroker dataBroker,
+                               ElanInterfaceManager elanInterfaceManager,
                                ElanStatusMonitor elanStatusMonitor, ElanUtils elanUtils) {
         this.idManager = idManager;
         this.interfaceManager = interfaceManager;
         this.elanInstanceManager = elanInstanceManager;
         this.bridgeMgr = bridgeMgr;
-        this.broker = broker;
+        this.broker = dataBroker;
         this.elanStatusMonitor = elanStatusMonitor;
         this.elanUtils = elanUtils;
+        elanInstanceManager.setElanUtils(elanUtils);
+        elanInterfaceManager.setElanUtils(elanUtils);
+    }
+
+    public static ElanUtils getElanutils() {
+        return ElanServiceProvider.elanUtils;
     }
 
     public void init() {
index 996923d907319ff9f2636e97aa95150a56ccd18a..efe2e2320233dece7e33994e43e90044ce3c22b8 100644 (file)
@@ -15,6 +15,7 @@ import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.genius.datastoreutils.AsyncClusteredDataChangeListenerBase;
 import org.opendaylight.genius.utils.hwvtep.HwvtepUtils;
 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
+import org.opendaylight.netvirt.elan.utils.ElanUtils;
 import org.opendaylight.netvirt.elanmanager.utils.ElanL2GwCacheUtils;
 import org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
@@ -43,11 +44,11 @@ public class HwvtepLocalUcastMacListener extends
     private final DataBroker broker;
     private final ElanL2GatewayUtils elanL2GatewayUtils;
 
-    public HwvtepLocalUcastMacListener(DataBroker broker, ElanL2GatewayUtils elanL2GatewayUtils) {
+    public HwvtepLocalUcastMacListener(DataBroker broker, ElanUtils elanUtils) {
         super(LocalUcastMacs.class, HwvtepLocalUcastMacListener.class);
 
         this.broker = broker;
-        this.elanL2GatewayUtils = elanL2GatewayUtils;
+        this.elanL2GatewayUtils = elanUtils.getElanL2GatewayUtils();
     }
 
     public void init() {
index 380fe735b0c60c5e927814d3d6fcb186ce817003..a361717ce5443ae857672c688b7d850a8acdf305 100644 (file)
@@ -24,6 +24,7 @@ import org.opendaylight.genius.utils.hwvtep.HwvtepSouthboundUtils;
 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
 import org.opendaylight.netvirt.elan.l2gw.utils.L2GatewayConnectionUtils;
 import org.opendaylight.netvirt.elan.utils.ElanClusterUtils;
+import org.opendaylight.netvirt.elan.utils.ElanUtils;
 import org.opendaylight.netvirt.elanmanager.utils.ElanL2GwCacheUtils;
 import org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice;
 import org.opendaylight.netvirt.neutronvpn.api.l2gw.utils.L2GatewayCacheUtils;
@@ -73,16 +74,16 @@ public class HwvtepPhysicalSwitchListener
      *            the data broker
      * @param itmRpcService
      * @param entityOwnershipService
-     * @param l2GatewayConnectionUtils
+     * @param elanUtils
      */
     public HwvtepPhysicalSwitchListener(final DataBroker dataBroker, ItmRpcService itmRpcService,
                                         EntityOwnershipService entityOwnershipService,
-                                        L2GatewayConnectionUtils l2GatewayConnectionUtils) {
+                                        ElanUtils elanUtils) {
         super(PhysicalSwitchAugmentation.class, HwvtepPhysicalSwitchListener.class);
         this.dataBroker = dataBroker;
         this.itmRpcService = itmRpcService;
         this.entityOwnershipService = entityOwnershipService;
-        this.l2GatewayConnectionUtils = l2GatewayConnectionUtils;
+        this.l2GatewayConnectionUtils = elanUtils.getL2GatewayConnectionUtils();
     }
 
     public void init() {
index 0c51c36f70c92dd80f7df7629f229212710b44a4..6ecf684024d8d43dd86b3954d2520260cfbbca7f 100644 (file)
@@ -20,6 +20,7 @@ import org.opendaylight.genius.datastoreutils.AsyncClusteredDataChangeListenerBa
 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
 import org.opendaylight.netvirt.elan.l2gw.utils.L2GatewayConnectionUtils;
 import org.opendaylight.netvirt.elan.utils.ElanClusterUtils;
+import org.opendaylight.netvirt.elan.utils.ElanUtils;
 import org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice;
 import org.opendaylight.netvirt.neutronvpn.api.l2gw.utils.L2GatewayCacheUtils;
 import org.opendaylight.genius.utils.hwvtep.HwvtepSouthboundConstants;
@@ -67,12 +68,12 @@ public class HwvtepTerminationPointListener extends
     private final ElanL2GatewayUtils elanL2GatewayUtils;
     private final EntityOwnershipService entityOwnershipService;
 
-    public HwvtepTerminationPointListener(DataBroker broker, ElanL2GatewayUtils elanL2GatewayUtils,
+    public HwvtepTerminationPointListener(DataBroker broker, ElanUtils elanUtils,
                                           EntityOwnershipService entityOwnershipService) {
         super(TerminationPoint.class, HwvtepTerminationPointListener.class);
 
         this.broker = broker;
-        this.elanL2GatewayUtils = elanL2GatewayUtils;
+        this.elanL2GatewayUtils = elanUtils.getElanL2GatewayUtils();
         this.entityOwnershipService = entityOwnershipService;
         registerListener();
         logger.debug("created HwvtepTerminationPointListener");
index f376297cab148fa3990f6a6f4ac330b606d6babf..8b148ba0b8e2057755c6a52d5482ef81e1c6bc00 100644 (file)
@@ -13,8 +13,8 @@ import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataCh
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.binding.api.ClusteredDataChangeListener;
 import org.opendaylight.netvirt.elan.l2gw.utils.L2GatewayConnectionUtils;
-import org.opendaylight.netvirt.elan.internal.ElanInstanceManager;
 import org.opendaylight.genius.datastoreutils.AsyncClusteredDataChangeListenerBase;
+import org.opendaylight.netvirt.elan.utils.ElanUtils;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.connections.attributes.L2gatewayConnections;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.connections.attributes.l2gatewayconnections.L2gatewayConnection;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron;
@@ -29,15 +29,13 @@ public class L2GatewayConnectionListener extends AsyncClusteredDataChangeListene
 
     private ListenerRegistration<DataChangeListener> listenerRegistration;
     private final DataBroker broker;
-    private final ElanInstanceManager elanInstanceManager;
     private final L2GatewayConnectionUtils l2GatewayConnectionUtils;
 
-    public L2GatewayConnectionListener(final DataBroker db, ElanInstanceManager elanInstanceManager,
-                                       L2GatewayConnectionUtils l2GatewayConnectionUtils) {
+    public L2GatewayConnectionListener(final DataBroker db,
+                                       ElanUtils elanUtils) {
         super(L2gatewayConnection.class, L2GatewayConnectionListener.class);
         broker = db;
-        this.elanInstanceManager = elanInstanceManager;
-        this.l2GatewayConnectionUtils = l2GatewayConnectionUtils;
+        this.l2GatewayConnectionUtils = elanUtils.getL2GatewayConnectionUtils();
         registerListener(db);
     }
 
index 0168494936e49732d1bd26dec0b53682c858385c..7ced597e7bd9d266349cf071ed01a39d940011f6 100644 (file)
@@ -7,27 +7,34 @@
  */
 package org.opendaylight.netvirt.elan.l2gw.utils;
 
-import java.math.BigInteger;
+import com.google.common.base.Optional;
+import com.google.common.collect.Lists;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.SettableFuture;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.ConcurrentMap;
-
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.netvirt.elan.internal.ElanInterfaceManager;
-import org.opendaylight.netvirt.elan.utils.ElanUtils;
-import org.opendaylight.netvirt.elan.internal.ElanInstanceManager;
-import org.opendaylight.netvirt.elan.utils.ElanConstants;
 import org.opendaylight.genius.datastoreutils.DataStoreJobCoordinator;
-import org.opendaylight.netvirt.elan.l2gw.jobs.HwvtepDeviceMcastMacUpdateJob;
-import org.opendaylight.netvirt.elanmanager.utils.ElanL2GwCacheUtils;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice;
 import org.opendaylight.genius.utils.hwvtep.HwvtepSouthboundUtils;
 import org.opendaylight.genius.utils.hwvtep.HwvtepUtils;
+import org.opendaylight.netvirt.elan.internal.ElanInstanceManager;
+import org.opendaylight.netvirt.elan.internal.ElanInterfaceManager;
+import org.opendaylight.netvirt.elan.l2gw.jobs.HwvtepDeviceMcastMacUpdateJob;
+import org.opendaylight.netvirt.elan.utils.ElanConstants;
+import org.opendaylight.netvirt.elan.utils.ElanUtils;
+import org.opendaylight.netvirt.elanmanager.utils.ElanL2GwCacheUtils;
+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.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp.rev160428.DesignatedSwitchesForExternalTunnels;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp.rev160428.designated.switches._for.external.tunnels.DesignatedSwitchForTunnel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp.rev160428.designated.switches._for.external.tunnels.DesignatedSwitchForTunnelKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepLogicalSwitchRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepNodeName;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalLocatorAugmentation;
@@ -38,21 +45,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacsKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.locator.set.attributes.LocatorSet;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.locator.set.attributes.LocatorSetBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp.rev160428.DesignatedSwitchesForExternalTunnels;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp.rev160428.designated.switches._for.external.tunnels.DesignatedSwitchForTunnel;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp.rev160428.designated.switches._for.external.tunnels.DesignatedSwitchForTunnelKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Optional;
-import com.google.common.collect.Lists;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.SettableFuture;
-
 /**
  * The utility class to handle ELAN L2 Gateway related to multicast.
  */
@@ -70,17 +67,14 @@ public class ElanL2GatewayMulticastUtils {
     /** The elan interface manager. */
     private final ElanInterfaceManager elanInterfaceManager;
 
-    private final ElanL2GatewayUtils elanL2GatewayUtils;
-
     private final ElanUtils elanUtils;
 
     public ElanL2GatewayMulticastUtils(DataBroker broker, ElanInstanceManager elanInstanceManager,
-                                       ElanInterfaceManager elanInterfaceManager, ElanL2GatewayUtils elanL2GatewayUtils,
+                                       ElanInterfaceManager elanInterfaceManager,
                                        ElanUtils elanUtils) {
         this.broker = broker;
         this.elanInstanceManager = elanInstanceManager;
         this.elanInterfaceManager = elanInterfaceManager;
-        this.elanL2GatewayUtils = elanL2GatewayUtils;
         this.elanUtils = elanUtils;
     }
 
@@ -220,7 +214,7 @@ public class ElanL2GatewayMulticastUtils {
                                                     L2GatewayDevice device, List<IpAddress> dpnsTepIps,
                                                     List<IpAddress> l2GwDevicesTepIps) {
         NodeId nodeId = new NodeId(device.getHwvtepNodeId());
-        String logicalSwitchName = ElanL2GatewayUtils.getLogicalSwitchFromElan(elanName);
+        String logicalSwitchName = "";//ElanL2GatewayUtils.getLogicalSwitchFromElan(elanName);
 
         ArrayList<IpAddress> remoteTepIps = new ArrayList<>(l2GwDevicesTepIps);
         remoteTepIps.remove(device.getTunnelIp());
@@ -293,8 +287,8 @@ public class ElanL2GatewayMulticastUtils {
     private List<IpAddress> getAllTepIpsOfDpns(L2GatewayDevice l2GwDevice, List<DpnInterfaces> dpns) {
         List<IpAddress> tepIps = new ArrayList<>();
         for (DpnInterfaces dpn : dpns) {
-            IpAddress internalTunnelIp = elanL2GatewayUtils.getSourceDpnTepIp(dpn.getDpId(),
-                    new NodeId(l2GwDevice.getHwvtepNodeId()));
+            IpAddress internalTunnelIp = null;//elanL2GatewayUtils.getSourceDpnTepIp(dpn.getDpId(),
+                    //new NodeId(l2GwDevice.getHwvtepNodeId()));
             if (internalTunnelIp != null) {
                 tepIps.add(internalTunnelIp);
             }
@@ -374,8 +368,8 @@ public class ElanL2GatewayMulticastUtils {
         DesignatedSwitchForTunnel desgSwitch = getDesignatedSwitchForExternalTunnel(l2GwDevice.getTunnelIp(),
                 elanInstanceName);
         if (desgSwitch != null) {
-            tepIp = elanL2GatewayUtils.getSourceDpnTepIp(BigInteger.valueOf(desgSwitch.getDpId()),
-                    new NodeId(l2GwDevice.getHwvtepNodeId()));
+            tepIp = null;//elanL2GatewayUtils.getSourceDpnTepIp(BigInteger.valueOf(desgSwitch.getDpId()),
+                    //new NodeId(l2GwDevice.getHwvtepNodeId()));
         }
         return tepIp;
     }
index 28ea7ed088d0cfbc6951362516fac0831978e36a..34c690865806c6fcea1068470876c908f2a6bc38 100644 (file)
@@ -54,15 +54,13 @@ public class L2GatewayConnectionUtils {
     private final ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils;
 
     public L2GatewayConnectionUtils(DataBroker dataBroker, ElanInstanceManager elanInstanceManager,
-                                    ElanL2GatewayUtils elanL2GatewayUtils,
-                                    EntityOwnershipService entityOwnershipService, ElanUtils elanUtils,
-                                    ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils) {
+                                    EntityOwnershipService entityOwnershipService, ElanUtils elanUtils) {
         this.broker = dataBroker;
         this.elanInstanceManager = elanInstanceManager;
-        this.elanL2GatewayUtils = elanL2GatewayUtils;
+        this.elanL2GatewayUtils = elanUtils.getElanL2GatewayUtils();
         this.entityOwnershipService = entityOwnershipService;
         this.elanUtils = elanUtils;
-        this.elanL2GatewayMulticastUtils = elanL2GatewayMulticastUtils;
+        this.elanL2GatewayMulticastUtils = elanUtils.getElanL2GatewayMulticastUtils();
     }
 
     public static boolean isGatewayAssociatedToL2Device(L2GatewayDevice l2GwDevice) {
index 8fb6784de5e5fbe308282e107f70a474b9c17193..286a4d685aa9022898c59d9078ecb04122548c12 100644 (file)
@@ -31,10 +31,13 @@ public class ElanForwardingEntriesHandler {
     private static final Logger logger = LoggerFactory.getLogger(ElanForwardingEntriesHandler.class);
 
     private final DataBroker broker;
-    private final ElanUtils elanUtils;
+    private ElanUtils elanUtils;
 
-    public ElanForwardingEntriesHandler(DataBroker dataBroker, ElanUtils elanUtils){
+    public ElanForwardingEntriesHandler(DataBroker dataBroker){
         this.broker = dataBroker;
+    }
+
+    public void setElanUtils(ElanUtils elanUtils) {
         this.elanUtils = elanUtils;
     }
 
index 52c0f848668613e038d7b528ad884362b7d7130a..aa2e32acab9e77f7cbd9a97e0ada551bf9167f3e 100644 (file)
@@ -26,6 +26,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
@@ -44,6 +45,10 @@ import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
 import org.opendaylight.genius.utils.ServiceIndex;
 import org.opendaylight.netvirt.elan.internal.ElanInstanceManager;
+import org.opendaylight.netvirt.elan.internal.ElanInterfaceManager;
+import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils;
+import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
+import org.opendaylight.netvirt.elan.l2gw.utils.L2GatewayConnectionUtils;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
@@ -161,6 +166,9 @@ public class ElanUtils {
     private final ElanInstanceManager elanInstanceManager;
     private final OdlInterfaceRpcService interfaceManagerRpcService;
     private final ItmRpcService itmRpcService;
+    private ElanL2GatewayUtils elanL2GatewayUtils;
+    private ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils;
+    private L2GatewayConnectionUtils l2GatewayConnectionUtils;
 
     public static final FutureCallback<Void> DEFAULT_CALLBACK = new FutureCallback<Void>() {
         @Override
@@ -175,14 +183,34 @@ public class ElanUtils {
     };
 
     public ElanUtils(DataBroker dataBroker, IMdsalApiManager mdsalManager, ElanInstanceManager elanInstanceManager,
-                     OdlInterfaceRpcService interfaceManagerRpcService, ItmRpcService itmRpcService) {
+                     OdlInterfaceRpcService interfaceManagerRpcService, ItmRpcService itmRpcService,
+                     ElanInterfaceManager elanInterfaceManager,
+                     EntityOwnershipService entityOwnershipService) {
         this.broker = dataBroker;
         this.mdsalManager = mdsalManager;
         this.elanInstanceManager = elanInstanceManager;
         this.interfaceManagerRpcService = interfaceManagerRpcService;
         this.itmRpcService = itmRpcService;
+
+        elanL2GatewayMulticastUtils =
+                new ElanL2GatewayMulticastUtils(broker, elanInstanceManager, elanInterfaceManager, this);
+        elanL2GatewayUtils = new ElanL2GatewayUtils(broker, itmRpcService, this,
+                entityOwnershipService, elanL2GatewayMulticastUtils);
+        l2GatewayConnectionUtils = new L2GatewayConnectionUtils(broker,
+                elanInstanceManager, entityOwnershipService, this);
+    }
+
+    public ElanL2GatewayUtils getElanL2GatewayUtils() {
+        return elanL2GatewayUtils;
     }
 
+    public ElanL2GatewayMulticastUtils getElanL2GatewayMulticastUtils() {
+        return elanL2GatewayMulticastUtils;
+    }
+
+    public L2GatewayConnectionUtils getL2GatewayConnectionUtils() {
+        return l2GatewayConnectionUtils;
+    }
 
     public static void addElanInstanceIntoCache(String elanInstanceName, ElanInstance elanInstance) {
         elanInstanceLocalCache.put(elanInstanceName, elanInstance);
index b43cd9a9a6b2990c17097cecd1164e25b1b9be17..3cd2ecb27dfc76547e854941ad34d1704c28b30d 100644 (file)
@@ -4,8 +4,7 @@
     <reference id="interfaceManagerRef"
         interface="org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager"
         availability="optional" />
-    <reference id="elanUtilsRef" interface="org.opendaylight.netvirt.elan.utils.ElanUtils"
-        availability="optional" />
+    <!--<reference id="elanUtilsRef" interface="org.opendaylight.netvirt.elan.utils.ElanUtils" />-->
     <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
         <command>
             <action class="org.opendaylight.netvirt.elan.cli.ElanAdd">
             <action class="org.opendaylight.netvirt.elan.cli.etree.EtreeInterfaceGet">
                 <property name="elanProvider" ref="elanProviderRef" />
                 <property name="interfaceManager" ref="interfaceManagerRef" />
-                <property name="elanUtils" ref="elanUtilsRef" />
+                <!--<property name="elanUtils" ref="elanUtilsRef" />-->
             </action>
         </command>
         <command>
             <action class="org.opendaylight.netvirt.elan.cli.etree.EtreeInterfaceDelete">
                 <property name="elanProvider" ref="elanProviderRef" />
-                <property name="elanUtils" ref="elanUtilsRef" />
+                <!--<property name="elanUtils" ref="elanUtilsRef" />-->
             </action>
         </command>
     </command-bundle>
index ef78656924e82fabc4d57ec146912b0359f66c2e..4dd1dd1989afd3c20bf68df658619c6911813ac5 100644 (file)
   <odl:rpc-service id="idManagerService"
     interface="org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService" />
 
-  <bean id="elanForwardingEntriesHandler" class="org.opendaylight.netvirt.elan.utils.ElanForwardingEntriesHandler"
-    destroy-method="close">
+  <bean id="elanBridgeManager" class="org.opendaylight.netvirt.elan.internal.ElanBridgeManager">
+    <argument ref="dataBroker" />
+  </bean>
+
+  <bean id="elanForwardingEntriesHandler" class="org.opendaylight.netvirt.elan.utils.ElanForwardingEntriesHandler">
     <argument ref="dataBroker" />
-    <argument ref="elanUtils" />
   </bean>
 
   <bean id="elanInterfaceManager"
@@ -38,8 +40,6 @@
     <argument ref="mdsalUtils" />
     <argument ref="interfaceManager" />
     <argument ref="elanForwardingEntriesHandler" />
-    <argument ref="elanL2GatewayUtils" />
-    <argument ref="elanUtils" />
   </bean>
 
   <bean id="elanInstanceManager"
@@ -49,7 +49,6 @@
     <argument ref="idManagerService" />
     <argument ref="elanInterfaceManager" />
     <argument ref="interfaceManager" />
-    <argument ref="elanUtils" />
   </bean>
 
   <bean id="elanNodeListener"
@@ -64,7 +63,6 @@
     <argument ref="dataBroker" />
     <argument ref="interfaceManager" />
     <argument ref="elanUtils" />
-    <argument ref="elanL2GatewayUtils" />
   </bean>
   <odl:notification-listener ref="elanPacketInHandler" />
 
@@ -72,6 +70,7 @@
     class="org.opendaylight.netvirt.elan.internal.ElanSmacFlowEventListener">
     <argument ref="dataBroker" />
     <argument ref="interfaceManager" />
+    <argument ref="elanUtils" />
   </bean>
   <odl:notification-listener ref="elanSmacFlowEventListener" />
 
@@ -81,6 +80,8 @@
     <argument ref="elanInstanceManager" />
     <argument ref="odlInterfaceRpcService" />
     <argument ref="itmRpcService" />
+    <argument ref="elanInterfaceManager" />
+    <argument ref="entityOwnershipService" />
   </bean>
 
   <bean id="elanStatisticsImpl" class="org.opendaylight.netvirt.elan.statisitcs.ElanStatisticsImpl">
     <argument ref="entityOwnershipService" />
   </bean>
 
-  <bean id="elanInterfaceClusterListener"
+  <bean id="elanDpnInterfaceClusteredListener"
     class="org.opendaylight.netvirt.elan.internal.ElanDpnInterfaceClusteredListener">
     <argument ref="dataBroker" />
     <argument ref="entityOwnershipService" />
-    <argument ref="elanL2GatewayUtils" />
+    <argument ref="elanUtils" />
   </bean>
 
   <bean id="elanService" class="org.opendaylight.netvirt.elan.internal.ElanServiceProvider"
     <argument ref="elanInstanceManager" />
     <argument ref="elanBridgeManager" />
     <argument ref="dataBroker" />
+    <argument ref="elanInterfaceManager" />
     <argument ref="elanStatusMonitor" />
     <argument ref="elanUtils" />
   </bean>
   <service ref="elanService" odl:type="default" interface="org.opendaylight.netvirt.elanmanager.api.IElanService" />
 
-  <bean id="elanL2GatewayUtils" class="org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils">
-    <argument ref="dataBroker" />
-    <argument ref="itmRpcService" />
-    <argument ref="elanUtils" />
-    <argument ref="entityOwnershipService" />
-  </bean>
-
   <bean id="cacheElanInterfaceListener" class="org.opendaylight.netvirt.elan.utils.CacheElanInterfaceListener"
     init-method="init" destroy-method="close">
     <argument ref="dataBroker" />
   <bean id="hwvtepLocalUcastMacListener" class="org.opendaylight.netvirt.elan.l2gw.listeners.HwvtepLocalUcastMacListener"
     init-method="init" destroy-method="close">
     <argument ref="dataBroker" />
-    <argument ref="elanL2GatewayUtils" />
+    <argument ref="elanUtils" />
   </bean>
 
   <bean id="elanStatusMonitor" class="org.opendaylight.netvirt.elan.statusanddiag.ElanStatusMonitor"
     class="org.opendaylight.netvirt.elan.l2gw.listeners.L2GatewayConnectionListener"
     destroy-method="close">
     <argument ref="dataBroker" />
-    <argument ref="elanInstanceManager" />
-    <argument ref="l2GatewayConnectionUtils" />
+    <argument ref="elanUtils" />
   </bean>
 
   <bean id="hwvtepPhysicalSwitchListener"
     <argument ref="dataBroker" />
     <argument ref="itmRpcService" />
     <argument ref="entityOwnershipService" />
-    <argument ref="l2GatewayConnectionUtils" />
+    <argument ref="elanUtils" />
   </bean>
 
   <bean id="hwvtepTerminationPointListener"
     class="org.opendaylight.netvirt.elan.l2gw.listeners.HwvtepTerminationPointListener"
     destroy-method="close">
-    <argument ref="broker" />
-    <argument ref="elanL2GatewayUtils" />
+    <argument ref="dataBroker" />
+    <argument ref="elanUtils" />
     <argument ref="entityOwnershipService" />
   </bean>
 </blueprint>
\ No newline at end of file
index 5fbd39ddfc8bfb1c3046575326af76fbc9006785..3b478914bc862251cd7c634a90b97c87c25099c2 100644 (file)
@@ -40,7 +40,7 @@ public class StateManager implements IStateManager {
      * Start method called by blueprint.
      */
     public void start() {
-        new ConfigStateManager(this).start();
+        setReady(true);
     }
 
     /**
@@ -77,9 +77,8 @@ public class StateManager implements IStateManager {
         }
     }
 
-    @Override
-    public void setReady(boolean ready) {
-        if (ready) {
+    private class WriteTopology implements Runnable {
+        public void run() {
             try {
                 Thread.sleep(5000);
             } catch (InterruptedException e) {
@@ -89,4 +88,11 @@ public class StateManager implements IStateManager {
             initializeNetvirtTopology();
         }
     }
+
+    @Override
+    public void setReady(boolean ready) {
+        if (ready) {
+            new Thread(new WriteTopology()).start();
+        }
+    }
 }