Jonathan Hart | 0961fe8 | 2014-04-03 09:56:25 -0700 | [diff] [blame] | 1 | package net.onrc.onos.apps.proxyarp; |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 2 | |
TeruU | 7feef8a | 2014-04-03 00:15:49 -0700 | [diff] [blame] | 3 | |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 4 | // TODO This class is too generic to be handled by ProxyArpService. |
| 5 | // TODO The generic broadcast packet shouldn't contain an IP address which is |
| 6 | // only for ARP packets. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 7 | |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 8 | /** |
| 9 | * Notification to all ONOS instances to broadcast this packet out the edge of |
| 10 | * the network. The edge is defined as any port that doesn't have a link to |
| 11 | * another switch. The one exception is the port that the packet was received |
| 12 | * on. |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 13 | */ |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 14 | public class BroadcastPacketOutNotification extends PacketOutNotification { |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 15 | |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 16 | private static final long serialVersionUID = 1L; |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 17 | |
TeruU | 7feef8a | 2014-04-03 00:15:49 -0700 | [diff] [blame] | 18 | private final int address; |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 19 | private final long inSwitch; |
| 20 | private final short inPort; |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 21 | |
TeruU | 7feef8a | 2014-04-03 00:15:49 -0700 | [diff] [blame] | 22 | protected BroadcastPacketOutNotification() { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 23 | super(); |
TeruU | 7feef8a | 2014-04-03 00:15:49 -0700 | [diff] [blame] | 24 | this.address = -1; |
| 25 | this.inSwitch = -1; |
| 26 | this.inPort = -1; |
| 27 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 28 | |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 29 | /** |
| 30 | * Class constructor. |
| 31 | * |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 32 | * @param packet packet data to send in the packet-out |
| 33 | * @param address target IP address if the packet is an ARP packet |
| 34 | * @param inSwitch dpid of the switch the packet was received on |
| 35 | * @param inPort port number of the receiving port |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 36 | */ |
TeruU | 7feef8a | 2014-04-03 00:15:49 -0700 | [diff] [blame] | 37 | public BroadcastPacketOutNotification(byte[] packet, int address, |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 38 | long inSwitch, short inPort) { |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 39 | super(packet); |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 40 | |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 41 | this.address = address; |
| 42 | this.inSwitch = inSwitch; |
| 43 | this.inPort = inPort; |
| 44 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 45 | |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 46 | /** |
| 47 | * Get the dpid of the switch the packet was received on. |
| 48 | * |
| 49 | * @return receiving switch dpid |
| 50 | */ |
| 51 | public long getInSwitch() { |
| 52 | return inSwitch; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Get the port number of the port the packet was received on. |
| 57 | * |
| 58 | * @return receiving port number |
| 59 | */ |
| 60 | public short getInPort() { |
| 61 | return inPort; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Get the target IP address if the packet is an ARP packet. |
| 66 | * |
| 67 | * @return the target IP address for ARP packets, or null if the packet is |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame^] | 68 | * not an ARP packet |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 69 | */ |
TeruU | 7feef8a | 2014-04-03 00:15:49 -0700 | [diff] [blame] | 70 | public int getTargetAddress() { |
Jonathan Hart | 7c9a2fb | 2014-03-27 09:51:41 -0700 | [diff] [blame] | 71 | return address; |
| 72 | } |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 73 | } |