blob: 530da784f5ccb3165c4b7b2a2a873f1a128957c8 [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;
Jonathan Harta213bce2014-08-11 15:44:07 -070038import org.projectfloodlight.openflow.protocol.OFFactory;
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070039import org.projectfloodlight.openflow.protocol.OFMessage;
40import org.projectfloodlight.openflow.protocol.OFPortDesc;
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070041import org.projectfloodlight.openflow.protocol.OFPortStatus;
42import org.projectfloodlight.openflow.protocol.OFStatsReply;
43import org.projectfloodlight.openflow.protocol.OFStatsRequest;
44import org.projectfloodlight.openflow.protocol.OFVersion;
45import org.projectfloodlight.openflow.types.U64;
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080046
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070047
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080048public interface IOFSwitch {
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070049
50 /**
51 * OF1.3 switches should support role-request messages as in the 1.3 spec.
52 * OF1.0 switches may or may not support the Nicira role request extensions.
53 * To indicate the support, this property should be set by the associated
54 * OF1.0 switch driver in the net.onrc.onos.core.drivermanager package.
55 * The property will be ignored for OF1.3 switches.
56 */
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080057 public static final String SWITCH_SUPPORTS_NX_ROLE = "supportsNxRole";
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070058
59
60 //************************
61 // Channel related
62 //************************
63
64 /**
65 * Disconnects the switch by closing the TCP connection. Results in a call
66 * to the channel handler's channelDisconnected method for cleanup
67 * @throws IOException
68 */
69 public void disconnectSwitch();
Ray Milkey269ffb92014-04-03 14:43:30 -070070
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080071 /**
72 * Writes to the OFMessage to the output stream.
73 * The message will be handed to the floodlightProvider for possible filtering
74 * and processing by message listeners
Ray Milkey269ffb92014-04-03 14:43:30 -070075 *
76 * @param m
77 * @param bc
78 * @throws IOException
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080079 */
Ray Milkey269ffb92014-04-03 14:43:30 -070080 public void write(OFMessage m, FloodlightContext bc) throws IOException;
81
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080082 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070083 * Writes the list of messages to the output stream.
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080084 * The message will be handed to the floodlightProvider for possible filtering
85 * and processing by message listeners.
Ray Milkey269ffb92014-04-03 14:43:30 -070086 *
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080087 * @param msglist
88 * @param bc
89 * @throws IOException
90 */
91 public void write(List<OFMessage> msglist, FloodlightContext bc) throws IOException;
Ray Milkey269ffb92014-04-03 14:43:30 -070092
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080093 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070094 * Gets the date the switch connected to this controller.
Ray Milkey269ffb92014-04-03 14:43:30 -070095 *
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070096 * @return the date
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080097 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -070098 public Date getConnectedSince();
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080099
100 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700101 * Gets the next available transaction id.
102 *
103 * @return the next transaction ID
104 */
105 public int getNextTransactionId();
106
107 /**
108 * Checks if the switch is still connected.
109 * Only call while holding processMessageLock
110 *
111 * @return whether the switch is still disconnected
112 */
113 public boolean isConnected();
114
115 /**
116 * Sets whether the switch is connected.
117 * Only call while holding modifySwitchLock
118 *
119 * @param connected whether the switch is connected
120 */
121 public void setConnected(boolean connected);
122
123 /**
124 * Flushes all flows queued for this switch in the current thread.
125 * NOTE: The contract is limited to the current thread
126 */
127 public void flush();
128
129 /**
130 * Sets the Netty Channel this switch instance is associated with.
131 * <p>
132 * Called immediately after instantiation
133 *
134 * @param channel
135 */
136 public void setChannel(Channel channel);
137
138 //************************
139 // Switch features related
140 //************************
141
142 /**
143 * Gets the datapathId of the switch.
Ray Milkey269ffb92014-04-03 14:43:30 -0700144 *
Jonathan Hart99ff20a2014-06-15 16:53:00 -0700145 * @return the switch buffers
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800146 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700147 public long getId();
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800148
149 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700150 * Gets a string version of the ID for this switch.
Ray Milkey269ffb92014-04-03 14:43:30 -0700151 *
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700152 * @return string version of the ID
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800153 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700154 public String getStringId();
Ray Milkey269ffb92014-04-03 14:43:30 -0700155
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800156 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700157 * Gets the number of buffers.
Ray Milkey269ffb92014-04-03 14:43:30 -0700158 *
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700159 * @return the number of buffers
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800160 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700161 public int getNumBuffers();
162
163 public Set<OFCapabilities> getCapabilities();
164
165 public byte getNumTables();
166
167 /**
168 * Returns an OFDescStatsReply message object. Use the methods contained
169 * to retrieve switch descriptions for Manufacturer, Hw/Sw version etc.
170 */
171 public OFDescStatsReply getSwitchDescription();
172
173// /**
174// * Returns a Future object that can be used to retrieve the asynchronous
175// * OFStatisticsReply when it is available.
176// *
177// * @param request statistics request
178// * @return Future object wrapping OFStatisticsReply
179// * @throws IOException
180// */
181// public Future<OFFeaturesReply> getFeaturesReplyFromSwitch()
182// throws IOException;
183//
184// /**
185// * Deliver the featuresReply future reply
186// *
187// * @param reply the reply to deliver
188// */
189// void deliverOFFeaturesReply(OFMessage reply);
190
191 /**
192 * Cancel features reply with a specific transaction ID
193 * @param transactionId the transaction ID
194 */
195 public void cancelFeaturesReply(int transactionId);
196
197 /**
198 * Gets the OFActionType set.
199 * <p>
200 * getActions has relevance only for an OpenFlow 1.0 switch.
201 * For OF1.3, each table can support different actions
202 *
203 * @return the action set
204 */
205 public Set<OFActionType> getActions();
206
Jonathan Harta213bce2014-08-11 15:44:07 -0700207 /**
208 * Gets an OpenFlow message factory that can be used to create messages to
209 * send to this switch.
210 *
211 * @return an OFFactory for the correct OpenFlow version
212 */
213 public OFFactory getFactory();
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700214
Jonathan Harta213bce2014-08-11 15:44:07 -0700215 /**
216 * Gets the OpenFlow version (eg. OF1.0, OF1.3) for this switch.
217 *
218 * @return the OpenFlow version of the switch
219 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700220 public OFVersion getOFVersion();
221
Jonathan Harta213bce2014-08-11 15:44:07 -0700222 /**
223 * Sets the OpenFlow version (eg. OF1.0, OF1.3) for this switch.
224 */
225 public void setOFVersion(OFVersion ofv);
226
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700227
228 //************************
229 // Switch port related
230 //************************
231
232 /**
233 * the type of change that happened to an open flow port
234 */
235 public enum PortChangeType {
236 /** Either a new port has been added by the switch, or we are
237 * adding a port we just deleted (via a prior notification) due to
238 * a change in the portNumber-portName mapping.
239 */
240 ADD,
241 /** some other feature of the port has changed (eg. speed)*/
242 OTHER_UPDATE,
243 /** Either a port has been deleted by the switch, or we are deleting
244 * a port whose portNumber-portName mapping has changed. Note that in
245 * the latter case, a subsequent notification will be sent out to add a
246 * port with the new portNumber-portName mapping.
247 */
248 DELETE,
249 /** Port is up (i.e. enabled). Presumably an earlier notification had
250 * indicated that it was down. To be UP implies that the port is
251 * administratively considered UP (see ofp_port_config) AND the port
252 * link is up AND the port is no longer blocked (see ofp_port_state).
253 */
254 UP,
255 /** Port is down (i.e. disabled). Presumably an earlier notification had
256 * indicated that it was up, or the port was always up.
257 * To be DOWN implies that the port has been either
258 * administratively brought down (see ofp_port_config) OR the port
259 * link is down OR the port is blocked (see ofp_port_state).
260 */
261 DOWN,
262 }
263
264 /**
265 * Describes a change of an open flow port.
266 */
267 public static class PortChangeEvent {
268 public final OFPortDesc port;
269 public final PortChangeType type;
270 /**
271 * @param port
272 * @param type
273 */
274 public PortChangeEvent(OFPortDesc port,
275 PortChangeType type) {
276 this.port = port;
277 this.type = type;
278 }
279 /* (non-Javadoc)
280 * @see java.lang.Object#hashCode()
281 */
282 @Override
283 public int hashCode() {
284 final int prime = 31;
285 int result = 1;
286 result = prime * result + ((port == null) ? 0 : port.hashCode());
287 result = prime * result + ((type == null) ? 0 : type.hashCode());
288 return result;
289 }
290 /* (non-Javadoc)
291 * @see java.lang.Object#equals(java.lang.Object)
292 */
293 @Override
294 public boolean equals(Object obj) {
295 if (this == obj) return true;
296 if (obj == null) return false;
297 if (getClass() != obj.getClass()) return false;
298 PortChangeEvent other = (PortChangeEvent) obj;
299 if (port == null) {
300 if (other.port != null) return false;
301 } else if (!port.equals(other.port)) return false;
302 if (type != other.type) return false;
303 return true;
304 }
305 /* (non-Javadoc)
306 * @see java.lang.Object#toString()
307 */
308 @Override
309 public String toString() {
310 return "[" + type + " " + port.toString() + "]";
311 }
312 }
313
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800314
315 /**
316 * Get list of all enabled ports. This will typically be different from
317 * the list of ports in the OFFeaturesReply, since that one is a static
318 * snapshot of the ports at the time the switch connected to the controller
319 * whereas this port list also reflects the port status messages that have
320 * been received.
Ray Milkey269ffb92014-04-03 14:43:30 -0700321 *
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800322 * @return Unmodifiable list of ports not backed by the underlying collection
323 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700324 public Collection<OFPortDesc> getEnabledPorts();
Ray Milkey269ffb92014-04-03 14:43:30 -0700325
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800326 /**
327 * Get list of the port numbers of all enabled ports. This will typically
328 * be different from the list of ports in the OFFeaturesReply, since that
Ray Milkey269ffb92014-04-03 14:43:30 -0700329 * one is a static snapshot of the ports at the time the switch connected
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800330 * to the controller whereas this port list also reflects the port status
331 * messages that have been received.
Ray Milkey269ffb92014-04-03 14:43:30 -0700332 *
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800333 * @return Unmodifiable list of ports not backed by the underlying collection
334 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700335 public Collection<Integer> getEnabledPortNumbers();
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800336
337 /**
338 * Retrieve the port object by the port number. The port object
339 * is the one that reflects the port status updates that have been
340 * received, not the one from the features reply.
Ray Milkey269ffb92014-04-03 14:43:30 -0700341 *
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800342 * @param portNumber
343 * @return port object
344 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700345 public OFPortDesc getPort(int portNumber);
Ray Milkey269ffb92014-04-03 14:43:30 -0700346
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800347 /**
348 * Retrieve the port object by the port name. The port object
349 * is the one that reflects the port status updates that have been
350 * received, not the one from the features reply.
Ray Milkey269ffb92014-04-03 14:43:30 -0700351 *
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800352 * @param portName
353 * @return port object
354 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700355 public OFPortDesc getPort(String portName);
Ray Milkey269ffb92014-04-03 14:43:30 -0700356
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800357 /**
358 * Add or modify a switch port. This is called by the core controller
359 * code in response to a OFPortStatus message. It should not typically be
360 * called by other floodlight applications.
Ray Milkey269ffb92014-04-03 14:43:30 -0700361 *
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700362 * OFPPR_MODIFY and OFPPR_ADD will be treated as equivalent. The OpenFlow
363 * spec is not clear on whether portNames are portNumbers are considered
364 * authoritative identifiers. We treat portNames <-> portNumber mappings
365 * as fixed. If they change, we delete all previous conflicting ports and
366 * add all new ports.
Ray Milkey269ffb92014-04-03 14:43:30 -0700367 *
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700368 * @param ps the port status message
369 * @return the ordered Collection of changes "applied" to the old ports
370 * of the switch according to the PortStatus message. A single PortStatus
371 * message can result in multiple changes.
372 * If portName <-> portNumber mappings have
373 * changed, the iteration order ensures that delete events for old
374 * conflicting appear before before events adding new ports
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800375 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700376 public OrderedCollection<PortChangeEvent> processOFPortStatus(OFPortStatus ps);
Ray Milkey269ffb92014-04-03 14:43:30 -0700377
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800378 /**
379 * Get list of all ports. This will typically be different from
380 * the list of ports in the OFFeaturesReply, since that one is a static
381 * snapshot of the ports at the time the switch connected to the controller
382 * whereas this port list also reflects the port status messages that have
383 * been received.
Ray Milkey269ffb92014-04-03 14:43:30 -0700384 *
385 * @return Unmodifiable list of ports
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800386 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700387 public Collection<OFPortDesc> getPorts();
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800388
389 /**
390 * @param portName
391 * @return Whether a port is enabled per latest port status message
392 * (not configured down nor link down nor in spanning tree blocking state)
393 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700394 public boolean portEnabled(int portName);
Ray Milkey269ffb92014-04-03 14:43:30 -0700395
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800396 /**
397 * @param portNumber
398 * @return Whether a port is enabled per latest port status message
399 * (not configured down nor link down nor in spanning tree blocking state)
400 */
401 public boolean portEnabled(String portName);
402
403 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700404 * Compute the changes that would be required to replace the old ports
405 * of this switch with the new ports
406 * @param ports new ports to set
407 * @return the ordered collection of changes "applied" to the old ports
408 * of the switch in order to set them to the new set.
409 * If portName <-> portNumber mappings have
410 * changed, the iteration order ensures that delete events for old
411 * conflicting appear before before events adding new ports
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800412 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700413 public OrderedCollection<PortChangeEvent>
414 comparePorts(Collection<OFPortDesc> ports);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800415
416 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700417 * Replace the ports of this switch with the given ports.
418 * @param ports new ports to set
419 * @return the ordered collection of changes "applied" to the old ports
420 * of the switch in order to set them to the new set.
421 * If portName <-> portNumber mappings have
422 * changed, the iteration order ensures that delete events for old
423 * conflicting appear before before events adding new ports
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800424 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700425 public OrderedCollection<PortChangeEvent>
426 setPorts(Collection<OFPortDesc> ports);
427
428// XXX S The odd use of providing an API call to 'set ports' (above) would
429// logically suggest that there should be a way to delete or unset the ports.
430// Right now we forbid this. We should probably not use setPorts too.
431//
432// /**
433// * Delete a port for the switch. This is called by the core controller
434// * code in response to a OFPortStatus message. It should not typically be
435// * called by other floodlight applications.
436// *
437// * @param portNumber
438// */
439// public void deletePort(short portNumber);
440//
441// /**
442// * Delete a port for the switch. This is called by the core controller
443// * code in response to a OFPortStatus message. It should not typically be
444// * called by other floodlight applications.
445// *
446// * @param portName
447// */
448// public void deletePort(String portName);
449
450
451 //*******************************************
452 // IOFSwitch object attributes
453 //************************
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800454
455 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700456 * Gets attributes of this switch.
Ray Milkey269ffb92014-04-03 14:43:30 -0700457 *
Jonathan Hart99ff20a2014-06-15 16:53:00 -0700458 * @return attributes of the switch
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800459 */
460 public Map<Object, Object> getAttributes();
461
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700462 /**
463 * Checks if a specific switch property exists for this switch
464 *
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800465 * @param name name of property
466 * @return value for name
467 */
468 boolean hasAttribute(String name);
469
470 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700471 * Gets properties for switch specific behavior.
Ray Milkey269ffb92014-04-03 14:43:30 -0700472 *
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800473 * @param name name of property
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700474 * @return 'value' for 'name', or null if no entry for 'name' exists
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800475 */
476 Object getAttribute(String name);
477
478 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700479 * Sets properties for switch specific behavior.
Ray Milkey269ffb92014-04-03 14:43:30 -0700480 *
481 * @param name name of property
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800482 * @param value value for name
483 */
484 void setAttribute(String name, Object value);
485
486 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700487 * Removes properties for switch specific behavior.
Ray Milkey269ffb92014-04-03 14:43:30 -0700488 *
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800489 * @param name name of property
490 * @return current value for name or null (if not present)
491 */
492 Object removeAttribute(String name);
493
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700494 //************************
495 // Switch statistics
496 //************************
497
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800498 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700499 * Delivers the statistics future reply.
500 *
501 * @param reply the reply to deliver
502 */
503 public void deliverStatisticsReply(OFMessage reply);
504
505 /**
506 * Cancels the statistics reply with the given transaction ID.
507 *
508 * @param transactionId the transaction ID
509 */
510 public void cancelStatisticsReply(int transactionId);
511
512 /**
513 * Cancels all statistics replies.
514 */
515 public void cancelAllStatisticsReplies();
516
517 /**
518 * Gets a Future object that can be used to retrieve the asynchronous.
519 * OFStatisticsReply when it is available.
520 *
521 * @param request statistics request
522 * @return Future object wrapping OFStatisticsReply
523 * @throws IOException
524 */
525 public Future<List<OFStatsReply>> getStatistics(OFStatsRequest<?> request)
526 throws IOException;
527
528 //************************
529 // Switch other utilities
530 //************************
531
532 /**
533 * Clears all flowmods on this switch.
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800534 */
535 public void clearAllFlowMods();
536
537 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700538 * Gets the current role of this controller for this IOFSwitch.
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800539 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700540 public Role getRole();
Ray Milkey269ffb92014-04-03 14:43:30 -0700541
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800542 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700543 * Sets this controller's Role for this IOFSwitch to role.
Ray Milkey269ffb92014-04-03 14:43:30 -0700544 *
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700545 * @param role
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800546 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700547 public void setRole(Role role);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800548
549 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700550 * Gets the next generation ID.
551 * <p>
552 * Note: relevant for role request messages in OF1.3
Ray Milkey269ffb92014-04-03 14:43:30 -0700553 *
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700554 * @return next generation ID
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800555 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700556 public U64 getNextGenerationId();
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800557
558 /**
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700559 * Sets IFloodlightProviderService for this switch instance.
560 * <p>
561 * Called immediately after instantiation
562 *
563 * @param controller
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800564 */
Brian O'Connorc67f9fa2014-08-07 18:17:46 -0700565 public void setFloodlightProvider(IFloodlightProviderService controller);
566
567 /**
568 * Sets IThreadPoolService for this switch instance.
569 * <p>
570 * Called immediately after instantiation
571 *
572 * @param threadPool
573 */
574 public void setThreadPoolService(IThreadPoolService threadPool);
575
576 /**
577 * Set debug counter service for per-switch counters
578 * Called immediately after instantiation
579 * @param debugCounters
580 * @throws CounterException
581 */
582 public void setDebugCounterService(IDebugCounterService debugCounter)
583 throws CounterException;
584
585 /**
586 * Start this switch driver's sub handshake. This might be a no-op but
587 * this method must be called at least once for the switch to be become
588 * ready.
589 * This method must only be called from the I/O thread
590 * @throws IOException
591 * @throws SwitchDriverSubHandshakeAlreadyStarted if the sub-handshake has
592 * already been started
593 */
594 public void startDriverHandshake() throws IOException;
595
596 /**
597 * Check if the sub-handshake for this switch driver has been completed.
598 * This method can only be called after startDriverHandshake()
599 *
600 * This methods must only be called from the I/O thread
601 * @return true if the sub-handshake has been completed. False otherwise
602 * @throws SwitchDriverSubHandshakeNotStarted if startDriverHandshake() has
603 * not been called yet.
604 */
605 public boolean isDriverHandshakeComplete();
606
607 /**
608 * Pass the given OFMessage to the driver as part of this driver's
609 * sub-handshake. Must not be called after the handshake has been completed
610 * This methods must only be called from the I/O thread
611 * @param m The message that the driver should process
612 * @throws SwitchDriverSubHandshakeCompleted if isDriverHandshake() returns
613 * false before this method call
614 * @throws SwitchDriverSubHandshakeNotStarted if startDriverHandshake() has
615 * not been called yet.
616 */
617 public void processDriverHandshakeMessage(OFMessage m);
618
619 /**
620 * Set the flow table full flag in the switch
621 * XXX S Rethink this for multiple tables
622 */
623 public void setTableFull(boolean isFull);
624
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800625}