Details
-
Bug
-
Status: Resolved
-
Resolution: Done
-
None
-
None
-
None
-
Operating System: Windows
Platform: PC
-
267
Description
If we insert a NodeConnector object with FlowCapableNode augmentation into operational datastore and read the same data using the same instance identifier, data retrieved does not contain augmentation.
Steps to reproduce the issue:
1. Create a NodeConnector object and attach a FlowCapableNode augmentation to it.
2. Add and commit this data to operational datastore using InstanceIdentifier:
InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).child(NodeConnector.class, nodeConnectorKey).toInstance();
3. After the commit is successful, read the data from the operational datastore using instance identifier: InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey).child(NodeConnector.class, nodeConnectorKey).augmentation(FlowCapableNodeConnector.class).toInstance();
The data read will be null. If same instance identifier specified in step 2 is used, we will receive all data except for the augmentation.
4. If we read the data through restconf, the data persisted is received correctly:
Eg: http://localhost:8080/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/node-connector/openflow:1:1
I used the following code:
public void _readMDPort(CommandInterpreter ci) {
Integer dpId = Integer.parseInt(ci.nextArgument());
Integer portno = Integer.parseInt(ci.nextArgument());
String nodeIdValue = "openflow:" + dpId;
NodeId nodeId = new NodeId(nodeIdValue);
NodeKey nodeKey = new NodeKey(nodeId);
String nodeConnectorIdValue = nodeIdValue + ":" + portno;
NodeConnectorId nodeConnectorId = new NodeConnectorId(nodeConnectorIdValue);
NodeConnectorKey nodeConnectorKey = new NodeConnectorKey(nodeConnectorId);
NodeConnectorBuilder data = new NodeConnectorBuilder();
data.setId(nodeConnectorId);
data.setKey(nodeConnectorKey);
FlowCapableNodeConnector augment = loadPortData();
data.addAugmentation(FlowCapableNodeConnector.class, augment);
InstanceIdentifier<NodeConnector> ncIdentifierWriter =
InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey)
.child(NodeConnector.class, nodeConnectorKey).toInstance();
DataModification<InstanceIdentifier<?>, DataObject> modification =
dataBrokerService.beginTransaction();
modification.putOperationalData(ncIdentifierWriter, data.build());
Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
try
catch (InterruptedException e)
{ LOG.error(e.getMessage(), e); }catch (ExecutionException e)
{ LOG.error(e.getMessage(), e); }
InstanceIdentifier<FlowCapableNodeConnector> ncIdentifierReader =
InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey)
.child(NodeConnector.class, nodeConnectorKey)
.augmentation(FlowCapableNodeConnector.class).toInstance();
FlowCapableNodeConnector port = (FlowCapableNodeConnector) dataBrokerService
.readOperationalData(ncIdentifierReader);
if (port != null)
}
private static FlowCapableNodeConnector loadPortData()
{ final FlowCapableNodeConnectorBuilder flowCapableNodeConnectorBuilder = new FlowCapableNodeConnectorBuilder(); PortFeatures _advertisedFeatures = PortFeatures.getDefaultInstance("_100mbFd"); flowCapableNodeConnectorBuilder.setAdvertisedFeatures(_advertisedFeatures); PortConfig _configuration = PortConfig.getDefaultInstance("nOPACKETIN"); flowCapableNodeConnectorBuilder.setConfiguration(_configuration); PortFeatures _currentFeature = PortFeatures.getDefaultInstance("_100mbFd"); flowCapableNodeConnectorBuilder.setCurrentFeature(_currentFeature); Long _currentSpeed = 1L; flowCapableNodeConnectorBuilder.setCurrentSpeed(_currentSpeed); MacAddress _hardwareAddress = new MacAddress("11:12:13:14:15:16"); flowCapableNodeConnectorBuilder.setHardwareAddress(_hardwareAddress); Long _maximumSpeed = 1L; flowCapableNodeConnectorBuilder.setMaximumSpeed(_maximumSpeed); String _name = "test"; flowCapableNodeConnectorBuilder.setName(_name); PortFeatures _peerFeatures = PortFeatures.getDefaultInstance("_100mbFd"); flowCapableNodeConnectorBuilder.setPeerFeatures(_peerFeatures); Long _portNumber = 1L; flowCapableNodeConnectorBuilder.setPortNumber(_portNumber); PortState _state = PortState.forValue(0); flowCapableNodeConnectorBuilder.setState(_state); PortFeatures _supported = PortFeatures.getDefaultInstance("_100mbFd"); flowCapableNodeConnectorBuilder.setSupported(_supported); return flowCapableNodeConnectorBuilder.build(); }Some observations:
1. InstanceIdentifier path elements does not have Qname associated with them when used directly through code where as the InstanceIdentifier generated from RestconfImpl class generates path elements with Qname containing module name, revision.
2. Same issue was observed using Node and FlowCapableNode.