nchan stream tests
This commit is contained in:
parent
f2810e849f
commit
09e2e767fe
2 changed files with 7 additions and 23 deletions
|
|
@ -847,12 +847,14 @@ url_post(char *url,
|
|||
/*! Stream callback for example stream notification
|
||||
* Push via curl_post to publish stream event
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] op Operation: 0 OK, 1 Close
|
||||
* @param[in] event Event as XML
|
||||
* @param[in] arg Extra argument provided in stream_ss_add
|
||||
* @see stream_ss_add
|
||||
*/
|
||||
static int
|
||||
stream_publish_cb(clicon_handle h,
|
||||
int op,
|
||||
cxobj *event,
|
||||
void *arg)
|
||||
{
|
||||
|
|
@ -864,7 +866,8 @@ stream_publish_cb(clicon_handle h,
|
|||
char *stream = (char*)arg;
|
||||
|
||||
clicon_debug(1, "%s", __FUNCTION__);
|
||||
|
||||
if (op != 0)
|
||||
goto ok;
|
||||
/* Create pub url */
|
||||
if ((u = cbuf_new()) == NULL){
|
||||
clicon_err(OE_XML, errno, "cbuf_new");
|
||||
|
|
@ -874,7 +877,6 @@ stream_publish_cb(clicon_handle h,
|
|||
clicon_err(OE_CFG, ENOENT, "CLICON_STREAM_PUB not defined");
|
||||
goto done;
|
||||
}
|
||||
|
||||
cprintf(u, "%s/%s", pub_prefix, stream);
|
||||
/* Create XML data as string */
|
||||
if ((d = cbuf_new()) == NULL){
|
||||
|
|
@ -889,6 +891,7 @@ stream_publish_cb(clicon_handle h,
|
|||
goto done;
|
||||
if (result)
|
||||
clicon_debug(1, "%s: %s", __FUNCTION__, result);
|
||||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
if (u)
|
||||
|
|
@ -910,7 +913,7 @@ stream_publish(clicon_handle h,
|
|||
#ifdef CLIXON_PUBLISH_STREAMS
|
||||
int retval = -1;
|
||||
|
||||
if (stream_ss_add(h, stream, NULL, stream_publish_cb, (void*)stream) < 0)
|
||||
if (stream_ss_add(h, stream, NULL, NULL, NULL, stream_publish_cb, (void*)stream) < 0)
|
||||
goto done;
|
||||
retval = 0;
|
||||
done:
|
||||
|
|
|
|||
|
|
@ -275,26 +275,7 @@ rm -rf $dir
|
|||
exit # DONT REMOVE MANUAL TESTING
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Need manual testing
|
||||
new "restconf monitor streams native NEEDS manual testing"
|
||||
if false; then
|
||||
# url -H "Accept: text/event-stream" http://localhost/streams/EXAMPLE
|
||||
# Expect:
|
||||
# data: <notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"><eventTime>2018-10-21T19:22:11.381827</eventTime><event><event-class>fault</event-class><reportingEntity><card>Ethernet0</card></reportingEntity><severity>major</severity></event></notification>
|
||||
#
|
||||
# data: <notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"><eventTime>2018-10-21T19:22:16.387228</eventTime><event><event-class>fault</event-class><reportingEntity><card>Ethernet0</card></reportingEntity><severity>major</severity></event></notification>
|
||||
|
||||
new "restconf monitor event ok stream"
|
||||
expectwait 'curl -s -X GET -H "Accept: text/event-stream" -H "Cache-Control: no-cache" -H "Connection: keep-alive" http://localhost/streams/EXAMPLE' 0 'foo' 5
|
||||
|
||||
new "restconf monitor event starttime"
|
||||
NOW=$(date +"%Y-%m-%dT%H%%3A%M%%3A%S")
|
||||
sleep 10
|
||||
expectwait "curl -s -X GET -H \"Accept: text/event-stream\" -H \"Cache-Control: no-cache\" -H \"Connection: keep-alive\" http://localhost/streams/EXAMPLE?start-time=$NOW" 0 'foo' 2
|
||||
fi
|
||||
|
||||
# Restconf stream subscription RFC8040 Sec 6.3 - Nginx nchan solution
|
||||
# Need manual testing
|
||||
# NCHAN Need manual testing
|
||||
new "restconf monitor streams nchan NEEDS manual testing"
|
||||
if false; then
|
||||
# url -H "Accept: text/event-stream" http://localhost/streams/EXAMPLE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue