-
Bug
-
Resolution: Done
-
None
-
unspecified
-
None
-
Operating System: All
Platform: All
-
2707
I see a case where the method below is called when a new openflow node connects. onNodeUpdated is called, we log it, read from the datastore and then enqueue a message to be processed later that will program the pipeline flows. What I am seeing is sometimes the enqueue doesn't happen. I don't see the error log from the onFailure path so I am assuming the optional.isPresent is true. We always get two of the onNodeUpdated callbacks per node. The nodes were just added so I don't see how the first callback doesn't have the field isPresent as true. Or I have no idea what that flag is for. But in the success case the flag is false the first time so the node is enqueued one time and everything works.
Node Update received for : KeyedInstanceIdentifier
{targetType=interface org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, path=[org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes, org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node[key=NodeKey [_id=Uri [_value=openflow:25030657407808]]]]}"
/**
- Process the Node update notification. Check for Openflow node and make sure if the bridge is part of the Pipeline before
- programming the Pipeline specific flows.
*/
@Override
public void onNodeUpdated(NodeUpdated nodeUpdated) {
NodeRef ref = nodeUpdated.getNodeRef();
InstanceIdentifier<Node> identifier = (InstanceIdentifier<Node>) ref.getValue();
logger.debug("Node Update received for : "+identifier.toString());
final NodeKey key = identifier.firstKeyOf(Node.class, NodeKey.class);
final String nodeId = key.getId().getValue();
if (key != null && key.getId().getValue().contains("openflow")) {
InstanceIdentifierBuilder<Node> builder = ((InstanceIdentifier<Node>) ref.getValue()).builder();
InstanceIdentifierBuilder<FlowCapableNode> augmentation = builder.augmentation(FlowCapableNode.class);
final InstanceIdentifier<FlowCapableNode> path = augmentation.build();
BindingTransactionChain txChain = mdsalConsumer.getDataBroker().createTransactionChain(this);
CheckedFuture readFuture = txChain.newReadWriteTransaction().read(LogicalDatastoreType.OPERATIONAL, path);
Futures.addCallback(readFuture, new FutureCallback<Optional<? extends DataObject>>() {
@Override
public void onSuccess(Optional<? extends DataObject> optional)Unknown macro: { if (!optional.isPresent()) { enqueue(nodeId); } }
@Override
public void onFailure(Throwable throwable)
});
}
}