Bump ONOS to 2.2 and build with Java 11
Change-Id: I215f7ca5cbded3acd9c440fe723f6f21d77f9ed5
diff --git a/api/pom.xml b/api/pom.xml
index e0c1733..962139d 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -15,14 +15,14 @@
~ 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">
+ 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>olt</artifactId>
<groupId>org.opencord</groupId>
- <version>3.1.0-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -32,25 +32,9 @@
<url>http://opencord.org</url>
<description>OLT application API</description>
- <properties>
- <sadis.api.version>3.2.0-SNAPSHOT</sadis.api.version>
- </properties>
<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>
-
- <dependency>
<groupId>org.opencord</groupId>
<artifactId>sadis-api</artifactId>
<version>${sadis.api.version}</version>
@@ -58,12 +42,20 @@
</dependencies>
<build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- </plugin>
- </plugins>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>3.1.0</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
</build>
</project>
diff --git a/app/app.xml b/app/app.xml
index 20a0392..6512e95 100644
--- a/app/app.xml
+++ b/app/app.xml
@@ -14,8 +14,10 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<app name="org.opencord.olt" origin="ON.Lab" version="${project.version}"
- category="Traffic Steering" url="http://onosproject.org" title="Optical Line Terminal App"
+<app name="org.opencord.olt" origin="Open Networking Foundation"
+ version="${project.version}"
+ category="Traffic Steering" url="http://onosproject.org"
+ title="Optical Line Terminal App"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}" apps="org.opencord.sadis">
<description>${project.description}</description>
diff --git a/app/pom.xml b/app/pom.xml
index c924c7c..2b3a216 100644
--- a/app/pom.xml
+++ b/app/pom.xml
@@ -20,13 +20,12 @@
<parent>
<groupId>org.opencord</groupId>
<artifactId>olt</artifactId>
- <version>3.1.0-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
+
<modelVersion>4.0.0</modelVersion>
-
<artifactId>olt-app</artifactId>
-
<packaging>bundle</packaging>
<description>OLT application for CORD</description>
@@ -42,10 +41,11 @@
<onos.app.origin>OpenCord</onos.app.origin>
<onos.app.category>default</onos.app.category>
<onos.app.url>http://opencord.org</onos.app.url>
- <onos.app.readme>CORD OLT Access management application</onos.app.readme>
+ <onos.app.readme>
+ CORD OLT Access management application
+ </onos.app.readme>
<api.package>org.opencord.olt.rest</api.package>
<olt.api.version>${project.version}</olt.api.version>
- <sadis.api.version>3.2.0-SNAPSHOT</sadis.api.version>
</properties>
<dependencies>
@@ -53,42 +53,77 @@
<groupId>org.opencord</groupId>
<artifactId>olt-api</artifactId>
<version>${olt.api.version}</version>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.opencord</groupId>
<artifactId>sadis-api</artifactId>
- <version>${sadis.api.version}</version>
+ <version>${sadis.api.version}</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.onosproject</groupId>
- <artifactId>onos-rest</artifactId>
+ <artifactId>onos-core-serializers</artifactId>
<version>${onos.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
+ <version>${karaf.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.core</artifactId>
+ <version>${karaf.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.component.annotations</artifactId>
+ <version>1.4.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>5.0.0</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
+ <version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-junit</artifactId>
- <version>${onos.version}</version>
- <scope>test</scope>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <version>2.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.25</version>
+ <scope>provided</scope>
</dependency>
</dependencies>
@@ -97,12 +132,35 @@
<plugin>
<groupId>org.onosproject</groupId>
<artifactId>onos-maven-plugin</artifactId>
- <version>1.11</version>
+ <version>2.2</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>
+
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
<configuration>
<instructions>
<_wab>src/main/webapp/</_wab>
@@ -117,28 +175,12 @@
*,org.glassfish.jersey.servlet
</Import-Package>
<Web-ContextPath>${web.context}</Web-ContextPath>
+ <Karaf-Commands>org.opencord.olt.cli</Karaf-Commands>
+ <_dsannotations-options>inherit</_dsannotations-options>
</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/app/src/main/java/org/opencord/olt/cli/ShowBpMeterMappingsCommand.java b/app/src/main/java/org/opencord/olt/cli/ShowBpMeterMappingsCommand.java
index 83b518f..3eec456 100644
--- a/app/src/main/java/org/opencord/olt/cli/ShowBpMeterMappingsCommand.java
+++ b/app/src/main/java/org/opencord/olt/cli/ShowBpMeterMappingsCommand.java
@@ -16,7 +16,8 @@
package org.opencord.olt.cli;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.meter.MeterKey;
import org.opencord.olt.AccessDeviceService;
@@ -24,12 +25,13 @@
import java.util.List;
import java.util.Map;
+@Service
@Command(scope = "onos", name = "volt-bpmeter-mappings",
description = "Shows information about bandwidthProfile-meterKey (device / meter) mappings")
public class ShowBpMeterMappingsCommand extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
Map<String, List<MeterKey>> bpMeterMappings = service.getBpMeterMappings();
bpMeterMappings.forEach(this::display);
diff --git a/app/src/main/java/org/opencord/olt/cli/ShowOltCommand.java b/app/src/main/java/org/opencord/olt/cli/ShowOltCommand.java
index d01e8e2..18aa935 100644
--- a/app/src/main/java/org/opencord/olt/cli/ShowOltCommand.java
+++ b/app/src/main/java/org/opencord/olt/cli/ShowOltCommand.java
@@ -16,19 +16,21 @@
package org.opencord.olt.cli;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.opencord.olt.AccessDeviceService;
/**
* Shows configured OLTs.
*/
+@Service
@Command(scope = "onos", name = "volt-olts",
description = "Shows vOLTs connected to ONOS")
public class ShowOltCommand extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
service.fetchOlts().forEach(did -> {
print("OLT %s", did);
diff --git a/app/src/main/java/org/opencord/olt/cli/ShowProgrammedMetersCommand.java b/app/src/main/java/org/opencord/olt/cli/ShowProgrammedMetersCommand.java
index 6fa8c9d..f4734d4 100644
--- a/app/src/main/java/org/opencord/olt/cli/ShowProgrammedMetersCommand.java
+++ b/app/src/main/java/org/opencord/olt/cli/ShowProgrammedMetersCommand.java
@@ -16,7 +16,8 @@
package org.opencord.olt.cli;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.meter.MeterKey;
import org.opencord.olt.AccessDeviceService;
@@ -27,12 +28,13 @@
* Shows information about device-meter mappings that have been programmed in the
* data-plane.
*/
+@Service
@Command(scope = "onos", name = "volt-programmed-meters",
description = "Shows device-meter mappings programmed in the data-plane")
public class ShowProgrammedMetersCommand extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
Set<MeterKey> programmedMeters = service.getProgMeters();
programmedMeters.forEach(this::display);
diff --git a/app/src/main/java/org/opencord/olt/cli/ShowProgrammedSubscribersCommand.java b/app/src/main/java/org/opencord/olt/cli/ShowProgrammedSubscribersCommand.java
index 2a4409e..22acb57 100644
--- a/app/src/main/java/org/opencord/olt/cli/ShowProgrammedSubscribersCommand.java
+++ b/app/src/main/java/org/opencord/olt/cli/ShowProgrammedSubscribersCommand.java
@@ -16,24 +16,26 @@
package org.opencord.olt.cli;
-import java.util.Map;
-
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.ConnectPoint;
import org.opencord.olt.AccessDeviceService;
import org.opencord.sadis.SubscriberAndDeviceInformation;
+import java.util.Map;
+
/**
* Shows subscriber information for those subscriber which have been programmed
* in the data-plane.
*/
+@Service
@Command(scope = "onos", name = "volt-programmed-subscribers",
description = "Shows subscribers programmed in the dataplane")
public class ShowProgrammedSubscribersCommand extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
Map<ConnectPoint, SubscriberAndDeviceInformation> info = service.getProgSubs();
info.forEach(this::display);
diff --git a/app/src/main/java/org/opencord/olt/cli/ShowSubscribersCommand.java b/app/src/main/java/org/opencord/olt/cli/ShowSubscribersCommand.java
index 711d1fa..4d2d583 100644
--- a/app/src/main/java/org/opencord/olt/cli/ShowSubscribersCommand.java
+++ b/app/src/main/java/org/opencord/olt/cli/ShowSubscribersCommand.java
@@ -16,18 +16,20 @@
package org.opencord.olt.cli;
-import java.util.Map;
-
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.VlanId;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.ConnectPoint;
import org.opencord.olt.AccessDeviceService;
+import java.util.Map;
+
/**
* Shows provisioned (configured) subscribers. The data plane flows for the
* subscribers may or may not have been programmed.
*/
+@Service
@Command(scope = "onos", name = "volt-subscribers",
description = "Shows pre-provisioned subscribers")
public class ShowSubscribersCommand extends AbstractShellCommand {
@@ -35,7 +37,7 @@
private static final String FORMAT = "port=%s, svlan=%s, cvlan=%s";
@Override
- protected void execute() {
+ protected void doExecute() {
AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
service.getSubscribers().forEach(this::display);
}
diff --git a/app/src/main/java/org/opencord/olt/cli/SubscriberAddCommand.java b/app/src/main/java/org/opencord/olt/cli/SubscriberAddCommand.java
index f6db81e..0c9369d 100644
--- a/app/src/main/java/org/opencord/olt/cli/SubscriberAddCommand.java
+++ b/app/src/main/java/org/opencord/olt/cli/SubscriberAddCommand.java
@@ -16,9 +16,12 @@
package org.opencord.olt.cli;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.cli.net.DeviceIdCompleter;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
import org.onosproject.net.PortNumber;
@@ -27,12 +30,14 @@
/**
* Adds a subscriber to an access device.
*/
+@Service
@Command(scope = "onos", name = "volt-add-subscriber-access",
description = "Adds a subscriber to an access device")
public class SubscriberAddCommand extends AbstractShellCommand {
@Argument(index = 0, name = "deviceId", description = "Access device ID",
required = true, multiValued = false)
+ @Completion(DeviceIdCompleter.class)
private String strDeviceId = null;
@Argument(index = 1, name = "port", description = "Subscriber port number",
@@ -40,7 +45,7 @@
private String strPort = null;
@Override
- protected void execute() {
+ protected void doExecute() {
AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
DeviceId deviceId = DeviceId.deviceId(strDeviceId);
diff --git a/app/src/main/java/org/opencord/olt/cli/SubscriberRemoveCommand.java b/app/src/main/java/org/opencord/olt/cli/SubscriberRemoveCommand.java
index eaf6049..4db9587 100644
--- a/app/src/main/java/org/opencord/olt/cli/SubscriberRemoveCommand.java
+++ b/app/src/main/java/org/opencord/olt/cli/SubscriberRemoveCommand.java
@@ -16,9 +16,12 @@
package org.opencord.olt.cli;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.cli.net.DeviceIdCompleter;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
import org.onosproject.net.PortNumber;
@@ -27,12 +30,14 @@
/**
* Adds a subscriber to an access device.
*/
+@Service
@Command(scope = "onos", name = "volt-remove-subscriber-access",
description = "Removes a subscriber to an access device")
public class SubscriberRemoveCommand extends AbstractShellCommand {
@Argument(index = 0, name = "deviceId", description = "Access device ID",
required = true, multiValued = false)
+ @Completion(DeviceIdCompleter.class)
private String strDeviceId = null;
@Argument(index = 1, name = "port", description = "Subscriber port number",
@@ -40,7 +45,7 @@
private String strPort = null;
@Override
- protected void execute() {
+ protected void doExecute() {
AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
DeviceId deviceId = DeviceId.deviceId(strDeviceId);
diff --git a/app/src/main/java/org/opencord/olt/impl/Olt.java b/app/src/main/java/org/opencord/olt/impl/Olt.java
index 60d9feb..0aaa8bf 100644
--- a/app/src/main/java/org/opencord/olt/impl/Olt.java
+++ b/app/src/main/java/org/opencord/olt/impl/Olt.java
@@ -15,38 +15,10 @@
*/
package org.opencord.olt.impl;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Strings.isNullOrEmpty;
-import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
-import static org.onlab.util.Tools.get;
-import static org.onlab.util.Tools.groupedThreads;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.AbstractMap;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Dictionary;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Properties;
-import java.util.Set;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.stream.Collectors;
-
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Modified;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferenceCardinality;
-import org.apache.felix.scr.annotations.Service;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
import org.onlab.packet.EthType;
import org.onlab.packet.IPv4;
import org.onlab.packet.IPv6;
@@ -105,27 +77,77 @@
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 com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
+import java.util.AbstractMap;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Dictionary;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.stream.Collectors;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Strings.isNullOrEmpty;
+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.olt.impl.OsgiPropertyConstants.DEFAULT_BP_ID;
+import static org.opencord.olt.impl.OsgiPropertyConstants.DEFAULT_BP_ID_DEFAULT;
+import static org.opencord.olt.impl.OsgiPropertyConstants.DEFAULT_TP_ID;
+import static org.opencord.olt.impl.OsgiPropertyConstants.DEFAULT_TP_ID_DEFAULT;
+import static org.opencord.olt.impl.OsgiPropertyConstants.DEFAULT_VLAN;
+import static org.opencord.olt.impl.OsgiPropertyConstants.DEFAULT_VLAN_DEFAULT;
+import static org.opencord.olt.impl.OsgiPropertyConstants.DELETE_METERS;
+import static org.opencord.olt.impl.OsgiPropertyConstants.DELETE_METERS_DEFAULT;
+import static org.opencord.olt.impl.OsgiPropertyConstants.ENABLE_DHCP_ON_PROVISIONING;
+import static org.opencord.olt.impl.OsgiPropertyConstants.ENABLE_DHCP_ON_PROVISIONING_DEFAULT;
+import static org.opencord.olt.impl.OsgiPropertyConstants.ENABLE_DHCP_V4;
+import static org.opencord.olt.impl.OsgiPropertyConstants.ENABLE_DHCP_V4_DEFAULT;
+import static org.opencord.olt.impl.OsgiPropertyConstants.ENABLE_DHCP_V6;
+import static org.opencord.olt.impl.OsgiPropertyConstants.ENABLE_DHCP_V6_DEFAULT;
+import static org.opencord.olt.impl.OsgiPropertyConstants.ENABLE_EAPOL;
+import static org.opencord.olt.impl.OsgiPropertyConstants.ENABLE_EAPOL_DEFAULT;
+import static org.opencord.olt.impl.OsgiPropertyConstants.ENABLE_IGMP_ON_PROVISIONING;
+import static org.opencord.olt.impl.OsgiPropertyConstants.ENABLE_IGMP_ON_PROVISIONING_DEFAULT;
+import static org.slf4j.LoggerFactory.getLogger;
/**
* Provisions rules on access devices.
*/
-@Service
-@Component(immediate = true)
+@Component(immediate = true,
+ property = {
+ DEFAULT_VLAN + ":Integer=" + DEFAULT_VLAN_DEFAULT,
+ ENABLE_DHCP_ON_PROVISIONING + ":Boolean=" + ENABLE_DHCP_ON_PROVISIONING_DEFAULT,
+ ENABLE_DHCP_V4 + ":Boolean=" + ENABLE_DHCP_V4_DEFAULT,
+ ENABLE_DHCP_V6 + ":Boolean=" + ENABLE_DHCP_V6_DEFAULT,
+ ENABLE_IGMP_ON_PROVISIONING + ":Boolean=" + ENABLE_IGMP_ON_PROVISIONING_DEFAULT,
+ DELETE_METERS + ":Boolean=" + DELETE_METERS_DEFAULT,
+ DEFAULT_TP_ID + ":Integer=" + DEFAULT_TP_ID_DEFAULT,
+ DEFAULT_BP_ID + ":String=" + DEFAULT_BP_ID_DEFAULT,
+ ENABLE_EAPOL + ":Boolean=" + ENABLE_EAPOL_DEFAULT,
+ })
public class Olt
extends AbstractListenerManager<AccessDeviceEvent, AccessDeviceListener>
implements AccessDeviceService {
private static final String APP_NAME = "org.opencord.olt";
- private static final short DEFAULT_VLAN = 0;
private static final short EAPOL_DEFAULT_VLAN = 4091;
- private static final int DEFAULT_TP_ID = 64;
- private static final String DEFAULT_BP_ID = "Default";
private static final String ADDITIONAL_VLANS = "additional-vlans";
private static final String NO_UPLINK_PORT = "No uplink port found for OLT device {}";
private static final String INSTALLED = "installed";
@@ -135,65 +157,74 @@
private final Logger log = getLogger(getClass());
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected FlowObjectiveService flowObjectiveService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected MastershipService mastershipService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected DeviceService deviceService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected CoreService coreService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected ComponentConfigService componentConfigService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected SadisService sadisService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected MeterService meterService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected StorageService storageService;
- @Property(name = "defaultVlan", intValue = DEFAULT_VLAN,
- label = "Default VLAN RG<->ONU traffic")
- private int defaultVlan = DEFAULT_VLAN;
+ /**
+ * Default VLAN RG<->ONU traffic
+ **/
+ private int defaultVlan = DEFAULT_VLAN_DEFAULT;
- @Property(name = "enableDhcpOnProvisioning", boolValue = true,
- label = "Create the DHCP Flow rules when a subscriber is provisioned")
- protected boolean enableDhcpOnProvisioning = false;
+ /**
+ * Create the DHCP Flow rules when a subscriber is provisioned
+ **/
+ protected boolean enableDhcpOnProvisioning = ENABLE_DHCP_ON_PROVISIONING_DEFAULT;
- @Property(name = "enableDhcpV4", boolValue = true,
- label = "Enable flows for DHCP v4")
- protected boolean enableDhcpV4 = true;
+ /**
+ * Enable flows for DHCP v4
+ **/
+ protected boolean enableDhcpV4 = ENABLE_DHCP_V4_DEFAULT;
- @Property(name = "enableDhcpV6", boolValue = true,
- label = "Enable flows for DHCP v6")
- protected boolean enableDhcpV6 = false;
+ /**
+ * Enable flows for DHCP v6
+ **/
+ protected boolean enableDhcpV6 = ENABLE_DHCP_V6_DEFAULT;
- @Property(name = "enableIgmpOnProvisioning", boolValue = false,
- label = "Create IGMP Flow rules when a subscriber is provisioned")
- protected boolean enableIgmpOnProvisioning = false;
+ /**
+ * Create IGMP Flow rules when a subscriber is provisioned
+ **/
+ protected boolean enableIgmpOnProvisioning = ENABLE_IGMP_ON_PROVISIONING_DEFAULT;
- @Property(name = "deleteMeters", boolValue = true,
- label = "Deleting Meters based on flow count statistics")
- protected boolean deleteMeters = true;
+ /**
+ * Deleting Meters based on flow count statistics
+ **/
+ protected boolean deleteMeters = DELETE_METERS_DEFAULT;
- @Property(name = "defaultTechProfileId", intValue = DEFAULT_TP_ID,
- label = "Default technology profile id that is used for authentication trap flows")
- protected int defaultTechProfileId = DEFAULT_TP_ID;
+ /**
+ * Default technology profile id that is used for authentication trap flows
+ **/
+ protected int defaultTechProfileId = DEFAULT_TP_ID_DEFAULT;
- @Property(name = "defaultBpId", value = DEFAULT_BP_ID,
- label = "Default bandwidth profile id that is used for authentication trap flows")
- protected String defaultBpId = DEFAULT_BP_ID;
+ /**
+ * Default bandwidth profile id that is used for authentication trap flows
+ **/
+ protected String defaultBpId = DEFAULT_BP_ID_DEFAULT;
- @Property(name = "enableEapol", boolValue = true,
- label = "Send EAPOL authentication trap flows before subscriber provisioning")
- protected boolean enableEapol = true;
+ /**
+ * Send EAPOL authentication trap flows before subscriber provisioning
+ **/
+ protected boolean enableEapol = ENABLE_EAPOL_DEFAULT;
private final DeviceListener deviceListener = new InternalDeviceListener();
private final MeterListener meterListener = new InternalMeterListener();
@@ -274,7 +305,7 @@
try {
String s = get(properties, "defaultVlan");
- defaultVlan = isNullOrEmpty(s) ? DEFAULT_VLAN : Integer.parseInt(s.trim());
+ defaultVlan = isNullOrEmpty(s) ? DEFAULT_VLAN_DEFAULT : Integer.parseInt(s.trim());
Boolean o = Tools.isPropertyEnabled(properties, "enableDhcpOnProvisioning");
if (o != null) {
@@ -305,7 +336,7 @@
}
String tpId = get(properties, "defaultTechProfileId");
- defaultTechProfileId = isNullOrEmpty(s) ? DEFAULT_TP_ID : Integer.parseInt(tpId.trim());
+ defaultTechProfileId = isNullOrEmpty(s) ? DEFAULT_TP_ID_DEFAULT : Integer.parseInt(tpId.trim());
String bpId = get(properties, "defaultBpId");
defaultBpId = bpId;
@@ -316,7 +347,7 @@
}
} catch (Exception e) {
- defaultVlan = DEFAULT_VLAN;
+ defaultVlan = DEFAULT_VLAN_DEFAULT;
}
}
@@ -1593,7 +1624,7 @@
private Long createMetadata(VlanId innerVlan, int techProfileId, PortNumber egressPort) {
if (techProfileId == -1) {
- techProfileId = DEFAULT_TP_ID;
+ techProfileId = defaultTechProfileId;
}
return ((long) (innerVlan.id()) << 48 | (long) techProfileId << 32) | egressPort.toLong();
diff --git a/app/src/main/java/org/opencord/olt/impl/OsgiPropertyConstants.java b/app/src/main/java/org/opencord/olt/impl/OsgiPropertyConstants.java
new file mode 100644
index 0000000..8fe9906
--- /dev/null
+++ b/app/src/main/java/org/opencord/olt/impl/OsgiPropertyConstants.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2019-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.olt.impl;
+
+/**
+ * Constants for default values of configurable properties.
+ */
+public final class OsgiPropertyConstants {
+
+ private OsgiPropertyConstants() {
+ }
+
+ public static final String DEFAULT_VLAN = "defaultVlan";
+ public static final short DEFAULT_VLAN_DEFAULT = 0;
+
+ public static final String ENABLE_DHCP_ON_PROVISIONING = "enableDhcpOnProvisioning";
+ public static final boolean ENABLE_DHCP_ON_PROVISIONING_DEFAULT = false;
+
+ public static final String ENABLE_DHCP_V4 = "enableDhcpV4";
+ public static final boolean ENABLE_DHCP_V4_DEFAULT = true;
+
+ public static final String ENABLE_DHCP_V6 = "enableDhcpV6";
+ public static final boolean ENABLE_DHCP_V6_DEFAULT = false;
+
+ public static final String ENABLE_IGMP_ON_PROVISIONING = "enableIgmpOnProvisioning";
+ public static final boolean ENABLE_IGMP_ON_PROVISIONING_DEFAULT = false;
+
+ public static final String DELETE_METERS = "deleteMeters";
+ public static final boolean DELETE_METERS_DEFAULT = true;
+
+ public static final String DEFAULT_TP_ID = "defaultTechProfileId";
+ public static final int DEFAULT_TP_ID_DEFAULT = 64;
+
+ public static final String DEFAULT_BP_ID = "defaultBpId";
+ public static final String DEFAULT_BP_ID_DEFAULT = "Default";
+
+ public static final String ENABLE_EAPOL = "enableEapol";
+ public static final boolean ENABLE_EAPOL_DEFAULT = true;
+}
diff --git a/app/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/app/src/main/resources/OSGI-INF/blueprint/shell-config.xml
deleted file mode 100644
index f871bc9..0000000
--- a/app/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<!--
- ~ 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.
- -->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
-
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
- <command>
- <action class="org.opencord.olt.cli.SubscriberAddCommand"/>
- <completers>
- <ref component-id="deviceIdCompleter"/>
- <null/>
- </completers>
- </command>
- <command>
- <action class="org.opencord.olt.cli.SubscriberRemoveCommand"/>
- <completers>
- <ref component-id="deviceIdCompleter"/>
- <null/>
- </completers>
- </command>
- <command>
- <action class="org.opencord.olt.cli.ShowOltCommand"/>
- </command>
- <command>
- <action class="org.opencord.olt.cli.ShowSubscribersCommand"/>
- </command>
- <command>
- <action class="org.opencord.olt.cli.ShowProgrammedSubscribersCommand"/>
- </command>
- <command>
- <action class="org.opencord.olt.cli.ShowProgrammedMetersCommand"/>
- </command>
- <command>
- <action class="org.opencord.olt.cli.ShowBpMeterMappingsCommand"/>
- </command>
- </command-bundle>
-
- <bean id="deviceIdCompleter" class="org.onosproject.cli.net.DeviceIdCompleter"/>
-</blueprint>
diff --git a/pom.xml b/pom.xml
index c6cf8f7..29176fb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,21 +19,16 @@
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>onos-dependencies</artifactId>
- <version>1.13.9-rc4</version>
- <relativePath></relativePath>
- </parent>
-
<groupId>org.opencord</groupId>
<artifactId>olt</artifactId>
- <version>3.1.0-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <onos.version>1.13.9-rc4</onos.version>
+ <onos.version>2.2.0</onos.version>
+ <karaf.version>4.2.6</karaf.version>
+ <sadis.api.version>4.0.0-SNAPSHOT</sadis.api.version>
</properties>
<modules>
@@ -46,36 +41,21 @@
<groupId>org.onosproject</groupId>
<artifactId>onos-api</artifactId>
<version>${onos.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onlab-misc</artifactId>
<version>${onos.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-osgi</artifactId>
- <version>${onos.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-incubator-api</artifactId>
- <version>${onos.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-incubator-net</artifactId>
- <version>${onos.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-core-common</artifactId>
- <version>${onos.version}</version>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>22.0</version>
+ <scope>provided</scope>
</dependency>
</dependencies>
@@ -106,4 +86,32 @@
</snapshots>
</repository>
</repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>4.1.0</version>
+ <extensions>true</extensions>
+ <inherited>true</inherited>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.0</version>
+ <configuration>
+ <release>11</release>
+ </configuration>
+ <inherited>true</inherited>
+ </plugin>
+ </plugins>
+ </build>
+ <distributionManagement>
+ <snapshotRepository>
+ <id>ossrh</id>
+ <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+ </snapshotRepository>
+ </distributionManagement>
</project>