Jonathan Hart | 4dfc365 | 2013-08-02 20:22:36 +1200 | [diff] [blame] | 1 | package net.onrc.onos.ofcontroller.bgproute; |
| 2 | |
| 3 | import java.net.InetAddress; |
Jonathan Hart | 309889c | 2013-08-13 23:26:24 +1200 | [diff] [blame] | 4 | import java.util.Collections; |
| 5 | import java.util.List; |
Jonathan Hart | 4dfc365 | 2013-08-02 20:22:36 +1200 | [diff] [blame] | 6 | |
| 7 | /* |
| 8 | * A path is always assumed to be from all other interfaces (external-facing |
| 9 | * switchports) to the destination interface. |
| 10 | */ |
| 11 | |
Jonathan Hart | a23ffdb | 2013-08-14 14:36:54 +1200 | [diff] [blame] | 12 | public class Path { |
Jonathan Hart | 4dfc365 | 2013-08-02 20:22:36 +1200 | [diff] [blame] | 13 | |
Jonathan Hart | 4dfc365 | 2013-08-02 20:22:36 +1200 | [diff] [blame] | 14 | private Interface dstInterface; |
| 15 | private InetAddress dstIpAddress; |
Jonathan Hart | 309889c | 2013-08-13 23:26:24 +1200 | [diff] [blame] | 16 | private int numUsers = 0; |
| 17 | |
| 18 | private List<PushedFlowMod> flowMods = null; |
| 19 | private boolean permanent = false; |
Jonathan Hart | 4dfc365 | 2013-08-02 20:22:36 +1200 | [diff] [blame] | 20 | |
Jonathan Hart | a23ffdb | 2013-08-14 14:36:54 +1200 | [diff] [blame] | 21 | public Path(Interface dstInterface, InetAddress dstIpAddress) { |
Jonathan Hart | 4dfc365 | 2013-08-02 20:22:36 +1200 | [diff] [blame] | 22 | this.dstInterface = dstInterface; |
| 23 | this.dstIpAddress = dstIpAddress; |
Jonathan Hart | 4dfc365 | 2013-08-02 20:22:36 +1200 | [diff] [blame] | 24 | } |
| 25 | |
Jonathan Hart | 4dfc365 | 2013-08-02 20:22:36 +1200 | [diff] [blame] | 26 | public Interface getDstInterface() { |
| 27 | return dstInterface; |
| 28 | } |
| 29 | |
| 30 | public InetAddress getDstIpAddress() { |
| 31 | return dstIpAddress; |
| 32 | } |
Jonathan Hart | 309889c | 2013-08-13 23:26:24 +1200 | [diff] [blame] | 33 | |
| 34 | public void incrementUsers() { |
| 35 | numUsers++; |
| 36 | } |
| 37 | |
| 38 | public void decrementUsers() { |
| 39 | numUsers--; |
| 40 | } |
| 41 | |
| 42 | public int getUsers() { |
| 43 | return numUsers; |
| 44 | } |
| 45 | |
| 46 | public List<PushedFlowMod> getFlowMods() { |
| 47 | return Collections.unmodifiableList(flowMods); |
| 48 | } |
| 49 | |
| 50 | public void setFlowMods(List<PushedFlowMod> flowMods) { |
| 51 | this.flowMods = flowMods; |
| 52 | } |
| 53 | |
| 54 | public boolean isPermanent() { |
| 55 | return permanent; |
| 56 | } |
| 57 | |
| 58 | public void setPermanent() { |
| 59 | permanent = true; |
| 60 | } |
Jonathan Hart | 4dfc365 | 2013-08-02 20:22:36 +1200 | [diff] [blame] | 61 | } |