Fixed variable names and javadoc left over from old code, and removed the ArpMessage class
diff --git a/src/main/java/net/onrc/onos/datagrid/HazelcastDatagrid.java b/src/main/java/net/onrc/onos/datagrid/HazelcastDatagrid.java
index 7677ee8..0c7be88 100644
--- a/src/main/java/net/onrc/onos/datagrid/HazelcastDatagrid.java
+++ b/src/main/java/net/onrc/onos/datagrid/HazelcastDatagrid.java
@@ -577,15 +577,15 @@
}
@Override
- public void registerPacketOutEventHandler(IPacketOutEventHandler arpEventHandler) {
- if (arpEventHandler != null) {
- packetOutEventHandlers.add(arpEventHandler);
+ public void registerPacketOutEventHandler(IPacketOutEventHandler packetOutEventHandler) {
+ if (packetOutEventHandler != null) {
+ packetOutEventHandlers.add(packetOutEventHandler);
}
}
@Override
- public void deregisterPacketOutEventHandler(IPacketOutEventHandler arpEventHandler) {
- packetOutEventHandlers.remove(arpEventHandler);
+ public void deregisterPacketOutEventHandler(IPacketOutEventHandler packetOutEventHandler) {
+ packetOutEventHandlers.remove(packetOutEventHandler);
}
@Override
diff --git a/src/main/java/net/onrc/onos/datagrid/IDatagridService.java b/src/main/java/net/onrc/onos/datagrid/IDatagridService.java
index 90fe57c..1478129 100644
--- a/src/main/java/net/onrc/onos/datagrid/IDatagridService.java
+++ b/src/main/java/net/onrc/onos/datagrid/IDatagridService.java
@@ -40,21 +40,31 @@
void deregisterFlowEventHandlerService(IFlowEventHandlerService flowEventHandlerService);
/**
- * Register event handler for ARP events.
+ * Register event handler for packet-out events.
*
- * @param arpEventHandler The ARP event handler to register.
+ * @param packetOutEventHandler The packet-out event handler to register.
*/
- public void registerPacketOutEventHandler(IPacketOutEventHandler arpEventHandler);
+ public void registerPacketOutEventHandler(IPacketOutEventHandler packetOutEventHandler);
/**
- * De-register event handler service for ARP events.
+ * Deregister event handler service for packet-out events.
*
- * @param arpEventHandler The ARP event handler to de-register.
+ * @param packetOutEventHandler The packet-out event handler to deregister.
*/
- public void deregisterPacketOutEventHandler(IPacketOutEventHandler arpEventHandler);
+ public void deregisterPacketOutEventHandler(IPacketOutEventHandler packetOutEventHandler);
+ /**
+ * Register event handler for ARP reply events.
+ *
+ * @param packetOutEventHandler The ARP reply event handler to register.
+ */
public void registerArpReplyEventHandler(IArpReplyEventHandler arpReplyEventHandler);
+ /**
+ * Deregister event handler service for ARP reply events.
+ *
+ * @param packetOutEventHandler The ARP reply event handler to deregister.
+ */
public void deregisterArpReplyEventHandler(IArpReplyEventHandler arpReplyEventHandler);
/**
diff --git a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ArpMessage.java b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ArpMessage.java
deleted file mode 100644
index 44b9ea0..0000000
--- a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ArpMessage.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package net.onrc.onos.ofcontroller.proxyarp;
-
-import java.io.Serializable;
-import java.net.InetAddress;
-import net.floodlightcontroller.util.MACAddress;
-
-// TODO This is getting very messy!!! Needs refactoring
-public class ArpMessage implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private final Type type;
- private final InetAddress forAddress;
- private final byte[] packetData;
-
- // ARP reply message needs MAC info
- private final MACAddress mac;
- // Only send the ARP request message to the device attachment needs the
- // attachment switch and port.
- private final long outSwitch;
- private final short outPort;
-
- private final long inSwitch;
- private final short inPort;
-
- public enum Type {
- REQUEST,
- REPLY
- }
-
- private ArpMessage(Type type, InetAddress address, byte[] eth,
- long outSwitch, short outPort, long inSwitch, short inPort) {
- this.type = type;
- this.forAddress = address;
- this.packetData = eth;
- this.mac = null;
- this.outSwitch = -1;
- this.outPort = -1;
- this.inSwitch = inSwitch;
- this.inPort = inPort;
- }
-
- private ArpMessage(Type type, InetAddress address) {
- this.type = type;
- this.forAddress = address;
- this.packetData = null;
- this.mac = null;
- this.outSwitch = -1;
- this.outPort = -1;
-
- this.inSwitch = -1;
- this.inPort = -1;
- }
- // the ARP reply message with MAC
- private ArpMessage(Type type, InetAddress address, MACAddress mac) {
- this.type = type;
- this.forAddress = address;
- this.packetData = null;
- this.mac = mac;
- this.outSwitch = -1;
- this.outPort = -1;
-
- this.inSwitch = -1;
- this.inPort = -1;
- }
-
- // construct ARP request message with attachment switch and port
- private ArpMessage(Type type, InetAddress address, byte[] arpRequest,
- long outSwitch, short outPort) {
- this.type = type;
- this.forAddress = address;
- this.packetData = arpRequest;
- this.mac = null;
- this.outSwitch = outSwitch;
- this.outPort = outPort;
-
- this.inSwitch = -1;
- this.inPort = -1;
- }
-
- // TODO Awful quick fix - caller has to supply dummy outSwitch and outPort
- public static ArpMessage newRequest(InetAddress forAddress, byte[] arpRequest,
- long outSwitch, short outPort, long inSwitch, short inPort) {
- return new ArpMessage(Type.REQUEST, forAddress, arpRequest,
- outSwitch, outPort, inSwitch, inPort);
- }
-
- public static ArpMessage newReply(InetAddress forAddress) {
- return new ArpMessage(Type.REPLY, forAddress);
- }
-
- //ARP reply message with MAC
- public static ArpMessage newReply(InetAddress forAddress, MACAddress mac) {
- return new ArpMessage(Type.REPLY, forAddress, mac);
- }
-
- //ARP request message with attachment switch and port
- public static ArpMessage newRequest(InetAddress forAddress,
- byte[] arpRequest, long outSwitch, short outPort ) {
- return new ArpMessage(Type.REQUEST, forAddress, arpRequest, outSwitch,
- outPort);
- }
-
- public Type getType() {
- return type;
- }
-
- public InetAddress getAddress() {
- return forAddress;
- }
-
- public byte[] getPacket() {
- return packetData;
- }
-
- public MACAddress getMAC() {
- return mac;
- }
-
- public long getOutSwitch() {
- return outSwitch;
- }
-
- public short getOutPort() {
- return outPort;
- }
-
- public long getInSwitch() {
- return inSwitch;
- }
-
- public short getInPort() {
- return inPort;
- }
-}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
index 70533b0..ac99678 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
@@ -296,7 +296,7 @@
}
else if (arp.getOpCode() == ARP.OP_REPLY) {
handleArpReply(sw, pi, arp);
- sendReplyNotification(eth, pi);
+ sendArpReplyNotification(eth, pi);
}
// Stop ARP packets here
@@ -532,7 +532,7 @@
}
}
- private void sendReplyNotification(Ethernet eth, OFPacketIn pi) {
+ private void sendArpReplyNotification(Ethernet eth, OFPacketIn pi) {
ARP arp = (ARP) eth.getPayload();
if (log.isTraceEnabled()) {
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/KryoFactory.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/KryoFactory.java
index 1355fe0..883f830 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/KryoFactory.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/KryoFactory.java
@@ -4,7 +4,6 @@
import java.util.TreeMap;
import net.floodlightcontroller.util.MACAddress;
-import net.onrc.onos.ofcontroller.proxyarp.ArpMessage;
import net.onrc.onos.ofcontroller.topology.TopologyElement;
import net.onrc.onos.ofcontroller.util.CallerId;
import net.onrc.onos.ofcontroller.util.DataPath;
@@ -152,9 +151,6 @@
kryo.register(TopologyElement.class);
kryo.register(TopologyElement.Type.class);
kryo.register(TreeMap.class);
-
- //ARP message
- kryo.register(ArpMessage.class);
return kryo;
}