- Optional<ElanDpnInterfaces> optional = MDSALUtil.read(dataBroker, OPERATIONAL,
- elanDpnInterfacesInstanceIdentifier);
- if (optional.isPresent() && optional.get().getElanDpnInterfacesList() != null) {
- LOG.debug("Found elan dpn interfaces list");
- optional.get().nonnullElanDpnInterfacesList().values().forEach(elanDpnInterfacesList -> {
- Map<DpnInterfacesKey, DpnInterfaces> dpnInterfaces
- = elanDpnInterfacesList.nonnullDpnInterfaces();
- InstanceIdentifier<ElanDpnInterfacesList> parentIid = InstanceIdentifier
- .builder(ElanDpnInterfaces.class).child(ElanDpnInterfacesList.class,
- new ElanDpnInterfacesListKey(elanDpnInterfacesList
+ txRunner.callWithNewReadOnlyTransactionAndClose(OPERATIONAL, tx -> {
+ Optional<ElanDpnInterfaces> optional = Optional.empty();
+ try {
+ optional = tx.read(elanDpnInterfacesInstanceIdentifier).get();
+ } catch (ExecutionException | InterruptedException e) {
+ LOG.error("Exception While reading ElanDpnInterfaces", e);
+ }
+ if (optional.isPresent()
+ && optional.get().getElanDpnInterfacesList() != null) {
+ LOG.debug("Found elan dpn interfaces list");
+ optional.get().nonnullElanDpnInterfacesList().values()
+ .forEach(elanDpnInterfacesList -> {
+ List<DpnInterfaces> dpnInterfaces = new ArrayList<>(
+ elanDpnInterfacesList.nonnullDpnInterfaces().values());
+ InstanceIdentifier<ElanDpnInterfacesList> parentIid = InstanceIdentifier
+ .builder(ElanDpnInterfaces.class)
+ .child(ElanDpnInterfacesList.class,
+ new ElanDpnInterfacesListKey(
+ elanDpnInterfacesList