Implemented ARP reply notifications when a new device is written to the database. Created an ArpMessage class which is the object put into hazelcast for both requests and replies
diff --git a/src/main/java/net/onrc/onos/datagrid/HazelcastDatagrid.java b/src/main/java/net/onrc/onos/datagrid/HazelcastDatagrid.java
index 04e001e..180cbe9 100644
--- a/src/main/java/net/onrc/onos/datagrid/HazelcastDatagrid.java
+++ b/src/main/java/net/onrc/onos/datagrid/HazelcastDatagrid.java
@@ -18,6 +18,7 @@
import net.floodlightcontroller.restserver.IRestApiService;
import net.onrc.onos.datagrid.web.DatagridWebRoutable;
import net.onrc.onos.ofcontroller.flowmanager.IFlowEventHandlerService;
+import net.onrc.onos.ofcontroller.proxyarp.ArpMessage;
import net.onrc.onos.ofcontroller.proxyarp.IArpEventHandler;
import net.onrc.onos.ofcontroller.topology.TopologyElement;
import net.onrc.onos.ofcontroller.util.FlowEntry;
@@ -81,7 +82,7 @@
// State related to the ARP map
protected static final String arpMapName = "arpMap";
- private IMap<byte[], byte[]> arpMap = null;
+ private IMap<ArpMessage, byte[]> arpMap = null;
private List<IArpEventHandler> arpEventHandlers = new ArrayList<IArpEventHandler>();
private final byte[] dummyByte = {0};
@@ -338,13 +339,13 @@
* - Key: Request ID (String)
* - Value: ARP request packet (byte[])
*/
- class ArpMapListener implements EntryListener<byte[], byte[]> {
+ class ArpMapListener implements EntryListener<ArpMessage, byte[]> {
/**
* Receive a notification that an entry is added.
*
* @param event the notification event for the entry.
*/
- public void entryAdded(EntryEvent<byte[], byte[]> event) {
+ public void entryAdded(EntryEvent<ArpMessage, byte[]> event) {
for (IArpEventHandler arpEventHandler : arpEventHandlers) {
arpEventHandler.arpRequestNotification(event.getKey());
}
@@ -367,7 +368,7 @@
*
* @param event the notification event for the entry.
*/
- public void entryRemoved(EntryEvent<byte[], byte[]> event) {
+ public void entryRemoved(EntryEvent<ArpMessage, byte[]> event) {
// Not used
}
@@ -376,7 +377,7 @@
*
* @param event the notification event for the entry.
*/
- public void entryUpdated(EntryEvent<byte[], byte[]> event) {
+ public void entryUpdated(EntryEvent<ArpMessage, byte[]> event) {
// Not used
}
@@ -385,7 +386,7 @@
*
* @param event the notification event for the entry.
*/
- public void entryEvicted(EntryEvent<byte[], byte[]> event) {
+ public void entryEvicted(EntryEvent<ArpMessage, byte[]> event) {
// Not used
}
}
@@ -866,8 +867,8 @@
}
@Override
- public void sendArpRequest(byte[] arpRequest) {
- log.debug("ARP bytes: {}", HexString.toHexString(arpRequest));
- arpMap.putAsync(arpRequest, dummyByte, 1L, TimeUnit.MILLISECONDS);
+ public void sendArpRequest(ArpMessage arpMessage) {
+ //log.debug("ARP bytes: {}", HexString.toHexString(arpRequest));
+ arpMap.putAsync(arpMessage, dummyByte, 1L, TimeUnit.MILLISECONDS);
}
}
diff --git a/src/main/java/net/onrc/onos/datagrid/IDatagridService.java b/src/main/java/net/onrc/onos/datagrid/IDatagridService.java
index 3f40480..9361341 100644
--- a/src/main/java/net/onrc/onos/datagrid/IDatagridService.java
+++ b/src/main/java/net/onrc/onos/datagrid/IDatagridService.java
@@ -4,6 +4,7 @@
import net.floodlightcontroller.core.module.IFloodlightService;
import net.onrc.onos.ofcontroller.flowmanager.IFlowEventHandlerService;
+import net.onrc.onos.ofcontroller.proxyarp.ArpMessage;
import net.onrc.onos.ofcontroller.proxyarp.IArpEventHandler;
import net.onrc.onos.ofcontroller.topology.TopologyElement;
import net.onrc.onos.ofcontroller.util.FlowEntry;
@@ -153,5 +154,5 @@
* Send an ARP request to other ONOS instances
* @param arpRequest The request packet to send
*/
- public void sendArpRequest(byte[] arpRequest);
+ public void sendArpRequest(ArpMessage arpMessage);
}