Refactor SdxL3 app for version 1.12 of ONOS

Change-Id: Ic978062e30d5a47af264a45a68d031ed6f04d1b3
diff --git a/sdx-l3/app.xml b/sdx-l3/app.xml
index 1a45b23..46f1874 100644
--- a/sdx-l3/app.xml
+++ b/sdx-l3/app.xml
@@ -19,10 +19,12 @@
 <app name="org.onosproject.sdxl3" origin="GEANT" version="${project.version}"
      category="Traffic Steering" title="SDX-L3 App"
      featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
-     features="${project.artifactId}">
+     features="${project.artifactId}"
+     apps="org.onosproject.intentsynchronizer,org.onosproject.route-service">
     <description>${project.description}</description>
     <readme>Application controlling SDN-based L3 Internet Exchange Points.</readme>
     <artifact>mvn:${project.groupId}/onos-apps-routing-api/${onos.version}</artifact>
-    <artifact>mvn:${project.groupId}/onos-apps-routing/${onos.version}</artifact>
+    <artifact>mvn:${project.groupId}/onos-apps-route-service-api/${onos.version}</artifact>
+    <artifact>mvn:${project.groupId}/onos-apps-intentsync/${onos.version}</artifact>
     <artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
 </app>
diff --git a/sdx-l3/features.xml b/sdx-l3/features.xml
index f1e8027..579e85e 100644
--- a/sdx-l3/features.xml
+++ b/sdx-l3/features.xml
@@ -21,7 +21,7 @@
              description="${project.description}">
         <feature>onos-api</feature>
         <bundle>mvn:${project.groupId}/onos-apps-routing-api/${onos.version}</bundle>
-        <bundle>mvn:${project.groupId}/onos-apps-routing/${onos.version}</bundle>
+        <bundle>mvn:${project.groupId}/onos-apps-route-service-api/${onos.version}</bundle>
         <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
     </feature>
 </features>
diff --git a/sdx-l3/pom.xml b/sdx-l3/pom.xml
index 77af083..cc6f8f5 100644
--- a/sdx-l3/pom.xml
+++ b/sdx-l3/pom.xml
@@ -1,5 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
 <!--
   ~ Copyright 2016 - present Open Networking Foundation
   ~
@@ -19,37 +18,26 @@
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
-
     <parent>
         <groupId>org.onosproject</groupId>
         <artifactId>onos-dependencies</artifactId>
-        <version>1.7.0</version>
+        <version>1.12.0</version>
         <relativePath/>
     </parent>
-
     <artifactId>onos-app-sdx-l3</artifactId>
-    <version>1.9.0-SNAPSHOT</version>
+    <version>1.12.0-SNAPSHOT</version>
     <packaging>bundle</packaging>
-
     <description>SDX-L3 application for GEANT</description>
-
     <properties>
-        <onos.version>1.7.0</onos.version>
+        <onos.version>1.12.0</onos.version>
     </properties>
-
     <dependencies>
         <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-        </dependency>
-
-        <dependency>
             <groupId>org.onosproject</groupId>
             <artifactId>onlab-junit</artifactId>
             <version>${onos.version}</version>
             <scope>test</scope>
         </dependency>
-
         <dependency>
             <groupId>org.onosproject</groupId>
             <artifactId>onos-api</artifactId>
@@ -57,7 +45,6 @@
             <scope>test</scope>
             <classifier>tests</classifier>
         </dependency>
-
         <dependency>
             <groupId>org.onosproject</groupId>
             <artifactId>onos-incubator-api</artifactId>
@@ -65,19 +52,16 @@
             <scope>test</scope>
             <classifier>tests</classifier>
         </dependency>
-
         <dependency>
             <groupId>org.onosproject</groupId>
-            <artifactId>onos-apps-routing</artifactId>
+            <artifactId>onos-apps-intentsync</artifactId>
             <version>${onos.version}</version>
         </dependency>
-
         <dependency>
             <groupId>org.onosproject</groupId>
             <artifactId>onos-apps-routing-api</artifactId>
             <version>${onos.version}</version>
         </dependency>
-
         <dependency>
             <groupId>org.onosproject</groupId>
             <artifactId>onos-apps-routing-api</artifactId>
@@ -85,30 +69,37 @@
             <classifier>tests</classifier>
             <version>${onos.version}</version>
         </dependency>
