use of org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult in project netconf by opendaylight.
the class NetconfDataTreeServiceActorTest method testDelete.
@Test
public void testDelete() {
doReturn(FluentFutures.immediateFluentFuture(new DefaultDOMRpcResult())).when(netconfService).delete(STORE, PATH);
actorRef.tell(new DeleteEditConfigRequest(STORE, PATH), probe.ref());
verify(netconfService).delete(STORE, PATH);
}
use of org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult in project netconf by opendaylight.
the class NetconfDataTreeServiceActorTest method testIdleTimeout.
@Test
public void testIdleTimeout() {
final TestProbe testProbe = new TestProbe(system);
testProbe.watch(actorRef);
doReturn(Futures.immediateFuture(new DefaultDOMRpcResult())).when(netconfService).unlock();
doReturn(Futures.immediateFuture(new DefaultDOMRpcResult())).when(netconfService).discardChanges();
verify(netconfService, timeout(3000)).discardChanges();
verify(netconfService, timeout(3000)).unlock();
testProbe.expectTerminated(actorRef, TIMEOUT.duration());
}
use of org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult in project netconf by opendaylight.
the class ActorProxyNetconfServiceFacade method createResult.
private ListenableFuture<? extends DOMRpcResult> createResult() {
final SettableFuture<DOMRpcResult> settableFuture = SettableFuture.create();
settableFuture.set(new DefaultDOMRpcResult());
return settableFuture;
}
use of org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult in project netconf by opendaylight.
the class FieldsAwareReadOnlyTxTest method testReadWithFields.
@Test
public void testReadWithFields() {
doReturn(FluentFutures.immediateFluentFuture(new DefaultDOMRpcResult(mockedNode))).when(rpc).invokeRpc(any(QName.class), any(ContainerNode.class));
final NetconfBaseOps netconfOps = new NetconfBaseOps(rpc, mock(MountPointContext.class));
try (FieldsAwareReadOnlyTx readOnlyTx = new FieldsAwareReadOnlyTx(netconfOps, new RemoteDeviceId("a", new InetSocketAddress("localhost", 196)))) {
readOnlyTx.read(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.empty(), List.of(YangInstanceIdentifier.empty()));
verify(rpc).invokeRpc(eq(NETCONF_GET_CONFIG_QNAME), any(ContainerNode.class));
readOnlyTx.read(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.empty());
verify(rpc).invokeRpc(eq(NETCONF_GET_QNAME), any(ContainerNode.class));
}
}
use of org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult in project netconf by opendaylight.
the class NetconfMessageTransformer method toRpcResult.
@Override
public synchronized DOMRpcResult toRpcResult(final NetconfMessage message, final QName rpc) {
final NormalizedNode normalizedNode;
if (NetconfMessageTransformUtil.isDataRetrievalOperation(rpc)) {
normalizedNode = Builders.containerBuilder().withNodeIdentifier(NetconfMessageTransformUtil.NETCONF_RPC_REPLY_NODEID).withChild(Builders.anyXmlBuilder().withNodeIdentifier(NetconfMessageTransformUtil.NETCONF_DATA_NODEID).withValue(new DOMSource(NetconfMessageTransformUtil.getDataSubtree(message.getDocument()))).build()).build();
} else {
// Determine whether a base netconf operation is being invoked
// and also check if the device exposed model for base netconf.
// If no, use pre built base netconf operations model
final ImmutableMap<QName, ? extends RpcDefinition> currentMappedRpcs;
if (mappedRpcs.get(rpc) == null && isBaseOrNotificationRpc(rpc)) {
currentMappedRpcs = baseSchema.getMappedRpcs();
} else {
currentMappedRpcs = mappedRpcs;
}
final RpcDefinition rpcDefinition = currentMappedRpcs.get(rpc);
Preconditions.checkArgument(rpcDefinition != null, "Unable to parse response of %s, the rpc is unknown", rpc);
// In case no input for rpc is defined, we can simply construct the payload here
normalizedNode = parseResult(message, rpcDefinition);
}
return new DefaultDOMRpcResult(normalizedNode);
}
Aggregations