</execution>\r
</executions>\r
</plugin>\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-source-plugin</artifactId>\r
+ <executions>\r
+ <execution>\r
+ <id>attach-sources</id>\r
+ <phase>package</phase>\r
+ <goals>\r
+ <goal>jar-no-fork</goal>\r
+ </goals>\r
+ </execution>\r
+ </executions>\r
+ </plugin>\r
</plugins>\r
<pluginManagement>\r
<plugins>\r
* @param messageListener here will be pushed all messages from switch
*/
public void setMessageListener(OpenflowProtocolListener messageListener);
-
- /**
- * @param version version of OpenFlow protocol to be used for communication with switch
- * (set after version negotiation) - in wire protocol format e.g. 4 (or 0x04) for OF 1.3
- *
- */
- public void setVersion(int version);
+
}
uses ofHeader;
- leaf-list packet-in-mask {
- type oft:packet-in-reason;
+ list packet-in-mask {
+ leaf-list mask {
+ type oft:packet-in-reason;
+ }
}
- leaf-list port-status-mask {
- type oft:port-reason;
+ list port-status-mask {
+ leaf-list mask {
+ type oft:port-reason;
+ }
}
- leaf-list flow-removed-mask {
- type oft:flow-removed-reason;
+ list flow-removed-mask {
+ leaf-list mask {
+ type oft:flow-removed-reason;
+ }
}
}
grouping set-async {
* @param ch
* @return connection adapter tcp-implementation
*/
- public static CommunicationFacade createConnectionAdapter(SocketChannel ch) {
+ public static ConnectionFacade createConnectionAdapter(SocketChannel ch) {
ConnectionAdapterImpl connectionAdapter = new ConnectionAdapterImpl();
connectionAdapter.setChannel(ch);
return connectionAdapter;
* @author mirehak
* @author michal.polkorab
*/
-public class ConnectionAdapterImpl implements CommunicationFacade {
+public class ConnectionAdapterImpl implements ConnectionFacade {
/** after this time, rpc future response objects will be thrown away (in minutes) */
public static final int RPC_RESPONSE_EXPIRATION = 1;
private static final String TAG = "OPENFLOW";
private Channel channel;
private OpenflowProtocolListener messageListener;
- private int version;
/** expiring cache for future rpcResponses */
protected Cache<RpcResponseKey, SettableFuture<?>> responseCache;
@Override
public void consume(DataObject message) {
- if (message == null) {
- LOG.error("message is null");
- } else {
- LOG.debug("message is ok");
- }
if (message instanceof Notification) {
if (message instanceof EchoRequestMessage) {
messageListener.onEchoRequestMessage((EchoRequestMessage) message);
return (SettableFuture<RpcResult<?>>) responseCache.getIfPresent(key);
}
- /* (non-Javadoc)
- * @see org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter#setVersion(int)
- */
- @Override
- public void setVersion(int version) {
- this.version = version;
- }
-
}
* @author michal.polkorab\r
*\r
*/\r
-public interface CommunicationFacade extends MessageConsumer, ConnectionAdapter {\r
+public interface ConnectionFacade extends MessageConsumer, ConnectionAdapter {\r
\r
// empty unifying superinterface\r
}\r
}
@Override
- public Future<Boolean> shutdown() {
+ public Future<List<Boolean>> shutdown() {
LOG.debug("shutdown summoned");
- for (ServerFacade server : serverLot) {
- server.shutdown();
+ ListenableFuture<List<Boolean>> result = SettableFuture.create();
+ try {
+ List<ListenableFuture<Boolean>> shutdownChain = new ArrayList<>();
+ for (ServerFacade server : serverLot) {
+ ListenableFuture<Boolean> shutdownFuture = server.shutdown();
+ shutdownChain.add(shutdownFuture);
+ }
+
+ if (!shutdownChain.isEmpty()) {
+ result = Futures.allAsList(shutdownChain);
+ } else {
+ throw new IllegalStateException("no servers configured");
+ }
+ } catch (Exception e) {
+ SettableFuture<List<Boolean>> exFuture = SettableFuture.create();
+ exFuture.setException(e);
+ result = exFuture;
}
- return null;
+ return result;
}
@Override
import java.util.Iterator;\r
\r
import org.opendaylight.openflowjava.protocol.api.connection.SwitchConnectionHandler;\r
-import org.opendaylight.openflowjava.protocol.impl.connection.CommunicationFacade;\r
+import org.opendaylight.openflowjava.protocol.impl.connection.ConnectionFacade;\r
import org.opendaylight.openflowjava.protocol.impl.connection.ConnectionAdapterFactory;\r
import org.opendaylight.openflowjava.protocol.impl.core.TcpHandler.COMPONENT_NAMES;\r
\r
protected void initChannel(SocketChannel ch) throws Exception {\r
// TODO - call switchConnectionHandler accept first\r
allChannels.add(ch);\r
- CommunicationFacade connectionAdapter = null;\r
+ ConnectionFacade connectionAdapter = null;\r
if (switchConnectionHandler != null) {\r
connectionAdapter = ConnectionAdapterFactory.createConnectionAdapter(ch);\r
switchConnectionHandler.onSwitchConnected(connectionAdapter);\r
* stop listening to switches
* @return future, triggered to true, when all listening channels are down
*/
- public Future<Boolean> shutdown();
+ public Future<List<Boolean>> shutdown();
/**
* @param switchConHandler instance being informed when new switch connects