HIGUCHI Yuta | 356086e | 2013-06-12 15:21:19 -0700 | [diff] [blame] | 1 | package net.onrc.onos.ofcontroller.util; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 2 | |
Pavlin Radoslavov | ad008e0 | 2013-02-21 18:42:42 -0800 | [diff] [blame] | 3 | |
| 4 | import org.codehaus.jackson.annotate.JsonProperty; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 5 | |
| 6 | /** |
| 7 | * The class representing the Data Path Endpoints. |
| 8 | */ |
| 9 | public class DataPathEndpoints { |
| 10 | private SwitchPort srcPort; // The source port |
| 11 | private SwitchPort dstPort; // The destination port |
| 12 | |
| 13 | /** |
| 14 | * Default constructor. |
| 15 | */ |
| 16 | public DataPathEndpoints() { |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * Constructor for given source and destination ports. |
| 21 | * |
| 22 | * @param srcPort the source port to use. |
| 23 | * @param dstPort the destination port to use. |
| 24 | */ |
| 25 | public DataPathEndpoints(SwitchPort srcPort, SwitchPort dstPort) { |
| 26 | this.srcPort = srcPort; |
| 27 | this.dstPort = dstPort; |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Get the data path source port. |
| 32 | * |
| 33 | * @return the data path source port. |
| 34 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 35 | @JsonProperty("srcPort") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 36 | public SwitchPort srcPort() { return srcPort; } |
| 37 | |
| 38 | /** |
| 39 | * Set the data path source port. |
| 40 | * |
| 41 | * @param srcPort the data path source port to set. |
| 42 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 43 | @JsonProperty("srcPort") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 44 | public void setSrcPort(SwitchPort srcPort) { |
| 45 | this.srcPort = srcPort; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Get the data path destination port. |
| 50 | * |
| 51 | * @return the data path destination port. |
| 52 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 53 | @JsonProperty("dstPort") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 54 | public SwitchPort dstPort() { return dstPort; } |
| 55 | |
| 56 | /** |
| 57 | * Set the data path destination port. |
| 58 | * |
| 59 | * @param dstPort the data path destination port to set. |
| 60 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 61 | @JsonProperty("dstPort") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 62 | public void setDstPort(SwitchPort dstPort) { |
| 63 | this.dstPort = dstPort; |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Convert the data path endpoints to a string. |
| 68 | * |
Pavlin Radoslavov | ad008e0 | 2013-02-21 18:42:42 -0800 | [diff] [blame] | 69 | * The string has the following form: |
Pavlin Radoslavov | a10a9a8 | 2013-02-22 11:47:54 -0800 | [diff] [blame] | 70 | * [src=01:01:01:01:01:01:01:01/1111 dst=02:02:02:02:02:02:02:02/2222] |
Pavlin Radoslavov | ad008e0 | 2013-02-21 18:42:42 -0800 | [diff] [blame] | 71 | * |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 72 | * @return the data path endpoints as a string. |
| 73 | */ |
| 74 | @Override |
| 75 | public String toString() { |
Pavlin Radoslavov | a10a9a8 | 2013-02-22 11:47:54 -0800 | [diff] [blame] | 76 | String ret = "[src=" + this.srcPort.toString() + |
| 77 | " dst=" + this.dstPort.toString() + "]"; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 78 | return ret; |
| 79 | } |
| 80 | } |