use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessageBuilder in project openflowplugin by opendaylight.
the class HandshakeManagerImplTest method testVersionNegotiation13InBitmap.
/**
* Test of version negotiation Where bitmap version {0x05,0x04}.
*/
@Test
public void testVersionNegotiation13InBitmap() throws Exception {
LOG.debug("testVersionNegotiation13InBitmap");
Short version = OFConstants.OFP_VERSION_1_3;
handshakeManager.setUseVersionBitmap(true);
HelloMessageBuilder helloMessage = createHelloMessage(version, helloXid);
addVersionBitmap(Lists.newArrayList((short) 0x05, OFConstants.OFP_VERSION_1_3), helloMessage);
Mockito.when(adapter.getFeatures(Matchers.any(GetFeaturesInput.class))).thenReturn(Futures.immediateFuture(resultFeatures));
handshakeManager.shake(helloMessage.build());
Mockito.verify(handshakeListener).onHandshakeSuccessful(resultFeatures.getResult(), version);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessageBuilder in project openflowplugin by opendaylight.
the class HandshakeManagerImplTest method testVersionNegotiation13InBitmapSwitchFirst.
/**
* Test of version negotiation Where bitmap version {0x05,0x04}.
*/
@Test
public void testVersionNegotiation13InBitmapSwitchFirst() throws Exception {
LOG.debug("testVersionNegotiation13InBitmap-ss");
Short version = OFConstants.OFP_VERSION_1_3;
handshakeManager.setUseVersionBitmap(true);
HelloMessageBuilder helloMessage = createHelloMessage(version, helloXid);
addVersionBitmap(Lists.newArrayList((short) 0x05, OFConstants.OFP_VERSION_1_3), helloMessage);
Mockito.when(adapter.getFeatures(Matchers.any(GetFeaturesInput.class))).thenReturn(Futures.immediateFuture(resultFeatures));
handshakeManager.shake(null);
handshakeManager.shake(helloMessage.build());
Mockito.verify(handshakeListener).onHandshakeSuccessful(resultFeatures.getResult(), version);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessageBuilder in project openflowplugin by opendaylight.
the class HandshakeManagerImplTest method testVersionNegotiation10InBitmapSwitchStarts.
/**
* Test of version negotiation Where bitmap version {0x05,0x01}.
*/
@Test
public void testVersionNegotiation10InBitmapSwitchStarts() throws Exception {
LOG.debug("testVersionNegotiation10InBitmap-ss");
Short version = OFConstants.OFP_VERSION_1_0;
handshakeManager.setUseVersionBitmap(true);
HelloMessageBuilder helloMessage = createHelloMessage(version, helloXid);
addVersionBitmap(Lists.newArrayList((short) 0x05, OFConstants.OFP_VERSION_1_0), helloMessage);
Mockito.when(adapter.getFeatures(Matchers.any(GetFeaturesInput.class))).thenReturn(Futures.immediateFuture(resultFeatures));
handshakeManager.shake(null);
handshakeManager.shake(helloMessage.build());
Mockito.verify(handshakeListener).onHandshakeSuccessful(resultFeatures.getResult(), version);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessageBuilder in project openflowplugin by opendaylight.
the class HandshakeManagerImplTest method testVersionNegotiation10InBitmap.
/**
* Test of version negotiation Where bitmap version {0x05,0x01}.
*/
@Test
public void testVersionNegotiation10InBitmap() throws Exception {
LOG.debug("testVersionNegotiation10InBitmap");
Short version = OFConstants.OFP_VERSION_1_0;
handshakeManager.setUseVersionBitmap(true);
HelloMessageBuilder helloMessage = createHelloMessage(version, helloXid);
addVersionBitmap(Lists.newArrayList((short) 0x05, OFConstants.OFP_VERSION_1_0), helloMessage);
Mockito.when(adapter.getFeatures(Matchers.any(GetFeaturesInput.class))).thenReturn(Futures.immediateFuture(resultFeatures));
handshakeManager.shake(helloMessage.build());
Mockito.verify(handshakeListener).onHandshakeSuccessful(resultFeatures.getResult(), version);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessageBuilder in project openflowplugin by opendaylight.
the class ConnectionAdapterImplStatisticsTest method testMessagePassCounter.
/**
* Test counter for pass messages to consumer (counter US_MESSAGE_PASS has to be enabled).
*/
@Test
public void testMessagePassCounter() {
if (!statCounters.isCounterEnabled(CounterEventTypes.US_MESSAGE_PASS)) {
Assert.fail("Counter " + CounterEventTypes.US_MESSAGE_PASS + " is not enabled");
}
when(channel.pipeline()).thenReturn(pipeline);
adapter = new ConnectionAdapterImpl(channel, InetSocketAddress.createUnresolved("10.0.0.1", 6653), true, CHANNEL_OUTBOUND_QUEUE_SIZE);
adapter.setMessageListener(messageListener);
adapter.setSystemListener(systemListener);
adapter.setConnectionReadyListener(readyListener);
cache = CacheBuilder.newBuilder().concurrencyLevel(1).expireAfterWrite(RPC_RESPONSE_EXPIRATION, TimeUnit.MINUTES).removalListener(REMOVAL_LISTENER).build();
adapter.setResponseCache(cache);
when(channel.disconnect()).thenReturn(channelFuture);
DataObject message = new EchoRequestMessageBuilder().build();
adapter.consume(message);
message = new ErrorMessageBuilder().build();
adapter.consume(message);
message = new ExperimenterMessageBuilder().build();
adapter.consume(message);
message = new FlowRemovedMessageBuilder().build();
adapter.consume(message);
message = new HelloMessageBuilder().build();
adapter.consume(message);
message = new MultipartReplyMessageBuilder().build();
adapter.consume(message);
message = new PacketInMessageBuilder().build();
adapter.consume(message);
message = new PortStatusMessageBuilder().build();
adapter.consume(message);
message = new EchoRequestMessageBuilder().build();
adapter.consume(message);
Assert.assertEquals("Wrong - bad counter value for ConnectionAdapterImpl consume method", 9, statCounters.getCounter(CounterEventTypes.US_MESSAGE_PASS).getCounterValue());
adapter.disconnect();
}
Aggregations