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