blob: 15b2125a4f3e8abb59c7cfa942eb7b4967ae9e62 [file] [log] [blame]
Jonathan Hart832a7cb2013-06-24 11:25:35 +12001package net.onrc.onos.ofcontroller.bgproute;
2
3import java.net.InetAddress;
4
5import net.onrc.onos.ofcontroller.util.Dpid;
6import net.onrc.onos.ofcontroller.util.Port;
7import net.onrc.onos.ofcontroller.util.SwitchPort;
8
9import org.codehaus.jackson.annotate.JsonProperty;
10import org.openflow.util.HexString;
11
12import com.google.common.net.InetAddresses;
13
14public class Interface {
15 private SwitchPort switchPort = null;
16 private long dpid;
17 private short port;
18 private InetAddress ipAddress;
19 private int prefixLength;
20
21 public synchronized SwitchPort getSwitchPort() {
22 if (switchPort == null){
23 switchPort = new SwitchPort(new Dpid(dpid), new Port(port));
24 }
25 return switchPort;
26 }
27
28 public long getDpid() {
29 return dpid;
30 }
31
32 @JsonProperty("dpid")
33 public void setDpid(String dpid) {
34 this.dpid = HexString.toLong(dpid);
35 }
36
37 public short getPort() {
38 return port;
39 }
40
41 @JsonProperty("port")
42 public void setPort(short port) {
43 this.port = port;
44 }
45
46 public InetAddress getIpAddress() {
47 return ipAddress;
48 }
49
50 @JsonProperty("ipAddress")
51 public void setIpAddress(String ipAddress) {
52 this.ipAddress = InetAddresses.forString(ipAddress);
53 }
54
55 public int getPrefixLength() {
56 return prefixLength;
57 }
58
59 @JsonProperty("prefixLength")
60 public void setPrefixLength(int prefixLength) {
61 this.prefixLength = prefixLength;
62 }
63}