blob: e03166c6cea8f6bae6fdf38d8c09a1c6a4007de7 [file] [log] [blame]
Sho SHIMIZU228140c2014-08-11 19:15:43 -07001package net.onrc.onos.api.newintent;
Toshio Koidea03915e2014-07-01 18:39:52 -07002
Sho SHIMIZU54739912014-07-21 18:55:39 -07003import net.onrc.onos.core.matchaction.match.PacketMatch;
4import net.onrc.onos.core.util.SwitchPort;
5
Toshio Koidea03915e2014-07-01 18:39:52 -07006import java.util.Collection;
7import java.util.Collections;
8import java.util.HashSet;
Toshio Koidea03915e2014-07-01 18:39:52 -07009import java.util.Set;
10
Sho SHIMIZU228140c2014-08-11 19:15:43 -070011// TODO: consider if this intent should be sub-class of Connectivity intent
Toshio Koidea03915e2014-07-01 18:39:52 -070012/**
13 * A packet layer Intent for a connectivity from a set of ports to a set of
14 * ports.
15 * <p>
16 * TODO: Design methods to support the ReactiveForwarding and the SDN-IP. <br>
17 * NOTE: Should this class support modifier methods? Should this object a
18 * read-only object?
19 */
Sho SHIMIZU228140c2014-08-11 19:15:43 -070020public class PacketConnectivityIntent extends AbstractIntent {
Toshio Koidea03915e2014-07-01 18:39:52 -070021 protected Set<SwitchPort> srcSwitchPorts;
22 protected PacketMatch match;
23 protected Set<SwitchPort> dstSwitchPorts;
24 protected boolean canSetupOpticalFlow;
25 protected int idleTimeoutValue;
26 protected int hardTimeoutValue;
27
28 /**
29 * Creates a connectivity intent for the packet layer.
30 * <p>
31 * When the "canSetupOpticalFlow" option is true, this intent will compute
32 * the packet/optical converged path, decompose it to the OpticalPathFlow
33 * and the PacketPathFlow objects, and execute the operations to add them
34 * considering the dependency between the packet and optical layers.
35 *
36 * @param id ID for this new Intent object.
37 * @param srcSwitchPorts The set of source switch ports.
38 * @param match Traffic specifier for this object.
39 * @param dstSwitchPorts The set of destination switch ports.
40 * @param canSetupOpticalFlow The flag whether this intent can create
41 * optical flows if needed.
42 */
Sho SHIMIZUec4f5a72014-07-21 18:21:23 -070043 public PacketConnectivityIntent(IntentId id,
Toshio Koidea03915e2014-07-01 18:39:52 -070044 Collection<SwitchPort> srcSwitchPorts, PacketMatch match,
45 Collection<SwitchPort> dstSwitchPorts, boolean canSetupOpticalFlow) {
46 super(id);
47 this.srcSwitchPorts = new HashSet<SwitchPort>(srcSwitchPorts);
48 this.match = match;
49 this.dstSwitchPorts = new HashSet<SwitchPort>(dstSwitchPorts);
50 this.canSetupOpticalFlow = canSetupOpticalFlow;
51 this.idleTimeoutValue = 0;
52 this.hardTimeoutValue = 0;
53
54 // TODO: check consistency between these parameters.
55 }
56
57 /**
58 * Gets the set of source switch ports.
59 *
60 * @return the set of source switch ports.
61 */
62 public Collection<SwitchPort> getSrcSwitchPorts() {
63 return Collections.unmodifiableCollection(srcSwitchPorts);
64 }
65
66 /**
67 * Gets the traffic specifier.
68 *
69 * @return The traffic specifier.
70 */
71 public PacketMatch getMatch() {
72 return match;
73 }
74
75 /**
76 * Gets the set of destination switch ports.
77 *
78 * @return the set of destination switch ports.
79 */
80 public Collection<SwitchPort> getDstSwitchPorts() {
81 return Collections.unmodifiableCollection(dstSwitchPorts);
82 }
83
84 /**
85 * Adds the specified port to the set of source ports.
86 *
87 * @param port SwitchPort object to be added
88 */
89 public void addSrcSwitchPort(SwitchPort port) {
90 // TODO implement it.
91 }
92
93 /**
94 * Adds the specified port to the set of destination ports.
95 *
96 * @param port SwitchPort object to be added
97 */
98 public void addDstSwitchPort(SwitchPort port) {
99 // TODO implement it.
100 }
101
102 /**
103 * Removes the specified port from the set of source ports.
104 *
105 * @param port SwitchPort object to be removed
106 */
107 public void removeSrcSwitchPort(SwitchPort port) {
108 // TODO implement it.
109 }
110
111 /**
112 * Removes the specified port from the set of destination ports.
113 *
114 * @param port SwitchPort object to be removed
115 */
116 public void removeDstSwitchPort(SwitchPort port) {
117 // TODO implement it.
118 }
119
120 /**
121 * Sets idle-timeout value.
122 *
123 * @param timeout Idle-timeout value (seconds)
124 */
125 public void setIdleTimeout(int timeout) {
126 idleTimeoutValue = timeout;
127 }
128
129 /**
130 * Sets hard-timeout value.
131 *
132 * @param timeout Hard-timeout value (seconds)
133 */
134 public void setHardTimeout(int timeout) {
135 hardTimeoutValue = timeout;
136 }
137
138 /**
139 * Gets idle-timeout value.
140 *
141 * @return Idle-timeout value (seconds)
142 */
143 public int getIdleTimeout() {
144 return idleTimeoutValue;
145 }
146
147 /**
148 * Gets hard-timeout value.
149 *
150 * @return Hard-timeout value (seconds)
151 */
152 public int getHardTimeout() {
153 return hardTimeoutValue;
154 }
155
156 /**
157 * Returns whether this intent can create optical flows if needed.
158 *
159 * @return whether this intent can create optical flows.
160 */
161 public boolean canSetupOpticalFlow() {
162 return canSetupOpticalFlow;
163 }
Toshio Koidea03915e2014-07-01 18:39:52 -0700164}