Added support for data store type (OPERATIONAL or CONFIG or BOTH) 40/31240/3
authorJan Medved <jmedved@cisco.com>
Mon, 14 Dec 2015 01:38:22 +0000 (17:38 -0800)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 14 Dec 2015 15:33:08 +0000 (15:33 +0000)
Change-Id: I33e59fd4fdab2058ce863643f84fede50e79271e
Signed-off-by: Jan Medved <jmedved@cisco.com>
15 files changed:
benchmark/api/src/main/yang/dsbenchmark.yang
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/DatastoreAbstractWriter.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/DsbenchmarkProvider.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 062cc85..d56c185 100644 (file)
@@ -125,6 +125,20 @@ module dsbenchmark {
                     "Data format:-binding-aware or binding-independent";
             }
 
+            leaf data-store {
+                mandatory true;
+                type enumeration {
+                    enum "CONFIG" {
+                        value 1;
+                    }
+                    enum "OPERATIONAL" {
+                        value 2;
+                    }
+                    enum "BOTH" {
+                        value 3;
+                    }
+                }
+            }
             leaf outerElements {
                 type uint32;
                 default 100000;
index 93a4876..db17cdb 100644 (file)
@@ -8,24 +8,37 @@
 
 package org.opendaylight.dsbenchmark;
 
+import java.util.Random;
+
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 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;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public abstract class DatastoreAbstractWriter {
+    private static final Logger LOG = LoggerFactory.getLogger(DatastoreAbstractWriter.class);
+
     protected final int outerListElem;
     protected final int innerListElem;
     protected final long writesPerTx;
     protected final StartTestInput.Operation oper;
+    protected final StartTestInput.DataStore dataStore;
+    protected final Random rn = new Random();
+
 
     protected int txOk = 0;
     protected int txError = 0;
 
 
     public DatastoreAbstractWriter(StartTestInput.Operation oper,
-                                   int outerListElem, int innerListElem, long writesPerTx) {
+                                   int outerListElem, int innerListElem, long writesPerTx, DataStore dataStore) {
         this.outerListElem = outerListElem;
         this.innerListElem = innerListElem;
         this.writesPerTx = writesPerTx;
         this.oper = oper;
+        this.dataStore = dataStore;
+        LOG.info("DatastoreAbstractWriter created: {}", this);
     }
 
     public abstract void createList();
@@ -39,4 +52,22 @@ public abstract class DatastoreAbstractWriter {
         return txOk;
     }
 
+    protected LogicalDatastoreType getDataStoreType() {
+        final LogicalDatastoreType dsType;
+        if (dataStore == DataStore.CONFIG) {
+            dsType = LogicalDatastoreType.CONFIGURATION;
+        }
+        else if (dataStore == DataStore.OPERATIONAL) {
+            dsType = LogicalDatastoreType.OPERATIONAL;
+        }
+        else
+        {
+            if (rn.nextInt() % 2 != 0) {
+                dsType = LogicalDatastoreType.OPERATIONAL;
+            } else {
+                dsType = LogicalDatastoreType.CONFIGURATION;
+            }
+        }
+        return dsType;
+    }
 }
index 56e3899..92ac69c 100644 (file)
@@ -176,9 +176,19 @@ public class DsbenchmarkProvider implements BindingAwareProvider, DsbenchmarkSer
         tx.put(LogicalDatastoreType.CONFIGURATION, TEST_EXEC_IID, data);
         try {
             tx.submit().checkedGet();
-            LOG.info("DataStore test data cleaned up");
+            LOG.info("DataStore config test data cleaned up");
         } catch (TransactionCommitFailedException e) {
-            LOG.info("Failed to cleanup DataStore test data");
+            LOG.info("Failed to cleanup DataStore configtest data");
+            throw new IllegalStateException(e);
+        }
+        
+        tx = dataBroker.newWriteOnlyTransaction();
+        tx.put(LogicalDatastoreType.OPERATIONAL, TEST_EXEC_IID, data);
+        try {
+            tx.submit().checkedGet();
+            LOG.info("DataStore operational test data cleaned up");
+        } catch (TransactionCommitFailedException e) {
+            LOG.info("Failed to cleanup DataStore operational test data");
             throw new IllegalStateException(e);
         }
 
@@ -191,6 +201,7 @@ public class DsbenchmarkProvider implements BindingAwareProvider, DsbenchmarkSer
         StartTestInput.TransactionType txType = input.getTransactionType();
         StartTestInput.Operation oper = input.getOperation();
         StartTestInput.DataFormat dataFormat = input.getDataFormat();
+        StartTestInput.DataStore dataStore = input.getDataStore();
         int outerListElem = input.getOuterElements().intValue();
         int innerListElem = input.getInnerElements().intValue();
         int writesPerTx = input.getPutsPerTx().intValue();
@@ -200,49 +211,49 @@ public class DsbenchmarkProvider implements BindingAwareProvider, DsbenchmarkSer
                 if (dataFormat == StartTestInput.DataFormat.BINDINGAWARE) {
                     if (StartTestInput.Operation.DELETE == oper) {
                         retVal = new SimpletxBaDelete(this.dataBroker, outerListElem,
-                                innerListElem,writesPerTx);
+                                innerListElem,writesPerTx, dataStore);
                     } else if (StartTestInput.Operation.READ == oper) {
                         retVal = new SimpletxBaRead(this.dataBroker, outerListElem,
-                                innerListElem,writesPerTx);
+                                innerListElem, writesPerTx, dataStore);
                     } else {
                         retVal = new SimpletxBaWrite(this.dataBroker, oper, outerListElem,
-                                innerListElem,writesPerTx);
+                                innerListElem, writesPerTx, dataStore);
                     }
                 } else {
                     if (StartTestInput.Operation.DELETE == oper) {
                         retVal = new SimpletxDomDelete(this.domDataBroker, outerListElem,
-                                innerListElem, writesPerTx);
+                                innerListElem, writesPerTx, dataStore);
                     } else if (StartTestInput.Operation.READ == oper) {
                         retVal = new SimpletxDomRead(this.domDataBroker, outerListElem,
-                                innerListElem, writesPerTx);
+                                innerListElem, writesPerTx, dataStore);
                     } else {
                         retVal = new SimpletxDomWrite(this.domDataBroker, oper, outerListElem,
-                                innerListElem,writesPerTx);
+                                innerListElem, writesPerTx, dataStore);
                     }
                 }
             } else {
                 if (dataFormat == StartTestInput.DataFormat.BINDINGAWARE) {
                     if (StartTestInput.Operation.DELETE == oper) {
                         retVal = new TxchainBaDelete(this.bindingDataBroker, outerListElem,
-                                innerListElem, writesPerTx);
+                                innerListElem, writesPerTx, dataStore);
                     } else if (StartTestInput.Operation.READ == oper) {
                         retVal = new TxchainBaRead(this.bindingDataBroker,outerListElem,
-                                innerListElem,writesPerTx);
+                                innerListElem,writesPerTx, dataStore);
                     } else {
                         retVal = new TxchainBaWrite(this.bindingDataBroker, oper, outerListElem,
-                                innerListElem,writesPerTx);
+                                innerListElem, writesPerTx, dataStore);
                     }
                 } else {
                     if (StartTestInput.Operation.DELETE == oper) {
                         retVal = new TxchainDomDelete(this.domDataBroker, outerListElem,
-                                innerListElem, writesPerTx);
+                                innerListElem, writesPerTx, dataStore);
                     } else if (StartTestInput.Operation.READ == oper) {
                         retVal = new TxchainDomRead(this.domDataBroker, outerListElem,
-                                innerListElem, writesPerTx);
+                                innerListElem, writesPerTx, dataStore);
 
                     } else {
                         retVal = new TxchainDomWrite(this.domDataBroker, oper, outerListElem,
-                                innerListElem,writesPerTx);
+                                innerListElem,writesPerTx, dataStore);
                     }
                 }
             }
