blob: e893acfb0a0196f1efe31859e88d444b80b4b67c [file] [log] [blame]
HIGUCHI Yutaea60e5f2013-06-12 11:10:21 -07001package net.onrc.onos.ofcontroller.bgproute;
Jonathan Harte7e1c6e2013-06-04 20:50:23 -07002
Jonathan Harte7e1c6e2013-06-04 20:50:23 -07003import net.floodlightcontroller.util.MACAddress;
Jonathan Hartd1f23252013-06-13 15:17:05 +12004import net.onrc.onos.ofcontroller.util.Dpid;
HIGUCHI Yuta356086e2013-06-12 15:21:19 -07005import net.onrc.onos.ofcontroller.util.IPv4;
Jonathan Hartd1f23252013-06-13 15:17:05 +12006import net.onrc.onos.ofcontroller.util.Port;
HIGUCHI Yuta356086e2013-06-12 15:21:19 -07007import net.onrc.onos.ofcontroller.util.SwitchPort;
Jonathan Harte7e1c6e2013-06-04 20:50:23 -07008
Jonathan Hartd1f23252013-06-13 15:17:05 +12009import org.codehaus.jackson.annotate.JsonProperty;
10import org.openflow.util.HexString;
11
Jonathan Harte7e1c6e2013-06-04 20:50:23 -070012public class GatewayRouter {
Jonathan Hartd1f23252013-06-13 15:17:05 +120013 private SwitchPort attachmentPoint = null;
14 private long dpid;
15 private short port;
Jonathan Harte7e1c6e2013-06-04 20:50:23 -070016 private MACAddress routerMac;
17 private IPv4 routerIp;
Jonathan Hart832a7cb2013-06-24 11:25:35 +120018 private IPv4 myIpAddress;
Jonathan Harte7e1c6e2013-06-04 20:50:23 -070019
Jonathan Hart50a8d1e2013-06-06 16:00:47 +120020
Jonathan Hartd1f23252013-06-13 15:17:05 +120021 public SwitchPort getAttachmentPoint() {
22 if (attachmentPoint == null){
23 attachmentPoint = new SwitchPort(new Dpid(dpid), new Port(port));
24 }
25 return attachmentPoint;
26 }
27
28 public long getDpid() {
29 return dpid;
Jonathan Harte7e1c6e2013-06-04 20:50:23 -070030 }
31
Jonathan Hartd1f23252013-06-13 15:17:05 +120032 @JsonProperty("attachmentDpid")
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("attachmentPort")
42 public void setPort(short port) {
43 this.port = port;
Jonathan Harte7e1c6e2013-06-04 20:50:23 -070044 }
45
46 public MACAddress getRouterMac() {
47 return routerMac;
48 }
Jonathan Hartd1f23252013-06-13 15:17:05 +120049
50 @JsonProperty("macAddress")
51 public void setRouterMac(String routerMac) {
52 this.routerMac = MACAddress.valueOf(routerMac);;
53 }
Jonathan Harte7e1c6e2013-06-04 20:50:23 -070054
55 public IPv4 getRouterIp() {
56 return routerIp;
57 }
Jonathan Hart50a8d1e2013-06-06 16:00:47 +120058
Jonathan Hartd1f23252013-06-13 15:17:05 +120059 @JsonProperty("ipAddress")
60 public void setRouterIp(String routerIp) {
61 this.routerIp = new IPv4(routerIp);
Jonathan Hart50a8d1e2013-06-06 16:00:47 +120062 }
Jonathan Hart832a7cb2013-06-24 11:25:35 +120063
64 public IPv4 getMyIpAddress() {
65 return myIpAddress;
66 }
67
68 @JsonProperty("myIpAddress")
69 public void setMyIpAddress(String myIpAddress) {
70 this.myIpAddress = new IPv4(myIpAddress);
71 }
Jonathan Harte7e1c6e2013-06-04 20:50:23 -070072}