manipulate YANG modeled data and invoke YANG modeled RPCs, using XML
or JSON as payload format.
+.. _mdsal_dev_guide:
+
MD-SAL Overview
---------------
.. code:: java
- Futures.addCallback( writeTx.submit(), new FutureCallback<Void>() {
- public void onSuccess( Void result ) {
+ Futures.addCallback( writeTx.submit(), new FutureCallback<Void>() {
+ public void onSuccess( Void result ) {
LOG.debug("Transaction committed successfully.");
}
- public void onFailure( Throwable t ) {
+ public void onFailure( Throwable t ) {
LOG.error("Commit failed.",e);
}
});
.. code:: java
try {
- writeTx.submit().checkedGet();
- } catch (TransactionCommitFailedException e) {
+ writeTx.submit().checkedGet();
+ } catch (TransactionCommitFailedException e) {
LOG.error("Commit failed.",e);
}
.. code:: java
- ReadWriteTransaction rwTx = broker.newReadWriteTransaction();
+ ReadWriteTransaction rwTx = broker.newReadWriteTransaction();
- rwRx.read(OPERATIONAL,PATH).get();
- rwRx.put(OPERATIONAL,PATH,B);
- rwRx.read(OPERATIONAL,PATH).get();
- rwRx.put(OPERATIONAL,PATH,C);
- rwRx.read(OPERATIONAL,PATH).get();
+ rwRx.read(OPERATIONAL,PATH).get();
+ rwRx.put(OPERATIONAL,PATH,B);
+ rwRx.read(OPERATIONAL,PATH).get();
+ rwRx.put(OPERATIONAL,PATH,C);
+ rwRx.read(OPERATIONAL,PATH).get();
- Allocates new ``ReadWriteTransaction``.
.. code:: java
- ReadOnlyTransaction txRead = broker.newReadOnlyTransaction();
- ReadWriteTransaction txWrite = broker.newReadWriteTransaction();
+ ReadOnlyTransaction txRead = broker.newReadOnlyTransaction();
+ ReadWriteTransaction txWrite = broker.newReadWriteTransaction();
- txRead.read(OPERATIONAL,PATH).get();
- txWrite.put(OPERATIONAL,PATH,B);
- txWrite.read(OPERATIONAL,PATH).get();
- txWrite.submit().get();
- txRead.read(OPERATIONAL,PATH).get();
- txAfterCommit = broker.newReadOnlyTransaction();
- txAfterCommit.read(OPERATIONAL,PATH).get();
+ txRead.read(OPERATIONAL,PATH).get();
+ txWrite.put(OPERATIONAL,PATH,B);
+ txWrite.read(OPERATIONAL,PATH).get();
+ txWrite.submit().get();
+ txRead.read(OPERATIONAL,PATH).get();
+ txAfterCommit = broker.newReadOnlyTransaction();
+ txAfterCommit.read(OPERATIONAL,PATH).get();
- Allocates read only transaction, which is based on data tree which
contains value ``A`` for ``PATH``.
WriteTransaction txA = broker.newWriteTransaction();
WriteTransaction txB = broker.newWriteTransaction();
- txA.put(CONFIGURATION, PATH, A);
- txB.put(CONFIGURATION, PATH, B);
+ txA.put(CONFIGURATION, PATH, A);
+ txB.put(CONFIGURATION, PATH, B);
- CheckedFuture<?,?> futureA = txA.submit();
- CheckedFuture<?,?> futureB = txB.submit();
+ CheckedFuture<?,?> futureA = txA.submit();
+ CheckedFuture<?,?> futureB = txB.submit();
- Updates ``PATH`` to value ``A`` using ``txA``
{
"output": {
- "stream-name": "toaster:toaster/toaster:toasterStatus/datastore=CONFIGURATION/scope=SUBTREE"
+ "stream-name": "data-change-event-subscription/toaster:toaster/toaster:toasterStatus/datastore=CONFIGURATION/scope=SUBTREE"
}
}
previous step.
- URI:
- http://{odlAddress}:{odlPort}/restconf/streams/stream/toaster:toaster/datastore=CONFIGURATION/scope=SUBTREE
+ http://{odlAddress}:{odlPort}/restconf/streams/stream/data-change-event-subscription/toaster:toaster/datastore=CONFIGURATION/scope=SUBTREE
- OPERATION: GET
+The subscription call may be modified with the following query parameters defined in the RESTCONF RFC:
+
+- `filter <https://tools.ietf.org/html/draft-ietf-netconf-restconf-05#section-4.8.6>`__
+
+- `start-time <https://tools.ietf.org/html/draft-ietf-netconf-restconf-05#section-4.8.7>`__
+
+- `end-time <https://tools.ietf.org/html/draft-ietf-netconf-restconf-05#section-4.8.8>`__
+
+In addition, the following ODL extension query parameter is supported:
+
+:odl-leaf-nodes-only:
+ If this parameter is set to "true", create and update notifications will only
+ contain the leaf nodes modified instead of the entire subscription subtree.
+ This can help in reducing the size of the notifications.
+
The expected response status is 200 OK and response body should be
empty. You will get your WebSocket location from **Location** header of
response. For example in our particular toaster example location header