Partially extract segmentrouting-api

Change-Id: Iaf2a0bb387a6e7024fa3d75b42cb4874c93a09bb
diff --git a/api/pom.xml b/api/pom.xml
new file mode 100644
index 0000000..d222db2
--- /dev/null
+++ b/api/pom.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2015-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.
+  -->
+  <project xmlns="http://maven.apache.org/POM/4.0.0"
+              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+              xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.onosproject</groupId>
+        <artifactId>segmentrouting</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>segmentrouting-api</artifactId>
+    <packaging>bundle</packaging>
+    <url>http://trellisfabric.org</url>
+    <description>Trellis control api</description>
+
+    <dependencies>
+        <!-- ONOS core -->
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-api</artifactId>
+            <version>${onos.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <!-- Tests -->
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-api</artifactId>
+            <version>${onos.version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file
diff --git a/app/src/main/java/org/onosproject/segmentrouting/config/BlockedPortsConfig.java b/api/src/main/java/org/onosproject/segmentrouting/config/BlockedPortsConfig.java
similarity index 100%
rename from app/src/main/java/org/onosproject/segmentrouting/config/BlockedPortsConfig.java
rename to api/src/main/java/org/onosproject/segmentrouting/config/BlockedPortsConfig.java
diff --git a/app/src/main/java/org/onosproject/segmentrouting/config/DeviceConfigNotFoundException.java b/api/src/main/java/org/onosproject/segmentrouting/config/DeviceConfigNotFoundException.java
similarity index 100%
rename from app/src/main/java/org/onosproject/segmentrouting/config/DeviceConfigNotFoundException.java
rename to api/src/main/java/org/onosproject/segmentrouting/config/DeviceConfigNotFoundException.java
diff --git a/app/src/main/java/org/onosproject/segmentrouting/config/DeviceProperties.java b/api/src/main/java/org/onosproject/segmentrouting/config/DeviceProperties.java
similarity index 100%
rename from app/src/main/java/org/onosproject/segmentrouting/config/DeviceProperties.java
rename to api/src/main/java/org/onosproject/segmentrouting/config/DeviceProperties.java
diff --git a/app/src/main/java/org/onosproject/segmentrouting/config/SegmentRoutingAppConfig.java b/api/src/main/java/org/onosproject/segmentrouting/config/SegmentRoutingAppConfig.java
similarity index 100%
rename from app/src/main/java/org/onosproject/segmentrouting/config/SegmentRoutingAppConfig.java
rename to api/src/main/java/org/onosproject/segmentrouting/config/SegmentRoutingAppConfig.java
diff --git a/app/src/main/java/org/onosproject/segmentrouting/config/SegmentRoutingDeviceConfig.java b/api/src/main/java/org/onosproject/segmentrouting/config/SegmentRoutingDeviceConfig.java
similarity index 100%
rename from app/src/main/java/org/onosproject/segmentrouting/config/SegmentRoutingDeviceConfig.java
rename to api/src/main/java/org/onosproject/segmentrouting/config/SegmentRoutingDeviceConfig.java
diff --git a/api/src/main/java/org/onosproject/segmentrouting/config/package-info.java b/api/src/main/java/org/onosproject/segmentrouting/config/package-info.java
new file mode 100644
index 0000000..a664a8f
--- /dev/null
+++ b/api/src/main/java/org/onosproject/segmentrouting/config/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2015-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.
+ */
+
+/**
+ * Segment routing network configuration mechanism.
+ */
+package org.onosproject.segmentrouting.config;
\ No newline at end of file
diff --git a/app/src/test/java/org/onosproject/segmentrouting/config/BlockedPortsConfigTest.java b/api/src/test/java/org/onosproject/segmentrouting/config/BlockedPortsConfigTest.java
similarity index 100%
rename from app/src/test/java/org/onosproject/segmentrouting/config/BlockedPortsConfigTest.java
rename to api/src/test/java/org/onosproject/segmentrouting/config/BlockedPortsConfigTest.java
diff --git a/app/src/test/java/org/onosproject/segmentrouting/config/SegmentRoutingAppConfigTest.java b/api/src/test/java/org/onosproject/segmentrouting/config/SegmentRoutingAppConfigTest.java
similarity index 98%
rename from app/src/test/java/org/onosproject/segmentrouting/config/SegmentRoutingAppConfigTest.java
rename to api/src/test/java/org/onosproject/segmentrouting/config/SegmentRoutingAppConfigTest.java
index 2a10f56..fa667c0 100644
--- a/app/src/test/java/org/onosproject/segmentrouting/config/SegmentRoutingAppConfigTest.java
+++ b/api/src/test/java/org/onosproject/segmentrouting/config/SegmentRoutingAppConfigTest.java
@@ -29,7 +29,6 @@
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.config.Config;
 import org.onosproject.net.config.ConfigApplyDelegate;
-import org.onosproject.segmentrouting.SegmentRoutingManager;
 
 import java.io.InputStream;
 import java.util.Set;
@@ -45,6 +44,7 @@
     private SegmentRoutingAppConfig invalidConfig;
     private SegmentRoutingAppConfig mplsEcmpConfig;
 
+    private static final String APP_NAME = "org.onosproject.segmentrouting";
     private static final MacAddress ROUTER_MAC_1 = MacAddress.valueOf("00:00:00:00:00:01");
     private static final MacAddress ROUTER_MAC_2 = MacAddress.valueOf("00:00:00:00:00:02");
     private static final MacAddress ROUTER_MAC_3 = MacAddress.valueOf("00:00:00:00:00:03");
@@ -73,7 +73,7 @@
         InputStream mplsEcmpJsonStream = SegmentRoutingAppConfigTest.class
                 .getResourceAsStream("/app-ecmp.json");
 
-        String key = SegmentRoutingManager.APP_NAME;
+        String key = APP_NAME;
         ApplicationId subject = new TestApplicationId(key);
         ObjectMapper mapper = new ObjectMapper();
         JsonNode jsonNode = mapper.readTree(jsonStream);
diff --git a/app/src/test/java/org/onosproject/segmentrouting/config/SegmentRoutingDeviceConfigTest.java b/api/src/test/java/org/onosproject/segmentrouting/config/SegmentRoutingDeviceConfigTest.java
similarity index 100%
rename from app/src/test/java/org/onosproject/segmentrouting/config/SegmentRoutingDeviceConfigTest.java
rename to api/src/test/java/org/onosproject/segmentrouting/config/SegmentRoutingDeviceConfigTest.java
diff --git a/app/src/test/resources/app-ecmp.json b/api/src/test/resources/app-ecmp.json
similarity index 100%
rename from app/src/test/resources/app-ecmp.json
rename to api/src/test/resources/app-ecmp.json
diff --git a/app/src/test/resources/app-invalid.json b/api/src/test/resources/app-invalid.json
similarity index 100%
rename from app/src/test/resources/app-invalid.json
rename to api/src/test/resources/app-invalid.json
diff --git a/app/src/test/resources/app.json b/api/src/test/resources/app.json
similarity index 100%
rename from app/src/test/resources/app.json
rename to api/src/test/resources/app.json
diff --git a/app/src/test/resources/blocked-ports-alt.json b/api/src/test/resources/blocked-ports-alt.json
similarity index 100%
rename from app/src/test/resources/blocked-ports-alt.json
rename to api/src/test/resources/blocked-ports-alt.json
diff --git a/app/src/test/resources/blocked-ports.json b/api/src/test/resources/blocked-ports.json
similarity index 100%
rename from app/src/test/resources/blocked-ports.json
rename to api/src/test/resources/blocked-ports.json
diff --git a/app/src/test/resources/device-invalid.json b/api/src/test/resources/device-invalid.json
similarity index 100%
rename from app/src/test/resources/device-invalid.json
rename to api/src/test/resources/device-invalid.json
diff --git a/app/src/test/resources/device-ipv6.json b/api/src/test/resources/device-ipv6.json
similarity index 100%
rename from app/src/test/resources/device-ipv6.json
rename to api/src/test/resources/device-ipv6.json
diff --git a/app/src/test/resources/device-pair.json b/api/src/test/resources/device-pair.json
similarity index 100%
rename from app/src/test/resources/device-pair.json
rename to api/src/test/resources/device-pair.json
diff --git a/app/src/test/resources/device.json b/api/src/test/resources/device.json
similarity index 100%
rename from app/src/test/resources/device.json
rename to api/src/test/resources/device.json
diff --git a/app/pom.xml b/app/pom.xml
index e275676..c43447e 100644
--- a/app/pom.xml
+++ b/app/pom.xml
@@ -55,6 +55,12 @@
         <!-- Other Trellis apps -->
         <dependency>
             <groupId>org.onosproject</groupId>
+            <artifactId>segmentrouting-api</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
             <artifactId>onos-apps-portloadbalancer</artifactId>
             <version>${onos.version}</version>
             <scope>provided</scope>
@@ -95,6 +101,13 @@
         </dependency>
         <dependency>
             <groupId>org.onosproject</groupId>
+            <artifactId>segmentrouting-api</artifactId>
+            <version>${project.version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
             <artifactId>onos-apps-route-service-api</artifactId>
             <version>${onos.version}</version>
             <classifier>tests</classifier>
diff --git a/pom.xml b/pom.xml
index 864ae54..3ac1eb4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,6 +33,7 @@
     <description>Trellis control</description>
 
     <modules>
+        <module>api</module>
         <module>app</module>
         <module>web</module>
         <module>oar</module>