blob: 92cf2ddc6fc9ba7ddb6df53764d1ece996cb8cff [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 -08004import net.floodlightcontroller.util.serializers.DataPathEndpointsSerializer;
5
6import org.codehaus.jackson.annotate.JsonProperty;
7import org.codehaus.jackson.map.annotate.JsonSerialize;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -08008
9/**
10 * The class representing the Data Path Endpoints.
11 */
Pavlin Radoslavovad008e02013-02-21 18:42:42 -080012@JsonSerialize(using=DataPathEndpointsSerializer.class)
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080013public class DataPathEndpoints {
14 private SwitchPort srcPort; // The source port
15 private SwitchPort dstPort; // The destination port
16
17 /**
18 * Default constructor.
19 */
20 public DataPathEndpoints() {
21 }
22
23 /**
24 * Constructor for given source and destination ports.
25 *
26 * @param srcPort the source port to use.
27 * @param dstPort the destination port to use.
28 */
29 public DataPathEndpoints(SwitchPort srcPort, SwitchPort dstPort) {
30 this.srcPort = srcPort;
31 this.dstPort = dstPort;
32 }
33
34 /**
35 * Get the data path source port.
36 *
37 * @return the data path source port.
38 */
39 public SwitchPort srcPort() { return srcPort; }
40
41 /**
42 * Set the data path source port.
43 *
44 * @param srcPort the data path source port to set.
45 */
46 public void setSrcPort(SwitchPort srcPort) {
47 this.srcPort = srcPort;
48 }
49
50 /**
51 * Get the data path destination port.
52 *
53 * @return the data path destination port.
54 */
55 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 */
62 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}