blob: ff5ab87fcffb39b806bf866c2e4ff7fe8970d1c0 [file] [log] [blame]
Jonathan Hart0961fe82014-04-03 09:56:25 -07001package net.onrc.onos.apps.proxyarp;
Jonathan Hart7804bea2014-01-07 10:50:52 -08002
TeruU7feef8a2014-04-03 00:15:49 -07003
Naoki Shiota78e403c2014-02-20 17:13:36 -08004// TODO This class is too generic to be handled by ProxyArpService.
Ray Milkey269ffb92014-04-03 14:43:30 -07005
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.
Ray Milkey269ffb92014-04-03 14:43:30 -070019 *
20 * @param packet the packet data to send in the packet-out
21 * @param address target IP address if the packet is an ARP packet
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070022 * @param outSwitch the dpid of the switch to send the packet on
Ray Milkey269ffb92014-04-03 14:43:30 -070023 * @param outPort the port number of the port to send the packet out
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070024 */
TeruU7feef8a2014-04-03 00:15:49 -070025 public SinglePacketOutNotification(byte[] packet, int address,
Ray Milkey269ffb92014-04-03 14:43:30 -070026 long outSwitch, short outPort) {
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070027 super(packet);
Jonathan Hart7804bea2014-01-07 10:50:52 -080028
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070029 this.address = address;
30 this.outSwitch = outSwitch;
31 this.outPort = outPort;
32 }
33
34 /**
35 * Get the dpid of the switch the packet will be sent out.
Ray Milkey269ffb92014-04-03 14:43:30 -070036 *
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070037 * @return the switch's dpid
38 */
39 public long getOutSwitch() {
40 return outSwitch;
41 }
42
43 /**
44 * Get the port number of the port the packet will be sent out.
Ray Milkey269ffb92014-04-03 14:43:30 -070045 *
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070046 * @return the port number
47 */
48 public short getOutPort() {
49 return outPort;
50 }
51
52 /**
53 * Get the target IP address if the packet is an ARP packet.
Ray Milkey269ffb92014-04-03 14:43:30 -070054 *
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070055 * @return the target IP address for ARP packets, or null if the packet is
Ray Milkey269ffb92014-04-03 14:43:30 -070056 * not an ARP packet
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070057 */
TeruU7feef8a2014-04-03 00:15:49 -070058 public int getTargetAddress() {
Jonathan Hart7c9a2fb2014-03-27 09:51:41 -070059 return address;
60 }
Jonathan Hart7804bea2014-01-07 10:50:52 -080061}