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";
}
}
}
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 )
.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;
}
-
}
}
public abstract void createList();
+
public abstract void executeList();
public int getTxError() {
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 {
// 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))
.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))
}
return innerList.build();
}
-
-
}
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;
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
this.testsCompleted++;
- } catch ( Exception e ) {
+ } catch (Exception e) {
LOG.error( "Test error: {}", e.toString());
execStatus.set( ExecStatus.Idle );
return RpcResultBuilder.success(new StartTestOutputBuilder()
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()
.setExecTime(execTime)
.setTxOk((long)dsWriter.getTxOk())
.setNtfOk(numEvents)
+ .setDataChangeEventsOk(numDataChanges)
.setTxError((long)dsWriter.getTxError())
.build();
LOG.info("Failed to cleanup DataStore configtest data");
throw new IllegalStateException(e);
}
-
+
tx = dataBroker.newWriteOnlyTransaction();
tx.put(LogicalDatastoreType.OPERATIONAL, TEST_EXEC_IID, data);
try {
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(
// 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);
}
}
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());
return numEvents.get();
}
+ public int getNumDataChanges() {
+ return numDataChanges.get();
+ }
}
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;
}
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));
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;
}
@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);
}
+ }
}
}
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;
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()) {
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;
}
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() {
tx.submit().checkedGet();
txOk++;
} catch (TransactionCommitFailedException e) {
- LOG.error("Transaction failed: {}", e.toString());
+ LOG.error("Transaction failed: {}", e);
txError++;
}
tx = dataBroker.newWriteOnlyTransaction();
try {
tx.submit().checkedGet();
} catch (TransactionCommitFailedException e) {
- LOG.error("Transaction failed: {}", e.toString());
+ LOG.error("Transaction failed: {}", e);
}
}
}
super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx, dataStore);
this.domDataBroker = domDataBroker;
LOG.info("Created simpleTxDomDelete");
- }
+ }
@Override
public void createList() {
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);
tx.submit().checkedGet();
txOk++;
} catch (TransactionCommitFailedException e) {
- LOG.error("Transaction failed: {}", e.toString());
+ LOG.error("Transaction failed: {}", e);
txError++;
}
tx = domDataBroker.newWriteOnlyTransaction();
try {
tx.submit().checkedGet();
} catch (TransactionCommitFailedException e) {
- LOG.error("Transaction failed: {}", e.toString());
+ LOG.error("Transaction failed: {}", e);
}
}
}
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;
@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++) {
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");
}
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);
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;
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");
public void onSuccess(final Void result) {
txOk++;
}
+
@Override
public void onFailure(final Throwable t) {
LOG.error("Transaction failed, {}", t);
}
try {
chain.close();
- }
- catch (IllegalStateException e){
+ } catch (IllegalStateException e) {
LOG.error("Transaction close failed,", e);
}
LOG.info("Transactions: submitted {}, completed {}", txSubmitted, (txOk + txError));
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.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");
@Override
public void executeList() {
-
- BindingTransactionChain chain = bindingDataBroker.createTransactionChain(this);
ReadTransaction tx = bindingDataBroker.newReadOnlyTransaction();
for (long l = 0; l < outerListElem; l++) {
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) {
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;
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;
public void onSuccess(final Void result) {
txOk++;
}
+
@Override
public void onFailure(final Throwable t) {
LOG.error("Transaction failed, {}", t);
}
try {
chain.close();
- }
- catch (IllegalStateException e){
+ } catch (IllegalStateException e) {
LOG.error("Transaction close failed,", e);
}
LOG.info("Transactions: submitted {}, completed {}", txSubmitted, (txOk + txError));
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;
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++;
public void onSuccess(final Void result) {
txOk++;
}
+
@Override
public void onFailure(final Throwable t) {
LOG.error("Transaction failed, {}", t);
}
try {
chain.close();
- }
- catch (IllegalStateException e){
+ } catch (IllegalStateException e) {
LOG.error("Transaction close failed,", e);
}
LOG.info("Transactions: submitted {}, completed {}", txSubmitted, (txOk + txError));
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.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;
@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) {
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);
public void onSuccess(final Void result) {
txOk++;
}
+
@Override
public void onFailure(final Throwable t) {
LOG.error("Transaction failed, {}", t);
}
try {
chain.close();
- }
- catch (IllegalStateException e){
+ } catch (IllegalStateException e) {
LOG.error("Transaction close failed,", e);
}
+
LOG.info("Transactions: submitted {}, completed {}", txSubmitted, (txOk + txError));
}