use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage in project openflowplugin by opendaylight.
the class OF10HelloMessageFactoryTest method testWithElements.
/**
* Testing {@link OF10HelloMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithElements() {
ByteBuf bb = BufferHelper.buildBuffer(// type
"00 01 " + // length
"00 0c " + // bitmap 1
"00 00 00 11 " + // bitmap 2
"00 00 00 00 " + // padding
"00 00 00 00");
HelloMessage builtByFactory = BufferHelper.deserialize(helloFactory, bb);
BufferHelper.checkHeaderV10(builtByFactory);
Assert.assertNull("Wrong elements", builtByFactory.getElements());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage in project openflowplugin by opendaylight.
the class HelloMessageFactoryTest method testSerialize.
@Test
public void testSerialize() throws Exception {
HelloMessageBuilder builder = new HelloMessageBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
HelloMessage message = builder.build();
ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer();
factory.serialize(message, serializedBuffer);
BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 8);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage in project openflowplugin by opendaylight.
the class HandshakeManagerImplTest method testVersionNegotiationNoCommonVersionInBitmap.
/**
* Test of version negotiation Where bitmap version {0x05,0x02}.
*/
@Test
public void testVersionNegotiationNoCommonVersionInBitmap() throws Exception {
LOG.debug("testVersionNegotiationNoCommonVersionInBitmap");
Short version = (short) 0x05;
expectedErrors = 1;
handshakeManager.setUseVersionBitmap(true);
HelloMessageBuilder helloMessage = createHelloMessage(version, helloXid);
addVersionBitmap(Lists.newArrayList((short) 0x05, (short) 0x02), helloMessage);
handshakeManager.shake(helloMessage.build());
Mockito.verify(handshakeListener, Mockito.never()).onHandshakeSuccessful(Matchers.any(GetFeaturesOutput.class), Matchers.anyShort());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage 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.HelloMessage 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);
}
Aggregations