use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId in project openflowplugin by opendaylight.
the class GroupStatsResponseConvertor method toSALBuckets.
private Buckets toSALBuckets(List<BucketStats> bucketStats) {
BucketsBuilder salBuckets = new BucketsBuilder();
List<BucketCounter> allBucketStats = new ArrayList<>();
int bucketKey = 0;
for (BucketStats bucketStat : bucketStats) {
BucketCounterBuilder bucketCounter = new BucketCounterBuilder();
bucketCounter.setByteCount(new Counter64(bucketStat.getByteCount()));
bucketCounter.setPacketCount(new Counter64(bucketStat.getPacketCount()));
BucketId bucketId = new BucketId((long) bucketKey);
bucketCounter.setKey(new BucketCounterKey(bucketId));
bucketCounter.setBucketId(bucketId);
bucketKey++;
allBucketStats.add(bucketCounter.build());
}
salBuckets.setBucketCounter(allBucketStats);
return salBuckets.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId 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);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId in project genius by opendaylight.
the class MDSALUtil method buildBuckets.
protected static Buckets buildBuckets(List<BucketInfo> listBucketInfo) {
long index = 0;
if (listBucketInfo != null) {
BucketsBuilder bucketsBuilder = new BucketsBuilder();
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();
}
return EMPTY_BUCKETS;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId in project genius by opendaylight.
the class MDSALManager method deleteBucket.
public void deleteBucket(BigInteger dpId, long groupId, long bucketId, WriteTransaction tx) {
Node nodeDpn = buildDpnNode(dpId);
if (groupExists(nodeDpn, groupId)) {
InstanceIdentifier<Bucket> bucketInstanceId = buildBucketInstanceIdentifier(groupId, bucketId, nodeDpn);
tx.delete(LogicalDatastoreType.CONFIGURATION, bucketInstanceId);
} else {
LOG.debug("Group {} does not exist for dpn {}", groupId, dpId);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId in project netvirt by opendaylight.
the class ElanL2GatewayMulticastUtils method getRemoteBCGroupTunnelBuckets.
@SuppressWarnings("checkstyle:IllegalCatch")
private List<Bucket> getRemoteBCGroupTunnelBuckets(ElanDpnInterfacesList elanDpns, BigInteger dpnId, int bucketId, long elanTagOrVni) {
List<Bucket> listBucketInfo = new ArrayList<>();
if (elanDpns != null) {
for (DpnInterfaces dpnInterface : elanDpns.getDpnInterfaces()) {
if (elanUtils.isDpnPresent(dpnInterface.getDpId()) && !Objects.equals(dpnInterface.getDpId(), dpnId) && dpnInterface.getInterfaces() != null && !dpnInterface.getInterfaces().isEmpty()) {
try {
List<Action> listActionInfo = elanItmUtils.getInternalTunnelItmEgressAction(dpnId, dpnInterface.getDpId(), elanTagOrVni);
if (listActionInfo.isEmpty()) {
continue;
}
listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
bucketId++;
} catch (Exception ex) {
LOG.error("Logical Group Interface not found between source Dpn - {}, destination Dpn - {} ", dpnId, dpnInterface.getDpId(), ex);
}
}
}
}
return listBucketInfo;
}
Aggregations