Search in sources :

Example 51 with GroupId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId in project openflowplugin by opendaylight.

the class MultipartRequestInputFactoryTest method decodeRequestGroup.

private static MultipartRequestGroupCase decodeRequestGroup(ByteBuf output) {
    MultipartRequestGroupCaseBuilder caseBuilder = new MultipartRequestGroupCaseBuilder();
    MultipartRequestGroupBuilder builder = new MultipartRequestGroupBuilder();
    builder.setGroupId(new GroupId(output.readUnsignedInt()));
    output.skipBytes(PADDING_IN_MULTIPART_REQUEST_GROUP_BODY);
    caseBuilder.setMultipartRequestGroup(builder.build());
    return caseBuilder.build();
}
Also used : MultipartRequestGroupCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupCaseBuilder) MultipartRequestGroupBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroupBuilder) GroupId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId)

Example 52 with GroupId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId in project openflowplugin by opendaylight.

the class GroupActionDeserializerTest method testDeserialize.

@Test
public void testDeserialize() throws Exception {
    final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
    final int groupId = 10;
    writeHeader(in);
    in.writeInt(groupId);
    final Action action = deserializeAction(in);
    assertTrue(GroupActionCase.class.isInstance(action));
    assertEquals(groupId, GroupActionCase.class.cast(action).getGroupAction().getGroupId().intValue());
    assertEquals(0, in.readableBytes());
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action) ByteBuf(io.netty.buffer.ByteBuf) GroupActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCase) Test(org.junit.Test)

Example 53 with GroupId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId in project openflowplugin by opendaylight.

the class MultipartReplyMessageFactoryTest method createGroupDesc.

private static List<GroupDesc> createGroupDesc() {
    GroupDescBuilder builder = new GroupDescBuilder();
    builder.setType(GroupType.forValue(1));
    builder.setGroupId(new GroupId(1L));
    builder.setBucketsList(createBucketsList());
    List<GroupDesc> list = new ArrayList<>();
    list.add(builder.build());
    return list;
}
Also used : GroupDesc(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.multipart.reply.group.desc.GroupDesc) MultipartReplyGroupDesc(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.MultipartReplyGroupDesc) ArrayList(java.util.ArrayList) MultipartReplyGroupDescBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.MultipartReplyGroupDescBuilder) GroupDescBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.multipart.reply.group.desc.GroupDescBuilder) GroupId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId)

Example 54 with GroupId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId in project openflowplugin by opendaylight.

the class GroupModInputMessageFactoryTest method testGroupModInputWithNoBuckets.

/**
 * Testing of {@link GroupModInputMessageFactory} for correct translation from POJO.
 */
@Test
public void testGroupModInputWithNoBuckets() throws Exception {
    GroupModInputBuilder builder = new GroupModInputBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
    builder.setCommand(GroupModCommand.forValue(2));
    builder.setType(GroupType.forValue(3));
    builder.setGroupId(new GroupId(256L));
    GroupModInput message = builder.build();
    ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
    groupModFactory.serialize(message, out);
    BufferHelper.checkHeaderV13(out, MESSAGE_TYPE, 16);
    Assert.assertEquals("Wrong command", message.getCommand().getIntValue(), out.readUnsignedShort());
    Assert.assertEquals("Wrong type", message.getType().getIntValue(), out.readUnsignedByte());
    out.skipBytes(PADDING_IN_GROUP_MOD_MESSAGE);
    Assert.assertEquals("Wrong groupId", message.getGroupId().getValue().intValue(), out.readUnsignedInt());
    Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
}
Also used : GroupModInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInputBuilder) ByteBuf(io.netty.buffer.ByteBuf) GroupId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId) GroupModInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInput) Test(org.junit.Test)

Example 55 with GroupId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId in project genius by opendaylight.

the class ItmTunnelAggregationHelper method updateTunnelAggregationGroup.

