use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.outer.list.InnerList in project controller by opendaylight.
the class BaListBuilder method buildInnerList.
private static List<InnerList> buildInnerList(final int index, final int elements) {
List<InnerList> innerList = new ArrayList<>(elements);
final String itemStr = "Item-" + String.valueOf(index) + "-";
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;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.outer.list.InnerList in project controller by opendaylight.
the class SimpletxBaRead method executeList.
@Override
public void executeList() {
final LogicalDatastoreType dsType = getDataStoreType();
try (ReadOnlyTransaction tx = dataBroker.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(dsType, iid);
try {
optionalDataObject = submitFuture.checkedGet();
if (optionalDataObject != null && optionalDataObject.isPresent()) {
OuterList outerList = optionalDataObject.get();
String[] objectsArray = new String[outerList.getInnerList().size()];
for (InnerList innerList : outerList.getInnerList()) {
if (objectsArray[innerList.getName()] != null) {
LOG.error("innerList: DUPLICATE name: {}, value: {}", innerList.getName(), innerList.getValue());
}
objectsArray[innerList.getName()] = innerList.getValue();
}
for (int i = 0; i < outerList.getInnerList().size(); i++) {
String itemStr = objectsArray[i];
if (!itemStr.contentEquals("Item-" + String.valueOf(l) + "-" + String.valueOf(i))) {
LOG.error("innerList: name: {}, value: {}", i, itemStr);
break;
}
}
txOk++;
} else {
txError++;
}
} catch (final ReadFailedException e) {
LOG.warn("failed to ....", e);
txError++;
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.outer.list.InnerList in project controller by opendaylight.
the class TxchainBaRead method executeList.
@Override
public void executeList() {
final LogicalDatastoreType dsType = getDataStoreType();
try (ReadOnlyTransaction tx = bindingDataBroker.newReadOnlyTransaction()) {
for (long l = 0; l < outerListElem; l++) {
InstanceIdentifier<OuterList> iid = InstanceIdentifier.create(TestExec.class).child(OuterList.class, new OuterListKey((int) l));
CheckedFuture<Optional<OuterList>, ReadFailedException> submitFuture = tx.read(dsType, iid);
try {
Optional<OuterList> optionalDataObject = submitFuture.checkedGet();
if (optionalDataObject != null && optionalDataObject.isPresent()) {
OuterList outerList = optionalDataObject.get();
String[] objectsArray = new String[outerList.getInnerList().size()];
for (InnerList innerList : outerList.getInnerList()) {
if (objectsArray[innerList.getName()] != null) {
LOG.error("innerList: DUPLICATE name: {}, value: {}", innerList.getName(), innerList.getValue());
}
objectsArray[innerList.getName()] = innerList.getValue();
}
for (int i = 0; i < outerList.getInnerList().size(); i++) {
String itemStr = objectsArray[i];
if (!itemStr.contentEquals("Item-" + String.valueOf(l) + "-" + String.valueOf(i))) {
LOG.error("innerList: name: {}, value: {}", i, itemStr);
break;
}
}
txOk++;
} else {
txError++;
}
} catch (final ReadFailedException e) {
LOG.warn("failed to ....", e);
txError++;
}
}
}
}
Aggregations