Search in sources :

Example 6 with YangInstanceIdentifier

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);
}
Also used : YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier) Test(org.junit.Test)

Example 7 with YangInstanceIdentifier

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);
}
Also used : YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier) Test(org.junit.Test)

Example 8 with YangInstanceIdentifier

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;
}
Also used : ChildShardContext(org.opendaylight.mdsal.dom.spi.shard.ChildShardContext) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)

Example 9 with YangInstanceIdentifier

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();
}
Also used : DOMDataReadWriteTransaction(org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)

Example 10 with YangInstanceIdentifier

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();
}
Also used : DOMStoreReadWriteTransaction(org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier) DOMStoreThreePhaseCommitCohort(org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort)

Aggregations

YangInstanceIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)187 Test (org.junit.Test)111 NormalizedNode (org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode)34 MapEntryNode (org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode)21 ActorRef (akka.actor.ActorRef)19 NodeIdentifierWithPredicates (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates)19 ContainerNode (org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)15 TestActorRef (akka.testkit.TestActorRef)14 TestKit (akka.testkit.javadsl.TestKit)13 WriteModification (org.opendaylight.controller.cluster.datastore.modification.WriteModification)12 ArrayList (java.util.ArrayList)11 RegisterDataTreeNotificationListenerReply (org.opendaylight.controller.cluster.datastore.messages.RegisterDataTreeNotificationListenerReply)10 DeleteModification (org.opendaylight.controller.cluster.datastore.modification.DeleteModification)10 ActorContext (org.opendaylight.controller.cluster.datastore.utils.ActorContext)10 MapNode (org.opendaylight.yangtools.yang.data.api.schema.MapNode)10 AbstractTest (org.opendaylight.controller.cluster.datastore.AbstractTest)9 RegisterChangeListener (org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListener)9 DOMDataWriteTransaction (org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction)9 DOMStoreWriteTransaction (org.opendaylight.mdsal.dom.spi.store.DOMStoreWriteTransaction)9 NodeIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier)9