Added the 'number of data changes' parameter to dsbenchmark test start outputs 48/45848/2
authorJan <jmedved@cisco.com>
Mon, 19 Sep 2016 22:32:55 +0000 (15:32 -0700)
committerTom Pantelis <tpanteli@brocade.com>
Tue, 20 Sep 2016 17:04:41 +0000 (17:04 +0000)
Change-Id: Ibc3826e1c0758ebd6cbf30e664a5ecc6a79ec317
Signed-off-by: Jan <jmedved@cisco.com>
19 files changed:
benchmark/api/src/main/yang/dsbenchmark.yang
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/BaListBuilder.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/DatastoreAbstractWriter.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/DomListBuilder.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/DsbenchmarkProvider.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/listener/DsbenchmarkListener.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/listener/DsbenchmarkListenerProvider.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/simpletx/SimpletxBaDelete.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/simpletx/SimpletxBaRead.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/simpletx/SimpletxBaWrite.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/simpletx/SimpletxDomDelete.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/simpletx/SimpletxDomRead.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/simpletx/SimpletxDomWrite.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainBaDelete.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainBaRead.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainBaWrite.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainDomDelete.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainDomRead.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainDomWrite.java

index a543101..7a8d727 100644 (file)
@@ -206,7 +206,14 @@ module dsbenchmark {
             leaf ntfOk {
                 type uint32;
                 description
-                  "The number of successfully received data tree change notifications";
+                  "The number of successfully received data tree change
+                   notifications";
+            }
+            leaf dataChangeEventsOk {
+                type uint32;
+                description
+                  "The number of data change events received in data tree
+                   change notifications";
             }
         }
     }