private void updateTunnelAggregationGroup(InterfaceParentEntry parentEntry) {
    String logicTunnelName = parentEntry.getParentInterface();
    InternalTunnel logicInternalTunnel = ItmUtils.ITM_CACHE.getInternalTunnel(logicTunnelName);
    if (logicInternalTunnel == null) {
        LOG.debug("MULTIPLE_VxLAN_TUNNELS: {} not found in internal tunnels list", logicTunnelName);
        return;
    }
    InterfaceInfo ifLogicTunnel = interfaceManager.getInterfaceInfoFromOperationalDataStore(logicTunnelName);
    long groupId = ifLogicTunnel != null ? interfaceManager.getLogicalTunnelSelectGroupId(ifLogicTunnel.getInterfaceTag()) : INVALID_ID;
    BigInteger srcDpnId = logicInternalTunnel.getSourceDPN();
    List<Bucket> listBuckets = new ArrayList<>();
    List<InterfaceChildEntry> interfaceChildEntries = parentEntry.getInterfaceChildEntry();
    if (interfaceChildEntries == null || interfaceChildEntries.isEmpty()) {
        LOG.debug("MULTIPLE_VxLAN_TUNNELS: empty child list in group {}", parentEntry.getParentInterface());
        return;
    }
    for (InterfaceChildEntry interfaceChildEntry : interfaceChildEntries) {
        String curChildName = interfaceChildEntry.getChildInterface();
        org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface childIface = ItmUtils.getInterface(curChildName, interfaceManager);
        IfTunnel ifTunnel = childIface != null ? childIface.getAugmentation(IfTunnel.class) : null;
        if (ifTunnel == null || !ifTunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeVxlan.class)) {
            LOG.debug("MULTIPLE_VxLAN_TUNNELS: not tunnel interface {} found in group {}", curChildName, logicTunnelName);
            continue;
        }
        ParentRefs parentRefs = childIface.getAugmentation(ParentRefs.class);
        if (parentRefs == null) {
            LOG.debug("MULTIPLE_VxLAN_TUNNELS: parent refs not specified for interface {} in group {}", curChildName, logicTunnelName);
            continue;
        }
        InterfaceInfo ifInfo = interfaceManager.getInterfaceInfoFromOperationalDataStore(curChildName);
        if (ifInfo == null) {
            LOG.debug("MULTIPLE_VxLAN_TUNNELS: interface state not found for {} in groupId {}", curChildName, groupId);
            continue;
        }
        int bucketId = interfaceChildEntries.indexOf(interfaceChildEntry);
        LOG.debug("MULTIPLE_VxLAN_TUNNELS: updateTunnelAggregationGroup - add bucketId {} to groupId {}", bucketId, groupId);
        listBuckets.add(createBucket(curChildName, ifTunnel, bucketId, ifInfo.getPortNo()));
    }
    if (!listBuckets.isEmpty()) {
        Group group = MDSALUtil.buildGroup(groupId, logicTunnelName, GroupTypes.GroupSelect, MDSALUtil.buildBucketLists(listBuckets));
        mdsalManager.syncInstallGroup(srcDpnId, group);
    }
}
Also used : TunnelTypeLogicalGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeLogicalGroup) Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group) ArrayList(java.util.ArrayList) IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel) InternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnel) ParentRefs(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs) Bucket(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket) InterfaceChildEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntry) BigInteger(java.math.BigInteger) InterfaceInfo(org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)

Aggregations

ArrayList (java.util.ArrayList)41 GroupId (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId)36 Test (org.junit.Test)28 Bucket (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket)27 GroupId (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId)22 Group (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group)21 BigInteger (java.math.BigInteger)19 ActionGroup (org.opendaylight.genius.mdsalutil.actions.ActionGroup)18 GroupBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder)12 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)11 BucketsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.BucketsBuilder)10 BucketBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketBuilder)10 ByteBuf (io.netty.buffer.ByteBuf)9 GroupKey (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey)9 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)8 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)8 AddGroupInput (org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput)8 AddGroupInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInputBuilder)8 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder)7 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)6