Search in sources :

Example 6 with MultipartReplyGroupFeatures

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyGroupFeatures in project openflowplugin by opendaylight.

the class MultipartReplyGroupFeaturesDeserializerTest method testDeserialize.

@Test
public void testDeserialize() throws Exception {
    int bitMaskGroups = ByteBufUtils.fillBitMask(0, GROUP_TYPES_SUPPORTED.contains(GroupTypes.GroupAll), GROUP_TYPES_SUPPORTED.contains(GroupTypes.GroupSelect), GROUP_TYPES_SUPPORTED.contains(GroupTypes.GroupIndirect), GROUP_TYPES_SUPPORTED.contains(GroupTypes.GroupFf));
    int bitMaskCapabilities = ByteBufUtils.fillBitMask(0, GROUP_CAPABILITIES_SUPPORTED.contains(GroupCapabilities.SelectWeight), GROUP_CAPABILITIES_SUPPORTED.contains(GroupCapabilities.SelectLiveness), GROUP_CAPABILITIES_SUPPORTED.contains(GroupCapabilities.Chaining), GROUP_CAPABILITIES_SUPPORTED.contains(GroupCapabilities.ChainingChecks));
    ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();
    buffer.writeInt(bitMaskGroups);
    buffer.writeInt(bitMaskCapabilities);
    for (Long group : MAX_GROUPS_LIST) {
        buffer.writeInt(group.intValue());
    }
    for (Long action : ACTIONS_LIST) {
        buffer.writeInt(action.intValue());
    }
    final MultipartReplyGroupFeatures reply = (MultipartReplyGroupFeatures) deserializeMultipart(buffer);
    assertTrue(reply.getActions().containsAll(ACTIONS_LIST));
    assertTrue(reply.getMaxGroups().containsAll(MAX_GROUPS_LIST));
    assertEquals(GROUP_TYPES_SUPPORTED.size(), reply.getGroupTypesSupported().size());
    assertEquals(GroupAll.class, reply.getGroupTypesSupported().get(0));
    assertEquals(GroupSelect.class, reply.getGroupTypesSupported().get(1));
    assertEquals(GroupIndirect.class, reply.getGroupTypesSupported().get(2));
    assertEquals(GROUP_CAPABILITIES_SUPPORTED.size(), reply.getGroupCapabilitiesSupported().size());
    assertEquals(Chaining.class, reply.getGroupCapabilitiesSupported().get(0));
    assertEquals(ChainingChecks.class, reply.getGroupCapabilitiesSupported().get(1));
    assertEquals(0, buffer.readableBytes());
}
Also used : MultipartReplyGroupFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyGroupFeatures) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 7 with MultipartReplyGroupFeatures

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyGroupFeatures in project openflowplugin by opendaylight.

the class MultipartReplyMessageFactory method serializeGroupFeaturesBody.

private void serializeGroupFeaturesBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
    MultipartReplyGroupFeaturesCase groupFeaturesCase = (MultipartReplyGroupFeaturesCase) body;
    MultipartReplyGroupFeatures groupFeatures = groupFeaturesCase.getMultipartReplyGroupFeatures();
    writeGroupTypes(groupFeatures.getTypes(), outBuffer);
    writeGroupCapabilities(groupFeatures.getCapabilities(), outBuffer);
    for (Long maxGroups : groupFeatures.getMaxGroups()) {
        outBuffer.writeInt(maxGroups.intValue());
    }
    for (ActionType action : groupFeatures.getActionsBitmap()) {
        writeActionType(action, outBuffer);
    }
}
Also used : MultipartReplyGroupFeaturesCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesCase) ActionType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType) MultipartReplyGroupFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.MultipartReplyGroupFeatures)

Aggregations

MultipartReplyGroupFeaturesCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesCase)6 MultipartReplyGroupFeatures (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.MultipartReplyGroupFeatures)6 ByteBuf (io.netty.buffer.ByteBuf)4 Test (org.junit.Test)4 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 MultipartReplyMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage)3 ArrayList (java.util.ArrayList)2 ActionType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType)2 GroupFeaturesUpdatedBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupFeaturesUpdatedBuilder)1 MultipartReplyGroupFeatures (org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyGroupFeatures)1 MultipartReplyGroupFeaturesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesBuilder)1 GroupCapability (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupCapability)1 GroupType (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupType)1 MultipartRequestFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags)1 MultipartReplyMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder)1 MultipartReplyGroupFeaturesCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesCaseBuilder)1 MultipartReplyGroupFeaturesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.MultipartReplyGroupFeaturesBuilder)1