elanmanager dead code removal 27/75427/6
authorStephen Kitt <skitt@redhat.com>
Tue, 19 Mar 2019 08:35:57 +0000 (09:35 +0100)
committerFaseela K <faseela.k@ericsson.com>
Tue, 26 Mar 2019 05:14:09 +0000 (05:14 +0000)
This patch removes unused methods, classes and fields.

Change-Id: Ia14e3ff0a304ca9c9db16562c1c766f07f98b9f2
Signed-off-by: Stephen Kitt <skitt@redhat.com>
34 files changed:
elanmanager/api/src/main/java/org/opendaylight/netvirt/elanmanager/api/IElanBridgeManager.java [deleted file]
elanmanager/api/src/main/java/org/opendaylight/netvirt/elanmanager/api/IElanService.java
elanmanager/api/src/main/java/org/opendaylight/netvirt/elanmanager/exceptions/MacNotFoundException.java [deleted file]
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/ElanException.java [deleted file]
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/internal/ElanBridgeManager.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/internal/ElanInterfaceManager.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/internal/ElanItmEventListener.java [deleted file]
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/internal/ElanManagerCounters.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/internal/ElanServiceProvider.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/ha/BatchedTransaction.java [deleted file]
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/ha/HwvtepHAUtil.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/ha/commands/IMergeCommand.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/ha/commands/MergeCommand.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/ha/handlers/HAEventHandler.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/ha/handlers/IHAEventHandler.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/ha/handlers/INodeCopier.java [deleted file]
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/ha/handlers/NodeCopier.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/ha/handlers/NodeDisconnectedHandler.java [deleted file]
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/ha/listeners/HAConfigNodeListener.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/ha/listeners/HAJobScheduler.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/ha/listeners/HAOpNodeListener.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/ha/listeners/HwvtepNodeBaseListener.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/jobs/AssociateHwvtepToElanJob.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/jobs/DisAssociateHwvtepFromElanJob.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/jobs/LogicalSwitchAddedJob.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/listeners/HwvtepLocalUcastMacListener.java [deleted file]
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/listeners/HwvtepLogicalSwitchListener.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/utils/ElanL2GatewayUtils.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/utils/L2GatewayConnectionUtils.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/statisitcs/ElanStatisticsImpl.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/utils/ElanDmacUtils.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/utils/ElanForwardingEntriesHandler.java
elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/utils/ElanUtils.java
elanmanager/impl/src/main/resources/OSGI-INF/blueprint/elanmanager.xml

diff --git a/elanmanager/api/src/main/java/org/opendaylight/netvirt/elanmanager/api/IElanBridgeManager.java b/elanmanager/api/src/main/java/org/opendaylight/netvirt/elanmanager/api/IElanBridgeManager.java
deleted file mode 100644 (file)
index 20f1d78..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2016 Hewlett Packard Enterprise, Co. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.netvirt.elanmanager.api;
-
-import java.math.BigInteger;
-import java.util.Map;
-import java.util.Optional;
-
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
-
-public interface IElanBridgeManager {
-
-    /**
-     * Get integration bridge node with dpId.
-     *
-     * @param dpId
-     *            datapath id
-     * @return integration bridge {@code Node} or null if not found
-     */
-    Node getBridgeNode(BigInteger dpId);
-
-    /**
-     * Extract OpenvSwitch other-config to key value map.
-     *
-     * @param node
-     *            OVSDB node
-     * @param key
-     *            key to extract from other-config
-     * @return key-value Map or empty map if key was not found
-     */
-    Map<String, String> getOpenvswitchOtherConfigMap(Node node, String key);
-
-    /**
-     * Extract multi key-value into Map.
-     *
-     * @param multiKeyValueStr
-     *            multi key-value formatted using colon key-value
-     *            separator and comma multi-value separator
-     * @return Map containing key value pairs or empty map if no key value pairs
-     *         where found
-     */
-    Map<String, String> getMultiValueMap(String multiKeyValueStr);
-
-    /**
-     * Get the integration bridge DPN id from the manager node UUID.
-     *
-     * @param managerNodeId
-     *            node-id of the OVSDB node managing br-int
-     * @return Optional containing the dp-id or empty Optional if not found
-     */
-    Optional<BigInteger> getDpIdFromManagerNodeId(String managerNodeId);
-
-}
index 17d3c1e9edbb7e4bd598bc734bcdd2d3117cfc0d..840baa2360e8ef54ce58a6226d9ddb5d4a2d71b5 100644 (file)
@@ -11,8 +11,6 @@ package org.opendaylight.netvirt.elanmanager.api;
 import java.math.BigInteger;
 import java.util.Collection;
 import java.util.List;
-
-import org.opendaylight.genius.mdsalutil.MatchInfoBase;
 import org.opendaylight.netvirt.elan.arp.responder.ArpResponderInput;
 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;
