Added unit tests and some minor changes for ProxyArp.
Change-Id: I027919c331575ba57b3d342683d73e1c31284810
diff --git a/src/main/java/net/onrc/onos/apps/proxyarp/ArpCache.java b/src/main/java/net/onrc/onos/apps/proxyarp/ArpCache.java
index 38cd41f..6216f59 100644
--- a/src/main/java/net/onrc/onos/apps/proxyarp/ArpCache.java
+++ b/src/main/java/net/onrc/onos/apps/proxyarp/ArpCache.java
@@ -95,6 +95,10 @@
log.debug("Set arpEntryTimeoutConfig {}", ArpCache.arpEntryTimeoutConfig);
}
+ public long getArpEntryTimeout() {
+ return ArpCache.arpEntryTimeoutConfig;
+ }
+
/**
* Get the MAC address that is mapped to an IP address in the ARP cache.
*
diff --git a/src/main/java/net/onrc/onos/apps/proxyarp/ProxyArpManager.java b/src/main/java/net/onrc/onos/apps/proxyarp/ProxyArpManager.java
index c1f80d8..f026745 100644
--- a/src/main/java/net/onrc/onos/apps/proxyarp/ProxyArpManager.java
+++ b/src/main/java/net/onrc/onos/apps/proxyarp/ProxyArpManager.java
@@ -260,14 +260,6 @@
this.onosDeviceService = context.getServiceImpl(IOnosDeviceService.class);
this.packetService = context.getServiceImpl(IPacketService.class);
- Map<String, String> configOptions = context.getConfigParams(this);
-
- try {
- arpCleaningTimerPeriodConfig = Long.parseLong(configOptions.get("cleanupmsec"));
- } catch (NumberFormatException e) {
- log.debug("ArpCleaningTimerPeriod related config options were not set. Use default.");
- }
-
arpRequests = Multimaps.synchronizedSetMultimap(HashMultimap
.<InetAddress, ArpRequest>create());
}
@@ -276,6 +268,12 @@
public void startUp(FloodlightModuleContext context) {
Map<String, String> configOptions = context.getConfigParams(this);
+ try {
+ arpCleaningTimerPeriodConfig = Long.parseLong(configOptions.get("cleanupmsec"));
+ } catch (NumberFormatException e) {
+ log.debug("ArpCleaningTimerPeriod related config options were not set. Use default.");
+ }
+
Long agingmsec = null;
try {
agingmsec = Long.parseLong(configOptions.get("agingmsec"));
@@ -393,6 +391,7 @@
@Override
public void receive(Switch sw, Port inPort, Ethernet eth) {
+
if (eth.getEtherType() == Ethernet.TYPE_ARP) {
ARP arp = (ARP) eth.getPayload();
learnArp(arp);
@@ -700,7 +699,7 @@
@Override
public List<String> getMappings() {
- return new ArrayList<String>();
+ return arpCache.getMappings();
}
private void sendArpReplyToWaitingRequesters(InetAddress address,
@@ -737,4 +736,12 @@
arpCacheEventChannel.removeEntry(expireIp.toString());
}
}
+
+ public long getArpEntryTimeout() {
+ return arpCache.getArpEntryTimeout();
+ }
+
+ public long getArpCleaningTimerPeriod() {
+ return arpCleaningTimerPeriodConfig;
+ }
}