Small refactoring to support new packet-out API

Change-Id: I33094045b074fc00352ec1ba62e18e690dc3f3ad
diff --git a/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java b/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java
index d3db080..77703e5 100644
--- a/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java
+++ b/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java
@@ -19,7 +19,6 @@
 import net.floodlightcontroller.core.module.IFloodlightModule;
 import net.floodlightcontroller.core.module.IFloodlightService;
 import net.floodlightcontroller.util.MACAddress;
-import net.onrc.onos.apps.proxyarp.BroadcastPacketOutNotification;
 import net.onrc.onos.apps.proxyarp.IProxyArpService;
 import net.onrc.onos.core.datagrid.IDatagridService;
 import net.onrc.onos.core.datagrid.IEventChannel;
@@ -36,6 +35,7 @@
 import net.onrc.onos.core.intent.runtime.IPathCalcRuntimeService;
 import net.onrc.onos.core.intent.runtime.IntentStateList;
 import net.onrc.onos.core.packet.Ethernet;
+import net.onrc.onos.core.packetservice.BroadcastPacketOutNotification;
 import net.onrc.onos.core.registry.IControllerRegistryService;
 import net.onrc.onos.core.topology.Device;
 import net.onrc.onos.core.topology.INetworkGraphService;
diff --git a/src/main/java/net/onrc/onos/apps/proxyarp/BroadcastPacketOutNotification.java b/src/main/java/net/onrc/onos/apps/proxyarp/BroadcastPacketOutNotification.java
deleted file mode 100644
index 5f70cf1..0000000
--- a/src/main/java/net/onrc/onos/apps/proxyarp/BroadcastPacketOutNotification.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package net.onrc.onos.apps.proxyarp;
-
-
-// TODO This class is too generic to be handled by ProxyArpService.
-// TODO The generic broadcast packet shouldn't contain an IP address which is
-// only for ARP packets.
-
-/**
- * Notification to all ONOS instances to broadcast this packet out the edge of
- * the network. The edge is defined as any port that doesn't have a link to
- * another switch. The one exception is the port that the packet was received
- * on.
- */
-public class BroadcastPacketOutNotification extends PacketOutNotification {
-
-    private static final long serialVersionUID = 1L;
-
-    private final int address;
-    private final long inSwitch;
-    private final short inPort;
-
-    protected BroadcastPacketOutNotification() {
-        super();
-        this.address = -1;
-        this.inSwitch = -1;
-        this.inPort = -1;
-    }
-
-    /**
-     * Class constructor.
-     *
-     * @param packet   packet data to send in the packet-out
-     * @param address  target IP address if the packet is an ARP packet
-     * @param inSwitch dpid of the switch the packet was received on
-     * @param inPort   port number of the receiving port
-     */
-    public BroadcastPacketOutNotification(byte[] packet, int address,
-                                          long inSwitch, short inPort) {
-        super(packet);
-
-        this.address = address;
-        this.inSwitch = inSwitch;
-        this.inPort = inPort;
-    }
-
-    /**
-     * Get the dpid of the switch the packet was received on.
-     *
-     * @return receiving switch dpid
-     */
-    public long getInSwitch() {
-        return inSwitch;
-    }
-
-    /**
-     * Get the port number of the port the packet was received on.
-     *
-     * @return receiving port number
-     */
-    public short getInPort() {
-        return inPort;
-    }
-
-    /**
-     * Get the target IP address if the packet is an ARP packet.
-     *
-     * @return the target IP address for ARP packets, or null if the packet is
-     * not an ARP packet
-     */
-    public int getTargetAddress() {
-        return address;
-    }
-}
diff --git a/src/main/java/net/onrc/onos/apps/proxyarp/PacketOutNotification.java b/src/main/java/net/onrc/onos/apps/proxyarp/PacketOutNotification.java
deleted file mode 100644
index a3cbb28..0000000
--- a/src/main/java/net/onrc/onos/apps/proxyarp/PacketOutNotification.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package net.onrc.onos.apps.proxyarp;
-
-import java.io.Serializable;
-import java.util.Arrays;
-
-/**
- * A PacketOutNotification contains data sent between ONOS instances that
- * directs other instances to send a packet out a set of ports. This is an
- * abstract base class that will be subclassed by specific types of
- * notifications.
- */
-public abstract class PacketOutNotification implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    protected final byte[] packet;
-
-    /**
-     * Class constructor.
-     *
-     * @param packet the packet data to send in the packet-out
-     */
-    public PacketOutNotification() {
-        packet = null;
-    }
-
-    public PacketOutNotification(byte[] packet) {
-        this.packet = Arrays.copyOf(packet, packet.length);
-    }
-}
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 017b260..d7e94cb 100644
--- a/src/main/java/net/onrc/onos/apps/proxyarp/ProxyArpManager.java
+++ b/src/main/java/net/onrc/onos/apps/proxyarp/ProxyArpManager.java
@@ -32,6 +32,8 @@
 import net.onrc.onos.core.packet.ARP;
 import net.onrc.onos.core.packet.Ethernet;
 import net.onrc.onos.core.packet.IPv4;
