blob: 3ee88d15fb27f0d3ba44817fd484b75e1266fddb [file] [log] [blame]
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -08001package net.floodlightcontroller.util;
2
3import net.floodlightcontroller.util.SwitchPort;
Pavlin Radoslavovad008e02013-02-21 18:42:42 -08004
5import org.codehaus.jackson.annotate.JsonProperty;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -08006
7/**
8 * The class representing the Data Path Endpoints.
9 */
10public class DataPathEndpoints {
11 private SwitchPort srcPort; // The source port
12 private SwitchPort dstPort; // The destination port
13
14 /**
15 * Default constructor.
16 */
17 public DataPathEndpoints() {
18 }
19
20 /**
21 * Constructor for given source and destination ports.
22 *
23 * @param srcPort the source port to use.
24 * @param dstPort the destination port to use.
25 */
26 public DataPathEndpoints(SwitchPort srcPort, SwitchPort dstPort) {
27 this.srcPort = srcPort;
28 this.dstPort = dstPort;
29 }
30
31 /**
32 * Get the data path source port.
33 *
34 * @return the data path source port.
35 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080036 @JsonProperty("srcPort")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080037 public SwitchPort srcPort() { return srcPort; }
38
39 /**
40 * Set the data path source port.
41 *
42 * @param srcPort the data path source port to set.
43 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080044 @JsonProperty("srcPort")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080045 public void setSrcPort(SwitchPort srcPort) {
46 this.srcPort = srcPort;
47 }
48
49 /**
50 * Get the data path destination port.
51 *
52 * @return the data path destination port.
53 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080054 @JsonProperty("dstPort")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080055 public SwitchPort dstPort() { return dstPort; }
56
57 /**
58 * Set the data path destination port.
59 *
60 * @param dstPort the data path destination port to set.
61 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080062 @JsonProperty("dstPort")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080063 public void setDstPort(SwitchPort dstPort) {
64 this.dstPort = dstPort;
65 }
66
67 /**
68 * Convert the data path endpoints to a string.
69 *
Pavlin Radoslavovad008e02013-02-21 18:42:42 -080070 * The string has the following form:
Pavlin Radoslavova10a9a82013-02-22 11:47:54 -080071 * [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 -080072 *
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080073 * @return the data path endpoints as a string.
74 */
75 @Override
76 public String toString() {
Pavlin Radoslavova10a9a82013-02-22 11:47:54 -080077 String ret = "[src=" + this.srcPort.toString() +
78 " dst=" + this.dstPort.toString() + "]";
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080079 return ret;
80 }
81}