Pavlin Radoslavov

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
...@@ -19,8 +19,8 @@ import static com.google.common.base.Preconditions.checkNotNull; ...@@ -19,8 +19,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
19 19
20 import java.util.Objects; 20 import java.util.Objects;
21 21
22 -import org.onlab.packet.IpAddress; 22 +import org.onlab.packet.Ip4Address;
23 -import org.onlab.packet.IpPrefix; 23 +import org.onlab.packet.Ip4Prefix;
24 24
25 import com.google.common.base.MoreObjects; 25 import com.google.common.base.MoreObjects;
26 26
...@@ -28,8 +28,8 @@ import com.google.common.base.MoreObjects; ...@@ -28,8 +28,8 @@ import com.google.common.base.MoreObjects;
28 * Represents a route entry for an IP prefix. 28 * Represents a route entry for an IP prefix.
29 */ 29 */
30 public class RouteEntry { 30 public class RouteEntry {
31 - private final IpPrefix prefix; // The IP prefix 31 + private final Ip4Prefix prefix; // The IP prefix
32 - private final IpAddress nextHop; // Next-hop IP address 32 + private final Ip4Address nextHop; // Next-hop IP address
33 33
34 /** 34 /**
35 * Class constructor. 35 * Class constructor.
...@@ -37,7 +37,7 @@ public class RouteEntry { ...@@ -37,7 +37,7 @@ public class RouteEntry {
37 * @param prefix the IP prefix of the route 37 * @param prefix the IP prefix of the route
38 * @param nextHop the next hop IP address for the route 38 * @param nextHop the next hop IP address for the route
39 */ 39 */
40 - public RouteEntry(IpPrefix prefix, IpAddress nextHop) { 40 + public RouteEntry(Ip4Prefix prefix, Ip4Address nextHop) {
41 this.prefix = checkNotNull(prefix); 41 this.prefix = checkNotNull(prefix);
42 this.nextHop = checkNotNull(nextHop); 42 this.nextHop = checkNotNull(nextHop);
43 } 43 }
...@@ -47,7 +47,7 @@ public class RouteEntry { ...@@ -47,7 +47,7 @@ public class RouteEntry {
47 * 47 *
48 * @return the IP prefix of the route 48 * @return the IP prefix of the route
49 */ 49 */
50 - public IpPrefix prefix() { 50 + public Ip4Prefix prefix() {
51 return prefix; 51 return prefix;
52 } 52 }
53 53
...@@ -56,7 +56,7 @@ public class RouteEntry { ...@@ -56,7 +56,7 @@ public class RouteEntry {
56 * 56 *
57 * @return the next hop IP address for the route 57 * @return the next hop IP address for the route
58 */ 58 */
59 - public IpAddress nextHop() { 59 + public Ip4Address nextHop() {
60 return nextHop; 60 return nextHop;
61 } 61 }
62 62
...@@ -67,7 +67,7 @@ public class RouteEntry { ...@@ -67,7 +67,7 @@ public class RouteEntry {
67 * @param ip4Prefix the IPv4 prefix to use 67 * @param ip4Prefix the IPv4 prefix to use
68 * @return the binary string representation 68 * @return the binary string representation
69 */ 69 */
70 - static String createBinaryString(IpPrefix ip4Prefix) { 70 + static String createBinaryString(Ip4Prefix ip4Prefix) {
71 if (ip4Prefix.prefixLength() == 0) { 71 if (ip4Prefix.prefixLength() == 0) {
72 return ""; 72 return "";
73 } 73 }
...@@ -75,7 +75,7 @@ public class RouteEntry { ...@@ -75,7 +75,7 @@ public class RouteEntry {
75 StringBuilder result = new StringBuilder(ip4Prefix.prefixLength()); 75 StringBuilder result = new StringBuilder(ip4Prefix.prefixLength());
76 long value = ip4Prefix.address().toInt() & 0xffffffffL; 76 long value = ip4Prefix.address().toInt() & 0xffffffffL;
77 for (int i = 0; i < ip4Prefix.prefixLength(); i++) { 77 for (int i = 0; i < ip4Prefix.prefixLength(); i++) {
78 - long mask = 1 << (IpPrefix.MAX_INET_MASK_LENGTH - 1 - i); 78 + long mask = 1 << (Ip4Prefix.MAX_MASK_LENGTH - 1 - i);
79 result.append(((value & mask) == 0) ? "0" : "1"); 79 result.append(((value & mask) == 0) ? "0" : "1");
80 } 80 }
81 return result.toString(); 81 return result.toString();
......
...@@ -21,8 +21,8 @@ import java.util.ArrayList; ...@@ -21,8 +21,8 @@ import java.util.ArrayList;
21 import java.util.Objects; 21 import java.util.Objects;
22 22
23 import org.onlab.onos.sdnip.RouteEntry; 23 import org.onlab.onos.sdnip.RouteEntry;
24 -import org.onlab.packet.IpAddress; 24 +import org.onlab.packet.Ip4Address;
25 -import org.onlab.packet.IpPrefix; 25 +import org.onlab.packet.Ip4Prefix;
26 26
27 import com.google.common.base.MoreObjects; 27 import com.google.common.base.MoreObjects;
28 28
...@@ -48,8 +48,8 @@ public class BgpRouteEntry extends RouteEntry { ...@@ -48,8 +48,8 @@ public class BgpRouteEntry extends RouteEntry {
48 * @param asPath the AS path 48 * @param asPath the AS path
49 * @param localPref the route local preference 49 * @param localPref the route local preference
50 */ 50 */
51 - public BgpRouteEntry(BgpSession bgpSession, IpPrefix prefix, 51 + public BgpRouteEntry(BgpSession bgpSession, Ip4Prefix prefix,
52 - IpAddress nextHop, byte origin, 52 + Ip4Address nextHop, byte origin,
53 BgpRouteEntry.AsPath asPath, long localPref) { 53 BgpRouteEntry.AsPath asPath, long localPref) {
54 super(prefix, nextHop); 54 super(prefix, nextHop);
55 this.bgpSession = checkNotNull(bgpSession); 55 this.bgpSession = checkNotNull(bgpSession);
...@@ -232,15 +232,15 @@ public class BgpRouteEntry extends RouteEntry { ...@@ -232,15 +232,15 @@ public class BgpRouteEntry extends RouteEntry {
232 } 232 }
233 233
234 // Compare the peer BGP ID: lower is better 234 // Compare the peer BGP ID: lower is better
235 - IpAddress peerBgpId = getBgpSession().getRemoteBgpId(); 235 + Ip4Address peerBgpId = getBgpSession().getRemoteBgpId();
236 - IpAddress otherPeerBgpId = other.getBgpSession().getRemoteBgpId(); 236 + Ip4Address otherPeerBgpId = other.getBgpSession().getRemoteBgpId();
237 if (!peerBgpId.equals(otherPeerBgpId)) { 237 if (!peerBgpId.equals(otherPeerBgpId)) {
238 return (peerBgpId.compareTo(otherPeerBgpId) < 0); 238 return (peerBgpId.compareTo(otherPeerBgpId) < 0);
239 } 239 }
240 240
241 // Compare the peer BGP address: lower is better 241 // Compare the peer BGP address: lower is better
242 - IpAddress peerAddress = getBgpSession().getRemoteIp4Address(); 242 + Ip4Address peerAddress = getBgpSession().getRemoteIp4Address();
243 - IpAddress otherPeerAddress = 243 + Ip4Address otherPeerAddress =
244 other.getBgpSession().getRemoteIp4Address(); 244 other.getBgpSession().getRemoteIp4Address();
245 if (!peerAddress.equals(otherPeerAddress)) { 245 if (!peerAddress.equals(otherPeerAddress)) {
246 return (peerAddress.compareTo(otherPeerAddress) < 0); 246 return (peerAddress.compareTo(otherPeerAddress) < 0);
......
...@@ -35,8 +35,8 @@ import org.jboss.netty.channel.Channels; ...@@ -35,8 +35,8 @@ import org.jboss.netty.channel.Channels;
35 import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; 35 import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
36 import org.onlab.onos.sdnip.RouteListener; 36 import org.onlab.onos.sdnip.RouteListener;
37 import org.onlab.onos.sdnip.RouteUpdate; 37 import org.onlab.onos.sdnip.RouteUpdate;
38 -import org.onlab.packet.IpAddress; 38 +import org.onlab.packet.Ip4Address;
39 -import org.onlab.packet.IpPrefix; 39 +import org.onlab.packet.Ip4Prefix;
40 import org.slf4j.Logger; 40 import org.slf4j.Logger;
41 import org.slf4j.LoggerFactory; 41 import org.slf4j.LoggerFactory;
42 42
...@@ -49,10 +49,10 @@ public class BgpSessionManager { ...@@ -49,10 +49,10 @@ public class BgpSessionManager {
49 private Channel serverChannel; // Listener for incoming BGP connections 49 private Channel serverChannel; // Listener for incoming BGP connections
50 private ConcurrentMap<SocketAddress, BgpSession> bgpSessions = 50 private ConcurrentMap<SocketAddress, BgpSession> bgpSessions =
51 new ConcurrentHashMap<>(); 51 new ConcurrentHashMap<>();
52 - private IpAddress myBgpId; // Same BGP ID for all peers 52 + private Ip4Address myBgpId; // Same BGP ID for all peers
53 53
54 private BgpRouteSelector bgpRouteSelector = new BgpRouteSelector(); 54 private BgpRouteSelector bgpRouteSelector = new BgpRouteSelector();
55 - private ConcurrentMap<IpPrefix, BgpRouteEntry> bgpRoutes = 55 + private ConcurrentMap<Ip4Prefix, BgpRouteEntry> bgpRoutes =
56 new ConcurrentHashMap<>(); 56 new ConcurrentHashMap<>();
57 57
58 private final RouteListener routeListener; 58 private final RouteListener routeListener;
...@@ -105,8 +105,7 @@ public class BgpSessionManager { ...@@ -105,8 +105,7 @@ public class BgpSessionManager {
105 if (bgpSession.getLocalAddress() instanceof InetSocketAddress) { 105 if (bgpSession.getLocalAddress() instanceof InetSocketAddress) {
106 InetAddress inetAddr = 106 InetAddress inetAddr =
107 ((InetSocketAddress) bgpSession.getLocalAddress()).getAddress(); 107 ((InetSocketAddress) bgpSession.getLocalAddress()).getAddress();
108 - IpAddress ip4Address = IpAddress.valueOf(IpAddress.Version.INET, 108 + Ip4Address ip4Address = Ip4Address.valueOf(inetAddr.getAddress());
109 - inetAddr.getAddress());
110 updateMyBgpId(ip4Address); 109 updateMyBgpId(ip4Address);
111 } 110 }
112 return true; 111 return true;
...@@ -128,7 +127,7 @@ public class BgpSessionManager { ...@@ -128,7 +127,7 @@ public class BgpSessionManager {
128 * 127 *
129 * @param ip4Address the IPv4 address to use as BGP ID 128 * @param ip4Address the IPv4 address to use as BGP ID
130 */ 129 */
131 - private synchronized void updateMyBgpId(IpAddress ip4Address) { 130 + private synchronized void updateMyBgpId(Ip4Address ip4Address) {
132 if (myBgpId == null) { 131 if (myBgpId == null) {
133 myBgpId = ip4Address; 132 myBgpId = ip4Address;
134 log.debug("BGP: My BGP ID is {}", myBgpId); 133 log.debug("BGP: My BGP ID is {}", myBgpId);
...@@ -140,7 +139,7 @@ public class BgpSessionManager { ...@@ -140,7 +139,7 @@ public class BgpSessionManager {
140 * 139 *
141 * @return the local BGP Identifier as an IPv4 address 140 * @return the local BGP Identifier as an IPv4 address
142 */ 141 */
143 - IpAddress getMyBgpId() { 142 + Ip4Address getMyBgpId() {
144 return myBgpId; 143 return myBgpId;
145 } 144 }
146 145
...@@ -352,7 +351,7 @@ public class BgpSessionManager { ...@@ -352,7 +351,7 @@ public class BgpSessionManager {
352 * @param prefix the prefix of the route 351 * @param prefix the prefix of the route
353 * @return the best route if found, otherwise null 352 * @return the best route if found, otherwise null
354 */ 353 */
355 - private BgpRouteEntry findBestBgpRoute(IpPrefix prefix) { 354 + private BgpRouteEntry findBestBgpRoute(Ip4Prefix prefix) {
356 BgpRouteEntry bestRoute = null; 355 BgpRouteEntry bestRoute = null;
357 356
358 // Iterate across all BGP Sessions and select the best route 357 // Iterate across all BGP Sessions and select the best route
......
...@@ -42,7 +42,9 @@ import org.onlab.onos.net.provider.ProviderId; ...@@ -42,7 +42,9 @@ import org.onlab.onos.net.provider.ProviderId;
42 import org.onlab.onos.sdnip.config.Interface; 42 import org.onlab.onos.sdnip.config.Interface;
43 import org.onlab.packet.Ethernet; 43 import org.onlab.packet.Ethernet;
44 import org.onlab.packet.IpAddress; 44 import org.onlab.packet.IpAddress;
45 +import org.onlab.packet.Ip4Address;
45 import org.onlab.packet.IpPrefix; 46 import org.onlab.packet.IpPrefix;
47 +import org.onlab.packet.Ip4Prefix;
46 import org.onlab.packet.MacAddress; 48 import org.onlab.packet.MacAddress;
47 import org.onlab.packet.VlanId; 49 import org.onlab.packet.VlanId;
48 50
...@@ -209,36 +211,36 @@ public class IntentSyncTest { ...@@ -209,36 +211,36 @@ public class IntentSyncTest {
209 // 6. RouteEntry6 was newly added, but the intent was not submitted. 211 // 6. RouteEntry6 was newly added, but the intent was not submitted.
210 // 212 //
211 RouteEntry routeEntry1 = new RouteEntry( 213 RouteEntry routeEntry1 = new RouteEntry(
212 - IpPrefix.valueOf("1.1.1.0/24"), 214 + Ip4Prefix.valueOf("1.1.1.0/24"),
213 - IpAddress.valueOf("192.168.10.1")); 215 + Ip4Address.valueOf("192.168.10.1"));
214 216
215 RouteEntry routeEntry2 = new RouteEntry( 217 RouteEntry routeEntry2 = new RouteEntry(
216 - IpPrefix.valueOf("2.2.2.0/24"), 218 + Ip4Prefix.valueOf("2.2.2.0/24"),
217 - IpAddress.valueOf("192.168.20.1")); 219 + Ip4Address.valueOf("192.168.20.1"));
218 220
219 RouteEntry routeEntry3 = new RouteEntry( 221 RouteEntry routeEntry3 = new RouteEntry(
220 - IpPrefix.valueOf("3.3.3.0/24"), 222 + Ip4Prefix.valueOf("3.3.3.0/24"),
221 - IpAddress.valueOf("192.168.30.1")); 223 + Ip4Address.valueOf("192.168.30.1"));
222 224
223 RouteEntry routeEntry4 = new RouteEntry( 225 RouteEntry routeEntry4 = new RouteEntry(
224 - IpPrefix.valueOf("4.4.4.0/24"), 226 + Ip4Prefix.valueOf("4.4.4.0/24"),
225 - IpAddress.valueOf("192.168.30.1")); 227 + Ip4Address.valueOf("192.168.30.1"));
226 228
227 RouteEntry routeEntry4Update = new RouteEntry( 229 RouteEntry routeEntry4Update = new RouteEntry(
228 - IpPrefix.valueOf("4.4.4.0/24"), 230 + Ip4Prefix.valueOf("4.4.4.0/24"),
229 - IpAddress.valueOf("192.168.20.1")); 231 + Ip4Address.valueOf("192.168.20.1"));
230 232
231 RouteEntry routeEntry5 = new RouteEntry( 233 RouteEntry routeEntry5 = new RouteEntry(
232 - IpPrefix.valueOf("5.5.5.0/24"), 234 + Ip4Prefix.valueOf("5.5.5.0/24"),
233 - IpAddress.valueOf("192.168.10.1")); 235 + Ip4Address.valueOf("192.168.10.1"));
234 236
235 RouteEntry routeEntry6 = new RouteEntry( 237 RouteEntry routeEntry6 = new RouteEntry(
236 - IpPrefix.valueOf("6.6.6.0/24"), 238 + Ip4Prefix.valueOf("6.6.6.0/24"),
237 - IpAddress.valueOf("192.168.10.1")); 239 + Ip4Address.valueOf("192.168.10.1"));
238 240
239 RouteEntry routeEntry7 = new RouteEntry( 241 RouteEntry routeEntry7 = new RouteEntry(
240 - IpPrefix.valueOf("7.7.7.0/24"), 242 + Ip4Prefix.valueOf("7.7.7.0/24"),
241 - IpAddress.valueOf("192.168.10.1")); 243 + Ip4Address.valueOf("192.168.10.1"));
242 244
243 MultiPointToSinglePointIntent intent1 = intentBuilder( 245 MultiPointToSinglePointIntent intent1 = intentBuilder(
244 routeEntry1.prefix(), "00:00:00:00:00:01", SW1_ETH1); 246 routeEntry1.prefix(), "00:00:00:00:00:01", SW1_ETH1);
...@@ -286,7 +288,7 @@ public class IntentSyncTest { ...@@ -286,7 +288,7 @@ public class IntentSyncTest {
286 routeEntry7); 288 routeEntry7);
287 TestUtils.setField(router, "bgpRoutes", bgpRoutes); 289 TestUtils.setField(router, "bgpRoutes", bgpRoutes);
288 290
289 - ConcurrentHashMap<IpPrefix, MultiPointToSinglePointIntent> 291 + ConcurrentHashMap<Ip4Prefix, MultiPointToSinglePointIntent>
290 pushedRouteIntents = new ConcurrentHashMap<>(); 292 pushedRouteIntents = new ConcurrentHashMap<>();
291 pushedRouteIntents.put(routeEntry1.prefix(), intent1); 293 pushedRouteIntents.put(routeEntry1.prefix(), intent1);
292 pushedRouteIntents.put(routeEntry3.prefix(), intent3); 294 pushedRouteIntents.put(routeEntry3.prefix(), intent3);
...@@ -355,7 +357,7 @@ public class IntentSyncTest { ...@@ -355,7 +357,7 @@ public class IntentSyncTest {
355 * @param egressPoint to which packets should be sent 357 * @param egressPoint to which packets should be sent
356 * @return the constructed MultiPointToSinglePointIntent 358 * @return the constructed MultiPointToSinglePointIntent
357 */ 359 */
358 - private MultiPointToSinglePointIntent intentBuilder(IpPrefix ipPrefix, 360 + private MultiPointToSinglePointIntent intentBuilder(Ip4Prefix ipPrefix,
359 String nextHopMacAddress, ConnectPoint egressPoint) { 361 String nextHopMacAddress, ConnectPoint egressPoint) {
360 362
361 TrafficSelector.Builder selectorBuilder = 363 TrafficSelector.Builder selectorBuilder =
......
...@@ -20,8 +20,8 @@ import static org.hamcrest.Matchers.not; ...@@ -20,8 +20,8 @@ import static org.hamcrest.Matchers.not;
20 import static org.junit.Assert.assertThat; 20 import static org.junit.Assert.assertThat;
21 21
22 import org.junit.Test; 22 import org.junit.Test;
23 -import org.onlab.packet.IpAddress; 23 +import org.onlab.packet.Ip4Address;
24 -import org.onlab.packet.IpPrefix; 24 +import org.onlab.packet.Ip4Prefix;
25 25
26 /** 26 /**
27 * Unit tests for the RouteEntry class. 27 * Unit tests for the RouteEntry class.
...@@ -32,8 +32,8 @@ public class RouteEntryTest { ...@@ -32,8 +32,8 @@ public class RouteEntryTest {
32 */ 32 */
33 @Test 33 @Test
34 public void testConstructor() { 34 public void testConstructor() {
35 - IpPrefix prefix = IpPrefix.valueOf("1.2.3.0/24"); 35 + Ip4Prefix prefix = Ip4Prefix.valueOf("1.2.3.0/24");
36 - IpAddress nextHop = IpAddress.valueOf("5.6.7.8"); 36 + Ip4Address nextHop = Ip4Address.valueOf("5.6.7.8");
37 37
38 RouteEntry routeEntry = new RouteEntry(prefix, nextHop); 38 RouteEntry routeEntry = new RouteEntry(prefix, nextHop);
39 assertThat(routeEntry.toString(), 39 assertThat(routeEntry.toString(),
...@@ -45,8 +45,8 @@ public class RouteEntryTest { ...@@ -45,8 +45,8 @@ public class RouteEntryTest {
45 */ 45 */
46 @Test(expected = NullPointerException.class) 46 @Test(expected = NullPointerException.class)
47 public void testInvalidConstructorNullPrefix() { 47 public void testInvalidConstructorNullPrefix() {
48 - IpPrefix prefix = null; 48 + Ip4Prefix prefix = null;
49 - IpAddress nextHop = IpAddress.valueOf("5.6.7.8"); 49 + Ip4Address nextHop = Ip4Address.valueOf("5.6.7.8");
50 50
51 new RouteEntry(prefix, nextHop); 51 new RouteEntry(prefix, nextHop);
52 } 52 }
...@@ -56,8 +56,8 @@ public class RouteEntryTest { ...@@ -56,8 +56,8 @@ public class RouteEntryTest {
56 */ 56 */
57 @Test(expected = NullPointerException.class) 57 @Test(expected = NullPointerException.class)
58 public void testInvalidConstructorNullNextHop() { 58 public void testInvalidConstructorNullNextHop() {
59 - IpPrefix prefix = IpPrefix.valueOf("1.2.3.0/24"); 59 + Ip4Prefix prefix = Ip4Prefix.valueOf("1.2.3.0/24");
60 - IpAddress nextHop = null; 60 + Ip4Address nextHop = null;
61 61
62 new RouteEntry(prefix, nextHop); 62 new RouteEntry(prefix, nextHop);
63 } 63 }
...@@ -67,8 +67,8 @@ public class RouteEntryTest { ...@@ -67,8 +67,8 @@ public class RouteEntryTest {
67 */ 67 */
68 @Test 68 @Test
69 public void testGetFields() { 69 public void testGetFields() {
70 - IpPrefix prefix = IpPrefix.valueOf("1.2.3.0/24"); 70 + Ip4Prefix prefix = Ip4Prefix.valueOf("1.2.3.0/24");
71 - IpAddress nextHop = IpAddress.valueOf("5.6.7.8"); 71 + Ip4Address nextHop = Ip4Address.valueOf("5.6.7.8");
72 72
73 RouteEntry routeEntry = new RouteEntry(prefix, nextHop); 73 RouteEntry routeEntry = new RouteEntry(prefix, nextHop);
74 assertThat(routeEntry.prefix(), is(prefix)); 74 assertThat(routeEntry.prefix(), is(prefix));
...@@ -80,28 +80,28 @@ public class RouteEntryTest { ...@@ -80,28 +80,28 @@ public class RouteEntryTest {
80 */ 80 */
81 @Test 81 @Test
82 public void testCreateBinaryString() { 82 public void testCreateBinaryString() {
83 - IpPrefix prefix; 83 + Ip4Prefix prefix;
84 84
85 - prefix = IpPrefix.valueOf("0.0.0.0/0"); 85 + prefix = Ip4Prefix.valueOf("0.0.0.0/0");
86 assertThat(RouteEntry.createBinaryString(prefix), is("")); 86 assertThat(RouteEntry.createBinaryString(prefix), is(""));
87 87
88 - prefix = IpPrefix.valueOf("192.168.166.0/22"); 88 + prefix = Ip4Prefix.valueOf("192.168.166.0/22");
89 assertThat(RouteEntry.createBinaryString(prefix), 89 assertThat(RouteEntry.createBinaryString(prefix),
90 is("1100000010101000101001")); 90 is("1100000010101000101001"));
91 91
92 - prefix = IpPrefix.valueOf("192.168.166.0/23"); 92 + prefix = Ip4Prefix.valueOf("192.168.166.0/23");
93 assertThat(RouteEntry.createBinaryString(prefix), 93 assertThat(RouteEntry.createBinaryString(prefix),
94 is("11000000101010001010011")); 94 is("11000000101010001010011"));
95 95
96 - prefix = IpPrefix.valueOf("192.168.166.0/24"); 96 + prefix = Ip4Prefix.valueOf("192.168.166.0/24");
97 assertThat(RouteEntry.createBinaryString(prefix), 97 assertThat(RouteEntry.createBinaryString(prefix),
98 is("110000001010100010100110")); 98 is("110000001010100010100110"));
99 99
100 - prefix = IpPrefix.valueOf("130.162.10.1/25"); 100 + prefix = Ip4Prefix.valueOf("130.162.10.1/25");
101 assertThat(RouteEntry.createBinaryString(prefix), 101 assertThat(RouteEntry.createBinaryString(prefix),
102 is("1000001010100010000010100")); 102 is("1000001010100010000010100"));
103 103
104 - prefix = IpPrefix.valueOf("255.255.255.255/32"); 104 + prefix = Ip4Prefix.valueOf("255.255.255.255/32");
105 assertThat(RouteEntry.createBinaryString(prefix), 105 assertThat(RouteEntry.createBinaryString(prefix),
106 is("11111111111111111111111111111111")); 106 is("11111111111111111111111111111111"));
107 } 107 }
...@@ -111,12 +111,12 @@ public class RouteEntryTest { ...@@ -111,12 +111,12 @@ public class RouteEntryTest {
111 */ 111 */
112 @Test 112 @Test
113 public void testEquality() { 113 public void testEquality() {
114 - IpPrefix prefix1 = IpPrefix.valueOf("1.2.3.0/24"); 114 + Ip4Prefix prefix1 = Ip4Prefix.valueOf("1.2.3.0/24");
115 - IpAddress nextHop1 = IpAddress.valueOf("5.6.7.8"); 115 + Ip4Address nextHop1 = Ip4Address.valueOf("5.6.7.8");
116 RouteEntry routeEntry1 = new RouteEntry(prefix1, nextHop1); 116 RouteEntry routeEntry1 = new RouteEntry(prefix1, nextHop1);
117 117
118 - IpPrefix prefix2 = IpPrefix.valueOf("1.2.3.0/24"); 118 + Ip4Prefix prefix2 = Ip4Prefix.valueOf("1.2.3.0/24");
119 - IpAddress nextHop2 = IpAddress.valueOf("5.6.7.8"); 119 + Ip4Address nextHop2 = Ip4Address.valueOf("5.6.7.8");
120 RouteEntry routeEntry2 = new RouteEntry(prefix2, nextHop2); 120 RouteEntry routeEntry2 = new RouteEntry(prefix2, nextHop2);
121 121
122 assertThat(routeEntry1, is(routeEntry2)); 122 assertThat(routeEntry1, is(routeEntry2));
...@@ -127,16 +127,16 @@ public class RouteEntryTest { ...@@ -127,16 +127,16 @@ public class RouteEntryTest {
127 */ 127 */
128 @Test 128 @Test
129 public void testNonEquality() { 129 public void testNonEquality() {
130 - IpPrefix prefix1 = IpPrefix.valueOf("1.2.3.0/24"); 130 + Ip4Prefix prefix1 = Ip4Prefix.valueOf("1.2.3.0/24");
131 - IpAddress nextHop1 = IpAddress.valueOf("5.6.7.8"); 131 + Ip4Address nextHop1 = Ip4Address.valueOf("5.6.7.8");
132 RouteEntry routeEntry1 = new RouteEntry(prefix1, nextHop1); 132 RouteEntry routeEntry1 = new RouteEntry(prefix1, nextHop1);
133 133
134 - IpPrefix prefix2 = IpPrefix.valueOf("1.2.3.0/25"); // Different 134 + Ip4Prefix prefix2 = Ip4Prefix.valueOf("1.2.3.0/25"); // Different
135 - IpAddress nextHop2 = IpAddress.valueOf("5.6.7.8"); 135 + Ip4Address nextHop2 = Ip4Address.valueOf("5.6.7.8");
136 RouteEntry routeEntry2 = new RouteEntry(prefix2, nextHop2); 136 RouteEntry routeEntry2 = new RouteEntry(prefix2, nextHop2);
137 137
138 - IpPrefix prefix3 = IpPrefix.valueOf("1.2.3.0/24"); 138 + Ip4Prefix prefix3 = Ip4Prefix.valueOf("1.2.3.0/24");
139 - IpAddress nextHop3 = IpAddress.valueOf("5.6.7.9"); // Different 139 + Ip4Address nextHop3 = Ip4Address.valueOf("5.6.7.9"); // Different
140 RouteEntry routeEntry3 = new RouteEntry(prefix3, nextHop3); 140 RouteEntry routeEntry3 = new RouteEntry(prefix3, nextHop3);
141 141
142 assertThat(routeEntry1, is(not(routeEntry2))); 142 assertThat(routeEntry1, is(not(routeEntry2)));
...@@ -148,8 +148,8 @@ public class RouteEntryTest { ...@@ -148,8 +148,8 @@ public class RouteEntryTest {
148 */ 148 */
149 @Test 149 @Test
150 public void testToString() { 150 public void testToString() {
151 - IpPrefix prefix = IpPrefix.valueOf("1.2.3.0/24"); 151 + Ip4Prefix prefix = Ip4Prefix.valueOf("1.2.3.0/24");
152 - IpAddress nextHop = IpAddress.valueOf("5.6.7.8"); 152 + Ip4Address nextHop = Ip4Address.valueOf("5.6.7.8");
153 RouteEntry routeEntry = new RouteEntry(prefix, nextHop); 153 RouteEntry routeEntry = new RouteEntry(prefix, nextHop);
154 154
155 assertThat(routeEntry.toString(), 155 assertThat(routeEntry.toString(),
......
...@@ -57,7 +57,9 @@ import org.onlab.onos.sdnip.config.Interface; ...@@ -57,7 +57,9 @@ import org.onlab.onos.sdnip.config.Interface;
57 import org.onlab.onos.sdnip.config.SdnIpConfigService; 57 import org.onlab.onos.sdnip.config.SdnIpConfigService;
58 import org.onlab.packet.Ethernet; 58 import org.onlab.packet.Ethernet;
59 import org.onlab.packet.IpAddress; 59 import org.onlab.packet.IpAddress;
60 +import org.onlab.packet.Ip4Address;
60 import org.onlab.packet.IpPrefix; 61 import org.onlab.packet.IpPrefix;
62 +import org.onlab.packet.Ip4Prefix;
61 import org.onlab.packet.MacAddress; 63 import org.onlab.packet.MacAddress;
62 import org.onlab.packet.VlanId; 64 import org.onlab.packet.VlanId;
63 65
...@@ -228,8 +230,8 @@ public class RouterTest { ...@@ -228,8 +230,8 @@ public class RouterTest {
228 public void testProcessRouteAdd() throws TestUtilsException { 230 public void testProcessRouteAdd() throws TestUtilsException {
229 // Construct a route entry 231 // Construct a route entry
230 RouteEntry routeEntry = new RouteEntry( 232 RouteEntry routeEntry = new RouteEntry(
231 - IpPrefix.valueOf("1.1.1.0/24"), 233 + Ip4Prefix.valueOf("1.1.1.0/24"),
232 - IpAddress.valueOf("192.168.10.1")); 234 + Ip4Address.valueOf("192.168.10.1"));
233 235
234 // Construct a MultiPointToSinglePointIntent intent 236 // Construct a MultiPointToSinglePointIntent intent
235 TrafficSelector.Builder selectorBuilder = 237 TrafficSelector.Builder selectorBuilder =
...@@ -281,8 +283,8 @@ public class RouterTest { ...@@ -281,8 +283,8 @@ public class RouterTest {
281 283
282 // Construct the existing route entry 284 // Construct the existing route entry
283 RouteEntry routeEntry = new RouteEntry( 285 RouteEntry routeEntry = new RouteEntry(
284 - IpPrefix.valueOf("1.1.1.0/24"), 286 + Ip4Prefix.valueOf("1.1.1.0/24"),
285 - IpAddress.valueOf("192.168.10.1")); 287 + Ip4Address.valueOf("192.168.10.1"));
286 288
287 // Construct the existing MultiPointToSinglePointIntent intent 289 // Construct the existing MultiPointToSinglePointIntent intent
288 TrafficSelector.Builder selectorBuilder = 290 TrafficSelector.Builder selectorBuilder =
...@@ -305,8 +307,8 @@ public class RouterTest { ...@@ -305,8 +307,8 @@ public class RouterTest {
305 307
306 // Start to construct a new route entry and new intent 308 // Start to construct a new route entry and new intent
307 RouteEntry routeEntryUpdate = new RouteEntry( 309 RouteEntry routeEntryUpdate = new RouteEntry(
308 - IpPrefix.valueOf("1.1.1.0/24"), 310 + Ip4Prefix.valueOf("1.1.1.0/24"),
309 - IpAddress.valueOf("192.168.20.1")); 311 + Ip4Address.valueOf("192.168.20.1"));
310 312
311 // Construct a new MultiPointToSinglePointIntent intent 313 // Construct a new MultiPointToSinglePointIntent intent
312 TrafficSelector.Builder selectorBuilderNew = 314 TrafficSelector.Builder selectorBuilderNew =
...@@ -359,8 +361,8 @@ public class RouterTest { ...@@ -359,8 +361,8 @@ public class RouterTest {
359 361
360 // Construct the existing route entry 362 // Construct the existing route entry
361 RouteEntry routeEntry = new RouteEntry( 363 RouteEntry routeEntry = new RouteEntry(
362 - IpPrefix.valueOf("1.1.1.0/24"), 364 + Ip4Prefix.valueOf("1.1.1.0/24"),
363 - IpAddress.valueOf("192.168.10.1")); 365 + Ip4Address.valueOf("192.168.10.1"));
364 366
365 // Construct the existing MultiPointToSinglePointIntent intent 367 // Construct the existing MultiPointToSinglePointIntent intent
366 TrafficSelector.Builder selectorBuilder = 368 TrafficSelector.Builder selectorBuilder =
...@@ -406,7 +408,8 @@ public class RouterTest { ...@@ -406,7 +408,8 @@ public class RouterTest {
406 public void testLocalRouteAdd() throws TestUtilsException { 408 public void testLocalRouteAdd() throws TestUtilsException {
407 // Construct a route entry, the next hop is the local BGP speaker 409 // Construct a route entry, the next hop is the local BGP speaker
408 RouteEntry routeEntry = new RouteEntry( 410 RouteEntry routeEntry = new RouteEntry(
409 - IpPrefix.valueOf("1.1.1.0/24"), IpAddress.valueOf("0.0.0.0")); 411 + Ip4Prefix.valueOf("1.1.1.0/24"),
412 + Ip4Address.valueOf("0.0.0.0"));
410 413
411 // Reset intentService to check whether the submit method is called 414 // Reset intentService to check whether the submit method is called
412 reset(intentService); 415 reset(intentService);
......
...@@ -58,7 +58,9 @@ import org.onlab.onos.sdnip.config.Interface; ...@@ -58,7 +58,9 @@ import org.onlab.onos.sdnip.config.Interface;
58 import org.onlab.onos.sdnip.config.SdnIpConfigService; 58 import org.onlab.onos.sdnip.config.SdnIpConfigService;
59 import org.onlab.packet.Ethernet; 59 import org.onlab.packet.Ethernet;
60 import org.onlab.packet.IpAddress; 60 import org.onlab.packet.IpAddress;
61 +import org.onlab.packet.Ip4Address;
61 import org.onlab.packet.IpPrefix; 62 import org.onlab.packet.IpPrefix;
63 +import org.onlab.packet.Ip4Prefix;
62 import org.onlab.packet.MacAddress; 64 import org.onlab.packet.MacAddress;
63 import org.onlab.packet.VlanId; 65 import org.onlab.packet.VlanId;
64 66
...@@ -191,8 +193,8 @@ public class RouterTestWithAsyncArp { ...@@ -191,8 +193,8 @@ public class RouterTestWithAsyncArp {
191 193
192 // Construct a route entry 194 // Construct a route entry
193 RouteEntry routeEntry = new RouteEntry( 195 RouteEntry routeEntry = new RouteEntry(
194 - IpPrefix.valueOf("1.1.1.0/24"), 196 + Ip4Prefix.valueOf("1.1.1.0/24"),
195 - IpAddress.valueOf("192.168.10.1")); 197 + Ip4Address.valueOf("192.168.10.1"));
196 198
197 // Construct a route intent 199 // Construct a route intent
198 MultiPointToSinglePointIntent intent = staticIntentBuilder(); 200 MultiPointToSinglePointIntent intent = staticIntentBuilder();
...@@ -243,8 +245,8 @@ public class RouterTestWithAsyncArp { ...@@ -243,8 +245,8 @@ public class RouterTestWithAsyncArp {
243 245
244 // Construct the existing route entry 246 // Construct the existing route entry
245 RouteEntry routeEntry = new RouteEntry( 247 RouteEntry routeEntry = new RouteEntry(
246 - IpPrefix.valueOf("1.1.1.0/24"), 248 + Ip4Prefix.valueOf("1.1.1.0/24"),
247 - IpAddress.valueOf("192.168.10.1")); 249 + Ip4Address.valueOf("192.168.10.1"));
248 250
249 // Construct the existing MultiPointToSinglePointIntent intent 251 // Construct the existing MultiPointToSinglePointIntent intent
250 MultiPointToSinglePointIntent intent = staticIntentBuilder(); 252 MultiPointToSinglePointIntent intent = staticIntentBuilder();
...@@ -256,8 +258,8 @@ public class RouterTestWithAsyncArp { ...@@ -256,8 +258,8 @@ public class RouterTestWithAsyncArp {
256 258
257 // Start to construct a new route entry and new intent 259 // Start to construct a new route entry and new intent
258 RouteEntry routeEntryUpdate = new RouteEntry( 260 RouteEntry routeEntryUpdate = new RouteEntry(
259 - IpPrefix.valueOf("1.1.1.0/24"), 261 + Ip4Prefix.valueOf("1.1.1.0/24"),
260 - IpAddress.valueOf("192.168.20.1")); 262 + Ip4Address.valueOf("192.168.20.1"));
261 263
262 // Construct a new MultiPointToSinglePointIntent intent 264 // Construct a new MultiPointToSinglePointIntent intent
263 TrafficSelector.Builder selectorBuilderNew = 265 TrafficSelector.Builder selectorBuilderNew =
...@@ -323,8 +325,8 @@ public class RouterTestWithAsyncArp { ...@@ -323,8 +325,8 @@ public class RouterTestWithAsyncArp {
323 325
324 // Construct the existing route entry 326 // Construct the existing route entry
325 RouteEntry routeEntry = new RouteEntry( 327 RouteEntry routeEntry = new RouteEntry(
326 - IpPrefix.valueOf("1.1.1.0/24"), 328 + Ip4Prefix.valueOf("1.1.1.0/24"),
327 - IpAddress.valueOf("192.168.10.1")); 329 + Ip4Address.valueOf("192.168.10.1"));
328 330
329 // Construct the existing MultiPointToSinglePointIntent intent 331 // Construct the existing MultiPointToSinglePointIntent intent
330 MultiPointToSinglePointIntent intent = staticIntentBuilder(); 332 MultiPointToSinglePointIntent intent = staticIntentBuilder();
...@@ -401,8 +403,8 @@ public class RouterTestWithAsyncArp { ...@@ -401,8 +403,8 @@ public class RouterTestWithAsyncArp {
401 MultiPointToSinglePointIntent intent) 403 MultiPointToSinglePointIntent intent)
402 throws TestUtilsException { 404 throws TestUtilsException {
403 405
404 - ConcurrentHashMap<IpPrefix, MultiPointToSinglePointIntent> 406 + ConcurrentHashMap<Ip4Prefix, MultiPointToSinglePointIntent>
405 - pushedRouteIntents = new ConcurrentHashMap<>(); 407 + pushedRouteIntents = new ConcurrentHashMap<>();
406 pushedRouteIntents.put(routeEntry.prefix(), intent); 408 pushedRouteIntents.put(routeEntry.prefix(), intent);
407 TestUtils.setField(router, "pushedRouteIntents", pushedRouteIntents); 409 TestUtils.setField(router, "pushedRouteIntents", pushedRouteIntents);
408 } 410 }
......
...@@ -207,7 +207,7 @@ public class SdnIpTest { ...@@ -207,7 +207,7 @@ public class SdnIpTest {
207 reset(intentService); 207 reset(intentService);
208 208
209 for (RouteUpdate update : routeUpdates) { 209 for (RouteUpdate update : routeUpdates) {
210 - IpAddress nextHopAddress = update.routeEntry().nextHop(); 210 + Ip4Address nextHopAddress = update.routeEntry().nextHop();
211 211
212 // Find out the egress ConnectPoint 212 // Find out the egress ConnectPoint
213 ConnectPoint egressConnectPoint = getConnectPoint(nextHopAddress); 213 ConnectPoint egressConnectPoint = getConnectPoint(nextHopAddress);
...@@ -268,7 +268,7 @@ public class SdnIpTest { ...@@ -268,7 +268,7 @@ public class SdnIpTest {
268 reset(intentService); 268 reset(intentService);
269 269
270 for (RouteUpdate update : routeUpdates) { 270 for (RouteUpdate update : routeUpdates) {
271 - IpAddress nextHopAddress = update.routeEntry().nextHop(); 271 + Ip4Address nextHopAddress = update.routeEntry().nextHop();
272 272
273 // Find out the egress ConnectPoint 273 // Find out the egress ConnectPoint
274 ConnectPoint egressConnectPoint = getConnectPoint(nextHopAddress); 274 ConnectPoint egressConnectPoint = getConnectPoint(nextHopAddress);
...@@ -342,11 +342,6 @@ public class SdnIpTest { ...@@ -342,11 +342,6 @@ public class SdnIpTest {
342 prefixLength); 342 prefixLength);
343 // We have to ensure we don't generate the same prefix twice 343 // We have to ensure we don't generate the same prefix twice
344 // (this is quite easy to happen with small prefix lengths). 344 // (this is quite easy to happen with small prefix lengths).
345 - // TODO:
346 - // The IpPrefix does the comparison using 32 bits length,
347 - // but we need to compare only the prefix length. So I use
348 - // Ip4Prefix for this moment and changed to IpPrefix. This
349 - // can be improved in the future.
350 } while (prefixes.contains(prefix)); 345 } while (prefixes.contains(prefix));
351 346
352 prefixes.add(prefix); 347 prefixes.add(prefix);
...@@ -366,9 +361,9 @@ public class SdnIpTest { ...@@ -366,9 +361,9 @@ public class SdnIpTest {
366 assertNotNull(nextHop); 361 assertNotNull(nextHop);
367 362
368 RouteUpdate update = 363 RouteUpdate update =
369 - new RouteUpdate(RouteUpdate.Type.UPDATE, 364 + new RouteUpdate(RouteUpdate.Type.UPDATE,
370 - new RouteEntry(prefix, 365 + new RouteEntry(prefix,
371 - nextHop.ipAddress())); 366 + nextHop.ipAddress().getIp4Address()));
372 367
373 routeUpdates.add(update); 368 routeUpdates.add(update);
374 } 369 }
......
...@@ -26,30 +26,30 @@ import java.util.ArrayList; ...@@ -26,30 +26,30 @@ import java.util.ArrayList;
26 26
27 import org.junit.Before; 27 import org.junit.Before;
28 import org.junit.Test; 28 import org.junit.Test;
29 -import org.onlab.packet.IpAddress; 29 +import org.onlab.packet.Ip4Address;
30 -import org.onlab.packet.IpPrefix; 30 +import org.onlab.packet.Ip4Prefix;
31 31
32 /** 32 /**
33 * Unit tests for the BgpRouteEntry class. 33 * Unit tests for the BgpRouteEntry class.
34 */ 34 */
35 public class BgpRouteEntryTest { 35 public class BgpRouteEntryTest {
36 private BgpSession bgpSession; 36 private BgpSession bgpSession;
37 - private static final IpAddress BGP_SESSION_BGP_ID = 37 + private static final Ip4Address BGP_SESSION_BGP_ID =
38 - IpAddress.valueOf("10.0.0.1"); 38 + Ip4Address.valueOf("10.0.0.1");
39 - private static final IpAddress BGP_SESSION_IP_ADDRESS = 39 + private static final Ip4Address BGP_SESSION_IP_ADDRESS =
40 - IpAddress.valueOf("20.0.0.1"); 40 + Ip4Address.valueOf("20.0.0.1");
41 41
42 private BgpSession bgpSession2; 42 private BgpSession bgpSession2;
43 - private static final IpAddress BGP_SESSION_BGP_ID2 = 43 + private static final Ip4Address BGP_SESSION_BGP_ID2 =
44 - IpAddress.valueOf("10.0.0.2"); 44 + Ip4Address.valueOf("10.0.0.2");
45 - private static final IpAddress BGP_SESSION_IP_ADDRESS2 = 45 + private static final Ip4Address BGP_SESSION_IP_ADDRESS2 =
46 - IpAddress.valueOf("20.0.0.1"); 46 + Ip4Address.valueOf("20.0.0.1");
47 47
48 private BgpSession bgpSession3; 48 private BgpSession bgpSession3;
49 - private static final IpAddress BGP_SESSION_BGP_ID3 = 49 + private static final Ip4Address BGP_SESSION_BGP_ID3 =
50 - IpAddress.valueOf("10.0.0.1"); 50 + Ip4Address.valueOf("10.0.0.1");
51 - private static final IpAddress BGP_SESSION_IP_ADDRESS3 = 51 + private static final Ip4Address BGP_SESSION_IP_ADDRESS3 =
52 - IpAddress.valueOf("20.0.0.2"); 52 + Ip4Address.valueOf("20.0.0.2");
53 53
54 @Before 54 @Before
55 public void setUp() throws Exception { 55 public void setUp() throws Exception {
...@@ -85,8 +85,8 @@ public class BgpRouteEntryTest { ...@@ -85,8 +85,8 @@ public class BgpRouteEntryTest {
85 * @return a generated BGP Route Entry 85 * @return a generated BGP Route Entry
86 */ 86 */
87 private BgpRouteEntry generateBgpRouteEntry() { 87 private BgpRouteEntry generateBgpRouteEntry() {
88 - IpPrefix prefix = IpPrefix.valueOf("1.2.3.0/24"); 88 + Ip4Prefix prefix = Ip4Prefix.valueOf("1.2.3.0/24");
89 - IpAddress nextHop = IpAddress.valueOf("5.6.7.8"); 89 + Ip4Address nextHop = Ip4Address.valueOf("5.6.7.8");
90 byte origin = BgpConstants.Update.Origin.IGP; 90 byte origin = BgpConstants.Update.Origin.IGP;
91 // Setup the AS Path 91 // Setup the AS Path
92 ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>(); 92 ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>();
...@@ -143,8 +143,8 @@ public class BgpRouteEntryTest { ...@@ -143,8 +143,8 @@ public class BgpRouteEntryTest {
143 @Test(expected = NullPointerException.class) 143 @Test(expected = NullPointerException.class)
144 public void testInvalidConstructorNullBgpSession() { 144 public void testInvalidConstructorNullBgpSession() {
145 BgpSession bgpSessionNull = null; 145 BgpSession bgpSessionNull = null;
146 - IpPrefix prefix = IpPrefix.valueOf("1.2.3.0/24"); 146 + Ip4Prefix prefix = Ip4Prefix.valueOf("1.2.3.0/24");
147 - IpAddress nextHop = IpAddress.valueOf("5.6.7.8"); 147 + Ip4Address nextHop = Ip4Address.valueOf("5.6.7.8");
148 byte origin = BgpConstants.Update.Origin.IGP; 148 byte origin = BgpConstants.Update.Origin.IGP;
149 // Setup the AS Path 149 // Setup the AS Path
150 ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>(); 150 ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>();
...@@ -161,8 +161,8 @@ public class BgpRouteEntryTest { ...@@ -161,8 +161,8 @@ public class BgpRouteEntryTest {
161 */ 161 */
162 @Test(expected = NullPointerException.class) 162 @Test(expected = NullPointerException.class)
163 public void testInvalidConstructorNullAsPath() { 163 public void testInvalidConstructorNullAsPath() {
164 - IpPrefix prefix = IpPrefix.valueOf("1.2.3.0/24"); 164 + Ip4Prefix prefix = Ip4Prefix.valueOf("1.2.3.0/24");
165 - IpAddress nextHop = IpAddress.valueOf("5.6.7.8"); 165 + Ip4Address nextHop = Ip4Address.valueOf("5.6.7.8");
166 byte origin = BgpConstants.Update.Origin.IGP; 166 byte origin = BgpConstants.Update.Origin.IGP;
167 BgpRouteEntry.AsPath asPath = null; 167 BgpRouteEntry.AsPath asPath = null;
168 long localPref = 100; 168 long localPref = 100;
...@@ -177,8 +177,8 @@ public class BgpRouteEntryTest { ...@@ -177,8 +177,8 @@ public class BgpRouteEntryTest {
177 @Test 177 @Test
178 public void testGetFields() { 178 public void testGetFields() {
179 // Create the fields to compare against 179 // Create the fields to compare against
180 - IpPrefix prefix = IpPrefix.valueOf("1.2.3.0/24"); 180 + Ip4Prefix prefix = Ip4Prefix.valueOf("1.2.3.0/24");
181 - IpAddress nextHop = IpAddress.valueOf("5.6.7.8"); 181 + Ip4Address nextHop = Ip4Address.valueOf("5.6.7.8");
182 byte origin = BgpConstants.Update.Origin.IGP; 182 byte origin = BgpConstants.Update.Origin.IGP;
183 // Setup the AS Path 183 // Setup the AS Path
184 ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>(); 184 ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>();
...@@ -231,8 +231,8 @@ public class BgpRouteEntryTest { ...@@ -231,8 +231,8 @@ public class BgpRouteEntryTest {
231 // 231 //
232 // Test local route with AS Path that begins with AS_SET 232 // Test local route with AS Path that begins with AS_SET
233 // 233 //
234 - IpPrefix prefix = IpPrefix.valueOf("1.2.3.0/24"); 234 + Ip4Prefix prefix = Ip4Prefix.valueOf("1.2.3.0/24");
235 - IpAddress nextHop = IpAddress.valueOf("5.6.7.8"); 235 + Ip4Address nextHop = Ip4Address.valueOf("5.6.7.8");
236 byte origin = BgpConstants.Update.Origin.IGP; 236 byte origin = BgpConstants.Update.Origin.IGP;
237 // Setup the AS Path 237 // Setup the AS Path
238 ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>(); 238 ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>();
...@@ -291,8 +291,8 @@ public class BgpRouteEntryTest { ...@@ -291,8 +291,8 @@ public class BgpRouteEntryTest {
291 // 291 //
292 // Get neighbor AS for a local route 292 // Get neighbor AS for a local route
293 // 293 //
294 - IpPrefix prefix = IpPrefix.valueOf("1.2.3.0/24"); 294 + Ip4Prefix prefix = Ip4Prefix.valueOf("1.2.3.0/24");
295 - IpAddress nextHop = IpAddress.valueOf("5.6.7.8"); 295 + Ip4Address nextHop = Ip4Address.valueOf("5.6.7.8");
296 byte origin = BgpConstants.Update.Origin.IGP; 296 byte origin = BgpConstants.Update.Origin.IGP;
297 // Setup the AS Path 297 // Setup the AS Path
298 ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>(); 298 ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>();
...@@ -341,8 +341,8 @@ public class BgpRouteEntryTest { ...@@ -341,8 +341,8 @@ public class BgpRouteEntryTest {
341 // 341 //
342 // Compare two routes with different LOCAL_PREF 342 // Compare two routes with different LOCAL_PREF
343 // 343 //
344 - IpPrefix prefix = IpPrefix.valueOf("1.2.3.0/24"); 344 + Ip4Prefix prefix = Ip4Prefix.valueOf("1.2.3.0/24");
345 - IpAddress nextHop = IpAddress.valueOf("5.6.7.8"); 345 + Ip4Address nextHop = Ip4Address.valueOf("5.6.7.8");
346 byte origin = BgpConstants.Update.Origin.IGP; 346 byte origin = BgpConstants.Update.Origin.IGP;
347 // Setup the AS Path 347 // Setup the AS Path
348 ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>(); 348 ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>();
...@@ -460,8 +460,8 @@ public class BgpRouteEntryTest { ...@@ -460,8 +460,8 @@ public class BgpRouteEntryTest {
460 BgpRouteEntry bgpRouteEntry1 = generateBgpRouteEntry(); 460 BgpRouteEntry bgpRouteEntry1 = generateBgpRouteEntry();
461 461
462 // Setup BGP Route 2 462 // Setup BGP Route 2
463 - IpPrefix prefix = IpPrefix.valueOf("1.2.3.0/24"); 463 + Ip4Prefix prefix = Ip4Prefix.valueOf("1.2.3.0/24");
464 - IpAddress nextHop = IpAddress.valueOf("5.6.7.8"); 464 + Ip4Address nextHop = Ip4Address.valueOf("5.6.7.8");
465 byte origin = BgpConstants.Update.Origin.IGP; 465 byte origin = BgpConstants.Update.Origin.IGP;
466 // Setup the AS Path 466 // Setup the AS Path
467 ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>(); 467 ArrayList<BgpRouteEntry.PathSegment> pathSegments = new ArrayList<>();
......
...@@ -45,8 +45,8 @@ import org.onlab.junit.TestUtils; ...@@ -45,8 +45,8 @@ import org.onlab.junit.TestUtils;
45 import org.onlab.junit.TestUtils.TestUtilsException; 45 import org.onlab.junit.TestUtils.TestUtilsException;
46 import org.onlab.onos.sdnip.RouteListener; 46 import org.onlab.onos.sdnip.RouteListener;
47 import org.onlab.onos.sdnip.RouteUpdate; 47 import org.onlab.onos.sdnip.RouteUpdate;
48 -import org.onlab.packet.IpAddress; 48 +import org.onlab.packet.Ip4Address;
49 -import org.onlab.packet.IpPrefix; 49 +import org.onlab.packet.Ip4Prefix;
50 50
51 import com.google.common.net.InetAddresses; 51 import com.google.common.net.InetAddresses;
52 52
...@@ -54,9 +54,10 @@ import com.google.common.net.InetAddresses; ...@@ -54,9 +54,10 @@ import com.google.common.net.InetAddresses;
54 * Unit tests for the BgpSessionManager class. 54 * Unit tests for the BgpSessionManager class.
55 */ 55 */
56 public class BgpSessionManagerTest { 56 public class BgpSessionManagerTest {
57 - private static final IpAddress IP_LOOPBACK_ID = 57 + private static final Ip4Address IP_LOOPBACK_ID =
58 - IpAddress.valueOf("127.0.0.1"); 58 + Ip4Address.valueOf("127.0.0.1");
59 - private static final IpAddress BGP_PEER1_ID = IpAddress.valueOf("10.0.0.1"); 59 + private static final Ip4Address BGP_PEER1_ID =
60 + Ip4Address.valueOf("10.0.0.1");
60 private static final long DEFAULT_LOCAL_PREF = 10; 61 private static final long DEFAULT_LOCAL_PREF = 10;
61 private static final long DEFAULT_MULTI_EXIT_DISC = 20; 62 private static final long DEFAULT_MULTI_EXIT_DISC = 20;
62 63
...@@ -245,7 +246,7 @@ public class BgpSessionManagerTest { ...@@ -245,7 +246,7 @@ public class BgpSessionManagerTest {
245 @Test 246 @Test
246 public void testProcessedBgpUpdateMessages() throws InterruptedException { 247 public void testProcessedBgpUpdateMessages() throws InterruptedException {
247 BgpSession bgpSession; 248 BgpSession bgpSession;
248 - IpAddress nextHopRouter; 249 + Ip4Address nextHopRouter;
249 BgpRouteEntry bgpRouteEntry; 250 BgpRouteEntry bgpRouteEntry;
250 ChannelBuffer message; 251 ChannelBuffer message;
251 Collection<BgpRouteEntry> bgpRibIn; 252 Collection<BgpRouteEntry> bgpRibIn;
...@@ -265,18 +266,18 @@ public class BgpSessionManagerTest { ...@@ -265,18 +266,18 @@ public class BgpSessionManagerTest {
265 bgpSession = bgpSessionManager.getBgpSessions().iterator().next(); 266 bgpSession = bgpSessionManager.getBgpSessions().iterator().next();
266 267
267 // Prepare routes to add/delete 268 // Prepare routes to add/delete
268 - nextHopRouter = IpAddress.valueOf("10.20.30.40"); 269 + nextHopRouter = Ip4Address.valueOf("10.20.30.40");
269 - Collection<IpPrefix> addedRoutes = new LinkedList<>(); 270 + Collection<Ip4Prefix> addedRoutes = new LinkedList<>();
270 - Collection<IpPrefix> withdrawnRoutes = new LinkedList<>(); 271 + Collection<Ip4Prefix> withdrawnRoutes = new LinkedList<>();
271 - addedRoutes.add(IpPrefix.valueOf("0.0.0.0/0")); 272 + addedRoutes.add(Ip4Prefix.valueOf("0.0.0.0/0"));
272 - addedRoutes.add(IpPrefix.valueOf("20.0.0.0/8")); 273 + addedRoutes.add(Ip4Prefix.valueOf("20.0.0.0/8"));
273 - addedRoutes.add(IpPrefix.valueOf("30.0.0.0/16")); 274 + addedRoutes.add(Ip4Prefix.valueOf("30.0.0.0/16"));
274 - addedRoutes.add(IpPrefix.valueOf("40.0.0.0/24")); 275 + addedRoutes.add(Ip4Prefix.valueOf("40.0.0.0/24"));
275 - addedRoutes.add(IpPrefix.valueOf("50.0.0.0/32")); 276 + addedRoutes.add(Ip4Prefix.valueOf("50.0.0.0/32"));
276 - withdrawnRoutes.add(IpPrefix.valueOf("60.0.0.0/8")); 277 + withdrawnRoutes.add(Ip4Prefix.valueOf("60.0.0.0/8"));
277 - withdrawnRoutes.add(IpPrefix.valueOf("70.0.0.0/16")); 278 + withdrawnRoutes.add(Ip4Prefix.valueOf("70.0.0.0/16"));
278 - withdrawnRoutes.add(IpPrefix.valueOf("80.0.0.0/24")); 279 + withdrawnRoutes.add(Ip4Prefix.valueOf("80.0.0.0/24"));
279 - withdrawnRoutes.add(IpPrefix.valueOf("90.0.0.0/32")); 280 + withdrawnRoutes.add(Ip4Prefix.valueOf("90.0.0.0/32"));
280 // Write the routes 281 // Write the routes
281 message = peerChannelHandler.prepareBgpUpdate(nextHopRouter, 282 message = peerChannelHandler.prepareBgpUpdate(nextHopRouter,
282 addedRoutes, 283 addedRoutes,
...@@ -314,7 +315,7 @@ public class BgpSessionManagerTest { ...@@ -314,7 +315,7 @@ public class BgpSessionManagerTest {
314 // 315 //
315 bgpRouteEntry = 316 bgpRouteEntry =
316 new BgpRouteEntry(bgpSession, 317 new BgpRouteEntry(bgpSession,
317 - IpPrefix.valueOf("0.0.0.0/0"), 318 + Ip4Prefix.valueOf("0.0.0.0/0"),
318 nextHopRouter, 319 nextHopRouter,
319 (byte) BgpConstants.Update.Origin.IGP, 320 (byte) BgpConstants.Update.Origin.IGP,
320 asPath, 321 asPath,
...@@ -324,7 +325,7 @@ public class BgpSessionManagerTest { ...@@ -324,7 +325,7 @@ public class BgpSessionManagerTest {
324 // 325 //
325 bgpRouteEntry = 326 bgpRouteEntry =
326 new BgpRouteEntry(bgpSession, 327 new BgpRouteEntry(bgpSession,
327 - IpPrefix.valueOf("20.0.0.0/8"), 328 + Ip4Prefix.valueOf("20.0.0.0/8"),
328 nextHopRouter, 329 nextHopRouter,
329 (byte) BgpConstants.Update.Origin.IGP, 330 (byte) BgpConstants.Update.Origin.IGP,
330 asPath, 331 asPath,
...@@ -334,7 +335,7 @@ public class BgpSessionManagerTest { ...@@ -334,7 +335,7 @@ public class BgpSessionManagerTest {
334 // 335 //
335 bgpRouteEntry = 336 bgpRouteEntry =
336 new BgpRouteEntry(bgpSession, 337 new BgpRouteEntry(bgpSession,
337 - IpPrefix.valueOf("30.0.0.0/16"), 338 + Ip4Prefix.valueOf("30.0.0.0/16"),
338 nextHopRouter, 339 nextHopRouter,
339 (byte) BgpConstants.Update.Origin.IGP, 340 (byte) BgpConstants.Update.Origin.IGP,
340 asPath, 341 asPath,
...@@ -344,7 +345,7 @@ public class BgpSessionManagerTest { ...@@ -344,7 +345,7 @@ public class BgpSessionManagerTest {
344 // 345 //
345 bgpRouteEntry = 346 bgpRouteEntry =
346 new BgpRouteEntry(bgpSession, 347 new BgpRouteEntry(bgpSession,
347 - IpPrefix.valueOf("40.0.0.0/24"), 348 + Ip4Prefix.valueOf("40.0.0.0/24"),
348 nextHopRouter, 349 nextHopRouter,
349 (byte) BgpConstants.Update.Origin.IGP, 350 (byte) BgpConstants.Update.Origin.IGP,
350 asPath, 351 asPath,
...@@ -354,7 +355,7 @@ public class BgpSessionManagerTest { ...@@ -354,7 +355,7 @@ public class BgpSessionManagerTest {
354 // 355 //
355 bgpRouteEntry = 356 bgpRouteEntry =
356 new BgpRouteEntry(bgpSession, 357 new BgpRouteEntry(bgpSession,
357 - IpPrefix.valueOf("50.0.0.0/32"), 358 + Ip4Prefix.valueOf("50.0.0.0/32"),
358 nextHopRouter, 359 nextHopRouter,
359 (byte) BgpConstants.Update.Origin.IGP, 360 (byte) BgpConstants.Update.Origin.IGP,
360 asPath, 361 asPath,
...@@ -365,8 +366,8 @@ public class BgpSessionManagerTest { ...@@ -365,8 +366,8 @@ public class BgpSessionManagerTest {
365 // Delete some routes 366 // Delete some routes
366 addedRoutes = new LinkedList<>(); 367 addedRoutes = new LinkedList<>();
367 withdrawnRoutes = new LinkedList<>(); 368 withdrawnRoutes = new LinkedList<>();
368 - withdrawnRoutes.add(IpPrefix.valueOf("0.0.0.0/0")); 369 + withdrawnRoutes.add(Ip4Prefix.valueOf("0.0.0.0/0"));
369 - withdrawnRoutes.add(IpPrefix.valueOf("50.0.0.0/32")); 370 + withdrawnRoutes.add(Ip4Prefix.valueOf("50.0.0.0/32"));
370 371
371 // Write the routes 372 // Write the routes
372 message = peerChannelHandler.prepareBgpUpdate(nextHopRouter, 373 message = peerChannelHandler.prepareBgpUpdate(nextHopRouter,
...@@ -382,7 +383,7 @@ public class BgpSessionManagerTest { ...@@ -382,7 +383,7 @@ public class BgpSessionManagerTest {
382 // 383 //
383 bgpRouteEntry = 384 bgpRouteEntry =
384 new BgpRouteEntry(bgpSession, 385 new BgpRouteEntry(bgpSession,
385 - IpPrefix.valueOf("20.0.0.0/8"), 386 + Ip4Prefix.valueOf("20.0.0.0/8"),
386 nextHopRouter, 387 nextHopRouter,
387 (byte) BgpConstants.Update.Origin.IGP, 388 (byte) BgpConstants.Update.Origin.IGP,
388 asPath, 389 asPath,
...@@ -392,7 +393,7 @@ public class BgpSessionManagerTest { ...@@ -392,7 +393,7 @@ public class BgpSessionManagerTest {
392 // 393 //
393 bgpRouteEntry = 394 bgpRouteEntry =
394 new BgpRouteEntry(bgpSession, 395 new BgpRouteEntry(bgpSession,
395 - IpPrefix.valueOf("30.0.0.0/16"), 396 + Ip4Prefix.valueOf("30.0.0.0/16"),
396 nextHopRouter, 397 nextHopRouter,
397 (byte) BgpConstants.Update.Origin.IGP, 398 (byte) BgpConstants.Update.Origin.IGP,
398 asPath, 399 asPath,
...@@ -402,7 +403,7 @@ public class BgpSessionManagerTest { ...@@ -402,7 +403,7 @@ public class BgpSessionManagerTest {
402 // 403 //
403 bgpRouteEntry = 404 bgpRouteEntry =
404 new BgpRouteEntry(bgpSession, 405 new BgpRouteEntry(bgpSession,
405 - IpPrefix.valueOf("40.0.0.0/24"), 406 + Ip4Prefix.valueOf("40.0.0.0/24"),
406 nextHopRouter, 407 nextHopRouter,
407 (byte) BgpConstants.Update.Origin.IGP, 408 (byte) BgpConstants.Update.Origin.IGP,
408 asPath, 409 asPath,
......
...@@ -22,8 +22,8 @@ import org.jboss.netty.buffer.ChannelBuffers; ...@@ -22,8 +22,8 @@ import org.jboss.netty.buffer.ChannelBuffers;
22 import org.jboss.netty.channel.ChannelHandlerContext; 22 import org.jboss.netty.channel.ChannelHandlerContext;
23 import org.jboss.netty.channel.ChannelStateEvent; 23 import org.jboss.netty.channel.ChannelStateEvent;
24 import org.jboss.netty.channel.SimpleChannelHandler; 24 import org.jboss.netty.channel.SimpleChannelHandler;
25 -import org.onlab.packet.IpAddress; 25 +import org.onlab.packet.Ip4Address;
26 -import org.onlab.packet.IpPrefix; 26 +import org.onlab.packet.Ip4Prefix;
27 27
28 /** 28 /**
29 * Class for handling the remote BGP Peer session. 29 * Class for handling the remote BGP Peer session.
...@@ -31,7 +31,7 @@ import org.onlab.packet.IpPrefix; ...@@ -31,7 +31,7 @@ import org.onlab.packet.IpPrefix;
31 class TestBgpPeerChannelHandler extends SimpleChannelHandler { 31 class TestBgpPeerChannelHandler extends SimpleChannelHandler {
32 static final long PEER_AS = 65001; 32 static final long PEER_AS = 65001;
33 static final int PEER_HOLDTIME = 120; // 120 seconds 33 static final int PEER_HOLDTIME = 120; // 120 seconds
34 - final IpAddress bgpId; // The BGP ID 34 + final Ip4Address bgpId; // The BGP ID
35 final long localPref; // Local preference for routes 35 final long localPref; // Local preference for routes
36 final long multiExitDisc = 20; // MED value 36 final long multiExitDisc = 20; // MED value
37 37
...@@ -43,8 +43,7 @@ class TestBgpPeerChannelHandler extends SimpleChannelHandler { ...@@ -43,8 +43,7 @@ class TestBgpPeerChannelHandler extends SimpleChannelHandler {
43 * @param bgpId the BGP ID to use 43 * @param bgpId the BGP ID to use
44 * @param localPref the local preference for the routes to use 44 * @param localPref the local preference for the routes to use
45 */ 45 */
46 - TestBgpPeerChannelHandler(IpAddress bgpId, 46 + TestBgpPeerChannelHandler(Ip4Address bgpId, long localPref) {
47 - long localPref) {
48 this.bgpId = bgpId; 47 this.bgpId = bgpId;
49 this.localPref = localPref; 48 this.localPref = localPref;
50 } 49 }
...@@ -99,9 +98,9 @@ class TestBgpPeerChannelHandler extends SimpleChannelHandler { ...@@ -99,9 +98,9 @@ class TestBgpPeerChannelHandler extends SimpleChannelHandler {
99 * @param withdrawnRoutes the routes to withdraw 98 * @param withdrawnRoutes the routes to withdraw
100 * @return the message to transmit (BGP header included) 99 * @return the message to transmit (BGP header included)
101 */ 100 */
102 - ChannelBuffer prepareBgpUpdate(IpAddress nextHopRouter, 101 + ChannelBuffer prepareBgpUpdate(Ip4Address nextHopRouter,
103 - Collection<IpPrefix> addedRoutes, 102 + Collection<Ip4Prefix> addedRoutes,
104 - Collection<IpPrefix> withdrawnRoutes) { 103 + Collection<Ip4Prefix> withdrawnRoutes) {
105 int attrFlags; 104 int attrFlags;
106 ChannelBuffer message = 105 ChannelBuffer message =
107 ChannelBuffers.buffer(BgpConstants.BGP_MESSAGE_MAX_LENGTH); 106 ChannelBuffers.buffer(BgpConstants.BGP_MESSAGE_MAX_LENGTH);
...@@ -178,24 +177,24 @@ class TestBgpPeerChannelHandler extends SimpleChannelHandler { ...@@ -178,24 +177,24 @@ class TestBgpPeerChannelHandler extends SimpleChannelHandler {
178 * @param prefixes the prefixes to encode 177 * @param prefixes the prefixes to encode
179 * @return the buffer with the encoded prefixes 178 * @return the buffer with the encoded prefixes
180 */ 179 */
181 - private ChannelBuffer encodePackedPrefixes(Collection<IpPrefix> prefixes) { 180 + private ChannelBuffer encodePackedPrefixes(Collection<Ip4Prefix> prefixes) {
182 ChannelBuffer message = 181 ChannelBuffer message =
183 ChannelBuffers.buffer(BgpConstants.BGP_MESSAGE_MAX_LENGTH); 182 ChannelBuffers.buffer(BgpConstants.BGP_MESSAGE_MAX_LENGTH);
184 183
185 // Write each of the prefixes 184 // Write each of the prefixes
186 - for (IpPrefix prefix : prefixes) { 185 + for (Ip4Prefix prefix : prefixes) {
187 int prefixBitlen = prefix.prefixLength(); 186 int prefixBitlen = prefix.prefixLength();
188 int prefixBytelen = (prefixBitlen + 7) / 8; // Round-up 187 int prefixBytelen = (prefixBitlen + 7) / 8; // Round-up
189 message.writeByte(prefixBitlen); 188 message.writeByte(prefixBitlen);
190 189
191 - IpAddress address = prefix.address(); 190 + Ip4Address address = prefix.address();
192 long value = address.toInt() & 0xffffffffL; 191 long value = address.toInt() & 0xffffffffL;
193 - for (int i = 0; i < IpAddress.INET_BYTE_LENGTH; i++) { 192 + for (int i = 0; i < Ip4Address.BYTE_LENGTH; i++) {
194 if (prefixBytelen-- == 0) { 193 if (prefixBytelen-- == 0) {
195 break; 194 break;
196 } 195 }
197 long nextByte = 196 long nextByte =
198 - (value >> ((IpAddress.INET_BYTE_LENGTH - i - 1) * 8)) & 0xff; 197 + (value >> ((Ip4Address.BYTE_LENGTH - i - 1) * 8)) & 0xff;
199 message.writeByte((int) nextByte); 198 message.writeByte((int) nextByte);
200 } 199 }
201 } 200 }
......
...@@ -21,7 +21,7 @@ import org.jboss.netty.buffer.ChannelBuffer; ...@@ -21,7 +21,7 @@ import org.jboss.netty.buffer.ChannelBuffer;
21 import org.jboss.netty.channel.Channel; 21 import org.jboss.netty.channel.Channel;
22 import org.jboss.netty.channel.ChannelHandlerContext; 22 import org.jboss.netty.channel.ChannelHandlerContext;
23 import org.jboss.netty.handler.codec.frame.FrameDecoder; 23 import org.jboss.netty.handler.codec.frame.FrameDecoder;
24 -import org.onlab.packet.IpAddress; 24 +import org.onlab.packet.Ip4Address;
25 25
26 /** 26 /**
27 * Class for handling the decoding of the BGP messages at the remote 27 * Class for handling the decoding of the BGP messages at the remote
...@@ -31,7 +31,7 @@ class TestBgpPeerFrameDecoder extends FrameDecoder { ...@@ -31,7 +31,7 @@ class TestBgpPeerFrameDecoder extends FrameDecoder {
31 int remoteBgpVersion; // 1 octet 31 int remoteBgpVersion; // 1 octet
32 long remoteAs; // 2 octets 32 long remoteAs; // 2 octets
33 long remoteHoldtime; // 2 octets 33 long remoteHoldtime; // 2 octets
34 - IpAddress remoteBgpIdentifier; // 4 octets -> IPv4 address 34 + Ip4Address remoteBgpIdentifier; // 4 octets -> IPv4 address
35 35
36 final CountDownLatch receivedOpenMessageLatch = new CountDownLatch(1); 36 final CountDownLatch receivedOpenMessageLatch = new CountDownLatch(1);
37 final CountDownLatch receivedKeepaliveMessageLatch = new CountDownLatch(1); 37 final CountDownLatch receivedKeepaliveMessageLatch = new CountDownLatch(1);
...@@ -144,7 +144,8 @@ class TestBgpPeerFrameDecoder extends FrameDecoder { ...@@ -144,7 +144,8 @@ class TestBgpPeerFrameDecoder extends FrameDecoder {
144 remoteBgpVersion = message.readUnsignedByte(); 144 remoteBgpVersion = message.readUnsignedByte();
145 remoteAs = message.readUnsignedShort(); 145 remoteAs = message.readUnsignedShort();
146 remoteHoldtime = message.readUnsignedShort(); 146 remoteHoldtime = message.readUnsignedShort();
147 - remoteBgpIdentifier = IpAddress.valueOf((int) message.readUnsignedInt()); 147 + remoteBgpIdentifier =
148 + Ip4Address.valueOf((int) message.readUnsignedInt());
148 // Optional Parameters 149 // Optional Parameters
149 int optParamLen = message.readUnsignedByte(); 150 int optParamLen = message.readUnsignedByte();
150 if (message.readableBytes() < optParamLen) { 151 if (message.readableBytes() < optParamLen) {
......