Search in sources :

Example 21 with BucketId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId in project netvirt by opendaylight.

the class ElanL2GatewayMulticastUtils method getRemoteBCGroupBucketsOfElanExternalTeps.

public List<Bucket> getRemoteBCGroupBucketsOfElanExternalTeps(ElanInstance elanInfo, BigInteger dpnId, int bucketId) {
    ElanInstance operElanInstance = null;
    try {
        operElanInstance = new SingleTransactionDataBroker(broker).syncReadOptional(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.builder(ElanInstances.class).child(ElanInstance.class, elanInfo.getKey()).build()).orNull();
    } catch (ReadFailedException e) {
        LOG.error("Failed to read elan instance operational path {}", elanInfo, e);
        return emptyList();
    }
    if (operElanInstance == null) {
        return emptyList();
    }
    List<ExternalTeps> teps = operElanInstance.getExternalTeps();
    if (teps == null || teps.isEmpty()) {
        return emptyList();
    }
    List<Bucket> listBucketInfo = new ArrayList<>();
    for (ExternalTeps tep : teps) {
        String externalTep = tep.getNodeid() != null ? tep.getNodeid() : tep.getTepIp().toString();
        String interfaceName = elanItmUtils.getExternalTunnelInterfaceName(String.valueOf(dpnId), externalTep);
        if (interfaceName == null) {
            LOG.error("Could not get interface name to ext tunnel {} {}", dpnId, tep.getTepIp());
            continue;
        }
        List<Action> listActionInfo = elanItmUtils.buildTunnelItmEgressActions(interfaceName, elanUtils.getVxlanSegmentationId(elanInfo));
        listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
        bucketId++;
    }
    return listBucketInfo;
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) ExternalTeps(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.elan.instance.ExternalTeps) ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) Bucket(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket) ArrayList(java.util.ArrayList) SingleTransactionDataBroker(org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker) ElanInstances(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInstances)

Example 22 with BucketId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId in project netvirt by opendaylight.

the class ElanInterfaceManager method removeElanBroadcastGroup.

public void removeElanBroadcastGroup(ElanInstance elanInfo, InterfaceInfo interfaceInfo, WriteTransaction deleteFlowGroupTx) {
    int bucketId = 0;
    int actionKey = 0;
    Long elanTag = elanInfo.getElanTag();
    List<Bucket> listBuckets = new ArrayList<>();
    List<Action> listAction = new ArrayList<>();
    listAction.add(new ActionGroup(++actionKey, ElanUtils.getElanLocalBCGId(elanTag)).buildAction());
    listBuckets.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
    bucketId++;
    listBuckets.addAll(getRemoteBCGroupBucketInfos(elanInfo, bucketId, interfaceInfo, elanTag));
    BigInteger dpnId = interfaceInfo.getDpId();
    long groupId = ElanUtils.getElanRemoteBCGId(elanInfo.getElanTag());
    Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBuckets));
    LOG.trace("deleting the remoteBroadCast group:{}", group);
    mdsalManager.removeGroupToTx(dpnId, group, deleteFlowGroupTx);
}
Also used : ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) Bucket(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket) ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) ArrayList(java.util.ArrayList) BigInteger(java.math.BigInteger)

Example 23 with BucketId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId in project netvirt by opendaylight.

the class ElanInterfaceManager method removeLocalBroadcastGroup.

public void removeLocalBroadcastGroup(ElanInstance elanInfo, InterfaceInfo interfaceInfo, WriteTransaction deleteFlowGroupTx) {
    BigInteger dpnId = interfaceInfo.getDpId();
    long groupId = ElanUtils.getElanLocalBCGId(elanInfo.getElanTag());
    List<Bucket> listBuckets = new ArrayList<>();
    int bucketId = 0;
    listBuckets.add(getLocalBCGroupBucketInfo(interfaceInfo, bucketId));
    // listBuckets.addAll(getRemoteBCGroupBucketInfos(elanInfo, 1,
    // interfaceInfo));
    Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBuckets));
    LOG.trace("deleted the localBroadCast Group:{}", group);
    mdsalManager.removeGroupToTx(dpnId, group, deleteFlowGroupTx);
}
Also used : ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group) Bucket(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket) ArrayList(java.util.ArrayList) BigInteger(java.math.BigInteger)

Example 24 with BucketId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId in project netvirt by opendaylight.

the class ElanInterfaceManager method removeLeavesEtreeBroadcastGroup.

private void removeLeavesEtreeBroadcastGroup(ElanInstance elanInfo, InterfaceInfo interfaceInfo, WriteTransaction deleteFlowGroupTx) {
    EtreeInstance etreeInstance = elanInfo.getAugmentation(EtreeInstance.class);
    if (etreeInstance != null) {
        long etreeTag = etreeInstance.getEtreeLeafTagVal().getValue();
        int bucketId = 0;
        int actionKey = 0;
        List<Bucket> listBuckets = new ArrayList<>();
        List<Action> listAction = new ArrayList<>();
        listAction.add(new ActionGroup(ElanUtils.getEtreeLeafLocalBCGId(etreeTag)).buildAction(++actionKey));
        listBuckets.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
        bucketId++;
        listBuckets.addAll(getRemoteBCGroupBucketInfos(elanInfo, bucketId, interfaceInfo, etreeTag));
        BigInteger dpnId = interfaceInfo.getDpId();
        long groupId = ElanUtils.getEtreeLeafRemoteBCGId(etreeTag);
        Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBuckets));
        LOG.trace("deleting the remoteBroadCast group:{}", group);
        mdsalManager.removeGroupToTx(dpnId, group, deleteFlowGroupTx);
    }
}
Also used : ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) Bucket(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket) ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) ArrayList(java.util.ArrayList) EtreeInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance) BigInteger(java.math.BigInteger)

Example 25 with BucketId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId in project netvirt by opendaylight.

the class FibUtil method buildBuckets.

static Buckets buildBuckets(List<BucketInfo> listBucketInfo) {
    long index = 0;
    BucketsBuilder bucketsBuilder = new BucketsBuilder();
    if (listBucketInfo != null) {
        List<Bucket> bucketList = new ArrayList<>();
        for (BucketInfo bucketInfo : listBucketInfo) {
            BucketBuilder bucketBuilder = new BucketBuilder();
            bucketBuilder.setAction(bucketInfo.buildActions());
            bucketBuilder.setWeight(bucketInfo.getWeight());
            bucketBuilder.setBucketId(new BucketId(index++));
            bucketBuilder.setWeight(bucketInfo.getWeight()).setWatchPort(bucketInfo.getWatchPort()).setWatchGroup(bucketInfo.getWatchGroup());
            bucketList.add(bucketBuilder.build());
        }
        bucketsBuilder.setBucket(bucketList);
    }
    return bucketsBuilder.build();
}
Also used : BucketBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketBuilder) Bucket(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket) ArrayList(java.util.ArrayList) BucketsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.BucketsBuilder) BucketInfo(org.opendaylight.genius.mdsalutil.BucketInfo) BucketId(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId)

Aggregations

Bucket (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket)27 ArrayList (java.util.ArrayList)25 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)11 Group (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group)11 ActionGroup (org.opendaylight.genius.mdsalutil.actions.ActionGroup)10 BucketId (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId)10 BigInteger (java.math.BigInteger)8 BucketBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketBuilder)8 BucketsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.BucketsBuilder)7 GroupId (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId)5 InterfaceInfo (org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)4 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder)4 BucketKey (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketKey)4 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)3 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)3 EtreeInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance)3 Counter64 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64)2 GroupActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder)2 ActionKey (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey)2 InterfaceChildEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntry)2