return;
}
LOG.debug("Update the VpnInterfaces for Unprocessed Adjancencies for vpnName:{}", vpnName);
- vpnToDpnLists.forEach(vpnToDpnList -> vpnToDpnList.getVpnInterfaces().forEach(vpnInterface -> {
- try {
- InstanceIdentifier<VpnInterfaceOpDataEntry> existingVpnInterfaceId =
- VpnUtil.getVpnInterfaceOpDataEntryIdentifier(vpnInterface.getInterfaceName(), vpnName);
- Optional<VpnInterfaceOpDataEntry> vpnInterfaceOptional = SingleTransactionDataBroker.syncReadOptional(
- dataBroker, LogicalDatastoreType.OPERATIONAL, existingVpnInterfaceId);
- if (!vpnInterfaceOptional.isPresent()) {
- return;
- }
- List<Adjacency> configVpnAdjacencies = VpnUtil.getAdjacenciesForVpnInterfaceFromConfig(dataBroker,
- vpnInterface.getInterfaceName());
- if (configVpnAdjacencies == null) {
- LOG.debug("There is no adjacency available for vpnInterface:{}", vpnInterface);
- return;
- }
- List<Adjacency> operationVpnAdjacencies = vpnInterfaceOptional.get()
- .augmentation(AdjacenciesOp.class).getAdjacency();
- // Due to insufficient rds, some of the extra route wont get processed when it is added.
- // The unprocessed adjacencies will be present in config vpn interface DS but will be missing
- // in operational DS. These unprocessed adjacencies will be handled below.
- // To obtain unprocessed adjacencies, filtering is done by which the missing adjacencies in operational
- // DS are retrieved which is used to call addNewAdjToVpnInterface method.
- configVpnAdjacencies.stream()
+ vpnToDpnLists.forEach(vpnToDpnList -> {
+ if (vpnToDpnList.getVpnInterfaces() == null) {
+ return;
+ }
+ vpnToDpnList.getVpnInterfaces().forEach(vpnInterface -> {
+ try {
+ InstanceIdentifier<VpnInterfaceOpDataEntry> existingVpnInterfaceId =
+ VpnUtil.getVpnInterfaceOpDataEntryIdentifier(vpnInterface.getInterfaceName(), vpnName);
+ Optional<VpnInterfaceOpDataEntry> vpnInterfaceOptional = SingleTransactionDataBroker
+ .syncReadOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, existingVpnInterfaceId);
+ if (!vpnInterfaceOptional.isPresent()) {
+ return;
+ }
+ List<Adjacency> configVpnAdjacencies = VpnUtil.getAdjacenciesForVpnInterfaceFromConfig(dataBroker,
+ vpnInterface.getInterfaceName());
+ if (configVpnAdjacencies == null) {
+ LOG.debug("There is no adjacency available for vpnInterface:{}", vpnInterface);
+ return;
+ }
+ List<Adjacency> operationVpnAdjacencies = vpnInterfaceOptional.get()
+ .augmentation(AdjacenciesOp.class).getAdjacency();
+ // Due to insufficient rds, some of the extra route wont get processed when it is added.
+ // The unprocessed adjacencies will be present in config vpn interface DS but will be missing
+ // in operational DS. These unprocessed adjacencies will be handled below.
+ // To obtain unprocessed adjacencies, filtering is done by which the missing adjacencies in
+ // operational DS are retrieved which is used to call addNewAdjToVpnInterface method.
+ configVpnAdjacencies.stream()
.filter(adjacency -> operationVpnAdjacencies.stream()
.noneMatch(operationalAdjacency ->
operationalAdjacency.getIpAddress().equals(adjacency.getIpAddress())))
if (VpnUtil.isAdjacencyEligibleToVpn(dataBroker, adjacency, vpnName)) {
List<ListenableFuture<Void>> futures = new ArrayList<>();
futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(operTx ->
- futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(
- confTx -> addNewAdjToVpnInterface(existingVpnInterfaceId,
- primaryRd, adjacency, vpnInterfaceOptional.get()
- .getDpnId(), confTx, operTx)))));
+ futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(
+ confTx -> addNewAdjToVpnInterface(existingVpnInterfaceId,
+ primaryRd, adjacency, vpnInterfaceOptional.get()
+ .getDpnId(), confTx, operTx)))));
return futures;
} else {
return Collections.emptyList();
}
});
});
- } catch (ReadFailedException e) {
- LOG.error("updateVpnInterfacesForUnProcessAdjancencies: Failed to read data store for vpn {} rd {}",
- vpnName, primaryRd);
- }
- }));
+ } catch (ReadFailedException e) {
+ LOG.error("updateVpnInterfacesForUnProcessAdjancencies: Failed to read data store for vpn {} rd {}",
+ vpnName, primaryRd);
+ }
+ });
+ });
}
private class PostVpnInterfaceWorker implements FutureCallback<Void> {