+ @SuppressWarnings("unchecked")
+ InstanceIdentifierBuilder<Node> builder = ((InstanceIdentifier<Node>) ref.getValue()).builder();
+ InstanceIdentifierBuilder<FlowCapableNode> augmentation = builder.augmentation(FlowCapableNode.class);
+ final InstanceIdentifier<FlowCapableNode> path = augmentation.build();
+ CheckedFuture readFuture = tx.read(LogicalDatastoreType.OPERATIONAL, path);
+ Futures.addCallback(readFuture, new FutureCallback<Optional<? extends DataObject>>() {
+ @Override
+ public void onSuccess(Optional<? extends DataObject> optional) {
+ enqueueWriteNodeDataTx(node, flowNode, path);
+ if (!optional.isPresent()) {
+ enqueuePutTable0Tx(ref);
+ }
+ }
+
+ @Override
+ public void onFailure(Throwable throwable) {
+ LOG.debug(String.format("Can't retrieve node data for node %s. Writing node data with table0.", node));
+ enqueueWriteNodeDataTx(node, flowNode, path);
+ enqueuePutTable0Tx(ref);
+ }
+ });
+ }
+ });
+ }
+
+ private void enqueueWriteNodeDataTx(final NodeUpdated node, final FlowCapableNodeUpdated flowNode, final InstanceIdentifier<FlowCapableNode> path) {
+ manager.enqueue(new InventoryOperation() {
+ @Override
+ public void applyOperation(final ReadWriteTransaction tx) {