index 976623f..45cd66e 100644 (file)
@@ -15,6 +15,7 @@ import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 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;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.TestExec;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterListKey;
@@ -26,8 +27,9 @@ public class SimpletxBaDelete extends DatastoreAbstractWriter {
     private static final Logger LOG = (Logger) LoggerFactory.getLogger(SimpletxBaDelete.class);
     private DataBroker dataBroker;
 
-    public SimpletxBaDelete(DataBroker dataBroker, int outerListElem, int innerListElem, long writesPerTx) {
-        super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx);
+    public SimpletxBaDelete(DataBroker dataBroker, int outerListElem, int innerListElem,
+            long writesPerTx, DataStore dataStore) {
+        super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx, dataStore);
         this.dataBroker = dataBroker;
         LOG.info("Created SimpletxBaDelete");
     }
@@ -41,7 +43,8 @@ public class SimpletxBaDelete extends DatastoreAbstractWriter {
                                                  StartTestInput.Operation.PUT,
                                                  outerListElem,
                                                  innerListElem,
-                                                 outerListElem);
+                                                 outerListElem,
+                                                 dataStore);
         dd.createList();
         dd.executeList();
     }
index b647269..bc43d46 100644 (file)
@@ -11,12 +11,14 @@ package org.opendaylight.dsbenchmark.simpletx;
 
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
+
 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.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 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;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.TestExec;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterListKey;
