Remove old config classes from routing bundle.

Change-Id: Ifc8ff03674c1cfb9e3cde86b9994b8362744840d
diff --git a/apps/routing/src/main/java/org/onosproject/routing/config/impl/Configuration.java b/apps/routing/src/main/java/org/onosproject/routing/config/impl/Configuration.java
deleted file mode 100644
index dd1ffe3..0000000
--- a/apps/routing/src/main/java/org/onosproject/routing/config/impl/Configuration.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright 2015-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.routing.config.impl;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import org.onlab.packet.MacAddress;
-import org.onosproject.routing.config.BgpPeer;
-import org.onosproject.routing.config.BgpSpeaker;
-import org.onosproject.routing.config.LocalIpPrefixEntry;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Contains the configuration data for SDN-IP that has been read from a
- * JSON-formatted configuration file.
- */
-public class Configuration {
-    // We call the BGP routers in our SDN network the BGP speakers, and call
-    // the BGP routers outside our SDN network the BGP peers.
-    private List<BgpSpeaker> bgpSpeakers = Collections.emptyList();
-    private List<BgpPeer> peers = Collections.emptyList();
-    private MacAddress virtualGatewayMacAddress;
-
-    // All IP prefixes from the configuration are local
-    private List<LocalIpPrefixEntry> localIp4PrefixEntries =
-            Collections.emptyList();
-    private List<LocalIpPrefixEntry> localIp6PrefixEntries =
-            Collections.emptyList();
-
-    /**
-     * Default constructor.
-     */
-    public Configuration() {
-    }
-
-    /**
-     * Gets a list of bgpSpeakers in the system, represented by
-     * {@link BgpSpeaker} objects.
-     *
-     * @return the list of BGP speakers
-     */
-    public List<BgpSpeaker> getBgpSpeakers() {
-        return Collections.unmodifiableList(bgpSpeakers);
-    }
-
-    /**
-     * Sets a list of bgpSpeakers in the system.
-     *
-     * @param bgpSpeakers the list of BGP speakers
-     */
-    @JsonProperty("bgpSpeakers")
-    public void setBgpSpeakers(List<BgpSpeaker> bgpSpeakers) {
-        this.bgpSpeakers = bgpSpeakers;
-    }
-
-    /**
-     * Gets a list of BGP peers we are configured to peer with. Peers are
-     * represented by {@link BgpPeer} objects.
-     *
-     * @return the list of BGP peers
-     */
-    public List<BgpPeer> getPeers() {
-        return Collections.unmodifiableList(peers);
-    }
-
-    /**
-     * Sets a list of BGP peers we configured to peer with.
-     *
-     * @param peers the list of BGP peers
-     */
-    @JsonProperty("bgpPeers")
-    public void setPeers(List<BgpPeer> peers) {
-        this.peers = peers;
-    }
-
-    /**
-     * Gets the MAC address we configured for virtual gateway
-     * in SDN network.
-     *
-     * @return the MAC address of virtual gateway
-     */
-    public MacAddress getVirtualGatewayMacAddress() {
-        return virtualGatewayMacAddress;
-    }
-
-    /**
-     * Sets the MAC address for virtual gateway in SDN network.
-     *
-     * @param virtualGatewayMacAddress the MAC address of virtual gateway
-     */
-    @JsonProperty("virtualGatewayMacAddress")
-    public void setVirtualGatewayMacAddress(MacAddress virtualGatewayMacAddress) {
-        this.virtualGatewayMacAddress = virtualGatewayMacAddress;
-    }
-
-    /**
-     * Gets a list of local IPv4 prefix entries configured for local
-     * SDN network.
-     * <p>
-     * IP prefix entries are represented by {@link LocalIpPrefixEntry}
-     * objects.
-     * </p>
-     *
-     * @return the list of local IPv4 prefix entries
-     */
-    public List<LocalIpPrefixEntry> getLocalIp4PrefixEntries() {
-        return Collections.unmodifiableList(localIp4PrefixEntries);
-    }
-
-    /**
-     * Sets a list of IPv4 prefix entries configured for local SDN network.
-     *
-     * @param ip4PrefixEntries the list of Ipv4 prefix entries
-     */
-    @JsonProperty("ip4LocalPrefixes")
-    public void setLocalIp4PrefixEntries(List<LocalIpPrefixEntry> ip4PrefixEntries) {
-        this.localIp4PrefixEntries = ip4PrefixEntries;
-    }
-
-    /**
-     * Gets a list of IPv6 prefix entries configured for local SDN network.
-     * <p>
-     * IP prefix entries are represented by {@link LocalIpPrefixEntry}
-     * objects.
-     * </p>
-     *
-     * @return the list of IPv6 prefix entries
-     */
-    public List<LocalIpPrefixEntry> getLocalIp6PrefixEntries() {
-        return Collections.unmodifiableList(localIp6PrefixEntries);
-    }
-
-    /**
-     * Sets a list of IPv6 prefix entries configured for local SDN network.
-     *
-     * @param ip6PrefixEntries the list of Ipv6 prefix entries
-     */
-    @JsonProperty("ip6LocalPrefixes")
-    public void setLocalIp6PrefixEntries(List<LocalIpPrefixEntry> ip6PrefixEntries) {
-        this.localIp6PrefixEntries = ip6PrefixEntries;
-    }
-
-}
diff --git a/apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java b/apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java
index 31b16c6..f3533a5 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java
+++ b/apps/routing/src/main/java/org/onosproject/routing/config/impl/RoutingConfigurationImpl.java
@@ -58,7 +58,7 @@
 
 /**
  * Implementation of RoutingConfigurationService which reads routing
- * configuration from a file.
+ * configuration from the network configuration service.
  */
 @Component(immediate = true)
 @Service
