Add TLS support in the Opendaylight Controller:
[controller.git] / opendaylight / protocol_plugins / openflow / src / main / java / org / opendaylight / controller / protocol_plugin / openflow / core / ISwitch.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.opendaylight.controller.protocol_plugin.openflow.core;
11
12 import java.util.Date;
13 import java.util.List;
14 import java.util.Map;
15 import java.util.Set;
16
17 import org.openflow.protocol.OFMessage;
18 import org.openflow.protocol.OFPhysicalPort;
19 import org.openflow.protocol.OFStatisticsRequest;
20
21 /**
22  * This interface defines an abstraction of an Open Flow Switch.
23  *
24  */
25 public interface ISwitch {
26         /**
27          * Gets a unique XID.
28          * @return XID
29          */
30         public int getNextXid();
31
32         /**
33          * Returns the Switch's ID.
34          * @return the Switch's ID
35          */
36         public Long getId();
37
38         /**
39          * Returns the Switch's table numbers supported by datapath 
40          * @return the tables
41          */
42         public Byte getTables();
43
44         /**
45          * Returns the Switch's bitmap of supported ofp_action_type
46          * @return the actions
47          */
48         public Integer getActions();
49
50         /**
51          * Returns the Switch's bitmap of supported ofp_capabilities
52          * @return the capabilities
53          */
54         public Integer getCapabilities();
55
56         /**
57          * Returns the Switch's buffering capacity in Number of Pkts
58          * @return the buffers
59          */
60         public Integer getBuffers();
61
62         /**
63          * Returns the Date when the switch was connected.
64          * @return Date The date when the switch was connected
65          */
66         public Date getConnectedDate();
67
68         /**
69          * This method puts the message in an outgoing priority queue with normal
70          * priority. It will be served after high priority messages. The method
71          * should be used for non-critical messages such as statistics request,
72          * discovery packets, etc. An unique XID is generated automatically and
73          * inserted into the message.
74          * 
75          * @param msg The OF message to be sent
76          * @return The XID used
77          */
78         public Integer asyncSend(OFMessage msg);
79
80         /**
81          * This method puts the message in an outgoing priority queue with normal
82          * priority. It will be served after high priority messages. The method
83          * should be used for non-critical messages such as statistics request,
84          * discovery packets, etc. The specified XID is inserted into the message.
85          * 
86          * @param msg The OF message to be Sent
87          * @param xid The XID to be used in the message
88          * @return The XID used
89          */
90         public Integer asyncSend(OFMessage msg, int xid);
91
92         /**
93          * This method puts the message in an outgoing priority queue with high
94          * priority. It will be served first before normal priority messages. The
95          * method should be used for critical messages such as hello, echo reply
96          * etc. An unique XID is generated automatically and inserted into the
97          * message.
98          * 
99          * @param msg The OF message to be sent
100          * @return The XID used
101          */
102         public Integer asyncFastSend(OFMessage msg);
103
104         /**
105          * This method puts the message in an outgoing priority queue with high
106          * priority. It will be served first before normal priority messages. The
107          * method should be used for critical messages such as hello, echo reply
108          * etc. The specified XID is inserted into the message.
109          * 
110          * @param msg The OF message to be sent
111          * @return The XID used
112          */
113         public Integer asyncFastSend(OFMessage msg, int xid);
114
115         /**
116          * Sends the OF message followed by a Barrier Request with a unique XID which is automatically generated,
117          * and waits for a result from the switch.
118          * @param msg The message to be sent
119          * @return An Object which has one of the followings instances/values:
120          * Boolean with value true to indicate the message has been successfully processed and acknowledged by the switch;
121          * Boolean with value false to indicate the message has failed to be processed by the switch within a period of time or
122          * OFError to indicate that the message has been denied by the switch which responded with OFError.
123          */
124         public Object syncSend(OFMessage msg);
125
126         /**
127          * Returns a map containing all OFPhysicalPorts of this switch.
128          * @return The Map of OFPhysicalPort
129          */
130         public Map<Short, OFPhysicalPort> getPhysicalPorts();
131
132         /**
133          * Returns a Set containing all port IDs of this switch.
134          * @return The Set of port ID
135          */
136         public Set<Short> getPorts();
137
138         /**
139          * Returns OFPhysicalPort of the specified portNumber of this switch.
140          * @param portNumber The port ID
141          * @return OFPhysicalPort for the specified PortNumber
142          */
143         public OFPhysicalPort getPhysicalPort(Short portNumber);
144
145         /**
146          * Returns the bandwidth of the specified portNumber of this switch.
147          * @param portNumber the port ID
148          * @return bandwidth
149          */
150         public Integer getPortBandwidth(Short portNumber);
151
152         /**
153          * Returns True if the port is enabled,
154          * @param portNumber 
155          * @return True if the port is enabled
156          */
157         public boolean isPortEnabled(short portNumber);
158
159         /**
160          * Returns True if the port is enabled.
161          * @param port
162          * @return True if the port is enabled
163          */
164         public boolean isPortEnabled(OFPhysicalPort port);
165
166         /**
167          * Returns a list containing all enabled ports of this switch.
168          * @return: List containing all enabled ports of this switch
169          */
170         public List<OFPhysicalPort> getEnabledPorts();
171
172         /**
173          * Sends OFStatisticsRequest  with a unique XID generated automatically and waits for a result from the switch.
174          * @param req the OF Statistic Request to be sent
175          * @return Object has one of the following instances/values::
176          * List<OFStatistics>, a list  of statistics records received from the switch as response from the request;
177          *      OFError if the switch failed handle the request or
178          * NULL if timeout has occurred while waiting for the response.
179          */
180         public Object getStatistics(OFStatisticsRequest req);
181
182         /**
183          * Returns true if the switch has reached the operational state (has sent FEATURE_REPLY to the controller).
184          * @return true if the switch is operational
185          */
186         public boolean isOperational();
187
188 }