@@ -30,8 +32,9 @@ public class SimpletxBaRead extends DatastoreAbstractWriter {
     private static final Logger LOG = (Logger) LoggerFactory.getLogger(SimpletxBaRead.class);
     private DataBroker dataBroker;
 
-    public SimpletxBaRead(DataBroker dataBroker, int outerListElem, int innerListElem, long writesPerTx) {
-        super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx);
+    public SimpletxBaRead(DataBroker dataBroker, int outerListElem, int innerListElem, 
+            long writesPerTx, DataStore dataStore) {
+        super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx, dataStore);
         this.dataBroker = dataBroker;
         LOG.info("Created SimpletxBaRead");
     }
@@ -45,7 +48,8 @@ public class SimpletxBaRead extends DatastoreAbstractWriter {
                 StartTestInput.Operation.PUT,
                 outerListElem,
                 innerListElem,
-                outerListElem);
+                outerListElem,
+                dataStore);
         dd.createList();
         dd.executeList();
     }
index f811c4b..5357311 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFaile
 import org.opendaylight.dsbenchmark.BaListBuilder;
 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;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.TestExec;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterList;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -29,8 +30,8 @@ public class SimpletxBaWrite extends DatastoreAbstractWriter {
     private List<OuterList> list;
 
     public SimpletxBaWrite(DataBroker dataBroker, StartTestInput.Operation oper,
-            int outerListElem, int innerListElem, long writesPerTx) {
-        super(oper, outerListElem, innerListElem, writesPerTx);
+            int outerListElem, int innerListElem, long writesPerTx, DataStore dataStore) {
+        super(oper, outerListElem, innerListElem, writesPerTx, dataStore);
         this.dataBroker = dataBroker;
         LOG.info("Created SimpletxBaWrite");
     }
index ab7590c..aa0a2ac 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 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;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.TestExec;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterList;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -26,8 +27,8 @@ public class SimpletxDomDelete extends DatastoreAbstractWriter {
     private final DOMDataBroker domDataBroker;
 
     public SimpletxDomDelete(DOMDataBroker domDataBroker, int outerListElem,
-            int innerListElem, long writesPerTx) {
-        super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx);
+            int innerListElem, long writesPerTx, DataStore dataStore) {
+        super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx, dataStore);
         this.domDataBroker = domDataBroker;
         LOG.info("Created simpleTxDomDelete");
    }
@@ -41,7 +42,8 @@ public class SimpletxDomDelete extends DatastoreAbstractWriter {
                                                    StartTestInput.Operation.PUT,
                                                    outerListElem,
                                                    innerListElem,
-                                                   outerListElem);
+                                                   outerListElem,
+                                                   dataStore);
         dd.createList();
         dd.executeList();
     }
index 98f8c9f..4c0eb02 100644 (file)
@@ -11,12 +11,14 @@ 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.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;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.TestExec;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterList;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -31,8 +33,8 @@ public class SimpletxDomRead extends DatastoreAbstractWriter {
     private final DOMDataBroker domDataBroker;
 
     public SimpletxDomRead(DOMDataBroker domDataBroker, int outerListElem,
-                           int innerListElem, long writesPerTx) {
-        super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx);
+                           int innerListElem, long writesPerTx, DataStore dataStore) {
+        super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx, dataStore);
         this.domDataBroker = domDataBroker;
         LOG.info("Created simpleTxDomRead");
 
@@ -44,10 +46,11 @@ public class SimpletxDomRead extends DatastoreAbstractWriter {
         // Dump the whole list into the data store in a single transaction
         // with <outerListElem> PUTs on the transaction
         SimpletxDomWrite dd = new SimpletxDomWrite(domDataBroker,
-                StartTestInput.Operation.PUT,
-                outerListElem,
-                innerListElem,
-                outerListElem);
+                                                   StartTestInput.Operation.PUT,
+                                                   outerListElem,
+                                                   innerListElem,
+                                                   outerListElem,
+                                                   dataStore);
         dd.createList();
         dd.executeList();
     }