diff --git a/apps/routing/src/test/java/org/onosproject/routing/impl/IntentSynchronizerTest.java b/apps/routing/src/test/java/org/onosproject/routing/impl/IntentSynchronizerTest.java
index 0172dc7..4b7110a 100644
--- a/apps/routing/src/test/java/org/onosproject/routing/impl/IntentSynchronizerTest.java
+++ b/apps/routing/src/test/java/org/onosproject/routing/impl/IntentSynchronizerTest.java
@@ -15,20 +15,14 @@
  */
 package org.onosproject.routing.impl;
 
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
 import com.google.common.util.concurrent.MoreExecutors;
 import org.junit.Before;
 import org.junit.Test;
-import org.onlab.junit.TestUtils;
-import org.onlab.junit.TestUtils.TestUtilsException;
 import org.onlab.packet.Ethernet;
-import org.onlab.packet.Ip4Address;
 import org.onlab.packet.Ip4Prefix;
 import org.onlab.packet.IpAddress;
 import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
-import org.onlab.packet.VlanId;
 import org.onosproject.TestApplicationId;
 import org.onosproject.cluster.ClusterServiceAdapter;
 import org.onosproject.cluster.ControllerNode;
@@ -37,7 +31,6 @@
 import org.onosproject.cluster.NodeId;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreServiceAdapter;
-import org.onosproject.incubator.net.intf.Interface;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.PortNumber;
@@ -45,19 +38,15 @@
 import org.onosproject.net.flow.DefaultTrafficTreatment;
 import org.onosproject.net.flow.TrafficSelector;
 import org.onosproject.net.flow.TrafficTreatment;
-import org.onosproject.net.host.InterfaceIpAddress;
 import org.onosproject.net.intent.AbstractIntentTest;
 import org.onosproject.net.intent.Intent;
 import org.onosproject.net.intent.IntentService;
 import org.onosproject.net.intent.IntentState;
-import org.onosproject.net.intent.IntentUtils;
 import org.onosproject.net.intent.Key;
 import org.onosproject.net.intent.MultiPointToSinglePointIntent;
