return "FIB-" + vpnId.toString() + "-" + dpnId.toString() ;
}
- public void updateUsedRdAndVpnToExtraRoute(WriteTransaction writeOperTxn, String tunnelIpRemoved, String primaryRd,
- String prefix) {
+ public void updateUsedRdAndVpnToExtraRoute(WriteTransaction writeConfigTxn, WriteTransaction writeOperTxn,
+ String tunnelIpRemoved, String primaryRd, String prefix) {
Optional<VpnInstanceOpDataEntry> optVpnInstance = getVpnInstanceOpData(primaryRd);
if (!optVpnInstance.isPresent()) {
return;
//Delete datastore only if extra route is deleted or VM interface is deleted/down
if (!MDSALUtil.read(dataBroker, LogicalDatastoreType.CONFIGURATION, adjId).isPresent()
|| ifState == null || ifState.getOperStatus() == OperStatus.Down) {
+ LOG.info("updating data-stores for prefix {} with primaryRd {} for interface {} on vpn {} ",
+ prefix, primaryRd, prefixToInterface.getVpnInterfaceName(), vpnName);
writeOperTxn.delete(LogicalDatastoreType.OPERATIONAL,
- getAdjacencyIdentifier(prefixToInterface.getVpnInterfaceName(), prefix));
+ FibUtil.getAdjacencyIdentifierOp(prefixToInterface.getVpnInterfaceName(),
+ vpnName, prefix));
writeOperTxn.delete(LogicalDatastoreType.OPERATIONAL,
VpnExtraRouteHelper.getVpnToExtrarouteVrfIdIdentifier(vpnName, usedRd, prefix));
- writeOperTxn.delete(LogicalDatastoreType.CONFIGURATION,
+ writeConfigTxn.delete(LogicalDatastoreType.CONFIGURATION,
VpnExtraRouteHelper.getUsedRdsIdentifier(vpnId, prefix, nextHopRemoved));
break;
}
//Update the used rds and vpntoextraroute containers only for the deleted nextHops.
List<String> nextHopsRemoved = FibHelper.getNextHopListFromRoutePaths(original);
nextHopsRemoved.removeAll(FibHelper.getNextHopListFromRoutePaths(update));
- ListenableFuture<Void> future =
- txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> nextHopsRemoved.parallelStream()
- .forEach(nextHopRemoved -> fibUtil.updateUsedRdAndVpnToExtraRoute(
- tx, nextHopRemoved, rd, update.getDestPrefix())));
- Futures.addCallback(future, new FutureCallback<Void>() {
+ List<ListenableFuture<Void>> futures = new ArrayList<>();
+ ListenableFuture<Void> configFuture =
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(configTx ->
+ futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(operTx ->
+ nextHopsRemoved.parallelStream()
+ .forEach(nextHopRemoved -> fibUtil.updateUsedRdAndVpnToExtraRoute(
+ configTx, operTx, nextHopRemoved, rd, update.getDestPrefix())))));
+ futures.add(configFuture);
+ Futures.addCallback(configFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void result) {
createFibEntries(identifier, update);
Adjacency adjElem = adjIt.next();
if (adjElem.getIpAddress().equals(adj.getIpAddress())) {
String rd = adjElem.getVrfId();
- adjIt.remove();
- AdjacenciesOp aug = VpnUtil.getVpnInterfaceOpDataEntryAugmentation(adjacencies);
- VpnInterfaceOpDataEntry newVpnIntf = VpnUtil
- .getVpnInterfaceOpDataEntry(currVpnIntf.getName(),
- currVpnIntf.getVpnInstanceName(), aug, dpnId,
- currVpnIntf.isScheduledForRemove(), currVpnIntf.getLportTag(),
- currVpnIntf.getGatewayMacAddress());
- writeOperTxn.merge(LogicalDatastoreType.OPERATIONAL, identifier, newVpnIntf, true);
if (adj.getNextHopIpList() != null) {
for (String nh : adj.getNextHopIpList()) {
deleteExtraRouteFromCurrentAndImportingVpns(