Search in sources :

Example 31 with Capabilities

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());
}
Also used : GetFeaturesOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutputBuilder) GetFeaturesOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput) Capabilities(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 32 with Capabilities

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()));
}
Also used : Capabilities(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities) Test(org.junit.Test)

Example 33 with Capabilities

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()));
}
Also used : CapabilitiesV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.CapabilitiesV10)

Aggregations

Test (org.junit.Test)18 ByteBuf (io.netty.buffer.ByteBuf)14 CapabilitiesV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.CapabilitiesV10)8 Capabilities (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities)7 GetFeaturesOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput)6 MultipartReplyMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage)6 ArrayList (java.util.ArrayList)5 Before (org.junit.Before)3 GroupCapabilities (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupCapabilities)3 GroupTypes (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupTypes)3 MeterBandTypeBitmap (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterBandTypeBitmap)3 MeterFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterFlags)3 MultipartReplyGroupFeaturesCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesCase)3 MultipartReplyMeterFeaturesCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterFeaturesCase)3 MultipartReplyGroupFeatures (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.MultipartReplyGroupFeatures)3 MultipartReplyMeterFeatures (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter.features._case.MultipartReplyMeterFeatures)3 OptionalCapabilities (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.OptionalCapabilities)3 Nullable (javax.annotation.Nullable)2 ConnectionContext (org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext)2 DeviceInfo (org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo)2