use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier in project controller by opendaylight.
the class ClientTransactionCursorTest method testExitOneLevel.
@Test
public void testExitOneLevel() throws Exception {
cursor.enter(toPathArg(NODE_1, NODE_2));
cursor.exit();
cursor.delete(YangInstanceIdentifier.NodeIdentifier.create(NODE_2));
final YangInstanceIdentifier expected = createId(NODE_1, NODE_2);
verify(transaction).delete(expected);
}
use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier in project controller by opendaylight.
the class RemoteProxyTransactionTest method testDelete.
@Override
@Test
public void testDelete() throws Exception {
final YangInstanceIdentifier path = PATH_3;
testModification(() -> transaction.delete(path), TransactionDelete.class, path);
}
use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier in project controller by opendaylight.
the class DistributedShardChangePublisher method setupListenerContext.
private <L extends DOMDataTreeChangeListener> AbstractDOMDataTreeChangeListenerRegistration<L> setupListenerContext(final YangInstanceIdentifier listenerPath, final L listener) {
// we need to register the listener registration path based on the shards root
// we have to strip the shard path from the listener path and then register
YangInstanceIdentifier strippedIdentifier = listenerPath;
if (!shardPath.isEmpty()) {
strippedIdentifier = YangInstanceIdentifier.create(stripShardPath(shardPath, listenerPath));
}
final DOMDataTreeListenerWithSubshards subshardListener = new DOMDataTreeListenerWithSubshards(strippedIdentifier, listener);
final AbstractDOMDataTreeChangeListenerRegistration<L> reg = setupContextWithoutSubshards(listenerPath, strippedIdentifier, subshardListener);
for (final ChildShardContext maybeAffected : childShards.values()) {
if (listenerPath.contains(maybeAffected.getPrefix().getRootIdentifier())) {
// consumer has initialDataChangeEvent subshard somewhere on lower level
// register to the notification manager with snapshot and forward child notifications to parent
LOG.debug("Adding new subshard{{}} to listener at {}", maybeAffected.getPrefix(), listenerPath);
subshardListener.addSubshard(maybeAffected);
} else if (maybeAffected.getPrefix().getRootIdentifier().contains(listenerPath)) {
// already registering to the lowest shard possible
throw new UnsupportedOperationException("Listener should be registered directly " + "into initialDataChangeEvent subshard");
}
}
return reg;
}
use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier in project controller by opendaylight.
the class AbstractInMemoryBrokerWriteTransactionBenchmark method initTestNode.
protected void initTestNode() throws Exception {
final YangInstanceIdentifier testPath = YangInstanceIdentifier.builder(BenchmarkModel.TEST_PATH).build();
DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction();
writeTx.put(LogicalDatastoreType.OPERATIONAL, testPath, provideOuterListNode());
writeTx.submit().get();
}
use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier in project controller by opendaylight.
the class AbstractInMemoryDatastoreWriteTransactionBenchmark method initTestNode.
protected void initTestNode() throws Exception {
final YangInstanceIdentifier testPath = YangInstanceIdentifier.builder(BenchmarkModel.TEST_PATH).build();
DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
writeTx.write(testPath, provideOuterListNode());
DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
cohort.canCommit().get();
cohort.preCommit().get();
cohort.commit().get();
}
Aggregations