blob: 62d808670944f14776ff1c60db7bc13d60d6ab2e [file] [log] [blame]
Jonathan Hart7804bea2014-01-07 10:50:52 -08001package net.onrc.onos.ofcontroller.proxyarp;
2
TeruU7feef8a2014-04-03 00:15:49 -07003
Naoki Shiota78e403c2014-02-20 17:13:36 -08004
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
TeruU7feef8a2014-04-03 00:15:49 -070013 private final int address;
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070014 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 */
TeruU7feef8a2014-04-03 00:15:49 -070024 public SinglePacketOutNotification(byte[] packet, int address,
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070025 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 */
TeruU7feef8a2014-04-03 00:15:49 -070054 public int getTargetAddress() {
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070055 return address;
56 }
Jonathan Hart7804bea2014-01-07 10:50:52 -080057}