Remove deprecated RouteService APIs.

The goal is to clean up the interfaces a little bit in preparation for
a major RouteService refactoring that is coming.

Change-Id: Ifbde9a507dd0dc3cddcd7fa1c02c426dad386e5f
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/routing/NextHop.java b/incubator/api/src/main/java/org/onosproject/incubator/net/routing/NextHop.java
deleted file mode 100644
index 0241742..0000000
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/routing/NextHop.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.incubator.net.routing;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onosproject.net.ConnectPoint;
-
-import java.util.Objects;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-/**
- * Describes a routing next hop.
- */
-public class NextHop {
-
-    private final IpAddress ip;
-    private final NextHopData nextHopData;
-
-    /**
-     * Creates a new next hop.
-     *
-     * @param ip IP address
-     * @param nextHopData Next hop data
-     */
-    public NextHop(IpAddress ip, NextHopData nextHopData) {
-        this.ip = ip;
-        this.nextHopData = nextHopData;
-    }
-
-    /**
-     * Returns the IP address of the next hop.
-     *
-     * @return IP address
-     */
-    public IpAddress ip() {
-        return ip;
-    }
-
-    /**
-     * Returns the MAC address of the next hop.
-     *
-     * @return MAC address
-     */
-    public MacAddress mac() {
-        return nextHopData.mac();
-    }
-
-    /**
-     * Returns the location of the next hop.
-     *
-     * @return Connect point
-     */
-    public ConnectPoint location() {
-        return nextHopData.location();
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(ip, nextHopData);
-    }
-
-    @Override
-    public boolean equals(Object other) {
-        if (this == other) {
-            return true;
-        }
-
-        if (!(other instanceof NextHop)) {
-            return false;
-        }
-
-        NextHop that = (NextHop) other;
-
-        return Objects.equals(this.ip, that.ip) &&
-                Objects.equals(this.nextHopData, that.nextHopData);
-    }
-
-    @Override
-    public String toString() {
-        return toStringHelper(this)
-                .add("ip", ip)
-                .add("nextHopData", nextHopData)
-                .toString();
-    }
-}
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/routing/RouteService.java b/incubator/api/src/main/java/org/onosproject/incubator/net/routing/RouteService.java
index 4a298ba..c123dc3 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/routing/RouteService.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/routing/RouteService.java
@@ -20,9 +20,7 @@
 import org.onosproject.event.ListenerService;
 
 import java.util.Collection;
-import java.util.Map;
 import java.util.Optional;
-import java.util.Set;
 
 /**
  * Unicast IP route service.
@@ -30,16 +28,6 @@
 public interface RouteService extends ListenerService<RouteEvent, RouteListener> {
 
     /**
-     * Returns all routes for all route tables in the system.
-     *
-     * @return map of route table name to routes in that table
-     * @deprecated in Kingfisher release. Use {@link #getRoutes(RouteTableId)}
-     * instead.
-     */
-    @Deprecated
-    Map<RouteTableId, Collection<Route>> getAllRoutes();
-
-    /**
      * Returns information about all routes in the given route table.
      *
      * @param id route table ID
@@ -55,6 +43,14 @@
     Collection<RouteTableId> getRouteTables();
 
     /**
+     * Performs a longest prefix lookup on the given IP address.
+     *
+     * @param ip IP address to look up
+     * @return most specific matching route, if one exists
+     */
+    Optional<ResolvedRoute> longestPrefixLookup(IpAddress ip);
+
+    /**
      * Performs a longest prefix match on the given IP address. The call will
      * return the route with the most specific prefix that contains the given
      * IP address.
@@ -66,30 +62,4 @@
      */
     @Deprecated
     Route longestPrefixMatch(IpAddress ip);
