use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class ElanDpnInterfaceClusteredListener method add.
@Override
protected void add(InstanceIdentifier<DpnInterfaces> identifier, final DpnInterfaces dpnInterfaces) {
final String elanName = getElanName(identifier);
jobCoordinator.enqueueJob(elanName + ":l2gw", () -> {
elanInstanceDpnsCache.add(getElanName(identifier), dpnInterfaces);
if (entityOwnershipUtils.isEntityOwner(HwvtepSouthboundConstants.ELAN_ENTITY_TYPE, HwvtepSouthboundConstants.ELAN_ENTITY_NAME)) {
ElanInstance elanInstance = elanInstanceCache.get(elanName).orNull();
if (elanInstance != null) {
elanL2GatewayUtils.installElanL2gwDevicesLocalMacsInDpn(dpnInterfaces.getDpId(), elanInstance, dpnInterfaces.getInterfaces().get(0));
// updating remote mcast mac on l2gw devices
elanL2GatewayMulticastUtils.updateRemoteMcastMacOnElanL2GwDevices(elanName);
}
}
return null;
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class ElanExtnTepListener method updateElanRemoteBroadCastGroup.
@SuppressWarnings("checkstyle:IllegalCatch")
private void updateElanRemoteBroadCastGroup(final InstanceIdentifier<ExternalTeps> iid) {
String elanName = iid.firstKeyOf(ElanInstance.class).getElanInstanceName();
ElanInstance elanInfo = elanInstanceCache.get(elanName).orNull();
if (elanInfo == null) {
return;
}
jobCoordinator.enqueueJob(elanName, () -> {
SettableFuture<Void> ft = SettableFuture.create();
try {
// TODO make the following method return ft
elanL2GatewayMulticastUtils.updateRemoteBroadcastGroupForAllElanDpns(elanInfo);
ft.set(null);
} catch (Exception e) {
// since the above method does a sync write , if it fails there was no retry
// by setting the above mdsal exception in ft, and returning the ft makes sures that job is retried
ft.setException(e);
}
return Lists.newArrayList(ft);
}, ElanConstants.JOB_MAX_RETRIES);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class ElanInstanceManager method remove.
@Override
protected void remove(InstanceIdentifier<ElanInstance> identifier, ElanInstance deletedElan) {
LOG.trace("Remove ElanInstance - Key: {}, value: {}", identifier, deletedElan);
String elanName = deletedElan.getElanInstanceName();
// check the elan Instance present in the Operational DataStore
Elan existingElan = ElanUtils.getElanByName(broker, elanName);
long elanTag = deletedElan.getElanTag();
// Cleaning up the existing Elan Instance
if (existingElan != null) {
List<String> elanInterfaces = existingElan.getElanInterfaces();
if (elanInterfaces != null && !elanInterfaces.isEmpty()) {
for (String elanInterfaceName : elanInterfaces) {
InstanceIdentifier<ElanInterface> elanInterfaceId = ElanUtils.getElanInterfaceConfigurationDataPathId(elanInterfaceName);
InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(elanInterfaceName);
elanInterfaceManager.removeElanInterface(deletedElan, elanInterfaceName, interfaceInfo);
ElanUtils.delete(broker, LogicalDatastoreType.CONFIGURATION, elanInterfaceId);
}
}
ElanUtils.delete(broker, LogicalDatastoreType.OPERATIONAL, ElanUtils.getElanInstanceOperationalDataPath(elanName));
Optional<ElanDpnInterfacesList> elanDpnInterfaceList = MDSALUtil.read(broker, LogicalDatastoreType.OPERATIONAL, ElanUtils.getElanDpnOperationDataPath(elanName));
if (elanDpnInterfaceList.isPresent()) {
ElanUtils.delete(broker, LogicalDatastoreType.OPERATIONAL, getElanDpnOperationDataPath(elanName));
}
ElanUtils.delete(broker, LogicalDatastoreType.OPERATIONAL, ElanUtils.getElanInfoEntriesOperationalDataPath(elanTag));
}
elanInterfaceCache.getInterfaceNames(elanName).forEach(elanInterfaceName -> jobCoordinator.enqueueJob(ElanUtils.getElanInterfaceJobKey(elanInterfaceName), () -> Collections.singletonList(txRunner.callWithNewReadWriteTransactionAndSubmit(tx -> {
LOG.info("Deleting the elanInterface present under ConfigDS:{}", elanInterfaceName);
ElanUtils.delete(broker, LogicalDatastoreType.CONFIGURATION, ElanUtils.getElanInterfaceConfigurationDataPathId(elanInterfaceName));
elanInterfaceManager.unbindService(elanInterfaceName, tx);
LOG.info("unbind the Interface:{} service bounded to Elan:{}", elanInterfaceName, elanName);
})), ElanConstants.JOB_MAX_RETRIES));
// Release tag
ElanUtils.releaseId(idManager, ElanConstants.ELAN_ID_POOL_NAME, elanName);
if (deletedElan.getAugmentation(EtreeInstance.class) != null) {
removeEtreeInstance(deletedElan);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class ElanInterfaceManager method handleunprocessedElanInterfaces.
List<ListenableFuture<Void>> handleunprocessedElanInterfaces(ElanInstance elanInstance) throws ElanException {
List<ListenableFuture<Void>> futures = new ArrayList<>();
Queue<ElanInterface> elanInterfaces = unProcessedElanInterfaces.get(elanInstance.getElanInstanceName());
if (elanInterfaces == null || elanInterfaces.isEmpty()) {
return futures;
}
for (ElanInterface elanInterface : elanInterfaces) {
String interfaceName = elanInterface.getName();
InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(interfaceName);
futures.addAll(addElanInterface(elanInterface, interfaceInfo, elanInstance));
}
return futures;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance 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);
}
}
}
Aggregations