Updated SDN-IP to use Ip4Address and Ip4Prefix instead of IpAddress and
IpPrefix, because so far we haven't implemented IPv6.
Also, some of the BGP-related attributes (e.g., BGP Speaker ID)
are IPv4 by definition.
The following components are updated:
* BGP implementation
* Router component and relevant state (e.g., RouteEntry)
Other components (e.g., configuration) will continue to use
the more generic IpAddress and IpPrefix.
Change-Id: I1936ca9871fd5a9709cb4f2c2850d78ebc1472c4
diff --git a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/RouteEntry.java b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/RouteEntry.java
index 95169bb..07dd691 100644
--- a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/RouteEntry.java
+++ b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/RouteEntry.java
@@ -19,8 +19,8 @@
import java.util.Objects;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.Ip4Prefix;
import com.google.common.base.MoreObjects;
@@ -28,8 +28,8 @@
* Represents a route entry for an IP prefix.
*/
public class RouteEntry {
- private final IpPrefix prefix; // The IP prefix
- private final IpAddress nextHop; // Next-hop IP address
+ private final Ip4Prefix prefix; // The IP prefix
+ private final Ip4Address nextHop; // Next-hop IP address
/**
* Class constructor.
@@ -37,7 +37,7 @@
* @param prefix the IP prefix of the route
* @param nextHop the next hop IP address for the route
*/
- public RouteEntry(IpPrefix prefix, IpAddress nextHop) {
+ public RouteEntry(Ip4Prefix prefix, Ip4Address nextHop) {
this.prefix = checkNotNull(prefix);
this.nextHop = checkNotNull(nextHop);
}
@@ -47,7 +47,7 @@
*
* @return the IP prefix of the route
*/
- public IpPrefix prefix() {
+ public Ip4Prefix prefix() {
return prefix;
}
@@ -56,7 +56,7 @@
*
* @return the next hop IP address for the route
*/
- public IpAddress nextHop() {
+ public Ip4Address nextHop() {
return nextHop;
}
@@ -67,7 +67,7 @@
* @param ip4Prefix the IPv4 prefix to use
* @return the binary string representation
*/
- static String createBinaryString(IpPrefix ip4Prefix) {
+ static String createBinaryString(Ip4Prefix ip4Prefix) {
if (ip4Prefix.prefixLength() == 0) {
return "";
}
@@ -75,7 +75,7 @@
StringBuilder result = new StringBuilder(ip4Prefix.prefixLength());
long value = ip4Prefix.address().toInt() & 0xffffffffL;
for (int i = 0; i < ip4Prefix.prefixLength(); i++) {
- long mask = 1 << (IpPrefix.MAX_INET_MASK_LENGTH - 1 - i);
+ long mask = 1 << (Ip4Prefix.MAX_MASK_LENGTH - 1 - i);
result.append(((value & mask) == 0) ? "0" : "1");
}
return result.toString();