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/main/java/org/onlab/onos/net/host/impl/HostManager.java b/core/net/src/main/java/org/onlab/onos/net/host/impl/HostManager.java
index 4f9bcbb..e4d158d 100644
--- a/core/net/src/main/java/org/onlab/onos/net/host/impl/HostManager.java
+++ b/core/net/src/main/java/org/onlab/onos/net/host/impl/HostManager.java
@@ -33,7 +33,6 @@
import org.onlab.onos.net.provider.AbstractProviderRegistry;
import org.onlab.onos.net.provider.AbstractProviderService;
import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
import org.slf4j.Logger;
@@ -121,7 +120,7 @@
}
@Override
- public Set<Host> getHostsByIp(IpPrefix ip) {
+ public Set<Host> getHostsByIp(IpAddress ip) {
checkNotNull(ip, "IP address cannot be null");
return store.getHosts(ip);
}
diff --git a/core/net/src/main/java/org/onlab/onos/net/host/impl/HostMonitor.java b/core/net/src/main/java/org/onlab/onos/net/host/impl/HostMonitor.java
index a624c07..e92440f 100644
--- a/core/net/src/main/java/org/onlab/onos/net/host/impl/HostMonitor.java
+++ b/core/net/src/main/java/org/onlab/onos/net/host/impl/HostMonitor.java
@@ -129,10 +129,7 @@
@Override
public void run(Timeout timeout) throws Exception {
for (IpAddress ip : monitoredAddresses) {
- // TODO have to convert right now because the HostService API uses IpPrefix
- IpPrefix prefix = IpPrefix.valueOf(ip.toOctets());
-
- Set<Host> hosts = hostManager.getHostsByIp(prefix);
+ Set<Host> hosts = hostManager.getHostsByIp(ip);
if (hosts.isEmpty()) {
sendArpRequest(ip);
diff --git a/core/net/src/main/java/org/onlab/onos/net/proxyarp/impl/ProxyArpManager.java b/core/net/src/main/java/org/onlab/onos/net/proxyarp/impl/ProxyArpManager.java
index 735c109..3ba1c8a 100644
--- a/core/net/src/main/java/org/onlab/onos/net/proxyarp/impl/ProxyArpManager.java
+++ b/core/net/src/main/java/org/onlab/onos/net/proxyarp/impl/ProxyArpManager.java
@@ -99,7 +99,7 @@
}
@Override
- public boolean known(IpPrefix addr) {
+ public boolean known(IpAddress addr) {
checkNotNull(addr, MAC_ADDR_NULL);
Set<Host> hosts = hostService.getHostsByIp(addr);
return !hosts.isEmpty();
@@ -150,7 +150,7 @@
// Continue with normal proxy ARP case
VlanId vlan = VlanId.vlanId(eth.getVlanID());
- Set<Host> hosts = hostService.getHostsByIp(IpPrefix.valueOf(arp
+ Set<Host> hosts = hostService.getHostsByIp(IpAddress.valueOf(arp
.getTargetProtocolAddress()));
Host dst = null;
@@ -170,8 +170,7 @@
}
// TODO find the correct IP address
- IpAddress ipAddress =
- dst.ipAddresses().iterator().next().toIpAddress();
+ IpAddress ipAddress = dst.ipAddresses().iterator().next();
Ethernet arpReply = buildArpReply(ipAddress, dst.mac(), eth);
// TODO: check send status with host service.
sendTo(arpReply, src.location());