index 97dc900..f367b83 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.dsbenchmark.DatastoreAbstractWriter;
 import org.opendaylight.dsbenchmark.DomListBuilder;
 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;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.TestExec;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterList;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -31,8 +32,8 @@ public class SimpletxDomWrite extends DatastoreAbstractWriter {
     private List<MapEntryNode> list;
 
     public SimpletxDomWrite(DOMDataBroker domDataBroker, StartTestInput.Operation oper,
-                                    int outerListElem, int innerListElem, long putsPerTx ) {
-        super(oper, outerListElem, innerListElem, putsPerTx);
+                                    int outerListElem, int innerListElem, long putsPerTx, DataStore dataStore ) {
+        super(oper, outerListElem, innerListElem, putsPerTx, dataStore);
         this.domDataBroker = domDataBroker;
         LOG.info("Created SimpletxDomWrite");
     }
index dd565fb..b30b38b 100644 (file)
@@ -18,6 +18,7 @@ import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListen
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 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;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.TestExec;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterListKey;
@@ -32,8 +33,8 @@ public class TxchainBaDelete extends DatastoreAbstractWriter implements Transact
     private static final Logger LOG = (Logger) LoggerFactory.getLogger(TxchainBaDelete.class);
     private DataBroker bindingDataBroker;
 
-    public TxchainBaDelete(DataBroker bindingDataBroker, int outerListElem, int innerListElem, long writesPerTx) {
-        super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx);
+    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");
     }
@@ -48,7 +49,8 @@ public class TxchainBaDelete extends DatastoreAbstractWriter implements Transact
                                                StartTestInput.Operation.PUT,
                                                outerListElem,
                                                innerListElem,
-                                               outerListElem);
+                                               outerListElem,
+                                               dataStore);
         dd.createList();
         dd.executeList();
     }
index 3763b89..2a53dea 100644 (file)
@@ -10,12 +10,14 @@ 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.*;
 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;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.TestExec;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterListKey;
@@ -28,8 +30,8 @@ public class TxchainBaRead extends DatastoreAbstractWriter implements Transactio
     private static final Logger LOG = (Logger) LoggerFactory.getLogger(TxchainBaRead.class);
     private DataBroker bindingDataBroker;
 
-    public TxchainBaRead(DataBroker bindingDataBroker, int outerListElem, int innerListElem, long writesPerTx) {
-        super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx);
+    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");
     }
@@ -41,10 +43,11 @@ public class TxchainBaRead extends DatastoreAbstractWriter implements Transactio
         // Dump the whole list into the data store in a single transaction
         // with <outerListElem> PUTs on the transaction
         TxchainBaWrite dd = new TxchainBaWrite(bindingDataBroker,
-                StartTestInput.Operation.PUT,
-                outerListElem,
-                innerListElem,
-                outerListElem);
+                                               StartTestInput.Operation.PUT,
+                                               outerListElem,
+                                               innerListElem,
+                                               outerListElem,
+                                               dataStore);
         dd.createList();
         dd.executeList();
     }
index 3c78de4..64efbd9 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.dsbenchmark.txchain;
 
 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;
@@ -20,6 +21,7 @@ import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListen
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.dsbenchmark.BaListBuilder;
 import org.opendaylight.dsbenchmark.DatastoreAbstractWriter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput.DataStore;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput.Operation;
 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.TestExec;
@@ -37,8 +39,8 @@ public class TxchainBaWrite extends DatastoreAbstractWriter implements Transacti
     private List<OuterList> list;
 
     public TxchainBaWrite(DataBroker bindingDataBroker, Operation oper,
-                          int outerListElem, int innerListElem, long writesPerTx) {
-        super(oper, outerListElem, innerListElem, writesPerTx);
+                          int outerListElem, int innerListElem, long writesPerTx, DataStore dataStore) {
+        super(oper, outerListElem, innerListElem, writesPerTx, dataStore);
         this.bindingDataBroker = bindingDataBroker;
         LOG.info("Created TxchainBaWrite");
     }
@@ -55,14 +57,16 @@ public class TxchainBaWrite extends DatastoreAbstractWriter implements Transacti
 
         BindingTransactionChain chain = bindingDataBroker.createTransactionChain(this);
         WriteTransaction tx = chain.newWriteOnlyTransaction();
