builder.setVersion(echoRequestMessage.getVersion());
builder.setXid(echoRequestMessage.getXid());
builder.setData(echoRequestMessage.getData());
-
+
getConnectionAdapter().echoReply(builder.build());
}
- }).start();
+ }).start();
}
@Override
* 2. If HelloMessage contains bitmap and common version found in bitmap
* then continue connection processing. if no common version found, just disconnect.
* 3. If HelloMessage version is not supported, send HelloMessage with lower supported version.
- * If Hello message received again with not supported version, just disconnect.
+ * 4. If Hello message received again with not supported version, just disconnect.
*
* TODO: Better to handle handshake into a maintainable innerclass which uses State-Pattern.
*/
// TODO:: get from configuration
return 2000;
}
-
+
/**
* @return milliseconds
*/
EchoInputBuilder builder = new EchoInputBuilder();
builder.setVersion(getVersion());
builder.setXid(getSessionContext().getNextXid());
-
+
Future<RpcResult<EchoOutput>> echoReplyFuture = getConnectionAdapter()
.echo(builder.build());
-
+
try {
RpcResult<EchoOutput> echoReplyValue = echoReplyFuture.get(getMaxTimeout(),
getMaxTimeoutUnit());
}
}
}
-
+
}).start();
}
@Override
public Future<Boolean> disconnect() {
LOG.info("disconnecting: sessionCtx="+sessionContext+"|auxId="+auxiliaryKey);
-
+
Future<Boolean> result = null;
if (connectionAdapter.isAlive()) {
result = connectionAdapter.disconnect();
LOG.debug("connection already disconnected");
result = Futures.immediateFuture(true);
}
-
- return result;
+
+ return result;
}
@Override
public SessionContext getSessionContext() {
return sessionContext;
}
-
+
@Override
public ConnectionAdapter getConnectionAdapter() {
return connectionAdapter;
/** in [ms] */
private final int maxProcessingTimeout = 500;
-
+
protected ConnectionAdapterStackImpl adapter;
private ConnectionConductorImpl connectionConductor;
private MDController controller;
@Before
public void setUp() throws Exception {
adapter = new ConnectionAdapterStackImpl();
-
+
popListener = new PopListenerCountingImpl<>();
queueKeeper = new QueueKeeperLightImpl();
queueKeeper.init();
queueKeeper.addPopListener(popListener);
-
+
connectionConductor = new ConnectionConductorImpl(adapter);
connectionConductor.setQueueKeeper(queueKeeper);
connectionConductor.init();
builder1.setExperimenter(84L).setExpType(4L);
eventPlan.add(0, EventFactory.createDefaultNotificationEvent(42L,
EventFactory.DEFAULT_VERSION, builder1));
-
+
executeLater();
Runnable sendExperimenterCmd = new Runnable() {
* Test method for
* {@link org.opendaylight.openflowplugin.openflow.md.core.ConnectionConductorImpl#onFlowRemovedMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage)}
* .
- * @throws InterruptedException
+ * @throws InterruptedException
*/
@Test
public void testOnFlowRemovedMessage() throws InterruptedException {
eventPlan.add(0, EventFactory.createDefaultRpcResponseEvent(43,
EventFactory.DEFAULT_VERSION, getFeatureResponseMsg()));
execute(true);
-
+
// Now send Flow Removed messages
FlowRemovedMessageBuilder builder1 = new FlowRemovedMessageBuilder();
builder1.setVersion((short) 4);
* Test method for
* {@link org.opendaylight.openflowplugin.openflow.md.core.ConnectionConductorImpl#onPacketInMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage)}
* .
- * @throws InterruptedException
+ * @throws InterruptedException
*/
@Test
public void testOnPacketInMessage() throws InterruptedException {
eventPlan.add(0, EventFactory.createDefaultRpcResponseEvent(43,
EventFactory.DEFAULT_VERSION, getFeatureResponseMsg()));
execute(true);
-
+
// Now send PacketIn
PacketInMessageBuilder builder1 = new PacketInMessageBuilder();
builder1.setVersion((short) 4);
* Test method for
* {@link org.opendaylight.openflowplugin.openflow.md.core.ConnectionConductorImpl#onPortStatusMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage)}
* .
- * @throws InterruptedException
+ * @throws InterruptedException
*/
@Test
public void testOnPortStatusMessage() throws InterruptedException {
eventPlan.add(0, EventFactory.createDefaultRpcResponseEvent(43,
EventFactory.DEFAULT_VERSION, getFeatureResponseMsg()));
execute(true);
-
+
// Send Port Status messages
PortStatusMessageBuilder builder1 = new PortStatusMessageBuilder();
builder1.setVersion((short) 4);
popListener.wait(maxProcessingTimeout);
}
Assert.assertEquals(1, experimenterMessageCounter);
-
+
builder1.setExperimenter(85L).setExpType(4L);
connectionConductor.onExperimenterMessage(builder1.build());
synchronized (popListener) {
}
Assert.assertEquals(2, experimenterMessageCounter);
}
-
+
/**
* Test method for
* {@link org.opendaylight.openflowplugin.openflow.md.core.ConnectionConductorImpl#onExperimenterMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage)}
}
/**
- * @return listener mapping for :
+ * @return listener mapping for:
* <ul>
* <li>experimenter</li>
* <li>error</li>