Move IntentSynchronizer to routing bundle.

This allows it to be used separately from SDNIP.

Change-Id: I45358666aa32763cb4bcac8f1c0a4025c6b76863
diff --git a/apps/routing/pom.xml b/apps/routing/pom.xml
index 1123c12..51bd396 100644
--- a/apps/routing/pom.xml
+++ b/apps/routing/pom.xml
@@ -106,6 +106,14 @@
             <scope>test</scope>
         </dependency>
 
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-api</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+            <classifier>tests</classifier>
+        </dependency>
+
     </dependencies>
 
 </project>
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/PrimaryChangeCommand.java b/apps/routing/src/main/java/org/onosproject/routing/cli/PrimaryChangeCommand.java
similarity index 94%
rename from apps/sdnip/src/main/java/org/onosproject/sdnip/cli/PrimaryChangeCommand.java
rename to apps/routing/src/main/java/org/onosproject/routing/cli/PrimaryChangeCommand.java
index 11da428..232abe6 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/PrimaryChangeCommand.java
+++ b/apps/routing/src/main/java/org/onosproject/routing/cli/PrimaryChangeCommand.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 Open Networking Laboratory
+ * Copyright 2016 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.
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.sdnip.cli;
+package org.onosproject.routing.cli;
 
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java b/apps/routing/src/main/java/org/onosproject/routing/impl/IntentSynchronizer.java
similarity index 98%
rename from apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java
rename to apps/routing/src/main/java/org/onosproject/routing/impl/IntentSynchronizer.java
index 35383dc..22c7d43 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java
+++ b/apps/routing/src/main/java/org/onosproject/routing/impl/IntentSynchronizer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014-2015 Open Networking Laboratory
+ * Copyright 2016 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.
@@ -13,7 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.sdnip;
+
+package org.onosproject.routing.impl;
 
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
@@ -30,6 +31,7 @@
 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.routing.IntentSynchronizationAdminService;
 import org.onosproject.routing.IntentSynchronizationService;
@@ -45,8 +47,6 @@
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutorService;
 
-import org.onosproject.net.intent.IntentUtils;
-
 import static java.util.concurrent.Executors.newSingleThreadExecutor;
 import static org.onlab.util.Tools.groupedThreads;
 
@@ -54,7 +54,7 @@
  * Synchronizes intents between an in-memory intent store and the IntentService.
  */
 @Service
-@Component(immediate = true)
+@Component(immediate = false)
 public class IntentSynchronizer implements IntentSynchronizationService,
         IntentSynchronizationAdminService {
 
diff --git a/apps/routing/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/apps/routing/src/main/resources/OSGI-INF/blueprint/shell-config.xml
index 866e1c4..d5ca246 100644
--- a/apps/routing/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/apps/routing/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -34,5 +34,8 @@
     <command>
       <action class="org.onosproject.routing.cli.BgpSpeakersListCommand"/>
     </command>
+    <command>
+      <action class="org.onosproject.routing.cli.PrimaryChangeCommand"/>
+    </command>
   </command-bundle>
 </blueprint>
diff --git a/apps/sdnip/src/test/java/org/onosproject/sdnip/IntentSyncTest.java b/apps/routing/src/test/java/org/onosproject/routing/impl/IntentSynchronizerTest.java
similarity index 98%
rename from apps/sdnip/src/test/java/org/onosproject/sdnip/IntentSyncTest.java
rename to apps/routing/src/test/java/org/onosproject/routing/impl/IntentSynchronizerTest.java
index 37c50d3..d265323 100644
--- a/apps/sdnip/src/test/java/org/onosproject/sdnip/IntentSyncTest.java
+++ b/apps/routing/src/test/java/org/onosproject/routing/impl/IntentSynchronizerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014-2015 Open Networking Laboratory
+ * Copyright 2016 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.
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.sdnip;
+package org.onosproject.routing.impl;
 
 import com.google.common.collect.Sets;
 import com.google.common.util.concurrent.MoreExecutors;
@@ -68,7 +68,7 @@
  * This class tests the intent synchronization function in the
  * IntentSynchronizer class.
  */
-public class IntentSyncTest extends AbstractIntentTest {
+public class IntentSynchronizerTest extends AbstractIntentTest {
 
     private IntentService intentService;
 
@@ -400,7 +400,6 @@
                         .treatment(treatmentBuilder.build())
                         .ingressPoints(ingressPoints)
                         .egressPoint(egressPoint)
-                        .constraints(SdnIpFib.CONSTRAINTS)
                         .build();
         return intent;
     }
diff --git a/apps/sdnip/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/apps/sdnip/src/main/resources/OSGI-INF/blueprint/shell-config.xml
index 97b2f09..0238d46 100644
--- a/apps/sdnip/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/apps/sdnip/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -17,9 +17,6 @@
 
   <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
     <command>
-      <action class="org.onosproject.sdnip.cli.PrimaryChangeCommand"/>
-    </command>
-    <command>
       <action class="org.onosproject.sdnip.cli.AddSpeakerCommand"/>
     </command>
     <command>