1. Added SegmentRoutingManager so that it can spawn any required objects such as ArpHandler or IcmpHandler
2. Added ArpHandler.java so that it handles any ICMP request for any known host
Change-Id: Ifd93318dc4c67fde2fce2fde04fa9df33d231e41
diff --git a/src/main/java/net/onrc/onos/core/topology/HostData.java b/src/main/java/net/onrc/onos/core/topology/HostData.java
index d799113..e790134 100644
--- a/src/main/java/net/onrc/onos/core/topology/HostData.java
+++ b/src/main/java/net/onrc/onos/core/topology/HostData.java
@@ -1,5 +1,7 @@
package net.onrc.onos.core.topology;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collections;
@@ -12,7 +14,6 @@
import net.onrc.onos.core.util.Dpid;
import net.onrc.onos.core.util.SwitchPort;
-import static com.google.common.base.Preconditions.checkNotNull;
import org.codehaus.jackson.map.annotate.JsonSerialize;
/**
@@ -22,6 +23,7 @@
public class HostData extends TopologyElement<HostData> {
private final MACAddress mac;
+ private final int ip;
private List<SwitchPort> attachmentPoints;
private long lastSeenTime;
@@ -31,6 +33,7 @@
@Deprecated
protected HostData() {
mac = null;
+ ip = 0;
}
/**
@@ -38,8 +41,9 @@
*
* @param mac the MAC address to identify the host
*/
- public HostData(MACAddress mac) {
+ public HostData(MACAddress mac, int ip) {
this.mac = checkNotNull(mac);
+ this.ip = ip;
this.attachmentPoints = new LinkedList<>();
}
@@ -53,6 +57,7 @@
public HostData(HostData original) {
super(original);
this.mac = original.mac;
+ this.ip = original.ip;
this.attachmentPoints = new ArrayList<>(original.attachmentPoints);
this.lastSeenTime = original.lastSeenTime;
}
@@ -67,6 +72,15 @@
}
/**
+ * Gets the host IP address.
+ *
+ * @return the IP address.
+ */
+ public int getIp() {
+ return ip;
+ }
+
+ /**
* Gets the switch attachment points.
*
* @return the switch attachment points
@@ -185,11 +199,12 @@
HostData other = (HostData) o;
// XXX lastSeenTime excluded from Equality condition, is it OK?
return Objects.equals(mac, other.mac) &&
+ ip == other.ip &&
Objects.equals(this.attachmentPoints, other.attachmentPoints);
}
@Override
public String toString() {
- return "[HostData " + mac + " attachmentPoints:" + attachmentPoints + "]";
+ return "[HostData " + mac + "(ip:" + ip + ")" + " attachmentPoints:" + attachmentPoints + "]";
}
}