+import net.onrc.onos.core.packetservice.BroadcastPacketOutNotification;
+import net.onrc.onos.core.packetservice.SinglePacketOutNotification;
 import net.onrc.onos.core.topology.Device;
 import net.onrc.onos.core.topology.INetworkGraphService;
 import net.onrc.onos.core.topology.NetworkGraph;
@@ -94,10 +96,10 @@
         @Override
         public void entryAdded(BroadcastPacketOutNotification value) {
             if (log.isTraceEnabled()) {
-                log.trace("entryAdded ip{}, sw {}, port {}, packet {}", value.getTargetAddress(), value.getInSwitch(), value.getInPort(), value.packet.length);
+                log.trace("entryAdded ip{}, sw {}, port {}, packet {}", value.getTargetAddress(), value.getInSwitch(), value.getInPort(), value.getPacketData().length);
             }
             BroadcastPacketOutNotification notification = (BroadcastPacketOutNotification) value;
-            broadcastArpRequestOutMyEdge(notification.packet,
+            broadcastArpRequestOutMyEdge(notification.getPacketData(),
                     notification.getInSwitch(),
                     notification.getInPort());
 
@@ -139,7 +141,7 @@
             log.debug("entryAdded");
             SinglePacketOutNotification notification =
                     (SinglePacketOutNotification) packetOutNotification;
-            sendArpRequestOutPort(notification.packet,
+            sendArpRequestOutPort(notification.getPacketData(),
                     notification.getOutSwitch(),
                     notification.getOutPort());
 
diff --git a/src/main/java/net/onrc/onos/apps/proxyarp/SinglePacketOutNotification.java b/src/main/java/net/onrc/onos/apps/proxyarp/SinglePacketOutNotification.java
deleted file mode 100644
index ff5ab87..0000000
--- a/src/main/java/net/onrc/onos/apps/proxyarp/SinglePacketOutNotification.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package net.onrc.onos.apps.proxyarp;
-
-
-// TODO This class is too generic to be handled by ProxyArpService.
-
-/**
- * Notification to another ONOS instance to send a packet out a single port.
- */
-public class SinglePacketOutNotification extends PacketOutNotification {
-
-    private static final long serialVersionUID = 1L;
-
-    private final int address;
-    private final long outSwitch;
-    private final short outPort;
-
-    /**
-     * Class constructor.
-     *
-     * @param packet    the packet data to send in the packet-out
-     * @param address   target IP address if the packet is an ARP packet
-     * @param outSwitch the dpid of the switch to send the packet on
-     * @param outPort   the port number of the port to send the packet out
-     */
-    public SinglePacketOutNotification(byte[] packet, int address,
-                                       long outSwitch, short outPort) {
-        super(packet);
-
-        this.address = address;
-        this.outSwitch = outSwitch;
-        this.outPort = outPort;
-    }
-
-    /**
-     * Get the dpid of the switch the packet will be sent out.
-     *
-     * @return the switch's dpid
-     */
-    public long getOutSwitch() {
-        return outSwitch;
-    }
-
-    /**
-     * Get the port number of the port the packet will be sent out.
-     *
-     * @return the port number
-     */
-    public short getOutPort() {
-        return outPort;
-    }
-
-    /**
-     * Get the target IP address if the packet is an ARP packet.
-     *
-     * @return the target IP address for ARP packets, or null if the packet is
-     * not an ARP packet
-     */
-    public int getTargetAddress() {
-        return address;
-    }
-}