use of io.fabric8.groups.Group in project netvirt by opendaylight.
the class ElanInterfaceManager method setBCGrouponOtherDpns.
@SuppressWarnings("checkstyle:IllegalCatch")
private void setBCGrouponOtherDpns(ElanInstance elanInfo, BigInteger dpId, int elanTag, long groupId) {
int bucketId = 0;
ElanDpnInterfacesList elanDpns = elanUtils.getElanDpnInterfacesList(elanInfo.getElanInstanceName());
if (elanDpns != null) {
List<DpnInterfaces> dpnInterfaces = elanDpns.getDpnInterfaces();
for (DpnInterfaces dpnInterface : dpnInterfaces) {
List<Bucket> remoteListBucketInfo = new ArrayList<>();
if (elanUtils.isDpnPresent(dpnInterface.getDpId()) && !Objects.equals(dpnInterface.getDpId(), dpId) && dpnInterface.getInterfaces() != null && !dpnInterface.getInterfaces().isEmpty()) {
List<Action> listAction = new ArrayList<>();
int actionKey = 0;
listAction.add(new ActionGroup(ElanUtils.getElanLocalBCGId(elanTag)).buildAction(++actionKey));
remoteListBucketInfo.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
bucketId++;
for (DpnInterfaces otherFes : dpnInterfaces) {
if (elanUtils.isDpnPresent(otherFes.getDpId()) && !Objects.equals(otherFes.getDpId(), dpnInterface.getDpId()) && otherFes.getInterfaces() != null && !otherFes.getInterfaces().isEmpty()) {
try {
List<Action> remoteListActionInfo = elanItmUtils.getInternalTunnelItmEgressAction(dpnInterface.getDpId(), otherFes.getDpId(), elanUtils.isOpenstackVniSemanticsEnforced() ? elanUtils.getVxlanSegmentationId(elanInfo) : elanTag);
if (!remoteListActionInfo.isEmpty()) {
remoteListBucketInfo.add(MDSALUtil.buildBucket(remoteListActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
bucketId++;
}
} catch (Exception ex) {
LOG.error("setElanBCGrouponOtherDpns failed due to Exception caught; " + "Logical Group Interface not found between source Dpn - {}, " + "destination Dpn - {} ", dpnInterface.getDpId(), otherFes.getDpId(), ex);
return;
}
}
}
List<Bucket> elanL2GwDevicesBuckets = elanL2GatewayMulticastUtils.getRemoteBCGroupBucketsOfElanL2GwDevices(elanInfo, dpnInterface.getDpId(), bucketId);
remoteListBucketInfo.addAll(elanL2GwDevicesBuckets);
if (remoteListBucketInfo.isEmpty()) {
LOG.debug("No ITM is present on Dpn - {} ", dpnInterface.getDpId());
continue;
}
Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(remoteListBucketInfo));
LOG.trace("Installing remote bc group {} on dpnId {}", group, dpnInterface.getDpId());
mdsalManager.syncInstallGroup(dpnInterface.getDpId(), group);
}
}
try {
Thread.sleep(WAIT_TIME_FOR_SYNC_INSTALL);
} catch (InterruptedException e1) {
LOG.warn("Error while waiting for remote BC group on other DPNs for ELAN {} to install", elanInfo);
}
}
}
use of io.fabric8.groups.Group in project netvirt by opendaylight.
the class NexthopManager method removeOrUpdateDcGwLoadBalancingGroup.
/**
* This method is invoked when the tunnel state is removed from DS.
* If the there is just one DC-GW left in configuration then the LB groups can be deleted.
* Otherwise, the groups are just updated.
*/
public void removeOrUpdateDcGwLoadBalancingGroup(List<String> availableDcGws, BigInteger dpnId, String destinationIp) {
Preconditions.checkNotNull(availableDcGws, "There are no dc-gws present");
WriteTransaction configTx = dataBroker.newWriteOnlyTransaction();
WriteTransaction operationalTx = dataBroker.newWriteOnlyTransaction();
int noOfDcGws = availableDcGws.size();
// If availableDcGws does not contain the destination Ip it means this is a configuration delete.
if (!availableDcGws.contains(destinationIp)) {
availableDcGws.add(destinationIp);
Collections.sort(availableDcGws);
}
// TODO : Place the logic to construct all possible DC-GW combination here.
int bucketId = availableDcGws.indexOf(destinationIp);
Optional<DpnLbNexthops> dpnLbNextHops = fibUtil.getDpnLbNexthops(dpnId, destinationIp);
if (!dpnLbNextHops.isPresent()) {
return;
}
List<String> nextHopKeys = dpnLbNextHops.get().getNexthopKey();
nextHopKeys.forEach(nextHopKey -> {
Optional<Nexthops> optionalNextHops = fibUtil.getNexthops(nextHopKey);
if (!optionalNextHops.isPresent()) {
return;
}
Nexthops nexthops = optionalNextHops.get();
final String groupId = nexthops.getGroupId();
final long groupIdValue = Long.parseLong(groupId);
if (noOfDcGws > 1) {
mdsalApiManager.removeBucketToTx(dpnId, groupIdValue, bucketId, configTx);
} else {
Group group = MDSALUtil.buildGroup(groupIdValue, nextHopKey, GroupTypes.GroupSelect, MDSALUtil.buildBucketLists(Collections.emptyList()));
LOG.trace("Removed LB group {} on dpn {}", group, dpnId);
mdsalApiManager.removeGroupToTx(dpnId, group, configTx);
removeNextHopPointer(nextHopKey);
}
// When the DC-GW is removed from configuration.
if (noOfDcGws != availableDcGws.size()) {
FibUtil.removeOrUpdateNextHopInfo(dpnId, nextHopKey, groupId, nexthops, operationalTx);
}
});
FibUtil.removeDpnIdToNextHopInfo(destinationIp, dpnId, operationalTx);
configTx.submit();
operationalTx.submit();
return;
}
use of io.fabric8.groups.Group in project netvirt by opendaylight.
the class ElanL2GatewayMulticastUtils method setupLeavesEtreeBroadcastGroups.
public void setupLeavesEtreeBroadcastGroups(ElanInstance elanInfo, DpnInterfaces dpnInterfaces, BigInteger dpnId) {
EtreeInstance etreeInstance = elanInfo.getAugmentation(EtreeInstance.class);
if (etreeInstance != null) {
long etreeLeafTag = etreeInstance.getEtreeLeafTagVal().getValue();
List<Bucket> listBucket = new ArrayList<>();
int bucketId = 0;
int actionKey = 0;
List<Action> listAction = new ArrayList<>();
listAction.add(new ActionGroup(ElanUtils.getEtreeLeafLocalBCGId(etreeLeafTag)).buildAction(++actionKey));
listBucket.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
bucketId++;
List<Bucket> listBucketInfoRemote = getRemoteBCGroupBuckets(elanInfo, dpnInterfaces, dpnId, bucketId, etreeLeafTag);
listBucket.addAll(listBucketInfoRemote);
long groupId = ElanUtils.getEtreeLeafRemoteBCGId(etreeLeafTag);
Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBucket));
LOG.trace("Installing the remote BroadCast Group:{}", group);
mdsalManager.syncInstallGroup(dpnId, group);
}
}
use of io.fabric8.groups.Group in project netvirt by opendaylight.
the class ElanL2GatewayMulticastUtils method setupStandardElanBroadcastGroups.
public void setupStandardElanBroadcastGroups(ElanInstance elanInfo, DpnInterfaces dpnInterfaces, BigInteger dpnId) {
List<Bucket> listBucket = new ArrayList<>();
int bucketId = 0;
int actionKey = 0;
Long elanTag = elanInfo.getElanTag();
List<Action> listAction = new ArrayList<>();
listAction.add(new ActionGroup(ElanUtils.getElanLocalBCGId(elanTag)).buildAction(++actionKey));
listBucket.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
bucketId++;
List<Bucket> listBucketInfoRemote = getRemoteBCGroupBuckets(elanInfo, dpnInterfaces, dpnId, bucketId, elanTag);
listBucket.addAll(listBucketInfoRemote);
long groupId = ElanUtils.getElanRemoteBCGId(elanTag);
Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBucket));
LOG.trace("Installing the remote BroadCast Group:{}", group);
mdsalManager.syncInstallGroup(dpnId, group);
}
use of io.fabric8.groups.Group in project fabric8 by jboss-fuse.
the class FabricDiscovery method addingService.
@Override
public CuratorFramework addingService(ServiceReference<CuratorFramework> reference) {
CuratorFramework curator = context.getService(reference);
try {
logger.debug("CuratorFramework found, starting group");
GroupFactory factory = new ZooKeeperGroupFactory(curator);
singleton = factory.createGroup("/fabric/registry/clusters/elasticsearch/" + clusterName.value(), ESNode.class);
singleton.add(this);
singleton.update(new ESNode(clusterName.value(), localNode, false));
singleton.start();
} catch (Exception e) {
LOG.error("Error starting group", e);
}
return curator;
}
Aggregations