@@ -78,8 +76,6 @@ public interface IElanService extends IEtreeService {
 
     void removeKnownL3DmacAddress(String macAddress, String elanInstanceName);
 
-    List<MatchInfoBase> getEgressMatchesForElanInstance(String elanInstanceName);
-
     Boolean isOpenStackVniSemanticsEnforced();
 
     /**
diff --git a/elanmanager/api/src/main/java/org/opendaylight/netvirt/elanmanager/exceptions/MacNotFoundException.java b/elanmanager/api/src/main/java/org/opendaylight/netvirt/elanmanager/exceptions/MacNotFoundException.java
deleted file mode 100644 (file)
index 1bf4189..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.netvirt.elanmanager.exceptions;
-
-/**
- * Exception thrown when a MAC address was not found.
- */
-public class MacNotFoundException extends Exception {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * Constructor.
-     * @param message the eror message text, which must include the MAC address that was not found
-     */
-    public MacNotFoundException(String message) {
-        super(message);
-    }
-}
diff --git a/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/ElanException.java b/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/ElanException.java
deleted file mode 100644 (file)
index c402cee..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2016 Red Hat, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.netvirt.elan;
-
-public class ElanException extends Exception {
-    private static final long serialVersionUID = -2491313989449541864L;
-
-    public ElanException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    public ElanException(String message) {
-        super(message);
-    }
-
-}
index c6065d7862c6e6788cff8babefb6211048646b5f..81e545bc9febd731e70771448059b23a4f060895 100644 (file)
@@ -29,7 +29,6 @@ import org.opendaylight.genius.interfacemanager.globals.IfmConstants;
 import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
 import org.opendaylight.genius.itm.globals.ITMConstants;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
-import org.opendaylight.netvirt.elanmanager.api.IElanBridgeManager;
 import org.opendaylight.ovsdb.utils.southbound.utils.SouthboundUtils;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.config.rev150710.ElanConfig;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId;
@@ -57,7 +56,7 @@ import org.slf4j.LoggerFactory;
 @Singleton
 // Checkstyle expects the first sentence to end with a period, question marks don’t count
 @SuppressWarnings("checkstyle:SummaryJavadoc")
-public class ElanBridgeManager implements IElanBridgeManager {
+public class ElanBridgeManager {
     private static final Logger LOG = LoggerFactory.getLogger(ElanBridgeManager.class);
 
     public static final String PROVIDER_MAPPINGS_KEY = "provider_mappings";
@@ -395,7 +394,6 @@ public class ElanBridgeManager implements IElanBridgeManager {
     /**
      * {@inheritDoc}.
      */
-    @Override
     public Map<String, String> getOpenvswitchOtherConfigMap(Node node, String key) {
         String otherConfigVal = southboundUtils.getOpenvswitchOtherConfig(node, key);
         return getMultiValueMap(otherConfigVal);
@@ -515,7 +513,6 @@ public class ElanBridgeManager implements IElanBridgeManager {
         return rv;
     }
 
-    @Override
     public Optional<BigInteger> getDpIdFromManagerNodeId(String managerNodeId) {
         InstanceIdentifier<Node> identifier = getIntegrationBridgeIdentifier(managerNodeId);
         OvsdbBridgeAugmentation integrationBridgeAugmentation = interfaceManager.getOvsdbBridgeForNodeIid(identifier);
@@ -555,8 +552,7 @@ public class ElanBridgeManager implements IElanBridgeManager {
         return stringBuilder.toString();
     }
 
-    @Override
-    public Map<String, String> getMultiValueMap(String multiKeyValueStr) {
+    private Map<String, String> getMultiValueMap(String multiKeyValueStr) {
         if (Strings.isNullOrEmpty(multiKeyValueStr)) {
             return Collections.emptyMap();
         }
@@ -576,9 +572,8 @@ public class ElanBridgeManager implements IElanBridgeManager {
     /**
      * {@inheritDoc}.
      */
-    @Override
     @Nullable
-    public Node getBridgeNode(BigInteger dpId) {
+    private Node getBridgeNode(BigInteger dpId) {
         List<Node> ovsdbNodes = southboundUtils.getOvsdbNodes();
         if (null == ovsdbNodes) {
             LOG.debug("Could not find any (?) ovsdb nodes");
index 27f6aa744295e60de846499e3f7d194e17692353..1175c78a7c009fa47e6c87f93e9e0da50ce0b659 100644 (file)
@@ -809,7 +809,7 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
         futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, confTx -> {
             futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(OPERATIONAL, operTx -> {
                 installEntriesForElanInterface(elanInstance, elanInterface, interfaceInfo,
-                    isFirstInterfaceInDpn, confTx, operTx);
+                    isFirstInterfaceInDpn, confTx);
 
                 List<StaticMacEntries> staticMacEntriesList = elanInterface.getStaticMacEntries();
                 List<PhysAddress> staticMacAddresses = Lists.newArrayList();
@@ -916,8 +916,7 @@ public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanIn
     }
 
     private void installEntriesForElanInterface(ElanInstance elanInstance, ElanInterface elanInterface,
-            InterfaceInfo interfaceInfo, boolean isFirstInterfaceInDpn, TypedWriteTransaction<Configuration> confTx,
-            TypedWriteTransaction<Operational> operTx) {
+            InterfaceInfo interfaceInfo, boolean isFirstInterfaceInDpn, TypedWriteTransaction<Configuration> confTx) {
         if (!isOperational(interfaceInfo)) {
             return;
         }
diff --git a/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/internal/ElanItmEventListener.java b/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/internal/ElanItmEventListener.java
deleted file mode 100755 (executable)
index 9a91f31..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.netvirt.elan.internal;
-
-public class ElanItmEventListener{
-
-}
-//public class ElanItmEventListener extends AbstractDataChangeListener<DataObject> implements AutoCloseable {
-//FIXME: This class is to be made functional once ITM is added
-//    private static final Logger LOG = LoggerFactory.getLogger(ElanItmEventListener.class);
-//    private final DataBroker broker;
-//    private ListenerRegistration<DataChangeListener> listenerRegistration;
-//    private ElanInterfaceManager elanInterfaceManager;
-//
-//    public ElanItmEventListener(final DataBroker db, final ElanInterfaceManager ifManager) {
-//        super(StateTunnelList.class);
-//        broker = db;
-//        elanInterfaceManager = ifManager;
-//        registerListener(db);
-//    }
-//
-//    private void registerListener(final DataBroker db) {
-//        try {
-//            listenerRegistration = broker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL,
-//                    getWildCardPath(), ElanItmEventListener.this, AsyncDataBroker.DataChangeScope.SUBTREE);
-//        } catch (final Exception e) {
-//            LOG.error("ITM Monitor Interfaces DataChange listener registration fail!", e);
-//            throw new IllegalStateException("ITM Monitor registration Listener failed.", e);
-//        }
-//    }
-//
-//    private InstanceIdentifier<StateTunnelList> getWildCardPath() {
-//        return InstanceIdentifier.create(TunnelsState.class).child(StateTunnelList.class);
-//    }
-//
-//    @Override
-//    public void close() throws Exception {
-//        if (listenerRegistration != null) {
-//            try {
-//                listenerRegistration.close();
-//            } catch (final Exception e) {
-//                LOG.error("Error when cleaning up DataChangeListener.", e);
-//            }
-//            listenerRegistration = null;
-//        }
-//    }
-//
-//    @Override
-//    protected void remove(InstanceIdentifier<StateTunnelList> identifier, StateTunnelList del) {
-//
-//    }
-//
-//    @Override
-//    protected void update(InstanceIdentifier<StateTunnelList> identifier,
-//        StateTunnelList original, StateTunnelList update) {
-//
-//        BigInteger srcDpId = update.getSourceDPN();
-//        BigInteger dstDpId = update.getDestinationDPN();
-//        LOG.trace("ITM Tunnel state event changed from :{} to :{} for transportZone:{}",
-//            original.isLogicalTunnelState(), update.isLogicalTunnelState(), update.getLogicalTunnelGroupName());
-//
-//        if(update.isLogicalTunnelState()) {
-//            LOG.trace("ITM Tunnel State is Up b/w srcDpn: {} and dstDpn: {}", srcDpId, dstDpId);
-//            elanInterfaceManager.handleTunnelStateEvent(srcDpId, dstDpId);
-//        }
-//    }
-//
-//    @Override
-//    protected void add(InstanceIdentifier<StateTunnelList> identifier, StateTunnelList add) {
-//        BigInteger srcDpId =  add.getSourceDPN();
-//        BigInteger dstDpId = add.getDestinationDPN();
-//        LOG.trace("ITM Tunnel state event:{} for transportZone:{} of {}", add.isLogicalTunnelState(),
-//            add.getLogicalTunnelGroupName());
-//
-//        if(add.isLogicalTunnelState()) {
-//            LOG.trace("ITM Tunnel State is Up b/w srcDpn: {} and dstDpn: {}", srcDpId, dstDpId);
-//            elanInterfaceManager.handleTunnelStateEvent(srcDpId, dstDpId);
-//        }
-//    }
-//}
index b500c88ea0f15a11d8cc048918c569e6d17843e2..9f1be9a8f309463e29db128165718e05f0826e81 100644 (file)
@@ -19,7 +19,6 @@ public final class ElanManagerCounters {
     private final Meter unknownSmacPktinForwardingEntriesRemovedMeter;
     private final Meter unknownSmacPktinRcvMeter;
     private final Meter unknownSmacPktinLearnedMeter;
-    private final Meter unknownSmacPktinIgnoredDueProtectionMeter;
     private final Meter unknownSmacPktinFlowsRemovedForRelearnedMeter;
     private final Meter unknownSmacPktinRemovedForRelearnedMeter;
     private final Meter unknownSmacPktinMacMigrationIgnoredDueToProtectionMeter;
@@ -30,8 +29,6 @@ public final class ElanManagerCounters {
             meter(metricProvider, "unknown_smac_pktin_forwarding_entries_removed");
         this.unknownSmacPktinRcvMeter = meter(metricProvider, "unknown_smac_pktin_rcv");
         this.unknownSmacPktinLearnedMeter = meter(metricProvider, "unknown_smac_pktin_learned");
-        this.unknownSmacPktinIgnoredDueProtectionMeter =
-            meter(metricProvider, "unknown_smac_pktin_ignored_due_protection");
         this.unknownSmacPktinFlowsRemovedForRelearnedMeter =
             meter(metricProvider, "unknown_smac_pktin_flows_removed_for_relearned");
         this.unknownSmacPktinRemovedForRelearnedMeter =
@@ -57,10 +54,6 @@ public final class ElanManagerCounters {
         unknownSmacPktinLearnedMeter.mark();
     }
 
-    public void unknownSmacPktinIgnoredDueProtection() {
-        unknownSmacPktinIgnoredDueProtectionMeter.mark();
-    }
-
     public void unknownSmacPktinFlowsRemovedForRelearned() {
         unknownSmacPktinFlowsRemovedForRelearnedMeter.mark();
     }
index 44a4e463d7f0774cf526be5a8c77f2e09425fb2f..9c161ab0fcb369a123ff7cd1eb24b764bccbdfea 100644 (file)
@@ -36,11 +36,8 @@ import org.opendaylight.genius.interfacemanager.exceptions.InterfaceAlreadyExist
 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.MatchInfoBase;
-import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
-import org.opendaylight.genius.mdsalutil.nxmatches.NxMatchRegister;
 import org.opendaylight.genius.utils.ServiceIndex;
 import org.opendaylight.genius.utils.hwvtep.HwvtepSouthboundConstants;
 import org.opendaylight.infrautils.inject.AbstractLifecycle;
@@ -723,23 +720,6 @@ public class ElanServiceProvider extends AbstractLifecycle implements IElanServi
         elanUtils.removeDmacRedirectToDispatcherFlows(elanInstance.getElanTag(), macAddress, dpnsIdsForElanInstance);
     }
 
-    @Override
-    public List<MatchInfoBase> getEgressMatchesForElanInstance(String elanInstanceName) {
-        ElanInstance elanInstance = getElanInstance(elanInstanceName);
-        if (elanInstance == null) {
-            LOG.debug("No ELAN instance found for {}", elanInstanceName);
-            return emptyList();
-        }
-
-        Long elanTag = elanInstance.getElanTag();
-        if (elanTag == null) {
-            LOG.debug("No ELAN tag found for {}", elanInstanceName);
-            return emptyList();
-        }
-        return Collections.singletonList(
-                new NxMatchRegister(ElanConstants.ELAN_REG_ID, elanTag, MetaDataUtil.getElanMaskForReg()));
-    }
-
     /**
      * Create ietf-interfaces based on the ELAN segment type.<br>
      * For segment type flat - create transparent interface pointing to the
diff --git a/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/ha/BatchedTransaction.java b/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/ha/BatchedTransaction.java
deleted file mode 100644 (file)
index cf11c41..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2017 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.netvirt.elan.l2gw.ha;
-
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.FluentFuture;
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
-import org.opendaylight.genius.utils.batching.ResourceBatchingManager;
-import org.opendaylight.mdsal.common.api.CommitInfo;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class BatchedTransaction implements ReadWriteTransaction {
-
-    @Override
-    public <T extends DataObject> CheckedFuture<Optional<T>, ReadFailedException> read(
-            LogicalDatastoreType logicalDatastoreType, InstanceIdentifier<T> instanceIdentifier) {
-        return ResourceBatchingManager.getInstance().read(getShard(logicalDatastoreType).name(), instanceIdentifier);
-    }
-
-    ResourceBatchingManager.ShardResource getShard(LogicalDatastoreType logicalDatastoreType) {
-        if (logicalDatastoreType == LogicalDatastoreType.CONFIGURATION) {
-            return ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY;
-        }
-        return ResourceBatchingManager.ShardResource.OPERATIONAL_TOPOLOGY;
-    }
-
-    @Override
-    public <T extends DataObject> void put(
-            LogicalDatastoreType logicalDatastoreType, InstanceIdentifier<T> instanceIdentifier, T dataObj) {
-        ResourceBatchingManager.getInstance().put(getShard(logicalDatastoreType), instanceIdentifier, dataObj);
-    }
-
-    @Override
-    public <T extends DataObject> void put(LogicalDatastoreType logicalDatastoreType,
-                                           InstanceIdentifier<T> instanceIdentifier, T dataObj, boolean flag) {
-        ResourceBatchingManager.getInstance().put(getShard(logicalDatastoreType), instanceIdentifier, dataObj);
-    }
-
-    @Override
-    public <T extends DataObject> void merge(LogicalDatastoreType logicalDatastoreType,
-                                             InstanceIdentifier<T> instanceIdentifier, T dataObj) {
-        ResourceBatchingManager.getInstance().merge(getShard(logicalDatastoreType), instanceIdentifier, dataObj);
-    }
-
-    @Override
-    public <T extends DataObject> void merge(LogicalDatastoreType logicalDatastoreType,
-                                             InstanceIdentifier<T> instanceIdentifier, T dataObj, boolean flag) {
-        ResourceBatchingManager.getInstance().merge(getShard(logicalDatastoreType), instanceIdentifier, dataObj);
-    }
-
-    @Override
-    public boolean cancel() {
-        return false;
-    }
-
-    @Override
-    public void delete(LogicalDatastoreType logicalDatastoreType, InstanceIdentifier<?> instanceIdentifier) {
-        ResourceBatchingManager.getInstance().delete(getShard(logicalDatastoreType), instanceIdentifier);
-    }
-
-    @Override
-    public @NonNull FluentFuture<? extends @NonNull CommitInfo> commit() {
-        return CommitInfo.emptyFluentFuture();
-    }
-
-    @Override
-    public Object getIdentifier() {
-        return "BatchedTransaction";
-    }
-}
index 867bbba46d20a56415d1c20e538483932282dbb9..ab86ae74fe690c0db02c612c473c5324b50aa004 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.netvirt.elan.l2gw.ha;
 
 import static org.opendaylight.controller.md.sal.binding.api.WriteTransaction.CREATE_MISSING_PARENTS;
-import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.OPERATIONAL;
 
 import com.google.common.base.Optional;
 import com.google.common.base.Strings;
@@ -23,11 +22,8 @@ import java.util.concurrent.ExecutionException;
 import java.util.stream.Collectors;
 import javax.annotation.Nullable;
 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
-import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.genius.infra.Datastore;
 import org.opendaylight.genius.infra.Datastore.Configuration;
-import org.opendaylight.genius.infra.Datastore.Operational;
 import org.opendaylight.genius.infra.TypedReadWriteTransaction;
 import org.opendaylight.genius.infra.TypedWriteTransaction;
 import org.opendaylight.genius.utils.hwvtep.HwvtepNodeHACache;
@@ -109,21 +105,6 @@ public final class HwvtepHAUtil {
         return tpId.firstKeyOf(TerminationPoint.class).getTpId().getValue().substring("vxlan_over_ipv4:".length());
     }
 
-    public static String getLogicalSwitchSwitchName(HwvtepLogicalSwitchRef logicalSwitchRef) {
-        InstanceIdentifier<LogicalSwitches> id = (InstanceIdentifier<LogicalSwitches>) logicalSwitchRef.getValue();
-        return id.firstKeyOf(LogicalSwitches.class).getHwvtepNodeName().getValue();
-    }
-
-    public static String getNodeIdFromLocatorRef(HwvtepPhysicalLocatorRef locatorRef) {
-        InstanceIdentifier<TerminationPoint> tpId = (InstanceIdentifier<TerminationPoint>) locatorRef.getValue();
-        return tpId.firstKeyOf(Node.class).getNodeId().getValue();
-    }
-
-    public static String getNodeIdFromLogicalSwitches(HwvtepLogicalSwitchRef logicalSwitchRef) {
-        InstanceIdentifier<LogicalSwitches> id = (InstanceIdentifier<LogicalSwitches>) logicalSwitchRef.getValue();
-        return id.firstKeyOf(Node.class).getNodeId().getValue();
-    }
-
     public static InstanceIdentifier<Node> createInstanceIdentifierFromHAId(String haUUidVal) {
         String nodeString = HWVTEP_URI_PREFIX + "://"
             + UUID + "/" + java.util.UUID.nameUUIDFromBytes(haUUidVal.getBytes(StandardCharsets.UTF_8)).toString();
@@ -259,15 +240,6 @@ public final class HwvtepHAUtil {
         return null;
     }
 
-    @Nullable
-    public static String getPsName(Node psNode) {
-        String psNodeId = psNode.getNodeId().getValue();
-        if (psNodeId.contains(PHYSICALSWITCH)) {
-            return psNodeId.substring(psNodeId.indexOf(PHYSICALSWITCH) + PHYSICALSWITCH.length());
-        }
-        return null;
-    }
-
     @Nullable
     public static String getPsName(InstanceIdentifier<Node> psNodeIid) {
         String psNodeId = psNodeIid.firstKeyOf(Node.class).getNodeId().getValue();
@@ -522,51 +494,6 @@ public final class HwvtepHAUtil {
         }
     }
 
-    /**
-     * Delete switches from Node in Operational Data Tree .
-     *
-     * @param haPath HA node path from whih switches will be deleted
-     * @param tx  Transaction object
-     */
-    public static void deleteSwitchesManagedByNode(InstanceIdentifier<Node> haPath,
-            TypedReadWriteTransaction<Operational> tx) throws ExecutionException, InterruptedException {
-
-        Optional<Node> nodeOptional = tx.read(haPath).get();
-        if (!nodeOptional.isPresent()) {
-            return;
-        }
-        Node node = nodeOptional.get();
-        HwvtepGlobalAugmentation globalAugmentation = node.augmentation(HwvtepGlobalAugmentation.class);
-        if (globalAugmentation == null) {
-            return;
-        }
-        List<Switches> switches = globalAugmentation.getSwitches();
-        if (switches != null) {
-            for (Switches switche : switches) {
-                InstanceIdentifier<Node> id = (InstanceIdentifier<Node>)switche.getSwitchRef().getValue();
-                deleteNodeIfPresent(tx, id);
-            }
-        }
-    }
-
-    /**
-     * Returns true/false if all the childrens are deleted from Operational Data store.
-     *
-     * @param children IID for the child node to read from OP data tree
-     * @param tx Transaction
-     * @return true/false boolean
-     * @throws ReadFailedException Exception thrown if read fails
-     */
-    public static boolean areAllChildDeleted(Set<InstanceIdentifier<Node>> children,
-                                             ReadWriteTransaction tx) throws ReadFailedException {
-        for (InstanceIdentifier<Node> childId : children) {
-            if (tx.read(OPERATIONAL, childId).checkedGet().isPresent()) {
-                return false;
-            }
-        }
-        return true;
-    }
-
     public static void addToCacheIfHAChildNode(InstanceIdentifier<Node> childPath, Node childNode,
             HwvtepNodeHACache hwvtepNodeHACache) {
         String haId = HwvtepHAUtil.getHAIdFromManagerOtherConfig(childNode);
index f2662c22d5d13169226e952560e33862f3066cf6..e657798d81eda03bcda9d40c5ee30f641d44a4fa 100644 (file)
@@ -28,31 +28,6 @@ public interface IMergeCommand<T extends DataObject, Y extends Builder, Z extend
                               Z src,
                               InstanceIdentifier<Node> nodePath);
 
-    /**
-     * Abstract function to merge data from src to dst in Config Topology.
-     * @param dst builder which will be used to build concrete object
-     * @param src builder which are to be merged in destination
-     * @param nodePath nodePath of dest
-     */
-    void mergeConfigData(Y dst,
-                         Z src,
-                         InstanceIdentifier<Node> nodePath);
-
-    /**
-     * Abstract function to update data from src to dst in Config Topology.
-     * while existing data helps in keeping track of data only updated
-     * @param existingData dataObject which are already exisitng
-     * @param updated updated data
-     * @param orig original data
-     * @param nodePath nodePath of dest
-     * @param tx ReadWriteTransaction
-     */
-    void mergeConfigUpdate(Z existingData,
-                           Z updated,
-                           Z orig,
-                           InstanceIdentifier<Node> nodePath,
-                           ReadWriteTransaction tx);
-
     /**
      * Abstract function to update data from src to dst in Operational Topology.
      * while existing data helps in keeping track of data only updated
index d75f76bd1f3e3105a6a0bd5f753e1908aeef3abc..ddc2bfcad035d5ef1528bbf83722eeccd6bbc221 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.netvirt.elan.l2gw.ha.commands;
 
-import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION;
 import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.OPERATIONAL;
 import static org.opendaylight.netvirt.elan.l2gw.ha.HwvtepHAUtil.isEmptyList;
 
@@ -150,7 +149,6 @@ public abstract class MergeCommand<T extends DataObject, Y extends Builder, Z ex
         }
     }
 
-    @Override
     public void mergeConfigData(Y dst,
                                 Z src,
                                 InstanceIdentifier<Node> nodePath) {
@@ -163,18 +161,6 @@ public abstract class MergeCommand<T extends DataObject, Y extends Builder, Z ex
         }
     }
 
-    @Override
-    public void mergeConfigUpdate(Z existing,
-                                  Z updated,
-                                  Z orig,
-                                  InstanceIdentifier<Node> nodePath,
-                                  ReadWriteTransaction tx) {
-        List<T> updatedData     = getData(updated);
-        List<T> origData        = getData(orig);
-        List<T> existingData    = getData(existing);
-        transformUpdate(existingData, updatedData, origData, nodePath, CONFIGURATION, tx);
-    }
-
     @Override
     public void mergeOpUpdate(Z origDst,
                               Z updatedSrc,
index d06ad39c4aa314b1c6bd7f71a72046f05b381fca..7e81f6ac2e982e6f2127f20e0983fe06c4697ff7 100644 (file)
@@ -7,60 +7,23 @@
  */
 package org.opendaylight.netvirt.elan.l2gw.ha.handlers;
 
-import com.google.common.base.Optional;
-import java.util.concurrent.ExecutionException;
 import javax.inject.Inject;
 import javax.inject.Singleton;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.genius.infra.Datastore.Configuration;
 import org.opendaylight.genius.infra.Datastore.Operational;
 import org.opendaylight.genius.infra.TypedReadWriteTransaction;
-import org.opendaylight.genius.utils.hwvtep.HwvtepNodeHACache;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 @Singleton
 public class HAEventHandler implements IHAEventHandler {
 
-    private final NodeConnectedHandler nodeConnectedHandler;
     private final ConfigNodeUpdatedHandler configNodeUpdatedHandler = new ConfigNodeUpdatedHandler();
     private final OpNodeUpdatedHandler opNodeUpdatedHandler = new OpNodeUpdatedHandler();
 
     @Inject
-    public HAEventHandler(DataBroker db, HwvtepNodeHACache hwvtepNodeHACache) {
-        nodeConnectedHandler = new NodeConnectedHandler(db, hwvtepNodeHACache);
-    }
-
-    @Override
-    public void handleChildNodeConnected(Node connectedNode,
-                                         InstanceIdentifier<Node> connectedNodePath,
-                                         InstanceIdentifier<Node> haNodePath,
-                                         TypedReadWriteTransaction<Configuration> confTx,
-                                         TypedReadWriteTransaction<Operational> operTx)
-            throws ReadFailedException, ExecutionException, InterruptedException {
-        if (haNodePath == null) {
-            return;
-        }
-        nodeConnectedHandler.handleNodeConnected(connectedNode, connectedNodePath, haNodePath,
-                Optional.absent(), Optional.absent(), confTx, operTx);
-    }
-
-    @Override
-    public void handleChildNodeReConnected(Node connectedNode,
-                                           InstanceIdentifier<Node> connectedNodePath,
-                                           InstanceIdentifier<Node> haNodePath,
-                                           Optional<Node> haGlobalCfg,
-                                           Optional<Node> haPSCfg,
-                                           TypedReadWriteTransaction<Configuration> confTx,
-                                           TypedReadWriteTransaction<Operational> operTx)
-            throws ReadFailedException, ExecutionException, InterruptedException {
-        if (haNodePath == null) {
-            return;
-        }
-        nodeConnectedHandler.handleNodeConnected(connectedNode, connectedNodePath, haNodePath,
-                haGlobalCfg, haPSCfg, confTx, operTx);
+    public HAEventHandler() {
     }
 
     @Override
index 55ab0caed10067fbad13363e2bc5c5392d58aa1e..6b76636d4efffe6b3b48997c853198075ac7849a 100644 (file)
@@ -7,11 +7,7 @@
  */
 package org.opendaylight.netvirt.elan.l2gw.ha.handlers;
 
-import com.google.common.base.Optional;
-
-import java.util.concurrent.ExecutionException;
 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.genius.infra.Datastore.Configuration;
 import org.opendaylight.genius.infra.Datastore.Operational;
 import org.opendaylight.genius.infra.TypedReadWriteTransaction;
@@ -21,22 +17,6 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 public interface IHAEventHandler {
 
-    void handleChildNodeConnected(Node connectedNode,
-                                  InstanceIdentifier<Node> connectedNodePath,
-                                  InstanceIdentifier<Node> haNodePath,
-                                  TypedReadWriteTransaction<Configuration> confTx,
-                                  TypedReadWriteTransaction<Operational> operTx)
-            throws ReadFailedException, ExecutionException, InterruptedException;
-
-    void handleChildNodeReConnected(Node connectedNode,
-                                    InstanceIdentifier<Node> connectedNodePath,
-                                    InstanceIdentifier<Node> haNodePath,
-                                    Optional<Node> haGlobalCfg,
-                                    Optional<Node> haPSCfg,
-                                    TypedReadWriteTransaction<Configuration> confTx,
-                                    TypedReadWriteTransaction<Operational> operTx)
-            throws ReadFailedException, ExecutionException, InterruptedException;
-
 
     void copyChildGlobalOpUpdateToHAParent(InstanceIdentifier<Node> haPath,
                                            DataObjectModification<Node> mod,
diff --git a/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/ha/handlers/INodeCopier.java b/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/ha/handlers/INodeCopier.java
deleted file mode 100644 (file)
index 744d523..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2017 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.netvirt.elan.l2gw.ha.handlers;
-
-import com.google.common.base.Optional;
-import java.util.concurrent.ExecutionException;
-import org.opendaylight.genius.infra.Datastore;
-import org.opendaylight.genius.infra.TypedReadWriteTransaction;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public interface INodeCopier {
-
-    <D extends Datastore> void copyGlobalNode(Optional<Node> globalNodeOptional,
-                        InstanceIdentifier<Node> srcPath,
-                        InstanceIdentifier<Node> dstPath,
-                        Class<D> datastoreType,
-                        TypedReadWriteTransaction<D> tx)
-        throws ExecutionException, InterruptedException;
-
-    <D extends Datastore> void copyPSNode(Optional<Node> psNodeOptional,
-                    InstanceIdentifier<Node> srcPsPath,
-                    InstanceIdentifier<Node> dstPsPath,
-                    InstanceIdentifier<Node> dstGlobalPath,
-                    Class<D> datastoreType,
-                    TypedReadWriteTransaction<D> tx)
-        throws ExecutionException, InterruptedException;
-}
index 1c31257b4cf10868233c17a4457057149be2cb76..749583e52c25e94c84b979b3472d7ba7b9095134 100644 (file)
@@ -44,7 +44,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @Singleton
-public class NodeCopier implements INodeCopier {
+public class NodeCopier {
 
     private static final Logger LOG = LoggerFactory.getLogger(NodeCopier.class);
 
@@ -59,7 +59,6 @@ public class NodeCopier implements INodeCopier {
         this.txRunner = new ManagedNewTransactionRunnerImpl(db);
     }
 
-    @Override
     public <D extends Datastore> void copyGlobalNode(Optional<Node> srcGlobalNodeOptional,
                                InstanceIdentifier<Node> srcPath,
                                InstanceIdentifier<Node> dstPath,
@@ -142,7 +141,6 @@ public class NodeCopier implements INodeCopier {
         }
     }
 
-    @Override
     public <D extends Datastore> void copyPSNode(Optional<Node> srcPsNodeOptional,
                            InstanceIdentifier<Node> srcPsPath,
                            InstanceIdentifier<Node> dstPsPath,
diff --git a/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/ha/handlers/NodeDisconnectedHandler.java b/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/ha/handlers/NodeDisconnectedHandler.java
deleted file mode 100644 (file)
index dc84121..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.netvirt.elan.l2gw.ha.handlers;
-
-public class NodeDisconnectedHandler {
-}
index 8a491b97c58341caee0185c1b65e25fb2bad0433..abda2205ee2501e9ecac7712ff4f3a15e6fa5b75 100644 (file)
@@ -72,9 +72,8 @@ public class HAConfigNodeListener extends HwvtepNodeBaseListener<Configuration>
 
     @Override
     void onPsNodeUpdate(Node haPSUpdated,
-            Node haPSOriginal,
-            DataObjectModification<Node> mod,
-            TypedReadWriteTransaction<Configuration> tx) {
+        DataObjectModification<Node> mod,
+        TypedReadWriteTransaction<Configuration> tx) {
         //copy the ps node data to children
         String psId = haPSUpdated.getNodeId().getValue();
         Set<InstanceIdentifier<Node>> childSwitchIds = getPSChildrenIdsForHAPSNode(psId);
index 0d6774b6103ef66063a9fccd6ccafdfc10f636f9..66cd2ad54711a9587f21dee82bf11d1f4e4e6a6f 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.netvirt.elan.l2gw.ha.listeners;
 
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
-
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadFactory;
@@ -33,10 +32,6 @@ public final class HAJobScheduler implements Thread.UncaughtExceptionHandler {
         return instance;
     }
 
-    public void setThreadPool(ExecutorService service) {
-        executorService = service;
-    }
-
     public void submitJob(Runnable runnable) {
         executorService.execute(runnable);
     }
index 49ef723ebf59c78e647159591642f2fcff50b8c6..aa3ce9f210b656a1866947b9a998e5fb6f2afb70 100644 (file)
@@ -171,9 +171,8 @@ public class HAOpNodeListener extends HwvtepNodeBaseListener<Operational> {
 
     @Override
     void onPsNodeUpdate(Node updatedChildPSNode,
-            Node originalChildPSNode,
-            DataObjectModification<Node> mod,
-            TypedReadWriteTransaction<Operational> tx) {
+        DataObjectModification<Node> mod,
+        TypedReadWriteTransaction<Operational> tx) {
         InstanceIdentifier<Node> childGlobalPath = HwvtepHAUtil.getGlobalNodePathFromPSNode(updatedChildPSNode);
         if (isNotHAChild(childGlobalPath)) {
             return;
index b0b4729736a84a635a55463918b15a21f8e6d06e..e0316bec5df799f34549a7e1ef5eb2d067d0c34e 100644 (file)
@@ -163,7 +163,7 @@ public abstract class HwvtepNodeBaseListener<D extends Datastore>
                     onGlobalNodeUpdate(key, updated, original, mod, tx);
                     subMod = change.getRootNode().getModifiedAugmentation(HwvtepGlobalAugmentation.class);
                 } else {
-                    onPsNodeUpdate(updated, original, mod, tx);
+                    onPsNodeUpdate(updated, mod, tx);
                     subMod = change.getRootNode().getModifiedAugmentation(PhysicalSwitchAugmentation.class);
                 }
                 if (subMod != null) {
@@ -291,7 +291,7 @@ public abstract class HwvtepNodeBaseListener<D extends Datastore>
 
     }
 
-    void onPsNodeUpdate(Node updated, Node original,
+    void onPsNodeUpdate(Node updated,
                         DataObjectModification<Node> mod, TypedReadWriteTransaction<D> tx)
             throws ReadFailedException, InterruptedException, ExecutionException {
 
index 4fb95750994de055c9c0303ecdd5872929d6c679..b6f8e52a4b73043d38dfb82d8ce80d214c963aa6 100644 (file)
@@ -89,8 +89,8 @@ public class AssociateHwvtepToElanJob implements Callable<List<ListenableFuture<
 
             LogicalSwitchAddedJob logicalSwitchAddedJob =
                     new LogicalSwitchAddedJob(elanL2GatewayUtils, elanL2GatewayMulticastUtils,
-                        logicalSwitchName, l2Device, l2GatewayDevice, defaultVlan,
-                        () -> elanInstanceCache.get(logicalSwitchName).orNull());
+                        logicalSwitchName, l2Device, l2GatewayDevice, defaultVlan
+                    );
             return logicalSwitchAddedJob.call();
         }
     }
index 946b350556f48c501a05d8607837d7a84bc9b752..cf6a4c7d062af76adbf7e934b1e2ed80c0c28a28 100644 (file)
@@ -11,13 +11,11 @@ import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.Callable;
-import java.util.function.Supplier;
 import javax.annotation.Nullable;
 import org.opendaylight.netvirt.elan.l2gw.ha.HwvtepHAUtil;
 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils;
 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
 import org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
 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;
@@ -37,18 +35,16 @@ public class DisAssociateHwvtepFromElanJob implements Callable<List<ListenableFu
     private final Integer defaultVlan;
     private final boolean isLastL2GwConnDeleted;
     private final NodeId hwvtepNodeId;
-    private final Supplier<ElanInstance> elanInstanceSupplier;
 
     public DisAssociateHwvtepFromElanJob(ElanL2GatewayUtils elanL2GatewayUtils,
                                          ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils,
-                                         @Nullable L2GatewayDevice l2GatewayDevice,  String elanName,
-                                         Supplier<ElanInstance> elanInstanceSupplier, Devices l2Device,
+                                         @Nullable L2GatewayDevice l2GatewayDevice, String elanName,
+                                         Devices l2Device,
                                          Integer defaultVlan, String nodeId, boolean isLastL2GwConnDeleted) {
         this.elanL2GatewayUtils = elanL2GatewayUtils;
         this.elanL2GatewayMulticastUtils = elanL2GatewayMulticastUtils;
         this.l2GatewayDevice = l2GatewayDevice;
         this.elanName = elanName;
-        this.elanInstanceSupplier = elanInstanceSupplier;
         this.l2Device = l2Device;
         this.defaultVlan = defaultVlan;
         this.isLastL2GwConnDeleted = isLastL2GwConnDeleted;
index 1da0b0c9a0072aa795faa555abbd35403b5c5d88..75b65bf0da292cbb70e082e652364c2bbe696e99 100644 (file)
@@ -11,12 +11,10 @@ import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.Callable;
-import java.util.function.Supplier;
 import org.opendaylight.netvirt.elan.l2gw.ha.HwvtepHAUtil;
 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils;
 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
 import org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
 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;
@@ -42,19 +40,16 @@ public class LogicalSwitchAddedJob implements Callable<List<ListenableFuture<Voi
 
     private final ElanL2GatewayUtils elanL2GatewayUtils;
     private final ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils;
-    private final Supplier<ElanInstance> elanInstanceSupplier;
 
     public LogicalSwitchAddedJob(ElanL2GatewayUtils elanL2GatewayUtils,
                                  ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils, String logicalSwitchName,
-                                 Devices physicalDevice, L2GatewayDevice l2GatewayDevice, Integer defaultVlanId,
-                                 Supplier<ElanInstance> elanInstanceSupplier) {
+                                 Devices physicalDevice, L2GatewayDevice l2GatewayDevice, Integer defaultVlanId) {
         this.elanL2GatewayUtils = elanL2GatewayUtils;
         this.elanL2GatewayMulticastUtils = elanL2GatewayMulticastUtils;
         this.logicalSwitchName = logicalSwitchName;
         this.physicalDevice = physicalDevice;
         this.elanL2GwDevice = l2GatewayDevice;
         this.defaultVlanId = defaultVlanId;
-        this.elanInstanceSupplier = elanInstanceSupplier;
         LOG.debug("created logical switch added job for {} {}", logicalSwitchName, elanL2GwDevice.getHwvtepNodeId());
     }
 
diff --git a/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/listeners/HwvtepLocalUcastMacListener.java b/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/listeners/HwvtepLocalUcastMacListener.java
deleted file mode 100644 (file)
index 1ce9f86..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.netvirt.elan.l2gw.listeners;
-
-import java.util.Collections;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.genius.datastoreutils.hwvtep.HwvtepClusteredDataTreeChangeListener;
-import org.opendaylight.genius.utils.batching.ResourceBatchingManager;
-import org.opendaylight.genius.utils.hwvtep.HwvtepNodeHACache;
-import org.opendaylight.genius.utils.hwvtep.HwvtepUtils;
-import org.opendaylight.netvirt.elan.cache.ElanInstanceCache;
-import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
-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.yang.types.rev130715.IetfYangUtil;
-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.elan.rev150602.elan.instances.ElanInstance;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalUcastMacs;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A listener for Ucast MAC entries that are added/removed to/from an External
- * Device (e.g., TOR).
- *
- * <p>When a Ucast MAC addr appears in the hwvtep's operational DS, that MAC must
- * be populated in DMAC tables in all Elan participating DPNs. ELAN is selected
- * according to field 'tunnel_key' of the Logical Switch to which the new MAC
- * belongs.
- */
-public class HwvtepLocalUcastMacListener extends
-        HwvtepClusteredDataTreeChangeListener<LocalUcastMacs, HwvtepLocalUcastMacListener> {
-
-    private static final Logger LOG = LoggerFactory.getLogger(HwvtepLocalUcastMacListener.class);
-
-    private final DataBroker broker;
-    private final ElanL2GatewayUtils elanL2GatewayUtils;
-    private final ElanInstanceCache elanInstanceCache;
-
-    public HwvtepLocalUcastMacListener(DataBroker broker, ElanL2GatewayUtils elanL2GatewayUtils,
-            ElanInstanceCache elanInstanceCache, HwvtepNodeHACache hwvtepNodeHACache) {
-        super(LocalUcastMacs.class, HwvtepLocalUcastMacListener.class, hwvtepNodeHACache);
-
-        this.broker = broker;
-        this.elanL2GatewayUtils = elanL2GatewayUtils;
-        this.elanInstanceCache = elanInstanceCache;
-        ResourceBatchingManager.getInstance().registerDefaultBatchHandlers(this.broker);
-    }
-
-    public void init() {
-        registerListener(LogicalDatastoreType.OPERATIONAL, broker);
-    }
-
-    @Override
-    protected void removed(InstanceIdentifier<LocalUcastMacs> identifier, LocalUcastMacs macRemoved) {
-        String hwvtepNodeId = identifier.firstKeyOf(Node.class).getNodeId().getValue();
-        MacAddress macAddress = IetfYangUtil.INSTANCE.canonizeMacAddress(macRemoved.getMacEntryKey());
-
-        LOG.trace("LocalUcastMacs {} removed from {}", macAddress.getValue(), hwvtepNodeId);
-
-        String elanName = getElanName(macRemoved);
-
-        L2GatewayDevice elanL2GwDevice = ElanL2GwCacheUtils.getL2GatewayDeviceFromCache(elanName, hwvtepNodeId);
-        if (elanL2GwDevice == null) {
-            LOG.warn("Could not find L2GatewayDevice for ELAN: {}, nodeID:{} from cache", elanName, hwvtepNodeId);
-            return;
-        }
-
-        // Remove MAC from cache
-        elanL2GwDevice.removeUcastLocalMac(macRemoved);
-        elanL2GatewayUtils.unInstallL2GwUcastMacFromL2gwDevices(elanName, elanL2GwDevice,
-                Collections.singletonList(macAddress));
-        elanL2GatewayUtils.unInstallL2GwUcastMacFromElanDpns(elanInstanceCache.get(elanName).orNull(),
-                elanL2GwDevice, Collections.singletonList(macAddress));
-    }
-
-    protected String getElanName(LocalUcastMacs mac) {
-        return mac.getLogicalSwitchRef().getValue()
-                .firstKeyOf(LogicalSwitches.class).getHwvtepNodeName().getValue();
-    }
-
-    @Override
-    protected void updated(InstanceIdentifier<LocalUcastMacs> identifier, LocalUcastMacs original,
-            LocalUcastMacs update) {
-        // TODO (eperefr) what can change here?
-
-    }
-
-    @Override
-    public void added(InstanceIdentifier<LocalUcastMacs> identifier, LocalUcastMacs macAdded) {
-        String hwvtepNodeId = identifier.firstKeyOf(Node.class).getNodeId().getValue();
-        String macAddress = IetfYangUtil.INSTANCE.canonizeMacAddress(macAdded.getMacEntryKey()).getValue();
-
-        LOG.trace("LocalUcastMacs {} added to {}", macAddress, hwvtepNodeId);
-
-        String elanName = getElanName(macAdded);
-        ElanInstance elan = elanInstanceCache.get(elanName).orNull();
-        if (elan == null) {
-            LOG.warn("Could not find ELAN for mac {} being added", macAddress);
-            return;
-        }
-
-        L2GatewayDevice elanL2GwDevice = ElanL2GwCacheUtils.getL2GatewayDeviceFromCache(elanName, hwvtepNodeId);
-        if (elanL2GwDevice == null) {
-            LOG.warn("Could not find L2GatewayDevice for ELAN: {}, nodeID:{} from cache", elanName, hwvtepNodeId);
-            return;
-        }
-
-        // Cache MAC for furthur processing later
-        elanL2GwDevice.addUcastLocalMac(macAdded);
-
-        elanL2GatewayUtils.installL2GwUcastMacInElan(elan, elanL2GwDevice, macAddress, macAdded, null);
-    }
-
-    @Override
-    protected InstanceIdentifier<LocalUcastMacs> getWildCardPath() {
-        return HwvtepUtils.getWildCardPathForLocalUcastMacs();
-    }
-
-    @Override
-    protected HwvtepLocalUcastMacListener getDataTreeChangeListener() {
-        return this;
-    }
-}
index 4ce137005fe112b931ef0b622dc1ed4153807b9c..62e8796cdb420fd49fd80a4c16249a0e434da1e1 100644 (file)
@@ -143,7 +143,7 @@ public class HwvtepLogicalSwitchListener extends
 
             LogicalSwitchAddedJob logicalSwitchAddedWorker = new LogicalSwitchAddedJob(
                     elanL2GatewayUtils, elanL2GatewayMulticastUtils, logicalSwitchName, physicalDevice, elanDevice,
-                    defaultVlanId, () -> elanInstanceCache.get(logicalSwitchName).orNull());
+                    defaultVlanId);
             elanClusterUtils.runOnlyInOwnerNode(logicalSwitchAddedWorker.getJobKey(),
                     "create vlan mappings and mcast configurations", logicalSwitchAddedWorker);
         } catch (RuntimeException e) {
index 0b69b50b6f2f6c3772c385e5762283288845e058..a6623cb37807274cbce4b9fa68c6381548c51699 100644 (file)
@@ -275,19 +275,6 @@ public class ElanL2GatewayUtils {
         return HwvtepUtils.deleteRemoteUcastMacs(broker, nodeId, logicalSwitchName, lstMac);
     }
 
-    @Nullable
-    public ElanInstance getElanInstanceForUcastLocalMac(LocalUcastMacs localUcastMac) {
-        Optional<LogicalSwitches> lsOpc = ElanUtils.read(broker, LogicalDatastoreType.OPERATIONAL,
-                (InstanceIdentifier<LogicalSwitches>) localUcastMac.getLogicalSwitchRef().getValue());
-        if (lsOpc.isPresent()) {
-            LogicalSwitches ls = lsOpc.get();
-            // Logical switch name is Elan name
-            String elanName = getElanFromLogicalSwitch(ls.getHwvtepNodeName().getValue());
-            return elanInstanceCache.get(elanName).orNull();
-        }
-        return null;
-    }
-
     /**
      * Install external device local macs in dpn.
      *
@@ -895,19 +882,6 @@ public class ElanL2GatewayUtils {
         });
     }
 
-    /**
-     * Gets the elan name from logical switch name.
-     *
-     * @param logicalSwitchName
-     *            the logical switch name
-     * @return the elan name from logical switch name
-     */
-    public static String getElanFromLogicalSwitch(String logicalSwitchName) {
-        // Assuming elan name is same as logical switch name
-        String elanName = logicalSwitchName;
-        return elanName;
-    }
-
     /**
      * Gets the logical switch name from elan name.
      *
@@ -1065,10 +1039,6 @@ public class ElanL2GatewayUtils {
         }
     }
 
-    public static String getNodeIdFromDpnId(BigInteger dpnId) {
-        return MDSALUtil.NODE_PREFIX + MDSALUtil.SEPARATOR + dpnId.toString();
-    }
-
     public void scheduleAddDpnMacInExtDevices(String elanName, BigInteger dpId,
             List<PhysAddress> staticMacAddresses) {
         ConcurrentMap<String, L2GatewayDevice> elanDevices = ElanL2GwCacheUtils.getInvolvedL2GwDevices(elanName);
index 8cb813b52c44d6d7eb4ae9068cca0aff531769a6..cea2408db0a74d09f18e5f075979669a507351fc 100644 (file)
@@ -269,8 +269,8 @@ public class L2GatewayConnectionUtils implements AutoCloseable {
 
             DisAssociateHwvtepFromElanJob disAssociateHwvtepToElanJob =
                     new DisAssociateHwvtepFromElanJob(elanL2GatewayUtils, elanL2GatewayMulticastUtils,
-                            elanL2GwDevice, elanName, () -> elanInstanceCache.get(elanName).orNull(),
-                            l2Device, defaultVlan, hwvtepNodeId, isLastL2GwConnDeleted);
+                            elanL2GwDevice, elanName,
+                        l2Device, defaultVlan, hwvtepNodeId, isLastL2GwConnDeleted);
             elanClusterUtils.runOnlyInOwnerNode(disAssociateHwvtepToElanJob.getJobKey(), "remove l2gw connection job",
                     disAssociateHwvtepToElanJob);
         }
index d79b270e067ccc8a96e796de9dcd0819160f46e2..d23c7c8696d008afd2658e666f9d38bacafbb0c5 100755 (executable)
@@ -59,18 +59,7 @@ public class ElanStatisticsImpl implements ElanStatisticsService {
             return getFutureWithAppErrorMessage(rpcResultBuilder,
                     String.format("Interface %s is not a ELAN interface", interfaceName));
         }
-        String elanInstanceName = elanInterface.get().getElanInstanceName();
         InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(interfaceName);
-        //FIXME [ELANBE] Get this API Later
-        short tableId = 0;
-//        try {
-//
-//            //tableId = interfaceManager.getTableIdForService(interfaceName, serviceInfo);
-//        } catch (InterfaceNotFoundException | InterfaceServiceNotFoundException e) {
-//            rpcResultBuilder = RpcResultBuilder.failed();
-//            return getFutureWithAppErrorMessage(rpcResultBuilder,
-//                String.format("Interface %s or Service %s doesn't exist", interfaceName, serviceInfo));
-//        }
         if (!interfaceInfo.isOperational()) {
             LOG.debug("interface {} is down and returning with no statistics", interfaceName);
             rpcResultBuilder = RpcResultBuilder.success();
@@ -81,44 +70,11 @@ public class ElanStatisticsImpl implements ElanStatisticsService {
                             .build()).buildFuture();
         }
         rpcResultBuilder = RpcResultBuilder.success();
-        return Futures.immediateFuture(rpcResultBuilder
-                .withResult(queryforElanInterfaceStatistics(tableId, elanInstanceName, interfaceInfo)).build());
+        return Futures.immediateFuture(rpcResultBuilder.withResult(queryforElanInterfaceStatistics()).build());
     }
 
     @Nullable
-    private GetElanInterfaceStatisticsOutput queryforElanInterfaceStatistics(short tableId, String elanInstanceName,
-            InterfaceInfo interfaceInfo) {
-//        BigInteger dpId = interfaceInfo.getDpId();
-//        List<MatchInfo> matches;
-//        String interfaceName = interfaceInfo.getInterfaceName();
-//        if (interfaceInfo instanceof VlanInterfaceInfo) {
-//            VlanInterfaceInfo vlanInterfaceInfo = (VlanInterfaceInfo)interfaceInfo;
-//            matches = InterfaceServiceUtil.getMatchInfoForVlanLPort(dpId, interfaceInfo.getPortNo(),
-//                InterfaceServiceUtil.getVlanId(interfaceName, dataBroker), vlanInterfaceInfo.isVlanTransparent());
-//        } else {
-//            matches = InterfaceServiceUtil.getLPortDispatcherMatches(
-//                    ServiceIndex.getIndex(NwConstants.ELAN_SERVICE_NAME, NwConstants.ELAN_SERVICE_INDEX),
-//                    interfaceInfo.getInterfaceTag());
-//        }
-//        long groupId = interfaceInfo.getGroupId();
-//        Set<Object> statRequestKeys = InterfaceServiceUtil.getStatRequestKeys(dpId, tableId, matches,
-//                String.format("%s.%s", elanInstanceName, interfaceName), groupId);
-        // StatisticsInfo statsInfo = new StatisticsInfo(statRequestKeys);
-//        org.opendaylight.vpnservice.ericsson.mdsalutil.statistics.StatResult statResult
-//            = mdsalMgr.queryForStatistics(interfaceName, statsInfo);
-//        ResultCode resultCode = ResultCode.Success;
-//        if (!statResult.isComplete()) {
-//            resultCode = ResultCode.Incomplete;
-//        }
-
-        //StatValue ingressFlowStats = statResult.getStatResult(InterfaceServiceUtil
-//            .getFlowStatisticsKey(dpId, tableId, matches, elanInstanceName));
-        //StatValue groupStats = statResult.getStatResult(InterfaceServiceUtil.getGroupStatisticsKey(dpId, groupId));
-//      return new GetElanInterfaceStatisticsOutputBuilder().setStatResult(new
-//          StatResultBuilder().setStatResultCode(resultCode)
-//                .setByteRxCount(ingressFlowStats.getByteCount()).setPacketRxCount(ingressFlowStats.getPacketCount())
-//                .setByteTxCount(groupStats.getByteCount()).setPacketTxCount(groupStats.getPacketCount()).build())
-//                .build();
+    private GetElanInterfaceStatisticsOutput queryforElanInterfaceStatistics() {
         return null;
     }
 
index e373f55166512834f157c2f0b1eaf8a48a6ccf9a..60c264b4772ccd7fbc5561723bced82deb00c368 100644 (file)
@@ -18,7 +18,6 @@ import java.util.List;
 import javax.annotation.Nullable;
 import javax.inject.Inject;
 import javax.inject.Singleton;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.genius.mdsalutil.MDSALUtil;
 import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.NwConstants;
@@ -42,15 +41,13 @@ public class ElanDmacUtils {
     private static final boolean SH_FLAG_SET = true;
     private static final boolean SH_FLAG_UNSET = false;
 
-    private final DataBroker broker;
     private final ElanItmUtils elanItmUtils;
     private final ElanEtreeUtils elanEtreeUtils;
     private final ElanInterfaceCache elanInterfaceCache;
 
     @Inject
-    public ElanDmacUtils(DataBroker broker, ElanItmUtils elanItmUtils, ElanEtreeUtils elanEtreeUtils,
+    public ElanDmacUtils(ElanItmUtils elanItmUtils, ElanEtreeUtils elanEtreeUtils,
             ElanInterfaceCache elanInterfaceCache) {
-        this.broker = broker;
         this.elanItmUtils = elanItmUtils;
         this.elanEtreeUtils = elanEtreeUtils;
         this.elanInterfaceCache = elanInterfaceCache;
@@ -100,81 +97,6 @@ public class ElanDmacUtils {
                 ElanConstants.COOKIE_ELAN_KNOWN_DMAC.add(BigInteger.valueOf(elanTag)), mkMatches, mkInstructions);
     }
 
-    /**
-     * Installs a Flow in the specified DPN's DMAC table. The flow is for a MAC
-     * that is connected remotely in an External Device (TOR) and that is
-     * accessible through an external tunnel. It also installs the flow for
-     * dropping the packet if it came over an ITM tunnel (that is, if the
-     * Split-Horizon flag is set)
-     *
-     * @param dpnId
-     *            Id of the DPN where the flow must be installed
-     * @param extDeviceNodeId
-     *            the ext device node id
-     * @param elanTag
-     *            the elan tag
-     * @param vni
-     *            the vni
-     * @param macAddress
-     *            the mac address
-     * @param displayName
-     *            the display name
-     * @param interfaceName
-     *            the interface name
-     *
-     * @return the dmac flows
-     */
-    public List<ListenableFuture<Void>> installDmacFlowsToExternalRemoteMac(BigInteger dpnId,
-            String extDeviceNodeId, Long elanTag, Long vni, String macAddress, String displayName,
-            String interfaceName) {
-        synchronized (ElanUtils.getElanMacDPNKey(elanTag, macAddress, dpnId)) {
-            Flow flow = buildDmacFlowForExternalRemoteMac(dpnId, extDeviceNodeId, elanTag, vni, macAddress,
-                    displayName);
-            ResourceBatchingManager.getInstance().put(
-                    ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY, ElanUtils.getFlowIid(flow, dpnId), flow);
-
-            Flow dropFlow = buildDmacFlowDropIfPacketComingFromTunnel(dpnId, extDeviceNodeId, elanTag, macAddress);
-            ResourceBatchingManager.getInstance().put(ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY,
-                    ElanUtils.getFlowIid(dropFlow, dpnId), dropFlow);
-            installEtreeDmacFlowsToExternalRemoteMac(dpnId, extDeviceNodeId, elanTag, vni, macAddress, displayName,
-                    interfaceName);
-        }
-        return Collections.emptyList();
-    }
-
-    /**
-     * Installs or removes flows in DMAC table for MACs that are/were located in
-     * an external Elan Device.
-     *
-     * @param dpId
-     *            Id of the DPN where the DMAC table is going to be modified
-     * @param extNodeId
-     *            Id of the External Device where the MAC is located
-     * @param elanTag
-     *            Id of the ELAN
-     * @param vni
-     *            VNI of the LogicalSwitch to which the MAC belongs to, and that
-     *            is associated with the ELAN
-     * @param macAddress
-     *            the mac address
-     * @param elanInstanceName
-     *            the elan instance name
-     * @param addOrRemove
-     *            Indicates if flows must be installed or removed.
-     * @param interfaceName
-     *            the interface name
-     * @see org.opendaylight.genius.mdsalutil.MDSALUtil.MdsalOp
-     */
-    public void setupDmacFlowsToExternalRemoteMac(BigInteger dpId, String extNodeId, Long elanTag, Long vni,
-            String macAddress, String elanInstanceName, MDSALUtil.MdsalOp addOrRemove, String interfaceName) {
-        if (addOrRemove == MDSALUtil.MdsalOp.CREATION_OP) {
-            installDmacFlowsToExternalRemoteMac(dpId, extNodeId, elanTag, vni, macAddress, elanInstanceName,
-                    interfaceName);
-        } else if (addOrRemove == MDSALUtil.MdsalOp.REMOVAL_OP) {
-            deleteDmacFlowsToExternalMac(elanTag, dpId, extNodeId, macAddress);
-        }
-    }
-
     /**
      * Delete dmac flows to external mac.
      *
@@ -229,53 +151,6 @@ public class ElanDmacUtils {
                 ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY, ElanUtils.getFlowIid(flowToRemove, dpId));
     }
 
-    private List<ListenableFuture<Void>> installEtreeDmacFlowsToExternalRemoteMac(
-            BigInteger dpnId, String extDeviceNodeId, Long elanTag,
-            Long vni, String macAddress, String displayName, String interfaceName) {
-        EtreeLeafTagName etreeLeafTag = elanEtreeUtils.getEtreeLeafTagByElanTag(elanTag);
-        if (etreeLeafTag != null) {
-            return Lists.newArrayList(
-                buildEtreeDmacFlowDropIfPacketComingFromTunnel(
-                    dpnId, extDeviceNodeId, macAddress, etreeLeafTag),
-                buildEtreeDmacFlowForExternalRemoteMac(
-                        dpnId, extDeviceNodeId, vni, macAddress, displayName, interfaceName, etreeLeafTag));
-        }
-        return Collections.emptyList();
-    }
-
-    private ListenableFuture<Void> buildEtreeDmacFlowForExternalRemoteMac(
-            BigInteger dpnId, String extDeviceNodeId, Long vni,
-            String macAddress, String displayName, String interfaceName,
-            EtreeLeafTagName etreeLeafTag) {
-        boolean isRoot;
-        if (interfaceName == null) {
-            isRoot = true;
-        } else {
-            Optional<EtreeInterface> etreeInterface = elanInterfaceCache.getEtreeInterface(interfaceName);
-            isRoot = etreeInterface.isPresent() ? etreeInterface.get().getEtreeInterfaceType()
-                    == EtreeInterface.EtreeInterfaceType.Root : false;
-        }
-        if (isRoot) {
-            Flow flow = buildDmacFlowForExternalRemoteMac(dpnId, extDeviceNodeId,
-                    etreeLeafTag.getEtreeLeafTag().getValue(), vni, macAddress, displayName);
-            return ResourceBatchingManager.getInstance().put(
-                    ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY, ElanUtils.getFlowIid(flow, dpnId), flow);
-        }
-        return Futures.immediateFuture(null);
-    }
-
-    private ListenableFuture<Void> buildEtreeDmacFlowDropIfPacketComingFromTunnel(
-            BigInteger dpnId, String extDeviceNodeId, String macAddress, EtreeLeafTagName etreeLeafTag) {
-        if (etreeLeafTag != null) {
-            Flow dropFlow = buildDmacFlowDropIfPacketComingFromTunnel(dpnId, extDeviceNodeId,
-                    etreeLeafTag.getEtreeLeafTag().getValue(), macAddress);
-            return ResourceBatchingManager.getInstance().put(
-                    ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY, ElanUtils.getFlowIid(dropFlow, dpnId),
-                    dropFlow);
-        }
-        return Futures.immediateFuture(null);
-    }
-
     /**
      * Builds the flow that drops the packet if it came through an external
      * tunnel, that is, if the Split-Horizon flag is set.
index d6599a9c50a0778275ff1fb23945f66df4fb9b30..13794f82f1f101707997717db25c8d2677a1621c 100644 (file)
@@ -13,24 +13,18 @@ import static org.opendaylight.genius.infra.Datastore.OPERATIONAL;
 
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.ListenableFuture;
-
 import java.util.ArrayList;
 import java.util.List;
-
 import java.util.concurrent.ExecutionException;
 import javax.inject.Inject;
 import javax.inject.Singleton;
-
 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.genius.infra.Datastore.Operational;
 import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
 import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
 import org.opendaylight.genius.infra.TypedReadWriteTransaction;
 import org.opendaylight.genius.interfacemanager.globals.InterfaceInfo;
 import org.opendaylight.infrautils.utils.concurrent.ListenableFutures;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry;
@@ -152,13 +146,4 @@ public class ElanForwardingEntriesHandler {
             ListenableFutures.addErrorLogging(future, LOG, "Error deleting ELAN interface forwarding entries");
         }
     }
-
-    public void deleteElanInterfaceMacForwardingEntries(String interfaceName, PhysAddress physAddress,
-            WriteTransaction tx) {
-        InstanceIdentifier<MacEntry> macEntryId = ElanUtils
-                .getInterfaceMacEntriesIdentifierOperationalDataPath(interfaceName, physAddress);
-        tx.delete(LogicalDatastoreType.OPERATIONAL, macEntryId);
-    }
-
-
 }
index 334f871b103ffa0a6d2ca3e4a4078561d0d076fb..c3ca78d1935d6e110554337c9cd615d2f2a515af 100755 (executable)
@@ -50,7 +50,6 @@ import org.opendaylight.genius.infra.TypedReadTransaction;
 import org.opendaylight.genius.infra.TypedReadWriteTransaction;
 import org.opendaylight.genius.infra.TypedWriteTransaction;
 import org.opendaylight.genius.interfacemanager.globals.InterfaceInfo;
-import org.opendaylight.genius.interfacemanager.globals.InterfaceServiceUtil;
 import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
 import org.opendaylight.genius.itm.api.IITMProvider;
 import org.opendaylight.genius.itm.globals.ITMConstants;
@@ -147,7 +146,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev16061
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTagNameBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanForwardingTables;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInstances;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInterfaceForwardingEntries;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInterfaces;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanState;
@@ -312,18 +310,6 @@ public class ElanUtils {
         Futures.addCallback(tx.submit(), DEFAULT_CALLBACK, MoreExecutors.directExecutor());
     }
 
-    @SuppressWarnings("checkstyle:ForbidCertainMethod")
-    public static <T extends DataObject> void delete(DataBroker broker, LogicalDatastoreType datastoreType,
-            InstanceIdentifier<T> path, FutureCallback<Void> callback) {
-        WriteTransaction tx = broker.newWriteOnlyTransaction();
-        tx.delete(datastoreType, path);
-        Futures.addCallback(tx.submit(), callback, MoreExecutors.directExecutor());
-    }
-
-    public static InstanceIdentifier<ElanInstance> getElanInstanceIdentifier() {
-        return InstanceIdentifier.builder(ElanInstances.class).child(ElanInstance.class).build();
-    }
-
     public static InstanceIdentifier<ElanInterface> getElanInterfaceConfigurationDataPathId(String interfaceName) {
         return InstanceIdentifier.builder(ElanInterfaces.class)
                 .child(ElanInterface.class, new ElanInterfaceKey(interfaceName)).build();
@@ -409,25 +395,6 @@ public class ElanUtils {
         return read(dataBroker, LogicalDatastoreType.OPERATIONAL, elanInterfaceId).orNull();
     }
 
-    /**
-     * Gets the elan interface mac addresses.
-     *
-     * @param interfaceName
-     *            the interface name
-     * @return the elan interface mac addresses
-     */
-    public List<PhysAddress> getElanInterfaceMacAddresses(String interfaceName) {
-        List<PhysAddress> macAddresses = new ArrayList<>();
-        ElanInterfaceMac elanInterfaceMac = getElanInterfaceMacByInterfaceName(interfaceName);
-        if (elanInterfaceMac != null && elanInterfaceMac.getMacEntry() != null) {
-            List<MacEntry> macEntries = elanInterfaceMac.getMacEntry();
-            for (MacEntry macEntry : macEntries) {
-                macAddresses.add(macEntry.getMacAddress());
-            }
-        }
-        return macAddresses;
-    }
-
     public static InstanceIdentifier<ElanInterfaceMac> getElanInterfaceMacEntriesOperationalDataPath(
             String interfaceName) {
         return InstanceIdentifier.builder(ElanInterfaceForwardingEntries.class)
@@ -537,40 +504,6 @@ public class ElanUtils {
         return dpIds;
     }
 
-    /**
-     * To check given dpId is already present in Elan instance. This can be used
-     * to program flow entry in external tunnel table when a new access port
-     * added for first time into the ELAN instance
-     *
-     * @param dpId
-     *            the dp id
-     * @param elanInstanceName
-     *            the elan instance name
-     * @return true if dpId is already present, otherwise return false
-     */
-    public boolean isDpnAlreadyPresentInElanInstance(BigInteger dpId, String elanInstanceName) {
-        InstanceIdentifier<ElanDpnInterfacesList> elanDpnInterfaceId = getElanDpnOperationDataPath(elanInstanceName);
-        Optional<ElanDpnInterfacesList> existingElanDpnInterfaces = read(broker,
-                LogicalDatastoreType.OPERATIONAL, elanDpnInterfaceId);
-        if (!existingElanDpnInterfaces.isPresent()) {
-            return false;
-        }
-        List<DpnInterfaces> dpnInterfaces = existingElanDpnInterfaces.get().nonnullDpnInterfaces();
-        for (DpnInterfaces dpnInterface : dpnInterfaces) {
-            if (Objects.equals(dpnInterface.getDpId(), dpId)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    @Nullable
-    public ElanForwardingTables getElanForwardingList() {
-        InstanceIdentifier<ElanForwardingTables> elanForwardingTableId = InstanceIdentifier
-                .builder(ElanForwardingTables.class).build();
-        return read(broker, LogicalDatastoreType.OPERATIONAL, elanForwardingTableId).orNull();
-    }
-
     public static long getElanRemoteBroadCastGroupID(long elanTag) {
         return ElanConstants.ELAN_GID_MIN + elanTag % ElanConstants.ELAN_GID_MIN * 2;
     }
@@ -1230,11 +1163,6 @@ public class ElanUtils {
         return read(broker, LogicalDatastoreType.CONFIGURATION, node).isPresent();
     }
 
-    public static ServicesInfo getServiceInfo(String elanInstanceName, String interfaceName) {
-        return InterfaceServiceUtil.buildServiceInfo(elanInstanceName + "." + interfaceName,
-                ElanConstants.ELAN_SERVICE_PRIORITY);
-    }
-
     public static String getElanServiceName(String elanName, String interfaceName) {
         return "elan." + elanName + interfaceName;
     }
@@ -1405,19 +1333,6 @@ public class ElanUtils {
         return idBuilder.build();
     }
 
-    @CheckReturnValue
-    public static CheckedFuture<Void, TransactionCommitFailedException> waitForTransactionToComplete(
-            WriteTransaction tx) {
-        CheckedFuture<Void, TransactionCommitFailedException> futures = tx.submit();
-        try {
-            futures.get();
-        } catch (InterruptedException | ExecutionException e) {
-            // NETVIRT-1215: Do not log.error() here, only debug(); but callers *MUST* @CheckReturnValue
-            LOG.debug("Error writing to datastore", e);
-        }
-        return futures;
-    }
-
     @CheckReturnValue
     public static ListenableFuture<Void> waitForTransactionToComplete(ListenableFuture<Void> future) {
         try {
@@ -1592,18 +1507,6 @@ public class ElanUtils {
                         new StaticMacEntriesKey(new PhysAddress(macAddress))).build();
     }
 
-    public static List<StaticMacEntries> getDeletedEntries(List<StaticMacEntries> originalStaticMacEntries,
-                                                           List<StaticMacEntries> updatedStaticMacEntries) {
-        if (isEmpty(originalStaticMacEntries)) {
-            return Collections.EMPTY_LIST;
-        }
-        List<StaticMacEntries> deleted = Lists.newArrayList(originalStaticMacEntries);
-        if (isNotEmpty(updatedStaticMacEntries)) {
-            deleted.removeAll(updatedStaticMacEntries);
-        }
-        return deleted;
-    }
-
     public static <T> List<T> diffOf(List<T> orig, List<T> updated) {
         if (isEmpty(orig)) {
             return Collections.EMPTY_LIST;
@@ -1615,18 +1518,6 @@ public class ElanUtils {
         return diff;
     }
 
-    public static void segregateToBeDeletedAndAddEntries(List<StaticMacEntries> originalStaticMacEntries,
-                                                             List<StaticMacEntries> updatedStaticMacEntries) {
-        if (isNotEmpty(updatedStaticMacEntries)) {
-            List<StaticMacEntries> existingClonedStaticMacEntries = new ArrayList<>();
-            if (isNotEmpty(originalStaticMacEntries)) {
-                existingClonedStaticMacEntries.addAll(0, originalStaticMacEntries);
-                originalStaticMacEntries.removeAll(updatedStaticMacEntries);
-                updatedStaticMacEntries.removeAll(existingClonedStaticMacEntries);
-            }
-        }
-    }
-
     public static boolean isEmpty(Collection collection) {
         return collection == null || collection.isEmpty();
     }
index 89fae2567b70d7bad62b35df8cde9f3e54d7e098..9b0739d6050b3a10b994204227cd626c82a6bf68 100644 (file)
   <service ref="elanServiceProvider" odl:type="default"
     interface="org.opendaylight.netvirt.elanmanager.api.IElanService" />
 
-  <service ref="elanBridgeManager" odl:type="default"
-    interface="org.opendaylight.netvirt.elanmanager.api.IElanBridgeManager" />
-
-  <!--<bean id="hwvtepLocalUcastMacListener"
-    class="org.opendaylight.netvirt.elan.l2gw.listeners.HwvtepLocalUcastMacListener"
-    init-method="init" destroy-method="close">
-    <argument ref="dataBroker" />
-    <argument ref="elanL2GatewayUtils" />
-  </bean>-->
-
   <service ref="l2gwServiceProvider" odl:type="default"
            interface="org.opendaylight.netvirt.elanmanager.api.IL2gwService" />