use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactory method setGroupFeatures.
private static MultipartReplyGroupFeaturesCase setGroupFeatures(final ByteBuf rawMessage) {
final MultipartReplyGroupFeaturesCaseBuilder caseBuilder = new MultipartReplyGroupFeaturesCaseBuilder();
MultipartReplyGroupFeaturesBuilder featuresBuilder = new MultipartReplyGroupFeaturesBuilder();
featuresBuilder.setTypes(createGroupType(rawMessage.readUnsignedInt()));
featuresBuilder.setCapabilities(createCapabilities(rawMessage.readUnsignedInt()));
List<Long> maxGroupsList = new ArrayList<>();
for (int i = 0; i < GROUP_TYPES; i++) {
maxGroupsList.add(rawMessage.readUnsignedInt());
}
featuresBuilder.setMaxGroups(maxGroupsList);
List<ActionType> actionBitmaps = new ArrayList<>();
for (int i = 0; i < GROUP_TYPES; i++) {
actionBitmaps.add(createActionBitmap(rawMessage.readUnsignedInt()));
}
featuresBuilder.setActionsBitmap(actionBitmaps);
caseBuilder.setMultipartReplyGroupFeatures(featuresBuilder.build());
return caseBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactoryTest method createActionType.
private static List<ActionType> createActionType() {
ActionType actionType1 = new ActionType(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true);
ActionType actionType2 = new ActionType(true, false, false, false, true, false, true, false, true, false, true, false, true, false, true, true, true);
ActionType actionType3 = new ActionType(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true);
ActionType actionType4 = new ActionType(true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true);
List<ActionType> list = new ArrayList<>();
list.add(actionType1);
list.add(actionType2);
list.add(actionType3);
list.add(actionType4);
return list;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType in project openflowplugin by opendaylight.
the class MultipartReplyGroupFeaturesTest method testMultipartReplyGroupFeatures.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testMultipartReplyGroupFeatures() {
ByteBuf bb = BufferHelper.buildBuffer(//
"00 08 00 01 00 00 00 00 " + // types
"00 00 00 0F " + // capabilities
"00 00 00 0F " + // max groups
"00 00 00 01 " + // max groups
"00 00 00 02 " + // max groups
"00 00 00 03 " + // max groups
"00 00 00 04 " + // actions bitmap (all actions included)
"0F FF 98 01 " + // actions bitmap (no actions included)
"00 00 00 00 " + // actions bitmap (no actions included)
"00 00 00 00 " + // actions bitmap (no actions included)
"00 00 00 00");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 8, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyGroupFeaturesCase messageCase = (MultipartReplyGroupFeaturesCase) builtByFactory.getMultipartReplyBody();
MultipartReplyGroupFeatures message = messageCase.getMultipartReplyGroupFeatures();
Assert.assertEquals("Wrong group types", new GroupTypes(true, true, true, true), message.getTypes());
Assert.assertEquals("Wrong capabilities", new GroupCapabilities(true, true, true, true), message.getCapabilities());
Assert.assertEquals("Wrong max groups", 1, message.getMaxGroups().get(0).intValue());
Assert.assertEquals("Wrong max groups", 2, message.getMaxGroups().get(1).intValue());
Assert.assertEquals("Wrong max groups", 3, message.getMaxGroups().get(2).intValue());
Assert.assertEquals("Wrong max groups", 4, message.getMaxGroups().get(3).intValue());
Assert.assertEquals("Wrong actions bitmap", new ActionType(true, true, true, true, false, true, true, true, true, true, true, true, true, true, true, true, true), message.getActionsBitmap().get(0));
Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(1));
Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(2));
Assert.assertEquals("Wrong actions bitmap", new ActionType(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), message.getActionsBitmap().get(3));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType in project openflowplugin by opendaylight.
the class OpendaylightGroupStatisticsServiceImplTest method testGetGroupFeatures.
@Test
public void testGetGroupFeatures() throws Exception {
GetGroupFeaturesInputBuilder input = new GetGroupFeaturesInputBuilder().setNode(createNodeRef("unitProt:123"));
rpcResult = RpcResultBuilder.<Object>success(Collections.singletonList(new MultipartReplyMessageBuilder().setVersion(OFConstants.OFP_VERSION_1_3).setMultipartReplyBody(new MultipartReplyGroupFeaturesCaseBuilder().setMultipartReplyGroupFeatures(new MultipartReplyGroupFeaturesBuilder().setActionsBitmap(Collections.singletonList(new ActionType(true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false))).setCapabilities(new GroupCapabilities(true, false, false, false)).setTypes(new GroupTypes(true, false, false, false)).setMaxGroups(Collections.singletonList(5L)).build()).build()).build())).build();
final Future<RpcResult<GetGroupFeaturesOutput>> resultFuture = groupStatisticsService.getGroupFeatures(input.build());
Assert.assertTrue(resultFuture.isDone());
final RpcResult<GetGroupFeaturesOutput> rpcResult = resultFuture.get();
Assert.assertTrue(rpcResult.isSuccessful());
Assert.assertEquals(MultipartType.OFPMPGROUPFEATURES, requestInput.getValue().getType());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType 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