-
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-apps-route-service-api</artifactId>
+            <version>${onos.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-apps-route-service-api</artifactId>
+            <scope>test</scope>
+            <classifier>tests</classifier>
+            <version>${onos.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.onosproject</groupId>
             <artifactId>onos-cli</artifactId>
             <version>${onos.version}</version>
         </dependency>
-
         <dependency>
             <groupId>org.apache.karaf.shell</groupId>
             <artifactId>org.apache.karaf.shell.console</artifactId>
         </dependency>
-
         <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.core</artifactId>
         </dependency>
-
         <dependency>
             <groupId>org.easymock</groupId>
             <artifactId>easymock</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
-
     <build>
         <plugins>
             <plugin>
@@ -125,5 +116,4 @@
             </plugin>
         </plugins>
     </build>
-
 </project>
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3.java
index f7ee1f7..eac2e18 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3.java
@@ -24,8 +24,8 @@
 import org.onosproject.app.ApplicationService;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
-import org.onosproject.incubator.component.ComponentService;
-import org.onosproject.routing.IntentSynchronizationService;
+import org.onosproject.component.ComponentService;
+import org.onosproject.intentsync.IntentSynchronizationService;
 import org.slf4j.Logger;
 
 import java.util.ArrayList;
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3Fib.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3Fib.java
index ca4c7d1..8b4bc7a 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3Fib.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3Fib.java
@@ -30,14 +30,14 @@
 import org.onlab.packet.VlanId;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
-import org.onosproject.incubator.net.intf.Interface;
-import org.onosproject.incubator.net.intf.InterfaceEvent;
-import org.onosproject.incubator.net.intf.InterfaceListener;
-import org.onosproject.incubator.net.intf.InterfaceService;
-import org.onosproject.incubator.net.routing.ResolvedRoute;
-import org.onosproject.incubator.net.routing.RouteEvent;
-import org.onosproject.incubator.net.routing.RouteListener;
-import org.onosproject.incubator.net.routing.RouteService;
+import org.onosproject.net.intf.Interface;
+import org.onosproject.net.intf.InterfaceEvent;
+import org.onosproject.net.intf.InterfaceListener;
+import org.onosproject.net.intf.InterfaceService;
+import org.onosproject.routeservice.ResolvedRoute;
+import org.onosproject.routeservice.RouteEvent;
+import org.onosproject.routeservice.RouteListener;
+import org.onosproject.routeservice.RouteService;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.flow.DefaultTrafficSelector;
 import org.onosproject.net.flow.DefaultTrafficTreatment;
@@ -47,7 +47,7 @@
 import org.onosproject.net.intent.Key;
 import org.onosproject.net.intent.MultiPointToSinglePointIntent;
 import org.onosproject.net.intent.constraint.PartialFailureConstraint;
-import org.onosproject.routing.IntentSynchronizationService;
+import org.onosproject.intentsync.IntentSynchronizationService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3PeerService.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3PeerService.java
index 3dd8e87..c1a2d28 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3PeerService.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/SdxL3PeerService.java
@@ -17,7 +17,7 @@
 package org.onosproject.sdxl3;
 
 import org.onlab.packet.IpAddress;
-import org.onosproject.incubator.net.intf.Interface;
+import org.onosproject.net.intf.Interface;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.routing.config.BgpConfig;
 import org.onosproject.sdxl3.config.SdxParticipantsConfig;
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/SdxL3NeighbourHandler.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/SdxL3NeighbourHandler.java
index df14bf4..8cf98a5 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/SdxL3NeighbourHandler.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/SdxL3NeighbourHandler.java
@@ -26,11 +26,11 @@
 import org.onlab.packet.VlanId;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
-import org.onosproject.incubator.net.intf.Interface;
-import org.onosproject.incubator.net.intf.InterfaceService;
-import org.onosproject.incubator.net.neighbour.NeighbourMessageContext;
-import org.onosproject.incubator.net.neighbour.NeighbourMessageHandler;
-import org.onosproject.incubator.net.neighbour.NeighbourResolutionService;
+import org.onosproject.net.intf.Interface;
+import org.onosproject.net.intf.InterfaceService;
+import org.onosproject.net.neighbour.NeighbourMessageContext;
+import org.onosproject.net.neighbour.NeighbourMessageHandler;
+import org.onosproject.net.neighbour.NeighbourResolutionService;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.Host;
 import org.onosproject.net.config.NetworkConfigEvent;
@@ -177,7 +177,7 @@
                     // address on this port. Drop all other requests.
                     interfaceService.getInterfacesByPort(context.inPort())
                             .stream()
-                            .filter(intf -> intf.ipAddresses()
+                            .filter(intf -> intf.ipAddressesList()
                                     .stream()
                                     .anyMatch(ia -> ia.ipAddress().equals(context.target()) &&
                                             ia.subnetAddress().contains(context.sender())))
diff --git a/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/SdxL3PeerManager.java b/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/SdxL3PeerManager.java
index 4bd31c2..230902a 100644
--- a/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/SdxL3PeerManager.java
+++ b/sdx-l3/src/main/java/org/onosproject/sdxl3/impl/SdxL3PeerManager.java
@@ -33,10 +33,10 @@
 import org.onlab.util.ItemNotFoundException;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
-import org.onosproject.incubator.net.intf.Interface;
-import org.onosproject.incubator.net.intf.InterfaceEvent;
-import org.onosproject.incubator.net.intf.InterfaceListener;
-import org.onosproject.incubator.net.intf.InterfaceService;
+import org.onosproject.net.intf.Interface;
+import org.onosproject.net.intf.InterfaceEvent;
+import org.onosproject.net.intf.InterfaceListener;
+import org.onosproject.net.intf.InterfaceService;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.config.ConfigFactory;
 import org.onosproject.net.config.NetworkConfigEvent;
@@ -52,9 +52,10 @@
 import org.onosproject.net.intent.IntentUtils;
 import org.onosproject.net.intent.Key;
 import org.onosproject.net.intent.PointToPointIntent;
-import org.onosproject.routing.IntentSynchronizationService;
+import org.onosproject.intentsync.IntentSynchronizationService;
 import org.onosproject.routing.RoutingService;
 import org.onosproject.routing.config.BgpConfig;
+import org.onosproject.routing.config.RoutingConfiguration;
 import org.onosproject.sdxl3.SdxL3;
 import org.onosproject.sdxl3.SdxL3PeerService;
 import org.onosproject.sdxl3.config.SdxParticipantsConfig;
@@ -124,8 +125,10 @@
 
     @Activate
     public void activate() {
-        sdxAppId = coreService.getAppId(SdxL3.SDX_L3_APP);
-        routerAppId = coreService.getAppId(RoutingService.ROUTER_APP_ID);
+        sdxAppId = coreService.registerApplication(SdxL3.SDX_L3_APP);
+        routerAppId = coreService.registerApplication(RoutingService.ROUTER_APP_ID);
+
+        RoutingConfiguration.register(registry);
 
         registry.registerConfigFactory(configFactory);
 
diff --git a/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3FibTest.java b/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3FibTest.java
index bf4936a..86c6bde 100644
--- a/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3FibTest.java
+++ b/sdx-l3/src/test/java/org/onosproject/sdxl3/SdxL3FibTest.java
@@ -29,14 +29,15 @@
 import org.onosproject.TestApplicationId;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreServiceAdapter;
-import org.onosproject.incubator.net.intf.Interface;
-import org.onosproject.incubator.net.intf.InterfaceListener;
-import org.onosproject.incubator.net.intf.InterfaceService;
-import org.onosproject.incubator.net.intf.InterfaceServiceAdapter;
-import org.onosproject.incubator.net.routing.ResolvedRoute;
-import org.onosproject.incubator.net.routing.RouteEvent;
-import org.onosproject.incubator.net.routing.RouteListener;
-import org.onosproject.incubator.net.routing.RouteServiceAdapter;
+import org.onosproject.net.intf.Interface;
+import org.onosproject.net.intf.InterfaceListener;
+import org.onosproject.net.intf.InterfaceService;
+import org.onosproject.net.intf.InterfaceServiceAdapter;
+import org.onosproject.routeservice.ResolvedRoute;
+import org.onosproject.routeservice.Route;
+import org.onosproject.routeservice.RouteEvent;
+import org.onosproject.routeservice.RouteListener;
+import org.onosproject.routeservice.RouteServiceAdapter;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.PortNumber;
@@ -48,7 +49,7 @@
 import org.onosproject.net.intent.AbstractIntentTest;
 import org.onosproject.net.intent.Key;
 import org.onosproject.net.intent.MultiPointToSinglePointIntent;
-import org.onosproject.routing.IntentSynchronizationService;
+import org.onosproject.intentsync.IntentSynchronizationService;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -121,7 +122,7 @@
 
     @Override
     @Before
-    public void setUp() throws Exception {
+    public void setUp() {
         super.setUp();
 
         interfaceService = createMock(InterfaceService.class);
@@ -234,8 +235,8 @@
     @Test
     public void testRouteAdd() {
         Ip4Prefix prefix = Ip4Prefix.valueOf("1.1.1.0/24");
-        ResolvedRoute resRoute = new ResolvedRoute(prefix,
-                                                   Ip4Address.valueOf(PEER1_IP),
+        ResolvedRoute resRoute = new ResolvedRoute(new Route(Route.Source.STATIC, prefix,
+                                                   Ip4Address.valueOf(PEER1_IP)),
                                                    MacAddress.valueOf(MAC1));
 
         // Construct a MultiPointToSinglePointIntent intent
@@ -282,8 +283,9 @@
     @Test
     public void testRouteAddWithVlan() {
         Ip4Prefix prefix = Ip4Prefix.valueOf("1.1.1.0/24");
-        ResolvedRoute resRoute = new ResolvedRoute(prefix,
-                                                   Ip4Address.valueOf(PEER3_IP),
+        ResolvedRoute resRoute = new ResolvedRoute(new Route(Route.Source.STATIC,
+                                                   prefix,
+                                                   Ip4Address.valueOf(PEER3_IP)),
                                                    MacAddress.valueOf(MAC1));
 
         // Construct a MultiPointToSinglePointIntent intent
@@ -337,8 +339,9 @@
         testRouteAdd();
 
         Ip4Prefix prefix = Ip4Prefix.valueOf("1.1.1.0/24");
-        ResolvedRoute resRoute = new ResolvedRoute(prefix,
-                                                   Ip4Address.valueOf(PEER2_IP),
+        ResolvedRoute resRoute = new ResolvedRoute(new Route(Route.Source.STATIC,
+                                                             prefix,
+                                                             Ip4Address.valueOf(PEER2_IP)),
                                                    MacAddress.valueOf(MAC1));
 
         // Construct a new MultiPointToSinglePointIntent intent
@@ -394,8 +397,9 @@
 
         IpPrefix prefix = Ip4Prefix.valueOf("1.1.1.0/24");
         // Construct the existing route entry
-        ResolvedRoute resRoute = new ResolvedRoute(prefix, null, null);
-
+        ResolvedRoute resRoute = new ResolvedRoute(
+                new Route(Route.Source.STATIC, prefix, Ip4Address.valueOf(PEER1_IP)),
+                MacAddress.valueOf(MAC1));
         // Construct the existing MultiPointToSinglePoint intent
         TrafficSelector.Builder selectorBuilder =
                 DefaultTrafficSelector.builder();
diff --git a/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerAdministrationTest.java b/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerAdministrationTest.java
index 8b160b6..07e72c8 100644
--- a/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerAdministrationTest.java
+++ b/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerAdministrationTest.java
@@ -29,9 +29,9 @@
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
 import org.onosproject.core.CoreServiceAdapter;
-import org.onosproject.incubator.net.intf.Interface;
-import org.onosproject.incubator.net.intf.InterfaceListener;
-import org.onosproject.incubator.net.intf.InterfaceService;
+import org.onosproject.net.intf.Interface;
+import org.onosproject.net.intf.InterfaceListener;
+import org.onosproject.net.intf.InterfaceService;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.PortNumber;
@@ -43,7 +43,7 @@
 import org.onosproject.net.host.InterfaceIpAddress;
 import org.onosproject.net.intent.AbstractIntentTest;
 import org.onosproject.net.intent.PointToPointIntent;
-import org.onosproject.routing.IntentSynchronizationService;
+import org.onosproject.intentsync.IntentSynchronizationService;
 import org.onosproject.routing.RoutingService;
 import org.onosproject.routing.config.BgpConfig;
 import org.onosproject.sdxl3.SdxL3;
@@ -138,7 +138,7 @@
 
     @Override
     @Before
-    public void setUp() throws Exception {
+    public void setUp() {
         super.setUp();
         // Setup services and configurations
         setupEnvironment();
@@ -182,7 +182,7 @@
         }
 
         @Override
-        public ApplicationId getAppId(String name) {
+        public ApplicationId registerApplication(String name) {
             return registeredApps.get(name);
         }
     }
diff --git a/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerConnectivityTest.java b/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerConnectivityTest.java
index 2d88b31..baa1434 100644
--- a/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerConnectivityTest.java
+++ b/sdx-l3/src/test/java/org/onosproject/sdxl3/impl/SdxL3PeerConnectivityTest.java
@@ -30,9 +30,9 @@
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
 import org.onosproject.core.CoreServiceAdapter;
-import org.onosproject.incubator.net.intf.Interface;
-import org.onosproject.incubator.net.intf.InterfaceListener;
-import org.onosproject.incubator.net.intf.InterfaceService;
+import org.onosproject.net.intf.Interface;
+import org.onosproject.net.intf.InterfaceListener;
+import org.onosproject.net.intf.InterfaceService;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.PortNumber;
@@ -50,7 +50,7 @@
 import org.onosproject.net.intent.Intent;
 import org.onosproject.net.intent.Key;
 import org.onosproject.net.intent.PointToPointIntent;
-import org.onosproject.routing.IntentSynchronizationService;
+import org.onosproject.intentsync.IntentSynchronizationService;
 import org.onosproject.routing.RoutingService;
 import org.onosproject.routing.config.BgpConfig;
 import org.onosproject.sdxl3.SdxL3;
@@ -157,7 +157,7 @@
             DefaultTrafficTreatment.emptyTreatment();
 
     @Before
-    public void setUp() throws Exception {
+    public void setUp() {
         super.setUp();
         // Setup services and configurations
         setupEnvironment();
@@ -203,7 +203,7 @@
         }
 
         @Override
-        public ApplicationId getAppId(String name) {
+        public ApplicationId registerApplication(String name) {
             return registeredApps.get(name);
         }
     }