neutronvpn dead code removal 92/81092/4
authorStephen Kitt <skitt@redhat.com>
Thu, 21 Mar 2019 14:05:57 +0000 (15:05 +0100)
committerFaseela K <faseela.k@ericsson.com>
Mon, 1 Apr 2019 05:00:25 +0000 (05:00 +0000)
This patch removes unused methods, classes and fields.

Change-Id: I3241d203ac11f02dc9ab17209a624eb8ddbcdfd1
Signed-off-by: Stephen Kitt <skitt@redhat.com>
neutronvpn/api/src/main/java/org/opendaylight/netvirt/neutronvpn/api/l2gw/L2GatewayDevice.java
neutronvpn/api/src/main/java/org/opendaylight/netvirt/neutronvpn/api/utils/ChangeUtils.java
neutronvpn/api/src/main/java/org/opendaylight/netvirt/neutronvpn/api/utils/NeutronUtils.java
neutronvpn/api/src/main/java/org/opendaylight/netvirt/neutronvpn/interfaces/INeutronVpnManager.java
neutronvpn/impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronSubnetGwMacResolver.java
neutronvpn/impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronvpnManager.java
neutronvpn/impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronvpnManagerImpl.java
neutronvpn/impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronvpnNatManager.java
neutronvpn/impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronvpnUtils.java
neutronvpn/impl/src/main/java/org/opendaylight/netvirt/neutronvpn/evpn/utils/NeutronEvpnUtils.java
neutronvpn/impl/src/main/java/org/opendaylight/netvirt/neutronvpn/l2gw/L2GatewayUtils.java

index 65a29b04cce6702a33f7856a91be1e0537e11971..43744491a83fb337d3c3bb07ed3080fd81fa7b19 100644 (file)
@@ -143,14 +143,6 @@ public class L2GatewayDevice {
         l2GatewayIds.remove(l2GatewayId);
     }
 
