blob: 088c18e82ff84fe26aa10fcf749c32009aa713f7 [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 {
Jonathan Hart9575cb62013-07-05 13:43:49 +120015 private String name;
Jonathan Hart832a7cb2013-06-24 11:25:35 +120016 private SwitchPort switchPort = null;
17 private long dpid;
18 private short port;
19 private InetAddress ipAddress;
20 private int prefixLength;
21
Jonathan Hart9575cb62013-07-05 13:43:49 +120022 public String getName() {
23 return name;
24 }
25
26 @JsonProperty("name")
27 public void setName(String name) {
28 this.name = name;
29 }
30
Jonathan Hart832a7cb2013-06-24 11:25:35 +120031 public synchronized SwitchPort getSwitchPort() {
32 if (switchPort == null){
33 switchPort = new SwitchPort(new Dpid(dpid), new Port(port));
34 }
35 return switchPort;
36 }
37
38 public long getDpid() {
39 return dpid;
40 }
41
42 @JsonProperty("dpid")
43 public void setDpid(String dpid) {
44 this.dpid = HexString.toLong(dpid);
45 }
46
47 public short getPort() {
48 return port;
49 }
50
51 @JsonProperty("port")
52 public void setPort(short port) {
53 this.port = port;
54 }
55
56 public InetAddress getIpAddress() {
57 return ipAddress;
58 }
59
60 @JsonProperty("ipAddress")
61 public void setIpAddress(String ipAddress) {
62 this.ipAddress = InetAddresses.forString(ipAddress);
63 }
64
65 public int getPrefixLength() {
66 return prefixLength;
67 }
68
69 @JsonProperty("prefixLength")
70 public void setPrefixLength(int prefixLength) {
71 this.prefixLength = prefixLength;
72 }
73}