Search in sources :

Example 6 with NormalizedNodeMessage

use of org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage in project netconf by opendaylight.

the class ActorProxyNetconfServiceFacade method merge.

@Override
public ListenableFuture<? extends DOMRpcResult> merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode data, final Optional<ModifyAction> defaultOperation) {
    LOG.debug("{}: Merge {} {} via actor {}", id, store, path, masterActor);
    masterActor.tell(new MergeEditConfigRequest(store, new NormalizedNodeMessage(path, data), defaultOperation.orElse(null)), ActorRef.noSender());
    return createResult();
}
Also used : MergeEditConfigRequest(org.opendaylight.netconf.topology.singleton.messages.netconf.MergeEditConfigRequest) NormalizedNodeMessage(org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage)

Example 7 with NormalizedNodeMessage

use of org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage in project netconf by opendaylight.

the class ActorProxyNetconfServiceFacade method replace.

@Override
public ListenableFuture<? extends DOMRpcResult> replace(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode data, final Optional<ModifyAction> defaultOperation) {
    LOG.debug("{}: Replace {} {} via actor {}", id, store, path, masterActor);
    masterActor.tell(new ReplaceEditConfigRequest(store, new NormalizedNodeMessage(path, data), defaultOperation.orElse(null)), ActorRef.noSender());
    return createResult();
}
Also used : NormalizedNodeMessage(org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage) ReplaceEditConfigRequest(org.opendaylight.netconf.topology.singleton.messages.netconf.ReplaceEditConfigRequest)

Example 8 with NormalizedNodeMessage

use of org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage in project netconf by opendaylight.

the class ActorProxyTransactionFacade method put.

@Override
public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode data) {
    LOG.debug("{}: Put {} {} via actor {}", id, store, path, masterTxActor);
    masterTxActor.tell(new PutRequest(store, new NormalizedNodeMessage(path, data)), ActorRef.noSender());
}
Also used : NormalizedNodeMessage(org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage) PutRequest(org.opendaylight.netconf.topology.singleton.messages.transactions.PutRequest)

Example 9 with NormalizedNodeMessage

use of org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage in project netconf by opendaylight.

the class ProxyReadWriteTransactionTest method testDelayedMasterActorFuture.

@Test
public void testDelayedMasterActorFuture() throws InterruptedException, TimeoutException, ExecutionException {
    final Promise<Object> promise = Futures.promise();
    ProxyReadWriteTransaction tx = new ProxyReadWriteTransaction(DEVICE_ID, promise.future(), system.dispatcher(), Timeout.apply(5, TimeUnit.SECONDS));
    final ListenableFuture<Optional<NormalizedNode>> read = tx.read(STORE, PATH);
    final ListenableFuture<Boolean> exists = tx.exists(STORE, PATH);
    tx.put(STORE, PATH, node);
    tx.merge(STORE, PATH, node);
    tx.delete(STORE, PATH);
    final ListenableFuture<?> commit = tx.commit();
    promise.success(masterActor.ref());
    masterActor.expectMsgClass(ReadRequest.class);
    masterActor.reply(new NormalizedNodeMessage(PATH, node));
    masterActor.expectMsgClass(ExistsRequest.class);
    masterActor.reply(Boolean.TRUE);
    masterActor.expectMsgClass(PutRequest.class);
    masterActor.expectMsgClass(MergeRequest.class);
    masterActor.expectMsgClass(DeleteRequest.class);
    masterActor.expectMsgClass(SubmitRequest.class);
    masterActor.reply(new Success(null));
    read.get(5, TimeUnit.SECONDS).isPresent();
    assertTrue(exists.get(5, TimeUnit.SECONDS));
    commit.get(5, TimeUnit.SECONDS);
}
Also used : NormalizedNodeMessage(org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage) Optional(java.util.Optional) Success(akka.actor.Status.Success) Test(org.junit.Test)

Example 10 with NormalizedNodeMessage

use of org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage in project netconf by opendaylight.

the class ProxyReadWriteTransactionTest method testRead.

@Test
public void testRead() throws Exception {
    ProxyReadWriteTransaction tx = newSuccessfulProxyTx();
    final ListenableFuture<Optional<NormalizedNode>> read = tx.read(STORE, PATH);
    final ReadRequest readRequest = masterActor.expectMsgClass(ReadRequest.class);
    assertEquals(STORE, readRequest.getStore());
    assertEquals(PATH, readRequest.getPath());
    masterActor.reply(new NormalizedNodeMessage(PATH, node));
    final Optional<NormalizedNode> result = read.get(5, TimeUnit.SECONDS);
    assertTrue(result.isPresent());
    assertEquals(node, result.get());
}
Also used : NormalizedNodeMessage(org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage) Optional(java.util.Optional) NormalizedNode(org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode) ReadRequest(org.opendaylight.netconf.topology.singleton.messages.transactions.ReadRequest) Test(org.junit.Test)

Aggregations

NormalizedNodeMessage (org.opendaylight.netconf.topology.singleton.messages.NormalizedNodeMessage)20 Test (org.junit.Test)12 Optional (java.util.Optional)5 DefaultDOMRpcResult (org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult)4 MergeRequest (org.opendaylight.netconf.topology.singleton.messages.transactions.MergeRequest)3 PutRequest (org.opendaylight.netconf.topology.singleton.messages.transactions.PutRequest)3 ReadRequest (org.opendaylight.netconf.topology.singleton.messages.transactions.ReadRequest)3 NormalizedNode (org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode)3 CreateEditConfigRequest (org.opendaylight.netconf.topology.singleton.messages.netconf.CreateEditConfigRequest)2 GetConfigRequest (org.opendaylight.netconf.topology.singleton.messages.netconf.GetConfigRequest)2 GetRequest (org.opendaylight.netconf.topology.singleton.messages.netconf.GetRequest)2 MergeEditConfigRequest (org.opendaylight.netconf.topology.singleton.messages.netconf.MergeEditConfigRequest)2 ReplaceEditConfigRequest (org.opendaylight.netconf.topology.singleton.messages.netconf.ReplaceEditConfigRequest)2 Success (akka.actor.Status.Success)1 Collection (java.util.Collection)1 ReadFailedException (org.opendaylight.mdsal.common.api.ReadFailedException)1 DOMRpcResult (org.opendaylight.mdsal.dom.api.DOMRpcResult)1 ClusteringRpcException (org.opendaylight.netconf.topology.singleton.impl.utils.ClusteringRpcException)1 SchemaPathMessage (org.opendaylight.netconf.topology.singleton.messages.SchemaPathMessage)1 InvokeRpcMessage (org.opendaylight.netconf.topology.singleton.messages.rpc.InvokeRpcMessage)1