Toshio Koide | 5f26065 | 2014-01-30 14:41:12 -0800 | [diff] [blame] | 1 | package net.onrc.onos.ofcontroller.app; |
| 2 | |
| 3 | /** |
| 4 | * This code is valid for the architectural study purpose only. |
| 5 | * @author Toshio Koide (t-koide@onlab.us) |
| 6 | */ |
| 7 | public class SwitchPort extends NetworkGraphEntity { |
| 8 | protected Switch parentSwitch; |
| 9 | protected Integer portNumber; |
| 10 | protected Link outgoingLink; |
| 11 | protected Link incomingLink; |
| 12 | |
| 13 | public SwitchPort(Switch parentSwitch, Integer portNumber) { |
| 14 | super(parentSwitch.getNetworkGraph()); |
| 15 | this.parentSwitch = parentSwitch; |
| 16 | this.portNumber = portNumber; |
| 17 | } |
| 18 | |
| 19 | public Switch getSwitch() { |
| 20 | return parentSwitch; |
| 21 | } |
| 22 | |
| 23 | public void setOutgoingLink(Link link) { |
| 24 | outgoingLink = link; |
| 25 | } |
| 26 | |
| 27 | public Link getOutgointLink() { |
| 28 | return outgoingLink; |
| 29 | } |
| 30 | |
| 31 | public void setIncomingLink(Link link) { |
| 32 | incomingLink = link; |
| 33 | } |
| 34 | |
| 35 | public Link getIncomingLink() { |
| 36 | return incomingLink; |
| 37 | } |
| 38 | |
| 39 | public Integer getPortNumber() { |
| 40 | return portNumber; |
| 41 | } |
| 42 | |
| 43 | @Override |
| 44 | public String toString() { |
| 45 | return String.format("%s:%d", |
| 46 | getSwitch().getName(), |
| 47 | getPortNumber()); |
| 48 | } |
| 49 | } |