Search in sources :

Example 6 with ActionType

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();
}
Also used : MultipartReplyGroupFeaturesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesCaseBuilder) ActionType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType) ArrayList(java.util.ArrayList) MultipartReplyGroupFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.MultipartReplyGroupFeaturesBuilder)

Example 7 with ActionType

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

Example 8 with ActionType

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));
}
Also used : MultipartReplyGroupFeaturesCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesCase) GroupTypes(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupTypes) GroupCapabilities(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupCapabilities) MultipartReplyMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage) 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) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 9 with ActionType

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());
}
Also used : MultipartReplyGroupFeaturesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesCaseBuilder) GroupTypes(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupTypes) GetGroupFeaturesOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesOutput) GroupCapabilities(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupCapabilities) ActionType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType) MultipartReplyMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder) GetGroupFeaturesInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesInputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) MultipartReplyGroupFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.MultipartReplyGroupFeaturesBuilder) Test(org.junit.Test)

Example 10 with ActionType

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);
    }
}
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

ActionType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType)8 ArrayList (java.util.ArrayList)7 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 MultipartReplyGroupFeaturesCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesCaseBuilder)3 MultipartReplyGroupFeaturesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.MultipartReplyGroupFeaturesBuilder)3 BucketId (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId)2 GroupId (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId)2 BucketsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.BucketsBuilder)2 Bucket (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket)2 BucketBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketBuilder)2 BucketKey (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketKey)2 GroupBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder)2 GroupKey (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey)2 MultipartReplyGroupFeaturesCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesCase)2 MultipartReplyGroupFeatures (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.MultipartReplyGroupFeatures)2 ByteBuf (io.netty.buffer.ByteBuf)1 CopyTtlInCase (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCase)1 CopyTtlOutCase (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCase)1