2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.protocol_plugin.openflow.core;
11 import java.util.Date;
12 import java.util.List;
16 import org.openflow.protocol.OFMessage;
17 import org.openflow.protocol.OFPhysicalPort;
18 import org.openflow.protocol.OFStatisticsRequest;
21 * This interface defines an abstraction of an Open Flow Switch.
24 public interface ISwitch {
30 public int getNextXid();
33 * Returns the Switch's ID.
35 * @return the Switch's ID
40 * Returns the Switch's table numbers supported by datapath
44 public Byte getTables();
47 * Returns the Switch's bitmap of supported ofp_action_type
51 public Integer getActions();
54 * Returns the Switch's bitmap of supported ofp_capabilities
56 * @return the capabilities
58 public Integer getCapabilities();
61 * Returns the Switch's buffering capacity in Number of Pkts
65 public Integer getBuffers();
68 * Returns the Date when the switch was connected.
70 * @return Date The date when the switch was connected
72 public Date getConnectedDate();
75 * This method puts the message in an outgoing priority queue with normal
76 * priority. It will be served after high priority messages. The method
77 * should be used for non-critical messages such as statistics request,
78 * discovery packets, etc. An unique XID is generated automatically and
79 * inserted into the message.
82 * The OF message to be sent
83 * @return The XID used
85 public Integer asyncSend(OFMessage msg);
88 * This method puts the message in an outgoing priority queue with normal
89 * priority. It will be served after high priority messages. The method
90 * should be used for non-critical messages such as statistics request,
91 * discovery packets, etc. The specified XID is inserted into the message.
94 * The OF message to be Sent
96 * The XID to be used in the message
97 * @return The XID used
99 public Integer asyncSend(OFMessage msg, int xid);
102 * This method puts the message in an outgoing priority queue with high
103 * priority. It will be served first before normal priority messages. The
104 * method should be used for critical messages such as hello, echo reply
105 * etc. An unique XID is generated automatically and inserted into the
109 * The OF message to be sent
110 * @return The XID used
112 public Integer asyncFastSend(OFMessage msg);
115 * This method puts the message in an outgoing priority queue with high
116 * priority. It will be served first before normal priority messages. The
117 * method should be used for critical messages such as hello, echo reply
118 * etc. The specified XID is inserted into the message.
121 * The OF message to be sent
122 * @return The XID used
124 public Integer asyncFastSend(OFMessage msg, int xid);
127 * Sends the OF message followed by a Barrier Request with a unique XID
128 * which is automatically generated, and waits for a result from the switch.
131 * The message to be sent
132 * @return An Object which has one of the followings instances/values:
133 * Boolean with value true to indicate the message has been
134 * successfully processed and acknowledged by the switch; Boolean
135 * with value false to indicate the message has failed to be
136 * processed by the switch within a period of time or OFError to
137 * indicate that the message has been denied by the switch which
138 * responded with OFError.
140 public Object syncSend(OFMessage msg);
143 * Returns a map containing all OFPhysicalPorts of this switch.
145 * @return The Map of OFPhysicalPort
147 public Map<Short, OFPhysicalPort> getPhysicalPorts();
150 * Returns a Set containing all port IDs of this switch.
152 * @return The Set of port ID
154 public Set<Short> getPorts();
157 * Returns OFPhysicalPort of the specified portNumber of this switch.
161 * @return OFPhysicalPort for the specified PortNumber
163 public OFPhysicalPort getPhysicalPort(Short portNumber);
166 * Returns the bandwidth of the specified portNumber of this switch.
172 public Integer getPortBandwidth(Short portNumber);
175 * Returns True if the port is enabled,
178 * @return True if the port is enabled
180 public boolean isPortEnabled(short portNumber);
183 * Returns True if the port is enabled.
186 * @return True if the port is enabled
188 public boolean isPortEnabled(OFPhysicalPort port);
191 * Returns a list containing all enabled ports of this switch.
193 * @return: List containing all enabled ports of this switch
195 public List<OFPhysicalPort> getEnabledPorts();
198 * Sends OFStatisticsRequest with a unique XID generated automatically and
199 * waits for a result from the switch.
202 * the OF Statistic Request to be sent
203 * @return Object has one of the following instances/values::
204 * List<OFStatistics>, a list of statistics records received from
205 * the switch as response from the request; OFError if the switch
206 * failed handle the request or NULL if timeout has occurred while
207 * waiting for the response.
209 public Object getStatistics(OFStatisticsRequest req);
212 * Returns true if the switch has reached the operational state (has sent
213 * FEATURE_REPLY to the controller).
215 * @return true if the switch is operational
217 public boolean isOperational();
220 * Sends synchronous Barrier message
222 public Object sendBarrierMessage();