use of org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps in project netconf by opendaylight.
the class ReadOnlyTxTest method testRead.
@Test
public void testRead() throws Exception {
final NetconfBaseOps netconfOps = new NetconfBaseOps(rpc, mock(MountPointContext.class));
final ReadOnlyTx readOnlyTx = new ReadOnlyTx(netconfOps, new RemoteDeviceId("a", new InetSocketAddress("localhost", 196)));
readOnlyTx.read(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.empty());
verify(rpc).invokeRpc(Mockito.eq(NetconfMessageTransformUtil.NETCONF_GET_CONFIG_QNAME), any(ContainerNode.class));
readOnlyTx.read(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.empty());
verify(rpc).invokeRpc(Mockito.eq(NetconfMessageTransformUtil.NETCONF_GET_QNAME), any(ContainerNode.class));
}
use of org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps in project netconf by opendaylight.
the class WriteCandidateRunningTxTest method setUp.
@Before
public void setUp() {
doReturn(FluentFutures.immediateFluentFuture(new DefaultDOMRpcResult())).when(rpc).invokeRpc(any(), any());
netconfOps = new NetconfBaseOps(rpc, new EmptyMountPointContext(SCHEMA_CONTEXT));
id = new RemoteDeviceId("device1", InetSocketAddress.createUnresolved("0.0.0.0", 17830));
}
use of org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps in project netconf by opendaylight.
the class WriteCandidateTxTest method setUp.
@Before
public void setUp() {
doReturn(FluentFutures.immediateFluentFuture(new DefaultDOMRpcResult())).when(rpc).invokeRpc(any(), any());
netconfOps = new NetconfBaseOps(rpc, new EmptyMountPointContext(SCHEMA_CONTEXT));
id = new RemoteDeviceId("device1", InetSocketAddress.createUnresolved("0.0.0.0", 17830));
}
use of org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps in project netconf by opendaylight.
the class WriteRunningTxTest method setUp.
@Before
public void setUp() {
doReturn(FluentFutures.immediateFluentFuture(new DefaultDOMRpcResult())).when(rpc).invokeRpc(any(), any());
netconfOps = new NetconfBaseOps(rpc, new EmptyMountPointContext(SCHEMA_CONTEXT));
id = new RemoteDeviceId("device1", InetSocketAddress.createUnresolved("0.0.0.0", 17830));
}
use of org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps in project netconf by opendaylight.
the class AbstractNetconfDataTreeService method of.
@NonNull
public static AbstractNetconfDataTreeService of(final RemoteDeviceId id, final MountPointContext mountContext, final DOMRpcService rpc, final NetconfSessionPreferences netconfSessionPreferences) {
final NetconfBaseOps netconfOps = new NetconfBaseOps(rpc, mountContext);
final boolean rollbackSupport = netconfSessionPreferences.isRollbackSupported();
// Examine preferences and decide which implementation to use
if (netconfSessionPreferences.isCandidateSupported()) {
return netconfSessionPreferences.isRunningWritable() ? new CandidateWithRunning(id, netconfOps, rollbackSupport) : new Candidate(id, netconfOps, rollbackSupport);
} else if (netconfSessionPreferences.isRunningWritable()) {
return new Running(id, netconfOps, rollbackSupport);
} else {
throw new IllegalArgumentException("Device " + id.getName() + " has advertised neither :writable-running " + "nor :candidate capability. Failed to establish session, as at least one of these must be " + "advertised.");
}
}
Aggregations