Remove dependencies from EVPN route system on unicast route system.

The route system is moving to an app, so EVPN code in the incubator
can't depend on it. I implemented an EvpnRouteTableId to remove this
dependency.

Change-Id: Id9af9fc0e0c680add1e061d0628ffdbd2a23dbde
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/routing/EvpnRouteService.java b/incubator/api/src/main/java/org/onosproject/incubator/net/routing/EvpnRouteService.java
index ba9179b..20e1fa7 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/routing/EvpnRouteService.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/routing/EvpnRouteService.java
@@ -32,5 +32,5 @@
      *
      * @return collection of route table IDs.
      */
-    Collection<RouteTableId> getRouteTables();
+    Collection<EvpnRouteTableId> getRouteTables();
 }
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/routing/EvpnRouteSet.java b/incubator/api/src/main/java/org/onosproject/incubator/net/routing/EvpnRouteSet.java
index 9530f09..adc8c1c 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/routing/EvpnRouteSet.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/routing/EvpnRouteSet.java
@@ -27,7 +27,7 @@
  * A set of routes for a particular prefix in a route table.
  */
 public class EvpnRouteSet {
-    private final RouteTableId tableId;
+    private final EvpnRouteTableId tableId;
 
     private final EvpnPrefix prefix;
     private final Set<EvpnRoute> routes;
@@ -39,7 +39,7 @@
      * @param prefix  IP prefix
      * @param routes  routes for the given prefix
      */
-    public EvpnRouteSet(RouteTableId tableId, EvpnPrefix prefix, Set<EvpnRoute>
+    public EvpnRouteSet(EvpnRouteTableId tableId, EvpnPrefix prefix, Set<EvpnRoute>
             routes) {
         this.tableId = checkNotNull(tableId);
         this.prefix = checkNotNull(prefix);
@@ -51,7 +51,7 @@
      *
      * @return route table ID
      */
-    public RouteTableId tableId() {
+    public EvpnRouteTableId tableId() {
         return tableId;
     }
 
@@ -84,7 +84,7 @@
             return true;
         }
 
-        if (!(other instanceof RouteSet)) {
+        if (!(other instanceof EvpnRouteSet)) {
             return false;
         }
 
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/routing/EvpnRouteStore.java b/incubator/api/src/main/java/org/onosproject/incubator/net/routing/EvpnRouteStore.java
index 9dd5e73..5c6e2ef 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/routing/EvpnRouteStore.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/routing/EvpnRouteStore.java
@@ -47,7 +47,7 @@
      *
      * @return route table IDs
      */
-    Set<RouteTableId> getRouteTables();
+    Set<EvpnRouteTableId> getRouteTables();
 
     /**
      * Returns the routes in the given route table, grouped by prefix.
@@ -55,7 +55,7 @@
      * @param table route table ID
      * @return routes
      */
-    Collection<EvpnRouteSet> getRoutes(RouteTableId table);
+    Collection<EvpnRouteSet> getRoutes(EvpnRouteTableId table);
 
     /**
      * Returns the routes that point to the given next hop IP address.
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/routing/EvpnRouteTableId.java b/incubator/api/src/main/java/org/onosproject/incubator/net/routing/EvpnRouteTableId.java
new file mode 100644
index 0000000..44af3cb
--- /dev/null
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/routing/EvpnRouteTableId.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * 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 java.util.Objects;
+
+/**
+ * Identifier for an EVPN routing table.
+ */
+public class EvpnRouteTableId {
+    private final String name;
+
+    /**
+     * Creates a new route table ID.
+     *
+     * @param name unique name for the route table
+     */
+    public EvpnRouteTableId(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Returns the name of the route table.
+     *
+     * @return table name
+     */
+    public String name() {
+        return name;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+
+        if (obj instanceof EvpnRouteTableId) {
+            EvpnRouteTableId that = (EvpnRouteTableId) obj;
+
+            return Objects.equals(this.name, that.name);
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(name);
+    }
+
+    @Override
+    public String toString() {
+        return name;
+    }
+}
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/routing/EvpnTable.java b/incubator/api/src/main/java/org/onosproject/incubator/net/routing/EvpnTable.java
index eaa07af..1b8fe78 100755
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/routing/EvpnTable.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/routing/EvpnTable.java
@@ -44,7 +44,7 @@
      *
      * @return route table ID
      */
-    RouteTableId id();
+    EvpnRouteTableId id();
 
     /**
      * Returns all routes in the route table.
diff --git a/incubator/net/src/main/java/org/onosproject/incubator/net/routing/impl/EvpnRouteManager.java b/incubator/net/src/main/java/org/onosproject/incubator/net/routing/impl/EvpnRouteManager.java
index 7ea4813..6757353 100644
--- a/incubator/net/src/main/java/org/onosproject/incubator/net/routing/impl/EvpnRouteManager.java
+++ b/incubator/net/src/main/java/org/onosproject/incubator/net/routing/impl/EvpnRouteManager.java
@@ -31,7 +31,7 @@
 import org.onosproject.incubator.net.routing.EvpnRouteSet;
 import org.onosproject.incubator.net.routing.EvpnRouteStore;
 import org.onosproject.incubator.net.routing.EvpnRouteStoreDelegate;
-import org.onosproject.incubator.net.routing.RouteTableId;
+import org.onosproject.incubator.net.routing.EvpnRouteTableId;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -146,7 +146,7 @@
     }
 
 
-    public Collection<RouteTableId> getRouteTables() {
+    public Collection<EvpnRouteTableId> getRouteTables() {
         return evpnRouteStore.getRouteTables();
     }
 
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/DistributedEvpnRouteStore.java b/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/DistributedEvpnRouteStore.java
index 49356b6..b4526e2 100755
--- a/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/DistributedEvpnRouteStore.java
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/DistributedEvpnRouteStore.java
@@ -30,8 +30,8 @@
 import org.onosproject.incubator.net.routing.EvpnRouteSet;
 import org.onosproject.incubator.net.routing.EvpnRouteStore;
 import org.onosproject.incubator.net.routing.EvpnRouteStoreDelegate;
+import org.onosproject.incubator.net.routing.EvpnRouteTableId;
 import org.onosproject.incubator.net.routing.EvpnTable;
-import org.onosproject.incubator.net.routing.RouteTableId;
 import org.onosproject.store.AbstractStore;
 import org.onosproject.store.service.DistributedSet;
 import org.onosproject.store.service.Serializer;
@@ -67,18 +67,18 @@
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     public StorageService storageService;
 
-    private static final RouteTableId EVPN_IPV4 = new RouteTableId("evpn_ipv4");
-    private static final RouteTableId EVPN_IPV6 = new RouteTableId("evpn_ipv6");
+    private static final EvpnRouteTableId EVPN_IPV4 = new EvpnRouteTableId("evpn_ipv4");
+    private static final EvpnRouteTableId EVPN_IPV6 = new EvpnRouteTableId("evpn_ipv6");
 
-    private final SetEventListener<RouteTableId> masterRouteTableListener =
+    private final SetEventListener<EvpnRouteTableId> masterRouteTableListener =
             new MasterRouteTableListener();
     private final EvpnRouteStoreDelegate ourDelegate = new
             InternalEvpnRouteStoreDelegate();
 
     // Stores the route tables that have been created
-    public DistributedSet<RouteTableId> masterRouteTable;
+    public DistributedSet<EvpnRouteTableId> masterRouteTable;
     // Local memory map to store route table object
-    public Map<RouteTableId, EvpnTable> routeTables;
+    public Map<EvpnRouteTableId, EvpnTable> routeTables;
 
     private ExecutorService executor;
 
@@ -92,10 +92,10 @@
         executor = Executors.newSingleThreadExecutor(groupedThreads("onos/route", "store", log));
 
         KryoNamespace masterRouteTableSerializer = KryoNamespace.newBuilder()
-                .register(RouteTableId.class)
+                .register(EvpnRouteTableId.class)
                 .build();
 
-        masterRouteTable = storageService.<RouteTableId>setBuilder()
+        masterRouteTable = storageService.<EvpnRouteTableId>setBuilder()
                 .withName("onos-master-route-table")
                 .withSerializer(Serializer.using(masterRouteTableSerializer))
                 .build()
@@ -135,12 +135,12 @@
     }
 
     @Override
-    public Set<RouteTableId> getRouteTables() {
+    public Set<EvpnRouteTableId> getRouteTables() {
         return ImmutableSet.copyOf(masterRouteTable);
     }
 
     @Override
-    public Collection<EvpnRouteSet> getRoutes(RouteTableId table) {
+    public Collection<EvpnRouteSet> getRoutes(EvpnRouteTableId table) {
         EvpnTable routeTable = routeTables.get(table);
         if (routeTable == null) {
             return Collections.emptySet();
@@ -154,12 +154,12 @@
         return getDefaultRouteTable(ip).getRoutesForNextHop(ip);
     }
 
-    private void createRouteTable(RouteTableId tableId) {
+    private void createRouteTable(EvpnRouteTableId tableId) {
         routeTables.computeIfAbsent(tableId, id -> new EvpnRouteTable(id,
                                                                       ourDelegate, storageService, executor));
     }
 
-    private void destroyRouteTable(RouteTableId tableId) {
+    private void destroyRouteTable(EvpnRouteTableId tableId) {
         EvpnTable table = routeTables.remove(tableId);
         if (table != null) {
             table.destroy();
@@ -171,7 +171,7 @@
     }
 
     private EvpnTable getDefaultRouteTable(IpAddress ip) {
-        RouteTableId routeTableId = (ip.isIp4()) ? EVPN_IPV4 : EVPN_IPV6;
+        EvpnRouteTableId routeTableId = (ip.isIp4()) ? EVPN_IPV4 : EVPN_IPV6;
         return routeTables.getOrDefault(routeTableId, EmptyEvpnRouteTable
                 .instance());
     }
@@ -185,9 +185,9 @@
         }
     }
 
-    private class MasterRouteTableListener implements SetEventListener<RouteTableId> {
+    private class MasterRouteTableListener implements SetEventListener<EvpnRouteTableId> {
         @Override
-        public void event(SetEvent<RouteTableId> event) {
+        public void event(SetEvent<EvpnRouteTableId> event) {
             switch (event.type()) {
                 case ADD:
                     executor.execute(() -> createRouteTable(event.entry()));
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/EmptyEvpnRouteTable.java b/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/EmptyEvpnRouteTable.java
index fc59649..aa56d71 100755
--- a/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/EmptyEvpnRouteTable.java
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/EmptyEvpnRouteTable.java
@@ -20,8 +20,8 @@
 import org.onosproject.incubator.net.routing.EvpnPrefix;
 import org.onosproject.incubator.net.routing.EvpnRoute;
 import org.onosproject.incubator.net.routing.EvpnRouteSet;
+import org.onosproject.incubator.net.routing.EvpnRouteTableId;
 import org.onosproject.incubator.net.routing.EvpnTable;
-import org.onosproject.incubator.net.routing.RouteTableId;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -31,7 +31,7 @@
  */
 public final class EmptyEvpnRouteTable implements EvpnTable {
 
-    private final RouteTableId id = new RouteTableId("empty");
+    private final EvpnRouteTableId id = new EvpnRouteTableId("empty");
 
     private static final EmptyEvpnRouteTable INSTANCE = new EmptyEvpnRouteTable();
 
@@ -58,7 +58,7 @@
     }
 
     @Override
-    public RouteTableId id() {
+    public EvpnRouteTableId id() {
         return id;
     }
 
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/EvpnRouteTable.java b/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/EvpnRouteTable.java
index 9fd8798..33c8f96 100755
--- a/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/EvpnRouteTable.java
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/routing/impl/EvpnRouteTable.java
@@ -25,11 +25,10 @@
 import org.onosproject.incubator.net.routing.EvpnRoute;
 import org.onosproject.incubator.net.routing.EvpnRouteSet;
 import org.onosproject.incubator.net.routing.EvpnRouteStoreDelegate;
+import org.onosproject.incubator.net.routing.EvpnRouteTableId;
 import org.onosproject.incubator.net.routing.EvpnTable;
 import org.onosproject.incubator.net.routing.Label;
-import org.onosproject.incubator.net.routing.Route;
 import org.onosproject.incubator.net.routing.RouteDistinguisher;
-import org.onosproject.incubator.net.routing.RouteTableId;
 import org.onosproject.incubator.net.routing.VpnRouteTarget;
 import org.onosproject.store.serializers.KryoNamespaces;
 import org.onosproject.store.service.ConsistentMap;
@@ -55,7 +54,7 @@
  */
 public class EvpnRouteTable implements EvpnTable {
 
-    private final RouteTableId id;
+    private final EvpnRouteTableId id;
     private final ConsistentMap<EvpnPrefix, Set<EvpnRoute>> routes;
     private final EvpnRouteStoreDelegate delegate;
     private final ExecutorService executor;
@@ -71,7 +70,7 @@
      * @param storageService storage service
      * @param executor       executor service
      */
-    public EvpnRouteTable(RouteTableId id, EvpnRouteStoreDelegate delegate,
+    public EvpnRouteTable(EvpnRouteTableId id, EvpnRouteStoreDelegate delegate,
                           StorageService storageService, ExecutorService executor) {
         this.delegate = checkNotNull(delegate);
         this.id = checkNotNull(id);
@@ -103,8 +102,6 @@
         KryoNamespace routeTableSerializer = KryoNamespace.newBuilder()
                 .register(KryoNamespaces.API)
                 .register(KryoNamespaces.MISC)
-                .register(Route.class)
-                .register(Route.Source.class)
                 .register(EvpnRoute.class)
                 .register(EvpnPrefix.class)
                 .register(RouteDistinguisher.class)
@@ -114,7 +111,7 @@
                 .register(IpAddress.class)
                 .register(VpnRouteTarget.class)
                 .register(Label.class)
-                .register(RouteTableId.class)
+                .register(EvpnRouteTableId.class)
                 .build();
         return storageService.<EvpnPrefix, Set<EvpnRoute>>consistentMapBuilder()
                 .withName("onos-evpn-routes-" + id.name())
@@ -124,7 +121,7 @@
     }
 
     @Override
-    public RouteTableId id() {
+    public EvpnRouteTableId id() {
         return id;
     }