Search in sources :

Example 6 with EmptyMountPointContext

use of org.opendaylight.yangtools.rfc8528.data.util.EmptyMountPointContext in project netconf by opendaylight.

the class NetconfDeviceDataBrokerTest method getDataBroker.

private NetconfDeviceDataBroker getDataBroker(final String... caps) {
    NetconfSessionPreferences prefs = NetconfSessionPreferences.fromStrings(Arrays.asList(caps));
    final RemoteDeviceId id = new RemoteDeviceId("device-1", InetSocketAddress.createUnresolved("localhost", 17830));
    return new NetconfDeviceDataBroker(id, new EmptyMountPointContext(SCHEMA_CONTEXT), rpcService, prefs);
}
Also used : RemoteDeviceId(org.opendaylight.netconf.sal.connect.util.RemoteDeviceId) EmptyMountPointContext(org.opendaylight.yangtools.rfc8528.data.util.EmptyMountPointContext) NetconfSessionPreferences(org.opendaylight.netconf.sal.connect.netconf.listener.NetconfSessionPreferences)

Example 7 with EmptyMountPointContext

use of org.opendaylight.yangtools.rfc8528.data.util.EmptyMountPointContext in project netconf by opendaylight.

the class NetconfMessageTransformerTest method testCreateSubscriberNotificationSchemaNotPresent.

@Test
public void testCreateSubscriberNotificationSchemaNotPresent() throws Exception {
    final NetconfMessageTransformer transformer = new NetconfMessageTransformer(new EmptyMountPointContext(SCHEMA), true, BASE_SCHEMAS.getBaseSchemaWithNotifications());
    NetconfMessage netconfMessage = transformer.toRpcRequest(CREATE_SUBSCRIPTION_RPC_QNAME, CREATE_SUBSCRIPTION_RPC_CONTENT);
    String documentString = XmlUtil.toString(netconfMessage.getDocument());
    assertThat(documentString, CoreMatchers.containsString("<create-subscription"));
    assertThat(documentString, CoreMatchers.containsString("<rpc"));
}
Also used : EmptyMountPointContext(org.opendaylight.yangtools.rfc8528.data.util.EmptyMountPointContext) NetconfMessage(org.opendaylight.netconf.api.NetconfMessage) AbstractBaseSchemasTest(org.opendaylight.netconf.sal.connect.netconf.AbstractBaseSchemasTest) Test(org.junit.Test)

Example 8 with EmptyMountPointContext

use of org.opendaylight.yangtools.rfc8528.data.util.EmptyMountPointContext in project netconf by opendaylight.

the class NetconfToNotificationTest method testMostRecentWrongYangModel.

@Test
public void testMostRecentWrongYangModel() throws Exception {
    final EffectiveModelContext schemaContext = getNotificationSchemaContext(getClass(), true);
    messageTransformer = new NetconfMessageTransformer(new EmptyMountPointContext(schemaContext), true, BASE_SCHEMAS.getBaseSchema());
    assertThrows(IllegalArgumentException.class, () -> messageTransformer.toNotification(userNotification));
}
Also used : EmptyMountPointContext(org.opendaylight.yangtools.rfc8528.data.util.EmptyMountPointContext) NetconfMessageTransformer(org.opendaylight.netconf.sal.connect.netconf.schema.mapping.NetconfMessageTransformer) EffectiveModelContext(org.opendaylight.yangtools.yang.model.api.EffectiveModelContext) Test(org.junit.Test)

Example 9 with EmptyMountPointContext

use of org.opendaylight.yangtools.rfc8528.data.util.EmptyMountPointContext in project netconf by opendaylight.

the class NetconfDataTreeServiceImplTest method getNetconService.

private AbstractNetconfDataTreeService getNetconService() {
    NetconfSessionPreferences prefs = NetconfSessionPreferences.fromStrings(Collections.singletonList(NetconfMessageTransformUtil.NETCONF_CANDIDATE_URI.toString()));
    final RemoteDeviceId id = new RemoteDeviceId("device-1", InetSocketAddress.createUnresolved("localhost", 17830));
    return AbstractNetconfDataTreeService.of(id, new EmptyMountPointContext(SCHEMA_CONTEXT), rpcService, prefs);
}
Also used : RemoteDeviceId(org.opendaylight.netconf.sal.connect.util.RemoteDeviceId) EmptyMountPointContext(org.opendaylight.yangtools.rfc8528.data.util.EmptyMountPointContext) NetconfSessionPreferences(org.opendaylight.netconf.sal.connect.netconf.listener.NetconfSessionPreferences)

Example 10 with EmptyMountPointContext

use of org.opendaylight.yangtools.rfc8528.data.util.EmptyMountPointContext in project yangtools by opendaylight.

the class AbstractMountPointChild method normalizeTo.

@Override
public final NormalizedNode normalizeTo(final EffectiveModelContext schemaContext) throws IOException {
    final NormalizedNodeResult result = new NormalizedNodeResult();
    final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result);
    writeTo(streamWriter, new EmptyMountPointContext(schemaContext));
    return result.getResult();
}
Also used : EmptyMountPointContext(org.opendaylight.yangtools.rfc8528.data.util.EmptyMountPointContext) NormalizedNodeStreamWriter(org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter)

Aggregations

EmptyMountPointContext (org.opendaylight.yangtools.rfc8528.data.util.EmptyMountPointContext)17 NetconfMessageTransformer (org.opendaylight.netconf.sal.connect.netconf.schema.mapping.NetconfMessageTransformer)7 EffectiveModelContext (org.opendaylight.yangtools.yang.model.api.EffectiveModelContext)7 Before (org.junit.Before)6 RemoteDeviceId (org.opendaylight.netconf.sal.connect.util.RemoteDeviceId)6 Test (org.junit.Test)5 DefaultDOMRpcResult (org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult)4 NetconfMessage (org.opendaylight.netconf.api.NetconfMessage)4 ContainerNode (org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)4 NetconfSessionPreferences (org.opendaylight.netconf.sal.connect.netconf.listener.NetconfSessionPreferences)3 NetconfBaseOps (org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps)3 DOMNotification (org.opendaylight.mdsal.dom.api.DOMNotification)2 DOMRpcService (org.opendaylight.mdsal.dom.api.DOMRpcService)2 NetconfDeviceRpc (org.opendaylight.netconf.sal.connect.netconf.sal.NetconfDeviceRpc)2 MountPointContext (org.opendaylight.yangtools.rfc8528.data.api.MountPointContext)2 QName (org.opendaylight.yangtools.yang.common.QName)2 Beta (com.google.common.annotations.Beta)1 ToStringHelper (com.google.common.base.MoreObjects.ToStringHelper)1 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)1 ImmutableSet (com.google.common.collect.ImmutableSet)1