Refactor to separate api from implementation
Change-Id: Ia3ff3eab719cd380f502d359367e65835693ce12
diff --git a/api/pom.xml b/api/pom.xml
new file mode 100644
index 0000000..49a3aec
--- /dev/null
+++ b/api/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2020-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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.opencord</groupId>
+ <artifactId>mcast</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>mcast-api</artifactId>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-api</artifactId>
+ <version>${onos.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/api/src/main/java/org/opencord/cordmcast/CordMcastService.java b/api/src/main/java/org/opencord/cordmcast/CordMcastService.java
new file mode 100644
index 0000000..591f186
--- /dev/null
+++ b/api/src/main/java/org/opencord/cordmcast/CordMcastService.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2020-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.
+ */
+package org.opencord.cordmcast;
+
+/**
+ * CORD multicast provisioning application.
+ */
+public interface CordMcastService {
+
+}
diff --git a/src/main/java/org/opencord/cordmcast/CordMcastStatistics.java b/api/src/main/java/org/opencord/cordmcast/CordMcastStatistics.java
similarity index 100%
rename from src/main/java/org/opencord/cordmcast/CordMcastStatistics.java
rename to api/src/main/java/org/opencord/cordmcast/CordMcastStatistics.java
diff --git a/src/main/java/org/opencord/cordmcast/CordMcastStatisticsEvent.java b/api/src/main/java/org/opencord/cordmcast/CordMcastStatisticsEvent.java
similarity index 100%
rename from src/main/java/org/opencord/cordmcast/CordMcastStatisticsEvent.java
rename to api/src/main/java/org/opencord/cordmcast/CordMcastStatisticsEvent.java
diff --git a/src/main/java/org/opencord/cordmcast/CordMcastStatisticsEventListener.java b/api/src/main/java/org/opencord/cordmcast/CordMcastStatisticsEventListener.java
similarity index 100%
rename from src/main/java/org/opencord/cordmcast/CordMcastStatisticsEventListener.java
rename to api/src/main/java/org/opencord/cordmcast/CordMcastStatisticsEventListener.java
diff --git a/src/main/java/org/opencord/cordmcast/CordMcastStatisticsService.java b/api/src/main/java/org/opencord/cordmcast/CordMcastStatisticsService.java
similarity index 99%
rename from src/main/java/org/opencord/cordmcast/CordMcastStatisticsService.java
rename to api/src/main/java/org/opencord/cordmcast/CordMcastStatisticsService.java
index bf8a819..3ab6f09 100644
--- a/src/main/java/org/opencord/cordmcast/CordMcastStatisticsService.java
+++ b/api/src/main/java/org/opencord/cordmcast/CordMcastStatisticsService.java
@@ -23,8 +23,6 @@
*/
public interface CordMcastStatisticsService
extends ListenerService<CordMcastStatisticsEvent, CordMcastStatisticsEventListener> {
-
-
/**
* To set current vlanValue in Statistics Service.
* @param vlanValue current vlan value.
diff --git a/src/main/java/org/opencord/cordmcast/package-info.java b/api/src/main/java/org/opencord/cordmcast/package-info.java
similarity index 100%
rename from src/main/java/org/opencord/cordmcast/package-info.java
rename to api/src/main/java/org/opencord/cordmcast/package-info.java
diff --git a/app/app.xml b/app/app.xml
new file mode 100644
index 0000000..ec9ce34
--- /dev/null
+++ b/app/app.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2020-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.
+ -->
+<app name="org.opencord.mcast" origin="ONF" version="${project.version}"
+ category="Traffic Steering" url="http://opencord.org" title="CORD Mcast app"
+ featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
+ features="${project.artifactId}" apps="org.onosproject.mcast,org.opencord.sadis">
+ <description>${project.description}</description>
+ <artifact>mvn:${project.groupId}/mcast-api/${project.version}</artifact>
+ <artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
+</app>
diff --git a/app/features.xml b/app/features.xml
new file mode 100644
index 0000000..27289ef
--- /dev/null
+++ b/app/features.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+ ~ Copyright 2020-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.
+ -->
+<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}/mcast-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 100644
index 0000000..674e530
--- /dev/null
+++ b/app/pom.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2020-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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.opencord</groupId>
+ <artifactId>mcast</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>mcast-app</artifactId>
+
+ <packaging>bundle</packaging>
+ <description>CORD Multicast application</description>
+
+ <properties>
+ <onos.app.name>org.opencord.mcast</onos.app.name>
+ <onos.app.category>Traffic Steering</onos.app.category>
+ <onos.app.title>CORD Multicast App</onos.app.title>
+ <onos.app.url>http://opencord.org</onos.app.url>
+ <onos.app.requires>
+ org.onosproject.mcast,
+ org.opencord.sadis
+ </onos.app.requires>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-osgi</artifactId>
+ <version>${onos.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-api</artifactId>
+ <version>${onos.version}</version>
+ <scope>provided</scope>
+ <classifier>tests</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-core-serializers</artifactId>
+ <version>${onos.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opencord</groupId>
+ <artifactId>sadis-api</artifactId>
+ <version>${sadis.api.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-apps-mcast-api</artifactId>
+ <version>${onos.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opencord</groupId>
+ <artifactId>mcast-api</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-junit</artifactId>
+ <version>${onos.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/main/java/org/opencord/cordmcast/CordMcast.java b/app/src/main/java/org/opencord/cordmcast/impl/CordMcast.java
similarity index 98%
rename from src/main/java/org/opencord/cordmcast/CordMcast.java
rename to app/src/main/java/org/opencord/cordmcast/impl/CordMcast.java
index 0d20e9c..e014b79 100644
--- a/src/main/java/org/opencord/cordmcast/CordMcast.java
+++ b/app/src/main/java/org/opencord/cordmcast/impl/CordMcast.java
@@ -13,20 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.opencord.cordmcast;
+package org.opencord.cordmcast.impl;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.onosproject.net.Device;
-import org.opencord.sadis.SadisService;
-import org.opencord.sadis.SubscriberAndDeviceInformation;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Deactivate;
-import org.osgi.service.component.annotations.Modified;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.annotations.ReferenceCardinality;
import org.onlab.packet.Ethernet;
import org.onlab.packet.IpAddress;
import org.onlab.packet.VlanId;
@@ -43,6 +34,7 @@
import org.onosproject.mcast.api.McastRoute;
import org.onosproject.mcast.api.MulticastRouteService;
import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
import org.onosproject.net.HostId;
import org.onosproject.net.PortNumber;
@@ -70,7 +62,17 @@
import org.onosproject.store.service.Serializer;
import org.onosproject.store.service.StorageService;
import org.onosproject.store.service.Versioned;
+import org.opencord.cordmcast.CordMcastService;
+import org.opencord.cordmcast.CordMcastStatisticsService;
+import org.opencord.sadis.SadisService;
+import org.opencord.sadis.SubscriberAndDeviceInformation;
import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Modified;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
import org.slf4j.Logger;
import java.util.Dictionary;
@@ -87,11 +89,7 @@
import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
import static org.onlab.util.Tools.get;
import static org.onlab.util.Tools.groupedThreads;
-
-import static org.opencord.cordmcast.OsgiPropertyConstants.DEFAULT_PRIORITY;
-import static org.opencord.cordmcast.OsgiPropertyConstants.PRIORITY;
-import static org.opencord.cordmcast.OsgiPropertyConstants.DEFAULT_VLAN_ENABLED;
-import static org.opencord.cordmcast.OsgiPropertyConstants.VLAN_ENABLED;
+import static org.opencord.cordmcast.impl.OsgiPropertyConstants.*;
import static org.slf4j.LoggerFactory.getLogger;
@@ -105,8 +103,8 @@
VLAN_ENABLED + ":Boolean=" + DEFAULT_VLAN_ENABLED,
PRIORITY + ":Integer=" + DEFAULT_PRIORITY,
})
-public class CordMcast {
- private static final String APP_NAME = "org.opencord.cordmcast";
+public class CordMcast implements CordMcastService {
+ private static final String APP_NAME = "org.opencord.mcast";
private final Logger log = getLogger(getClass());
diff --git a/src/main/java/org/opencord/cordmcast/CordMcastStatisticsManager.java b/app/src/main/java/org/opencord/cordmcast/impl/CordMcastStatisticsManager.java
similarity index 92%
rename from src/main/java/org/opencord/cordmcast/CordMcastStatisticsManager.java
rename to app/src/main/java/org/opencord/cordmcast/impl/CordMcastStatisticsManager.java
index 80dc6f3..a5715f4 100644
--- a/src/main/java/org/opencord/cordmcast/CordMcastStatisticsManager.java
+++ b/app/src/main/java/org/opencord/cordmcast/impl/CordMcastStatisticsManager.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.opencord.cordmcast;
+package org.opencord.cordmcast.impl;
import org.onlab.packet.VlanId;
@@ -22,6 +22,10 @@
import org.onosproject.event.AbstractListenerManager;
import org.onosproject.mcast.api.McastRoute;
import org.onosproject.mcast.api.MulticastRouteService;
+import org.opencord.cordmcast.CordMcastStatistics;
+import org.opencord.cordmcast.CordMcastStatisticsEvent;
+import org.opencord.cordmcast.CordMcastStatisticsEventListener;
+import org.opencord.cordmcast.CordMcastStatisticsService;
import org.osgi.service.component.ComponentContext;
import org.osgi.service.component.annotations.Modified;
import org.osgi.service.component.annotations.Activate;
@@ -44,8 +48,8 @@
import static com.google.common.base.Strings.isNullOrEmpty;
import static org.onlab.util.Tools.get;
-import static org.opencord.cordmcast.OsgiPropertyConstants.EVENT_GENERATION_PERIOD;
-import static org.opencord.cordmcast.OsgiPropertyConstants.EVENT_GENERATION_PERIOD_DEFAULT;
+import static org.opencord.cordmcast.impl.OsgiPropertyConstants.EVENT_GENERATION_PERIOD;
+import static org.opencord.cordmcast.impl.OsgiPropertyConstants.EVENT_GENERATION_PERIOD_DEFAULT;
import static org.slf4j.LoggerFactory.getLogger;
diff --git a/src/main/java/org/opencord/cordmcast/OsgiPropertyConstants.java b/app/src/main/java/org/opencord/cordmcast/impl/OsgiPropertyConstants.java
similarity index 96%
rename from src/main/java/org/opencord/cordmcast/OsgiPropertyConstants.java
rename to app/src/main/java/org/opencord/cordmcast/impl/OsgiPropertyConstants.java
index 7600ba1..dcd5077 100644
--- a/src/main/java/org/opencord/cordmcast/OsgiPropertyConstants.java
+++ b/app/src/main/java/org/opencord/cordmcast/impl/OsgiPropertyConstants.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.opencord.cordmcast;
+package org.opencord.cordmcast.impl;
/**
* Constants for default values of configurable properties.
diff --git a/app/src/main/java/org/opencord/cordmcast/impl/package-info.java b/app/src/main/java/org/opencord/cordmcast/impl/package-info.java
new file mode 100644
index 0000000..841d95c
--- /dev/null
+++ b/app/src/main/java/org/opencord/cordmcast/impl/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-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.
+ */
+
+/**
+ * Application for provisioning multicast streams in the context of cord.
+ */
+package org.opencord.cordmcast.impl;
\ No newline at end of file
diff --git a/src/test/java/org/opencord/cordmcast/McastTest.java b/app/src/test/java/org/opencord/cordmcast/impl/McastTest.java
similarity index 98%
rename from src/test/java/org/opencord/cordmcast/McastTest.java
rename to app/src/test/java/org/opencord/cordmcast/impl/McastTest.java
index c55544e..a622e6d 100644
--- a/src/test/java/org/opencord/cordmcast/McastTest.java
+++ b/app/src/test/java/org/opencord/cordmcast/impl/McastTest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.opencord.cordmcast;
+package org.opencord.cordmcast.impl;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
@@ -41,6 +41,8 @@
import org.onosproject.net.flowobjective.Objective;
import org.onosproject.store.service.StorageServiceAdapter;
import org.onosproject.store.service.TestConsistentMap;
+import org.opencord.cordmcast.CordMcastStatistics;
+import org.opencord.cordmcast.CordMcastStatisticsEvent;
import org.osgi.service.component.ComponentContext;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
diff --git a/src/test/java/org/opencord/cordmcast/McastTestBase.java b/app/src/test/java/org/opencord/cordmcast/impl/McastTestBase.java
similarity index 98%
rename from src/test/java/org/opencord/cordmcast/McastTestBase.java
rename to app/src/test/java/org/opencord/cordmcast/impl/McastTestBase.java
index 823df6b..17ad11b 100644
--- a/src/test/java/org/opencord/cordmcast/McastTestBase.java
+++ b/app/src/test/java/org/opencord/cordmcast/impl/McastTestBase.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.opencord.cordmcast;
+package org.opencord.cordmcast.impl;
import java.util.List;
import java.util.Map;
@@ -61,6 +61,8 @@
import org.onosproject.net.flowobjective.NextObjective;
import com.google.common.collect.ImmutableMap;
+import org.opencord.cordmcast.CordMcastStatisticsEvent;
+import org.opencord.cordmcast.CordMcastStatisticsEventListener;
import org.opencord.sadis.BandwidthProfileInformation;
import org.opencord.sadis.BaseInformationService;
import org.opencord.sadis.SadisService;
diff --git a/pom.xml b/pom.xml
index 04c6b7c..c789c9b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,72 +22,24 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-dependencies</artifactId>
- <version>2.2.1-b3</version>
+ <version>2.2.1</version>
</parent>
<groupId>org.opencord</groupId>
<artifactId>mcast</artifactId>
<version>2.0.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
+ <packaging>pom</packaging>
<description>CORD Multicast application</description>
<properties>
- <onos.app.name>org.opencord.mcast</onos.app.name>
- <onos.app.category>Traffic Steering</onos.app.category>
- <onos.app.title>CORD Multicast App</onos.app.title>
- <onos.app.url>http://opencord.org</onos.app.url>
<sadis.api.version>5.0.0</sadis.api.version>
</properties>
- <dependencies>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-osgi</artifactId>
- <version>${onos.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-api</artifactId>
- <version>${onos.version}</version>
- <scope>provided</scope>
- <classifier>tests</classifier>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-core-serializers</artifactId>
- <version>${onos.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.opencord</groupId>
- <artifactId>sadis-api</artifactId>
- <version>${sadis.api.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-apps-mcast-api</artifactId>
- <version>${onos.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-junit</artifactId>
- <version>${onos.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
+ <modules>
+ <module>api</module>
+ <module>app</module>
+ </modules>
<repositories>
<repository>