Remove deprecated APIs from packet classes
Change-Id: Id02d759077e19e84ed290994ca53b2a0593de223
diff --git a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/IcmpHandler.java b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/IcmpHandler.java
index cb604a7..e7c9203 100644
--- a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/IcmpHandler.java
+++ b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/IcmpHandler.java
@@ -452,11 +452,11 @@
byte[] dstMac = IPv6.getMCastMacAddress(dstIp);
// Creates the request.
Ethernet ndpRequest = NeighborSolicitation.buildNdpSolicit(
- targetAddress.toOctets(),
- senderIpAddress,
- dstIp,
- senderMacAddress,
- dstMac,
+ targetAddress.getIp6Address(),
+ Ip6Address.valueOf(senderIpAddress),
+ Ip6Address.valueOf(dstIp),
+ MacAddress.valueOf(senderMacAddress),
+ MacAddress.valueOf(dstMac),
VlanId.NONE
);
flood(ndpRequest, inPort, targetAddress);
diff --git a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/SimpleFabricManager.java b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/SimpleFabricManager.java
index 6bfd813..cf34834 100644
--- a/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/SimpleFabricManager.java
+++ b/apps/simplefabric/app/src/main/java/org/onosproject/simplefabric/impl/SimpleFabricManager.java
@@ -468,11 +468,11 @@
} else {
byte[] soliciteIp = IPv6.getSolicitNodeAddress(ip.toOctets());
neighbourReq = NeighborSolicitation.buildNdpSolicit(
- ip.toOctets(),
- fabricSubnet.gatewayIp().toOctets(),
- soliciteIp,
- fabricSubnet.gatewayMac().toBytes(),
- IPv6.getMCastMacAddress(soliciteIp),
+ ip.getIp6Address(),
+ fabricSubnet.gatewayIp().getIp6Address(),
+ Ip6Address.valueOf(soliciteIp),
+ MacAddress.valueOf(fabricSubnet.gatewayMac().toBytes()),
+ MacAddress.valueOf(IPv6.getMCastMacAddress(soliciteIp)),
iface.vlan());
}
TrafficTreatment treatment = DefaultTrafficTreatment.builder()
diff --git a/core/net/src/main/java/org/onosproject/net/host/impl/HostMonitor.java b/core/net/src/main/java/org/onosproject/net/host/impl/HostMonitor.java
index 3d9861c..ef1c796 100644
--- a/core/net/src/main/java/org/onosproject/net/host/impl/HostMonitor.java
+++ b/core/net/src/main/java/org/onosproject/net/host/impl/HostMonitor.java
@@ -227,11 +227,11 @@
// and the multicast mac address as Ethernet destination.
byte[] destIp = IPv6.getSolicitNodeAddress(targetIp.toOctets());
probePacket = NeighborSolicitation.buildNdpSolicit(
- targetIp.toOctets(),
- sourceIp.toOctets(),
- destIp,
- sourceMac.toBytes(),
- IPv6.getMCastMacAddress(destIp),
+ targetIp.getIp6Address(),
+ sourceIp.getIp6Address(),
+ Ip6Address.valueOf(destIp),
+ sourceMac,
+ MacAddress.valueOf(IPv6.getMCastMacAddress(destIp)),
vlan
);
}
diff --git a/utils/misc/src/main/java/org/onlab/packet/DHCPPacketType.java b/utils/misc/src/main/java/org/onlab/packet/DHCPPacketType.java
deleted file mode 100644
index c88b907..0000000
--- a/utils/misc/src/main/java/org/onlab/packet/DHCPPacketType.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright 2014-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.onlab.packet;
-
-/**
- * @deprecated 1.11 Loon, move into DHCP class.
- */
-@Deprecated
-public enum DHCPPacketType {
- // From RFC 1533
- DHCPDISCOVER(1), DHCPOFFER(2), DHCPREQUEST(3), DHCPDECLINE(4), DHCPACK(5), DHCPNAK(
- 6), DHCPRELEASE(7),
-
- // From RFC2132
- DHCPINFORM(8),
-
- // From RFC3203
- DHCPFORCERENEW(9),
-
- // From RFC4388
- DHCPLEASEQUERY(10), DHCPLEASEUNASSIGNED(11), DHCPLEASEUNKNOWN(12), DHCPLEASEACTIVE(
- 13);
-
- protected int value;
-
- private DHCPPacketType(final int value) {
- this.value = value;
- }
-
- public int getValue() {
- return this.value;
- }
-
- @Override
- public String toString() {
- switch (this.value) {
- case 1:
- return "DHCPDISCOVER";
- case 2:
- return "DHCPOFFER";
- case 3:
- return "DHCPREQUEST";
- case 4:
- return "DHCPDECLINE";
- case 5:
- return "DHCPACK";
- case 6:
- return "DHCPNAK";
- case 7:
- return "DHCPRELEASE";
- case 8:
- return "DHCPINFORM";
- case 9:
- return "DHCPFORCERENEW";
- case 10:
- return "DHCPLEASEQUERY";
- case 11:
- return "DHCPLEASEUNASSIGNED";
- case 12:
- return "DHCPLEASEUNKNOWN";
- case 13:
- return "DHCPLEASEACTIVE";
- default:
- break;
- }
-
- return "";
- }
-
- public static DHCPPacketType getType(final int value) {
- switch (value) {
- case 1:
- return DHCPDISCOVER;
- case 2:
- return DHCPOFFER;
- case 3:
- return DHCPREQUEST;
- case 4:
- return DHCPDECLINE;
- case 5:
- return DHCPACK;
- case 6:
- return DHCPNAK;
- case 7:
- return DHCPRELEASE;
- case 8:
- return DHCPINFORM;
- case 9:
- return DHCPFORCERENEW;
- case 10:
- return DHCPLEASEQUERY;
- case 11:
- return DHCPLEASEUNASSIGNED;
- case 12:
- return DHCPLEASEUNKNOWN;
- case 13:
- return DHCPLEASEACTIVE;
- default:
- break;
- }
-
- return null;
- }
-}
diff --git a/utils/misc/src/main/java/org/onlab/packet/ICMP.java b/utils/misc/src/main/java/org/onlab/packet/ICMP.java
index 944f9ee..14196a2 100644
--- a/utils/misc/src/main/java/org/onlab/packet/ICMP.java
+++ b/utils/misc/src/main/java/org/onlab/packet/ICMP.java
@@ -31,11 +31,6 @@
public static final byte TYPE_ECHO_REQUEST = 0x08;
public static final byte TYPE_ECHO_REPLY = 0x00;
- /**
- * @deprecated since Peacock (1.15) - Use CODE_ECHO_REPLY instead.
- */
- @Deprecated
- public static final byte SUBTYPE_ECHO_REPLY = 0x00;
public static final byte CODE_ECHO_REPLY = 0x00;
public static final byte CODE_ECHO_REQEUST = 0x00;
diff --git a/utils/misc/src/main/java/org/onlab/packet/IpPrefix.java b/utils/misc/src/main/java/org/onlab/packet/IpPrefix.java
index 68e8733..0a6a5a3 100644
--- a/utils/misc/src/main/java/org/onlab/packet/IpPrefix.java
+++ b/utils/misc/src/main/java/org/onlab/packet/IpPrefix.java
@@ -38,11 +38,6 @@
/**
* An IpPrefix that contains all IPv4 multicast addresses.
*/
- @Deprecated
- public static final IpPrefix MULTICAST_RANGE = IpPrefix.valueOf("224.0.0.0/4");
- /**
- * An IpPrefix that contains all IPv4 multicast addresses.
- */
public static final IpPrefix IPV4_MULTICAST_PREFIX = IpPrefix.valueOf("224.0.0.0/4");
/**
* An IpPrefix that contains all IPv6 multicast addresses.
diff --git a/utils/misc/src/main/java/org/onlab/packet/LLDP.java b/utils/misc/src/main/java/org/onlab/packet/LLDP.java
index e555f1f..37f33dd 100644
--- a/utils/misc/src/main/java/org/onlab/packet/LLDP.java
+++ b/utils/misc/src/main/java/org/onlab/packet/LLDP.java
@@ -38,13 +38,7 @@
public static final byte PORT_TLV_TYPE = 2;
public static final short PORT_TLV_SIZE = 5;
- /**
- * @deprecated since 1.15. Use the PORT_TLV_COMPONENT_SUBTYPE instead of PORT_TLV_SUBTYPE.
- */
- @Deprecated
- public static final byte PORT_TLV_SUBTYPE = 2;
-
- public static final byte PORT_TLV_COMPONENT_SUBTYPE = PORT_TLV_SUBTYPE;
+ public static final byte PORT_TLV_COMPONENT_SUBTYPE = 2;
public static final byte PORT_TLV_INTERFACE_NAME_SUBTYPE = 5;
public static final byte TTL_TLV_TYPE = 3;
diff --git a/utils/misc/src/main/java/org/onlab/packet/ndp/NeighborAdvertisement.java b/utils/misc/src/main/java/org/onlab/packet/ndp/NeighborAdvertisement.java
index 77c360a..ffb7e52 100644
--- a/utils/misc/src/main/java/org/onlab/packet/ndp/NeighborAdvertisement.java
+++ b/utils/misc/src/main/java/org/onlab/packet/ndp/NeighborAdvertisement.java
@@ -289,69 +289,6 @@
* @param srcMac the MAC address to use as the reply source
* @param request the Neighbor Solicitation request we got
* @return an Ethernet frame containing the Neighbor Advertisement reply
- * @deprecated since 1.11.0
- */
- @Deprecated
- public static Ethernet buildNdpAdv(byte[] srcIp,
- byte[] srcMac,
- Ethernet request) {
-
- if (srcIp.length != Ip6Address.BYTE_LENGTH ||
- srcMac.length != MacAddress.MAC_ADDRESS_LENGTH) {
- return null;
- }
-
- if (request.getEtherType() != Ethernet.TYPE_IPV6) {
- return null;
- }
-
- IPv6 ipv6Request = (IPv6) request.getPayload();
-
- if (ipv6Request.getNextHeader() != IPv6.PROTOCOL_ICMP6) {
- return null;
- }
-
- ICMP6 icmpv6 = (ICMP6) ipv6Request.getPayload();
-
- if (icmpv6.getIcmpType() != ICMP6.NEIGHBOR_SOLICITATION) {
- return null;
- }
-
- Ethernet eth = new Ethernet();
- eth.setDestinationMACAddress(request.getSourceMAC());
- eth.setSourceMACAddress(srcMac);
- eth.setEtherType(Ethernet.TYPE_IPV6);
- eth.setVlanID(request.getVlanID());
-
- IPv6 ipv6 = new IPv6();
- ipv6.setSourceAddress(srcIp);
- ipv6.setDestinationAddress(ipv6Request.getSourceAddress());
- ipv6.setHopLimit((byte) 255);
-
- ICMP6 icmp6 = new ICMP6();
- icmp6.setIcmpType(ICMP6.NEIGHBOR_ADVERTISEMENT);
- icmp6.setIcmpCode((byte) 0);
-
- NeighborAdvertisement nadv = new NeighborAdvertisement();
- nadv.setTargetAddress(srcIp);
- nadv.setSolicitedFlag((byte) 1);
- nadv.setOverrideFlag((byte) 1);
- nadv.addOption(NeighborDiscoveryOptions.TYPE_TARGET_LL_ADDRESS,
- srcMac);
-
- icmp6.setPayload(nadv);
- ipv6.setPayload(icmp6);
- eth.setPayload(ipv6);
- return eth;
- }
-
- /**
- * Builds an NDP reply based on a request.
- *
- * @param srcIp the IP address to use as the reply source
- * @param srcMac the MAC address to use as the reply source
- * @param request the Neighbor Solicitation request we got
- * @return an Ethernet frame containing the Neighbor Advertisement reply
*/
public static Ethernet buildNdpAdv(Ip6Address srcIp,
MacAddress srcMac,
diff --git a/utils/misc/src/main/java/org/onlab/packet/ndp/NeighborSolicitation.java b/utils/misc/src/main/java/org/onlab/packet/ndp/NeighborSolicitation.java
index d48edc9..73350fc 100644
--- a/utils/misc/src/main/java/org/onlab/packet/ndp/NeighborSolicitation.java
+++ b/utils/misc/src/main/java/org/onlab/packet/ndp/NeighborSolicitation.java
@@ -206,64 +206,6 @@
* @param destinationMac the destination mac address
* @param vlan the vlan id
* @return the ethernet packet containing the ndp solicitation
- * @deprecated since 1.11.0
- */
- @Deprecated
- public static Ethernet buildNdpSolicit(byte[] targetIp,
- byte[] sourceIp,
- byte[] destinationIp,
- byte[] sourceMac,
- byte[] destinationMac,
- VlanId vlan) {
-
- if (targetIp.length != Ip6Address.BYTE_LENGTH ||
- sourceIp.length != Ip6Address.BYTE_LENGTH ||
- destinationIp.length != Ip6Address.BYTE_LENGTH ||
- sourceMac.length != MacAddress.MAC_ADDRESS_LENGTH ||
- destinationMac.length != MacAddress.MAC_ADDRESS_LENGTH) {
- return null;
- }
-
- // Here we craft the Ethernet packet.
- Ethernet ethernet = new Ethernet();
- ethernet.setEtherType(Ethernet.TYPE_IPV6)
- .setDestinationMACAddress(destinationMac)
- .setSourceMACAddress(sourceMac);
- ethernet.setVlanID(vlan.id());
- // IPv6 packet is created.
- IPv6 ipv6 = new IPv6();
- ipv6.setSourceAddress(sourceIp);
- ipv6.setDestinationAddress(destinationIp);
- ipv6.setHopLimit((byte) 255);
- // Create the ICMPv6 packet.
- ICMP6 icmp6 = new ICMP6();
- icmp6.setIcmpType(ICMP6.NEIGHBOR_SOLICITATION);
- icmp6.setIcmpCode((byte) 0);
- // Create the Neighbor Solicitation packet.
- NeighborSolicitation ns = new NeighborSolicitation();
- ns.setTargetAddress(targetIp);
- // DAD packets should not contain SRC_LL_ADDR option
- if (!Arrays.equals(sourceIp, Ip6Address.ZERO.toOctets())) {
- ns.addOption(NeighborDiscoveryOptions.TYPE_SOURCE_LL_ADDRESS, sourceMac);
- }
- // Set the payloads
- icmp6.setPayload(ns);
- ipv6.setPayload(icmp6);
- ethernet.setPayload(ipv6);
-
- return ethernet;
- }
-
- /**
- * Builds a NDP solicitation using the supplied parameters.
- *
- * @param targetIp the target ip
- * @param sourceIp the source ip
- * @param destinationIp the destination ip
- * @param sourceMac the source mac address
- * @param destinationMac the destination mac address
- * @param vlan the vlan id
- * @return the ethernet packet containing the ndp solicitation
*/
public static Ethernet buildNdpSolicit(Ip6Address targetIp,
Ip6Address sourceIp,