-    /**
-     * Clear hwvtep node data.
-     */
-    public void clearHwvtepNodeData() {
-        tunnelIps.clear();
-        hwvtepNodeId = null;
-    }
-
     /**
      * Sets the tunnel ips.
      *
index 3690d793dd06a9a2d0586d95a49f4dd92c262b7b..dc578e58f917305024808e09e3150a01b4074edb 100644 (file)
@@ -46,21 +46,11 @@ public final class ChangeUtils {
         return input -> input != null && input.getDataAfter() != null && filter.test(input);
     }
 
-    private static <T extends DataObject> Predicate<DataObjectModification<T>> matchesEverything() {
-        return input -> true;
-    }
-
     private static <T extends DataObject> Predicate<DataObjectModification<T>> modificationIsDeletion() {
         return input -> input != null && input.getModificationType() == DataObjectModification
                 .ModificationType.DELETE;
     }
 
-    private static <T extends DataObject> Predicate<DataObjectModification<T>>
-            modificationIsDeletionAndHasDataBefore() {
-        return input -> input != null && input.getModificationType() == DataObjectModification
-                .ModificationType.DELETE && input.getDataBefore() != null;
-    }
-
     /**
      * Extract all the instances of {@code clazz} which were created in the given set of modifications.
      *
@@ -111,38 +101,6 @@ public final class ChangeUtils {
         return result;
     }
 
-    /**
-     * Extract all the instances of {@code clazz} which were created or updated in the given set of modifications.
-     *
-     * @param changes The changes to process.
-     * @param clazz The class we're interested in.
-     * @param <T> The type of changes we're interested in.
-     * @param <U> The type of changes to process.
-     * @return The created or updated instances, mapped by instance identifier.
-     */
-    public static <T extends DataObject, U extends DataObject> Map<InstanceIdentifier<T>, T> extractCreatedOrUpdated(
-            Collection<DataTreeModification<U>> changes, Class<T> clazz) {
-        return extractCreatedOrUpdated(changes, clazz, matchesEverything());
-    }
-
-    /**
-     * Extract all the instances of {@code clazz} which were created, updated, or removed in the given set of
-     * modifications. For instances which were created or updated, the new instances are returned; for instances
-     * which were removed, the old instances are returned.
-     *
-     * @param changes The changes to process.
-     * @param clazz The class we're interested in.
-     * @param <T> The type of changes we're interested in.
-     * @param <U> The type of changes to process.
-     * @return The created, updated or removed instances, mapped by instance identifier.
-     */
-    public static <T extends DataObject, U extends DataObject> Map<InstanceIdentifier<T>, T>
-           extractCreatedOrUpdatedOrRemoved(Collection<DataTreeModification<U>> changes, Class<T> clazz) {
-        Map<InstanceIdentifier<T>, T> result = extractCreatedOrUpdated(changes, clazz);
-        result.putAll(extractRemovedObjects(changes, clazz));
-        return result;
-    }
-
     /**
      * Extract the original instances of class {@code clazz} in the given set of modifications.
      *
@@ -259,43 +217,4 @@ public final class ChangeUtils {
         }
     }
 
-    /**
-     * Extract the removed instances of {@code clazz} from the given set of modifications.
-     *
-     * @param changes The changes to process.
-     * @param clazz The class we're interested in.
-     * @param <T> The type of changes we're interested in.
-     * @param <U> The type of changes to process.
-     * @return The removed instances, keyed by instance identifier.
-     */
-    public static <T extends DataObject, U extends DataObject> Map<InstanceIdentifier<T>, T> extractRemovedObjects(
-            Collection<DataTreeModification<U>> changes, Class<T> clazz) {
-        Map<InstanceIdentifier<T>, T> result = new HashMap<>();
-        for (Entry<InstanceIdentifier<T>, DataObjectModification<T>> entry :
-                extractDataObjectModifications(changes, clazz, modificationIsDeletionAndHasDataBefore()).entrySet()) {
-            result.put(entry.getKey(), entry.getValue().getDataBefore());
-        }
-        return result;
-    }
-
-    public static <T extends DataObject> Map<InstanceIdentifier<T>,T> extract(
-            Map<InstanceIdentifier<?>, DataObject> changes, Class<T> klazz) {
-        Map<InstanceIdentifier<T>,T> result = new HashMap<>();
-        if (changes != null) {
-            for (Entry<InstanceIdentifier<?>, DataObject> created : changes.entrySet()) {
-                if (klazz.isInstance(created.getValue())) {
-                    @SuppressWarnings("unchecked")
-                    T value = (T) created.getValue();
-                    Class<?> type = created.getKey().getTargetType();
-                    if (type.equals(klazz)) {
-                        // Actually checked above
-                        @SuppressWarnings("unchecked")
-                        InstanceIdentifier<T> iid = (InstanceIdentifier<T>) created.getKey();
-                        result.put(iid, value);
-                    }
-                }
-            }
-        }
-        return result;
-    }
 }
index 82170e1763df3b44103c36a006d92c789c2e861b..a0d2ee32a468843ba227c328693580060230becc 100644 (file)
@@ -12,7 +12,6 @@ import com.google.common.base.Preconditions;
 import java.util.Collections;
 import java.util.List;
 import java.util.Locale;
-import java.util.Objects;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import org.eclipse.jdt.annotation.NonNull;
@@ -156,53 +155,6 @@ public final class NeutronUtils {
         return networkType != null && networkType.isAssignableFrom(expectedNetworkType);
     }
 