-
-    /**
-     * Performs a longest prefix lookup on the given IP address.
-     *
-     * @param ip IP address to look up
-     * @return most specific matching route, if one exists
-     */
-    Optional<ResolvedRoute> longestPrefixLookup(IpAddress ip);
-
-    /**
-     * Returns the routes for the given next hop.
-     *
-     * @param nextHop next hop IP address
-     * @return routes for this next hop
-     */
-    @Deprecated
-    Collection<Route> getRoutesForNextHop(IpAddress nextHop);
-
-    /**
-     * Returns all next hops in the route store.
-     *
-     * @return set of next hops
-     */
-    @Deprecated
-    Set<NextHop> getNextHops();
-
 }
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/routing/RouteStore.java b/incubator/api/src/main/java/org/onosproject/incubator/net/routing/RouteStore.java
index 27ec1c3..0d2eb23 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/routing/RouteStore.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/routing/RouteStore.java
@@ -22,7 +22,6 @@
 import org.onosproject.store.Store;
 
 import java.util.Collection;
-import java.util.Map;
 import java.util.Set;
 
 /**
@@ -78,49 +77,4 @@
     @Beta
     RouteSet getRoutes(IpPrefix prefix);
 
-    /**
-     * Updates a next hop information in the store.
-     *
-     * @param ip IP address
-     * @param nextHopData Information of the next hop
-     */
-    @Deprecated
-    void updateNextHop(IpAddress ip, NextHopData nextHopData);
-
-    /**
-     * Removes a next hop information from the store.
-     *
-     * @param ip IP address
-     * @param nextHopData Information of the next hop
-     */
-    @Deprecated
-    void removeNextHop(IpAddress ip, NextHopData nextHopData);
-
-    /**
-     * Returns the information of the given next hop.
-     *
-     * @param ip next hop IP
-     * @return Information of the next hop
-     */
-    @Deprecated
-    NextHopData getNextHop(IpAddress ip);
-
-    /**
-     * Returns all next hops in the route store.
-     *
-     * @return next hops
-     */
-    @Deprecated
-    Map<IpAddress, NextHopData> getNextHops();
-
-    /**
-     * Performs a longest prefix match with the given IP address.
-     *
-     * @param ip IP to look up
-     * @return longest prefix match route
-     * @deprecated in Kingfisher release. Now handled by the manager instead of
-     * the store
-     */
-    @Deprecated
-    Route longestPrefixMatch(IpAddress ip);
 }
diff --git a/incubator/api/src/test/java/org/onosproject/incubator/net/routing/RouteServiceAdapter.java b/incubator/api/src/test/java/org/onosproject/incubator/net/routing/RouteServiceAdapter.java
index a13f5c8..e81fc30 100644
--- a/incubator/api/src/test/java/org/onosproject/incubator/net/routing/RouteServiceAdapter.java
+++ b/incubator/api/src/test/java/org/onosproject/incubator/net/routing/RouteServiceAdapter.java
@@ -19,9 +19,7 @@
 import org.onlab.packet.IpAddress;
 
 import java.util.Collection;
-import java.util.Map;
 import java.util.Optional;
