Reorganized SADIS to separate out api and app
Change-Id: Id30e9bc2880282930f97ab947dd95f19f853b3e8
diff --git a/api/pom.xml b/api/pom.xml
new file mode 100755
index 0000000..4e87df9
--- /dev/null
+++ b/api/pom.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2017-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.
+ -->
+<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>
+ <artifactId>sadis</artifactId>
+ <groupId>org.opencord</groupId>
+ <version>1.0.0</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>sadis-api</artifactId>
+ <packaging>bundle</packaging>
+
+ <url>http://opencord.org</url>
+
+ <description>Subscriber and Device Information Service API</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-junit</artifactId>
+ <version>${onos.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-core-serializers</artifactId>
+ <version>${onos.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/main/java/org/opencord/sadis/SubscriberAndDeviceInformation.java b/api/src/main/java/org/opencord/sadis/SubscriberAndDeviceInformation.java
similarity index 99%
rename from src/main/java/org/opencord/sadis/SubscriberAndDeviceInformation.java
rename to api/src/main/java/org/opencord/sadis/SubscriberAndDeviceInformation.java
index 266f25a..2ebe42e 100644
--- a/src/main/java/org/opencord/sadis/SubscriberAndDeviceInformation.java
+++ b/api/src/main/java/org/opencord/sadis/SubscriberAndDeviceInformation.java
@@ -53,7 +53,7 @@
@JsonProperty(value = "nasId")
String nasId;
- SubscriberAndDeviceInformation() {
+ protected SubscriberAndDeviceInformation() {
}
public final String id() {
diff --git a/src/main/java/org/opencord/sadis/SubscriberAndDeviceInformationService.java b/api/src/main/java/org/opencord/sadis/SubscriberAndDeviceInformationService.java
similarity index 94%
rename from src/main/java/org/opencord/sadis/SubscriberAndDeviceInformationService.java
rename to api/src/main/java/org/opencord/sadis/SubscriberAndDeviceInformationService.java
index 8754978..ad1e313 100644
--- a/src/main/java/org/opencord/sadis/SubscriberAndDeviceInformationService.java
+++ b/api/src/main/java/org/opencord/sadis/SubscriberAndDeviceInformationService.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2017-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.
diff --git a/src/main/java/org/opencord/sadis/cli/package-info.java b/api/src/main/java/org/opencord/sadis/package-info.java
old mode 100644
new mode 100755
similarity index 86%
copy from src/main/java/org/opencord/sadis/cli/package-info.java
copy to api/src/main/java/org/opencord/sadis/package-info.java
index 9eee64f..be41c22
--- a/src/main/java/org/opencord/sadis/cli/package-info.java
+++ b/api/src/main/java/org/opencord/sadis/package-info.java
@@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/**
- * Subscriber And Device Information Service CLI handlers.
+ * Subscriber and Device Information Service API.
*/
-package org.opencord.sadis.cli;
+package org.opencord.sadis;
diff --git a/app/app.xml b/app/app.xml
new file mode 100755
index 0000000..ee1f3c8
--- /dev/null
+++ b/app/app.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2017-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.
+ -->
+<app name="org.opencord.sadis" origin="ON.Lab" version="${project.version}"
+ category="Traffic Steering" url="http://onosproject.org" title="Subscriber And Device Information App"
+ featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
+ features="${project.artifactId}" apps="org.opencord.config">
+ <description>${project.description}</description>
+ <artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
+ <artifact>mvn:${project.groupId}/sadis-api/${project.version}</artifact>
+</app>
diff --git a/app/features.xml b/app/features.xml
new file mode 100755
index 0000000..2e1e300
--- /dev/null
+++ b/app/features.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+ ~ Copyright 2017-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.
+ -->
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
+ <feature name="${project.artifactId}" version="${project.version}"
+ description="${project.description}">
+ <feature>onos-api</feature>
+ <bundle>mvn:${project.groupId}/sadis-api/${project.version}</bundle>
+ <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
+ </feature>
+</features>
diff --git a/app/pom.xml b/app/pom.xml
new file mode 100755
index 0000000..c9d29ac
--- /dev/null
+++ b/app/pom.xml
@@ -0,0 +1,193 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2017-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.
+ -->
+<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">
+ <parent>
+ <groupId>org.opencord</groupId>
+ <artifactId>sadis</artifactId>
+ <version>1.0.0</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>sadis-app</artifactId>
+
+ <packaging>bundle</packaging>
+ <description>Subscriber and Device Information application for CORD</description>
+
+ <properties>
+ <web.context>/onos/sadis</web.context>
+ <api.version>1.0.0</api.version>
+ <api.title>Subscriber And Device Information REST API</api.title>
+ <api.description>Subscriber And Device Information REST API</api.description>
+ <api.package>org.onosproject.sadis.rest</api.package>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-api</artifactId>
+ <version>${onos.version}</version>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opencord</groupId>
+ <artifactId>sadis-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-osgi</artifactId>
+ <version>${onos.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-junit</artifactId>
+ <version>${onos.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.scr.annotations</artifactId>
+ <version>1.9.12</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <version>2.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.8.6</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.8.6</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>5.0.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-rest</artifactId>
+ <version>${onos.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.console</artifactId>
+ <version>3.0.8</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-cli</artifactId>
+ <version>${onos.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-servlet</artifactId>
+ <version>2.25.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-rest</artifactId>
+ <version>${onos.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <_wab>src/main/webapp/</_wab>
+ <Include-Resource>
+ WEB-INF/classes/apidoc/swagger.json=target/swagger.json,
+ {maven-resources}
+ </Include-Resource>
+ <Bundle-SymbolicName>
+ ${project.groupId}.${project.artifactId}
+ </Bundle-SymbolicName>
+ <Import-Package>
+ *,org.glassfish.jersey.servlet
+ </Import-Package>
+ <Web-ContextPath>${web.context}</Web-ContextPath>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-scr-plugin</artifactId>
+ <version>1.21.0</version>
+ <executions>
+ <execution>
+ <id>generate-scr-srcdescriptor</id>
+ <goals>
+ <goal>scr</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <supportedProjectTypes>
+ <supportedProjectType>bundle</supportedProjectType>
+ <supportedProjectType>war</supportedProjectType>
+ </supportedProjectTypes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/main/java/org/opencord/sadis/cli/SubscriberGetCommand.java b/app/src/main/java/org/opencord/sadis/cli/SubscriberGetCommand.java
similarity index 100%
rename from src/main/java/org/opencord/sadis/cli/SubscriberGetCommand.java
rename to app/src/main/java/org/opencord/sadis/cli/SubscriberGetCommand.java
diff --git a/src/main/java/org/opencord/sadis/cli/package-info.java b/app/src/main/java/org/opencord/sadis/cli/package-info.java
similarity index 90%
rename from src/main/java/org/opencord/sadis/cli/package-info.java
rename to app/src/main/java/org/opencord/sadis/cli/package-info.java
index 9eee64f..04738d2 100644
--- a/src/main/java/org/opencord/sadis/cli/package-info.java
+++ b/app/src/main/java/org/opencord/sadis/cli/package-info.java
@@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/**
- * Subscriber And Device Information Service CLI handlers.
+ * SADIS application for handling Subscriber and Device Information.
*/
package org.opencord.sadis.cli;
diff --git a/src/main/java/org/opencord/sadis/SadisConfig.java b/app/src/main/java/org/opencord/sadis/impl/SadisConfig.java
similarity index 98%
rename from src/main/java/org/opencord/sadis/SadisConfig.java
rename to app/src/main/java/org/opencord/sadis/impl/SadisConfig.java
index fd9689f..26aaa87 100644
--- a/src/main/java/org/opencord/sadis/SadisConfig.java
+++ b/app/src/main/java/org/opencord/sadis/impl/SadisConfig.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.opencord.sadis;
+package org.opencord.sadis.impl;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -26,6 +26,8 @@
import org.onlab.packet.VlanId;
import org.onosproject.core.ApplicationId;
import org.onosproject.net.config.Config;
+import org.opencord.sadis.SubscriberAndDeviceInformation;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/src/main/java/org/opencord/sadis/SadisManager.java b/app/src/main/java/org/opencord/sadis/impl/SadisManager.java
similarity index 98%
rename from src/main/java/org/opencord/sadis/SadisManager.java
rename to app/src/main/java/org/opencord/sadis/impl/SadisManager.java
index e638d9e..713b8b0 100644
--- a/src/main/java/org/opencord/sadis/SadisManager.java
+++ b/app/src/main/java/org/opencord/sadis/impl/SadisManager.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.opencord.sadis;
+package org.opencord.sadis.impl;
import static org.onosproject.net.config.basics.SubjectFactories.APP_SUBJECT_FACTORY;
diff --git a/src/main/java/org/opencord/sadis/SubscriberAndDeviceInformationAdapter.java b/app/src/main/java/org/opencord/sadis/impl/SubscriberAndDeviceInformationAdapter.java
similarity index 96%
rename from src/main/java/org/opencord/sadis/SubscriberAndDeviceInformationAdapter.java
rename to app/src/main/java/org/opencord/sadis/impl/SubscriberAndDeviceInformationAdapter.java
index 56e60c5..7e063f7 100644
--- a/src/main/java/org/opencord/sadis/SubscriberAndDeviceInformationAdapter.java
+++ b/app/src/main/java/org/opencord/sadis/impl/SubscriberAndDeviceInformationAdapter.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.opencord.sadis;
+package org.opencord.sadis.impl;
import java.io.IOException;
import java.io.InputStream;
@@ -22,6 +22,9 @@
import java.util.Map;
import java.util.concurrent.TimeUnit;
+import org.opencord.sadis.SubscriberAndDeviceInformation;
+import org.opencord.sadis.SubscriberAndDeviceInformationService;
+
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
diff --git a/src/main/java/org/opencord/sadis/package-info.java b/app/src/main/java/org/opencord/sadis/impl/package-info.java
similarity index 100%
rename from src/main/java/org/opencord/sadis/package-info.java
rename to app/src/main/java/org/opencord/sadis/impl/package-info.java
diff --git a/src/main/java/org/opencord/sadis/AppWebApplication.java b/app/src/main/java/org/opencord/sadis/rest/AppWebApplication.java
similarity index 96%
rename from src/main/java/org/opencord/sadis/AppWebApplication.java
rename to app/src/main/java/org/opencord/sadis/rest/AppWebApplication.java
index 6bbbe48..25c3683 100644
--- a/src/main/java/org/opencord/sadis/AppWebApplication.java
+++ b/app/src/main/java/org/opencord/sadis/rest/AppWebApplication.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.opencord.sadis;
+package org.opencord.sadis.rest;
import org.onlab.rest.AbstractWebApplication;
diff --git a/src/main/java/org/opencord/sadis/AppWebResource.java b/app/src/main/java/org/opencord/sadis/rest/AppWebResource.java
similarity index 96%
rename from src/main/java/org/opencord/sadis/AppWebResource.java
rename to app/src/main/java/org/opencord/sadis/rest/AppWebResource.java
index 581728c..41c2819 100644
--- a/src/main/java/org/opencord/sadis/AppWebResource.java
+++ b/app/src/main/java/org/opencord/sadis/rest/AppWebResource.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.opencord.sadis;
+package org.opencord.sadis.rest;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onosproject.rest.AbstractWebResource;
@@ -32,8 +32,6 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-//import static org.onlab.util.Tools.nullIsNotFound;
-
/**
* Subscriber And Device Information Service web resource.
*/
diff --git a/src/main/java/org/opencord/sadis/cli/package-info.java b/app/src/main/java/org/opencord/sadis/rest/package-info.java
old mode 100644
new mode 100755
similarity index 86%
copy from src/main/java/org/opencord/sadis/cli/package-info.java
copy to app/src/main/java/org/opencord/sadis/rest/package-info.java
index 9eee64f..4a0c20e
--- a/src/main/java/org/opencord/sadis/cli/package-info.java
+++ b/app/src/main/java/org/opencord/sadis/rest/package-info.java
@@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/**
- * Subscriber And Device Information Service CLI handlers.
+ * REST APIs for the SADIS application.
*/
-package org.opencord.sadis.cli;
+package org.opencord.sadis.rest;
diff --git a/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/app/src/main/resources/OSGI-INF/blueprint/shell-config.xml
similarity index 91%
rename from src/main/resources/OSGI-INF/blueprint/shell-config.xml
rename to app/src/main/resources/OSGI-INF/blueprint/shell-config.xml
index 9c8f318..4f3126c 100644
--- a/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/app/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -17,7 +17,7 @@
<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
<command>
- <action class="org.opencord.sadis.AppCommand"/>
+ <action class="org.opencord.sadis.cli.SubscriberGetCommand"/>
</command>
</command-bundle>
diff --git a/src/main/resources/config.json b/app/src/main/resources/config.json
similarity index 100%
rename from src/main/resources/config.json
rename to app/src/main/resources/config.json
diff --git a/src/main/webapp/WEB-INF/web.xml b/app/src/main/webapp/WEB-INF/web.xml
similarity index 95%
rename from src/main/webapp/WEB-INF/web.xml
rename to app/src/main/webapp/WEB-INF/web.xml
index e27be50..1319998 100644
--- a/src/main/webapp/WEB-INF/web.xml
+++ b/app/src/main/webapp/WEB-INF/web.xml
@@ -45,7 +45,7 @@
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
- <param-value>org.opencord.sadis.AppWebApplication</param-value>
+ <param-value>org.opencord.sadis.rest.AppWebApplication</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
diff --git a/src/test/java/org/opencord/sadis/SadisManagerTest.java b/app/src/test/java/org/opencord/sadis/impl/SadisManagerTest.java
similarity index 69%
rename from src/test/java/org/opencord/sadis/SadisManagerTest.java
rename to app/src/test/java/org/opencord/sadis/impl/SadisManagerTest.java
index 0ea58bb..4b89b40 100644
--- a/src/test/java/org/opencord/sadis/SadisManagerTest.java
+++ b/app/src/test/java/org/opencord/sadis/impl/SadisManagerTest.java
@@ -13,9 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.opencord.sadis;
+package org.opencord.sadis.impl;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.io.InputStream;
import java.time.Duration;
@@ -36,6 +37,8 @@
import org.onosproject.net.config.ConfigApplyDelegate;
import org.onosproject.net.config.NetworkConfigRegistryAdapter;
+import org.opencord.sadis.SubscriberAndDeviceInformation;
+
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -79,13 +82,13 @@
assertEquals(Duration.parse("PT1m"), config.getCacheTtl());
List<SubscriberAndDeviceInformation> entries = config.getEntries();
assertEquals(3, entries.size());
- assertEquals(SubscriberAndDeviceInformationBuilder.build("1", (short) 2, (short) 2, "1/1/2", (short) 125,
- (short) 3, "aa:bb:cc:dd:ee:ff", "XXX-NASID", "10.10.10.10"), entries.get(0));
- assertEquals(SubscriberAndDeviceInformationBuilder.build("2", (short) 4, (short) 4, "1/1/2", (short) 129,
- (short) 4, "aa:bb:cc:dd:ee:ff", "YYY-NASID", "1.1.1.1"), entries.get(1));
- assertEquals(SubscriberAndDeviceInformationBuilder.build("cc:dd:ee:ff:aa:bb", (short) -1, (short) -1, null,
+ assertTrue(SubscriberAndDeviceInformationBuilder.build("1", (short) 2, (short) 2, "1/1/2", (short) 125,
+ (short) 3, "aa:bb:cc:dd:ee:ff", "XXX-NASID", "10.10.10.10").checkEquals(entries.get(0)));
+ assertTrue(SubscriberAndDeviceInformationBuilder.build("2", (short) 4, (short) 4, "1/1/2", (short) 129,
+ (short) 4, "aa:bb:cc:dd:ee:ff", "YYY-NASID", "1.1.1.1").checkEquals(entries.get(1)));
+ assertTrue(SubscriberAndDeviceInformationBuilder.build("cc:dd:ee:ff:aa:bb", (short) -1, (short) -1, null,
(short) -1,
- (short) -1, "cc:dd:ee:ff:aa:bb", "CCC-NASID", "12.12.12.12"), entries.get(2));
+ (short) -1, "cc:dd:ee:ff:aa:bb", "CCC-NASID", "12.12.12.12").checkEquals(entries.get(2)));
}
@@ -93,9 +96,10 @@
private static final class SubscriberAndDeviceInformationBuilder extends SubscriberAndDeviceInformation {
- public static SubscriberAndDeviceInformation build(String id, short cTag, short sTag, String nasPortId,
+ public static SubscriberAndDeviceInformationBuilder build(String id, short cTag, short sTag, String nasPortId,
short port, short slot, String mac, String nasId, String ipAddress) {
- SubscriberAndDeviceInformation info = new SubscriberAndDeviceInformation();
+ //SubscriberAndDeviceInformation info = new SubscriberAndDeviceInformation();
+ SubscriberAndDeviceInformationBuilder info = new SubscriberAndDeviceInformationBuilder();
info.setId(id);
if (cTag != -1) {
info.setCTag(VlanId.vlanId(cTag));
@@ -115,6 +119,68 @@
info.setNasId(nasId);
return info;
}
+
+ public boolean checkEquals(SubscriberAndDeviceInformation other) {
+ if (other == null) {
+ return false;
+ }
+ if (this.cTag() == null) {
+ if (other.cTag() != null) {
+ return false;
+ }
+ } else if (!this.cTag().equals(other.cTag())) {
+ return false;
+ }
+ if (this.hardwareIdentifier() == null) {
+ if (other.hardwareIdentifier() != null) {
+ return false;
+ }
+ } else if (!this.hardwareIdentifier().equals(other.hardwareIdentifier())) {
+ return false;
+ }
+ if (this.id() == null) {
+ if (other.id() != null) {
+ return false;
+ }
+ } else if (!this.id().equals(other.id())) {
+ return false;
+ }
+ if (this.nasPortId() == null) {
+ if (other.nasPortId() != null) {
+ return false;
+ }
+ } else if (!this.nasPortId().equals(other.nasPortId())) {
+ return false;
+ }
+ if (this.nasId() == null) {
+ if (other.nasId() != null) {
+ return false;
+ }
+ } else if (!this.nasId().equals(other.nasId())) {
+ return false;
+ }
+ if (this.ipAddress() == null) {
+ if (other.ipAddress() != null) {
+ return false;
+ }
+ } else if (!this.ipAddress().equals(other.ipAddress())) {
+ return false;
+ }
+ if (this.port() != other.port()) {
+ return false;
+ }
+ if (this.sTag() == null) {
+ if (other.sTag() != null) {
+ return false;
+ }
+ } else if (!this.sTag().equals(other.sTag())) {
+ return false;
+ }
+ if (this.slot() != other.slot()) {
+ return false;
+ }
+ return true;
+ }
}
/**
diff --git a/pom.xml b/pom.xml
index 78e8e3a..e1a7a8d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- ~ Copyright 2017 Open Networking Laboratory
+ ~ Copyright 2017-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.
@@ -12,8 +12,11 @@
~ 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">
+ ~ 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>
@@ -26,15 +29,11 @@
<groupId>org.opencord</groupId>
<artifactId>sadis</artifactId>
<version>1.0.0</version>
- <packaging>bundle</packaging>
-
- <description>ONOS OSGi bundle archetype</description>
- <url>http://onosproject.org</url>
+ <packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<onos.version>1.10.0</onos.version>
-
<onos.app.name>org.opencord.sadis</onos.app.name>
<onos.app.category>Utility</onos.app.category>
<onos.app.title>Subscriber and Access Device Information Service</onos.app.title>
@@ -42,14 +41,13 @@
<onos.app.url>http://opencord.org</onos.app.url>
<onos.app.readme>https://gerrit.opencord.org/gitweb?p=igmp.git;f=README.md;hb=HEAD</onos.app.readme>
<onos.app.requires>org.opencord.config</onos.app.requires>
-
- <api.title>Subscriber And Device Information REST API</api.title>
- <api.version>1.0.0</api.version>
- <api.description>Subscriber And Device Information REST API</api.description>
- <api.package>org.opencord.sadis</api.package>
- <web.context>/onos/sadis</web.context>
</properties>
+ <modules>
+ <module>api</module>
+ <module>app</module>
+ </modules>
+
<dependencies>
<dependency>
<groupId>org.onosproject</groupId>
@@ -59,178 +57,65 @@
<dependency>
<groupId>org.onosproject</groupId>
+ <artifactId>onlab-misc</artifactId>
+ <version>${onos.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
<artifactId>onlab-osgi</artifactId>
<version>${onos.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onlab-junit</artifactId>
+ <artifactId>onos-incubator-api</artifactId>
<version>${onos.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-api</artifactId>
+ <artifactId>onos-incubator-net</artifactId>
<version>${onos.version}</version>
- <scope>test</scope>
- <classifier>tests</classifier>
- </dependency>
-
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.scr.annotations</artifactId>
- <version>1.9.12</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>2.0.1</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.8.6</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-rest</artifactId>
+ <artifactId>onos-core-common</artifactId>
<version>${onos.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.console</artifactId>
- <version>3.0.8</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>2.8.6</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-cli</artifactId>
- <version>${onos.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.glassfish.jersey.containers</groupId>
- <artifactId>jersey-container-servlet</artifactId>
- <version>2.25.1</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>5.0.0</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-rest</artifactId>
- <version>${onos.version}</version>
- <scope>provided</scope>
+ <groupId>org.opencord</groupId>
+ <artifactId>cord-config</artifactId>
+ <version>${project.version}</version>
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>3.0.1</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <_wab>src/main/webapp/</_wab>
- <Include-Resource>WEB-INF/classes/apidoc/swagger.json=target/swagger.json,
- {maven-resources}</Include-Resource>
- <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
- <Import-Package>*,org.glassfish.jersey.servlet</Import-Package>
- <Web-ContextPath>${web.context}</Web-ContextPath>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.5.1</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- <version>1.21.0</version>
- <executions>
- <execution>
- <id>generate-scr-srcdescriptor</id>
- <goals>
- <goal>scr</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <supportedProjectTypes>
- <supportedProjectType>bundle</supportedProjectType>
- <supportedProjectType>war</supportedProjectType>
- </supportedProjectTypes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-maven-plugin</artifactId>
- <version>1.10</version>
- <executions>
- <execution>
- <id>cfg</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>cfg</goal>
- </goals>
- </execution>
- <execution>
- <id>swagger</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>swagger</goal>
- </goals>
- </execution>
- <execution>
- <id>app</id>
- <phase>package</phase>
- <goals>
- <goal>app</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <repositories>
+ <repository>
+ <id>central</id>
+ <name>Central Repository</name>
+ <url>http://repo.maven.apache.org/maven2</url>
+ <layout>default</layout>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>always</updatePolicy>
+ <checksumPolicy>fail</checksumPolicy>
+ </releases>
+ </repository>
+ <repository>
+ <id>snapshots</id>
+ <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>always</updatePolicy>
+ <checksumPolicy>fail</checksumPolicy>
+ </snapshots>
+ </repository>
+ </repositories>
</project>