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/core/net/src/test/java/org/onlab/onos/net/host/impl/HostMonitorTest.java b/core/net/src/test/java/org/onlab/onos/net/host/impl/HostMonitorTest.java
index 4b9d214..df211fb 100644
--- a/core/net/src/test/java/org/onlab/onos/net/host/impl/HostMonitorTest.java
+++ b/core/net/src/test/java/org/onlab/onos/net/host/impl/HostMonitorTest.java
@@ -46,9 +46,8 @@
public class HostMonitorTest {
- private IpAddress targetIpAddress = IpAddress.valueOf("10.0.0.1");
- private IpPrefix targetIpPrefix = IpPrefix.valueOf(targetIpAddress.toOctets());
-
+ private static final IpAddress TARGET_IP_ADDR =
+ IpAddress.valueOf("10.0.0.1");
private static final IpAddress SOURCE_ADDR =
IpAddress.valueOf("10.0.0.99");
private static final InterfaceIpAddress IA1 =
@@ -71,7 +70,7 @@
replay(host);
HostManager hostManager = createMock(HostManager.class);
- expect(hostManager.getHostsByIp(targetIpPrefix))
+ expect(hostManager.getHostsByIp(TARGET_IP_ADDR))
.andReturn(Collections.singleton(host));
replay(hostManager);
@@ -84,7 +83,7 @@
hostMonitor = new HostMonitor(null, null, hostManager);
hostMonitor.registerHostProvider(hostProvider);
- hostMonitor.addMonitoringFor(targetIpAddress);
+ hostMonitor.addMonitoringFor(TARGET_IP_ADDR);
hostMonitor.run(null);
@@ -115,7 +114,7 @@
PortAddresses pa =
new PortAddresses(cp, Collections.singleton(IA1), sourceMac);
- expect(hostManager.getHostsByIp(targetIpPrefix))
+ expect(hostManager.getHostsByIp(TARGET_IP_ADDR))
.andReturn(Collections.<Host>emptySet()).anyTimes();
expect(hostManager.getAddressBindingsForPort(cp))
.andReturn(pa).anyTimes();
@@ -127,7 +126,7 @@
// Run the test
hostMonitor = new HostMonitor(deviceService, packetService, hostManager);
- hostMonitor.addMonitoringFor(targetIpAddress);
+ hostMonitor.addMonitoringFor(TARGET_IP_ADDR);
hostMonitor.run(null);
@@ -150,7 +149,8 @@
assertTrue(Arrays.equals(arp.getSenderProtocolAddress(),
SOURCE_ADDR.toOctets()));
assertTrue(Arrays.equals(arp.getSenderHardwareAddress(), sourceMac.toBytes()));
- assertTrue(Arrays.equals(arp.getTargetProtocolAddress(), targetIpPrefix.toOctets()));
+ assertTrue(Arrays.equals(arp.getTargetProtocolAddress(),
+ TARGET_IP_ADDR.toOctets()));
}
class TestPacketService implements PacketService {