blob: eeb5aaa833f530f67826efcae27be8ecd7d6edf1 [file] [log] [blame]
Jonathan Hart23701d12014-04-03 10:45:48 -07001package net.onrc.onos.core.util;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -08002
Pavlin Radoslavovad008e02013-02-21 18:42:42 -08003
4import org.codehaus.jackson.annotate.JsonProperty;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -08005
6/**
7 * The class representing the Data Path Endpoints.
8 */
9public 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 Radoslavov2013cbb2013-02-26 10:15:18 -080035 @JsonProperty("srcPort")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080036 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 Radoslavov2013cbb2013-02-26 10:15:18 -080043 @JsonProperty("srcPort")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080044 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 Radoslavov2013cbb2013-02-26 10:15:18 -080053 @JsonProperty("dstPort")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080054 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 Radoslavov2013cbb2013-02-26 10:15:18 -080061 @JsonProperty("dstPort")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080062 public void setDstPort(SwitchPort dstPort) {
63 this.dstPort = dstPort;
64 }
65
66 /**
67 * Convert the data path endpoints to a string.
68 *
Pavlin Radoslavovad008e02013-02-21 18:42:42 -080069 * The string has the following form:
Pavlin Radoslavova10a9a82013-02-22 11:47:54 -080070 * [src=01:01:01:01:01:01:01:01/1111 dst=02:02:02:02:02:02:02:02/2222]
Pavlin Radoslavovad008e02013-02-21 18:42:42 -080071 *
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080072 * @return the data path endpoints as a string.
73 */
74 @Override
75 public String toString() {
Pavlin Radoslavova10a9a82013-02-22 11:47:54 -080076 String ret = "[src=" + this.srcPort.toString() +
77 " dst=" + this.dstPort.toString() + "]";
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080078 return ret;
79 }
80}