use of org.opendaylight.netconf.sal.connect.util.RemoteDeviceId in project netconf by opendaylight.
the class SchemalessNetconfDeviceRpcTest method setUp.
@Before
public void setUp() throws Exception {
RpcResult<NetconfMessage> msg = null;
ListenableFuture<RpcResult<NetconfMessage>> future = Futures.immediateFuture(msg);
doReturn(future).when(listener).sendRequest(any(), any());
final MessageCounter counter = new MessageCounter();
deviceRpc = new SchemalessNetconfDeviceRpc(new RemoteDeviceId("device1", InetSocketAddress.createUnresolved("0.0.0.0", 17830)), listener, new BaseRpcSchemalessTransformer(BASE_SCHEMAS, counter), new SchemalessMessageTransformer(counter));
}
use of org.opendaylight.netconf.sal.connect.util.RemoteDeviceId in project netconf by opendaylight.
the class ReadOnlyTxTest method testExists.
@Test
public void testExists() 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.exists(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.empty());
verify(rpc).invokeRpc(Mockito.eq(NetconfMessageTransformUtil.NETCONF_GET_CONFIG_QNAME), any(ContainerNode.class));
readOnlyTx.exists(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.empty());
verify(rpc).invokeRpc(Mockito.eq(NetconfMessageTransformUtil.NETCONF_GET_QNAME), any(ContainerNode.class));
}
use of org.opendaylight.netconf.sal.connect.util.RemoteDeviceId in project netconf by opendaylight.
the class ReadOnlyTxTest method testIdentifier.
@Test
public void testIdentifier() throws Exception {
final NetconfBaseOps netconfOps = new NetconfBaseOps(rpc, mock(MountPointContext.class));
final ReadOnlyTx tx1 = new ReadOnlyTx(netconfOps, new RemoteDeviceId("a", new InetSocketAddress("localhost", 196)));
final ReadOnlyTx tx2 = new ReadOnlyTx(netconfOps, new RemoteDeviceId("a", new InetSocketAddress("localhost", 196)));
Assert.assertNotEquals(tx1.getIdentifier(), tx2.getIdentifier());
}
use of org.opendaylight.netconf.sal.connect.util.RemoteDeviceId 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.util.RemoteDeviceId in project netconf by opendaylight.
the class YangLibrarySchemaYangSourceProviderTest method testGetSourceFailure.
@Test
public void testGetSourceFailure() throws InterruptedException, MalformedURLException {
final URL url = new URL("http://non-existing-entity.yang");
final Map<SourceIdentifier, URL> sourceIdentifierURLMap = Collections.singletonMap(workingSid, url);
final RemoteDeviceId id = new RemoteDeviceId("id", new InetSocketAddress("localhost", 22));
final YangLibrarySchemaYangSourceProvider failingYangLibrarySchemaYangSourceProvider = new YangLibrarySchemaYangSourceProvider(id, sourceIdentifierURLMap);
final ListenableFuture<?> future = failingYangLibrarySchemaYangSourceProvider.getSource(workingSid);
final ExecutionException ex = assertThrows(ExecutionException.class, () -> future.get());
assertThat(ex.getCause(), instanceOf(SchemaSourceException.class));
}
Aggregations