Bug 2435 - Controller/MD-SAL throwing ModifiedNodeDoesNotExistException exception... 56/13156/5
authorAnil Vishnoi <avishnoi@brocade.com>
Wed, 26 Nov 2014 21:28:41 +0000 (02:58 +0530)
committerAnil Vishnoi <vishnoianil@gmail.com>
Fri, 28 Nov 2014 10:15:22 +0000 (10:15 +0000)
augment queue statistics to the node connector. Exception was thrown because parent (queue) container was
not present when statistics manager tried to augment statistics. Fixed the issue by creating empty queue
container and 'merge'ing it to the node connector before augmenting the statistics.

Signed-off-by: Anil Vishnoi <vishnoianil@gmail.com>
Change-Id: I7d68f3e177ccf62c7adf154e655226450a74296c

opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitQueue.java

index 07e167d..f5c5689 100644 (file)
@@ -26,6 +26,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.Fl
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionAware;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.QueueBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.QueueKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
@@ -167,11 +168,13 @@ public class StatListenCommitQueue extends StatAbstractListenCommit<Queue, Opend
                             new FlowCapableNodeConnectorQueueStatisticsDataBuilder();
                     statBuild.setFlowCapableNodeConnectorQueueStatistics(statChild);
                     final QueueKey qKey = new QueueKey(queueStat.getQueueId());
-                    final InstanceIdentifier<FlowCapableNodeConnectorQueueStatisticsData> queueStatIdent = nodeIdent
+                    final InstanceIdentifier<Queue> queueIdent = nodeIdent
                             .child(NodeConnector.class, new NodeConnectorKey(queueStat.getNodeConnectorId()))
                             .augmentation(FlowCapableNodeConnector.class)
-                            .child(Queue.class, qKey).augmentation(FlowCapableNodeConnectorQueueStatisticsData.class);
+                            .child(Queue.class, qKey);
+                    final InstanceIdentifier<FlowCapableNodeConnectorQueueStatisticsData> queueStatIdent = queueIdent.augmentation(FlowCapableNodeConnectorQueueStatisticsData.class);
                     existQueueKeys.remove(qKey);
+                    tx.merge(LogicalDatastoreType.OPERATIONAL, queueIdent, new QueueBuilder().setKey(qKey).build());
                     tx.put(LogicalDatastoreType.OPERATIONAL, queueStatIdent, statBuild.build());
                 }
             }