Replaced IpPrefix and IpAddress in the following methods
and cleanup related code:
- Host.ipAddresses()
- DefaultHost.ipAddresses()
- HostDescription.ipAddress()
- DefaultHostDescription.ipAddress()
- HostService.getHostsByIp()
- HostManager.getHostsByIp()
- HostStore.getHosts()
- GossipHostStore.getHosts()
- SimpleHostStore.getHosts()
- ProxyArpService.known()
- ProxyArpManager.known()
As a result of the above cleanup, the "hosts" CLI command outputs
the IP addresses as "1.2.3.4" instead of "1.2.3.4/32".
Also, the following REST calls might be affected as well with
the above format replacement:
- REST POST: config/topology
- REST GET: topology/graph
diff --git a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/Router.java b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/Router.java
index 0907cd6..4e3415b 100644
--- a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/Router.java
+++ b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/Router.java
@@ -520,8 +520,7 @@
// See if we know the MAC address of the next hop
MacAddress nextHopMacAddress = null;
- Set<Host> hosts = hostService.getHostsByIp(
- routeEntry.nextHop().toPrefix());
+ Set<Host> hosts = hostService.getHostsByIp(routeEntry.nextHop());
if (!hosts.isEmpty()) {
// TODO how to handle if multiple hosts are returned?
nextHopMacAddress = hosts.iterator().next().mac();
@@ -773,8 +772,8 @@
if (event.type() == HostEvent.Type.HOST_ADDED ||
event.type() == HostEvent.Type.HOST_UPDATED) {
Host host = event.subject();
- for (IpPrefix ip : host.ipAddresses()) {
- updateMac(ip.toIpAddress(), host.mac());
+ for (IpAddress ip : host.ipAddresses()) {
+ updateMac(ip, host.mac());
}
}
}
diff --git a/apps/sdnip/src/test/java/org/onlab/onos/sdnip/RouterTest.java b/apps/sdnip/src/test/java/org/onlab/onos/sdnip/RouterTest.java
index 13547ae..7bc9473 100644
--- a/apps/sdnip/src/test/java/org/onlab/onos/sdnip/RouterTest.java
+++ b/apps/sdnip/src/test/java/org/onlab/onos/sdnip/RouterTest.java
@@ -197,27 +197,27 @@
hostService.addListener(anyObject(HostListener.class));
expectLastCall().anyTimes();
- IpPrefix host1Address = IpPrefix.valueOf("192.168.10.1/32");
+ IpAddress host1Address = IpAddress.valueOf("192.168.10.1");
Host host1 = new DefaultHost(ProviderId.NONE, HostId.NONE,
MacAddress.valueOf("00:00:00:00:00:01"), VlanId.NONE,
new HostLocation(SW1_ETH1, 1),
- Sets.newHashSet(host1Address));
+ Sets.newHashSet(host1Address));
expect(hostService.getHostsByIp(host1Address))
.andReturn(Sets.newHashSet(host1)).anyTimes();
- hostService.startMonitoringIp(host1Address.toIpAddress());
+ hostService.startMonitoringIp(host1Address);
expectLastCall().anyTimes();
- IpPrefix host2Address = IpPrefix.valueOf("192.168.20.1/32");
+ IpAddress host2Address = IpAddress.valueOf("192.168.20.1");
Host host2 = new DefaultHost(ProviderId.NONE, HostId.NONE,
MacAddress.valueOf("00:00:00:00:00:02"), VlanId.NONE,
new HostLocation(SW2_ETH1, 1),
- Sets.newHashSet(host2Address));
+ Sets.newHashSet(host2Address));
expect(hostService.getHostsByIp(host2Address))
.andReturn(Sets.newHashSet(host2)).anyTimes();
- hostService.startMonitoringIp(host2Address.toIpAddress());
+ hostService.startMonitoringIp(host2Address);
expectLastCall().anyTimes();
diff --git a/apps/sdnip/src/test/java/org/onlab/onos/sdnip/RouterTestWithAsyncArp.java b/apps/sdnip/src/test/java/org/onlab/onos/sdnip/RouterTestWithAsyncArp.java
index c2e2019..d1c8b2a 100644
--- a/apps/sdnip/src/test/java/org/onlab/onos/sdnip/RouterTestWithAsyncArp.java
+++ b/apps/sdnip/src/test/java/org/onlab/onos/sdnip/RouterTestWithAsyncArp.java
@@ -184,7 +184,7 @@
// Set up test expectation
reset(hostService);
- expect(hostService.getHostsByIp(anyObject(IpPrefix.class))).andReturn(
+ expect(hostService.getHostsByIp(anyObject(IpAddress.class))).andReturn(
new HashSet<Host>()).anyTimes();
hostService.startMonitoringIp(IpAddress.valueOf("192.168.10.1"));
replay(hostService);
@@ -203,7 +203,7 @@
new HostLocation(
SW1_ETH1.deviceId(),
SW1_ETH1.port(), 1),
- Sets.newHashSet(IpPrefix.valueOf("192.168.10.1/32")));
+ Sets.newHashSet(IpAddress.valueOf("192.168.10.1")));
internalHostListener.event(
new HostEvent(HostEvent.Type.HOST_ADDED, host));
@@ -266,7 +266,7 @@
// Set up test expectation
reset(hostService);
- expect(hostService.getHostsByIp(anyObject(IpPrefix.class))).andReturn(
+ expect(hostService.getHostsByIp(anyObject(IpAddress.class))).andReturn(
new HashSet<Host>()).anyTimes();
hostService.startMonitoringIp(IpAddress.valueOf("192.168.20.1"));
replay(hostService);
@@ -286,7 +286,7 @@
new HostLocation(
SW2_ETH1.deviceId(),
SW2_ETH1.port(), 1),
- Sets.newHashSet(IpPrefix.valueOf("192.168.20.1/32")));
+ Sets.newHashSet(IpAddress.valueOf("192.168.20.1")));
internalHostListener.event(
new HostEvent(HostEvent.Type.HOST_ADDED, host));