-import java.util.Set;
 
 /**
  * Adapter class for the route service.
@@ -38,11 +36,6 @@
     }
 
     @Override
-    public Map<RouteTableId, Collection<Route>> getAllRoutes() {
-        return null;
-    }
-
-    @Override
     public Collection<RouteInfo> getRoutes(RouteTableId id) {
         return null;
     }
@@ -63,16 +56,6 @@
     }
 
     @Override
-    public Collection<Route> getRoutesForNextHop(IpAddress nextHop) {
-        return null;
-    }
-
-    @Override
-    public Set<NextHop> getNextHops() {
-        return null;
-    }
-
-    @Override
     public void addListener(RouteListener listener) {
 
     }
diff --git a/incubator/net/src/main/java/org/onosproject/incubator/net/routing/impl/RouteManager.java b/incubator/net/src/main/java/org/onosproject/incubator/net/routing/impl/RouteManager.java
index 267bb69..f057942 100644
--- a/incubator/net/src/main/java/org/onosproject/incubator/net/routing/impl/RouteManager.java
+++ b/incubator/net/src/main/java/org/onosproject/incubator/net/routing/impl/RouteManager.java
@@ -26,7 +26,6 @@
 import org.onlab.packet.IpPrefix;
 import org.onosproject.cluster.ClusterService;
 import org.onosproject.incubator.net.routing.InternalRouteEvent;
-import org.onosproject.incubator.net.routing.NextHop;
 import org.onosproject.incubator.net.routing.ResolvedRoute;
 import org.onosproject.incubator.net.routing.Route;
 import org.onosproject.incubator.net.routing.RouteAdminService;
@@ -48,7 +47,6 @@
 
 import javax.annotation.concurrent.GuardedBy;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Map;
@@ -59,7 +57,6 @@
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.ThreadFactory;
-import java.util.function.Function;
 import java.util.stream.Collectors;
 
 import static java.util.concurrent.Executors.newSingleThreadExecutor;
@@ -175,14 +172,6 @@
         }
     }
 
-    @Override
-    public Map<RouteTableId, Collection<Route>> getAllRoutes() {
-        return routeStore.getRouteTables().stream()
-                .collect(Collectors.toMap(Function.identity(),
-                        table -> (table == null) ?
-                                 Collections.emptySet() : reformatRoutes(routeStore.getRoutes(table))));
-    }
-
     private Collection<Route> reformatRoutes(Collection<RouteSet> routeSets) {
         return routeSets.stream().flatMap(r -> r.routes().stream()).collect(Collectors.toList());
     }
@@ -214,30 +203,11 @@
     }
 
     @Override
-    public Route longestPrefixMatch(IpAddress ip) {
-        return longestPrefixLookup(ip)
-                .map(ResolvedRoute::route)
-                .orElse(null);
-    }
-
-    @Override
     public Optional<ResolvedRoute> longestPrefixLookup(IpAddress ip) {
         return resolvedRouteStore.longestPrefixMatch(ip);
     }
 
     @Override
-    public Collection<Route> getRoutesForNextHop(IpAddress nextHop) {
-        return routeStore.getRoutesForNextHop(nextHop);
-    }
-
-    @Override
-    public Set<NextHop> getNextHops() {
-        return routeStore.getNextHops().entrySet().stream()
-                .map(entry -> new NextHop(entry.getKey(), entry.getValue()))
-                .collect(Collectors.toSet());
-    }
-
-    @Override
     public void update(Collection<Route> routes) {
         synchronized (this) {
             routes.forEach(route -> {
@@ -257,6 +227,13 @@
         }
     }
 
+    @Override
+    public Route longestPrefixMatch(IpAddress ip) {
+        return longestPrefixLookup(ip)
+                .map(ResolvedRoute::route)
+                .orElse(null);
+    }
+
     private ResolvedRoute resolve(Route route) {
         hostService.startMonitoringIp(route.nextHop());
         Set<Host> hosts = hostService.getHostsByIp(route.nextHop());
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/DistributedRouteStore.java b/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/DistributedRouteStore.java
index 34e281a..9f0ae4f 100644
--- a/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/DistributedRouteStore.java
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/DistributedRouteStore.java
@@ -21,7 +21,6 @@
 import org.onlab.packet.IpPrefix;
 import org.onlab.util.KryoNamespace;
 import org.onosproject.incubator.net.routing.InternalRouteEvent;
-import org.onosproject.incubator.net.routing.NextHopData;
 import org.onosproject.incubator.net.routing.Route;
 import org.onosproject.incubator.net.routing.RouteSet;
 import org.onosproject.incubator.net.routing.RouteStore;
@@ -137,12 +136,6 @@
     }
 
     @Override
-    public Route longestPrefixMatch(IpAddress ip) {
-        // Not supported
-        return null;
-    }
-
-    @Override
     public Collection<Route> getRoutesForNextHop(IpAddress ip) {
         return getDefaultRouteTable(ip).getRoutesForNextHop(ip);
     }
@@ -152,28 +145,6 @@
         return getDefaultRouteTable(prefix.address()).getRoutes(prefix);
     }
 
-    @Override
-    public void updateNextHop(IpAddress ip, NextHopData nextHopData) {
-        // Not supported
-    }
-
-    @Override
-    public void removeNextHop(IpAddress ip, NextHopData nextHopData) {
-        // Not supported
-    }
-
-    @Override
-    public NextHopData getNextHop(IpAddress ip) {
-        // Not supported
-        return null;
-    }
-
-    @Override
-    public Map<IpAddress, NextHopData> getNextHops() {
-        // Not supported
-        return Collections.emptyMap();
-    }
-
     private void createRouteTable(RouteTableId tableId) {
         routeTables.computeIfAbsent(tableId, id -> new DefaultRouteTable(id, ourDelegate, storageService, executor));
     }
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/LocalRouteStore.java b/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/LocalRouteStore.java
index 508c2f1..04663e2 100644
--- a/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/LocalRouteStore.java
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/LocalRouteStore.java
@@ -23,7 +23,6 @@
 import org.onlab.packet.IpAddress;
 import org.onlab.packet.IpPrefix;
 import org.onosproject.incubator.net.routing.InternalRouteEvent;
-import org.onosproject.incubator.net.routing.NextHopData;
 import org.onosproject.incubator.net.routing.Route;
 import org.onosproject.incubator.net.routing.RouteSet;
 import org.onosproject.incubator.net.routing.RouteStore;
@@ -102,11 +101,6 @@
     }
 
     @Override
-    public Route longestPrefixMatch(IpAddress ip) {
-        return getDefaultRouteTable(ip).longestPrefixMatch(ip);
-    }
-
-    @Override
     public Collection<Route> getRoutesForNextHop(IpAddress ip) {
         return getDefaultRouteTable(ip).getRoutesForNextHop(ip);
     }
@@ -116,28 +110,6 @@
         return getDefaultRouteTable(prefix.address()).getRoutes(prefix);
     }
 
-    @Override
-    public void updateNextHop(IpAddress ip, NextHopData nextHopData) {
-        // No longer needed
-    }
-
-    @Override
-    public void removeNextHop(IpAddress ip, NextHopData nextHopData) {
-        // No longer needed
-    }
-
-    @Override
-    public NextHopData getNextHop(IpAddress ip) {
-        // No longer needed
-        return null;
-    }
-
-    @Override
-    public Map<IpAddress, NextHopData> getNextHops() {
-        // No longer needed
-        return Collections.emptyMap();
-    }
-
     private RouteTable getDefaultRouteTable(Route route) {
         return getDefaultRouteTable(route.prefix().address());
     }
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/RouteStoreImpl.java b/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/RouteStoreImpl.java
index c07f3a6..4d1f5f0 100644
--- a/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/RouteStoreImpl.java
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/RouteStoreImpl.java
@@ -28,7 +28,6 @@
 import org.onlab.util.Tools;
 import org.onosproject.cfg.ComponentConfigService;
 import org.onosproject.incubator.net.routing.InternalRouteEvent;
-import org.onosproject.incubator.net.routing.NextHopData;
 import org.onosproject.incubator.net.routing.Route;
 import org.onosproject.incubator.net.routing.RouteSet;
 import org.onosproject.incubator.net.routing.RouteStore;
@@ -43,7 +42,6 @@
 
 import java.util.Collection;
 import java.util.Dictionary;
-import java.util.Map;
 import java.util.Set;
 
 /**
@@ -154,11 +152,6 @@
     }
 
     @Override
-    public Route longestPrefixMatch(IpAddress ip) {
-        return currentRouteStore.longestPrefixMatch(ip);
-    }
-
-    @Override
     public Collection<Route> getRoutesForNextHop(IpAddress ip) {
         return currentRouteStore.getRoutesForNextHop(ip);
     }
@@ -167,24 +160,4 @@
     public RouteSet getRoutes(IpPrefix prefix) {
         return currentRouteStore.getRoutes(prefix);
     }
-
-    @Override
-    public void updateNextHop(IpAddress ip, NextHopData nextHopData) {
-        currentRouteStore.updateNextHop(ip, nextHopData);
-    }
-
-    @Override
-    public void removeNextHop(IpAddress ip, NextHopData nextHopData) {
-        currentRouteStore.removeNextHop(ip, nextHopData);
-    }
-
-    @Override
-    public NextHopData getNextHop(IpAddress ip) {
-        return currentRouteStore.getNextHop(ip);
-    }
-
-    @Override
-    public Map<IpAddress, NextHopData> getNextHops() {
-        return currentRouteStore.getNextHops();
-    }
 }