blob: 54e440891a7d665c81b2e90588a82a49c42d57fd [file] [log] [blame]
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -08001/**
Ray Milkey269ffb92014-04-03 14:43:30 -07002 * Copyright 2011, Big Switch Networks, Inc.
3 * Originally created by David Erickson, Stanford University
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 * not use this file except in compliance with the License. You may obtain
7 * a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations
15 * under the License.
16 **/
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080017
18package net.floodlightcontroller.core;
19
20import java.io.IOException;
21import java.util.Collection;
22import java.util.Date;
23import java.util.List;
24import java.util.Map;
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070025import java.util.Set;
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080026import java.util.concurrent.Future;
Jonathan Harta99ec672014-04-03 11:30:34 -070027
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080028import net.floodlightcontroller.core.IFloodlightProviderService.Role;
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070029import net.floodlightcontroller.debugcounter.IDebugCounterService;
30import net.floodlightcontroller.debugcounter.IDebugCounterService.CounterException;
31import net.floodlightcontroller.threadpool.IThreadPoolService;
32import net.floodlightcontroller.util.OrderedCollection;
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080033
34import org.jboss.netty.channel.Channel;
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070035import org.projectfloodlight.openflow.protocol.OFActionType;
36import org.projectfloodlight.openflow.protocol.OFCapabilities;
37import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
38import org.projectfloodlight.openflow.protocol.OFFeaturesReply;
39import org.projectfloodlight.openflow.protocol.OFMessage;
40import org.projectfloodlight.openflow.protocol.OFPortDesc;
41import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply;
42import org.projectfloodlight.openflow.protocol.OFPortStatus;
43import org.projectfloodlight.openflow.protocol.OFStatsReply;
44import org.projectfloodlight.openflow.protocol.OFStatsRequest;
45import org.projectfloodlight.openflow.protocol.OFVersion;
46import org.projectfloodlight.openflow.types.U64;
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080047
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070048
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080049public interface IOFSwitch {
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070050
51 /**
52 * OF1.3 switches should support role-request messages as in the 1.3 spec.
53 * OF1.0 switches may or may not support the Nicira role request extensions.
54 * To indicate the support, this property should be set by the associated
55 * OF1.0 switch driver in the net.onrc.onos.core.drivermanager package.
56 * The property will be ignored for OF1.3 switches.
57 */
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080058 public static final String SWITCH_SUPPORTS_NX_ROLE = "supportsNxRole";
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070059
60
61 //************************
62 // Channel related
63 //************************
64
65 /**
66 * Disconnects the switch by closing the TCP connection. Results in a call
67 * to the channel handler's channelDisconnected method for cleanup
68 * @throws IOException
69 */
70 public void disconnectSwitch();
Ray Milkey269ffb92014-04-03 14:43:30 -070071
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080072 /**
73 * Writes to the OFMessage to the output stream.
74 * The message will be handed to the floodlightProvider for possible filtering
75 * and processing by message listeners
Ray Milkey269ffb92014-04-03 14:43:30 -070076 *
77 * @param m
78 * @param bc
79 * @throws IOException
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080080 */
Ray Milkey269ffb92014-04-03 14:43:30 -070081 public void write(OFMessage m, FloodlightContext bc) throws IOException;
82
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080083 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070084 * Writes the list of messages to the output stream.
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080085 * The message will be handed to the floodlightProvider for possible filtering
86 * and processing by message listeners.
Ray Milkey269ffb92014-04-03 14:43:30 -070087 *
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080088 * @param msglist
89 * @param bc
90 * @throws IOException
91 */
92 public void write(List<OFMessage> msglist, FloodlightContext bc) throws IOException;
Ray Milkey269ffb92014-04-03 14:43:30 -070093
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080094 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070095 * Gets the date the switch connected to this controller.
Ray Milkey269ffb92014-04-03 14:43:30 -070096 *
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070097 * @return the date
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080098 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070099 public Date getConnectedSince();
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800100
101 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700102 * Gets the next available transaction id.
103 *
104 * @return the next transaction ID
105 */
106 public int getNextTransactionId();
107
108 /**
109 * Checks if the switch is still connected.
110 * Only call while holding processMessageLock
111 *
112 * @return whether the switch is still disconnected
113 */
114 public boolean isConnected();
115
116 /**
117 * Sets whether the switch is connected.
118 * Only call while holding modifySwitchLock
119 *
120 * @param connected whether the switch is connected
121 */
122 public void setConnected(boolean connected);
123
124 /**
125 * Flushes all flows queued for this switch in the current thread.
126 * NOTE: The contract is limited to the current thread
127 */
128 public void flush();
129
130 /**
131 * Sets the Netty Channel this switch instance is associated with.
132 * <p>
133 * Called immediately after instantiation
134 *
135 * @param channel
136 */
137 public void setChannel(Channel channel);
138
139 //************************
140 // Switch features related
141 //************************
142
143 /**
144 * Gets the datapathId of the switch.
Ray Milkey269ffb92014-04-03 14:43:30 -0700145 *
Jonathan Hart99ff20a2014-06-15 16:53:00 -0700146 * @return the switch buffers
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800147 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700148 public long getId();
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800149
150 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700151 * Gets a string version of the ID for this switch.
Ray Milkey269ffb92014-04-03 14:43:30 -0700152 *
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700153 * @return string version of the ID
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800154 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700155 public String getStringId();
Ray Milkey269ffb92014-04-03 14:43:30 -0700156
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800157 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700158 * Gets the number of buffers.
Ray Milkey269ffb92014-04-03 14:43:30 -0700159 *
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700160 * @return the number of buffers
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800161 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700162 public int getNumBuffers();
163
164 public Set<OFCapabilities> getCapabilities();
165
166 public byte getNumTables();
167
168 /**
169 * Returns an OFDescStatsReply message object. Use the methods contained
170 * to retrieve switch descriptions for Manufacturer, Hw/Sw version etc.
171 */
172 public OFDescStatsReply getSwitchDescription();
173
174// /**
175// * Returns a Future object that can be used to retrieve the asynchronous
176// * OFStatisticsReply when it is available.
177// *
178// * @param request statistics request
179// * @return Future object wrapping OFStatisticsReply
180// * @throws IOException
181// */
182// public Future<OFFeaturesReply> getFeaturesReplyFromSwitch()
183// throws IOException;
184//
185// /**
186// * Deliver the featuresReply future reply
187// *
188// * @param reply the reply to deliver
189// */
190// void deliverOFFeaturesReply(OFMessage reply);
191
192 /**
193 * Cancel features reply with a specific transaction ID
194 * @param transactionId the transaction ID
195 */
196 public void cancelFeaturesReply(int transactionId);
197
198 /**
199 * Gets the OFActionType set.
200 * <p>
201 * getActions has relevance only for an OpenFlow 1.0 switch.
202 * For OF1.3, each table can support different actions
203 *
204 * @return the action set
205 */
206 public Set<OFActionType> getActions();
207
208 public void setOFVersion(OFVersion ofv);
209
210 public OFVersion getOFVersion();
211
212
213 //************************
214 // Switch port related
215 //************************
216
217 /**
218 * the type of change that happened to an open flow port
219 */
220 public enum PortChangeType {
221 /** Either a new port has been added by the switch, or we are
222 * adding a port we just deleted (via a prior notification) due to
223 * a change in the portNumber-portName mapping.
224 */
225 ADD,
226 /** some other feature of the port has changed (eg. speed)*/
227 OTHER_UPDATE,
228 /** Either a port has been deleted by the switch, or we are deleting
229 * a port whose portNumber-portName mapping has changed. Note that in
230 * the latter case, a subsequent notification will be sent out to add a
231 * port with the new portNumber-portName mapping.
232 */
233 DELETE,
234 /** Port is up (i.e. enabled). Presumably an earlier notification had
235 * indicated that it was down. To be UP implies that the port is
236 * administratively considered UP (see ofp_port_config) AND the port
237 * link is up AND the port is no longer blocked (see ofp_port_state).
238 */
239 UP,
240 /** Port is down (i.e. disabled). Presumably an earlier notification had
241 * indicated that it was up, or the port was always up.
242 * To be DOWN implies that the port has been either
243 * administratively brought down (see ofp_port_config) OR the port
244 * link is down OR the port is blocked (see ofp_port_state).
245 */
246 DOWN,
247 }
248
249 /**
250 * Describes a change of an open flow port.
251 */
252 public static class PortChangeEvent {
253 public final OFPortDesc port;
254 public final PortChangeType type;
255 /**
256 * @param port
257 * @param type
258 */
259 public PortChangeEvent(OFPortDesc port,
260 PortChangeType type) {
261 this.port = port;
262 this.type = type;
263 }
264 /* (non-Javadoc)
265 * @see java.lang.Object#hashCode()
266 */
267 @Override
268 public int hashCode() {
269 final int prime = 31;
270 int result = 1;
271 result = prime * result + ((port == null) ? 0 : port.hashCode());
272 result = prime * result + ((type == null) ? 0 : type.hashCode());
273 return result;
274 }
275 /* (non-Javadoc)
276 * @see java.lang.Object#equals(java.lang.Object)
277 */
278 @Override
279 public boolean equals(Object obj) {
280 if (this == obj) return true;
281 if (obj == null) return false;
282 if (getClass() != obj.getClass()) return false;
283 PortChangeEvent other = (PortChangeEvent) obj;
284 if (port == null) {
285 if (other.port != null) return false;
286 } else if (!port.equals(other.port)) return false;
287 if (type != other.type) return false;
288 return true;
289 }
290 /* (non-Javadoc)
291 * @see java.lang.Object#toString()
292 */
293 @Override
294 public String toString() {
295 return "[" + type + " " + port.toString() + "]";
296 }
297 }
298
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800299
300 /**
301 * Get list of all enabled ports. This will typically be different from
302 * the list of ports in the OFFeaturesReply, since that one is a static
303 * snapshot of the ports at the time the switch connected to the controller
304 * whereas this port list also reflects the port status messages that have
305 * been received.
Ray Milkey269ffb92014-04-03 14:43:30 -0700306 *
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800307 * @return Unmodifiable list of ports not backed by the underlying collection
308 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700309 public Collection<OFPortDesc> getEnabledPorts();
Ray Milkey269ffb92014-04-03 14:43:30 -0700310
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800311 /**
312 * Get list of the port numbers of all enabled ports. This will typically
313 * be different from the list of ports in the OFFeaturesReply, since that
Ray Milkey269ffb92014-04-03 14:43:30 -0700314 * one is a static snapshot of the ports at the time the switch connected
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800315 * to the controller whereas this port list also reflects the port status
316 * messages that have been received.
Ray Milkey269ffb92014-04-03 14:43:30 -0700317 *
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800318 * @return Unmodifiable list of ports not backed by the underlying collection
319 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700320 public Collection<Integer> getEnabledPortNumbers();
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800321
322 /**
323 * Retrieve the port object by the port number. The port object
324 * is the one that reflects the port status updates that have been
325 * received, not the one from the features reply.
Ray Milkey269ffb92014-04-03 14:43:30 -0700326 *
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800327 * @param portNumber
328 * @return port object
329 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700330 public OFPortDesc getPort(int portNumber);
Ray Milkey269ffb92014-04-03 14:43:30 -0700331
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800332 /**
333 * Retrieve the port object by the port name. The port object
334 * is the one that reflects the port status updates that have been
335 * received, not the one from the features reply.
Ray Milkey269ffb92014-04-03 14:43:30 -0700336 *
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800337 * @param portName
338 * @return port object
339 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700340 public OFPortDesc getPort(String portName);
Ray Milkey269ffb92014-04-03 14:43:30 -0700341
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800342 /**
343 * Add or modify a switch port. This is called by the core controller
344 * code in response to a OFPortStatus message. It should not typically be
345 * called by other floodlight applications.
Ray Milkey269ffb92014-04-03 14:43:30 -0700346 *
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700347 * OFPPR_MODIFY and OFPPR_ADD will be treated as equivalent. The OpenFlow
348 * spec is not clear on whether portNames are portNumbers are considered
349 * authoritative identifiers. We treat portNames <-> portNumber mappings
350 * as fixed. If they change, we delete all previous conflicting ports and
351 * add all new ports.
Ray Milkey269ffb92014-04-03 14:43:30 -0700352 *
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700353 * @param ps the port status message
354 * @return the ordered Collection of changes "applied" to the old ports
355 * of the switch according to the PortStatus message. A single PortStatus
356 * message can result in multiple changes.
357 * If portName <-> portNumber mappings have
358 * changed, the iteration order ensures that delete events for old
359 * conflicting appear before before events adding new ports
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800360 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700361 public OrderedCollection<PortChangeEvent> processOFPortStatus(OFPortStatus ps);
Ray Milkey269ffb92014-04-03 14:43:30 -0700362
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800363 /**
364 * Get list of all ports. This will typically be different from
365 * the list of ports in the OFFeaturesReply, since that one is a static
366 * snapshot of the ports at the time the switch connected to the controller
367 * whereas this port list also reflects the port status messages that have
368 * been received.
Ray Milkey269ffb92014-04-03 14:43:30 -0700369 *
370 * @return Unmodifiable list of ports
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800371 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700372 public Collection<OFPortDesc> getPorts();
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800373
374 /**
375 * @param portName
376 * @return Whether a port is enabled per latest port status message
377 * (not configured down nor link down nor in spanning tree blocking state)
378 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700379 public boolean portEnabled(int portName);
Ray Milkey269ffb92014-04-03 14:43:30 -0700380
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800381 /**
382 * @param portNumber
383 * @return Whether a port is enabled per latest port status message
384 * (not configured down nor link down nor in spanning tree blocking state)
385 */
386 public boolean portEnabled(String portName);
387
388 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700389 * Compute the changes that would be required to replace the old ports
390 * of this switch with the new ports
391 * @param ports new ports to set
392 * @return the ordered collection of changes "applied" to the old ports
393 * of the switch in order to set them to the new set.
394 * If portName <-> portNumber mappings have
395 * changed, the iteration order ensures that delete events for old
396 * conflicting appear before before events adding new ports
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800397 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700398 public OrderedCollection<PortChangeEvent>
399 comparePorts(Collection<OFPortDesc> ports);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800400
401 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700402 * Replace the ports of this switch with the given ports.
403 * @param ports new ports to set
404 * @return the ordered collection of changes "applied" to the old ports
405 * of the switch in order to set them to the new set.
406 * If portName <-> portNumber mappings have
407 * changed, the iteration order ensures that delete events for old
408 * conflicting appear before before events adding new ports
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800409 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700410 public OrderedCollection<PortChangeEvent>
411 setPorts(Collection<OFPortDesc> ports);
412
413// XXX S The odd use of providing an API call to 'set ports' (above) would
414// logically suggest that there should be a way to delete or unset the ports.
415// Right now we forbid this. We should probably not use setPorts too.
416//
417// /**
418// * Delete a port for the switch. This is called by the core controller
419// * code in response to a OFPortStatus message. It should not typically be
420// * called by other floodlight applications.
421// *
422// * @param portNumber
423// */
424// public void deletePort(short portNumber);
425//
426// /**
427// * Delete a port for the switch. This is called by the core controller
428// * code in response to a OFPortStatus message. It should not typically be
429// * called by other floodlight applications.
430// *
431// * @param portName
432// */
433// public void deletePort(String portName);
434
435
436 //*******************************************
437 // IOFSwitch object attributes
438 //************************
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800439
440 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700441 * Gets attributes of this switch.
Ray Milkey269ffb92014-04-03 14:43:30 -0700442 *
Jonathan Hart99ff20a2014-06-15 16:53:00 -0700443 * @return attributes of the switch
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800444 */
445 public Map<Object, Object> getAttributes();
446
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700447 /**
448 * Checks if a specific switch property exists for this switch
449 *
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800450 * @param name name of property
451 * @return value for name
452 */
453 boolean hasAttribute(String name);
454
455 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700456 * Gets properties for switch specific behavior.
Ray Milkey269ffb92014-04-03 14:43:30 -0700457 *
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800458 * @param name name of property
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700459 * @return 'value' for 'name', or null if no entry for 'name' exists
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800460 */
461 Object getAttribute(String name);
462
463 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700464 * Sets properties for switch specific behavior.
Ray Milkey269ffb92014-04-03 14:43:30 -0700465 *
466 * @param name name of property
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800467 * @param value value for name
468 */
469 void setAttribute(String name, Object value);
470
471 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700472 * Removes properties for switch specific behavior.
Ray Milkey269ffb92014-04-03 14:43:30 -0700473 *
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800474 * @param name name of property
475 * @return current value for name or null (if not present)
476 */
477 Object removeAttribute(String name);
478
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700479 //************************
480 // Switch statistics
481 //************************
482
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800483 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700484 * Delivers the statistics future reply.
485 *
486 * @param reply the reply to deliver
487 */
488 public void deliverStatisticsReply(OFMessage reply);
489
490 /**
491 * Cancels the statistics reply with the given transaction ID.
492 *
493 * @param transactionId the transaction ID
494 */
495 public void cancelStatisticsReply(int transactionId);
496
497 /**
498 * Cancels all statistics replies.
499 */
500 public void cancelAllStatisticsReplies();
501
502 /**
503 * Gets a Future object that can be used to retrieve the asynchronous.
504 * OFStatisticsReply when it is available.
505 *
506 * @param request statistics request
507 * @return Future object wrapping OFStatisticsReply
508 * @throws IOException
509 */
510 public Future<List<OFStatsReply>> getStatistics(OFStatsRequest<?> request)
511 throws IOException;
512
513 //************************
514 // Switch other utilities
515 //************************
516
517 /**
518 * Clears all flowmods on this switch.
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800519 */
520 public void clearAllFlowMods();
521
522 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700523 * Gets the current role of this controller for this IOFSwitch.
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800524 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700525 public Role getRole();
Ray Milkey269ffb92014-04-03 14:43:30 -0700526
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800527 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700528 * Sets this controller's Role for this IOFSwitch to role.
Ray Milkey269ffb92014-04-03 14:43:30 -0700529 *
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700530 * @param role
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800531 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700532 public void setRole(Role role);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800533
534 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700535 * Gets the next generation ID.
536 * <p>
537 * Note: relevant for role request messages in OF1.3
Ray Milkey269ffb92014-04-03 14:43:30 -0700538 *
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700539 * @return next generation ID
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800540 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700541 public U64 getNextGenerationId();
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800542
543 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700544 * Sets IFloodlightProviderService for this switch instance.
545 * <p>
546 * Called immediately after instantiation
547 *
548 * @param controller
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800549 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700550 public void setFloodlightProvider(IFloodlightProviderService controller);
551
552 /**
553 * Sets IThreadPoolService for this switch instance.
554 * <p>
555 * Called immediately after instantiation
556 *
557 * @param threadPool
558 */
559 public void setThreadPoolService(IThreadPoolService threadPool);
560
561 /**
562 * Set debug counter service for per-switch counters
563 * Called immediately after instantiation
564 * @param debugCounters
565 * @throws CounterException
566 */
567 public void setDebugCounterService(IDebugCounterService debugCounter)
568 throws CounterException;
569
570 /**
571 * Start this switch driver's sub handshake. This might be a no-op but
572 * this method must be called at least once for the switch to be become
573 * ready.
574 * This method must only be called from the I/O thread
575 * @throws IOException
576 * @throws SwitchDriverSubHandshakeAlreadyStarted if the sub-handshake has
577 * already been started
578 */
579 public void startDriverHandshake() throws IOException;
580
581 /**
582 * Check if the sub-handshake for this switch driver has been completed.
583 * This method can only be called after startDriverHandshake()
584 *
585 * This methods must only be called from the I/O thread
586 * @return true if the sub-handshake has been completed. False otherwise
587 * @throws SwitchDriverSubHandshakeNotStarted if startDriverHandshake() has
588 * not been called yet.
589 */
590 public boolean isDriverHandshakeComplete();
591
592 /**
593 * Pass the given OFMessage to the driver as part of this driver's
594 * sub-handshake. Must not be called after the handshake has been completed
595 * This methods must only be called from the I/O thread
596 * @param m The message that the driver should process
597 * @throws SwitchDriverSubHandshakeCompleted if isDriverHandshake() returns
598 * false before this method call
599 * @throws SwitchDriverSubHandshakeNotStarted if startDriverHandshake() has
600 * not been called yet.
601 */
602 public void processDriverHandshakeMessage(OFMessage m);
603
604 /**
605 * Set the flow table full flag in the switch
606 * XXX S Rethink this for multiple tables
607 */
608 public void setTableFull(boolean isFull);
609
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800610}