Bump ONOS to 2.2 and build with Java 11
Change-Id: I215f7ca5cbded3acd9c440fe723f6f21d77f9ed5
diff --git a/api/pom.xml b/api/pom.xml
index eb57b56..5b0a95d 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -20,47 +20,44 @@
<parent>
<artifactId>dhcpl2relay</artifactId>
<groupId>org.opencord</groupId>
- <version>1.6.0</version>
+ <version>2.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>dhcpl2relay-api</artifactId>
-
<packaging>bundle</packaging>
-
<description>DHCP L2 Relay application API</description>
- <properties>
- <sadis.api.version>3.1.0</sadis.api.version>
- </properties>
-
<dependencies>
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onlab-junit</artifactId>
+ <artifactId>onos-api</artifactId>
<version>${onos.version}</version>
- <scope>test</scope>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-core-serializers</artifactId>
+ <artifactId>onlab-misc</artifactId>
<version>${onos.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.opencord</groupId>
- <artifactId>sadis-api</artifactId>
- <version>${sadis.api.version}</version>
+ <scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
+ <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>
diff --git a/app/app.xml b/app/app.xml
index 3bcf254..f2d29af 100644
--- a/app/app.xml
+++ b/app/app.xml
@@ -14,7 +14,8 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<app name="org.opencord.dhcpl2relay" origin="ON.Lab" version="${project.version}"
+<app name="org.opencord.dhcpl2relay" origin="Open Networking Foundation"
+ version="${project.version}"
category="default" url="http://onosproject.org" title="DHCP L2 Relay"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}" apps="org.opencord.sadis">
diff --git a/app/pom.xml b/app/pom.xml
index 7778858..1e425d4 100644
--- a/app/pom.xml
+++ b/app/pom.xml
@@ -20,7 +20,7 @@
<parent>
<artifactId>dhcpl2relay</artifactId>
<groupId>org.opencord</groupId>
- <version>1.6.0</version>
+ <version>2.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -31,7 +31,6 @@
<properties>
<onos.app.name>org.opencord.dhcpl2relay</onos.app.name>
- <onos.version>1.13.9</onos.version>
<onos.app.title>DHCP Relay Agent App</onos.app.title>
<onos.app.category>default</onos.app.category>
<onos.app.url>http://opencord.org</onos.app.url>
@@ -39,7 +38,7 @@
<onos.app.requires>
org.opencord.sadis
</onos.app.requires>
- <sadis.api.version>3.1.0</sadis.api.version>
+ <karaf.version>4.2.6</karaf.version>
</properties>
<dependencies>
@@ -47,49 +46,35 @@
<groupId>org.onosproject</groupId>
<artifactId>onos-api</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.opencord</groupId>
<artifactId>dhcpl2relay-api</artifactId>
- <version>1.6.0</version>
+ <version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-incubator-api</artifactId>
- <version>${onos.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-osgi</artifactId>
- <version>${onos.version}</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.onosproject</groupId>
<artifactId>onlab-junit</artifactId>
<version>${onos.version}</version>
<scope>test</scope>
</dependency>
+
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-cli</artifactId>
<version>${onos.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
@@ -101,14 +86,19 @@
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.scr.annotations</artifactId>
+ <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>org.onosproject</groupId>
<artifactId>onlab-osgi</artifactId>
@@ -116,15 +106,19 @@
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
+
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
+ <version>4.0.2</version>
<scope>test</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>
@@ -134,24 +128,86 @@
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-misc</artifactId>
+ <version>${onos.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.25</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>22.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.9.5</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- </plugin>
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- </plugin>
-
- <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>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>
+ ${project.groupId}.${project.artifactId}
+ </Bundle-SymbolicName>
+ <Karaf-Commands>org.opencord.dhcpl2relay.cli</Karaf-Commands>
+ <_dsannotations-options>inherit</_dsannotations-options>
+ </instructions>
+ </configuration>
</plugin>
</plugins>
</build>
diff --git a/app/src/main/java/org/opencord/dhcpl2relay/impl/DhcpL2RelayAllocationsCommand.java b/app/src/main/java/org/opencord/dhcpl2relay/cli/DhcpL2RelayAllocationsCommand.java
similarity index 85%
rename from app/src/main/java/org/opencord/dhcpl2relay/impl/DhcpL2RelayAllocationsCommand.java
rename to app/src/main/java/org/opencord/dhcpl2relay/cli/DhcpL2RelayAllocationsCommand.java
index adb0bf0..1e324aa 100644
--- a/app/src/main/java/org/opencord/dhcpl2relay/impl/DhcpL2RelayAllocationsCommand.java
+++ b/app/src/main/java/org/opencord/dhcpl2relay/cli/DhcpL2RelayAllocationsCommand.java
@@ -13,19 +13,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.opencord.dhcpl2relay.impl;
+package org.opencord.dhcpl2relay.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.dhcpl2relay.impl.DhcpL2Relay;
/**
* Shows the Successful DHCP allocations relayed by the dhcpl2relay.
*/
+@Service
@Command(scope = "onos", name = "dhcpl2relay-allocations",
description = "Shows the Successful DHCP allocations relayed by the dhcpl2relay")
public class DhcpL2RelayAllocationsCommand extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
DhcpL2Relay.allocationMap().forEach((key, value) -> {
print("SubscriberId=%s,ConnectPoint=%s,State=%s,MAC=%s,CircuitId=%s" +
",IP Allocated=%s,Allocation Timestamp=%s",
diff --git a/app/src/main/java/org/opencord/dhcpl2relay/cli/package-info.java b/app/src/main/java/org/opencord/dhcpl2relay/cli/package-info.java
new file mode 100644
index 0000000..e55847a
--- /dev/null
+++ b/app/src/main/java/org/opencord/dhcpl2relay/cli/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+/**
+ * Karaf CLI commands for the dhcpl2relay app.
+ */
+package org.opencord.dhcpl2relay.cli;
\ No newline at end of file
diff --git a/app/src/main/java/org/opencord/dhcpl2relay/impl/DhcpL2Relay.java b/app/src/main/java/org/opencord/dhcpl2relay/impl/DhcpL2Relay.java
index cf35677..82de81b 100755
--- a/app/src/main/java/org/opencord/dhcpl2relay/impl/DhcpL2Relay.java
+++ b/app/src/main/java/org/opencord/dhcpl2relay/impl/DhcpL2Relay.java
@@ -15,31 +15,11 @@
*/
package org.opencord.dhcpl2relay.impl;
-import static org.onlab.packet.DHCP.DHCPOptionCode.OptionCode_MessageType;
-import static org.onlab.packet.MacAddress.valueOf;
-import static org.onosproject.net.config.basics.SubjectFactories.APP_SUBJECT_FACTORY;
-
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Dictionary;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
-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.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
import org.onlab.packet.DHCP;
-import org.onlab.packet.DHCPPacketType;
import org.onlab.packet.Ethernet;
import org.onlab.packet.IPv4;
import org.onlab.packet.IpAddress;
@@ -91,19 +71,42 @@
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 org.slf4j.LoggerFactory;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Dictionary;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
+
+import static org.onlab.packet.DHCP.DHCPOptionCode.OptionCode_MessageType;
+import static org.onlab.packet.MacAddress.valueOf;
+import static org.onosproject.net.config.basics.SubjectFactories.APP_SUBJECT_FACTORY;
+import static org.opencord.dhcpl2relay.impl.OsgiPropertyConstants.ENABLE_DHCP_BROADCAST_REPLIES;
+import static org.opencord.dhcpl2relay.impl.OsgiPropertyConstants.ENABLE_DHCP_BROADCAST_REPLIES_DEFAULT;
+import static org.opencord.dhcpl2relay.impl.OsgiPropertyConstants.OPTION_82;
+import static org.opencord.dhcpl2relay.impl.OsgiPropertyConstants.OPTION_82_DEFAULT;
/**
* DHCP Relay Agent Application Component.
*/
-@Service
-@Component(immediate = true)
+@Component(immediate = true,
+property = {
+ OPTION_82 + ":Boolean=" + OPTION_82_DEFAULT,
+ ENABLE_DHCP_BROADCAST_REPLIES + ":Boolean=" + ENABLE_DHCP_BROADCAST_REPLIES_DEFAULT,
+})
public class DhcpL2Relay
extends AbstractListenerManager<DhcpL2RelayEvent, DhcpL2RelayListener>
implements DhcpL2RelayService {
@@ -126,40 +129,38 @@
}
);
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected NetworkConfigRegistry cfgService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected CoreService coreService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected PacketService packetService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected HostService hostService;
- @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 DeviceService deviceService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected MastershipService mastershipService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected FlowObjectiveService flowObjectiveService;
- @Property(name = "option82", boolValue = true,
- label = "Add option 82 to relayed packets")
- protected boolean option82 = true;
+ /** Add option 82 to relayed packets */
+ protected boolean option82 = OPTION_82_DEFAULT;
- @Property(name = "enableDhcpBroadcastReplies", boolValue = false,
- label = "Ask the DHCP Server to send back replies as L2 broadcast")
- protected boolean enableDhcpBroadcastReplies = false;
+ /** Ask the DHCP Server to send back replies as L2 broadcast */
+ protected boolean enableDhcpBroadcastReplies = ENABLE_DHCP_BROADCAST_REPLIES_DEFAULT;
private DhcpRelayPacketProcessor dhcpRelayPacketProcessor =
new DhcpRelayPacketProcessor();
@@ -228,12 +229,12 @@
Dictionary<?, ?> properties = context.getProperties();
- Boolean o = Tools.isPropertyEnabled(properties, "option82");
+ Boolean o = Tools.isPropertyEnabled(properties, OPTION_82);
if (o != null) {
option82 = o;
}
- o = Tools.isPropertyEnabled(properties, "enableDhcpBroadcastReplies");
+ o = Tools.isPropertyEnabled(properties, ENABLE_DHCP_BROADCAST_REPLIES);
if (o != null) {
enableDhcpBroadcastReplies = o;
}
@@ -610,12 +611,12 @@
}
// get the type of the DHCP packet
- private DHCPPacketType getDhcpPacketType(DHCP dhcpPayload) {
+ private DHCP.MsgType getDhcpPacketType(DHCP dhcpPayload) {
for (DhcpOption option : dhcpPayload.getOptions()) {
if (option.getCode() == OptionCode_MessageType.getValue()) {
byte[] data = option.getData();
- return DHCPPacketType.getType(data[0]);
+ return DHCP.MsgType.getType(data[0]);
}
}
return null;
@@ -629,7 +630,7 @@
return;
}
- DHCPPacketType incomingPacketType = getDhcpPacketType(dhcpPayload);
+ DHCP.MsgType incomingPacketType = getDhcpPacketType(dhcpPayload);
log.info("Received DHCP Packet of type {} from {}",
incomingPacketType, context.inPacket().receivedFrom());
@@ -749,10 +750,11 @@
ConnectPoint subsCp = getConnectPointOfClient(dstMac);
// If we can't find the subscriber, can't process further
if (subsCp == null) {
+ log.warn("Couldn't find connection point for mac address {} DHCPOFFERs won't be delivered", dstMac);
return null;
}
// if it's an ACK packet store the information for display purpose
- if (getDhcpPacketType(dhcpPayload) == DHCPPacketType.DHCPACK) {
+ if (getDhcpPacketType(dhcpPayload) == DHCP.MsgType.DHCPACK) {
String portId = nasPortId(subsCp);
SubscriberAndDeviceInformation sub = subsService.get(portId);
diff --git a/app/src/main/java/org/opencord/dhcpl2relay/impl/OsgiPropertyConstants.java b/app/src/main/java/org/opencord/dhcpl2relay/impl/OsgiPropertyConstants.java
new file mode 100644
index 0000000..2612fdf
--- /dev/null
+++ b/app/src/main/java/org/opencord/dhcpl2relay/impl/OsgiPropertyConstants.java
@@ -0,0 +1,32 @@
+/*
+ * 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.dhcpl2relay.impl;
+
+/**
+ * Constants for default values of configurable properties.
+ */
+public final class OsgiPropertyConstants {
+
+ private OsgiPropertyConstants() {
+ }
+
+ public static final String OPTION_82 = "option82";
+ public static final boolean OPTION_82_DEFAULT = true;
+
+ public static final String ENABLE_DHCP_BROADCAST_REPLIES = "enableDhcpBroadcastReplies";
+ public static final boolean ENABLE_DHCP_BROADCAST_REPLIES_DEFAULT = false;
+}
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 b5edcc3..0000000
--- a/app/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ /dev/null
@@ -1,23 +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.dhcpl2relay.impl.DhcpL2RelayAllocationsCommand"/>
- </command>
- </command-bundle>
-</blueprint>
\ No newline at end of file
diff --git a/app/src/test/java/org/opencord/dhcpl2relay/impl/DhcpL2RelayTestBase.java b/app/src/test/java/org/opencord/dhcpl2relay/impl/DhcpL2RelayTestBase.java
index 5318adc..a389ba4 100755
--- a/app/src/test/java/org/opencord/dhcpl2relay/impl/DhcpL2RelayTestBase.java
+++ b/app/src/test/java/org/opencord/dhcpl2relay/impl/DhcpL2RelayTestBase.java
@@ -16,17 +16,8 @@
package org.opencord.dhcpl2relay.impl;
-import static org.junit.Assert.fail;
-
-import java.nio.ByteBuffer;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
import org.onlab.packet.BasePacket;
import org.onlab.packet.DHCP;
-import org.onlab.packet.DHCPPacketType;
import org.onlab.packet.Ethernet;
import org.onlab.packet.IPv4;
import org.onlab.packet.Ip4Address;
@@ -47,6 +38,14 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import static org.junit.Assert.fail;
+
/**
* Common methods for AAA app testing.
@@ -208,7 +207,7 @@
UDP udpPacket = (UDP) ipv4Packet.getPayload();
DHCP dhcpPacket = (DHCP) udpPacket.getPayload();
- dhcpPacket.setOptions(constructDhcpOptions(DHCPPacketType.DHCPDISCOVER));
+ dhcpPacket.setOptions(constructDhcpOptions(DHCP.MsgType.DHCPDISCOVER));
return pkt;
}
@@ -228,7 +227,7 @@
UDP udpPacket = (UDP) ipv4Packet.getPayload();
DHCP dhcpPacket = (DHCP) udpPacket.getPayload();
- dhcpPacket.setOptions(constructDhcpOptions(DHCPPacketType.DHCPREQUEST));
+ dhcpPacket.setOptions(constructDhcpOptions(DHCP.MsgType.DHCPREQUEST));
return pkt;
}
@@ -248,7 +247,7 @@
UDP udpPacket = (UDP) ipv4Packet.getPayload();
DHCP dhcpPacket = (DHCP) udpPacket.getPayload();
- dhcpPacket.setOptions(constructDhcpOptions(DHCPPacketType.DHCPOFFER));
+ dhcpPacket.setOptions(constructDhcpOptions(DHCP.MsgType.DHCPOFFER));
return pkt;
}
@@ -268,7 +267,7 @@
UDP udpPacket = (UDP) ipv4Packet.getPayload();
DHCP dhcpPacket = (DHCP) udpPacket.getPayload();
- dhcpPacket.setOptions(constructDhcpOptions(DHCPPacketType.DHCPACK));
+ dhcpPacket.setOptions(constructDhcpOptions(DHCP.MsgType.DHCPACK));
return pkt;
}
@@ -278,7 +277,7 @@
*
* @return Ethernet packet
*/
- private List<DhcpOption> constructDhcpOptions(DHCPPacketType packetType) {
+ private List<DhcpOption> constructDhcpOptions(DHCP.MsgType packetType) {
// DHCP Options.
DhcpOption option = new DhcpOption();
diff --git a/pom.xml b/pom.xml
index 80bd80b..0de6965 100755
--- a/pom.xml
+++ b/pom.xml
@@ -17,16 +17,11 @@
<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>onos-dependencies</artifactId>
- <version>1.13.9</version>
- <relativePath></relativePath>
- </parent>
-
<groupId>org.opencord</groupId>
<artifactId>dhcpl2relay</artifactId>
- <version>1.6.0</version>
+ <!-- TODO: Should the version be bumped since we are now producing
+ classes for JRE 11? -->
+ <version>2.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<description>DHCP L2 Relay Agent</description>
@@ -34,11 +29,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <onos.version>1.13.9</onos.version>
- <onos.app.requires>
- org.opencord.sadis
- </onos.app.requires>
- <sadis.api.version>3.1.0</sadis.api.version>
+ <onos.version>2.2.0</onos.version>
+ <sadis.api.version>4.0.0-SNAPSHOT</sadis.api.version>
</properties>
<modules>
@@ -46,89 +38,24 @@
<module>api</module>
</modules>
- <dependencies>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-api</artifactId>
- <version>${onos.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opencord</groupId>
- <artifactId>sadis-api</artifactId>
- <version>${sadis.api.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-incubator-api</artifactId>
- <version>${onos.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-osgi</artifactId>
- <version>${onos.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-junit</artifactId>
- <version>${onos.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-cli</artifactId>
- <version>${onos.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-api</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>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-osgi</artifactId>
- <version>${onos.version}</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
<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.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- </plugin>
-
- <plugin>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-maven-plugin</artifactId>
- <version>1.11</version>
+ <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>
@@ -159,4 +86,10 @@
</snapshots>
</repository>
</repositories>
+ <distributionManagement>
+ <snapshotRepository>
+ <id>ossrh</id>
+ <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+ </snapshotRepository>
+ </distributionManagement>
</project>