Added configure option CLICON_STREAM_RETENTION is default number of seconds before dropping replay buffers
restconf start-time and stop-time query parameters stream_register->stream_add
This commit is contained in:
parent
f23a21d5db
commit
208ccd82a8
11 changed files with 179 additions and 121 deletions
|
|
@ -41,7 +41,7 @@ Send netconf command:
|
|||
```
|
||||
Start clixon restconf daemon
|
||||
```
|
||||
> sudo su -c "/www-data/clixon_restconf -f /usr/local/etc/example.xml " -s /bin/sh www-data
|
||||
sudo su -c "/www-data/clixon_restconf -f /usr/local/etc/example.xml " -s /bin/sh www-data
|
||||
```
|
||||
Send restconf command
|
||||
```
|
||||
|
|
@ -81,7 +81,7 @@ Send restconf command
|
|||
The example has an EXAMPLE stream notification triggering every 5s. To start a notification
|
||||
stream in the session using netconf, create a subscription:
|
||||
```
|
||||
<rpc><create-subscription><stream>ROUTING</stream></create-subscription></rpc>]]>]]>
|
||||
<rpc><create-subscription><stream>EXAMPLE</stream></create-subscription></rpc>]]>]]>
|
||||
<rpc-reply><ok/></rpc-reply>]]>]]>
|
||||
<notification><event>Routing notification</event></notification>]]>]]>
|
||||
<notification><event>Routing notification</event></notification>]]>]]>
|
||||
|
|
|
|||
|
|
@ -294,14 +294,18 @@ static clixon_plugin_api api = {
|
|||
clixon_plugin_api *
|
||||
clixon_plugin_init(clicon_handle h)
|
||||
{
|
||||
clicon_debug(1, "%s backend", __FUNCTION__);
|
||||
struct timeval retention = {0,0};
|
||||
|
||||
clicon_debug(1, "%s backend", __FUNCTION__);
|
||||
/* Example stream initialization:
|
||||
* 1) Register EXAMPLE stream
|
||||
* 2) setup timer for notifications, so something happens on stream
|
||||
* 3) setup stream callbacks for notification to push channel
|
||||
*/
|
||||
if (stream_register(h, "EXAMPLE", "Example event stream", 1) < 0)
|
||||
if (clicon_option_exists(h, "CLICON_STREAM_RETENTION"))
|
||||
retention.tv_sec = clicon_option_int(h, "CLICON_STREAM_RETENTION");
|
||||
if (stream_add(h, "EXAMPLE", "Example event stream", 1,
|
||||
retention.tv_sec?&retention:NULL) < 0)
|
||||
goto done;
|
||||
/* assumes: CLIXON_PUBLISH_STREAMS, eg configure --enable-publish
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ load("Load configuration from XML file") <filename:string>("Filename (local file
|
|||
}
|
||||
example("This is a comment") <var:int32>("Just a random number"), mycallback("myarg");
|
||||
rpc("ex:fib-route rpc") <instance:string>("routing instance"), fib_route_rpc("myarg");
|
||||
notify("Get notifications from backend"), cli_notify("NETCONF", "1", "text");
|
||||
no("Negate") notify("Get notifications from backend"), cli_notify("NETCONF", "0", "xml");
|
||||
notify("Get notifications from backend"), cli_notify("EXAMPLE", "1", "text");
|
||||
no("Negate") notify("Get notifications from backend"), cli_notify("EXAMPLE", "0", "xml");
|
||||
lock,cli_lock("candidate");
|
||||
unlock,cli_unlock("candidate");
|
||||
Loading…
Add table
Add a link
Reference in a new issue