use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.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);
}
}
Aggregations