-import org.onosproject.routing.RouteEntry;
 
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Set;
 import java.util.concurrent.ExecutorService;
 
@@ -66,9 +55,6 @@
 import static org.easymock.EasyMock.replay;
 import static org.easymock.EasyMock.reset;
 import static org.easymock.EasyMock.verify;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
 
 /**
  * This class tests the intent synchronization function in the
@@ -95,7 +81,7 @@
             PortNumber.portNumber(1));
 
     private IntentSynchronizer intentSynchronizer;
-    private final Set<Interface> interfaces = Sets.newHashSet();
+    private final Set<ConnectPoint> connectPoints = new HashSet<>();
 
     private static final ApplicationId APPID =
             TestApplicationId.create("intent-sync-test");
@@ -107,7 +93,7 @@
     public void setUp() throws Exception {
         super.setUp();
 
-        setUpInterfaceService();
+        setUpConnectPoints();
 
         intentService = createMock(IntentService.class);
 
@@ -115,131 +101,58 @@
 
         intentSynchronizer.coreService = new TestCoreService();
         intentSynchronizer.clusterService = new TestClusterService();
-        intentSynchronizer.leadershipService = new TestLeadershipService();
+        intentSynchronizer.leadershipService = new LeadershipServiceAdapter();
         intentSynchronizer.intentService = intentService;
 
         intentSynchronizer.activate();
     }
 
     /**
-     * Sets up InterfaceService.
+     * Sets up connect points.
      */