-    public static <T extends NetworkTypeBase> boolean isNetworkSegmentType(Network network, Long index,
-                                                                           Class<T> expectedNetworkType) {
-        Class<? extends NetworkTypeBase> segmentType = null;
-        NetworkProviderExtension providerExtension = network.augmentation(NetworkProviderExtension.class);
-        if (providerExtension != null) {
-            List<Segments> providerSegments = providerExtension.getSegments();
-            if (providerSegments != null && providerSegments.size() > 0) {
-                for (Segments providerSegment : providerSegments) {
-                    if (Objects.equals(providerSegment.getSegmentationIndex(), index)) {
-                        segmentType = providerSegment.getNetworkType();
-                        break;
-                    }
-                }
-            }
-        }
-        return segmentType != null && segmentType.isAssignableFrom(expectedNetworkType);
-    }
-
-    public static Long getNumberSegmentsFromNeutronNetwork(Network network) {
-        NetworkProviderExtension providerExtension = network.augmentation(NetworkProviderExtension.class);
-        Integer numSegs = 0;
-        if (providerExtension != null) {
-            List<Segments> providerSegments = providerExtension.getSegments();
-            if (providerSegments != null) {
-                numSegs = providerSegments.size();
-            }
-        }
-        return Long.valueOf(numSegs);
-    }
-
-    public static String getSegmentationIdFromNeutronNetworkSegment(Network network, Long index) {
-        String segmentationId = null;
-        NetworkProviderExtension providerExtension = network.augmentation(NetworkProviderExtension.class);
-        if (providerExtension != null) {
-            List<Segments> providerSegments = providerExtension.getSegments();
-            if (providerSegments != null && providerSegments.size() > 0) {
-                for (Segments providerSegment : providerSegments) {
-                    if (Objects.equals(providerSegment.getSegmentationIndex(), index)) {
-                        segmentationId = providerSegment.getSegmentationId();
-                        break;
-                    }
-                }
-            }
-        }
-        return segmentationId;
-    }
-
     public static boolean isUuid(String possibleUuid) {
         Preconditions.checkNotNull(possibleUuid, "possibleUuid == null");
 
index c7a3af896c1dcd749b0768398a411ba6576581bb..a8ce8d8092941567c453d6e7030d87c737df9820 100644 (file)
@@ -20,10 +20,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.s
 
 public interface INeutronVpnManager {
 
-    void addSubnetToVpn(Uuid vpnId, Uuid subnet);
-
-    void removeSubnetFromVpn(Uuid vpnId, Uuid subnet);
-
     List<String> showVpnConfigCLI(Uuid vuuid) throws InterruptedException, ExecutionException;
 
     List<String> showNeutronPortsCLI() throws ReadFailedException;
@@ -32,20 +28,14 @@ public interface INeutronVpnManager {
 
     Port getNeutronPort(String name);
 
-    Port getNeutronPort(Uuid portId);
-
     Subnet getNeutronSubnet(Uuid subnetId);
 
-    IpAddress getNeutronSubnetGateway(Uuid subnetId);
-
     Collection<Uuid> getSubnetIdsForGatewayIp(IpAddress ipAddress);
 
     Uuid getNetworkForSubnet(Uuid subnetId);
 
     List<Uuid> getNetworksForVpn(Uuid vpnId);
 
-    String getOpenDaylightVniRangesConfig();
-
     void programV6InternetFallbackFlow(Uuid routerId, Uuid internetVpnId, int addOrRemove);
 
 }
index 7d70bf78fa3535435c079cebb5cb8961e1a5d268..8b4c68921b106e1e3cf5f7b0710684c3bfc192b8 100644 (file)
@@ -24,7 +24,6 @@ import javax.annotation.PreDestroy;
 import javax.inject.Inject;
 import javax.inject.Singleton;
 import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.genius.arputil.api.ArpConstants;
 import org.opendaylight.genius.mdsalutil.NWUtil;
 import org.opendaylight.infrautils.utils.concurrent.ListenableFutures;
@@ -58,7 +57,6 @@ public class NeutronSubnetGwMacResolver {
     private static final Logger LOG = LoggerFactory.getLogger(NeutronSubnetGwMacResolver.class);
     private static final long L3_INSTALL_DELAY_MILLIS = 5000;
 
-    private final DataBroker broker;
     private final OdlArputilService arpUtilService;
     private final IElanService elanService;
     private final ICentralizedSwitchProvider cswitchProvider;
@@ -68,11 +66,9 @@ public class NeutronSubnetGwMacResolver {
     private final Ipv6NdUtilService ipv6NdUtilService;
 
     @Inject
-    public NeutronSubnetGwMacResolver(final DataBroker broker,
-            final OdlArputilService arputilService, final IElanService elanService,
+    public NeutronSubnetGwMacResolver(final OdlArputilService arputilService, final IElanService elanService,
             final ICentralizedSwitchProvider cswitchProvider, final NeutronvpnUtils neutronvpnUtils,
             final Ipv6NdUtilService ipv6NdUtilService) {
-        this.broker = broker;
         this.arpUtilService = arputilService;
         this.elanService = elanService;
         this.cswitchProvider = cswitchProvider;
index 629ca008e9e4c700f6f606de9822f6d7f0860797..a6896eaf8630d3f5550b492f003ed9468b263bed 100644 (file)
@@ -43,7 +43,6 @@ import javax.inject.Singleton;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.OptimisticLockFailedException;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
@@ -194,7 +193,6 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
 
     private final DataBroker dataBroker;
     private final ManagedNewTransactionRunner txRunner;
-    private final NotificationPublishService notificationPublishService;
     private final VpnRpcService vpnRpcService;
     private final NeutronFloatingToFixedIpMappingChangeListener floatingIpMapListener;
     private final IElanService elanService;
@@ -211,7 +209,7 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
 
     @Inject
     public NeutronvpnManager(
-            final DataBroker dataBroker, final NotificationPublishService notiPublishService,
+            final DataBroker dataBroker,
             final VpnRpcService vpnRpcSrv, final IElanService elanService,
             final NeutronFloatingToFixedIpMappingChangeListener neutronFloatingToFixedIpMappingChangeListener,
             final NeutronvpnConfig neutronvpnConfig, final IVpnManager vpnManager,
@@ -219,7 +217,6 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
             final NeutronvpnUtils neutronvpnUtils) throws TransactionCommitFailedException {
         this.dataBroker = dataBroker;
         this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
-        notificationPublishService = notiPublishService;
         vpnRpcService = vpnRpcSrv;
         this.elanService = elanService;
         floatingIpMapListener = neutronFloatingToFixedIpMappingChangeListener;
@@ -817,7 +814,7 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
 
     protected Adjacencies createPortIpAdjacencies(Port port, Boolean isRouterInterface,
                                                   TypedWriteTransaction<Configuration> wrtConfigTxn,
-                                                  @Nullable Subnetmap sn, @Nullable VpnInterface vpnIface) {
+                                                  @Nullable VpnInterface vpnIface) {
         List<Adjacency> adjList = new ArrayList<>();
         if (vpnIface != null) {
             adjList = vpnIface.augmentation(Adjacencies.class).getAdjacency();
@@ -875,7 +872,7 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
         String infName = port.getUuid().getValue();
         // Handling cluster reboot scenario where VpnInterface already exists in datastore.
         VpnInterface vpnIface = VpnHelper.getVpnInterface(dataBroker, infName);
-        Adjacencies adjs = createPortIpAdjacencies(port, isRouterInterface, wrtConfigTxn, null, vpnIface);
+        Adjacencies adjs = createPortIpAdjacencies(port, isRouterInterface, wrtConfigTxn, vpnIface);
         LOG.trace("createVpnInterface for Port: {}, isRouterInterface: {}", infName, isRouterInterface);
         writeVpnInterfaceToDs(vpnIds, infName, adjs, port.getNetworkId(), isRouterInterface, wrtConfigTxn);
     }
@@ -1651,8 +1648,8 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
                         .equals(NeutronConstants.DEVICE_OWNER_ROUTER_INF) ? true : false;
                 jobCoordinator.enqueueJob("PORT-" + portId.getValue(), () -> singletonList(
                     txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, wrtConfigTxn -> {
-                        Adjacencies portAdj = createPortIpAdjacencies(port, isRouterInterface, wrtConfigTxn, sn,
-                                    vpnIface);
+                        Adjacencies portAdj = createPortIpAdjacencies(port, isRouterInterface, wrtConfigTxn,
+                            vpnIface);
                         if (vpnIface == null) {
                             LOG.trace("addSubnetToVpn: create new VpnInterface for Port {}", vpnInfName);
                             Set<Uuid> listVpn = new HashSet<>();
index 3b8a27bfb3e52a9aac8ba8ce7ed54e786fa2a192..afc5eb8102cefc8500c24fdab8747dbcacd5d8d3 100644 (file)
@@ -47,16 +47,6 @@ public class NeutronvpnManagerImpl implements INeutronVpnManager {
         return nvManager.showVpnConfigCLI(vuuid);
     }
 
-    @Override
-    public void addSubnetToVpn(Uuid vpnId, Uuid subnet) {
-        nvManager.addSubnetToVpn(vpnId, subnet, null /* internet-vpn-id */);
-    }
-
-    @Override
-    public void removeSubnetFromVpn(Uuid vpnId, Uuid subnet) {
-        nvManager.removeSubnetFromVpn(vpnId, subnet, null /* internet-vpn-id */);
-    }
-
     @Override
     public Uuid getNetworkForSubnet(Uuid subnetId) {
         return nvManager.getNetworkForSubnet(subnetId);
@@ -72,31 +62,16 @@ public class NeutronvpnManagerImpl implements INeutronVpnManager {
         return nvManager.getNeutronPort(name);
     }
 
-    @Override
-    public Port getNeutronPort(Uuid portId) {
-        return nvManager.getNeutronPort(portId);
-    }
-
     @Override
     public Subnet getNeutronSubnet(Uuid subnetId) {
         return nvManager.getNeutronSubnet(subnetId);
     }
 
-    @Override
-    public IpAddress getNeutronSubnetGateway(Uuid subnetId) {
-        return nvManager.getNeutronSubnetGateway(subnetId);
-    }
-
     @Override
     public Collection<Uuid> getSubnetIdsForGatewayIp(IpAddress ipAddress) {
         return neutronvpnUtils.getSubnetIdsForGatewayIp(ipAddress);
     }
 
-    @Override
-    public String getOpenDaylightVniRangesConfig() {
-        return nvManager.getOpenDaylightVniRangesConfig();
-    }
-
     @Override
     public void programV6InternetFallbackFlow(Uuid routerId, Uuid internetVpnId, int addOrRemove) {
         nvManager.programV6InternetFallbackFlow(routerId, internetVpnId, addOrRemove);
index f87b98ac0272dbed5417119e2f6773bf41af557d..158a4e0f9ba6c7720f05b7d3935107d86a0caa05 100644 (file)
@@ -74,15 +74,13 @@ public class NeutronvpnNatManager implements AutoCloseable {
 
     private final DataBroker dataBroker;
     private final NeutronvpnUtils neutronvpnUtils;
-    private final NeutronvpnManager nvpnManager;
     private final IElanService elanService;
 
     @Inject
     public NeutronvpnNatManager(final DataBroker dataBroker, final NeutronvpnUtils neutronvpnUtils,
-                                  final NeutronvpnManager neutronvpnManager, final IElanService elanService) {
+                                final IElanService elanService) {
         this.dataBroker = dataBroker;
         this.neutronvpnUtils = neutronvpnUtils;
-        this.nvpnManager = neutronvpnManager;
         this.elanService = elanService;
     }
 
index 6d91d2317468001d1c58841952ee8afa29944b29..27806c64fc26ae24044fd1a649d371a44e090171 100644 (file)
@@ -26,7 +26,6 @@ import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -35,9 +34,7 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
 import java.util.concurrent.locks.ReentrantLock;
-import java.util.stream.Collectors;
 import javax.inject.Inject;
 import javax.inject.Singleton;
 import org.apache.commons.lang3.StringUtils;
@@ -73,9 +70,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInputBuilder;
@@ -150,7 +144,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.por
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.PortKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.portsecurity.rev150712.PortSecurityExtension;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.provider.ext.rev150712.NetworkProviderExtension;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.QosPolicy;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.Subnets;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.subnets.Subnet;
@@ -193,9 +186,6 @@ public class NeutronvpnUtils {
     private final ConcurrentMap<Uuid, Port> portMap = new ConcurrentHashMap<>();
     private final ConcurrentMap<Uuid, Subnet> subnetMap = new ConcurrentHashMap<>();
     private final Map<IpAddress, Set<Uuid>> subnetGwIpMap = new ConcurrentHashMap<>();
-    private final ConcurrentMap<Uuid, QosPolicy> qosPolicyMap = new ConcurrentHashMap<>();
-    private final ConcurrentMap<Uuid, HashMap<Uuid, Port>> qosPortsMap = new ConcurrentHashMap<>();
-    private final ConcurrentMap<Uuid, HashMap<Uuid, Network>> qosNetworksMap = new ConcurrentHashMap<>();
 
     private final DataBroker dataBroker;
     private final ManagedNewTransactionRunner txRunner;
@@ -385,16 +375,6 @@ public class NeutronvpnUtils {
         return null;
     }
 
-    @Nullable
-    protected List<Uuid> getPortIdsFromSubnetId(Uuid subnetId) {
-        InstanceIdentifier<Subnetmap> id = buildSubnetMapIdentifier(subnetId);
-        Optional<Subnetmap> optionalSubnetmap = read(LogicalDatastoreType.CONFIGURATION, id);
-        if (optionalSubnetmap.isPresent()) {
-            return optionalSubnetmap.get().getPortList();
-        }
-        return null;
-    }
-
     protected Router getNeutronRouter(Uuid routerId) {
         Router router = routerMap.get(routerId);
         if (router != null) {
@@ -1009,50 +989,6 @@ public class NeutronvpnUtils {
                 && network.augmentation(NetworkL3Extension.class).isExternal();
     }
 
-    public void addToQosPolicyCache(QosPolicy qosPolicy) {
-        qosPolicyMap.put(qosPolicy.getUuid(),qosPolicy);
-    }
-
-    public void removeFromQosPolicyCache(QosPolicy qosPolicy) {
-        qosPolicyMap.remove(qosPolicy.getUuid());
-    }
-
-    public void addToQosPortsCache(Uuid qosUuid, Port port) {
-        if (qosPortsMap.containsKey(qosUuid)) {
-            if (!qosPortsMap.get(qosUuid).containsKey(port.getUuid())) {
-                qosPortsMap.get(qosUuid).put(port.getUuid(), port);
-            }
-        } else {
-            HashMap<Uuid, Port> newPortMap = new HashMap<>();
-            newPortMap.put(port.getUuid(), port);
-            qosPortsMap.put(qosUuid, newPortMap);
-        }
-    }
-
-    public void removeFromQosPortsCache(Uuid qosUuid, Port port) {
-        if (qosPortsMap.containsKey(qosUuid) && qosPortsMap.get(qosUuid).containsKey(port.getUuid())) {
-            qosPortsMap.get(qosUuid).remove(port.getUuid(), port);
-        }
-    }
-
-    public void addToQosNetworksCache(Uuid qosUuid, Network network) {
-        if (qosNetworksMap.containsKey(qosUuid)) {
-            if (!qosNetworksMap.get(qosUuid).containsKey(network.getUuid())) {
-                qosNetworksMap.get(qosUuid).put(network.getUuid(), network);
-            }
-        } else {
-            HashMap<Uuid, Network> newNetworkMap = new HashMap<>();
-            newNetworkMap.put(network.getUuid(), network);
-            qosNetworksMap.put(qosUuid, newNetworkMap);
-        }
-    }
-
-    public void removeFromQosNetworksCache(Uuid qosUuid, Network network) {
-        if (qosNetworksMap.containsKey(qosUuid) && qosNetworksMap.get(qosUuid).containsKey(network.getUuid())) {
-            qosNetworksMap.get(qosUuid).remove(network.getUuid(), network);
-        }
-    }
-
     static InstanceIdentifier<NetworkMap> buildNetworkMapIdentifier(Uuid networkId) {
         InstanceIdentifier<NetworkMap> id = InstanceIdentifier.builder(NetworkMaps.class).child(NetworkMap.class, new
                 NetworkMapKey(networkId)).build();
@@ -1101,11 +1037,6 @@ public class NeutronvpnUtils {
         }
     }
 
-    public static Class<? extends NetworkTypeBase> getNetworkType(Network network) {
-        NetworkProviderExtension providerExtension = network.augmentation(NetworkProviderExtension.class);
-        return providerExtension != null ? providerExtension.getNetworkType() : null;
-    }
-
     @Nullable
     static ProviderTypes getProviderNetworkType(Network network) {
         if (network == null) {
@@ -1187,46 +1118,6 @@ public class NeutronvpnUtils {
         return Optional.absent();
     }
 
-    public Set<RouterDpnList> getAllRouterDpnList(BigInteger dpid) {
-        Set<RouterDpnList> ret = new HashSet<>();
-        InstanceIdentifier<NeutronRouterDpns> routerDpnId =
-                InstanceIdentifier.create(NeutronRouterDpns.class);
-        Optional<NeutronRouterDpns> neutronRouterDpnsOpt =
-            MDSALUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL, routerDpnId);
-        if (neutronRouterDpnsOpt.isPresent()) {
-            NeutronRouterDpns neutronRouterDpns = neutronRouterDpnsOpt.get();
-            for (RouterDpnList routerDpnList : neutronRouterDpns.nonnullRouterDpnList()) {
-                if (routerDpnList.getDpnVpninterfacesList() != null) {
-                    for (DpnVpninterfacesList dpnInterfaceList : routerDpnList.getDpnVpninterfacesList()) {
-                        if (dpnInterfaceList.getDpnId().equals(dpid)) {
-                            ret.add(routerDpnList);
-                        }
-                    }
-                }
-            }
-        }
-        return ret;
-    }
-
-    @Nullable
-    protected Integer getUniqueRDId(String poolName, String idKey) {
-        AllocateIdInput getIdInput = new AllocateIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build();
-        try {
-            Future<RpcResult<AllocateIdOutput>> result = idManager.allocateId(getIdInput);
-            RpcResult<AllocateIdOutput> rpcResult = result.get();
-            if (rpcResult.isSuccessful()) {
-                return rpcResult.getResult().getIdValue().intValue();
-            } else {
-                LOG.error("RPC call to get unique ID for pool name {} with ID key {} returned with errors {}",
-                        poolName, idKey, rpcResult.getErrors());
-            }
-        } catch (InterruptedException | ExecutionException e) {
-            LOG.error("Exception when getting Unique Id for poolname {} and ID Key {}", poolName, idKey, e);
-        }
-        LOG.error("getUniqueRdId: Failed to return ID for poolname {} and ID Key {}", poolName, idKey);
-        return null;
-    }
-
     protected void releaseRDId(String poolName, String idKey) {
         ReleaseIdInput idInput = new ReleaseIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build();
         try {
@@ -1754,54 +1645,6 @@ public class NeutronvpnUtils {
         }), LOG, "Error updating VPN instance op {} with type {}", vpn, choice);
     }
 
-    public List<Uuid> getAssociateRouterInputRouterIdsListUuid(List<RouterIds> routerIds) {
-        if (routerIds == null) {
-            return Collections.emptyList();
-        }
-        return routerIds.stream().map(
-            routerId -> routerId.getRouterId()).collect(Collectors.toList());
-    }
-
-    public List<Uuid> getDisassociateRouterInputRouterIdsListUuid(List<RouterIds> routerIds) {
-        if (routerIds == null) {
-            return Collections.emptyList();
-        }
-        return routerIds.stream().map(
-            routerId -> routerId.getRouterId()).collect(Collectors.toList());
-    }
-
-    public RouterIds getvpnMapRouterIds(Uuid routerId) {
-        return new RouterIdsBuilder().setRouterId(routerId).build();
-    }
-
-    public void removeVpnMapRouterIdsFromList(Uuid routerId, List<RouterIds> vpnRouterIds) {
-        Iterator<RouterIds> vpnRouterIdIter = vpnRouterIds.iterator();
-        while (vpnRouterIdIter.hasNext()) {
-            RouterIds vpnRouterId = vpnRouterIdIter.next();
-            if (vpnRouterId.getRouterId().getValue().equals(routerId.getValue())) {
-                vpnRouterIdIter.remove();
-                return;
-            }
-        }
-        return;
-    }
-
-    public boolean vpnMapRouterIdsContainsRouterId(Uuid routerId, List<RouterIds> vpnRouterIds) {
-        if (routerId == null) {
-            return false;
-        }
-        return vpnRouterIds.stream().anyMatch(vpnRouterId ->
-              vpnRouterId.getRouterId().getValue().equals(routerId.getValue()));
-    }
-
-    public List<Uuid> getVpnInstanceRouterIdsListUuid(List<RouterIds> routerIds) {
-        if (routerIds == null) {
-            return Collections.emptyList();
-        }
-        return routerIds.stream().map(
-            routerId -> routerId.getRouterId()).collect(Collectors.toList());
-    }
-
     public static RouterIds getvpnInstanceRouterIds(Uuid routerId) {
         return new RouterIdsBuilder().setRouterId(routerId).build();
     }
@@ -1831,30 +1674,6 @@ public class NeutronvpnUtils {
         return dpns;
     }
 
-    @Nullable
-    public List<Uuid> getRouterIdsfromVpnInstance(String vpnName) {
-        // returns only router, attached to IPv4 networks
-        InstanceIdentifier<VpnMap> vpnMapIdentifier = InstanceIdentifier.builder(VpnMaps.class)
-            .child(VpnMap.class, new VpnMapKey(new Uuid(vpnName))).build();
-        Optional<VpnMap> optionalVpnMap = SingleTransactionDataBroker
-                .syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker,
-                        LogicalDatastoreType.CONFIGURATION, vpnMapIdentifier);
-        if (!optionalVpnMap.isPresent()) {
-            LOG.error("getRouterIdsfromVpnInstance : Router not found for vpn : {}", vpnName);
-            return null;
-        }
-        List<Uuid> rtrIds = optionalVpnMap.get().getRouterIds().stream().map(routerIds -> routerIds.getRouterId())
-                .collect(Collectors.toList());
-        return rtrIds;
-
-    }
-
-    public InstanceIdentifier<Router> buildNeutronRouterIdentifier(Uuid routerUuid) {
-        InstanceIdentifier<Router> routerInstanceIdentifier = InstanceIdentifier.create(Neutron.class)
-             .child(Routers.class).child(Router.class, new RouterKey(routerUuid));
-        return routerInstanceIdentifier;
-    }
-
     @Nullable
     List<Subnetmap> getSubnetmapListFromNetworkId(Uuid networkId) {
         List<Uuid> subnetIdList = getSubnetIdsFromNetworkId(networkId);
index c933e071ea88ebba12bed1cf50040aa45a791751..9fb6260fc75e15a5e5f3bfd223a1a32cee0e9bbc 100644 (file)
@@ -11,7 +11,6 @@ import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
 
 import com.google.common.base.Optional;
 import java.util.Collections;
-import org.eclipse.jdt.annotation.Nullable;
 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;
@@ -23,9 +22,7 @@ import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
 import org.opendaylight.infrautils.utils.concurrent.ListenableFutures;
 import org.opendaylight.netvirt.elanmanager.api.ElanHelper;
 import org.opendaylight.netvirt.vpnmanager.api.IVpnManager;
-import org.opendaylight.netvirt.vpnmanager.api.VpnHelper;
 import org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.EvpnAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.EvpnAugmentationBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
@@ -59,11 +56,6 @@ public class NeutronEvpnUtils {
         this.jobCoordinator = jobCoordinator;
     }
 
-    @Nullable
-    public VpnInstance getVpnInstance(Uuid vpnId) {
-        return VpnHelper.getVpnInstance(dataBroker, vpnId.getValue());
-    }
-
     public boolean isVpnAssociatedWithNetwork(VpnInstance vpnInstance) throws ReadFailedException {
         String rd = vpnManager.getPrimaryRdFromVpnInstance(vpnInstance);
         InstanceIdentifier<EvpnRdToNetwork> id = InstanceIdentifier.builder(EvpnRdToNetworks.class)
index b95fb2723deaeeb4aad4ca138d8a0b425651fbbc..af2109c11528704f8b7040982ee4aa7db6818a49 100644 (file)
@@ -28,18 +28,10 @@ public final class L2GatewayUtils {
 
     private L2GatewayUtils() { }
 
-    protected static boolean isGatewayAssociatedToL2Device(L2GatewayDevice l2GwDevice) {
-        return l2GwDevice.getL2GatewayIds().size() > 0;
-    }
-
     protected static boolean isLastL2GatewayBeingDeleted(L2GatewayDevice l2GwDevice) {
         return l2GwDevice.getL2GatewayIds().size() == 1;
     }
 
-    protected static boolean isItmTunnelsCreatedForL2Device(L2GatewayDevice l2GwDevice) {
-        return l2GwDevice.getHwvtepNodeId() != null && l2GwDevice.getL2GatewayIds().size() > 0;
-    }
-
     protected static void createItmTunnels(ItmRpcService itmRpcService, String hwvtepId, String psName,
                                            IpAddress tunnelIp) {
         AddL2GwDeviceInputBuilder builder = new AddL2GwDeviceInputBuilder();