HIGUCHI Yuta | ea60e5f | 2013-06-12 11:10:21 -0700 | [diff] [blame] | 1 | package net.onrc.onos.ofcontroller.bgproute; |
Jonathan Hart | e7e1c6e | 2013-06-04 20:50:23 -0700 | [diff] [blame] | 2 | |
Jonathan Hart | e7e1c6e | 2013-06-04 20:50:23 -0700 | [diff] [blame] | 3 | import net.floodlightcontroller.util.MACAddress; |
Jonathan Hart | d1f2325 | 2013-06-13 15:17:05 +1200 | [diff] [blame] | 4 | import net.onrc.onos.ofcontroller.util.Dpid; |
HIGUCHI Yuta | 356086e | 2013-06-12 15:21:19 -0700 | [diff] [blame] | 5 | import net.onrc.onos.ofcontroller.util.IPv4; |
Jonathan Hart | d1f2325 | 2013-06-13 15:17:05 +1200 | [diff] [blame] | 6 | import net.onrc.onos.ofcontroller.util.Port; |
HIGUCHI Yuta | 356086e | 2013-06-12 15:21:19 -0700 | [diff] [blame] | 7 | import net.onrc.onos.ofcontroller.util.SwitchPort; |
Jonathan Hart | e7e1c6e | 2013-06-04 20:50:23 -0700 | [diff] [blame] | 8 | |
Jonathan Hart | d1f2325 | 2013-06-13 15:17:05 +1200 | [diff] [blame] | 9 | import org.codehaus.jackson.annotate.JsonProperty; |
| 10 | import org.openflow.util.HexString; |
| 11 | |
Jonathan Hart | e7e1c6e | 2013-06-04 20:50:23 -0700 | [diff] [blame] | 12 | public class GatewayRouter { |
Jonathan Hart | d1f2325 | 2013-06-13 15:17:05 +1200 | [diff] [blame] | 13 | private SwitchPort attachmentPoint = null; |
| 14 | private long dpid; |
| 15 | private short port; |
Jonathan Hart | e7e1c6e | 2013-06-04 20:50:23 -0700 | [diff] [blame] | 16 | private MACAddress routerMac; |
| 17 | private IPv4 routerIp; |
Jonathan Hart | 832a7cb | 2013-06-24 11:25:35 +1200 | [diff] [blame] | 18 | private IPv4 myIpAddress; |
Jonathan Hart | e7e1c6e | 2013-06-04 20:50:23 -0700 | [diff] [blame] | 19 | |
Jonathan Hart | 50a8d1e | 2013-06-06 16:00:47 +1200 | [diff] [blame] | 20 | |
Jonathan Hart | d1f2325 | 2013-06-13 15:17:05 +1200 | [diff] [blame] | 21 | 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 Hart | e7e1c6e | 2013-06-04 20:50:23 -0700 | [diff] [blame] | 30 | } |
| 31 | |
Jonathan Hart | d1f2325 | 2013-06-13 15:17:05 +1200 | [diff] [blame] | 32 | @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 Hart | e7e1c6e | 2013-06-04 20:50:23 -0700 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | public MACAddress getRouterMac() { |
| 47 | return routerMac; |
| 48 | } |
Jonathan Hart | d1f2325 | 2013-06-13 15:17:05 +1200 | [diff] [blame] | 49 | |
| 50 | @JsonProperty("macAddress") |
| 51 | public void setRouterMac(String routerMac) { |
| 52 | this.routerMac = MACAddress.valueOf(routerMac);; |
| 53 | } |
Jonathan Hart | e7e1c6e | 2013-06-04 20:50:23 -0700 | [diff] [blame] | 54 | |
| 55 | public IPv4 getRouterIp() { |
| 56 | return routerIp; |
| 57 | } |
Jonathan Hart | 50a8d1e | 2013-06-06 16:00:47 +1200 | [diff] [blame] | 58 | |
Jonathan Hart | d1f2325 | 2013-06-13 15:17:05 +1200 | [diff] [blame] | 59 | @JsonProperty("ipAddress") |
| 60 | public void setRouterIp(String routerIp) { |
| 61 | this.routerIp = new IPv4(routerIp); |
Jonathan Hart | 50a8d1e | 2013-06-06 16:00:47 +1200 | [diff] [blame] | 62 | } |
Jonathan Hart | 832a7cb | 2013-06-24 11:25:35 +1200 | [diff] [blame] | 63 | |
| 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 Hart | e7e1c6e | 2013-06-04 20:50:23 -0700 | [diff] [blame] | 72 | } |