Merge branch 'master' into develop
This commit is contained in:
commit
845bc875c2
27 changed files with 208 additions and 157 deletions
46
CHANGELOG.md
46
CHANGELOG.md
|
|
@ -1,6 +1,6 @@
|
||||||
# Clixon Changelog
|
# Clixon Changelog
|
||||||
|
|
||||||
## 3.8.0 (Expected: Nov 4)
|
## 3.8.0 (6 Nov 2018)
|
||||||
|
|
||||||
### Major New features
|
### Major New features
|
||||||
* YANG Features
|
* YANG Features
|
||||||
|
|
@ -20,22 +20,20 @@
|
||||||
* RFC 7895 defines a module-set-id. Configure option CLICON_MODULE_SET_ID is set and changed when modules change.
|
* RFC 7895 defines a module-set-id. Configure option CLICON_MODULE_SET_ID is set and changed when modules change.
|
||||||
* Yang 1.1 notification support (RFC 7950: Sec 7.16)
|
* Yang 1.1 notification support (RFC 7950: Sec 7.16)
|
||||||
* New event streams implementation with replay
|
* New event streams implementation with replay
|
||||||
* See clicon_stream.[ch] for details
|
* Generic stream support (both CLI, Netconf and Restconf)
|
||||||
* Added stream discovery according to RFC 5277 for netconf and RFC 8040 for restconf
|
* Added stream discovery according to RFC 5277 for netconf and RFC 8040 for restconf
|
||||||
* Enabled by CLICON_STREAM_DISCOVERY_RFC5277 and CLICON_STREAM_DISCOVERY_RFC8040
|
* Enabled by configure options CLICON_STREAM_DISCOVERY_RFC5277 and CLICON_STREAM_DISCOVERY_RFC8040
|
||||||
* Configure option CLICON_STREAM_RETENTION is default number of seconds before dropping replay buffers
|
* Configure option CLICON_STREAM_RETENTION is default number of seconds before dropping replay buffers
|
||||||
8040.
|
* See clicon_stream.[ch] for details
|
||||||
* Restconf stream notification support according to RFC8040
|
* Restconf stream notification support according to RFC8040
|
||||||
* See (apps/restconf/README.md) for more details.
|
* start-time and stop-time query parameters
|
||||||
* start-time and stop-time query parameters
|
|
||||||
* Fork fcgi handler for streams
|
* Fork fcgi handler for multiple concurrent streams
|
||||||
* Set access/subscribe base URL with: CLICON_STREAM_URL (default "https://localhost") and CLICON_STREAM_PATH (default "streams")
|
* Set access/subscribe base URL with: CLICON_STREAM_URL (default "https://localhost") and CLICON_STREAM_PATH (default "streams")
|
||||||
* Example: new stream "foo" will get access URL: https://localhost/streams/foo
|
* Replay support: start-time and stop-time query parameter support
|
||||||
* Alternative variant using pub/sub support enabled by ./configure --enable-publish
|
* See [apps/restconf/README.md] for more details.
|
||||||
|
* Alternative restconf streams using pub/sub enabled by ./configure --enable-publish
|
||||||
* Set publish URL base with: CLICON_STREAM_PUB (default http://localhost/pub)
|
* Set publish URL base with: CLICON_STREAM_PUB (default http://localhost/pub)
|
||||||
* Example: new stream "foo" will publish event streams on URL: https://localhost/pub/foo
|
|
||||||
* RFC8040 Restconf replay support: start-time and stop-time query parameter support
|
|
||||||
* This only applies to "native" restconf stream support, Nchan mode has different replay functionality
|
|
||||||
* RFC5277 Netconf replay supported
|
* RFC5277 Netconf replay supported
|
||||||
* Replay support is only in-memory and not persistent. External time-series DB could be added.
|
* Replay support is only in-memory and not persistent. External time-series DB could be added.
|
||||||
|
|
||||||
|
|
@ -53,12 +51,12 @@
|
||||||
* stream_cb_delete() --> stream_ss_delete()
|
* stream_cb_delete() --> stream_ss_delete()
|
||||||
* backend_notify() and backend_notify_xml() - use stream_notify() instead
|
* backend_notify() and backend_notify_xml() - use stream_notify() instead
|
||||||
* Example uses "NETCONF" stream instead of "ROUTING"
|
* Example uses "NETCONF" stream instead of "ROUTING"
|
||||||
* clixon_restconf and clixon_netconf changed to take -D `<level>` as command-line option instead of just -D (without debig level)
|
* clixon_restconf and clixon_netconf changed command-line option from -D to -D `<level>` aligning with cli and backend
|
||||||
* This aligns to clixon_cli and clixon_backend
|
|
||||||
* Application command option -S to clixon_netconf is obsolete. Use `clixon_netconf -l s` instead.
|
|
||||||
* Unified log handling for all clicon applications using command-line option: `-l e|o|s|f<file>`.
|
* Unified log handling for all clicon applications using command-line option: `-l e|o|s|f<file>`.
|
||||||
* The options stand for e:stderr, o:stdout, s: syslog, f:file
|
* The options stand for e:stderr, o:stdout, s: syslog, f:file
|
||||||
* Added file logging (`-l f` or `-l f<file>`) for cases where neither syslog nor stderr is useful.
|
* Added file logging (`-l f` or `-l f<file>`) for cases where neither syslog nor stderr is usefpul.
|
||||||
|
* clixon_netconf -S is obsolete. Use `clixon_netconf -l s` instead.
|
||||||
* Comply to RFC 8040 3.5.3.1 rule: api-identifier = [module-name ":"] identifier
|
* Comply to RFC 8040 3.5.3.1 rule: api-identifier = [module-name ":"] identifier
|
||||||
* The "module-name" was a no-op before.
|
* The "module-name" was a no-op before.
|
||||||
* This means that there was no difference between eg: GET /restconf/data/ietf-yang-library:modules-state and GET /restconf/data/foobar:modules-state
|
* This means that there was no difference between eg: GET /restconf/data/ietf-yang-library:modules-state and GET /restconf/data/foobar:modules-state
|
||||||
|
|
@ -88,20 +86,24 @@
|
||||||
* Single quotes for XML attributes https://github.com/clicon/clixon/issues/51
|
* Single quotes for XML attributes https://github.com/clicon/clixon/issues/51
|
||||||
* Thanks @SCadilhac
|
* Thanks @SCadilhac
|
||||||
* Fixed https://github.com/clicon/clixon/issues/46 Issue with empty values in leaf-list
|
* Fixed https://github.com/clicon/clixon/issues/46 Issue with empty values in leaf-list
|
||||||
* Thanks achernavin22
|
* Thanks @achernavin22
|
||||||
* Identity without any identityref:s caused SEGV
|
* Identity without any identityref:s caused SEGV
|
||||||
* Memory error in backend transaction revert
|
* Memory error in backend transaction revert
|
||||||
* Set dir /www-data with www-data as owner, see https://github.com/clicon/clixon/issues/37
|
* Set dir /www-data with www-data as owner, see https://github.com/clicon/clixon/issues/37
|
||||||
|
|
||||||
### Known issues
|
### Known issues
|
||||||
* Netconf RPC input is not sanity checked for wrong symbols (just ignored).
|
* Netconf/Restconf RPC extra input arguments are ignored
|
||||||
* Yang sub-command order and cardinality not checked.
|
* https://github.com/clicon/clixon/issues/47
|
||||||
|
* Yang sub-command cardinality not checked.
|
||||||
|
* https://github.com/clicon/clixon/issues/48
|
||||||
|
* Issue with bare axis names (XPath 1.0)
|
||||||
|
* https://github.com/clicon/clixon/issues/54
|
||||||
* Top-level Yang symbol cannot be called "config" in any imported yang file.
|
* Top-level Yang symbol cannot be called "config" in any imported yang file.
|
||||||
* datastore uses "config" as reserved keyword for storing any XML whoich collides with code for detecting Yang sanity.
|
* datastore uses "config" as reserved keyword for storing any XML whoich collides with code for detecting Yang sanity.
|
||||||
* Namespace name relabeling is not supported.
|
* Namespace name relabeling is not supported.
|
||||||
* Eg: if "des" is defined as prefix for an imported module, then a relabeling using xmlns is not supported, such as:
|
* Eg: if "des" is defined as prefix for an imported module, then a relabeling using xmlns is not supported, such as:
|
||||||
```
|
```
|
||||||
<crypto xmlns:x="urn:example:des">x:des3</crypto>
|
<crypto xmlns:x="urn:example:des">x:des3</crypto>
|
||||||
```
|
```
|
||||||
|
|
||||||
## 3.7.0 (22 July 2018)
|
## 3.7.0 (22 July 2018)
|
||||||
|
|
|
||||||
11
README.md
11
README.md
|
|
@ -41,6 +41,8 @@ Users of clixon currently include:
|
||||||
|
|
||||||
See also [Clicon project page](http://clicon.org).
|
See also [Clicon project page](http://clicon.org).
|
||||||
|
|
||||||
|
Clixon runs on Linux, [FreeBSD port](https://www.freshports.org/devel/clixon) and Mac/Apple. CPU architecures include x86_64, i686, ARM32.
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
============
|
============
|
||||||
A typical installation is as follows:
|
A typical installation is as follows:
|
||||||
|
|
@ -73,8 +75,6 @@ Clixon depends on the following software packages, which need to exist on the ta
|
||||||
- Lex/Flex
|
- Lex/Flex
|
||||||
- Fcgi (if restconf is enabled)
|
- Fcgi (if restconf is enabled)
|
||||||
|
|
||||||
There is no yum/apt/ostree package for Clixon (please help?)
|
|
||||||
|
|
||||||
Support
|
Support
|
||||||
=======
|
=======
|
||||||
Clixon interaction is best done posting issues, pull requests, or joining the
|
Clixon interaction is best done posting issues, pull requests, or joining the
|
||||||
|
|
@ -114,7 +114,11 @@ Clixon follows:
|
||||||
- [RFC 7895: YANG module library](http://www.rfc-base.org/txt/rfc-7895.txt)
|
- [RFC 7895: YANG module library](http://www.rfc-base.org/txt/rfc-7895.txt)
|
||||||
|
|
||||||
However, the following YANG syntax modules are not implemented:
|
However, the following YANG syntax modules are not implemented:
|
||||||
`deviation`, `min/max-elements`, `unique`, and `action`.
|
- deviation
|
||||||
|
- min/max-elements
|
||||||
|
- unique
|
||||||
|
- action
|
||||||
|
- belongs-to
|
||||||
|
|
||||||
Netconf
|
Netconf
|
||||||
=======
|
=======
|
||||||
|
|
@ -131,6 +135,7 @@ Clixon does not yet support the following netconf features:
|
||||||
- edit-config testopts
|
- edit-config testopts
|
||||||
- edit-config erropts
|
- edit-config erropts
|
||||||
- edit-config config-text
|
- edit-config config-text
|
||||||
|
- edit-config operation
|
||||||
|
|
||||||
Restconf
|
Restconf
|
||||||
========
|
========
|
||||||
|
|
|
||||||
31
ROADMAP.md
Normal file
31
ROADMAP.md
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
# Clixon roadmap
|
||||||
|
|
||||||
|
Not in prio order (yet)
|
||||||
|
|
||||||
|
- XML
|
||||||
|
- [Namespace handling](https://github.com/clicon/clixon/issues/49)
|
||||||
|
- NETCONF
|
||||||
|
- Support for additional Netconf [edit-config modes](https://github.com/clicon/clixon/issues/53)
|
||||||
|
- Netconf [framing](https://github.com/clicon/clixon/issues/50)
|
||||||
|
- [Sanity checks](https://github.com/clicon/clixon/issues/47)
|
||||||
|
- [Child ordering](https://github.com/clicon/clixon/issues/22)
|
||||||
|
- Netconf backend (Clixon acts as netconf controller)
|
||||||
|
- Restconf
|
||||||
|
- Query parameters
|
||||||
|
- NACM (RFC 8341) is somewhat limited
|
||||||
|
- Extend with data node access (read/create/delete/update/execute)
|
||||||
|
- Streams (netconf and restconf)
|
||||||
|
- Extend native stream mode with external persistent timeseries database, eg influxdb.
|
||||||
|
- Jenkins CI/CD and webhooks
|
||||||
|
- YANG
|
||||||
|
- [Cardinality](https://github.com/clicon/clixon/issues/48)
|
||||||
|
- RFC 6022 [NETCONF monitoring](https://github.com/clicon/clixon/issues/39)
|
||||||
|
- Factory default Setting - draft-wu-netconf-restconf-factory-restore-03
|
||||||
|
- Deviation, belongs-to, min/max-elements, action, unique
|
||||||
|
- Containers
|
||||||
|
- [Docker improvements](https://github.com/clicon/clixon/issues/44)
|
||||||
|
- Kubernetes Helm chart definition
|
||||||
|
- [gRPC](https://github.com/clicon/clixon/issues/43)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -196,8 +196,7 @@ text_disconnect(xmldb_handle xh)
|
||||||
free(th->th_dbdir);
|
free(th->th_dbdir);
|
||||||
if (th->th_dbs){
|
if (th->th_dbs){
|
||||||
if (th->th_cache){
|
if (th->th_cache){
|
||||||
if ((keys = hash_keys(th->th_dbs, &klen)) == NULL)
|
keys = hash_keys(th->th_dbs, &klen);
|
||||||
return 0;
|
|
||||||
for(i = 0; i < klen; i++)
|
for(i = 0; i < klen; i++)
|
||||||
if ((de = hash_value(th->th_dbs, keys[i], NULL)) != NULL){
|
if ((de = hash_value(th->th_dbs, keys[i], NULL)) != NULL){
|
||||||
if (de->de_xml)
|
if (de->de_xml)
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ WORKDIR /clixon
|
||||||
|
|
||||||
# Clone cligen and clixon
|
# Clone cligen and clixon
|
||||||
RUN git clone https://github.com/olofhagsand/cligen.git
|
RUN git clone https://github.com/olofhagsand/cligen.git
|
||||||
RUN git clone -b develop https://github.com/clicon/clixon.git
|
RUN git clone https://github.com/clicon/clixon.git
|
||||||
|
|
||||||
# Build cligen
|
# Build cligen
|
||||||
WORKDIR /clixon/cligen
|
WORKDIR /clixon/cligen
|
||||||
|
|
|
||||||
|
|
@ -133,4 +133,4 @@
|
||||||
`char[]'. */
|
`char[]'. */
|
||||||
#undef YYTEXT_POINTER
|
#undef YYTEXT_POINTER
|
||||||
|
|
||||||
#include <clixon_custom.h>
|
#include "clixon_custom.h"
|
||||||
|
|
|
||||||
|
|
@ -84,14 +84,14 @@ typedef struct event_stream event_stream_t;
|
||||||
*/
|
*/
|
||||||
event_stream_t *stream_find(clicon_handle h, const char *name);
|
event_stream_t *stream_find(clicon_handle h, const char *name);
|
||||||
int stream_add(clicon_handle h, const char *name, const char *description, int replay_enabled, struct timeval *retention);
|
int stream_add(clicon_handle h, const char *name, const char *description, int replay_enabled, struct timeval *retention);
|
||||||
int stream_delete_all(clicon_handle h);
|
int stream_delete_all(clicon_handle h, int force);
|
||||||
int stream_get_xml(clicon_handle h, int access, cbuf *cb);
|
int stream_get_xml(clicon_handle h, int access, cbuf *cb);
|
||||||
int stream_timer_setup(int fd, void *arg);
|
int stream_timer_setup(int fd, void *arg);
|
||||||
/* Subscriptions */
|
/* Subscriptions */
|
||||||
struct stream_subscription *stream_ss_add(clicon_handle h, char *stream,
|
struct stream_subscription *stream_ss_add(clicon_handle h, char *stream,
|
||||||
char *xpath, struct timeval *start, struct timeval *stop,
|
char *xpath, struct timeval *start, struct timeval *stop,
|
||||||
stream_fn_t fn, void *arg);
|
stream_fn_t fn, void *arg);
|
||||||
int stream_ss_rm(clicon_handle h, event_stream_t *es, struct stream_subscription *ss);
|
int stream_ss_rm(clicon_handle h, event_stream_t *es, struct stream_subscription *ss, int force);
|
||||||
struct stream_subscription *stream_ss_find(event_stream_t *es,
|
struct stream_subscription *stream_ss_find(event_stream_t *es,
|
||||||
stream_fn_t fn, void *arg);
|
stream_fn_t fn, void *arg);
|
||||||
int stream_ss_delete_all(clicon_handle h, stream_fn_t fn, void *arg);
|
int stream_ss_delete_all(clicon_handle h, stream_fn_t fn, void *arg);
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ clicon_handle_exit(clicon_handle h)
|
||||||
hash_free(ha);
|
hash_free(ha);
|
||||||
if ((ha = clicon_data(h)) != NULL)
|
if ((ha = clicon_data(h)) != NULL)
|
||||||
hash_free(ha);
|
hash_free(ha);
|
||||||
stream_delete_all(h);
|
stream_delete_all(h, 1);
|
||||||
free(ch);
|
free(ch);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -151,10 +151,12 @@ stream_add(clicon_handle h,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Delete complete notification event stream list (not just single stream)
|
/*! Delete complete notification event stream list (not just single stream)
|
||||||
* @param[in] es
|
* @param[in] h Clicon handle
|
||||||
|
* @param[in] force Force deletion of
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
stream_delete_all(clicon_handle h)
|
stream_delete_all(clicon_handle h,
|
||||||
|
int force)
|
||||||
{
|
{
|
||||||
struct stream_replay *r;
|
struct stream_replay *r;
|
||||||
struct stream_subscription *ss;
|
struct stream_subscription *ss;
|
||||||
|
|
@ -169,7 +171,7 @@ stream_delete_all(clicon_handle h)
|
||||||
if (es->es_description)
|
if (es->es_description)
|
||||||
free(es->es_description);
|
free(es->es_description);
|
||||||
while ((ss = es->es_subscription) != NULL)
|
while ((ss = es->es_subscription) != NULL)
|
||||||
stream_ss_rm(h, es, ss); /* XXX in some cases leaks memory due to DONT clause in stream_ss_rm() */
|
stream_ss_rm(h, es, ss, force); /* XXX in some cases leaks memory due to DONT clause in stream_ss_rm() */
|
||||||
while ((r = es->es_replay) != NULL){
|
while ((r = es->es_replay) != NULL){
|
||||||
DELQ(r, es->es_replay, struct stream_replay *);
|
DELQ(r, es->es_replay, struct stream_replay *);
|
||||||
if (r->r_xml)
|
if (r->r_xml)
|
||||||
|
|
@ -262,7 +264,7 @@ stream_timer_setup(int fd,
|
||||||
if (timerisset(&ss->ss_stoptime) && timercmp(&ss->ss_stoptime, &now, <)){
|
if (timerisset(&ss->ss_stoptime) && timercmp(&ss->ss_stoptime, &now, <)){
|
||||||
ss1 = NEXTQ(struct stream_subscription *, ss);
|
ss1 = NEXTQ(struct stream_subscription *, ss);
|
||||||
/* Signal to remove stream for upper levels */
|
/* Signal to remove stream for upper levels */
|
||||||
if (stream_ss_rm(h, es, ss) < 0)
|
if (stream_ss_rm(h, es, ss, 0) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
ss = ss1;
|
ss = ss1;
|
||||||
}
|
}
|
||||||
|
|
@ -378,19 +380,20 @@ stream_ss_add(clicon_handle h,
|
||||||
int
|
int
|
||||||
stream_ss_rm(clicon_handle h,
|
stream_ss_rm(clicon_handle h,
|
||||||
event_stream_t *es,
|
event_stream_t *es,
|
||||||
struct stream_subscription *ss)
|
struct stream_subscription *ss,
|
||||||
|
int force)
|
||||||
{
|
{
|
||||||
clicon_debug(1, "%s", __FUNCTION__);
|
clicon_debug(1, "%s", __FUNCTION__);
|
||||||
DELQ(ss, es->es_subscription, struct stream_subscription *);
|
DELQ(ss, es->es_subscription, struct stream_subscription *);
|
||||||
/* Remove from upper layers - close socket etc. */
|
/* Remove from upper layers - close socket etc. */
|
||||||
(*ss->ss_fn)(h, 1, NULL, ss->ss_arg);
|
(*ss->ss_fn)(h, 1, NULL, ss->ss_arg);
|
||||||
#ifdef DONT /* upcall may have deleted it */
|
if (force){
|
||||||
if (ss->ss_stream)
|
if (ss->ss_stream)
|
||||||
free(ss->ss_stream);
|
free(ss->ss_stream);
|
||||||
if (ss->ss_xpath)
|
if (ss->ss_xpath)
|
||||||
free(ss->ss_xpath);
|
free(ss->ss_xpath);
|
||||||
free(ss);
|
free(ss);
|
||||||
#endif
|
}
|
||||||
clicon_debug(1, "%s retval: 0", __FUNCTION__);
|
clicon_debug(1, "%s retval: 0", __FUNCTION__);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -436,7 +439,7 @@ stream_ss_delete_all(clicon_handle h,
|
||||||
if ((es = clicon_stream(h)) != NULL){
|
if ((es = clicon_stream(h)) != NULL){
|
||||||
do {
|
do {
|
||||||
if ((ss = stream_ss_find(es, fn, arg)) != NULL){
|
if ((ss = stream_ss_find(es, fn, arg)) != NULL){
|
||||||
if (stream_ss_rm(h, es, ss) < 0)
|
if (stream_ss_rm(h, es, ss, 1) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
es = NEXTQ(struct event_stream *, es);
|
es = NEXTQ(struct event_stream *, es);
|
||||||
|
|
@ -464,7 +467,7 @@ stream_ss_delete(clicon_handle h,
|
||||||
do {
|
do {
|
||||||
if (strcmp(name, es->es_name)==0)
|
if (strcmp(name, es->es_name)==0)
|
||||||
if ((ss = stream_ss_find(es, fn, arg)) != NULL){
|
if ((ss = stream_ss_find(es, fn, arg)) != NULL){
|
||||||
if (stream_ss_rm(h, es, ss) < 0)
|
if (stream_ss_rm(h, es, ss, 0) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
es = NEXTQ(struct event_stream *, es);
|
es = NEXTQ(struct event_stream *, es);
|
||||||
|
|
@ -503,7 +506,7 @@ stream_notify1(clicon_handle h,
|
||||||
struct stream_subscription *ss1;
|
struct stream_subscription *ss1;
|
||||||
ss1 = NEXTQ(struct stream_subscription *, ss);
|
ss1 = NEXTQ(struct stream_subscription *, ss);
|
||||||
/* Signal to remove stream for upper levels */
|
/* Signal to remove stream for upper levels */
|
||||||
if (stream_ss_rm(h, es, ss) < 0)
|
if (stream_ss_rm(h, es, ss, 1) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
ss = ss1;
|
ss = ss1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,16 @@ testname=
|
||||||
clixon_cli=clixon_cli
|
clixon_cli=clixon_cli
|
||||||
|
|
||||||
# For memcheck / performance
|
# For memcheck / performance
|
||||||
#clixon_netconf="valgrind --leak-check=full --show-leak-kinds=all clixon_netconf"
|
|
||||||
#clixon_netconf="valgrind --tool=callgrind clixon_netconf"
|
#clixon_netconf="valgrind --tool=callgrind clixon_netconf"
|
||||||
|
#clixon_netconf="valgrind --leak-check=full --show-leak-kinds=all clixon_netconf"
|
||||||
clixon_netconf=clixon_netconf
|
clixon_netconf=clixon_netconf
|
||||||
|
|
||||||
# How to run restconf stand-alone and using valgrind
|
# How to run restconf stand-alone and using valgrind
|
||||||
#sudo su -c "/www-data/clixon_restconf -f $cfg -D 1" -s /bin/sh www-data
|
#clixon_restconf="valgrind --trace-children=no --child-silent-after-fork=yes --leak-check=full --show-leak-kinds=all /www-data/clixon_restconf"
|
||||||
#sudo su -c "valgrind --trace-children=no --child-silent-after-fork=yes --leak-check=full --show-leak-kinds=all /www-data/clixon_restconf -f $cfg -D 1" -s /bin/sh www-data
|
clixon_restconf=/www-data/clixon_restconf
|
||||||
|
RCWAIT=1 # Wait after restconf start. Set to 10 if valgrind
|
||||||
|
|
||||||
|
# If you test w valgrind, you need to set -F & and sleep 10 when starting
|
||||||
#clixon_backend="valgrind --leak-check=full --show-leak-kinds=all clixon_backend"
|
#clixon_backend="valgrind --leak-check=full --show-leak-kinds=all clixon_backend"
|
||||||
clixon_backend=clixon_backend
|
clixon_backend=clixon_backend
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,8 +114,8 @@ new "cli rpc"
|
||||||
expectfn "$clixon_cli -1 -f $cfg -l o rpc ipv4" 0 "<address-family>ipv4</address-family>" "<next-hop-list>2.3.4.5</next-hop-list>"
|
expectfn "$clixon_cli -1 -f $cfg -l o rpc ipv4" 0 "<address-family>ipv4</address-family>" "<next-hop-list>2.3.4.5</next-hop-list>"
|
||||||
|
|
||||||
new "Kill backend"
|
new "Kill backend"
|
||||||
# Check if still alive
|
# Check if premature kill
|
||||||
pid=`pgrep clixon_backend`
|
pid=`pgrep -u root -f clixon_backend`
|
||||||
if [ -z "$pid" ]; then
|
if [ -z "$pid" ]; then
|
||||||
err "backend already dead"
|
err "backend already dead"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -157,16 +157,15 @@ if [ -z "$match" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new "Kill backend"
|
new "Kill backend"
|
||||||
|
# Check if premature kill
|
||||||
|
pid=`pgrep -u root -f clixon_backend`
|
||||||
|
if [ -z "$pid" ]; then
|
||||||
|
err "backend already dead"
|
||||||
|
fi
|
||||||
# kill backend
|
# kill backend
|
||||||
sudo clixon_backend -zf $cfg
|
sudo clixon_backend -z -f $cfg
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err "kill backend"
|
err "kill backend"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if still alive
|
|
||||||
pid=`pgrep clixon_backend`
|
|
||||||
if [ -n "$pid" ]; then
|
|
||||||
sudo kill $pid
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -rf $dir
|
rm -rf $dir
|
||||||
|
|
|
||||||
|
|
@ -180,8 +180,8 @@ new "cli validate"
|
||||||
expectfn "$clixon_cli -1 -f $cfg -y $fyang -l o validate" 0 "^$"
|
expectfn "$clixon_cli -1 -f $cfg -y $fyang -l o validate" 0 "^$"
|
||||||
|
|
||||||
new "Kill backend"
|
new "Kill backend"
|
||||||
# Check if still alive
|
# Check if premature kill
|
||||||
pid=`pgrep clixon_backend`
|
pid=`pgrep -u root -f clixon_backend`
|
||||||
if [ -z "$pid" ]; then
|
if [ -z "$pid" ]; then
|
||||||
err "backend already dead"
|
err "backend already dead"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,9 @@ if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new "start backend -s init -f $cfg -y $fyang"
|
|
||||||
# start new backend
|
# start new backend
|
||||||
sudo $clixon_backend -s init -f $cfg -y $fyang
|
new "start backend -s init -f $cfg -y $fyang"
|
||||||
|
sudo $clixon_backend -s init -f $cfg -y $fyang
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
@ -140,13 +140,13 @@ new "cli sender template"
|
||||||
expectfn "$clixon_cli -1f $cfg -y $fyang -l o set sender b template a" 0 "^$"
|
expectfn "$clixon_cli -1f $cfg -y $fyang -l o set sender b template a" 0 "^$"
|
||||||
|
|
||||||
new "Kill backend"
|
new "Kill backend"
|
||||||
# Check if still alive
|
# Check if premature kill
|
||||||
pid=`pgrep clixon_backend`
|
pid=`pgrep -u root -f clixon_backend`
|
||||||
if [ -z "$pid" ]; then
|
if [ -z "$pid" ]; then
|
||||||
err "backend already dead"
|
err "backend already dead"
|
||||||
fi
|
fi
|
||||||
# kill backend
|
# kill backend
|
||||||
sudo clixon_backend -zf $cfg
|
sudo clixon_backend -z -f $cfg
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err "kill backend"
|
err "kill backend"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ fi
|
||||||
|
|
||||||
new "start backend -s init -f $cfg -y $fyang"
|
new "start backend -s init -f $cfg -y $fyang"
|
||||||
# start new backend
|
# start new backend
|
||||||
sudo $clixon_backend -s init -f $cfg -y $fyang
|
sudo $clixon_backend -s init -f $cfg -y $fyang
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
@ -119,9 +119,14 @@ new "minmax: validate should fail"
|
||||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><validate><source><candidate/></source></validate></rpc>]]>]]>" "^<rpc-reply><rpc-error/></rpc-reply>]]>]]>$"
|
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><validate><source><candidate/></source></validate></rpc>]]>]]>" "^<rpc-reply><rpc-error/></rpc-reply>]]>]]>$"
|
||||||
fi # NYI
|
fi # NYI
|
||||||
|
|
||||||
|
new "Kill backend"
|
||||||
|
# Check if premature kill
|
||||||
|
pid=`pgrep -u root -f clixon_backend`
|
||||||
|
if [ -z "$pid" ]; then
|
||||||
|
err "backend already dead"
|
||||||
|
fi
|
||||||
# kill backend
|
# kill backend
|
||||||
sudo clixon_backend -zf $cfg
|
sudo clixon_backend -z -f $cfg
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err "kill backend"
|
err "kill backend"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -136,12 +136,13 @@ if [ $? -ne 0 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new "kill old restconf daemon"
|
new "kill old restconf daemon"
|
||||||
sudo pkill -u www-data clixon_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
sleep 1
|
|
||||||
new "start restconf daemon (-a is enable basic authentication)"
|
|
||||||
sudo su -c "/www-data/clixon_restconf -f $cfg -y $fyang -- -a" -s /bin/sh www-data &
|
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
new "start restconf daemon (-a is enable basic authentication)"
|
||||||
|
sudo su -c "$clixon_restconf -f $cfg -y $fyang -- -a" -s /bin/sh www-data &
|
||||||
|
|
||||||
|
sleep $RCWAIT
|
||||||
|
|
||||||
new "restconf DELETE whole datastore"
|
new "restconf DELETE whole datastore"
|
||||||
expecteq "$(curl -u adm1:bar -sS -X DELETE http://localhost/restconf/data)" ""
|
expecteq "$(curl -u adm1:bar -sS -X DELETE http://localhost/restconf/data)" ""
|
||||||
|
|
@ -192,15 +193,16 @@ new2 "guest edit nacm"
|
||||||
expecteq "$(curl -u guest:bar -sS -X PUT -d '{"x": 3}' http://localhost/restconf/data/x)" '{"ietf-restconf:errors" : {"error": {"error-tag": "access-denied","error-type": "protocol","error-severity": "error","error-message": "The requested URL was unauthorized"}}}
'
|
expecteq "$(curl -u guest:bar -sS -X PUT -d '{"x": 3}' http://localhost/restconf/data/x)" '{"ietf-restconf:errors" : {"error": {"error-tag": "access-denied","error-type": "protocol","error-severity": "error","error-message": "The requested URL was unauthorized"}}}
'
|
||||||
|
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
sudo pkill -u www-data clixon_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
new "Kill backend"
|
new "Kill backend"
|
||||||
pid=`pgrep clixon_backend`
|
# Check if premature kill
|
||||||
|
pid=`pgrep -u root -f clixon_backend`
|
||||||
if [ -z "$pid" ]; then
|
if [ -z "$pid" ]; then
|
||||||
err "backend already dead"
|
err "backend already dead"
|
||||||
fi
|
fi
|
||||||
# kill backend
|
# kill backend
|
||||||
sudo clixon_backend -zf $cfg
|
sudo clixon_backend -z -f $cfg
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err "kill backend"
|
err "kill backend"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -158,19 +158,18 @@ fi
|
||||||
sleep 1
|
sleep 1
|
||||||
new "start backend -s init -f $cfg -y $fyang"
|
new "start backend -s init -f $cfg -y $fyang"
|
||||||
# start new backend
|
# start new backend
|
||||||
sudo $clixon_backend -s init -f $cfg -y $fyang
|
sudo $clixon_backend -s init -f $cfg -y $fyang
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
sleep 1
|
|
||||||
|
|
||||||
new "kill old restconf daemon"
|
new "kill old restconf daemon"
|
||||||
sudo pkill -u www-data clixon_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
new "start restconf daemon (-a is enable http basic auth)"
|
new "start restconf daemon (-a is enable http basic auth)"
|
||||||
sudo start-stop-daemon -S -q -o -b -x /www-data/clixon_restconf -d /www-data -c www-data -- -f $cfg -y $fyang -- -a
|
sudo su -c "$clixon_restconf -f $cfg -y $fyang -- -a" -s /bin/sh www-data &
|
||||||
|
|
||||||
sleep 1
|
sleep $RCWAIT
|
||||||
|
|
||||||
new "restconf DELETE whole datastore"
|
new "restconf DELETE whole datastore"
|
||||||
expecteq "$(curl -u adm1:bar -sS -X DELETE http://localhost/restconf/data)" ""
|
expecteq "$(curl -u adm1:bar -sS -X DELETE http://localhost/restconf/data)" ""
|
||||||
|
|
@ -231,15 +230,16 @@ new "cli rpc as guest"
|
||||||
expectfn "$clixon_cli -1 -U guest -l o -f $cfg -y $fyang rpc ipv4" 255 "protocol access-denied access denied"
|
expectfn "$clixon_cli -1 -U guest -l o -f $cfg -y $fyang rpc ipv4" 255 "protocol access-denied access denied"
|
||||||
|
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
sudo pkill -u www-data clixon_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
new "Kill backend"
|
new "Kill backend"
|
||||||
pid=`pgrep clixon_backend`
|
# Check if premature kill
|
||||||
|
pid=`pgrep -u root -f clixon_backend`
|
||||||
if [ -z "$pid" ]; then
|
if [ -z "$pid" ]; then
|
||||||
err "backend already dead"
|
err "backend already dead"
|
||||||
fi
|
fi
|
||||||
# kill backend
|
# kill backend
|
||||||
sudo clixon_backend -zf $cfg
|
sudo clixon_backend -z -f $cfg
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err "kill backend"
|
err "kill backend"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -248,16 +248,15 @@ new "netconf client-side rpc"
|
||||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><ex:client-rpc><request>example</request></ex:client-rpc></rpc>]]>]]>" "^<rpc-reply><result>ok</result></rpc-reply>]]>]]>$"
|
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><ex:client-rpc><request>example</request></ex:client-rpc></rpc>]]>]]>" "^<rpc-reply><result>ok</result></rpc-reply>]]>]]>$"
|
||||||
|
|
||||||
new "Kill backend"
|
new "Kill backend"
|
||||||
|
# Check if premature kill
|
||||||
|
pid=`pgrep -u root -f clixon_backend`
|
||||||
|
if [ -z "$pid" ]; then
|
||||||
|
err "backend already dead"
|
||||||
|
fi
|
||||||
# kill backend
|
# kill backend
|
||||||
sudo clixon_backend -zf $cfg
|
sudo clixon_backend -z -f $cfg
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err "kill backend"
|
err "kill backend"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if still alive
|
|
||||||
pid=`pgrep clixon_backend`
|
|
||||||
if [ -n "$pid" ]; then
|
|
||||||
sudo kill $pid
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -rf $dir
|
rm -rf $dir
|
||||||
|
|
|
||||||
|
|
@ -167,12 +167,14 @@ expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><edit-config><target><can
|
||||||
new "verify list user order (as entered)"
|
new "verify list user order (as entered)"
|
||||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get-config><source><candidate/></source><filter type=\"xpath\" select=\"/y2\"/></get-config></rpc>]]>]]>" "^<rpc-reply><data><y2><k>c</k><a>bar</a></y2><y2><k>b</k><a>foo</a></y2><y2><k>a</k><a>fie</a></y2></data></rpc-reply>]]>]]>$"
|
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get-config><source><candidate/></source><filter type=\"xpath\" select=\"/y2\"/></get-config></rpc>]]>]]>" "^<rpc-reply><data><y2><k>c</k><a>bar</a></y2><y2><k>b</k><a>foo</a></y2><y2><k>a</k><a>fie</a></y2></data></rpc-reply>]]>]]>$"
|
||||||
|
|
||||||
pid=`pgrep clixon_backend`
|
new "Kill backend"
|
||||||
|
# Check if premature kill
|
||||||
|
pid=`pgrep -u root -f clixon_backend`
|
||||||
if [ -z "$pid" ]; then
|
if [ -z "$pid" ]; then
|
||||||
err "backend already dead"
|
err "backend already dead"
|
||||||
fi
|
fi
|
||||||
# kill backend
|
# kill backend
|
||||||
sudo clixon_backend -zf $cfg
|
sudo clixon_backend -z -f $cfg
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err "kill backend"
|
err "kill backend"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ cat <<EOF > $cfg
|
||||||
<CLICON_YANG_MODULE_MAIN>ietf-ip</CLICON_YANG_MODULE_MAIN>
|
<CLICON_YANG_MODULE_MAIN>ietf-ip</CLICON_YANG_MODULE_MAIN>
|
||||||
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
||||||
<CLICON_BACKEND_PIDFILE>/usr/local/var/$APPNAME/$APPNAME.pidfile</CLICON_BACKEND_PIDFILE>
|
<CLICON_BACKEND_PIDFILE>/usr/local/var/$APPNAME/$APPNAME.pidfile</CLICON_BACKEND_PIDFILE>
|
||||||
<CLICON_RESTCONF_PRETTY>false</CLICON_RESTCONF_PRETTY>
|
<CLICON_RESTCONF_PRETTY>false</CLICON_RESTCONF_PRETTY>
|
||||||
<CLICON_XMLDB_DIR>/usr/local/var/$APPNAME</CLICON_XMLDB_DIR>
|
<CLICON_XMLDB_DIR>/usr/local/var/$APPNAME</CLICON_XMLDB_DIR>
|
||||||
<CLICON_XMLDB_PLUGIN>/usr/local/lib/xmldb/text.so</CLICON_XMLDB_PLUGIN>
|
<CLICON_XMLDB_PLUGIN>/usr/local/lib/xmldb/text.so</CLICON_XMLDB_PLUGIN>
|
||||||
</config>
|
</config>
|
||||||
|
|
@ -69,12 +69,12 @@ if [ $? -ne 0 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new "kill old restconf daemon"
|
new "kill old restconf daemon"
|
||||||
sudo pkill -u www-data clixon_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
new "start restconf daemon"
|
new "start restconf daemon"
|
||||||
sudo start-stop-daemon -S -q -o -b -x /www-data/clixon_restconf -d /www-data -c www-data -- -f $cfg -y $fyang # -D 1
|
sudo su -c "$clixon_restconf -f $cfg -y $fyang" -s /bin/sh www-data &
|
||||||
|
|
||||||
sleep 1
|
sleep $RCWAIT
|
||||||
|
|
||||||
new "generate 'large' config with $number list entries"
|
new "generate 'large' config with $number list entries"
|
||||||
echo -n "<rpc><edit-config><target><candidate/></target><config><x>" > $fconfig
|
echo -n "<rpc><edit-config><target><candidate/></target><config><x>" > $fconfig
|
||||||
|
|
@ -164,14 +164,17 @@ expecteof "time -f %e $clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><commit><sourc
|
||||||
new "netconf get large leaf-list config"
|
new "netconf get large leaf-list config"
|
||||||
expecteof "time -f %e $clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>" "^<rpc-reply><data><x><c>0</c><c>1</c>"
|
expecteof "time -f %e $clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>" "^<rpc-reply><data><x><c>0</c><c>1</c>"
|
||||||
|
|
||||||
|
new "Kill restconf daemon"
|
||||||
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
new "Kill backend"
|
new "Kill backend"
|
||||||
# Check if still alive
|
# Check if premature kill
|
||||||
pid=`pgrep clixon_backend`
|
pid=`pgrep -u root -f clixon_backend`
|
||||||
if [ -z "$pid" ]; then
|
if [ -z "$pid" ]; then
|
||||||
err "backend already dead"
|
err "backend already dead"
|
||||||
fi
|
fi
|
||||||
# kill backend
|
# kill backend
|
||||||
sudo clixon_backend -zf $cfg
|
sudo clixon_backend -z -f $cfg
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err "kill backend"
|
err "kill backend"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
new "start backend -s init -f $cfg -y $fyang"
|
new "start backend -s init -f $cfg -y $fyang"
|
||||||
sudo $clixon_backend -s init -f $cfg -y $fyang # -D 1
|
sudo $clixon_backend -s init -f $cfg -y $fyang # -D 1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
@ -99,9 +99,9 @@ new "kill old restconf daemon"
|
||||||
sudo pkill -u www-data clixon_restconf
|
sudo pkill -u www-data clixon_restconf
|
||||||
|
|
||||||
new "start restconf daemon"
|
new "start restconf daemon"
|
||||||
sudo start-stop-daemon -S -q -o -b -x /www-data/clixon_restconf -d /www-data -c www-data -- -f $cfg -y $fyang # -D 1
|
sudo su -c "$clixon_restconf -f $cfg -y $fyang" -s /bin/sh www-data &
|
||||||
|
|
||||||
sleep 1
|
sleep $RCWAIT
|
||||||
|
|
||||||
new "restconf tests"
|
new "restconf tests"
|
||||||
|
|
||||||
|
|
@ -314,16 +314,16 @@ fi
|
||||||
# Cant get shell macros to work, inline matching from lib.sh
|
# Cant get shell macros to work, inline matching from lib.sh
|
||||||
|
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
sudo pkill -u www-data clixon_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
new "Kill backend"
|
new "Kill backend"
|
||||||
# Check if still alive
|
# Check if premature kill
|
||||||
pid=`pgrep clixon_backend`
|
pid=`pgrep -u root -f clixon_backend`
|
||||||
if [ -z "$pid" ]; then
|
if [ -z "$pid" ]; then
|
||||||
err "backend already dead"
|
err "backend already dead"
|
||||||
fi
|
fi
|
||||||
# kill backend
|
# kill backend
|
||||||
sudo clixon_backend -zf $cfg
|
sudo clixon_backend -z -f $cfg
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err "kill backend"
|
err "kill backend"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -50,18 +50,17 @@ if [ $? -ne 0 ]; then
|
||||||
fi
|
fi
|
||||||
new "start backend -s init -f $cfg -y $fyang"
|
new "start backend -s init -f $cfg -y $fyang"
|
||||||
sudo $clixon_backend -s init -f $cfg -y $fyang
|
sudo $clixon_backend -s init -f $cfg -y $fyang
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new "kill old restconf daemon"
|
new "kill old restconf daemon"
|
||||||
sudo pkill -u www-data clixon_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
new "start restconf daemon"
|
new "start restconf daemon"
|
||||||
sudo start-stop-daemon -S -q -o -b -x /www-data/clixon_restconf -d /www-data -c www-data -- -f $cfg -y $fyang # -D 1
|
sudo su -c "$clixon_restconf -f $cfg -y $fyang" -s /bin/sh www-data &
|
||||||
|
|
||||||
sleep 1
|
sleep $RCWAIT
|
||||||
|
|
||||||
new "restconf tests"
|
new "restconf tests"
|
||||||
|
|
||||||
|
|
@ -135,16 +134,16 @@ new "restconf PUT change key error"
|
||||||
expectfn 'curl -is -X PUT -d {"interface":{"name":"ALPHA","type":"eth0"}} http://localhost/restconf/data/cont1/interface=TEST' 0 '{"ietf-restconf:errors" : {"error": {"rpc-error": {"error-tag": "operation-failed","error-type": "protocol","error-severity": "error","error-message": "api-path keys do not match data keys"}}}}'
|
expectfn 'curl -is -X PUT -d {"interface":{"name":"ALPHA","type":"eth0"}} http://localhost/restconf/data/cont1/interface=TEST' 0 '{"ietf-restconf:errors" : {"error": {"rpc-error": {"error-tag": "operation-failed","error-type": "protocol","error-severity": "error","error-message": "api-path keys do not match data keys"}}}}'
|
||||||
|
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
sudo pkill -u www-data clixon_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
new "Kill backend"
|
new "Kill backend"
|
||||||
# Check if still alive
|
# Check if premature kill
|
||||||
pid=`pgrep clixon_backend`
|
pid=`pgrep -u root -f clixon_backend`
|
||||||
if [ -z "$pid" ]; then
|
if [ -z "$pid" ]; then
|
||||||
err "backend already dead"
|
err "backend already dead"
|
||||||
fi
|
fi
|
||||||
# kill backend
|
# kill backend
|
||||||
sudo clixon_backend -zf $cfg
|
sudo clixon_backend -z -f $cfg
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err "kill backend"
|
err "kill backend"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new "start backend -f $cfg -s $mode -c $dir/config"
|
new "start backend -f $cfg -s $mode -c $dir/config"
|
||||||
sudo clixon_backend -f $cfg -s $mode -c $dir/config
|
sudo $clixon_backend -f $cfg -s $mode -c $dir/config
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
@ -90,13 +90,13 @@ EOF
|
||||||
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc><get-config><source><running/></source></get-config></rpc>]]>]]>' "^<rpc-reply>$expect</rpc-reply>]]>]]>$"
|
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc><get-config><source><running/></source></get-config></rpc>]]>]]>' "^<rpc-reply>$expect</rpc-reply>]]>]]>$"
|
||||||
|
|
||||||
new "Kill backend"
|
new "Kill backend"
|
||||||
# Check if still alive
|
# Check if premature kill
|
||||||
pid=`pgrep clixon_backend`
|
pid=`pgrep -u root -f clixon_backend`
|
||||||
if [ -z "$pid" ]; then
|
if [ -z "$pid" ]; then
|
||||||
err "backend already dead"
|
err "backend already dead"
|
||||||
fi
|
fi
|
||||||
# kill backend
|
# kill backend
|
||||||
sudo clixon_backend -zf $cfg
|
sudo clixon_backend -z -f $cfg
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err "kill backend"
|
err "kill backend"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
APPNAME=example
|
APPNAME=example
|
||||||
UTIL=../util/clixon_util_stream
|
UTIL=../util/clixon_util_stream
|
||||||
|
NCWAIT=5 # Wait (netconf valgrind may need more time)
|
||||||
|
|
||||||
if [ ! -x $UTIL ]; then
|
if [ ! -x $UTIL ]; then
|
||||||
echo "$UTIL not found. To build: (cd ../util; make clixon_util_stream)"
|
echo "$UTIL not found. To build: (cd ../util; make clixon_util_stream)"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -109,19 +111,17 @@ if [ $? -ne 0 ]; then
|
||||||
fi
|
fi
|
||||||
new "start backend -s init -f $cfg -y $fyang"
|
new "start backend -s init -f $cfg -y $fyang"
|
||||||
sudo $clixon_backend -s init -f $cfg -y $fyang # -D 1
|
sudo $clixon_backend -s init -f $cfg -y $fyang # -D 1
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new "kill old restconf daemon"
|
new "kill old restconf daemon"
|
||||||
sudo pkill -u www-data clixon_restconf
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
new "start restconf daemon"
|
new "start restconf daemon"
|
||||||
|
sudo su -c "$clixon_restconf -f $cfg -y $fyang" -s /bin/sh www-data &
|
||||||
|
|
||||||
sudo su -c "/www-data/clixon_restconf -f $cfg -y $fyang" -s /bin/sh www-data &
|
sleep $RCWAIT
|
||||||
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# 1. Netconf RFC5277 stream testing
|
# 1. Netconf RFC5277 stream testing
|
||||||
|
|
@ -136,19 +136,19 @@ expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 '<rpc><get><filter type="xpath"
|
||||||
#
|
#
|
||||||
# 1.2 Netconf stream subscription
|
# 1.2 Netconf stream subscription
|
||||||
new "netconf EXAMPLE subscription"
|
new "netconf EXAMPLE subscription"
|
||||||
expectwait "$clixon_netconf -qf $cfg -y $fyang" '<rpc><create-subscription><stream>EXAMPLE</stream></create-subscription></rpc>]]>]]>' '^<rpc-reply><ok/></rpc-reply>]]>]]><notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"><eventTime>20' 10
|
expectwait "$clixon_netconf -qf $cfg -y $fyang" '<rpc><create-subscription><stream>EXAMPLE</stream></create-subscription></rpc>]]>]]>' '^<rpc-reply><ok/></rpc-reply>]]>]]><notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"><eventTime>20' $NCWAIT
|
||||||
|
|
||||||
new "netconf subscription with empty startTime"
|
new "netconf subscription with empty startTime"
|
||||||
expectwait "$clixon_netconf -qf $cfg -y $fyang" '<rpc><create-subscription><stream>EXAMPLE</stream><startTime/></create-subscription></rpc>]]>]]>' '^<rpc-reply><ok/></rpc-reply>]]>]]><notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"><eventTime>20' 5
|
expectwait "$clixon_netconf -qf $cfg -y $fyang" '<rpc><create-subscription><stream>EXAMPLE</stream><startTime/></create-subscription></rpc>]]>]]>' '^<rpc-reply><ok/></rpc-reply>]]>]]><notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"><eventTime>20' $NCWAIT
|
||||||
|
|
||||||
new "netconf EXAMPLE subscription with simple filter"
|
new "netconf EXAMPLE subscription with simple filter"
|
||||||
expectwait "$clixon_netconf -qf $cfg -y $fyang" "<rpc><create-subscription><stream>EXAMPLE</stream><filter type=\"xpath\" select=\"event\"/></create-subscription></rpc>]]>]]>" '^<rpc-reply><ok/></rpc-reply>]]>]]><notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"><eventTime>20' 5
|
expectwait "$clixon_netconf -qf $cfg -y $fyang" "<rpc><create-subscription><stream>EXAMPLE</stream><filter type=\"xpath\" select=\"event\"/></create-subscription></rpc>]]>]]>" '^<rpc-reply><ok/></rpc-reply>]]>]]><notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"><eventTime>20' $NCWAIT
|
||||||
|
|
||||||
new "netconf EXAMPLE subscription with filter classifier"
|
new "netconf EXAMPLE subscription with filter classifier"
|
||||||
expectwait "$clixon_netconf -qf $cfg -y $fyang" "<rpc><create-subscription><stream>EXAMPLE</stream><filter type=\"xpath\" select=\"event[event-class='fault']\"/></create-subscription></rpc>]]>]]>" '^<rpc-reply><ok/></rpc-reply>]]>]]><notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"><eventTime>20' 5
|
expectwait "$clixon_netconf -qf $cfg -y $fyang" "<rpc><create-subscription><stream>EXAMPLE</stream><filter type=\"xpath\" select=\"event[event-class='fault']\"/></create-subscription></rpc>]]>]]>" '^<rpc-reply><ok/></rpc-reply>]]>]]><notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"><eventTime>20' $NCWAIT
|
||||||
|
|
||||||
new "netconf NONEXIST subscription"
|
new "netconf NONEXIST subscription"
|
||||||
expectwait "$clixon_netconf -qf $cfg -y $fyang" '<rpc><create-subscription><stream>NONEXIST</stream></create-subscription></rpc>]]>]]>' '^<rpc-reply><rpc-error><error-tag>invalid-value</error-tag><error-type>application</error-type><error-severity>error</error-severity><error-message>No such stream</error-message></rpc-error></rpc-reply>]]>]]>$' 5
|
expectwait "$clixon_netconf -qf $cfg -y $fyang" '<rpc><create-subscription><stream>NONEXIST</stream></create-subscription></rpc>]]>]]>' '^<rpc-reply><rpc-error><error-tag>invalid-value</error-tag><error-type>application</error-type><error-severity>error</error-severity><error-message>No such stream</error-message></rpc-error></rpc-reply>]]>]]>$' $NCWAIT
|
||||||
|
|
||||||
new "netconf EXAMPLE subscription with wrong date"
|
new "netconf EXAMPLE subscription with wrong date"
|
||||||
expectwait "$clixon_netconf -qf $cfg -y $fyang" '<rpc><create-subscription><stream>EXAMPLE</stream><startTime>kallekaka</startTime></create-subscription></rpc>]]>]]>' '^<rpc-reply><rpc-error><error-tag>bad-element</error-tag><error-type>application</error-type><error-info><bad-element>startTime</bad-element></error-info><error-severity>error</error-severity><error-message>Expected timestamp</error-message></rpc-error></rpc-reply>]]>]]>$' 0
|
expectwait "$clixon_netconf -qf $cfg -y $fyang" '<rpc><create-subscription><stream>EXAMPLE</stream><startTime>kallekaka</startTime></create-subscription></rpc>]]>]]>' '^<rpc-reply><rpc-error><error-tag>bad-element</error-tag><error-type>application</error-type><error-info><bad-element>startTime</bad-element></error-info><error-severity>error</error-severity><error-message>Expected timestamp</error-message></rpc-error></rpc-reply>]]>]]>$' 0
|
||||||
|
|
@ -158,6 +158,7 @@ expectwait "$clixon_netconf -qf $cfg -y $fyang" '<rpc><create-subscription><stre
|
||||||
#sleep 10
|
#sleep 10
|
||||||
#expectwait "$clixon_netconf -qf $cfg -y $fyang" "<rpc><create-subscription><stream>EXAMPLE</stream><startTime>$NOW</startTime></create-subscription></rpc>]]>]]>" '^<rpc-reply><ok/></rpc-reply>]]>]]><notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"><eventTime>20' 10
|
#expectwait "$clixon_netconf -qf $cfg -y $fyang" "<rpc><create-subscription><stream>EXAMPLE</stream><startTime>$NOW</startTime></create-subscription></rpc>]]>]]>" '^<rpc-reply><ok/></rpc-reply>]]>]]><notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"><eventTime>20' 10
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
#
|
#
|
||||||
# 2. Restconf RFC8040 stream testing
|
# 2. Restconf RFC8040 stream testing
|
||||||
new "2. Restconf RFC8040 stream testing"
|
new "2. Restconf RFC8040 stream testing"
|
||||||
|
|
@ -239,13 +240,15 @@ if [ -z "$match" ]; then
|
||||||
fi
|
fi
|
||||||
nr=$(echo "$ret" | grep -c "data:")
|
nr=$(echo "$ret" | grep -c "data:")
|
||||||
|
|
||||||
if [ $nr -lt 10 -o $nr -gt 14 ]; then
|
if [ $nr -lt 9 -o $nr -gt 14 ]; then
|
||||||
err 10 "$nr"
|
err 10 "$nr"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Try parallell
|
# Try parallell
|
||||||
# start background job
|
# start background job
|
||||||
curl -s -X GET -H "Accept: text/event-stream" -H "Cache-Control: no-cache" -H "Connection: keep-alive" "http://localhost/streams/EXAMPLE" > /dev/null &
|
curl -s -X GET -H "Accept: text/event-stream" -H "Cache-Control: no-cache" -H "Connection: keep-alive" "http://localhost/streams/EXAMPLE" > /dev/null &
|
||||||
|
PID=$!
|
||||||
|
|
||||||
new "Start subscription in parallell"
|
new "Start subscription in parallell"
|
||||||
ret=$($UTIL -u http://localhost/streams/EXAMPLE -t 8)
|
ret=$($UTIL -u http://localhost/streams/EXAMPLE -t 8)
|
||||||
|
|
@ -260,6 +263,8 @@ if [ $nr -lt 1 -o $nr -gt 2 ]; then
|
||||||
err 2 "$nr"
|
err 2 "$nr"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
kill $PID
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# NCHAN Need manual testing
|
# NCHAN Need manual testing
|
||||||
echo "Nchan streams requires manual testing"
|
echo "Nchan streams requires manual testing"
|
||||||
|
|
@ -267,27 +272,20 @@ echo "Add <CLICON_STREAM_PUB>http://localhost/pub</CLICON_STREAM_PUB> to config"
|
||||||
echo "Eg: curl -H \"Accept: text/event-stream\" -s -X GET http://localhost/sub/EXAMPLE"
|
echo "Eg: curl -H \"Accept: text/event-stream\" -s -X GET http://localhost/sub/EXAMPLE"
|
||||||
|
|
||||||
#-----------------
|
#-----------------
|
||||||
|
sleep 5
|
||||||
sudo pkill -u www-data clixon_restconf
|
new "Kill restconf daemon"
|
||||||
|
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||||
|
|
||||||
new "Kill backend"
|
new "Kill backend"
|
||||||
|
# Check if premature kill
|
||||||
|
pid=`pgrep -u root -f clixon_backend`
|
||||||
|
if [ -z "$pid" ]; then
|
||||||
|
err "backend already dead"
|
||||||
|
fi
|
||||||
# kill backend
|
# kill backend
|
||||||
sudo clixon_backend -zf $cfg
|
sudo clixon_backend -z -f $cfg
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err "kill backend"
|
err "kill backend"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if still alive
|
#rm -rf $dir
|
||||||
pid=`pgrep clixon_backend`
|
|
||||||
if [ -n "$pid" ]; then
|
|
||||||
sudo kill $pid
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -rf $dir
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,6 @@ module example{
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
# kill old backend (if any)
|
# kill old backend (if any)
|
||||||
new "kill old backend"
|
new "kill old backend"
|
||||||
sudo clixon_backend -zf $cfg
|
sudo clixon_backend -zf $cfg
|
||||||
|
|
@ -202,13 +201,13 @@ new "cli bits validate"
|
||||||
expectfn "$clixon_cli -1f $cfg -l o -y $fyang validate" 0 "^$"
|
expectfn "$clixon_cli -1f $cfg -l o -y $fyang validate" 0 "^$"
|
||||||
|
|
||||||
new "Kill backend"
|
new "Kill backend"
|
||||||
# Check if still alive
|
# Check if premature kill
|
||||||
pid=`pgrep clixon_backend`
|
pid=`pgrep -u root -f clixon_backend`
|
||||||
if [ -z "$pid" ]; then
|
if [ -z "$pid" ]; then
|
||||||
err "backend already dead"
|
err "backend already dead"
|
||||||
fi
|
fi
|
||||||
# kill backend
|
# kill backend
|
||||||
sudo clixon_backend -zf $cfg
|
sudo clixon_backend -z -f $cfg
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err "kill backend"
|
err "kill backend"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -137,13 +137,14 @@ expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><edit-config><target><can
|
||||||
new "must: eth validate fail"
|
new "must: eth validate fail"
|
||||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><validate><source><candidate/></source></validate></rpc>]]>]]>" "^<rpc-reply><rpc-error><error-tag>operation-failed</error-tag><error-type>application</error-type><error-severity>error</error-severity><error-message>An Ethernet MTU must be 1500</error-message></rpc-error></rpc-reply>]]>]]>"
|
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><validate><source><candidate/></source></validate></rpc>]]>]]>" "^<rpc-reply><rpc-error><error-tag>operation-failed</error-tag><error-type>application</error-type><error-severity>error</error-severity><error-message>An Ethernet MTU must be 1500</error-message></rpc-error></rpc-reply>]]>]]>"
|
||||||
|
|
||||||
# Check if still alive
|
new "Kill backend"
|
||||||
pid=`pgrep clixon_backend`
|
# Check if premature kill
|
||||||
|
pid=`pgrep -u root -f clixon_backend`
|
||||||
if [ -z "$pid" ]; then
|
if [ -z "$pid" ]; then
|
||||||
err "backend already dead"
|
err "backend already dead"
|
||||||
fi
|
fi
|
||||||
# kill backend
|
# kill backend
|
||||||
sudo clixon_backend -zf $cfg
|
sudo clixon_backend -z -f $cfg
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err "kill backend"
|
err "kill backend"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -212,15 +212,17 @@ expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 '<rpc><edit-config><target><can
|
||||||
new "netconf check delete"
|
new "netconf check delete"
|
||||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 '<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>' '<rpc-reply><data><x><y><a>1</a><b>2</b><c>1</c><val>two</val></y></x></data></rpc-reply>]]>]]>'
|
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 '<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>' '<rpc-reply><data><x><y><a>1</a><b>2</b><c>1</c><val>two</val></y></x></data></rpc-reply>]]>]]>'
|
||||||
|
|
||||||
# Check if still alive
|
new "Kill backend"
|
||||||
pid=`pgrep clixon_backend`
|
# Check if premature kill
|
||||||
|
pid=`pgrep -u root -f clixon_backend`
|
||||||
if [ -z "$pid" ]; then
|
if [ -z "$pid" ]; then
|
||||||
err "backend already dead"
|
err "backend already dead"
|
||||||
fi
|
fi
|
||||||
# kill backend
|
# kill backend
|
||||||
sudo clixon_backend -zf $cfg
|
sudo clixon_backend -z -f $cfg
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err "kill backend"
|
err "kill backend"
|
||||||
fi
|
fi
|
||||||
|
sudo pkill -u root -f clixon_backend
|
||||||
|
|
||||||
rm -rf $dir
|
rm -rf $dir
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue