Thomas Vachuska

Merge remote-tracking branch 'origin/master'

Showing 29 changed files with 109 additions and 121 deletions
...@@ -520,8 +520,7 @@ public class Router implements RouteListener { ...@@ -520,8 +520,7 @@ public class Router implements RouteListener {
520 520
521 // See if we know the MAC address of the next hop 521 // See if we know the MAC address of the next hop
522 MacAddress nextHopMacAddress = null; 522 MacAddress nextHopMacAddress = null;
523 - Set<Host> hosts = hostService.getHostsByIp( 523 + Set<Host> hosts = hostService.getHostsByIp(routeEntry.nextHop());
524 - routeEntry.nextHop().toPrefix());
525 if (!hosts.isEmpty()) { 524 if (!hosts.isEmpty()) {
526 // TODO how to handle if multiple hosts are returned? 525 // TODO how to handle if multiple hosts are returned?
527 nextHopMacAddress = hosts.iterator().next().mac(); 526 nextHopMacAddress = hosts.iterator().next().mac();
...@@ -773,8 +772,8 @@ public class Router implements RouteListener { ...@@ -773,8 +772,8 @@ public class Router implements RouteListener {
773 if (event.type() == HostEvent.Type.HOST_ADDED || 772 if (event.type() == HostEvent.Type.HOST_ADDED ||
774 event.type() == HostEvent.Type.HOST_UPDATED) { 773 event.type() == HostEvent.Type.HOST_UPDATED) {
775 Host host = event.subject(); 774 Host host = event.subject();
776 - for (IpPrefix ip : host.ipAddresses()) { 775 + for (IpAddress ip : host.ipAddresses()) {
777 - updateMac(ip.toIpAddress(), host.mac()); 776 + updateMac(ip, host.mac());
778 } 777 }
779 } 778 }
780 } 779 }
......
...@@ -197,27 +197,27 @@ public class RouterTest { ...@@ -197,27 +197,27 @@ public class RouterTest {
197 hostService.addListener(anyObject(HostListener.class)); 197 hostService.addListener(anyObject(HostListener.class));
198 expectLastCall().anyTimes(); 198 expectLastCall().anyTimes();
199 199
200 - IpPrefix host1Address = IpPrefix.valueOf("192.168.10.1/32"); 200 + IpAddress host1Address = IpAddress.valueOf("192.168.10.1");
201 Host host1 = new DefaultHost(ProviderId.NONE, HostId.NONE, 201 Host host1 = new DefaultHost(ProviderId.NONE, HostId.NONE,
202 MacAddress.valueOf("00:00:00:00:00:01"), VlanId.NONE, 202 MacAddress.valueOf("00:00:00:00:00:01"), VlanId.NONE,
203 new HostLocation(SW1_ETH1, 1), 203 new HostLocation(SW1_ETH1, 1),
204 - Sets.newHashSet(host1Address)); 204 + Sets.newHashSet(host1Address));
205 205
206 expect(hostService.getHostsByIp(host1Address)) 206 expect(hostService.getHostsByIp(host1Address))
207 .andReturn(Sets.newHashSet(host1)).anyTimes(); 207 .andReturn(Sets.newHashSet(host1)).anyTimes();
208 - hostService.startMonitoringIp(host1Address.toIpAddress()); 208 + hostService.startMonitoringIp(host1Address);
209 expectLastCall().anyTimes(); 209 expectLastCall().anyTimes();
210 210
211 211
212 - IpPrefix host2Address = IpPrefix.valueOf("192.168.20.1/32"); 212 + IpAddress host2Address = IpAddress.valueOf("192.168.20.1");
213 Host host2 = new DefaultHost(ProviderId.NONE, HostId.NONE, 213 Host host2 = new DefaultHost(ProviderId.NONE, HostId.NONE,
214 MacAddress.valueOf("00:00:00:00:00:02"), VlanId.NONE, 214 MacAddress.valueOf("00:00:00:00:00:02"), VlanId.NONE,
215 new HostLocation(SW2_ETH1, 1), 215 new HostLocation(SW2_ETH1, 1),
216 - Sets.newHashSet(host2Address)); 216 + Sets.newHashSet(host2Address));
217 217
218 expect(hostService.getHostsByIp(host2Address)) 218 expect(hostService.getHostsByIp(host2Address))
219 .andReturn(Sets.newHashSet(host2)).anyTimes(); 219 .andReturn(Sets.newHashSet(host2)).anyTimes();
220 - hostService.startMonitoringIp(host2Address.toIpAddress()); 220 + hostService.startMonitoringIp(host2Address);
221 expectLastCall().anyTimes(); 221 expectLastCall().anyTimes();
222 222
223 223
......
...@@ -184,7 +184,7 @@ public class RouterTestWithAsyncArp { ...@@ -184,7 +184,7 @@ public class RouterTestWithAsyncArp {
184 184
185 // Set up test expectation 185 // Set up test expectation
186 reset(hostService); 186 reset(hostService);
187 - expect(hostService.getHostsByIp(anyObject(IpPrefix.class))).andReturn( 187 + expect(hostService.getHostsByIp(anyObject(IpAddress.class))).andReturn(
188 new HashSet<Host>()).anyTimes(); 188 new HashSet<Host>()).anyTimes();
189 hostService.startMonitoringIp(IpAddress.valueOf("192.168.10.1")); 189 hostService.startMonitoringIp(IpAddress.valueOf("192.168.10.1"));
190 replay(hostService); 190 replay(hostService);
...@@ -203,7 +203,7 @@ public class RouterTestWithAsyncArp { ...@@ -203,7 +203,7 @@ public class RouterTestWithAsyncArp {
203 new HostLocation( 203 new HostLocation(
204 SW1_ETH1.deviceId(), 204 SW1_ETH1.deviceId(),
205 SW1_ETH1.port(), 1), 205 SW1_ETH1.port(), 1),
206 - Sets.newHashSet(IpPrefix.valueOf("192.168.10.1/32"))); 206 + Sets.newHashSet(IpAddress.valueOf("192.168.10.1")));
207 internalHostListener.event( 207 internalHostListener.event(
208 new HostEvent(HostEvent.Type.HOST_ADDED, host)); 208 new HostEvent(HostEvent.Type.HOST_ADDED, host));
209 209
...@@ -266,7 +266,7 @@ public class RouterTestWithAsyncArp { ...@@ -266,7 +266,7 @@ public class RouterTestWithAsyncArp {
266 266
267 // Set up test expectation 267 // Set up test expectation
268 reset(hostService); 268 reset(hostService);
269 - expect(hostService.getHostsByIp(anyObject(IpPrefix.class))).andReturn( 269 + expect(hostService.getHostsByIp(anyObject(IpAddress.class))).andReturn(
270 new HashSet<Host>()).anyTimes(); 270 new HashSet<Host>()).anyTimes();
271 hostService.startMonitoringIp(IpAddress.valueOf("192.168.20.1")); 271 hostService.startMonitoringIp(IpAddress.valueOf("192.168.20.1"));
272 replay(hostService); 272 replay(hostService);
...@@ -286,7 +286,7 @@ public class RouterTestWithAsyncArp { ...@@ -286,7 +286,7 @@ public class RouterTestWithAsyncArp {
286 new HostLocation( 286 new HostLocation(
287 SW2_ETH1.deviceId(), 287 SW2_ETH1.deviceId(),
288 SW2_ETH1.port(), 1), 288 SW2_ETH1.port(), 1),
289 - Sets.newHashSet(IpPrefix.valueOf("192.168.20.1/32"))); 289 + Sets.newHashSet(IpAddress.valueOf("192.168.20.1")));
290 internalHostListener.event( 290 internalHostListener.event(
291 new HostEvent(HostEvent.Type.HOST_ADDED, host)); 291 new HostEvent(HostEvent.Type.HOST_ADDED, host));
292 292
......
...@@ -34,7 +34,7 @@ import org.onlab.onos.net.topology.Topology; ...@@ -34,7 +34,7 @@ import org.onlab.onos.net.topology.Topology;
34 import org.onlab.onos.net.topology.TopologyGraph; 34 import org.onlab.onos.net.topology.TopologyGraph;
35 import org.onlab.onos.net.topology.TopologyService; 35 import org.onlab.onos.net.topology.TopologyService;
36 import org.onlab.onos.net.topology.TopologyVertex; 36 import org.onlab.onos.net.topology.TopologyVertex;
37 -import org.onlab.packet.IpPrefix; 37 +import org.onlab.packet.IpAddress;
38 import org.onlab.rest.BaseResource; 38 import org.onlab.rest.BaseResource;
39 39
40 import javax.ws.rs.GET; 40 import javax.ws.rs.GET;
...@@ -92,8 +92,8 @@ public class TopologyResource extends BaseResource { ...@@ -92,8 +92,8 @@ public class TopologyResource extends BaseResource {
92 // Merge the exterior and interior vertexes and inject host links as 92 // Merge the exterior and interior vertexes and inject host links as
93 // the exterior edges. 93 // the exterior edges.
94 for (Host host : hostService.getHosts()) { 94 for (Host host : hostService.getHosts()) {
95 - Set<IpPrefix> ipAddresses = host.ipAddresses(); 95 + Set<IpAddress> ipAddresses = host.ipAddresses();
96 - IpPrefix ipAddress = ipAddresses.isEmpty() ? null : ipAddresses.iterator().next(); 96 + IpAddress ipAddress = ipAddresses.isEmpty() ? null : ipAddresses.iterator().next();
97 String label = ipAddress != null ? ipAddress.toString() : host.mac().toString(); 97 String label = ipAddress != null ? ipAddress.toString() : host.mac().toString();
98 vertexesNode.add(json(mapper, host.id(), 3, label, true)); 98 vertexesNode.add(json(mapper, host.id(), 3, label, true));
99 edgesNode.add(json(mapper, 1, host.location(), new ConnectPoint(host.id(), portNumber(-1)))); 99 edgesNode.add(json(mapper, 1, host.location(), new ConnectPoint(host.id(), portNumber(-1))));
......
...@@ -27,7 +27,7 @@ import org.onlab.onos.cli.AbstractShellCommand; ...@@ -27,7 +27,7 @@ import org.onlab.onos.cli.AbstractShellCommand;
27 import org.onlab.onos.cli.Comparators; 27 import org.onlab.onos.cli.Comparators;
28 import org.onlab.onos.net.Host; 28 import org.onlab.onos.net.Host;
29 import org.onlab.onos.net.host.HostService; 29 import org.onlab.onos.net.host.HostService;
30 -import org.onlab.packet.IpPrefix; 30 +import org.onlab.packet.IpAddress;
31 31
32 import java.util.Collections; 32 import java.util.Collections;
33 import java.util.List; 33 import java.util.List;
...@@ -71,7 +71,7 @@ public class HostsListCommand extends AbstractShellCommand { ...@@ -71,7 +71,7 @@ public class HostsListCommand extends AbstractShellCommand {
71 ObjectNode loc = LinksListCommand.json(mapper, host.location()) 71 ObjectNode loc = LinksListCommand.json(mapper, host.location())
72 .put("time", host.location().time()); 72 .put("time", host.location().time());
73 ArrayNode ips = mapper.createArrayNode(); 73 ArrayNode ips = mapper.createArrayNode();
74 - for (IpPrefix ip : host.ipAddresses()) { 74 + for (IpAddress ip : host.ipAddresses()) {
75 ips.add(ip.toString()); 75 ips.add(ip.toString());
76 } 76 }
77 ObjectNode result = mapper.createObjectNode() 77 ObjectNode result = mapper.createObjectNode()
......
1 package org.onlab.onos.net; 1 package org.onlab.onos.net;
2 2
3 import org.onlab.onos.net.provider.ProviderId; 3 import org.onlab.onos.net.provider.ProviderId;
4 -import org.onlab.packet.IpPrefix; 4 +import org.onlab.packet.IpAddress;
5 import org.onlab.packet.MacAddress; 5 import org.onlab.packet.MacAddress;
6 import org.onlab.packet.VlanId; 6 import org.onlab.packet.VlanId;
7 7
...@@ -20,8 +20,7 @@ public class DefaultHost extends AbstractElement implements Host { ...@@ -20,8 +20,7 @@ public class DefaultHost extends AbstractElement implements Host {
20 private final MacAddress mac; 20 private final MacAddress mac;
21 private final VlanId vlan; 21 private final VlanId vlan;
22 private final HostLocation location; 22 private final HostLocation location;
23 - // FIXME: should be IpAddress 23 + private final Set<IpAddress> ips;
24 - private final Set<IpPrefix> ips;
25 24
26 /** 25 /**
27 * Creates an end-station host using the supplied information. 26 * Creates an end-station host using the supplied information.
...@@ -35,13 +34,13 @@ public class DefaultHost extends AbstractElement implements Host { ...@@ -35,13 +34,13 @@ public class DefaultHost extends AbstractElement implements Host {
35 * @param annotations optional key/value annotations 34 * @param annotations optional key/value annotations
36 */ 35 */
37 public DefaultHost(ProviderId providerId, HostId id, MacAddress mac, 36 public DefaultHost(ProviderId providerId, HostId id, MacAddress mac,
38 - VlanId vlan, HostLocation location, Set<IpPrefix> ips, 37 + VlanId vlan, HostLocation location, Set<IpAddress> ips,
39 Annotations... annotations) { 38 Annotations... annotations) {
40 super(providerId, id, annotations); 39 super(providerId, id, annotations);
41 this.mac = mac; 40 this.mac = mac;
42 this.vlan = vlan; 41 this.vlan = vlan;
43 this.location = location; 42 this.location = location;
44 - this.ips = new HashSet<IpPrefix>(ips); 43 + this.ips = new HashSet<>(ips);
45 } 44 }
46 45
47 @Override 46 @Override
...@@ -55,7 +54,7 @@ public class DefaultHost extends AbstractElement implements Host { ...@@ -55,7 +54,7 @@ public class DefaultHost extends AbstractElement implements Host {
55 } 54 }
56 55
57 @Override 56 @Override
58 - public Set<IpPrefix> ipAddresses() { 57 + public Set<IpAddress> ipAddresses() {
59 return Collections.unmodifiableSet(ips); 58 return Collections.unmodifiableSet(ips);
60 } 59 }
61 60
......
1 package org.onlab.onos.net; 1 package org.onlab.onos.net;
2 2
3 -import org.onlab.packet.IpPrefix; 3 +import org.onlab.packet.IpAddress;
4 import org.onlab.packet.MacAddress; 4 import org.onlab.packet.MacAddress;
5 import org.onlab.packet.VlanId; 5 import org.onlab.packet.VlanId;
6 6
...@@ -38,8 +38,7 @@ public interface Host extends Element { ...@@ -38,8 +38,7 @@ public interface Host extends Element {
38 * 38 *
39 * @return set of IP addresses; empty if no IP address is bound 39 * @return set of IP addresses; empty if no IP address is bound
40 */ 40 */
41 - // FIXME: Switch to IpAddress 41 + Set<IpAddress> ipAddresses();
42 - Set<IpPrefix> ipAddresses();
43 42
44 /** 43 /**
45 * Returns the most recent host location where the host attaches to the 44 * Returns the most recent host location where the host attaches to the
......
...@@ -6,7 +6,7 @@ import java.util.Set; ...@@ -6,7 +6,7 @@ import java.util.Set;
6 import org.onlab.onos.net.AbstractDescription; 6 import org.onlab.onos.net.AbstractDescription;
7 import org.onlab.onos.net.HostLocation; 7 import org.onlab.onos.net.HostLocation;
8 import org.onlab.onos.net.SparseAnnotations; 8 import org.onlab.onos.net.SparseAnnotations;
9 -import org.onlab.packet.IpPrefix; 9 +import org.onlab.packet.IpAddress;
10 import org.onlab.packet.MacAddress; 10 import org.onlab.packet.MacAddress;
11 import org.onlab.packet.VlanId; 11 import org.onlab.packet.VlanId;
12 12
...@@ -23,7 +23,7 @@ public class DefaultHostDescription extends AbstractDescription ...@@ -23,7 +23,7 @@ public class DefaultHostDescription extends AbstractDescription
23 private final MacAddress mac; 23 private final MacAddress mac;
24 private final VlanId vlan; 24 private final VlanId vlan;
25 private final HostLocation location; 25 private final HostLocation location;
26 - private final Set<IpPrefix> ip; 26 + private final Set<IpAddress> ip;
27 27
28 /** 28 /**
29 * Creates a host description using the supplied information. 29 * Creates a host description using the supplied information.
...@@ -36,7 +36,8 @@ public class DefaultHostDescription extends AbstractDescription ...@@ -36,7 +36,8 @@ public class DefaultHostDescription extends AbstractDescription
36 public DefaultHostDescription(MacAddress mac, VlanId vlan, 36 public DefaultHostDescription(MacAddress mac, VlanId vlan,
37 HostLocation location, 37 HostLocation location,
38 SparseAnnotations... annotations) { 38 SparseAnnotations... annotations) {
39 - this(mac, vlan, location, Collections.<IpPrefix>emptySet(), annotations); 39 + this(mac, vlan, location, Collections.<IpAddress>emptySet(),
40 + annotations);
40 } 41 }
41 42
42 /** 43 /**
...@@ -49,7 +50,7 @@ public class DefaultHostDescription extends AbstractDescription ...@@ -49,7 +50,7 @@ public class DefaultHostDescription extends AbstractDescription
49 * @param annotations optional key/value annotations map 50 * @param annotations optional key/value annotations map
50 */ 51 */
51 public DefaultHostDescription(MacAddress mac, VlanId vlan, 52 public DefaultHostDescription(MacAddress mac, VlanId vlan,
52 - HostLocation location, IpPrefix ip, 53 + HostLocation location, IpAddress ip,
53 SparseAnnotations... annotations) { 54 SparseAnnotations... annotations) {
54 this(mac, vlan, location, ImmutableSet.of(ip), annotations); 55 this(mac, vlan, location, ImmutableSet.of(ip), annotations);
55 } 56 }
...@@ -64,7 +65,7 @@ public class DefaultHostDescription extends AbstractDescription ...@@ -64,7 +65,7 @@ public class DefaultHostDescription extends AbstractDescription
64 * @param annotations optional key/value annotations map 65 * @param annotations optional key/value annotations map
65 */ 66 */
66 public DefaultHostDescription(MacAddress mac, VlanId vlan, 67 public DefaultHostDescription(MacAddress mac, VlanId vlan,
67 - HostLocation location, Set<IpPrefix> ip, 68 + HostLocation location, Set<IpAddress> ip,
68 SparseAnnotations... annotations) { 69 SparseAnnotations... annotations) {
69 super(annotations); 70 super(annotations);
70 this.mac = mac; 71 this.mac = mac;
...@@ -89,7 +90,7 @@ public class DefaultHostDescription extends AbstractDescription ...@@ -89,7 +90,7 @@ public class DefaultHostDescription extends AbstractDescription
89 } 90 }
90 91
91 @Override 92 @Override
92 - public Set<IpPrefix> ipAddress() { 93 + public Set<IpAddress> ipAddress() {
93 return ip; 94 return ip;
94 } 95 }
95 96
......
...@@ -4,7 +4,7 @@ import java.util.Set; ...@@ -4,7 +4,7 @@ import java.util.Set;
4 4
5 import org.onlab.onos.net.Description; 5 import org.onlab.onos.net.Description;
6 import org.onlab.onos.net.HostLocation; 6 import org.onlab.onos.net.HostLocation;
7 -import org.onlab.packet.IpPrefix; 7 +import org.onlab.packet.IpAddress;
8 import org.onlab.packet.MacAddress; 8 import org.onlab.packet.MacAddress;
9 import org.onlab.packet.VlanId; 9 import org.onlab.packet.VlanId;
10 10
...@@ -39,7 +39,5 @@ public interface HostDescription extends Description { ...@@ -39,7 +39,5 @@ public interface HostDescription extends Description {
39 * 39 *
40 * @return host IP address 40 * @return host IP address
41 */ 41 */
42 - // FIXME: Switch to IpAddress 42 + Set<IpAddress> ipAddress();
43 - Set<IpPrefix> ipAddress();
44 -
45 } 43 }
......
...@@ -7,7 +7,6 @@ import org.onlab.onos.net.DeviceId; ...@@ -7,7 +7,6 @@ import org.onlab.onos.net.DeviceId;
7 import org.onlab.onos.net.Host; 7 import org.onlab.onos.net.Host;
8 import org.onlab.onos.net.HostId; 8 import org.onlab.onos.net.HostId;
9 import org.onlab.packet.IpAddress; 9 import org.onlab.packet.IpAddress;
10 -import org.onlab.packet.IpPrefix;
11 import org.onlab.packet.MacAddress; 10 import org.onlab.packet.MacAddress;
12 import org.onlab.packet.VlanId; 11 import org.onlab.packet.VlanId;
13 12
...@@ -60,7 +59,7 @@ public interface HostService { ...@@ -60,7 +59,7 @@ public interface HostService {
60 * @param ip ip address 59 * @param ip ip address
61 * @return set of hosts with the given IP 60 * @return set of hosts with the given IP
62 */ 61 */
63 - Set<Host> getHostsByIp(IpPrefix ip); 62 + Set<Host> getHostsByIp(IpAddress ip);
64 63
65 // TODO: consider adding Host getHostByIp(IpAddress ip, VlanId vlan); 64 // TODO: consider adding Host getHostByIp(IpAddress ip, VlanId vlan);
66 65
......
...@@ -6,7 +6,7 @@ import org.onlab.onos.net.Host; ...@@ -6,7 +6,7 @@ import org.onlab.onos.net.Host;
6 import org.onlab.onos.net.HostId; 6 import org.onlab.onos.net.HostId;
7 import org.onlab.onos.net.provider.ProviderId; 7 import org.onlab.onos.net.provider.ProviderId;
8 import org.onlab.onos.store.Store; 8 import org.onlab.onos.store.Store;
9 -import org.onlab.packet.IpPrefix; 9 +import org.onlab.packet.IpAddress;
10 import org.onlab.packet.MacAddress; 10 import org.onlab.packet.MacAddress;
11 import org.onlab.packet.VlanId; 11 import org.onlab.packet.VlanId;
12 12
...@@ -82,8 +82,7 @@ public interface HostStore extends Store<HostEvent, HostStoreDelegate> { ...@@ -82,8 +82,7 @@ public interface HostStore extends Store<HostEvent, HostStoreDelegate> {
82 * @param ip ip address 82 * @param ip ip address
83 * @return set of hosts with the given IP 83 * @return set of hosts with the given IP
84 */ 84 */
85 - // FIXME: Switch to IpAddress 85 + Set<Host> getHosts(IpAddress ip);
86 - Set<Host> getHosts(IpPrefix ip);
87 86
88 /** 87 /**
89 * Returns the set of hosts whose location falls on the given connection point. 88 * Returns the set of hosts whose location falls on the given connection point.
......
...@@ -3,7 +3,7 @@ package org.onlab.onos.net.proxyarp; ...@@ -3,7 +3,7 @@ package org.onlab.onos.net.proxyarp;
3 import org.onlab.onos.net.ConnectPoint; 3 import org.onlab.onos.net.ConnectPoint;
4 import org.onlab.onos.net.packet.PacketContext; 4 import org.onlab.onos.net.packet.PacketContext;
5 import org.onlab.packet.Ethernet; 5 import org.onlab.packet.Ethernet;
6 -import org.onlab.packet.IpPrefix; 6 +import org.onlab.packet.IpAddress;
7 7
8 /** 8 /**
9 * Service for processing arp requests on behalf of applications. 9 * Service for processing arp requests on behalf of applications.
...@@ -17,7 +17,7 @@ public interface ProxyArpService { ...@@ -17,7 +17,7 @@ public interface ProxyArpService {
17 * @param addr a ip address 17 * @param addr a ip address
18 * @return true if know, false otherwise 18 * @return true if know, false otherwise
19 */ 19 */
20 - boolean known(IpPrefix addr); 20 + boolean known(IpAddress addr);
21 21
22 /** 22 /**
23 * Sends a reply for a given request. If the host is not known then the arp 23 * Sends a reply for a given request. If the host is not known then the arp
......
...@@ -2,7 +2,7 @@ package org.onlab.onos.net; ...@@ -2,7 +2,7 @@ package org.onlab.onos.net;
2 2
3 import org.onlab.onos.net.provider.ProviderId; 3 import org.onlab.onos.net.provider.ProviderId;
4 import org.onlab.packet.ChassisId; 4 import org.onlab.packet.ChassisId;
5 -import org.onlab.packet.IpPrefix; 5 +import org.onlab.packet.IpAddress;
6 6
7 import java.util.ArrayList; 7 import java.util.ArrayList;
8 import java.util.HashSet; 8 import java.util.HashSet;
...@@ -45,7 +45,7 @@ public final class NetTestTools { ...@@ -45,7 +45,7 @@ public final class NetTestTools {
45 public static Host host(String id, String did) { 45 public static Host host(String id, String did) {
46 return new DefaultHost(PID, hid(id), valueOf(1234), vlanId((short) 2), 46 return new DefaultHost(PID, hid(id), valueOf(1234), vlanId((short) 2),
47 new HostLocation(did(did), portNumber(1), 321), 47 new HostLocation(did(did), portNumber(1), 321),
48 - new HashSet<IpPrefix>()); 48 + new HashSet<IpAddress>());
49 } 49 }
50 50
51 // Short-hand for creating a connection point. 51 // Short-hand for creating a connection point.
......
...@@ -5,7 +5,7 @@ import static org.onlab.onos.net.DeviceId.deviceId; ...@@ -5,7 +5,7 @@ import static org.onlab.onos.net.DeviceId.deviceId;
5 import java.util.Set; 5 import java.util.Set;
6 6
7 import org.onlab.onos.net.provider.ProviderId; 7 import org.onlab.onos.net.provider.ProviderId;
8 -import org.onlab.packet.IpPrefix; 8 +import org.onlab.packet.IpAddress;
9 import org.onlab.packet.MacAddress; 9 import org.onlab.packet.MacAddress;
10 import org.onlab.packet.VlanId; 10 import org.onlab.packet.VlanId;
11 11
...@@ -24,9 +24,9 @@ public abstract class TestDeviceParams { ...@@ -24,9 +24,9 @@ public abstract class TestDeviceParams {
24 protected static final MacAddress MAC2 = MacAddress.valueOf("00:22:00:00:00:02"); 24 protected static final MacAddress MAC2 = MacAddress.valueOf("00:22:00:00:00:02");
25 protected static final VlanId VLAN1 = VlanId.vlanId((short) 11); 25 protected static final VlanId VLAN1 = VlanId.vlanId((short) 11);
26 protected static final VlanId VLAN2 = VlanId.vlanId((short) 22); 26 protected static final VlanId VLAN2 = VlanId.vlanId((short) 22);
27 - protected static final IpPrefix IP1 = IpPrefix.valueOf("10.0.0.1"); 27 + protected static final IpAddress IP1 = IpAddress.valueOf("10.0.0.1");
28 - protected static final IpPrefix IP2 = IpPrefix.valueOf("10.0.0.2"); 28 + protected static final IpAddress IP2 = IpAddress.valueOf("10.0.0.2");
29 - protected static final IpPrefix IP3 = IpPrefix.valueOf("10.0.0.3"); 29 + protected static final IpAddress IP3 = IpAddress.valueOf("10.0.0.3");
30 30
31 protected static final PortNumber P1 = PortNumber.portNumber(100); 31 protected static final PortNumber P1 = PortNumber.portNumber(100);
32 protected static final PortNumber P2 = PortNumber.portNumber(200); 32 protected static final PortNumber P2 = PortNumber.portNumber(200);
...@@ -34,7 +34,7 @@ public abstract class TestDeviceParams { ...@@ -34,7 +34,7 @@ public abstract class TestDeviceParams {
34 protected static final HostId HID2 = HostId.hostId(MAC2, VLAN2); 34 protected static final HostId HID2 = HostId.hostId(MAC2, VLAN2);
35 protected static final HostLocation LOC1 = new HostLocation(DID1, P1, 123L); 35 protected static final HostLocation LOC1 = new HostLocation(DID1, P1, 123L);
36 protected static final HostLocation LOC2 = new HostLocation(DID2, P2, 123L); 36 protected static final HostLocation LOC2 = new HostLocation(DID2, P2, 123L);
37 - protected static final Set<IpPrefix> IPSET1 = Sets.newHashSet(IP1, IP2); 37 + protected static final Set<IpAddress> IPSET1 = Sets.newHashSet(IP1, IP2);
38 - protected static final Set<IpPrefix> IPSET2 = Sets.newHashSet(IP1, IP3); 38 + protected static final Set<IpAddress> IPSET2 = Sets.newHashSet(IP1, IP3);
39 39
40 } 40 }
......
...@@ -4,7 +4,7 @@ import org.junit.Test; ...@@ -4,7 +4,7 @@ import org.junit.Test;
4 import org.onlab.onos.net.DeviceId; 4 import org.onlab.onos.net.DeviceId;
5 import org.onlab.onos.net.HostLocation; 5 import org.onlab.onos.net.HostLocation;
6 import org.onlab.onos.net.PortNumber; 6 import org.onlab.onos.net.PortNumber;
7 -import org.onlab.packet.IpPrefix; 7 +import org.onlab.packet.IpAddress;
8 import org.onlab.packet.MacAddress; 8 import org.onlab.packet.MacAddress;
9 import org.onlab.packet.VlanId; 9 import org.onlab.packet.VlanId;
10 10
...@@ -20,7 +20,7 @@ public class DefaultHostDecriptionTest { ...@@ -20,7 +20,7 @@ public class DefaultHostDecriptionTest {
20 20
21 private static final MacAddress MAC = MacAddress.valueOf("00:00:11:00:00:01"); 21 private static final MacAddress MAC = MacAddress.valueOf("00:00:11:00:00:01");
22 private static final VlanId VLAN = VlanId.vlanId((short) 10); 22 private static final VlanId VLAN = VlanId.vlanId((short) 10);
23 - private static final IpPrefix IP = IpPrefix.valueOf("10.0.0.1"); 23 + private static final IpAddress IP = IpAddress.valueOf("10.0.0.1");
24 24
25 private static final HostLocation LOC = new HostLocation( 25 private static final HostLocation LOC = new HostLocation(
26 DeviceId.deviceId("of:foo"), 26 DeviceId.deviceId("of:foo"),
......
...@@ -11,7 +11,7 @@ import org.onlab.onos.net.HostId; ...@@ -11,7 +11,7 @@ import org.onlab.onos.net.HostId;
11 import org.onlab.onos.net.HostLocation; 11 import org.onlab.onos.net.HostLocation;
12 import org.onlab.onos.net.PortNumber; 12 import org.onlab.onos.net.PortNumber;
13 import org.onlab.onos.net.provider.ProviderId; 13 import org.onlab.onos.net.provider.ProviderId;
14 -import org.onlab.packet.IpPrefix; 14 +import org.onlab.packet.IpAddress;
15 import org.onlab.packet.MacAddress; 15 import org.onlab.packet.MacAddress;
16 import org.onlab.packet.VlanId; 16 import org.onlab.packet.VlanId;
17 17
...@@ -27,9 +27,9 @@ public class HostEventTest extends AbstractEventTest { ...@@ -27,9 +27,9 @@ public class HostEventTest extends AbstractEventTest {
27 PortNumber.portNumber(100), 27 PortNumber.portNumber(100),
28 123L 28 123L
29 ); 29 );
30 - Set<IpPrefix> ipset = Sets.newHashSet( 30 + Set<IpAddress> ipset = Sets.newHashSet(
31 - IpPrefix.valueOf("10.0.0.1"), 31 + IpAddress.valueOf("10.0.0.1"),
32 - IpPrefix.valueOf("10.0.0.2") 32 + IpAddress.valueOf("10.0.0.2")
33 ); 33 );
34 HostId hid = HostId.hostId(mac, vlan); 34 HostId hid = HostId.hostId(mac, vlan);
35 35
......
...@@ -7,7 +7,6 @@ import org.onlab.onos.net.DeviceId; ...@@ -7,7 +7,6 @@ import org.onlab.onos.net.DeviceId;
7 import org.onlab.onos.net.Host; 7 import org.onlab.onos.net.Host;
8 import org.onlab.onos.net.HostId; 8 import org.onlab.onos.net.HostId;
9 import org.onlab.packet.IpAddress; 9 import org.onlab.packet.IpAddress;
10 -import org.onlab.packet.IpPrefix;
11 import org.onlab.packet.MacAddress; 10 import org.onlab.packet.MacAddress;
12 import org.onlab.packet.VlanId; 11 import org.onlab.packet.VlanId;
13 12
...@@ -41,7 +40,7 @@ public class HostServiceAdapter implements HostService { ...@@ -41,7 +40,7 @@ public class HostServiceAdapter implements HostService {
41 } 40 }
42 41
43 @Override 42 @Override
44 - public Set<Host> getHostsByIp(IpPrefix ip) { 43 + public Set<Host> getHostsByIp(IpAddress ip) {
45 return null; 44 return null;
46 } 45 }
47 46
......
...@@ -33,7 +33,6 @@ import org.onlab.onos.net.packet.PacketService; ...@@ -33,7 +33,6 @@ import org.onlab.onos.net.packet.PacketService;
33 import org.onlab.onos.net.provider.AbstractProviderRegistry; 33 import org.onlab.onos.net.provider.AbstractProviderRegistry;
34 import org.onlab.onos.net.provider.AbstractProviderService; 34 import org.onlab.onos.net.provider.AbstractProviderService;
35 import org.onlab.packet.IpAddress; 35 import org.onlab.packet.IpAddress;
36 -import org.onlab.packet.IpPrefix;
37 import org.onlab.packet.MacAddress; 36 import org.onlab.packet.MacAddress;
38 import org.onlab.packet.VlanId; 37 import org.onlab.packet.VlanId;
39 import org.slf4j.Logger; 38 import org.slf4j.Logger;
...@@ -121,7 +120,7 @@ public class HostManager ...@@ -121,7 +120,7 @@ public class HostManager
121 } 120 }
122 121
123 @Override 122 @Override
124 - public Set<Host> getHostsByIp(IpPrefix ip) { 123 + public Set<Host> getHostsByIp(IpAddress ip) {
125 checkNotNull(ip, "IP address cannot be null"); 124 checkNotNull(ip, "IP address cannot be null");
126 return store.getHosts(ip); 125 return store.getHosts(ip);
127 } 126 }
......
...@@ -129,10 +129,7 @@ public class HostMonitor implements TimerTask { ...@@ -129,10 +129,7 @@ public class HostMonitor implements TimerTask {
129 @Override 129 @Override
130 public void run(Timeout timeout) throws Exception { 130 public void run(Timeout timeout) throws Exception {
131 for (IpAddress ip : monitoredAddresses) { 131 for (IpAddress ip : monitoredAddresses) {
132 - // TODO have to convert right now because the HostService API uses IpPrefix 132 + Set<Host> hosts = hostManager.getHostsByIp(ip);
133 - IpPrefix prefix = IpPrefix.valueOf(ip.toOctets());
134 -
135 - Set<Host> hosts = hostManager.getHostsByIp(prefix);
136 133
137 if (hosts.isEmpty()) { 134 if (hosts.isEmpty()) {
138 sendArpRequest(ip); 135 sendArpRequest(ip);
......
...@@ -99,7 +99,7 @@ public class ProxyArpManager implements ProxyArpService { ...@@ -99,7 +99,7 @@ public class ProxyArpManager implements ProxyArpService {
99 } 99 }
100 100
101 @Override 101 @Override
102 - public boolean known(IpPrefix addr) { 102 + public boolean known(IpAddress addr) {
103 checkNotNull(addr, MAC_ADDR_NULL); 103 checkNotNull(addr, MAC_ADDR_NULL);
104 Set<Host> hosts = hostService.getHostsByIp(addr); 104 Set<Host> hosts = hostService.getHostsByIp(addr);
105 return !hosts.isEmpty(); 105 return !hosts.isEmpty();
...@@ -150,7 +150,7 @@ public class ProxyArpManager implements ProxyArpService { ...@@ -150,7 +150,7 @@ public class ProxyArpManager implements ProxyArpService {
150 // Continue with normal proxy ARP case 150 // Continue with normal proxy ARP case
151 151
152 VlanId vlan = VlanId.vlanId(eth.getVlanID()); 152 VlanId vlan = VlanId.vlanId(eth.getVlanID());
153 - Set<Host> hosts = hostService.getHostsByIp(IpPrefix.valueOf(arp 153 + Set<Host> hosts = hostService.getHostsByIp(IpAddress.valueOf(arp
154 .getTargetProtocolAddress())); 154 .getTargetProtocolAddress()));
155 155
156 Host dst = null; 156 Host dst = null;
...@@ -170,8 +170,7 @@ public class ProxyArpManager implements ProxyArpService { ...@@ -170,8 +170,7 @@ public class ProxyArpManager implements ProxyArpService {
170 } 170 }
171 171
172 // TODO find the correct IP address 172 // TODO find the correct IP address
173 - IpAddress ipAddress = 173 + IpAddress ipAddress = dst.ipAddresses().iterator().next();
174 - dst.ipAddresses().iterator().next().toIpAddress();
175 Ethernet arpReply = buildArpReply(ipAddress, dst.mac(), eth); 174 Ethernet arpReply = buildArpReply(ipAddress, dst.mac(), eth);
176 // TODO: check send status with host service. 175 // TODO: check send status with host service.
177 sendTo(arpReply, src.location()); 176 sendTo(arpReply, src.location());
......
...@@ -58,8 +58,8 @@ public class HostManagerTest { ...@@ -58,8 +58,8 @@ public class HostManagerTest {
58 private static final HostId HID1 = HostId.hostId(MAC1, VLAN1); 58 private static final HostId HID1 = HostId.hostId(MAC1, VLAN1);
59 private static final HostId HID2 = HostId.hostId(MAC2, VLAN1); 59 private static final HostId HID2 = HostId.hostId(MAC2, VLAN1);
60 60
61 - private static final IpPrefix IP1 = IpPrefix.valueOf("10.0.0.1"); 61 + private static final IpAddress IP1 = IpAddress.valueOf("10.0.0.1");
62 - private static final IpPrefix IP2 = IpPrefix.valueOf("10.0.0.2"); 62 + private static final IpAddress IP2 = IpAddress.valueOf("10.0.0.2");
63 63
64 private static final DeviceId DID1 = DeviceId.deviceId("of:001"); 64 private static final DeviceId DID1 = DeviceId.deviceId("of:001");
65 private static final DeviceId DID2 = DeviceId.deviceId("of:002"); 65 private static final DeviceId DID2 = DeviceId.deviceId("of:002");
...@@ -115,7 +115,7 @@ public class HostManagerTest { ...@@ -115,7 +115,7 @@ public class HostManagerTest {
115 } 115 }
116 116
117 private void detect(HostId hid, MacAddress mac, VlanId vlan, 117 private void detect(HostId hid, MacAddress mac, VlanId vlan,
118 - HostLocation loc, IpPrefix ip) { 118 + HostLocation loc, IpAddress ip) {
119 HostDescription descr = new DefaultHostDescription(mac, vlan, loc, ip); 119 HostDescription descr = new DefaultHostDescription(mac, vlan, loc, ip);
120 providerService.hostDetected(hid, descr); 120 providerService.hostDetected(hid, descr);
121 assertNotNull("host should be found", mgr.getHost(hid)); 121 assertNotNull("host should be found", mgr.getHost(hid));
......
...@@ -46,9 +46,8 @@ import com.google.common.collect.Multimap; ...@@ -46,9 +46,8 @@ import com.google.common.collect.Multimap;
46 46
47 public class HostMonitorTest { 47 public class HostMonitorTest {
48 48
49 - private IpAddress targetIpAddress = IpAddress.valueOf("10.0.0.1"); 49 + private static final IpAddress TARGET_IP_ADDR =
50 - private IpPrefix targetIpPrefix = IpPrefix.valueOf(targetIpAddress.toOctets()); 50 + IpAddress.valueOf("10.0.0.1");
51 -
52 private static final IpAddress SOURCE_ADDR = 51 private static final IpAddress SOURCE_ADDR =
53 IpAddress.valueOf("10.0.0.99"); 52 IpAddress.valueOf("10.0.0.99");
54 private static final InterfaceIpAddress IA1 = 53 private static final InterfaceIpAddress IA1 =
...@@ -71,7 +70,7 @@ public class HostMonitorTest { ...@@ -71,7 +70,7 @@ public class HostMonitorTest {
71 replay(host); 70 replay(host);
72 71
73 HostManager hostManager = createMock(HostManager.class); 72 HostManager hostManager = createMock(HostManager.class);
74 - expect(hostManager.getHostsByIp(targetIpPrefix)) 73 + expect(hostManager.getHostsByIp(TARGET_IP_ADDR))
75 .andReturn(Collections.singleton(host)); 74 .andReturn(Collections.singleton(host));
76 replay(hostManager); 75 replay(hostManager);
77 76
...@@ -84,7 +83,7 @@ public class HostMonitorTest { ...@@ -84,7 +83,7 @@ public class HostMonitorTest {
84 hostMonitor = new HostMonitor(null, null, hostManager); 83 hostMonitor = new HostMonitor(null, null, hostManager);
85 84
86 hostMonitor.registerHostProvider(hostProvider); 85 hostMonitor.registerHostProvider(hostProvider);
87 - hostMonitor.addMonitoringFor(targetIpAddress); 86 + hostMonitor.addMonitoringFor(TARGET_IP_ADDR);
88 87
89 hostMonitor.run(null); 88 hostMonitor.run(null);
90 89
...@@ -115,7 +114,7 @@ public class HostMonitorTest { ...@@ -115,7 +114,7 @@ public class HostMonitorTest {
115 PortAddresses pa = 114 PortAddresses pa =
116 new PortAddresses(cp, Collections.singleton(IA1), sourceMac); 115 new PortAddresses(cp, Collections.singleton(IA1), sourceMac);
117 116
118 - expect(hostManager.getHostsByIp(targetIpPrefix)) 117 + expect(hostManager.getHostsByIp(TARGET_IP_ADDR))
119 .andReturn(Collections.<Host>emptySet()).anyTimes(); 118 .andReturn(Collections.<Host>emptySet()).anyTimes();
120 expect(hostManager.getAddressBindingsForPort(cp)) 119 expect(hostManager.getAddressBindingsForPort(cp))
121 .andReturn(pa).anyTimes(); 120 .andReturn(pa).anyTimes();
...@@ -127,7 +126,7 @@ public class HostMonitorTest { ...@@ -127,7 +126,7 @@ public class HostMonitorTest {
127 // Run the test 126 // Run the test
128 hostMonitor = new HostMonitor(deviceService, packetService, hostManager); 127 hostMonitor = new HostMonitor(deviceService, packetService, hostManager);
129 128
130 - hostMonitor.addMonitoringFor(targetIpAddress); 129 + hostMonitor.addMonitoringFor(TARGET_IP_ADDR);
131 hostMonitor.run(null); 130 hostMonitor.run(null);
132 131
133 132
...@@ -150,7 +149,8 @@ public class HostMonitorTest { ...@@ -150,7 +149,8 @@ public class HostMonitorTest {
150 assertTrue(Arrays.equals(arp.getSenderProtocolAddress(), 149 assertTrue(Arrays.equals(arp.getSenderProtocolAddress(),
151 SOURCE_ADDR.toOctets())); 150 SOURCE_ADDR.toOctets()));
152 assertTrue(Arrays.equals(arp.getSenderHardwareAddress(), sourceMac.toBytes())); 151 assertTrue(Arrays.equals(arp.getSenderHardwareAddress(), sourceMac.toBytes()));
153 - assertTrue(Arrays.equals(arp.getTargetProtocolAddress(), targetIpPrefix.toOctets())); 152 + assertTrue(Arrays.equals(arp.getTargetProtocolAddress(),
153 + TARGET_IP_ADDR.toOctets()));
154 } 154 }
155 155
156 class TestPacketService implements PacketService { 156 class TestPacketService implements PacketService {
......
...@@ -59,8 +59,8 @@ public class ProxyArpManagerTest { ...@@ -59,8 +59,8 @@ public class ProxyArpManagerTest {
59 private static final int NUM_ADDRESS_PORTS = NUM_DEVICES / 2; 59 private static final int NUM_ADDRESS_PORTS = NUM_DEVICES / 2;
60 private static final int NUM_FLOOD_PORTS = 3; 60 private static final int NUM_FLOOD_PORTS = 3;
61 61
62 - private static final IpPrefix IP1 = IpPrefix.valueOf("192.168.1.1/24"); 62 + private static final IpAddress IP1 = IpAddress.valueOf("192.168.1.1");
63 - private static final IpPrefix IP2 = IpPrefix.valueOf("192.168.1.2/24"); 63 + private static final IpAddress IP2 = IpAddress.valueOf("192.168.1.2");
64 64
65 private static final ProviderId PID = new ProviderId("of", "foo"); 65 private static final ProviderId PID = new ProviderId("of", "foo");
66 66
...@@ -214,7 +214,7 @@ public class ProxyArpManagerTest { ...@@ -214,7 +214,7 @@ public class ProxyArpManagerTest {
214 } 214 }
215 215
216 /** 216 /**
217 - * Tests {@link ProxyArpManager#known(IpPrefix)} in the case where the 217 + * Tests {@link ProxyArpManager#known(IpAddress)} in the case where the
218 * IP address is not known. 218 * IP address is not known.
219 * Verifies the method returns false. 219 * Verifies the method returns false.
220 */ 220 */
...@@ -227,7 +227,7 @@ public class ProxyArpManagerTest { ...@@ -227,7 +227,7 @@ public class ProxyArpManagerTest {
227 } 227 }
228 228
229 /** 229 /**
230 - * Tests {@link ProxyArpManager#known(IpPrefix)} in the case where the 230 + * Tests {@link ProxyArpManager#known(IpAddress)} in the case where the
231 * IP address is known. 231 * IP address is known.
232 * Verifies the method returns true. 232 * Verifies the method returns true.
233 */ 233 */
...@@ -256,8 +256,8 @@ public class ProxyArpManagerTest { ...@@ -256,8 +256,8 @@ public class ProxyArpManagerTest {
256 Host requestor = new DefaultHost(PID, HID2, MAC2, VLAN1, getLocation(5), 256 Host requestor = new DefaultHost(PID, HID2, MAC2, VLAN1, getLocation(5),
257 Collections.singleton(IP2)); 257 Collections.singleton(IP2));
258 258
259 - expect(hostService.getHostsByIp(IpPrefix.valueOf(IP1.toOctets()))) 259 + expect(hostService.getHostsByIp(IP1))
260 - .andReturn(Collections.singleton(replyer)); 260 + .andReturn(Collections.singleton(replyer));
261 expect(hostService.getHost(HID2)).andReturn(requestor); 261 expect(hostService.getHost(HID2)).andReturn(requestor);
262 262
263 replay(hostService); 263 replay(hostService);
...@@ -281,7 +281,7 @@ public class ProxyArpManagerTest { ...@@ -281,7 +281,7 @@ public class ProxyArpManagerTest {
281 Host requestor = new DefaultHost(PID, HID2, MAC2, VLAN1, getLocation(5), 281 Host requestor = new DefaultHost(PID, HID2, MAC2, VLAN1, getLocation(5),
282 Collections.singleton(IP2)); 282 Collections.singleton(IP2));
283 283
284 - expect(hostService.getHostsByIp(IpPrefix.valueOf(IP1.toOctets()))) 284 + expect(hostService.getHostsByIp(IP1))
285 .andReturn(Collections.<Host>emptySet()); 285 .andReturn(Collections.<Host>emptySet());
286 expect(hostService.getHost(HID2)).andReturn(requestor); 286 expect(hostService.getHost(HID2)).andReturn(requestor);
287 287
...@@ -308,7 +308,7 @@ public class ProxyArpManagerTest { ...@@ -308,7 +308,7 @@ public class ProxyArpManagerTest {
308 Host requestor = new DefaultHost(PID, HID2, MAC2, VLAN1, getLocation(5), 308 Host requestor = new DefaultHost(PID, HID2, MAC2, VLAN1, getLocation(5),
309 Collections.singleton(IP2)); 309 Collections.singleton(IP2));
310 310
311 - expect(hostService.getHostsByIp(IpPrefix.valueOf(IP1.toOctets()))) 311 + expect(hostService.getHostsByIp(IP1))
312 .andReturn(Collections.singleton(replyer)); 312 .andReturn(Collections.singleton(replyer));
313 expect(hostService.getHost(HID2)).andReturn(requestor); 313 expect(hostService.getHost(HID2)).andReturn(requestor);
314 314
...@@ -323,9 +323,9 @@ public class ProxyArpManagerTest { ...@@ -323,9 +323,9 @@ public class ProxyArpManagerTest {
323 323
324 @Test 324 @Test
325 public void testReplyToRequestForUs() { 325 public void testReplyToRequestForUs() {
326 - IpPrefix theirIp = IpPrefix.valueOf("10.0.1.254/24"); 326 + IpAddress theirIp = IpAddress.valueOf("10.0.1.254");
327 - IpPrefix ourFirstIp = IpPrefix.valueOf("10.0.1.1/24"); 327 + IpAddress ourFirstIp = IpAddress.valueOf("10.0.1.1");
328 - IpPrefix ourSecondIp = IpPrefix.valueOf("10.0.2.1/24"); 328 + IpAddress ourSecondIp = IpAddress.valueOf("10.0.2.1");
329 MacAddress ourMac = MacAddress.valueOf(1L); 329 MacAddress ourMac = MacAddress.valueOf(1L);
330 330
331 Host requestor = new DefaultHost(PID, HID2, MAC2, VLAN1, LOC1, 331 Host requestor = new DefaultHost(PID, HID2, MAC2, VLAN1, LOC1,
...@@ -357,11 +357,11 @@ public class ProxyArpManagerTest { ...@@ -357,11 +357,11 @@ public class ProxyArpManagerTest {
357 public void testReplyExternalPortBadRequest() { 357 public void testReplyExternalPortBadRequest() {
358 replay(hostService); // no further host service expectations 358 replay(hostService); // no further host service expectations
359 359
360 - IpPrefix theirIp = IpPrefix.valueOf("10.0.1.254/24"); 360 + IpAddress theirIp = IpAddress.valueOf("10.0.1.254");
361 361
362 // Request for a valid external IP address but coming in the wrong port 362 // Request for a valid external IP address but coming in the wrong port
363 Ethernet arpRequest = buildArp(ARP.OP_REQUEST, MAC1, null, theirIp, 363 Ethernet arpRequest = buildArp(ARP.OP_REQUEST, MAC1, null, theirIp,
364 - IpPrefix.valueOf("10.0.3.1")); 364 + IpAddress.valueOf("10.0.3.1"));
365 proxyArp.reply(arpRequest, LOC1); 365 proxyArp.reply(arpRequest, LOC1);
366 assertEquals(0, packetService.packets.size()); 366 assertEquals(0, packetService.packets.size());
367 367
...@@ -376,9 +376,9 @@ public class ProxyArpManagerTest { ...@@ -376,9 +376,9 @@ public class ProxyArpManagerTest {
376 public void testReplyToRequestFromUs() { 376 public void testReplyToRequestFromUs() {
377 replay(hostService); // no further host service expectations 377 replay(hostService); // no further host service expectations
378 378
379 - IpPrefix ourIp = IpPrefix.valueOf("10.0.1.1/24"); 379 + IpAddress ourIp = IpAddress.valueOf("10.0.1.1");
380 MacAddress ourMac = MacAddress.valueOf(1L); 380 MacAddress ourMac = MacAddress.valueOf(1L);
381 - IpPrefix theirIp = IpPrefix.valueOf("10.0.1.100/24"); 381 + IpAddress theirIp = IpAddress.valueOf("10.0.1.100");
382 382
383 // This is a request from something inside our network (like a BGP 383 // This is a request from something inside our network (like a BGP
384 // daemon) to an external host. 384 // daemon) to an external host.
...@@ -501,7 +501,7 @@ public class ProxyArpManagerTest { ...@@ -501,7 +501,7 @@ public class ProxyArpManagerTest {
501 * @return the ARP packet 501 * @return the ARP packet
502 */ 502 */
503 private Ethernet buildArp(short opcode, MacAddress srcMac, MacAddress dstMac, 503 private Ethernet buildArp(short opcode, MacAddress srcMac, MacAddress dstMac,
504 - IpPrefix srcIp, IpPrefix dstIp) { 504 + IpAddress srcIp, IpAddress dstIp) {
505 Ethernet eth = new Ethernet(); 505 Ethernet eth = new Ethernet();
506 506
507 if (dstMac == null) { 507 if (dstMac == null) {
......
...@@ -42,7 +42,7 @@ import org.onlab.onos.store.cluster.messaging.MessageSubject; ...@@ -42,7 +42,7 @@ import org.onlab.onos.store.cluster.messaging.MessageSubject;
42 import org.onlab.onos.store.impl.Timestamped; 42 import org.onlab.onos.store.impl.Timestamped;
43 import org.onlab.onos.store.serializers.DistributedStoreSerializers; 43 import org.onlab.onos.store.serializers.DistributedStoreSerializers;
44 import org.onlab.onos.store.serializers.KryoSerializer; 44 import org.onlab.onos.store.serializers.KryoSerializer;
45 -import org.onlab.packet.IpPrefix; 45 +import org.onlab.packet.IpAddress;
46 import org.onlab.packet.MacAddress; 46 import org.onlab.packet.MacAddress;
47 import org.onlab.packet.VlanId; 47 import org.onlab.packet.VlanId;
48 import org.onlab.util.KryoNamespace; 48 import org.onlab.util.KryoNamespace;
...@@ -221,7 +221,7 @@ public class GossipHostStore ...@@ -221,7 +221,7 @@ public class GossipHostStore
221 return null; 221 return null;
222 } 222 }
223 223
224 - Set<IpPrefix> addresses = new HashSet<>(host.ipAddresses()); 224 + Set<IpAddress> addresses = new HashSet<>(host.ipAddresses());
225 addresses.addAll(descr.ipAddress()); 225 addresses.addAll(descr.ipAddress());
226 StoredHost updated = new StoredHost(providerId, host.id(), 226 StoredHost updated = new StoredHost(providerId, host.id(),
227 host.mac(), host.vlan(), 227 host.mac(), host.vlan(),
...@@ -300,7 +300,7 @@ public class GossipHostStore ...@@ -300,7 +300,7 @@ public class GossipHostStore
300 } 300 }
301 301
302 @Override 302 @Override
303 - public Set<Host> getHosts(IpPrefix ip) { 303 + public Set<Host> getHosts(IpAddress ip) {
304 Set<Host> ipset = new HashSet<>(); 304 Set<Host> ipset = new HashSet<>();
305 for (Host h : hosts.values()) { 305 for (Host h : hosts.values()) {
306 if (h.ipAddresses().contains(ip)) { 306 if (h.ipAddresses().contains(ip)) {
...@@ -418,7 +418,7 @@ public class GossipHostStore ...@@ -418,7 +418,7 @@ public class GossipHostStore
418 */ 418 */
419 public StoredHost(ProviderId providerId, HostId id, 419 public StoredHost(ProviderId providerId, HostId id,
420 MacAddress mac, VlanId vlan, Timestamped<HostLocation> location, 420 MacAddress mac, VlanId vlan, Timestamped<HostLocation> location,
421 - Set<IpPrefix> ips, Annotations... annotations) { 421 + Set<IpAddress> ips, Annotations... annotations) {
422 super(providerId, id, mac, vlan, location.value(), ips, annotations); 422 super(providerId, id, mac, vlan, location.value(), ips, annotations);
423 this.location = location; 423 this.location = location;
424 } 424 }
......
...@@ -23,7 +23,7 @@ import org.onlab.onos.net.host.InterfaceIpAddress; ...@@ -23,7 +23,7 @@ import org.onlab.onos.net.host.InterfaceIpAddress;
23 import org.onlab.onos.net.host.PortAddresses; 23 import org.onlab.onos.net.host.PortAddresses;
24 import org.onlab.onos.net.provider.ProviderId; 24 import org.onlab.onos.net.provider.ProviderId;
25 import org.onlab.onos.store.AbstractStore; 25 import org.onlab.onos.store.AbstractStore;
26 -import org.onlab.packet.IpPrefix; 26 +import org.onlab.packet.IpAddress;
27 import org.onlab.packet.MacAddress; 27 import org.onlab.packet.MacAddress;
28 import org.onlab.packet.VlanId; 28 import org.onlab.packet.VlanId;
29 import org.slf4j.Logger; 29 import org.slf4j.Logger;
...@@ -106,7 +106,7 @@ public class SimpleHostStore ...@@ -106,7 +106,7 @@ public class SimpleHostStore
106 return null; 106 return null;
107 } 107 }
108 108
109 - Set<IpPrefix> addresses = new HashSet<>(host.ipAddresses()); 109 + Set<IpAddress> addresses = new HashSet<>(host.ipAddresses());
110 addresses.addAll(descr.ipAddress()); 110 addresses.addAll(descr.ipAddress());
111 StoredHost updated = new StoredHost(providerId, host.id(), 111 StoredHost updated = new StoredHost(providerId, host.id(),
112 host.mac(), host.vlan(), 112 host.mac(), host.vlan(),
...@@ -170,7 +170,7 @@ public class SimpleHostStore ...@@ -170,7 +170,7 @@ public class SimpleHostStore
170 } 170 }
171 171
172 @Override 172 @Override
173 - public Set<Host> getHosts(IpPrefix ip) { 173 + public Set<Host> getHosts(IpAddress ip) {
174 Set<Host> ipset = new HashSet<>(); 174 Set<Host> ipset = new HashSet<>();
175 for (Host h : hosts.values()) { 175 for (Host h : hosts.values()) {
176 if (h.ipAddresses().contains(ip)) { 176 if (h.ipAddresses().contains(ip)) {
...@@ -288,7 +288,7 @@ public class SimpleHostStore ...@@ -288,7 +288,7 @@ public class SimpleHostStore
288 */ 288 */
289 public StoredHost(ProviderId providerId, HostId id, 289 public StoredHost(ProviderId providerId, HostId id,
290 MacAddress mac, VlanId vlan, HostLocation location, 290 MacAddress mac, VlanId vlan, HostLocation location,
291 - Set<IpPrefix> ips, Annotations... annotations) { 291 + Set<IpAddress> ips, Annotations... annotations) {
292 super(providerId, id, mac, vlan, location, ips, annotations); 292 super(providerId, id, mac, vlan, location, ips, annotations);
293 this.location = location; 293 this.location = location;
294 } 294 }
......
...@@ -43,7 +43,7 @@ import org.onlab.onos.net.topology.Topology; ...@@ -43,7 +43,7 @@ import org.onlab.onos.net.topology.Topology;
43 import org.onlab.onos.net.topology.TopologyService; 43 import org.onlab.onos.net.topology.TopologyService;
44 import org.onlab.packet.ARP; 44 import org.onlab.packet.ARP;
45 import org.onlab.packet.Ethernet; 45 import org.onlab.packet.Ethernet;
46 -import org.onlab.packet.IpPrefix; 46 +import org.onlab.packet.IpAddress;
47 import org.onlab.packet.VlanId; 47 import org.onlab.packet.VlanId;
48 import org.slf4j.Logger; 48 import org.slf4j.Logger;
49 49
...@@ -122,8 +122,8 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid ...@@ -122,8 +122,8 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
122 // Potentially a new or moved host 122 // Potentially a new or moved host
123 if (eth.getEtherType() == Ethernet.TYPE_ARP) { 123 if (eth.getEtherType() == Ethernet.TYPE_ARP) {
124 ARP arp = (ARP) eth.getPayload(); 124 ARP arp = (ARP) eth.getPayload();
125 - IpPrefix ip = IpPrefix.valueOf(arp.getSenderProtocolAddress(), 125 + IpAddress ip =
126 - IpPrefix.MAX_INET_MASK); 126 + IpAddress.valueOf(arp.getSenderProtocolAddress());
127 HostDescription hdescr = 127 HostDescription hdescr =
128 new DefaultHostDescription(eth.getSourceMAC(), vlan, hloc, ip); 128 new DefaultHostDescription(eth.getSourceMAC(), vlan, hloc, ip);
129 providerService.hostDetected(hid, hdescr); 129 providerService.hostDetected(hid, hdescr);
......
...@@ -47,7 +47,7 @@ import org.onlab.onos.openflow.controller.PacketListener; ...@@ -47,7 +47,7 @@ import org.onlab.onos.openflow.controller.PacketListener;
47 import org.onlab.packet.ARP; 47 import org.onlab.packet.ARP;
48 import org.onlab.packet.Ethernet; 48 import org.onlab.packet.Ethernet;
49 import org.onlab.packet.IPv4; 49 import org.onlab.packet.IPv4;
50 -import org.onlab.packet.IpPrefix; 50 +import org.onlab.packet.IpAddress;
51 import org.onlab.packet.VlanId; 51 import org.onlab.packet.VlanId;
52 import org.slf4j.Logger; 52 import org.slf4j.Logger;
53 53
...@@ -128,16 +128,16 @@ public class OpenFlowHostProvider extends AbstractProvider implements HostProvid ...@@ -128,16 +128,16 @@ public class OpenFlowHostProvider extends AbstractProvider implements HostProvid
128 // Potentially a new or moved host 128 // Potentially a new or moved host
129 if (eth.getEtherType() == Ethernet.TYPE_ARP) { 129 if (eth.getEtherType() == Ethernet.TYPE_ARP) {
130 ARP arp = (ARP) eth.getPayload(); 130 ARP arp = (ARP) eth.getPayload();
131 - IpPrefix ip = IpPrefix.valueOf(arp.getSenderProtocolAddress(), 131 + IpAddress ip =
132 - IpPrefix.MAX_INET_MASK); 132 + IpAddress.valueOf(arp.getSenderProtocolAddress());
133 HostDescription hdescr = 133 HostDescription hdescr =
134 new DefaultHostDescription(eth.getSourceMAC(), vlan, hloc, ip); 134 new DefaultHostDescription(eth.getSourceMAC(), vlan, hloc, ip);
135 providerService.hostDetected(hid, hdescr); 135 providerService.hostDetected(hid, hdescr);
136 136
137 } else if (ipLearn && eth.getEtherType() == Ethernet.TYPE_IPV4) { 137 } else if (ipLearn && eth.getEtherType() == Ethernet.TYPE_IPV4) {
138 IPv4 pip = (IPv4) eth.getPayload(); 138 IPv4 pip = (IPv4) eth.getPayload();
139 - IpPrefix ip = IpPrefix.valueOf(pip.getSourceAddress(), 139 + IpAddress ip =
140 - IpPrefix.MAX_INET_MASK); 140 + IpAddress.valueOf(pip.getSourceAddress());
141 HostDescription hdescr = 141 HostDescription hdescr =
142 new DefaultHostDescription(eth.getSourceMAC(), vlan, hloc, ip); 142 new DefaultHostDescription(eth.getSourceMAC(), vlan, hloc, ip);
143 providerService.hostDetected(hid, hdescr); 143 providerService.hostDetected(hid, hdescr);
......
...@@ -43,7 +43,7 @@ import org.onlab.onos.net.link.LinkProviderRegistry; ...@@ -43,7 +43,7 @@ import org.onlab.onos.net.link.LinkProviderRegistry;
43 import org.onlab.onos.net.link.LinkProviderService; 43 import org.onlab.onos.net.link.LinkProviderService;
44 import org.onlab.onos.net.provider.ProviderId; 44 import org.onlab.onos.net.provider.ProviderId;
45 import org.onlab.packet.ChassisId; 45 import org.onlab.packet.ChassisId;
46 -import org.onlab.packet.IpPrefix; 46 +import org.onlab.packet.IpAddress;
47 import org.onlab.packet.MacAddress; 47 import org.onlab.packet.MacAddress;
48 import org.onlab.packet.VlanId; 48 import org.onlab.packet.VlanId;
49 49
...@@ -179,7 +179,7 @@ class ConfigProvider implements DeviceProvider, LinkProvider, HostProvider { ...@@ -179,7 +179,7 @@ class ConfigProvider implements DeviceProvider, LinkProvider, HostProvider {
179 HostId hostId = HostId.hostId(mac, vlanId); 179 HostId hostId = HostId.hostId(mac, vlanId);
180 SparseAnnotations annotations = annotations(node.get("annotations")); 180 SparseAnnotations annotations = annotations(node.get("annotations"));
181 HostLocation location = new HostLocation(connectPoint(get(node, "location")), 0); 181 HostLocation location = new HostLocation(connectPoint(get(node, "location")), 0);
182 - IpPrefix ip = IpPrefix.valueOf(get(node, "ip")); 182 + IpAddress ip = IpAddress.valueOf(get(node, "ip"));
183 183
184 DefaultHostDescription desc = 184 DefaultHostDescription desc =
185 new DefaultHostDescription(mac, vlanId, location, ip, annotations); 185 new DefaultHostDescription(mac, vlanId, location, ip, annotations);
......
...@@ -33,7 +33,7 @@ import org.onlab.onos.net.topology.Topology; ...@@ -33,7 +33,7 @@ import org.onlab.onos.net.topology.Topology;
33 import org.onlab.onos.net.topology.TopologyGraph; 33 import org.onlab.onos.net.topology.TopologyGraph;
34 import org.onlab.onos.net.topology.TopologyService; 34 import org.onlab.onos.net.topology.TopologyService;
35 import org.onlab.onos.net.topology.TopologyVertex; 35 import org.onlab.onos.net.topology.TopologyVertex;
36 -import org.onlab.packet.IpPrefix; 36 +import org.onlab.packet.IpAddress;
37 import org.onlab.packet.MacAddress; 37 import org.onlab.packet.MacAddress;
38 import org.onlab.rest.BaseResource; 38 import org.onlab.rest.BaseResource;
39 39
...@@ -102,8 +102,8 @@ public class TopologyResource extends BaseResource { ...@@ -102,8 +102,8 @@ public class TopologyResource extends BaseResource {
102 private ArrayNode getHosts(ObjectMapper mapper, HostService hostService) { 102 private ArrayNode getHosts(ObjectMapper mapper, HostService hostService) {
103 ArrayNode hosts = mapper.createArrayNode(); 103 ArrayNode hosts = mapper.createArrayNode();
104 for (Host host : hostService.getHosts()) { 104 for (Host host : hostService.getHosts()) {
105 - Set<IpPrefix> ipAddresses = host.ipAddresses(); 105 + Set<IpAddress> ipAddresses = host.ipAddresses();
106 - IpPrefix ipAddress = ipAddresses.isEmpty() ? null : ipAddresses.iterator().next(); 106 + IpAddress ipAddress = ipAddresses.isEmpty() ? null : ipAddresses.iterator().next();
107 String label = ipAddress != null ? ipAddress.toString() : host.mac().toString(); 107 String label = ipAddress != null ? ipAddress.toString() : host.mac().toString();
108 hosts.add(json(mapper, host)); 108 hosts.add(json(mapper, host));
109 } 109 }
...@@ -160,8 +160,8 @@ public class TopologyResource extends BaseResource { ...@@ -160,8 +160,8 @@ public class TopologyResource extends BaseResource {
160 return json; 160 return json;
161 } 161 }
162 162
163 - private String ip(Set<IpPrefix> ipPrefixes) { 163 + private String ip(Set<IpAddress> ipAddresses) {
164 - Iterator<IpPrefix> it = ipPrefixes.iterator(); 164 + Iterator<IpAddress> it = ipAddresses.iterator();
165 return it.hasNext() ? it.next().toString() : "unknown"; 165 return it.hasNext() ? it.next().toString() : "unknown";
166 } 166 }
167 167
......