-    private void setUpInterfaceService() {
-        List<InterfaceIpAddress> interfaceIpAddresses1 = Lists.newArrayList();
-        interfaceIpAddresses1.add(new InterfaceIpAddress(
-                IpAddress.valueOf("192.168.10.101"),
-                IpPrefix.valueOf("192.168.10.0/24")));
-        Interface sw1Eth1 = new Interface(SW1_ETH1,
-                interfaceIpAddresses1, MacAddress.valueOf("00:00:00:00:00:01"),
-                VlanId.NONE);
-        interfaces.add(sw1Eth1);
-
-        List<InterfaceIpAddress> interfaceIpAddresses2 = Lists.newArrayList();
-        interfaceIpAddresses2.add(
-                new InterfaceIpAddress(IpAddress.valueOf("192.168.20.101"),
-                                       IpPrefix.valueOf("192.168.20.0/24")));
-        Interface sw2Eth1 = new Interface(SW2_ETH1,
-                interfaceIpAddresses2, MacAddress.valueOf("00:00:00:00:00:02"),
-                VlanId.NONE);
-        interfaces.add(sw2Eth1);
-
-        List<InterfaceIpAddress> interfaceIpAddresses3 = Lists.newArrayList();
-        interfaceIpAddresses3.add(
-                new InterfaceIpAddress(IpAddress.valueOf("192.168.30.101"),
-                                       IpPrefix.valueOf("192.168.30.0/24")));
-        Interface sw3Eth1 = new Interface(SW3_ETH1,
-                interfaceIpAddresses3, MacAddress.valueOf("00:00:00:00:00:03"),
-                VlanId.NONE);
-        interfaces.add(sw3Eth1);
-
-        InterfaceIpAddress interfaceIpAddress4 =
-                new InterfaceIpAddress(IpAddress.valueOf("192.168.40.101"),
-                                       IpPrefix.valueOf("192.168.40.0/24"));
-        Interface sw4Eth1 = new Interface(SW4_ETH1,
-                                          Lists.newArrayList(interfaceIpAddress4),
-                                          MacAddress.valueOf("00:00:00:00:00:04"),
-                                          VlanId.vlanId((short) 1));
-
-        interfaces.add(sw4Eth1);
+    private void setUpConnectPoints() {
+        connectPoints.add(SW1_ETH1);
+        connectPoints.add(SW2_ETH1);
+        connectPoints.add(SW3_ETH1);
+        connectPoints.add(SW4_ETH1);
     }
 
     /**
      * Tests the synchronization behavior of intent synchronizer. We set up
      * a discrepancy between the intent service state and the intent
      * synchronizer's state and ensure that this is reconciled correctly.
-     *
-     * @throws TestUtilsException
      */
     @Test
-    public void testIntentSync() throws TestUtilsException {
+    public void testIntentSync() {
 
-        //
         // Construct routes and intents.
         // This test simulates the following cases during the master change
         // time interval:
-        // 1. RouteEntry1 did not change and the intent also did not change.
-        // 2. RouteEntry2 was deleted, but the intent was not deleted.
-        // 3. RouteEntry3 was newly added, and the intent was also submitted.
-        // 4. RouteEntry4 was updated to RouteEntry4Update, and the intent was
+        // 1. intent1 did not change and the intent also did not change.
+        // 2. intent2 was deleted, but the intent was not deleted.
+        // 3. intent3 was newly added, and the intent was also submitted.
+        // 4. intent4 was updated to RouteEntry4Update, and the intent was
         // also updated to a new one.
-        // 5. RouteEntry5 did not change, but its intent id changed.
-        // 6. RouteEntry6 was newly added, but the intent was not submitted.
-        //
-        RouteEntry routeEntry1 = new RouteEntry(
-                Ip4Prefix.valueOf("1.1.1.0/24"),
-                Ip4Address.valueOf("192.168.10.1"));
-
-        RouteEntry routeEntry2 = new RouteEntry(
-                Ip4Prefix.valueOf("2.2.2.0/24"),
-                Ip4Address.valueOf("192.168.20.1"));
-
-        RouteEntry routeEntry3 = new RouteEntry(
-                Ip4Prefix.valueOf("3.3.3.0/24"),
-                Ip4Address.valueOf("192.168.30.1"));
-
-        RouteEntry routeEntry4 = new RouteEntry(
-                Ip4Prefix.valueOf("4.4.4.0/24"),
-                Ip4Address.valueOf("192.168.30.1"));
-
-        RouteEntry routeEntry4Update = new RouteEntry(
-                Ip4Prefix.valueOf("4.4.4.0/24"),
-                Ip4Address.valueOf("192.168.20.1"));
-
-        RouteEntry routeEntry5 = new RouteEntry(
-                Ip4Prefix.valueOf("5.5.5.0/24"),
-                Ip4Address.valueOf("192.168.10.1"));
-
-        RouteEntry routeEntry6 = new RouteEntry(
-                Ip4Prefix.valueOf("6.6.6.0/24"),
-                Ip4Address.valueOf("192.168.10.1"));
-
-        RouteEntry routeEntry7 = new RouteEntry(
-                Ip4Prefix.valueOf("7.7.7.0/24"),
-                Ip4Address.valueOf("192.168.10.1"));
+        // 5. intent5 did not change, but its intent id changed.
+        // 6. intent6 was newly added, but the intent was not submitted.
 
         MultiPointToSinglePointIntent intent1 = intentBuilder(
-                routeEntry1.prefix(), "00:00:00:00:00:01", SW1_ETH1);
+                Ip4Prefix.valueOf("1.1.1.0/24"), "00:00:00:00:00:01", SW1_ETH1);
         MultiPointToSinglePointIntent intent2 = intentBuilder(
-                routeEntry2.prefix(), "00:00:00:00:00:02", SW2_ETH1);
+                Ip4Prefix.valueOf("2.2.2.0/24"), "00:00:00:00:00:02", SW2_ETH1);
         MultiPointToSinglePointIntent intent3 = intentBuilder(
-                routeEntry3.prefix(), "00:00:00:00:00:03", SW3_ETH1);
+                Ip4Prefix.valueOf("3.3.3.0/24"), "00:00:00:00:00:03", SW3_ETH1);
         MultiPointToSinglePointIntent intent4 = intentBuilder(
-                routeEntry4.prefix(), "00:00:00:00:00:03", SW3_ETH1);
+                Ip4Prefix.valueOf("4.4.4.0/24"), "00:00:00:00:00:03", SW3_ETH1);
         MultiPointToSinglePointIntent intent4Update = intentBuilder(
-                routeEntry4Update.prefix(), "00:00:00:00:00:02", SW2_ETH1);
+                Ip4Prefix.valueOf("4.4.4.0/24"), "00:00:00:00:00:02", SW2_ETH1);
         MultiPointToSinglePointIntent intent5 = intentBuilder(
-                routeEntry5.prefix(), "00:00:00:00:00:01",  SW1_ETH1);
+                Ip4Prefix.valueOf("5.5.5.0/24"), "00:00:00:00:00:01",  SW1_ETH1);
         MultiPointToSinglePointIntent intent7 = intentBuilder(
-                routeEntry7.prefix(), "00:00:00:00:00:01",  SW1_ETH1);
-
-        // Compose a intent, which is equal to intent5 but the id is different.
-        MultiPointToSinglePointIntent intent5New =
-                staticIntentBuilder(intent5, routeEntry5, "00:00:00:00:00:01");
-        assertThat(IntentUtils.intentsAreEqual(intent5, intent5New), is(true));
-        assertFalse(intent5.equals(intent5New));
+                Ip4Prefix.valueOf("7.7.7.0/24"), "00:00:00:00:00:01",  SW1_ETH1);
 
         MultiPointToSinglePointIntent intent6 = intentBuilder(
-                routeEntry6.prefix(), "00:00:00:00:00:01",  SW1_ETH1);
+                Ip4Prefix.valueOf("6.6.6.0/24"), "00:00:00:00:00:01",  SW1_ETH1);
 
         // Set up expectation
         Set<Intent> intents = new HashSet<>();
