use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities in project openflowplugin by opendaylight.
the class GetFeaturesOutputFactoryTest method testSerialize.
@Test
public void testSerialize() throws Exception {
GetFeaturesOutputBuilder builder = new GetFeaturesOutputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setDatapathId(BigInteger.valueOf(1234L));
builder.setBuffers(1234L);
builder.setTables((short) 12);
builder.setAuxiliaryId((short) 12);
builder.setCapabilities(new Capabilities(true, false, true, false, true, false, true));
builder.setReserved(1234L);
GetFeaturesOutput message = builder.build();
ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer();
factory.serialize(message, serializedBuffer);
BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 32);
Assert.assertEquals("Wrong DatapathId", message.getDatapathId().longValue(), serializedBuffer.readLong());
Assert.assertEquals("Wrong Buffer ID", message.getBuffers().longValue(), serializedBuffer.readInt());
Assert.assertEquals("Wrong tables", message.getTables().shortValue(), serializedBuffer.readUnsignedByte());
Assert.assertEquals("Wrong auxiliary ID", message.getAuxiliaryId().shortValue(), serializedBuffer.readUnsignedByte());
serializedBuffer.skipBytes(PADDING);
Assert.assertEquals("Wrong Capabilities", message.getCapabilities(), createCapabilities(serializedBuffer.readInt()));
Assert.assertEquals("Wrong reserved", message.getReserved().longValue(), serializedBuffer.readInt());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities in project openflowplugin by opendaylight.
the class SwitchFeaturesUtilTest method testSwFeaturesCapabilitiesV13.
/**
* Test method for
* {@link SwitchFeaturesUtil#buildSwitchFeatures} for OF 1.3 version
* and switch feature capabilities
* .
*/
@Test
public void testSwFeaturesCapabilitiesV13() {
Capabilities capabilities = new Capabilities(true, false, true, false, true, false, true);
featuresOutputBuilder.setCapabilities(capabilities).setCapabilitiesV10(null).setVersion((short) 4);
Assert.assertNotNull(swUtil.buildSwitchFeatures(featuresOutputBuilder.build()));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities in project openflowplugin by opendaylight.
the class SwitchFeaturesUtilTest method testSwFeaturesCapabilitiesMalformed.
/**
* Test method for
* {@link SwitchFeaturesUtil#buildSwitchFeatures} for malformed switch feature capabilities
* - at least one feature is null
* .
*/
// @Test TODO:do we need to check if capability is null?
public void testSwFeaturesCapabilitiesMalformed() {
CapabilitiesV10 capabilities = new CapabilitiesV10(true, false, true, false, true, false, true, null);
featuresOutputBuilder.setCapabilitiesV10(capabilities).setCapabilities(null).setVersion((short) 1);
Assert.assertNull(swUtil.buildSwitchFeatures(featuresOutputBuilder.build()));
}
Aggregations