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/test/java/org/onlab/onos/sdnip/RouteEntryTest.java b/apps/sdnip/src/test/java/org/onlab/onos/sdnip/RouteEntryTest.java
index 9af90a7..ca5b1f8 100644
--- a/apps/sdnip/src/test/java/org/onlab/onos/sdnip/RouteEntryTest.java
+++ b/apps/sdnip/src/test/java/org/onlab/onos/sdnip/RouteEntryTest.java
@@ -20,8 +20,8 @@
import static org.junit.Assert.assertThat;
import org.junit.Test;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.Ip4Prefix;
/**
* Unit tests for the RouteEntry class.
@@ -32,8 +32,8 @@
*/
@Test
public void testConstructor() {
- IpPrefix prefix = IpPrefix.valueOf("1.2.3.0/24");
- IpAddress nextHop = IpAddress.valueOf("5.6.7.8");
+ Ip4Prefix prefix = Ip4Prefix.valueOf("1.2.3.0/24");
+ Ip4Address nextHop = Ip4Address.valueOf("5.6.7.8");
RouteEntry routeEntry = new RouteEntry(prefix, nextHop);
assertThat(routeEntry.toString(),
@@ -45,8 +45,8 @@
*/
@Test(expected = NullPointerException.class)
public void testInvalidConstructorNullPrefix() {
- IpPrefix prefix = null;
- IpAddress nextHop = IpAddress.valueOf("5.6.7.8");
+ Ip4Prefix prefix = null;
+ Ip4Address nextHop = Ip4Address.valueOf("5.6.7.8");
new RouteEntry(prefix, nextHop);
}
@@ -56,8 +56,8 @@
*/
@Test(expected = NullPointerException.class)
public void testInvalidConstructorNullNextHop() {
- IpPrefix prefix = IpPrefix.valueOf("1.2.3.0/24");
- IpAddress nextHop = null;
+ Ip4Prefix prefix = Ip4Prefix.valueOf("1.2.3.0/24");
+ Ip4Address nextHop = null;
new RouteEntry(prefix, nextHop);
}
@@ -67,8 +67,8 @@
*/
@Test
public void testGetFields() {
- IpPrefix prefix = IpPrefix.valueOf("1.2.3.0/24");
- IpAddress nextHop = IpAddress.valueOf("5.6.7.8");
+ Ip4Prefix prefix = Ip4Prefix.valueOf("1.2.3.0/24");
+ Ip4Address nextHop = Ip4Address.valueOf("5.6.7.8");
RouteEntry routeEntry = new RouteEntry(prefix, nextHop);
assertThat(routeEntry.prefix(), is(prefix));
@@ -80,28 +80,28 @@
*/
@Test
public void testCreateBinaryString() {
- IpPrefix prefix;
+ Ip4Prefix prefix;
- prefix = IpPrefix.valueOf("0.0.0.0/0");
+ prefix = Ip4Prefix.valueOf("0.0.0.0/0");
assertThat(RouteEntry.createBinaryString(prefix), is(""));
- prefix = IpPrefix.valueOf("192.168.166.0/22");
+ prefix = Ip4Prefix.valueOf("192.168.166.0/22");
assertThat(RouteEntry.createBinaryString(prefix),
is("1100000010101000101001"));
- prefix = IpPrefix.valueOf("192.168.166.0/23");
+ prefix = Ip4Prefix.valueOf("192.168.166.0/23");
assertThat(RouteEntry.createBinaryString(prefix),
is("11000000101010001010011"));
- prefix = IpPrefix.valueOf("192.168.166.0/24");
+ prefix = Ip4Prefix.valueOf("192.168.166.0/24");
assertThat(RouteEntry.createBinaryString(prefix),
is("110000001010100010100110"));
- prefix = IpPrefix.valueOf("130.162.10.1/25");
+ prefix = Ip4Prefix.valueOf("130.162.10.1/25");
assertThat(RouteEntry.createBinaryString(prefix),
is("1000001010100010000010100"));
- prefix = IpPrefix.valueOf("255.255.255.255/32");
+ prefix = Ip4Prefix.valueOf("255.255.255.255/32");
assertThat(RouteEntry.createBinaryString(prefix),
is("11111111111111111111111111111111"));
}
@@ -111,12 +111,12 @@
*/
@Test
public void testEquality() {
- IpPrefix prefix1 = IpPrefix.valueOf("1.2.3.0/24");
- IpAddress nextHop1 = IpAddress.valueOf("5.6.7.8");
+ Ip4Prefix prefix1 = Ip4Prefix.valueOf("1.2.3.0/24");
+ Ip4Address nextHop1 = Ip4Address.valueOf("5.6.7.8");
RouteEntry routeEntry1 = new RouteEntry(prefix1, nextHop1);
- IpPrefix prefix2 = IpPrefix.valueOf("1.2.3.0/24");
- IpAddress nextHop2 = IpAddress.valueOf("5.6.7.8");
+ Ip4Prefix prefix2 = Ip4Prefix.valueOf("1.2.3.0/24");
+ Ip4Address nextHop2 = Ip4Address.valueOf("5.6.7.8");
RouteEntry routeEntry2 = new RouteEntry(prefix2, nextHop2);
assertThat(routeEntry1, is(routeEntry2));
@@ -127,16 +127,16 @@
*/
@Test
public void testNonEquality() {
- IpPrefix prefix1 = IpPrefix.valueOf("1.2.3.0/24");
- IpAddress nextHop1 = IpAddress.valueOf("5.6.7.8");
+ Ip4Prefix prefix1 = Ip4Prefix.valueOf("1.2.3.0/24");
+ Ip4Address nextHop1 = Ip4Address.valueOf("5.6.7.8");
RouteEntry routeEntry1 = new RouteEntry(prefix1, nextHop1);
- IpPrefix prefix2 = IpPrefix.valueOf("1.2.3.0/25"); // Different
- IpAddress nextHop2 = IpAddress.valueOf("5.6.7.8");
+ Ip4Prefix prefix2 = Ip4Prefix.valueOf("1.2.3.0/25"); // Different
+ Ip4Address nextHop2 = Ip4Address.valueOf("5.6.7.8");
RouteEntry routeEntry2 = new RouteEntry(prefix2, nextHop2);
- IpPrefix prefix3 = IpPrefix.valueOf("1.2.3.0/24");
- IpAddress nextHop3 = IpAddress.valueOf("5.6.7.9"); // Different
+ Ip4Prefix prefix3 = Ip4Prefix.valueOf("1.2.3.0/24");
+ Ip4Address nextHop3 = Ip4Address.valueOf("5.6.7.9"); // Different
RouteEntry routeEntry3 = new RouteEntry(prefix3, nextHop3);
assertThat(routeEntry1, is(not(routeEntry2)));
@@ -148,8 +148,8 @@
*/
@Test
public void testToString() {
- IpPrefix prefix = IpPrefix.valueOf("1.2.3.0/24");
- IpAddress nextHop = IpAddress.valueOf("5.6.7.8");
+ Ip4Prefix prefix = Ip4Prefix.valueOf("1.2.3.0/24");
+ Ip4Address nextHop = Ip4Address.valueOf("5.6.7.8");
RouteEntry routeEntry = new RouteEntry(prefix, nextHop);
assertThat(routeEntry.toString(),