blob: f96e0b07f009334840bd75b946dd575ed44acdc8 [file] [log] [blame]
Jonathan Hart382623d2014-04-03 09:48:11 -07001package net.onrc.onos.apps.bgproute;
Jonathan Hart4dfc3652013-08-02 20:22:36 +12002
3import java.net.InetAddress;
Jonathan Hart309889c2013-08-13 23:26:24 +12004import java.util.Collections;
5import java.util.List;
Jonathan Hart4dfc3652013-08-02 20:22:36 +12006
7/*
8 * A path is always assumed to be from all other interfaces (external-facing
9 * switchports) to the destination interface.
10 */
11
Jonathan Harta23ffdb2013-08-14 14:36:54 +120012public class Path {
Jonathan Hart4dfc3652013-08-02 20:22:36 +120013
Jonathan Hart738980f2014-04-04 10:11:15 -070014 private final Interface dstInterface;
15 private final InetAddress dstIpAddress;
16 private int numUsers; // initialized to 0
Jonathan Hart4dfc3652013-08-02 20:22:36 +120017
Jonathan Hart738980f2014-04-04 10:11:15 -070018 private List<PushedFlowMod> flowMods; // initialized to null
19 private boolean permanent; // initialized to false
Jonathan Hart4dfc3652013-08-02 20:22:36 +120020
Ray Milkey269ffb92014-04-03 14:43:30 -070021 public Path(Interface dstInterface, InetAddress dstIpAddress) {
22 this.dstInterface = dstInterface;
23 this.dstIpAddress = dstIpAddress;
24 }
25
26 public Interface getDstInterface() {
27 return dstInterface;
28 }
29
30 public InetAddress getDstIpAddress() {
31 return dstIpAddress;
32 }
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 Hart4dfc3652013-08-02 20:22:36 +120061}