use of org.opendaylight.netconf.api.NetconfMessage in project netconf by opendaylight.
the class NetconfDataTreeServiceImplTest method merge.
@Test
public void merge() {
netconService.merge(LogicalDatastoreType.CONFIGURATION, TxTestUtils.getLeafId(), TxTestUtils.getLeafNode(), Optional.empty());
verify(rpcService).invokeRpc(eq(NetconfMessageTransformUtil.NETCONF_EDIT_CONFIG_QNAME), captor.capture());
final NetconfMessage netconfMessage = netconfMessageTransformer.toRpcRequest(NetconfMessageTransformUtil.NETCONF_EDIT_CONFIG_QNAME, captor.getValue());
Assert.assertTrue(netconfMessage.toString().contains("operation=\"merge\""));
}
use of org.opendaylight.netconf.api.NetconfMessage in project netconf by opendaylight.
the class NetconfDataTreeServiceImplTest method replace.
@Test
public void replace() {
netconService.replace(LogicalDatastoreType.CONFIGURATION, TxTestUtils.getLeafId(), TxTestUtils.getLeafNode(), Optional.empty());
verify(rpcService).invokeRpc(eq(NetconfMessageTransformUtil.NETCONF_EDIT_CONFIG_QNAME), captor.capture());
final NetconfMessage netconfMessage = netconfMessageTransformer.toRpcRequest(NetconfMessageTransformUtil.NETCONF_EDIT_CONFIG_QNAME, captor.getValue());
Assert.assertTrue(netconfMessage.toString().contains("operation=\"replace\""));
}
use of org.opendaylight.netconf.api.NetconfMessage in project netconf by opendaylight.
the class NetconfDataTreeServiceImplTest method delete.
@Test
public void delete() {
netconService.delete(LogicalDatastoreType.CONFIGURATION, TxTestUtils.getLeafId().getParent());
verify(rpcService).invokeRpc(eq(NetconfMessageTransformUtil.NETCONF_EDIT_CONFIG_QNAME), captor.capture());
final NetconfMessage netconfMessage = netconfMessageTransformer.toRpcRequest(NetconfMessageTransformUtil.NETCONF_EDIT_CONFIG_QNAME, captor.getValue());
Assert.assertTrue(netconfMessage.toString().contains("operation=\"delete\""));
}
use of org.opendaylight.netconf.api.NetconfMessage in project netconf by opendaylight.
the class NetconfDataTreeServiceImplTest method create.
@Test
public void create() {
netconService.create(LogicalDatastoreType.CONFIGURATION, TxTestUtils.getLeafId(), TxTestUtils.getLeafNode(), Optional.empty());
verify(rpcService).invokeRpc(eq(NetconfMessageTransformUtil.NETCONF_EDIT_CONFIG_QNAME), captor.capture());
final NetconfMessage netconfMessage = netconfMessageTransformer.toRpcRequest(NetconfMessageTransformUtil.NETCONF_EDIT_CONFIG_QNAME, captor.getValue());
Assert.assertTrue(netconfMessage.toString().contains("operation=\"create\""));
}
use of org.opendaylight.netconf.api.NetconfMessage in project lighty-netconf-simulator by PANTHEONtech.
the class ToasterDeviceTest method toasterNotificationTest.
@Test
public void toasterNotificationTest() throws ExecutionException, InterruptedException, URISyntaxException, SAXException, TimeoutException, IOException {
final CountDownLatch notificationReceivedLatch = new CountDownLatch(1);
final NotificationNetconfSessionListener sessionListenerNotification = new NotificationNetconfSessionListener(notificationReceivedLatch);
final SimpleNetconfClientSessionListener sessionListenerSimple = new SimpleNetconfClientSessionListener();
try (NetconfClientSession sessionNotification = dispatcher.createClient(createSHHConfig(sessionListenerNotification)).get(TimeoutUtil.TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
NetconfClientSession sessionSimple = dispatcher.createClient(createSHHConfig(sessionListenerSimple)).get(TimeoutUtil.TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)) {
final NetconfMessage subscribeResponse = sentRequestToDevice(SUBSCRIBE_TO_NOTIFICATIONS_REQUEST_XML, sessionListenerNotification);
assertTrue(containsOkElement(subscribeResponse));
final NetconfMessage restockToastResponse = sentRequestToDevice(RESTOCK_TOAST_REQUEST_XML, sessionListenerSimple);
assertTrue(containsOkElement(restockToastResponse));
final boolean await = notificationReceivedLatch.await(REQUEST_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
assertTrue(await);
NetconfMessage restockToastNotification = sessionListenerNotification.getReceivedNotificationMessage();
assertNotNull(restockToastNotification);
assertTrue(containsNotificationElement(restockToastNotification));
final String amountOfBreadExpected = XmlUtil.readXmlToDocument(xmlFileToInputStream(RESTOCK_TOAST_REQUEST_XML)).getElementsByTagName("amountOfBreadToStock").item(0).getTextContent();
final String amountOfBread = restockToastNotification.getDocument().getElementsByTagName("amountOfBread").item(0).getTextContent();
assertEquals(amountOfBreadExpected, amountOfBread);
}
}
Aggregations