index 610c3b5..9d5aa51 100644 (file)
@@ -19,8 +19,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchm
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.outer.list.InnerListKey;
 
 public final class BaListBuilder {
-    static public List<OuterList> buildOuterList(int outerElements, int innerElements) {
-        List<OuterList> outerList = new ArrayList<OuterList>(outerElements);
+    public static List<OuterList> buildOuterList(int outerElements, int innerElements) {
+        List<OuterList> outerList = new ArrayList<>(outerElements);
         for (int j = 0; j < outerElements; j++) {
             outerList.add(new OuterListBuilder()
                                 .setId( j )
@@ -28,23 +28,20 @@ public final class BaListBuilder {
                                 .setKey(new OuterListKey( j ))
                                 .build());
         }
-
         return outerList;
     }
 
-    static private List<InnerList> buildInnerList( int index, int elements ) {
-        List<InnerList> innerList = new ArrayList<InnerList>( elements );
+    private static List<InnerList> buildInnerList( int index, int elements ) {
+        List<InnerList> innerList = new ArrayList<>( elements );
 
         final String itemStr = "Item-" + String.valueOf(index) + "-";
-        for( int i = 0; i < elements; i++ ) {
+        for (int i = 0; i < elements; i++) {
             innerList.add(new InnerListBuilder()
                                 .setKey( new InnerListKey( i ) )
                                 .setName(i)
                                 .setValue( itemStr + String.valueOf( i ) )
                                 .build());
         }
-
         return innerList;
     }
-
 }
index 20024e4..ef4d04d 100644 (file)
@@ -42,6 +42,7 @@ public abstract class DatastoreAbstractWriter {
     }
 
     public abstract void createList();
+
     public abstract void executeList();
 
     public int getTxError() {
@@ -56,12 +57,9 @@ public abstract class DatastoreAbstractWriter {
         final LogicalDatastoreType dsType;
         if (dataStore == DataStore.CONFIG) {
             dsType = LogicalDatastoreType.CONFIGURATION;
-        }
-        else if (dataStore == DataStore.OPERATIONAL) {
+        } else if (dataStore == DataStore.OPERATIONAL) {
             dsType = LogicalDatastoreType.OPERATIONAL;
-        }
-        else
-        {
+        } else {
             if (rn.nextBoolean() == true) {
                 dsType = LogicalDatastoreType.OPERATIONAL;
             } else {
index a250823..bac6b2b 100644 (file)
@@ -28,8 +28,8 @@ public final class DomListBuilder {
     // Outer List Qname identifier for yang model's 'id'
     private static final org.opendaylight.yangtools.yang.common.QName OL_ID = QName.create(OuterList.QNAME, "id");
 
-    static public List<MapEntryNode> buildOuterList(int outerElements, int innerElements) {
-        List<MapEntryNode> outerList = new ArrayList<MapEntryNode>(outerElements);
+    public static List<MapEntryNode> buildOuterList(int outerElements, int innerElements) {
+        List<MapEntryNode> outerList = new ArrayList<>(outerElements);
         for (int j = 0; j < outerElements; j++) {
             outerList.add(ImmutableNodes.mapEntryBuilder()
                                 .withNodeIdentifier(new NodeIdentifierWithPredicates(OuterList.QNAME, OL_ID, j))
@@ -37,15 +37,14 @@ public final class DomListBuilder {
                                 .withChild(buildInnerList(j, innerElements))
                                 .build());
         }
-
         return outerList;
     }
 
-    static private MapNode buildInnerList(int index, int elements ) {
+    private static MapNode buildInnerList(int index, int elements ) {
         CollectionNodeBuilder<MapEntryNode, MapNode> innerList = ImmutableNodes.mapNodeBuilder(InnerList.QNAME);
 
         final String itemStr = "Item-" + String.valueOf(index) + "-";
-        for( int i = 0; i < elements; i++ ) {
+        for (int i = 0; i < elements; i++) {
             innerList.addChild(ImmutableNodes.mapEntryBuilder()
                                 .withNodeIdentifier(new NodeIdentifierWithPredicates(InnerList.QNAME, IL_NAME, i))
                                 .withChild(ImmutableNodes.leafNode(IL_NAME, i))
@@ -54,6 +53,4 @@ public final class DomListBuilder {
         }
         return innerList.build();
     }
-
-
 }
index f40efc3..b46089d 100644 (file)
@@ -53,14 +53,17 @@ import com.google.common.util.concurrent.Futures;
 public class DsbenchmarkProvider implements BindingAwareProvider, DsbenchmarkService, AutoCloseable {
 
     private static final Logger LOG = LoggerFactory.getLogger(DsbenchmarkProvider.class);
-    private static final InstanceIdentifier<TestExec> TEST_EXEC_IID = InstanceIdentifier.builder(TestExec.class).build();
-    private static final InstanceIdentifier<TestStatus> TEST_STATUS_IID = InstanceIdentifier.builder(TestStatus.class).build();
+    private static final InstanceIdentifier<TestExec> TEST_EXEC_IID =
+            InstanceIdentifier.builder(TestExec.class).build();
+    private static final InstanceIdentifier<TestStatus> TEST_STATUS_IID =
+            InstanceIdentifier.builder(TestStatus.class).build();
 
     private final AtomicReference<ExecStatus> execStatus = new AtomicReference<ExecStatus>( ExecStatus.Idle );
     private final DsbenchmarkListenerProvider listenerProvider = new DsbenchmarkListenerProvider();
     private final DOMDataBroker domDataBroker;  // Async DOM Broker for use with all DOM operations
-    private final DataBroker bindingDataBroker; // Async Binding-Aware Broker for use in tx chains; initialized to ping-pong
-                                                // broker in default config (see default-config.xml and dsbenchmark-impl.yang)
+    private final DataBroker bindingDataBroker; // Async Binding-Aware Broker for use in tx chains; initialized to
+                                                // ping-pong broker in default config (see default-config.xml and
+                                                // dsbenchmark-impl.yang)
     private DataBroker dataBroker;              // "Legacy" OSGI Data Broker for use in simple transactions
     private RpcRegistration<DsbenchmarkService> dstReg;
 
@@ -93,7 +96,7 @@ public class DsbenchmarkProvider implements BindingAwareProvider, DsbenchmarkSer
     public Future<RpcResult<Void>> cleanupStore() {
         cleanupTestStore();
         LOG.info("Data Store cleaned up");
-        return Futures.immediateFuture( RpcResultBuilder.<Void> success().build() );
+        return Futures.immediateFuture( RpcResultBuilder.<Void>success().build());
     }
 
     @Override
@@ -133,7 +136,7 @@ public class DsbenchmarkProvider implements BindingAwareProvider, DsbenchmarkSer
 
             this.testsCompleted++;
 
-        } catch ( Exception e ) {
+        } catch (Exception e) {
             LOG.error( "Test error: {}", e.toString());
             execStatus.set( ExecStatus.Idle );
             return RpcResultBuilder.success(new StartTestOutputBuilder()
@@ -146,6 +149,7 @@ public class DsbenchmarkProvider implements BindingAwareProvider, DsbenchmarkSer
         execStatus.set(ExecStatus.Idle);
 
         // Get the number of data change events and cleanup the data change listeners
+        long numDataChanges = listenerProvider.getDataChangeCount();
         long numEvents = listenerProvider.getEventCountAndDestroyListeners();
 
         StartTestOutput output = new StartTestOutputBuilder()
@@ -154,6 +158,7 @@ public class DsbenchmarkProvider implements BindingAwareProvider, DsbenchmarkSer
                 .setExecTime(execTime)
                 .setTxOk((long)dsWriter.getTxOk())
                 .setNtfOk(numEvents)
+                .setDataChangeEventsOk(numDataChanges)
                 .setTxError((long)dsWriter.getTxError())
                 .build();
 
@@ -192,7 +197,7 @@ public class DsbenchmarkProvider implements BindingAwareProvider, DsbenchmarkSer
             LOG.info("Failed to cleanup DataStore configtest data");
             throw new IllegalStateException(e);
         }
-        
+
         tx = dataBroker.newWriteOnlyTransaction();
         tx.put(LogicalDatastoreType.OPERATIONAL, TEST_EXEC_IID, data);
         try {
index 02d09f6..fcd2c11 100644 (file)
@@ -24,6 +24,7 @@ import org.slf4j.LoggerFactory;
 public class DsbenchmarkListener implements DataTreeChangeListener<TestExec> {
     private static final Logger LOG = LoggerFactory.getLogger(DsbenchmarkListener.class);
     private AtomicInteger numEvents = new AtomicInteger(0);
+    private AtomicInteger numDataChanges = new AtomicInteger(0);
 
     @Override
     public void onDataTreeChanged(
@@ -33,7 +34,9 @@ public class DsbenchmarkListener implements DataTreeChangeListener<TestExec> {
         // from different threads, and we need to use atomic counters.
 
         final int eventNum = numEvents.incrementAndGet();
-        if(LOG.isDebugEnabled()){
+        numDataChanges.addAndGet(changes.size());
+
+        if (LOG.isDebugEnabled()) {
             logDataTreeChangeEvent(eventNum, changes);
         }
     }
@@ -42,11 +45,12 @@ public class DsbenchmarkListener implements DataTreeChangeListener<TestExec> {
             Collection<DataTreeModification<TestExec>> changes) {
         LOG.debug("DsbenchmarkListener-onDataTreeChanged: Event {}", eventNum);
 
-        for(DataTreeModification<TestExec> change : changes) {
+        for (DataTreeModification<TestExec> change : changes) {
             final DataObjectModification<TestExec> rootNode = change.getRootNode();
             final ModificationType modType = rootNode.getModificationType();
             final PathArgument changeId = rootNode.getIdentifier();
-            final Collection<DataObjectModification<? extends DataObject>> modifications = rootNode.getModifiedChildren();
+            final Collection<DataObjectModification<? extends DataObject>> modifications =
+                    rootNode.getModifiedChildren();
 
             LOG.debug("    changeId {}, modType {}, mods: {}", changeId, modType, modifications.size());
 
@@ -60,4 +64,7 @@ public class DsbenchmarkListener implements DataTreeChangeListener<TestExec> {
         return numEvents.get();
     }
 
+    public int getNumDataChanges() {
+        return numDataChanges.get();
+    }
 }
index 7e0146f..e2deb46 100644 (file)
@@ -22,8 +22,9 @@ import org.slf4j.LoggerFactory;
 
 public class DsbenchmarkListenerProvider {
     private static final Logger LOG = LoggerFactory.getLogger(DsbenchmarkListenerProvider.class);
-    private static final InstanceIdentifier<TestExec> TEST_EXEC_IID = InstanceIdentifier.builder(TestExec.class).build();
-    private final List<ListenerRegistration<DsbenchmarkListener>> listeners = 
+    private static final InstanceIdentifier<TestExec> TEST_EXEC_IID =
+            InstanceIdentifier.builder(TestExec.class).build();
+    private final List<ListenerRegistration<DsbenchmarkListener>> listeners =
             new ArrayList<ListenerRegistration<DsbenchmarkListener>>();
     private DataBroker dataBroker;
 
@@ -33,7 +34,7 @@ public class DsbenchmarkListenerProvider {
     }
 
     public void createAndRegisterListeners(int numListeners) {
-        for(int i = 0; i < numListeners; i++) {
+        for (int i = 0; i < numListeners; i++) {
             DsbenchmarkListener listener = new DsbenchmarkListener();
             listeners.add(dataBroker.registerDataTreeChangeListener(
                     new DataTreeIdentifier<TestExec>(LogicalDatastoreType.CONFIGURATION, TEST_EXEC_IID), listener));
@@ -44,16 +45,24 @@ public class DsbenchmarkListenerProvider {
         LOG.info("DsbenchmarkListenerProvider created {} listeneres", numListeners);
     }
 
+    public long getDataChangeCount() {
+        long dataChanges = 0;
+
+        for (ListenerRegistration<DsbenchmarkListener> listenerRegistration : listeners) {
+            dataChanges += listenerRegistration.getInstance().getNumDataChanges();
+        }
+        LOG.info("DsbenchmarkListenerProvider , total data changes {}", dataChanges);
+        return dataChanges;
+    }
+
     public long getEventCountAndDestroyListeners() {
         long totalEvents = 0;
 
         for (ListenerRegistration<DsbenchmarkListener> listenerRegistration : listeners) {
-            totalEvents = totalEvents + listenerRegistration.getInstance().getNumEvents();
+            totalEvents += listenerRegistration.getInstance().getNumEvents();
             listenerRegistration.close();
         }
-
         listeners.clear();
-        totalEvents = totalEvents / 2;  // Each listener is registered 2x: adjust for event double-counting
         LOG.info("DsbenchmarkListenerProvider destroyed listeneres, total events {}", totalEvents);
         return totalEvents;
     }
index e42fef2..4d67d4c 100644 (file)
@@ -51,32 +51,32 @@ public class SimpletxBaDelete extends DatastoreAbstractWriter {
 
     @Override
     public void executeList() {
-            WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
-            long putCnt = 0;
+        WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
+        long putCnt = 0;
 
-            for (long l = 0; l < outerListElem; l++) {
-                InstanceIdentifier<OuterList> iid = InstanceIdentifier.create(TestExec.class)
+        for (long l = 0; l < outerListElem; l++) {
+            InstanceIdentifier<OuterList> iid = InstanceIdentifier.create(TestExec.class)
                                                         .child(OuterList.class, new OuterListKey((int)l));
-                tx.delete(LogicalDatastoreType.CONFIGURATION, iid);
-                putCnt++;
-                if (putCnt == writesPerTx) {
-                    try {
-                        tx.submit().checkedGet();
-                        txOk++;
-                    } catch (TransactionCommitFailedException e) {
-                        LOG.error("Transaction failed: {}", e.toString());
-                        txError++;
-                    }
-                    tx = dataBroker.newWriteOnlyTransaction();
-                    putCnt = 0;
-                }
-            }
-            if (putCnt != 0) {
+            tx.delete(LogicalDatastoreType.CONFIGURATION, iid);
+            putCnt++;
+            if (putCnt == writesPerTx) {
                 try {
                     tx.submit().checkedGet();
+                    txOk++;
                 } catch (TransactionCommitFailedException e) {
-                    LOG.error("Transaction failed: {}", e.toString());
+                    LOG.error("Transaction failed: {}", e);
+                    txError++;
                 }
+                tx = dataBroker.newWriteOnlyTransaction();
+                putCnt = 0;
+            }
+        }
+        if (putCnt != 0) {
+            try {
+                tx.submit().checkedGet();
+            } catch (TransactionCommitFailedException e) {
+                LOG.error("Transaction failed: {}", e);
             }
+        }
     }
 }
index 0281396..8f8ecaf 100644 (file)
@@ -32,7 +32,7 @@ public class SimpletxBaRead extends DatastoreAbstractWriter {
     private static final Logger LOG = LoggerFactory.getLogger(SimpletxBaRead.class);
     private DataBroker dataBroker;
 
-    public SimpletxBaRead(DataBroker dataBroker, int outerListElem, int innerListElem, 
+    public SimpletxBaRead(DataBroker dataBroker, int outerListElem, int innerListElem,
             long writesPerTx, DataStore dataStore) {
         super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx, dataStore);
         this.dataBroker = dataBroker;
@@ -64,7 +64,8 @@ public class SimpletxBaRead extends DatastoreAbstractWriter {
             InstanceIdentifier<OuterList> iid = InstanceIdentifier.create(TestExec.class)
                     .child(OuterList.class, new OuterListKey((int)l));
             Optional<OuterList> optionalDataObject;
-            CheckedFuture<Optional<OuterList>, ReadFailedException> submitFuture = tx.read(LogicalDatastoreType.CONFIGURATION, iid);
+            CheckedFuture<Optional<OuterList>, ReadFailedException> submitFuture =
+                    tx.read(LogicalDatastoreType.CONFIGURATION, iid);
             try {
                 optionalDataObject = submitFuture.checkedGet();
                 if (optionalDataObject != null && optionalDataObject.isPresent()) {
@@ -72,19 +73,16 @@ public class SimpletxBaRead extends DatastoreAbstractWriter {
 
                     String[] objectsArray = new String[outerList.getInnerList().size()];
 
-                    //LOG.info("innerList element: " + objectsArray );
                     for (InnerList innerList : outerList.getInnerList()) {
                         if (objectsArray[innerList.getName()] != null) {
-                            LOG.error("innerList: DUPLICATE name: {}, value: {}", innerList.getName(), innerList.getValue());
+                            LOG.error("innerList: DUPLICATE name: {}, value: {}", innerList.getName(),
+                                    innerList.getValue());
                         }
                         objectsArray[innerList.getName()] = innerList.getValue();
-                        // LOG.info("innerList: name: {}, value: {}", innerList.getName(), innerList.getValue());
                     }
-                    boolean foundAll = true;
                     for (int i = 0; i < outerList.getInnerList().size(); i++) {
                         String itemStr = objectsArray[i];
                         if (!itemStr.contentEquals("Item-" + String.valueOf(l) + "-" + String.valueOf(i))) {
-                            foundAll = false;
                             LOG.error("innerList: name: {}, value: {}", i, itemStr);
                             break;
                         }
index f0a0ba8..57dd810 100644 (file)
@@ -36,10 +36,10 @@ public class SimpletxBaWrite extends DatastoreAbstractWriter {
         LOG.info("Created SimpletxBaWrite");
     }
 
-     @Override
-     public void createList() {
-         list = BaListBuilder.buildOuterList(this.outerListElem, this.innerListElem);
-     }
+    @Override
+    public void createList() {
+        list = BaListBuilder.buildOuterList(this.outerListElem, this.innerListElem);
+    }
 
     @Override
     public void executeList() {
@@ -64,7 +64,7 @@ public class SimpletxBaWrite extends DatastoreAbstractWriter {
                     tx.submit().checkedGet();
                     txOk++;
                 } catch (TransactionCommitFailedException e) {
-                    LOG.error("Transaction failed: {}", e.toString());
+                    LOG.error("Transaction failed: {}", e);
                     txError++;
                 }
                 tx = dataBroker.newWriteOnlyTransaction();
@@ -78,7 +78,7 @@ public class SimpletxBaWrite extends DatastoreAbstractWriter {
             try {
                 tx.submit().checkedGet();
             } catch (TransactionCommitFailedException e) {
-                LOG.error("Transaction failed: {}", e.toString());
+                LOG.error("Transaction failed: {}", e);
             }
         }
     }
index 8f74853..2794fb4 100644 (file)
@@ -31,7 +31,7 @@ public class SimpletxDomDelete extends DatastoreAbstractWriter {
         super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx, dataStore);
         this.domDataBroker = domDataBroker;
         LOG.info("Created simpleTxDomDelete");
-   }
+    }
 
     @Override
     public void createList() {
@@ -52,14 +52,14 @@ public class SimpletxDomDelete extends DatastoreAbstractWriter {
     public void executeList() {
         long writeCnt = 0;
 
-        org.opendaylight.yangtools.yang.common.QName OL_ID = QName.create(OuterList.QNAME, "id");
+        org.opendaylight.yangtools.yang.common.QName olId = QName.create(OuterList.QNAME, "id");
         DOMDataWriteTransaction tx = domDataBroker.newWriteOnlyTransaction();
 
         for (int l = 0; l < outerListElem; l++) {
             YangInstanceIdentifier yid = YangInstanceIdentifier.builder()
                                          .node(TestExec.QNAME)
                                          .node(OuterList.QNAME)
-                                         .nodeWithKey(OuterList.QNAME, OL_ID, l)
+                                         .nodeWithKey(OuterList.QNAME, olId, l)
                                          .build();
 
             tx.delete(LogicalDatastoreType.CONFIGURATION, yid);
@@ -69,7 +69,7 @@ public class SimpletxDomDelete extends DatastoreAbstractWriter {
                     tx.submit().checkedGet();
                     txOk++;
                 } catch (TransactionCommitFailedException e) {
-                    LOG.error("Transaction failed: {}", e.toString());
+                    LOG.error("Transaction failed: {}", e);
                     txError++;
                 }
                 tx = domDataBroker.newWriteOnlyTransaction();
@@ -80,7 +80,7 @@ public class SimpletxDomDelete extends DatastoreAbstractWriter {
             try {
                 tx.submit().checkedGet();
             } catch (TransactionCommitFailedException e) {
-                LOG.error("Transaction failed: {}", e.toString());
+                LOG.error("Transaction failed: {}", e);
             }
         }
     }
index d644b1e..74f9d8e 100644 (file)
@@ -12,10 +12,10 @@ package org.opendaylight.dsbenchmark.simpletx;
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
 
-import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
 import org.opendaylight.dsbenchmark.DatastoreAbstractWriter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput.DataStore;
@@ -57,7 +57,7 @@ public class SimpletxDomRead extends DatastoreAbstractWriter {
 
     @Override
     public void executeList() {
-        org.opendaylight.yangtools.yang.common.QName OL_ID = QName.create(OuterList.QNAME, "id");
+        org.opendaylight.yangtools.yang.common.QName olId = QName.create(OuterList.QNAME, "id");
         DOMDataReadOnlyTransaction tx = domDataBroker.newReadOnlyTransaction();
 
         for (long l = 0; l < outerListElem; l++) {
@@ -66,41 +66,18 @@ public class SimpletxDomRead extends DatastoreAbstractWriter {
             YangInstanceIdentifier yid = YangInstanceIdentifier.builder()
                     .node(TestExec.QNAME)
                     .node(OuterList.QNAME)
-                    .nodeWithKey(OuterList.QNAME, OL_ID, l)
+                    .nodeWithKey(OuterList.QNAME, olId, l)
                     .build();
             Optional<NormalizedNode<?,?>> optionalDataObject;
-            CheckedFuture<Optional<NormalizedNode<?,?>>, ReadFailedException> submitFuture = tx.read(LogicalDatastoreType.CONFIGURATION, yid);
+            CheckedFuture<Optional<NormalizedNode<?,?>>, ReadFailedException> submitFuture =
+                    tx.read(LogicalDatastoreType.CONFIGURATION, yid);
             try {
                 optionalDataObject = submitFuture.checkedGet();
                 if (optionalDataObject != null && optionalDataObject.isPresent()) {
                     ret = optionalDataObject.get();
                     LOG.info("/n" + String.valueOf(ret));
                     txOk++;
-                }
-                /*if (optionalDataObject != null && optionalDataObject.isPresent()) {
-                    ret = optionalDataObject.get();
-
-                    String[] objectsArray = new String[ret.getInnerList().size()];
-
-                    //LOG.info("innerList element: " + objectsArray );
-                    for (InnerList innerList : ret.getInnerList()) {
-                        if (objectsArray[innerList.getName()] != null) {
-                            LOG.error("innerList: DUPLICATE name: {}, value: {}", innerList.getName(), innerList.getValue());
-                        }
-                        objectsArray[innerList.getName()] = innerList.getValue();
-                        // LOG.info("innerList: name: {}, value: {}", innerList.getName(), innerList.getValue());
-                    }
-                    boolean foundAll = true;
-                    for (int i = 0; i < ret.getInnerList().size(); i++) {
-                        String itemStr = objectsArray[i];
-                        if (!itemStr.contentEquals("Item-" + String.valueOf(l) + "-" + String.valueOf(i))) {
-                            foundAll = false;
-                            LOG.error("innerList: name: {}, value: {}", i, itemStr);
-                            break;
-                        }
-                    }
-                    txOk++;
-                }*/ else {
+                } else {
                     txError++;
                     LOG.info("In the else part");
                 }
index 6ab6990..572f4f7 100644 (file)
@@ -49,9 +49,11 @@ public class SimpletxDomWrite extends DatastoreAbstractWriter {
         LogicalDatastoreType dsType = getDataStoreType();
         long writeCnt = 0;
 
-        YangInstanceIdentifier pid = YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build();
+        YangInstanceIdentifier pid =
+                YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build();
         for (MapEntryNode element : this.list) {
-            YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, element.getIdentifier().getKeyValues()));
+            YangInstanceIdentifier yid =
+                    pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, element.getIdentifier().getKeyValues()));
 
             if (oper == StartTestInput.Operation.PUT) {
                 tx.put(dsType, yid, element);
index bbdb0f5..b4f6769 100644 (file)
@@ -8,6 +8,9 @@
 
 package org.opendaylight.dsbenchmark.txchain;
 
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+
 import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
@@ -26,14 +29,12 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
-
-public class TxchainBaDelete extends DatastoreAbstractWriter implements TransactionChainListener{
+public class TxchainBaDelete extends DatastoreAbstractWriter implements TransactionChainListener {
     private static final Logger LOG = LoggerFactory.getLogger(TxchainBaDelete.class);
     private DataBroker bindingDataBroker;
 
-    public TxchainBaDelete(DataBroker bindingDataBroker, int outerListElem, int innerListElem, long writesPerTx, DataStore dataStore) {
+    public TxchainBaDelete(DataBroker bindingDataBroker, int outerListElem, int innerListElem,
+            long writesPerTx, DataStore dataStore) {
         super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx, dataStore);
         this.bindingDataBroker = bindingDataBroker;
         LOG.info("Created TxchainBaDelete");
@@ -77,6 +78,7 @@ public class TxchainBaDelete extends DatastoreAbstractWriter implements Transact
                     public void onSuccess(final Void result) {
                         txOk++;
                     }
+
                     @Override
                     public void onFailure(final Throwable t) {
                         LOG.error("Transaction failed, {}", t);
@@ -100,8 +102,7 @@ public class TxchainBaDelete extends DatastoreAbstractWriter implements Transact
         }
         try {
             chain.close();
-        }
-        catch (IllegalStateException e){
+        } catch (IllegalStateException e) {
             LOG.error("Transaction close failed,", e);
         }
         LOG.info("Transactions: submitted {}, completed {}", txSubmitted, (txOk + txError));
index 37598d5..cb57f37 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.dsbenchmark.txchain;
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
 
-import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.ReadTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.*;
@@ -26,11 +25,12 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class TxchainBaRead extends DatastoreAbstractWriter implements TransactionChainListener{
+public class TxchainBaRead extends DatastoreAbstractWriter implements TransactionChainListener {
     private static final Logger LOG = LoggerFactory.getLogger(TxchainBaRead.class);
     private DataBroker bindingDataBroker;
 
-    public TxchainBaRead(DataBroker bindingDataBroker, int outerListElem, int innerListElem, long writesPerTx, DataStore dataStore) {
+    public TxchainBaRead(DataBroker bindingDataBroker, int outerListElem, int innerListElem,
+            long writesPerTx, DataStore dataStore) {
         super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx, dataStore);
         this.bindingDataBroker = bindingDataBroker;
         LOG.info("Created TxchainBaRead");
@@ -54,8 +54,6 @@ public class TxchainBaRead extends DatastoreAbstractWriter implements Transactio
 
     @Override
     public void executeList() {
-
-        BindingTransactionChain chain = bindingDataBroker.createTransactionChain(this);
         ReadTransaction tx = bindingDataBroker.newReadOnlyTransaction();
 
         for (long l = 0; l < outerListElem; l++) {
@@ -64,39 +62,31 @@ public class TxchainBaRead extends DatastoreAbstractWriter implements Transactio
             InstanceIdentifier<OuterList> iid = InstanceIdentifier.create(TestExec.class)
                     .child(OuterList.class, new OuterListKey((int) l));
             Optional<OuterList> optionalDataObject;
-            CheckedFuture<Optional<OuterList>, ReadFailedException> submitFuture = tx.read(LogicalDatastoreType.CONFIGURATION, iid);
+            CheckedFuture<Optional<OuterList>, ReadFailedException> submitFuture =
+                    tx.read(LogicalDatastoreType.CONFIGURATION, iid);
 
             try {
                 optionalDataObject = submitFuture.checkedGet();
-                /*if (optionalDataObject != null && optionalDataObject.isPresent()) {
-                    ret = optionalDataObject.get();
-                    txOk++;
-                }*/
                 if (optionalDataObject != null && optionalDataObject.isPresent()) {
                     outerList = optionalDataObject.get();
 
                     String[] objectsArray = new String[outerList.getInnerList().size()];
-
-                    //LOG.info("innerList element: " + objectsArray );
                     for (InnerList innerList : outerList.getInnerList()) {
                         if (objectsArray[innerList.getName()] != null) {
-                            LOG.error("innerList: DUPLICATE name: {}, value: {}", innerList.getName(), innerList.getValue());
+                            LOG.error("innerList: DUPLICATE name: {}, value: {}", innerList.getName(),
+                                    innerList.getValue());
                         }
                         objectsArray[innerList.getName()] = innerList.getValue();
-                        // LOG.info("innerList: name: {}, value: {}", innerList.getName(), innerList.getValue());
                     }
-                    boolean foundAll = true;
                     for (int i = 0; i < outerList.getInnerList().size(); i++) {
                         String itemStr = objectsArray[i];
                         if (!itemStr.contentEquals("Item-" + String.valueOf(l) + "-" + String.valueOf(i))) {
-                            foundAll = false;
                             LOG.error("innerList: name: {}, value: {}", i, itemStr);
                             break;
                         }
                     }
                     txOk++;
-                }
-                else {
+                } else {
                     txError++;
                 }
             } catch (ReadFailedException e) {
index 64efbd9..962c950 100644 (file)
@@ -8,8 +8,10 @@
 
 package org.opendaylight.dsbenchmark.txchain;
 
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+
 import java.util.List;
-import java.util.Random;
 
 import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
@@ -30,9 +32,6 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
-
 public class TxchainBaWrite extends DatastoreAbstractWriter implements TransactionChainListener {
     private static final Logger LOG = LoggerFactory.getLogger(TxchainBaWrite.class);
     private final DataBroker bindingDataBroker;
@@ -78,6 +77,7 @@ public class TxchainBaWrite extends DatastoreAbstractWriter implements Transacti
                     public void onSuccess(final Void result) {
                         txOk++;
                     }
+
                     @Override
                     public void onFailure(final Throwable t) {
                         LOG.error("Transaction failed, {}", t);
@@ -103,8 +103,7 @@ public class TxchainBaWrite extends DatastoreAbstractWriter implements Transacti
         }
         try {
             chain.close();
-        }
-        catch (IllegalStateException e){
+        } catch (IllegalStateException e) {
             LOG.error("Transaction close failed,", e);
         }
         LOG.info("Transactions: submitted {}, completed {}", txSubmitted, (txOk + txError));
index f1f4e44..63e9934 100644 (file)
@@ -30,11 +30,11 @@ import org.slf4j.LoggerFactory;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 
-public class TxchainDomDelete extends DatastoreAbstractWriter implements TransactionChainListener{
+public class TxchainDomDelete extends DatastoreAbstractWriter implements TransactionChainListener {
     private static final Logger LOG = LoggerFactory.getLogger(TxchainBaWrite.class);
     private final DOMDataBroker domDataBroker;
 
-    public TxchainDomDelete(DOMDataBroker domDataBroker, int outerListElem, int innerListElem, 
+    public TxchainDomDelete(DOMDataBroker domDataBroker, int outerListElem, int innerListElem,
             long writesPerTx, DataStore dataStore) {
         super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx, dataStore);
         this.domDataBroker = domDataBroker;
@@ -62,13 +62,14 @@ public class TxchainDomDelete extends DatastoreAbstractWriter implements Transac
         int txSubmitted = 0;
         int writeCnt = 0;
 
-        org.opendaylight.yangtools.yang.common.QName OL_ID = QName.create(OuterList.QNAME, "id");
+        org.opendaylight.yangtools.yang.common.QName olId = QName.create(OuterList.QNAME, "id");
         DOMTransactionChain chain = domDataBroker.createTransactionChain(this);
         DOMDataWriteTransaction tx = chain.newWriteOnlyTransaction();
 
-        YangInstanceIdentifier pid = YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build();
+        YangInstanceIdentifier pid =
+                YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build();
         for (int l = 0; l < outerListElem; l++) {
-            YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, OL_ID, l));
+            YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, olId, l));
             tx.delete(LogicalDatastoreType.CONFIGURATION, yid);
 
             writeCnt++;
@@ -80,6 +81,7 @@ public class TxchainDomDelete extends DatastoreAbstractWriter implements Transac
                     public void onSuccess(final Void result) {
                         txOk++;
                     }
+
                     @Override
                     public void onFailure(final Throwable t) {
                         LOG.error("Transaction failed, {}", t);
@@ -104,8 +106,7 @@ public class TxchainDomDelete extends DatastoreAbstractWriter implements Transac
         }
         try {
             chain.close();
-        }
-        catch (IllegalStateException e){
+        } catch (IllegalStateException e) {
             LOG.error("Transaction close failed,", e);
         }
         LOG.info("Transactions: submitted {}, completed {}", txSubmitted, (txOk + txError));
index 09d2aac..6a910f3 100644 (file)
@@ -14,7 +14,6 @@ import com.google.common.util.concurrent.CheckedFuture;
 import org.opendaylight.controller.md.sal.common.api.data.*;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
-import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
 import org.opendaylight.dsbenchmark.DatastoreAbstractWriter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput.DataStore;
@@ -27,11 +26,11 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class TxchainDomRead extends DatastoreAbstractWriter implements TransactionChainListener{
+public class TxchainDomRead extends DatastoreAbstractWriter implements TransactionChainListener {
     private static final Logger LOG = LoggerFactory.getLogger(TxchainDomRead.class);
     private final DOMDataBroker domDataBroker;
 
-    public TxchainDomRead(DOMDataBroker domDataBroker, int outerListElem, int innerListElem, 
+    public TxchainDomRead(DOMDataBroker domDataBroker, int outerListElem, int innerListElem,
             long writesPerTx, DataStore dataStore) {
         super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx, dataStore);
         this.domDataBroker = domDataBroker;
@@ -57,20 +56,19 @@ public class TxchainDomRead extends DatastoreAbstractWriter implements Transacti
     @Override
     public void executeList() {
 
-        org.opendaylight.yangtools.yang.common.QName OL_ID = QName.create(OuterList.QNAME, "id");
-        DOMTransactionChain chain = domDataBroker.createTransactionChain(this);
+        org.opendaylight.yangtools.yang.common.QName olId = QName.create(OuterList.QNAME, "id");
         DOMDataReadOnlyTransaction tx = domDataBroker.newReadOnlyTransaction();
 
-        YangInstanceIdentifier pid = YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build();
+        YangInstanceIdentifier pid =
+                YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build();
         for (int l = 0; l < outerListElem; l++) {
-            NormalizedNode<?,?> ret;
-            YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, OL_ID, l));
+            YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, olId, l));
             Optional<NormalizedNode<?,?>> optionalDataObject;
-            CheckedFuture<Optional<NormalizedNode<?,?>>, ReadFailedException> submitFuture = tx.read(LogicalDatastoreType.CONFIGURATION, yid);
+            CheckedFuture<Optional<NormalizedNode<?,?>>, ReadFailedException> submitFuture =
+                    tx.read(LogicalDatastoreType.CONFIGURATION, yid);
             try {
                 optionalDataObject = submitFuture.checkedGet();
                 if (optionalDataObject != null && optionalDataObject.isPresent()) {
-                    ret = optionalDataObject.get();
                     txOk++;
                 }
             } catch (ReadFailedException e) {
index 7e8c6aa..f422d43 100644 (file)
@@ -59,9 +59,11 @@ public class TxchainDomWrite extends DatastoreAbstractWriter implements Transact
         LogicalDatastoreType dsType = getDataStoreType();
         DOMDataWriteTransaction tx = chain.newWriteOnlyTransaction();
 
-        YangInstanceIdentifier pid = YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build();
+        YangInstanceIdentifier pid =
+                YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build();
         for (MapEntryNode element : this.list) {
-            YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, element.getIdentifier().getKeyValues()));
+            YangInstanceIdentifier yid =
+                    pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, element.getIdentifier().getKeyValues()));
 
             if (oper == StartTestInput.Operation.PUT) {
                 tx.put(dsType, yid, element);
@@ -79,6 +81,7 @@ public class TxchainDomWrite extends DatastoreAbstractWriter implements Transact
                     public void onSuccess(final Void result) {
                         txOk++;
                     }
+
                     @Override
                     public void onFailure(final Throwable t) {
                         LOG.error("Transaction failed, {}", t);
@@ -105,10 +108,10 @@ public class TxchainDomWrite extends DatastoreAbstractWriter implements Transact
         }
         try {
             chain.close();
-        }
-        catch (IllegalStateException e){
+        } catch (IllegalStateException e) {
             LOG.error("Transaction close failed,", e);
         }
+
         LOG.info("Transactions: submitted {}, completed {}", txSubmitted, (txOk + txError));
     }
 

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.