+        LogicalDatastoreType dsType = getDataStoreType();
 
         for (OuterList element : this.list) {
             InstanceIdentifier<OuterList> iid = InstanceIdentifier.create(TestExec.class)
                                                     .child(OuterList.class, element.getKey());
+
             if (oper == StartTestInput.Operation.PUT) {
-                tx.put(LogicalDatastoreType.CONFIGURATION, iid, element);
+                tx.put(dsType, iid, element);
             } else {
-                tx.merge(LogicalDatastoreType.CONFIGURATION, iid, element);
+                tx.merge(dsType, iid, element);
             }
 
             writeCnt++;
@@ -81,6 +85,7 @@ public class TxchainBaWrite extends DatastoreAbstractWriter implements Transacti
                     }
                 });
                 tx = chain.newWriteOnlyTransaction();
+                dsType = getDataStoreType();
                 writeCnt = 0;
             }
         }
index b1df83e..f1f4e44 100644 (file)
@@ -18,6 +18,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 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;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.TestExec;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterList;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -33,8 +34,9 @@ public class TxchainDomDelete extends DatastoreAbstractWriter implements Transac
     private static final Logger LOG = LoggerFactory.getLogger(TxchainBaWrite.class);
     private final DOMDataBroker domDataBroker;
 
-    public TxchainDomDelete(DOMDataBroker domDataBroker, int outerListElem, int innerListElem, long writesPerTx) {
-        super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx);
+    public TxchainDomDelete(DOMDataBroker domDataBroker, int outerListElem, int innerListElem, 
+            long writesPerTx, DataStore dataStore) {
+        super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx, dataStore);
         this.domDataBroker = domDataBroker;
         LOG.info("Created TxchainDomDelete");
     }
@@ -49,7 +51,8 @@ public class TxchainDomDelete extends DatastoreAbstractWriter implements Transac
                                                  StartTestInput.Operation.PUT,
                                                  outerListElem,
                                                  innerListElem,
-                                                 outerListElem);
+                                                 outerListElem,
+                                                 dataStore);
         dd.createList();
         dd.executeList();
     }
index 208d217..09d2aac 100644 (file)
@@ -10,12 +10,14 @@ package org.opendaylight.dsbenchmark.txchain;
 
 import com.google.common.base.Optional;
 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;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.TestExec;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterList;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -29,8 +31,9 @@ public class TxchainDomRead extends DatastoreAbstractWriter implements Transacti
     private static final Logger LOG = LoggerFactory.getLogger(TxchainDomRead.class);
     private final DOMDataBroker domDataBroker;
 
-    public TxchainDomRead(DOMDataBroker domDataBroker, int outerListElem, int innerListElem, long writesPerTx) {
-        super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx);
+    public TxchainDomRead(DOMDataBroker domDataBroker, int outerListElem, int innerListElem, 
+            long writesPerTx, DataStore dataStore) {
+        super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx, dataStore);
         this.domDataBroker = domDataBroker;
         LOG.info("Created TxchainDomDelete");
     }
@@ -42,10 +45,11 @@ public class TxchainDomRead extends DatastoreAbstractWriter implements Transacti
         // Dump the whole list into the data store in a single transaction
         // with <outerListElem> PUTs on the transaction
         TxchainDomWrite dd = new TxchainDomWrite(domDataBroker,
-                StartTestInput.Operation.PUT,
-                outerListElem,
-                innerListElem,
-                outerListElem);
+                                                 StartTestInput.Operation.PUT,
+                                                     outerListElem,
+                                                     innerListElem,
+                                                     outerListElem,
+                                                     dataStore);
         dd.createList();
         dd.executeList();
     }
index f7a44d5..902397c 100644 (file)
@@ -21,6 +21,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
 import org.opendaylight.dsbenchmark.DatastoreAbstractWriter;
 import org.opendaylight.dsbenchmark.DomListBuilder;
 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;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.TestExec;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterList;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -38,8 +39,8 @@ public class TxchainDomWrite extends DatastoreAbstractWriter implements Transact
     private List<MapEntryNode> list;
 
     public TxchainDomWrite(DOMDataBroker domDataBroker, StartTestInput.Operation oper, int outerListElem,
-            int innerListElem, long writesPerTx) {
-        super(oper, outerListElem, innerListElem, writesPerTx);
+            int innerListElem, long writesPerTx, DataStore dataStore) {
+        super(oper, outerListElem, innerListElem, writesPerTx, dataStore);
         this.domDataBroker = domDataBroker;
         LOG.info("Created TxchainDomWrite");
     }

©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.