blob: ab9a9b5fa2cd7d8fc72e0a58e28efcddb9bcd410 [file] [log] [blame]
Jonathan Hart7804bea2014-01-07 10:50:52 -08001package net.onrc.onos.ofcontroller.proxyarp;
2
Naoki Shiota78e403c2014-02-20 17:13:36 -08003import java.net.InetAddress;
4
5// TODO This class is too generic to be handled by ProxyArpService.
Jonathan Hart7804bea2014-01-07 10:50:52 -08006/**
7 * Notification to another ONOS instance to send a packet out a single port.
Jonathan Hart7804bea2014-01-07 10:50:52 -08008 */
9public class SinglePacketOutNotification extends PacketOutNotification {
10
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070011 private static final long serialVersionUID = 1L;
Jonathan Hart7804bea2014-01-07 10:50:52 -080012
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070013 private final InetAddress address;
14 private final long outSwitch;
15 private final short outPort;
Jonathan Hart7804bea2014-01-07 10:50:52 -080016
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070017 /**
18 * Class constructor.
19 * @param packet the packet data to send in the packet-out
20 * @param address target IP address if the packet is an ARP packet
21 * @param outSwitch the dpid of the switch to send the packet on
22 * @param outPort the port number of the port to send the packet out
23 */
24 public SinglePacketOutNotification(byte[] packet, InetAddress address,
25 long outSwitch, short outPort) {
26 super(packet);
Jonathan Hart7804bea2014-01-07 10:50:52 -080027
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070028 this.address = address;
29 this.outSwitch = outSwitch;
30 this.outPort = outPort;
31 }
32
33 /**
34 * Get the dpid of the switch the packet will be sent out.
35 * @return the switch's dpid
36 */
37 public long getOutSwitch() {
38 return outSwitch;
39 }
40
41 /**
42 * Get the port number of the port the packet will be sent out.
43 * @return the port number
44 */
45 public short getOutPort() {
46 return outPort;
47 }
48
49 /**
50 * Get the target IP address if the packet is an ARP packet.
51 * @return the target IP address for ARP packets, or null if the packet is
52 * not an ARP packet
53 */
54 public InetAddress getTargetAddress() {
55 return address;
56 }
Jonathan Hart7804bea2014-01-07 10:50:52 -080057}