... | ... | @@ -22,19 +22,14 @@ All jetconf-specific extensions are implemented as an internal operations inside |
|
|
The main enhancement of the Jetconf server to the standard RESTCONF protocol is the support for transactions. This means that any user can start editing the datastore content and then commit his changes at once, atomically. The use of transactions is obligatorily required by Jetconf. The user must begin a new transaction before editing the data with POST, PUT or DELETE HTTP requests. However, reading data with GET method can be done directly without the need of starting a transaction.
|
|
|
|
|
|
#### Starting a new transaction
|
|
|
A new transaction is opened by calling a Jetconf internal operation `conf-start`.
|
|
|
A new transaction is opened by calling a Jetconf internal operation `conf-start`. Only one transaction for every user can be opened at a time. If user attempts to call `conf-start` when his transaction is already opened, Jetconf server will respond with `HTTP 500` error code.
|
|
|
|
|
|
Operation name: `conf-start`
|
|
|
Input parameters: `name: "any_transaction_name"`
|
|
|
Input parameters: (none)
|
|
|
|
|
|
Example:
|
|
|
```
|
|
|
POST https://server:port/restconf/operations/jetconf:conf-start
|
|
|
{
|
|
|
"jetconf:input": {
|
|
|
"name": "Transaction 1"
|
|
|
}
|
|
|
}
|
|
|
|
|
|
response:
|
|
|
{
|
... | ... | @@ -42,40 +37,25 @@ response: |
|
|
}
|
|
|
```
|
|
|
|
|
|
#### Listing active transactions
|
|
|
The opened transactions with complete edit log can be previewed by calling a Jetconf internal operation `conf-list`.
|
|
|
#### Checking for opened transactions
|
|
|
The internal operation `conf-status` can be used to determine if there is already a pending Jetconf transaction for particular user. This RPC will return a JSON object containing "transaction-opened" member with a matching boolean value (true/false).
|
|
|
|
|
|
Operation name: `conf-list`
|
|
|
Operation name: `conf-status`
|
|
|
Input parameters: (none)
|
|
|
|
|
|
Example:
|
|
|
```
|
|
|
POST https://server:port/restconf/operations/jetconf:conf-list
|
|
|
POST https://server:port/restconf/operations/jetconf:conf-status
|
|
|
|
|
|
response:
|
|
|
{
|
|
|
"changelists": {
|
|
|
"Transaction 1": [
|
|
|
[
|
|
|
"CREATE",
|
|
|
"/dns-zones:zone-data"
|
|
|
],
|
|
|
[
|
|
|
"CREATE",
|
|
|
"/dns-zones:zone-data/zone=newzone.cz,IN"
|
|
|
],
|
|
|
[
|
|
|
"CREATE",
|
|
|
"/dns-zones:zone-data/zone=newzone.cz,IN/rrset=sub,iana-dns-parameters:A"
|
|
|
]
|
|
|
]
|
|
|
},
|
|
|
"status": "OK"
|
|
|
"status": "OK",
|
|
|
"transaction-opened": true
|
|
|
}
|
|
|
```
|
|
|
|
|
|
#### Aborting a transaction
|
|
|
The opened transaction can be aborted without committing by calling a Jetconf internal operation `conf-drop`.
|
|
|
Any opened Jetconf transaction can be aborted without committing to datastore and backend application. This can be done by calling a `conf-drop` internal operation. If user calls `conf-drop` with no transaction opened, Jetconf server will respond with `HTTP 500` error code (use `conf-status` to check for transaction status).
|
|
|
|
|
|
Operation name: `conf-drop`
|
|
|
Input parameters: (none)
|
... | ... | @@ -91,7 +71,7 @@ response: |
|
|
```
|
|
|
|
|
|
#### Committing a transaction
|
|
|
The opened transaction can be committed to datastore by calling a Jetconf internal operation `conf-commit`.
|
|
|
The opened transaction can be committed to datastore and backend application by calling a `conf-commit` internal operation.
|
|
|
|
|
|
Operation name: `conf-commit`
|
|
|
Input parameters: (none)
|
... | ... | @@ -121,3 +101,26 @@ POST https://server:port/restconf/operations/jetconf:get-schema-digest |
|
|
response:
|
|
|
{ ... schema_digest_in_json ... }
|
|
|
```
|
|
|
|
|
|
### YANG `list` and `leaf-list` node length:
|
|
|
Jetconf also enables the user to retrieve the length of any `list` or `leaf-list` node using the `get-list-length` internal operation. This RPC returns a JSON object containing the "jetconf:list-length" member with result value (integer).
|
|
|
|
|
|
Note: User must have read access permissions to the target data node.
|
|
|
|
|
|
Operation name: `get-list-length`
|
|
|
Input parameters: "url": "url_to_data_node"
|
|
|
|
|
|
Example:
|
|
|
```
|
|
|
POST https://server:port/restconf/operations/jetconf:get-list-length
|
|
|
{
|
|
|
"jetconf:input": {
|
|
|
"url": "https://server:port/restconf/data/ns:some_list_node"
|
|
|
}
|
|
|
}
|
|
|
|
|
|
response:
|
|
|
{
|
|
|
"jetconf:list-length": 123
|
|
|
}
|
|
|
``` |