@@ -395,13 +308,9 @@
                 DefaultTrafficTreatment.builder();
         treatmentBuilder.setEthDst(MacAddress.valueOf(nextHopMacAddress));
 
-        Set<ConnectPoint> ingressPoints = new HashSet<>();
-        for (Interface intf : interfaces) {
-            if (!intf.connectPoint().equals(egressPoint)) {
-                ConnectPoint srcPort = intf.connectPoint();
-                ingressPoints.add(srcPort);
-            }
-        }
+        Set<ConnectPoint> ingressPoints = new HashSet<>(connectPoints);
+        ingressPoints.remove(egressPoint);
+
         MultiPointToSinglePointIntent intent =
                 MultiPointToSinglePointIntent.builder()
                         .appId(APPID)
@@ -414,29 +323,6 @@
         return intent;
     }
 
-    /**
-     * A static MultiPointToSinglePointIntent builder, the returned intent is
-     * equal to the input intent except that the id is different.
-     *
-     * @param intent the intent to be used for building a new intent
-     * @param routeEntry the relative routeEntry of the intent
-     * @return the newly constructed MultiPointToSinglePointIntent
-     * @throws TestUtilsException
-     */
-    private MultiPointToSinglePointIntent staticIntentBuilder(
-            MultiPointToSinglePointIntent intent, RouteEntry routeEntry,
-            String nextHopMacAddress) throws TestUtilsException {
-
-        // Use a different egress ConnectPoint with that in intent
-        // to generate a different id
-        MultiPointToSinglePointIntent intentNew = intentBuilder(
-                routeEntry.prefix(), nextHopMacAddress, SW2_ETH1);
-        TestUtils.setField(intentNew, "egressPoint", intent.egressPoint());
-        TestUtils.setField(intentNew,
-                "ingressPoints", intent.ingressPoints());
-        return intentNew;
-    }
-
     private class TestIntentSynchronizer extends IntentSynchronizer {
         @Override
         protected ExecutorService createExecutor() {
@@ -457,8 +343,4 @@
             return LOCAL_NODE;
         }
     }
-
-    private class TestLeadershipService extends LeadershipServiceAdapter {
-
-    }
 }