Change for the way to learn IP and MAC binding.
ProxyArpManager has not done unit tests because the codes will be changed soon by another Jono's fix.
Change-Id: I0cf45aa328871497db522c531dcef999156c2d55
diff --git a/src/main/java/net/onrc/onos/core/datastore/KVArpCache.java b/src/main/java/net/onrc/onos/core/datastore/KVArpCache.java
new file mode 100644
index 0000000..01e0587
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/datastore/KVArpCache.java
@@ -0,0 +1,54 @@
+package net.onrc.onos.core.datastore;
+
+import java.net.InetAddress;
+
+import net.onrc.onos.core.datastore.IKVTable.IKVEntry;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class KVArpCache {
+
+ private static final Logger log = LoggerFactory.getLogger(KVArpCache.class);
+
+ private static final String GLOBAL_ARPCACHE_TABLE_NAME = "arp_cache";
+ private final IKVTable table;
+
+ public long getVersionNonexistant() {
+ return table.getVersionNonexistant();
+ }
+
+ public KVArpCache() {
+ table = DataStoreClient.getClient().getTable(GLOBAL_ARPCACHE_TABLE_NAME);
+ log.debug("create table {}", table.getTableId());
+ }
+
+ public void dropArpCache() {
+ DataStoreClient.getClient().dropTable(table);
+ log.debug("drop table {}", table.getTableId());
+ }
+
+ public long create(InetAddress ip, byte[] mac) throws ObjectExistsException {
+ return table.create(ip.getAddress(), mac);
+ }
+
+ public long forceCreate(InetAddress ip, byte[] mac) {
+ return table.forceCreate(ip.getAddress(), mac);
+ }
+
+ public IKVEntry read(InetAddress ip) throws ObjectDoesntExistException {
+ return table.read(ip.getAddress());
+ }
+
+ public long update(InetAddress ip, byte[] mac) throws ObjectDoesntExistException {
+ return table.update(ip.getAddress(), mac);
+ }
+
+ public long forceDelete(InetAddress ip) {
+ return table.forceDelete(ip.getAddress());
+ }
+
+ public Iterable<IKVEntry> getAllEntries() {
+ return table.getAllEntries();
+ }
+}
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/KryoFactory.java b/src/main/java/net/onrc/onos/core/util/serializers/KryoFactory.java
index e229d30..d1794d1 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/KryoFactory.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/KryoFactory.java
@@ -7,6 +7,7 @@
import java.util.HashSet;
import net.floodlightcontroller.util.MACAddress;
+import net.onrc.onos.apps.proxyarp.ArpCacheNotification;
import net.onrc.onos.apps.proxyarp.ArpReplyNotification;
import net.onrc.onos.core.devicemanager.OnosDevice;
import net.onrc.onos.core.intent.ConstrainedShortestPathIntent;
@@ -219,6 +220,7 @@
kryo.register(BroadcastPacketOutNotification.class);
kryo.register(SinglePacketOutNotification.class);
kryo.register(ArpReplyNotification.class);
+ kryo.register(ArpCacheNotification.class);
return kryo;
}