Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 1 | /** |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 2 | * 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 Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 17 | |
| 18 | package net.floodlightcontroller.core; |
| 19 | |
| 20 | import java.io.IOException; |
| 21 | import java.util.Collection; |
| 22 | import java.util.Date; |
| 23 | import java.util.List; |
| 24 | import java.util.Map; |
| 25 | import java.util.concurrent.Future; |
Jonathan Hart | a99ec67 | 2014-04-03 11:30:34 -0700 | [diff] [blame] | 26 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 27 | import net.floodlightcontroller.core.IFloodlightProviderService.Role; |
| 28 | |
| 29 | import org.jboss.netty.channel.Channel; |
| 30 | import org.openflow.protocol.OFFeaturesReply; |
| 31 | import org.openflow.protocol.OFMessage; |
| 32 | import org.openflow.protocol.OFPhysicalPort; |
| 33 | import org.openflow.protocol.OFStatisticsRequest; |
| 34 | import org.openflow.protocol.statistics.OFDescriptionStatistics; |
| 35 | import org.openflow.protocol.statistics.OFStatistics; |
| 36 | |
| 37 | /** |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 38 | * @author David Erickson (daviderickson@cs.stanford.edu) |
| 39 | */ |
| 40 | public interface IOFSwitch { |
| 41 | // Attribute keys |
| 42 | public static final String SWITCH_DESCRIPTION_FUTURE = "DescriptionFuture"; |
| 43 | public static final String SWITCH_DESCRIPTION_DATA = "DescriptionData"; |
| 44 | public static final String SWITCH_SUPPORTS_NX_ROLE = "supportsNxRole"; |
| 45 | public static final String SWITCH_IS_CORE_SWITCH = "isCoreSwitch"; |
| 46 | public static final String PROP_FASTWILDCARDS = "FastWildcards"; |
| 47 | public static final String PROP_REQUIRES_L3_MATCH = "requiresL3Match"; |
| 48 | public static final String PROP_SUPPORTS_OFPP_TABLE = "supportsOfppTable"; |
| 49 | public static final String PROP_SUPPORTS_OFPP_FLOOD = "supportsOfppFlood"; |
| 50 | public static final String PROP_SUPPORTS_NETMASK_TBL = "supportsNetmaskTbl"; |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 51 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 52 | /** |
| 53 | * Writes to the OFMessage to the output stream. |
| 54 | * The message will be handed to the floodlightProvider for possible filtering |
| 55 | * and processing by message listeners |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 56 | * |
| 57 | * @param m |
| 58 | * @param bc |
| 59 | * @throws IOException |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 60 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 61 | public void write(OFMessage m, FloodlightContext bc) throws IOException; |
| 62 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 63 | /** |
| 64 | * Writes the list of messages to the output stream |
| 65 | * The message will be handed to the floodlightProvider for possible filtering |
| 66 | * and processing by message listeners. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 67 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 68 | * @param msglist |
| 69 | * @param bc |
| 70 | * @throws IOException |
| 71 | */ |
| 72 | public void write(List<OFMessage> msglist, FloodlightContext bc) throws IOException; |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 73 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 74 | /** |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 75 | * @throws IOException |
| 76 | */ |
| 77 | public void disconnectOutputStream(); |
| 78 | |
| 79 | /** |
| 80 | * FIXME: remove getChannel(). All access to the channel should be through |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 81 | * wrapper functions in IOFSwitch |
| 82 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 83 | * @return |
| 84 | */ |
| 85 | public Channel getChannel(); |
| 86 | |
| 87 | /** |
| 88 | * Returns switch features from features Reply |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 89 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 90 | * @return |
| 91 | */ |
| 92 | public int getBuffers(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 93 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 94 | public int getActions(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 95 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 96 | public int getCapabilities(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 97 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 98 | public byte getTables(); |
| 99 | |
| 100 | /** |
| 101 | * Set the OFFeaturesReply message returned by the switch during initial |
| 102 | * handshake. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 103 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 104 | * @param featuresReply |
| 105 | */ |
| 106 | public void setFeaturesReply(OFFeaturesReply featuresReply); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 107 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 108 | /** |
| 109 | * Set the SwitchProperties based on it's description |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 110 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 111 | * @param description |
| 112 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 113 | public void setSwitchProperties(OFDescriptionStatistics description); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 114 | |
| 115 | /** |
| 116 | * Get list of all enabled ports. This will typically be different from |
| 117 | * the list of ports in the OFFeaturesReply, since that one is a static |
| 118 | * snapshot of the ports at the time the switch connected to the controller |
| 119 | * whereas this port list also reflects the port status messages that have |
| 120 | * been received. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 121 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 122 | * @return Unmodifiable list of ports not backed by the underlying collection |
| 123 | */ |
| 124 | public Collection<OFPhysicalPort> getEnabledPorts(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 125 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 126 | /** |
| 127 | * Get list of the port numbers of all enabled ports. This will typically |
| 128 | * be different from the list of ports in the OFFeaturesReply, since that |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 129 | * one is a static snapshot of the ports at the time the switch connected |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 130 | * to the controller whereas this port list also reflects the port status |
| 131 | * messages that have been received. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 132 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 133 | * @return Unmodifiable list of ports not backed by the underlying collection |
| 134 | */ |
| 135 | public Collection<Short> getEnabledPortNumbers(); |
| 136 | |
| 137 | /** |
| 138 | * Retrieve the port object by the port number. The port object |
| 139 | * is the one that reflects the port status updates that have been |
| 140 | * received, not the one from the features reply. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 141 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 142 | * @param portNumber |
| 143 | * @return port object |
| 144 | */ |
| 145 | public OFPhysicalPort getPort(short portNumber); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 146 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 147 | /** |
| 148 | * Retrieve the port object by the port name. The port object |
| 149 | * is the one that reflects the port status updates that have been |
| 150 | * received, not the one from the features reply. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 151 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 152 | * @param portName |
| 153 | * @return port object |
| 154 | */ |
| 155 | public OFPhysicalPort getPort(String portName); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 156 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 157 | /** |
| 158 | * Add or modify a switch port. This is called by the core controller |
| 159 | * code in response to a OFPortStatus message. It should not typically be |
| 160 | * called by other floodlight applications. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 161 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 162 | * @param port |
| 163 | */ |
| 164 | public void setPort(OFPhysicalPort port); |
| 165 | |
| 166 | /** |
| 167 | * Delete a port for the switch. This is called by the core controller |
| 168 | * code in response to a OFPortStatus message. It should not typically be |
| 169 | * called by other floodlight applications. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 170 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 171 | * @param portNumber |
| 172 | */ |
| 173 | public void deletePort(short portNumber); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 174 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 175 | /** |
| 176 | * Delete a port for the switch. This is called by the core controller |
| 177 | * code in response to a OFPortStatus message. It should not typically be |
| 178 | * called by other floodlight applications. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 179 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 180 | * @param portName |
| 181 | */ |
| 182 | public void deletePort(String portName); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 183 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 184 | /** |
| 185 | * Get list of all ports. This will typically be different from |
| 186 | * the list of ports in the OFFeaturesReply, since that one is a static |
| 187 | * snapshot of the ports at the time the switch connected to the controller |
| 188 | * whereas this port list also reflects the port status messages that have |
| 189 | * been received. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 190 | * |
| 191 | * @return Unmodifiable list of ports |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 192 | */ |
| 193 | public Collection<OFPhysicalPort> getPorts(); |
| 194 | |
| 195 | /** |
| 196 | * @param portName |
| 197 | * @return Whether a port is enabled per latest port status message |
| 198 | * (not configured down nor link down nor in spanning tree blocking state) |
| 199 | */ |
| 200 | public boolean portEnabled(short portName); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 201 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 202 | /** |
| 203 | * @param portNumber |
| 204 | * @return Whether a port is enabled per latest port status message |
| 205 | * (not configured down nor link down nor in spanning tree blocking state) |
| 206 | */ |
| 207 | public boolean portEnabled(String portName); |
| 208 | |
| 209 | /** |
| 210 | * @param port |
| 211 | * @return Whether a port is enabled per latest port status message |
| 212 | * (not configured down nor link down nor in spanning tree blocking state) |
| 213 | */ |
| 214 | public boolean portEnabled(OFPhysicalPort port); |
| 215 | |
| 216 | /** |
| 217 | * Get the datapathId of the switch |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 218 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 219 | * @return |
| 220 | */ |
| 221 | public long getId(); |
| 222 | |
| 223 | /** |
| 224 | * Get a string version of the ID for this switch |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 225 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 226 | * @return |
| 227 | */ |
| 228 | public String getStringId(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 229 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 230 | /** |
| 231 | * Retrieves attributes of this switch |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 232 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 233 | * @return |
| 234 | */ |
| 235 | public Map<Object, Object> getAttributes(); |
| 236 | |
| 237 | /** |
| 238 | * Retrieves the date the switch connected to this controller |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 239 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 240 | * @return the date |
| 241 | */ |
| 242 | public Date getConnectedSince(); |
| 243 | |
| 244 | /** |
| 245 | * Returns the next available transaction id |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 246 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 247 | * @return |
| 248 | */ |
| 249 | public int getNextTransactionId(); |
| 250 | |
| 251 | /** |
| 252 | * Returns a Future object that can be used to retrieve the asynchronous |
| 253 | * OFStatisticsReply when it is available. |
| 254 | * |
| 255 | * @param request statistics request |
| 256 | * @return Future object wrapping OFStatisticsReply |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 257 | * @throws IOException |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 258 | */ |
| 259 | public Future<List<OFStatistics>> getStatistics(OFStatisticsRequest request) |
| 260 | throws IOException; |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 261 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 262 | /** |
| 263 | * Returns a Future object that can be used to retrieve the asynchronous |
| 264 | * OFStatisticsReply when it is available. |
| 265 | * |
| 266 | * @param request statistics request |
| 267 | * @return Future object wrapping OFStatisticsReply |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 268 | * @throws IOException |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 269 | */ |
| 270 | public Future<OFFeaturesReply> getFeaturesReplyFromSwitch() |
| 271 | throws IOException; |
| 272 | |
| 273 | /** |
| 274 | * Deliver the featuresReply future reply |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 275 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 276 | * @param reply the reply to deliver |
| 277 | */ |
| 278 | void deliverOFFeaturesReply(OFMessage reply); |
| 279 | |
| 280 | /* |
| 281 | * Cancel features reply with a specific transction ID |
| 282 | * @param transactionId the transaction ID |
| 283 | */ |
| 284 | public void cancelFeaturesReply(int transactionId); |
| 285 | |
| 286 | /** |
| 287 | * Check if the switch is still connected; |
| 288 | * Only call while holding processMessageLock |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 289 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 290 | * @return whether the switch is still disconnected |
| 291 | */ |
| 292 | public boolean isConnected(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 293 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 294 | /** |
| 295 | * Set whether the switch is connected |
| 296 | * Only call while holding modifySwitchLock |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 297 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 298 | * @param connected whether the switch is connected |
| 299 | */ |
| 300 | public void setConnected(boolean connected); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 301 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 302 | /** |
| 303 | * Get the current role of the controller for the switch |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 304 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 305 | * @return the role of the controller |
| 306 | */ |
| 307 | public Role getRole(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 308 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 309 | /** |
| 310 | * Check if the controller is an active controller for the switch. |
| 311 | * The controller is active if its role is MASTER or EQUAL. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 312 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 313 | * @return whether the controller is active |
| 314 | */ |
| 315 | public boolean isActive(); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 316 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 317 | /** |
| 318 | * Deliver the statistics future reply |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 319 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 320 | * @param reply the reply to deliver |
| 321 | */ |
| 322 | public void deliverStatisticsReply(OFMessage reply); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 323 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 324 | /** |
| 325 | * Cancel the statistics reply with the given transaction ID |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 326 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 327 | * @param transactionId the transaction ID |
| 328 | */ |
| 329 | public void cancelStatisticsReply(int transactionId); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 330 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 331 | /** |
| 332 | * Cancel all statistics replies |
| 333 | */ |
| 334 | public void cancelAllStatisticsReplies(); |
| 335 | |
| 336 | /** |
| 337 | * Checks if a specific switch property exists for this switch |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 338 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 339 | * @param name name of property |
| 340 | * @return value for name |
| 341 | */ |
| 342 | boolean hasAttribute(String name); |
| 343 | |
| 344 | /** |
| 345 | * Set properties for switch specific behavior |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 346 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 347 | * @param name name of property |
| 348 | * @return value for name |
| 349 | */ |
| 350 | Object getAttribute(String name); |
| 351 | |
| 352 | /** |
| 353 | * Set properties for switch specific behavior |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 354 | * |
| 355 | * @param name name of property |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 356 | * @param value value for name |
| 357 | */ |
| 358 | void setAttribute(String name, Object value); |
| 359 | |
| 360 | /** |
| 361 | * Set properties for switch specific behavior |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 362 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 363 | * @param name name of property |
| 364 | * @return current value for name or null (if not present) |
| 365 | */ |
| 366 | Object removeAttribute(String name); |
| 367 | |
| 368 | /** |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 369 | * Clear all flowmods on this switch |
| 370 | */ |
| 371 | public void clearAllFlowMods(); |
| 372 | |
| 373 | /** |
| 374 | * Update broadcast cache |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 375 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 376 | * @param data |
| 377 | * @return true if there is a cache hit |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 378 | * false if there is no cache hit. |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 379 | */ |
| 380 | public boolean updateBroadcastCache(Long entry, Short port); |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 381 | |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 382 | /** |
| 383 | * Get the portBroadcastCacheHits |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 384 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 385 | * @return |
| 386 | */ |
| 387 | public Map<Short, Long> getPortBroadcastHits(); |
| 388 | |
| 389 | /** |
| 390 | * Send a flow statistics request to the switch. This call returns after |
| 391 | * sending the stats. request to the switch. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 392 | * |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 393 | * @param request flow statistics request message |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 394 | * @param xid transaction id, must be obtained by using the getXid() API. |
| 395 | * @param caller the caller of the API. receive() callback of this |
| 396 | * caller would be called when the reply from the switch is received. |
| 397 | * @return the transaction id for the message sent to the switch. The |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 398 | * transaction id can be used to match the response with the request. Note |
| 399 | * that the transaction id is unique only within the scope of this switch. |
| 400 | * @throws IOException |
| 401 | */ |
| 402 | public void sendStatsQuery(OFStatisticsRequest request, int xid, |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 403 | IOFMessageListener caller) throws IOException; |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 404 | |
| 405 | /** |
| 406 | * Flush all flows queued for this switch in the current thread. |
| 407 | * NOTE: The contract is limited to the current thread |
| 408 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 409 | public void flush(); |
Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 410 | } |