- final SettableFuture settableFuture = SettableFuture.create();
- Futures.addCallback(broker.newReadOnlyTransaction().read(LogicalDatastoreType.OPERATIONAL,
- nodeIid), new SettableFutureCallback<Optional<Node>>(settableFuture) {
- @Override
- public void onSuccess(@Nonnull Optional<Node> resultNode) {
- HwvtepLocalUcastMacListener localUcastMacListener =
- new HwvtepLocalUcastMacListener(broker, elanL2GatewayUtils);
- settableFuture.set(resultNode);
- Optional<Node> nodeOptional = resultNode;
- if (nodeOptional.isPresent()) {
- Node node = nodeOptional.get();
- if (node.getAugmentation(HwvtepGlobalAugmentation.class) != null) {
- List<LocalUcastMacs> localUcastMacs =
- node.getAugmentation(HwvtepGlobalAugmentation.class).getLocalUcastMacs();
- if (localUcastMacs == null) {
- return;
- }
- localUcastMacs.stream()
- .filter((mac) -> {
- return macBelongsToLogicalSwitch(mac, elanName);
- })
- .forEach((mac) -> {
- InstanceIdentifier<LocalUcastMacs> macIid = getMacIid(nodeIid, mac);
- localUcastMacListener.added(macIid, mac);
- });
- }
+ FluentFuture<Optional<Node>> fluentFuture = broker.newReadOnlyTransaction().read(
+ LogicalDatastoreType.OPERATIONAL, nodeIid);
+ Futures.addCallback(fluentFuture, new FutureCallback<Optional<Node>>() {
+ @Override
+ public void onSuccess(Optional<Node> nodeOptional) {
+ if (nodeOptional.isPresent()) {
+ Node node = nodeOptional.get();
+ if (node.augmentation(HwvtepGlobalAugmentation.class) != null) {
+ List<LocalUcastMacs> localUcastMacs =
+ node.augmentation(HwvtepGlobalAugmentation.class).getLocalUcastMacs();
+ if (localUcastMacs == null) {
+ return;