use of org.opendaylight.yangtools.rfc8528.data.util.EmptyMountPointContext in project netconf by opendaylight.
the class NetconfNestedNotificationTest method testNestedNotificationToNotificationFunction.
@Test
public void testNestedNotificationToNotificationFunction() throws Exception {
final EffectiveModelContext schemaContext = getNotificationSchemaContext(Collections.singleton("/schemas/nested-notification.yang"));
final NetconfMessage notificationMessage = prepareNotification("/nested-notification-payload.xml");
NetconfMessageTransformer messageTransformer = new NetconfMessageTransformer(new EmptyMountPointContext(schemaContext), true, BASE_SCHEMAS.getBaseSchema());
final DOMNotification domNotification = messageTransformer.toNotification(notificationMessage);
final ContainerNode root = domNotification.getBody();
assertNotNull(root);
assertEquals(1, root.body().size());
assertEquals("interface-enabled", root.getIdentifier().getNodeType().getLocalName());
assertEquals(NetconfNotification.RFC3339_DATE_PARSER.apply("2008-07-08T00:01:00Z").toInstant(), ((DOMEvent) domNotification).getEventInstant());
assertEquals(Absolute.of(INTERFACES_QNAME, INTERFACE_QNAME, INTERFACE_ENABLED_NOTIFICATION_QNAME), domNotification.getType());
}
use of org.opendaylight.yangtools.rfc8528.data.util.EmptyMountPointContext in project netconf by opendaylight.
the class NetconfToNotificationTest method testToNotificationFunction.
@Test
public void testToNotificationFunction() throws Exception {
final EffectiveModelContext schemaContext = getNotificationSchemaContext(getClass(), false);
messageTransformer = new NetconfMessageTransformer(new EmptyMountPointContext(schemaContext), true, BASE_SCHEMAS.getBaseSchema());
final DOMNotification domNotification = messageTransformer.toNotification(userNotification);
final ContainerNode root = domNotification.getBody();
assertNotNull(root);
assertEquals(6, root.body().size());
assertEquals("user-visited-page", root.getIdentifier().getNodeType().getLocalName());
assertEquals(NetconfNotification.RFC3339_DATE_PARSER.apply("2015-10-23T09:42:27.67175+00:00").toInstant(), ((DOMEvent) domNotification).getEventInstant());
}
use of org.opendaylight.yangtools.rfc8528.data.util.EmptyMountPointContext in project netconf by opendaylight.
the class NetconfDeviceRpcTest method setUp.
@Before
public void setUp() throws Exception {
NetconfMessageTransformer transformer = new NetconfMessageTransformer(new EmptyMountPointContext(SCHEMA_CONTEXT), true, BASE_SCHEMAS.getBaseSchema());
final NetconfMessage reply = new NetconfMessage(XmlUtil.readXmlToDocument("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" + "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"101\">\n" + "<data>\n" + "</data>\n" + "</rpc-reply>"));
RpcResult<NetconfMessage> result = RpcResultBuilder.success(reply).build();
doReturn(Futures.immediateFuture(result)).when(communicator).sendRequest(any(NetconfMessage.class), any(QName.class));
rpc = new NetconfDeviceRpc(SCHEMA_CONTEXT, communicator, transformer);
type = QName.create("urn:ietf:params:xml:ns:netconf:base:1.0", "2011-06-01", "get-config");
expectedReply = transformer.toRpcResult(reply, type);
}
use of org.opendaylight.yangtools.rfc8528.data.util.EmptyMountPointContext in project netconf by opendaylight.
the class NetconfDeviceSalFacadeTest method testOnDeviceConnected.
@Test
public void testOnDeviceConnected() {
final EffectiveModelContext schemaContext = mock(EffectiveModelContext.class);
final NetconfSessionPreferences netconfSessionPreferences = NetconfSessionPreferences.fromStrings(getCapabilities());
final DOMRpcService deviceRpc = mock(DOMRpcService.class);
deviceFacade.onDeviceConnected(new EmptyMountPointContext(schemaContext), netconfSessionPreferences, deviceRpc, null);
verify(mountInstance, times(1)).onTopologyDeviceConnected(eq(schemaContext), any(DOMDataBroker.class), any(NetconfDataTreeService.class), eq(deviceRpc), any(NetconfDeviceNotificationService.class), isNull());
verify(netconfDeviceTopologyAdapter, times(1)).updateDeviceData(true, netconfSessionPreferences.getNetconfDeviceCapabilities());
}
use of org.opendaylight.yangtools.rfc8528.data.util.EmptyMountPointContext in project netconf by opendaylight.
the class NetconfDataTreeServiceImplTest method setUp.
@Before
public void setUp() {
doReturn(FluentFutures.immediateFluentFuture(new DefaultDOMRpcResult())).when(rpcService).invokeRpc(any(), any());
netconService = getNetconService();
final EffectiveModelContext model = BindingRuntimeHelpers.createEffectiveModel(IetfNetconfService.class, NetconfState.class);
netconfMessageTransformer = new NetconfMessageTransformer(new EmptyMountPointContext(model), true, BASE_SCHEMAS.getBaseSchema());
}
Aggregations