Merge branch 'develop' of https://github.com/clicon/clixon into develop

This commit is contained in:
Olof hagsand 2018-10-12 18:42:03 +02:00
commit dcec834455
7 changed files with 48 additions and 11 deletions

View file

@ -52,10 +52,24 @@
* yang_parse() changed to take either filename or module name and revision.
* Removed clicon_dbspec_name[_set]().
* Use yang_main_module_name() instead.
* Replaced yang_spec_main with yang_spec_parse_module
* Added yang_spec_parse_file
* Replace code for initializing the main yang module
* Replace yang_spec_main() with yang_spec_parse_module() as follows:
```
/* old code */
if ((yspec = yang_spec_main(ch)) == NULL)
goto done;
/* new code */
if ((yspec = yspec_new()) == NULL)
goto done;
clicon_dbspec_yang_set(h, yspec);
if (yang_spec_parse_module(h, clicon_yang_module_main(h),
clicon_yang_dir(h), clicon_yang_module_revision(h), yspec) < 0)
goto done;
```
### Minor changes
* Added CLIXON_DEFAULT_CONFIG=/usr/local/etc/clixon.xml as option and in example (so you dont need to provide -f command-line option).
* Yang 1.1 action syntax added (but function is not supported)
* New function: clicon_conf_xml() returns configuration tree
* Obsoleted COMPAT_CLIV and COMPAT_XSL that were optional in 3.7

23
configure vendored
View file

@ -638,6 +638,7 @@ wwwdir
with_restconf
RANLIB
SH_SUFFIX
CLIXON_DEFAULT_CONFIG
INSTALLFLAGS
INSTALL
INSTALL_DATA
@ -685,6 +686,7 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
@ -761,6 +763,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE}'
@ -1013,6 +1016,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@ -1150,7 +1162,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@ -1303,6 +1315,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@ -2438,6 +2451,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
# If yes, compile apps/restconf
wwwdir=/www-data
@ -4057,12 +4071,11 @@ fi
fi
# Set default config file location
CLIXON_DEFAULT_CONFIG=/usr/local/etc/clixon.xml
# Check whether --with-configfile was given.
if test "${with_configfile+set}" = set; then :
withval=$with_configfile; DEFAULT_CONFIG="$withval"
else
DEFAULT_CONFIG="$(eval echo ${sysconfdir}/clixon.xml)"
withval=$with_configfile; CLIXON_DEFAULT_CONFIG="$withval"
fi
@ -4315,7 +4328,7 @@ _ACEOF
# Default location for config file
cat >>confdefs.h <<_ACEOF
#define CLIXON_DEFAULT_CONFIG "${DEFAULT_CONFIG}"
#define CLIXON_DEFAULT_CONFIG "${CLIXON_DEFAULT_CONFIG}"
_ACEOF

View file

@ -85,6 +85,7 @@ AC_SUBST(INSTALL)
AC_SUBST(INSTALL_DATA)
AC_SUBST(INSTALL_PROGRAM)
AC_SUBST(INSTALLFLAGS)
AC_SUBST(CLIXON_DEFAULT_CONFIG)
AC_SUBST(LIBS)
AC_SUBST(SH_SUFFIX)
AC_SUBST(RANLIB)
@ -158,10 +159,10 @@ if test "x${with_restconf}" == xyes; then
fi
# Set default config file location
CLIXON_DEFAULT_CONFIG=/usr/local/etc/clixon.xml
AC_ARG_WITH([configfile],
[AS_HELP_STRING([--with-configfile=FILE],[set default path to config file])],
[DEFAULT_CONFIG="$withval"],
[DEFAULT_CONFIG="$(eval echo ${sysconfdir}/clixon.xml)"])
[CLIXON_DEFAULT_CONFIG="$withval"],)
AC_CHECK_LIB(crypt, crypt)
AC_CHECK_HEADERS(crypt.h)
@ -186,7 +187,7 @@ CLIXON_DATADIR="${prefix}/share/clixon"
AC_DEFINE_UNQUOTED(CLIXON_DATADIR, "${CLIXON_DATADIR}", [Clixon data dir for system yang files etc])
# Default location for config file
AC_DEFINE_UNQUOTED(CLIXON_DEFAULT_CONFIG,"${DEFAULT_CONFIG}",[Location for apps to find default config file])
AC_DEFINE_UNQUOTED(CLIXON_DEFAULT_CONFIG,"${CLIXON_DEFAULT_CONFIG}",[Location for apps to find default config file])
AH_BOTTOM([#include <clixon_custom.h>])

View file

@ -43,6 +43,8 @@ localstatedir = @localstatedir@
libdir = @exec_prefix@/lib
APPNAME = example
# Install here if you want default clixon location:
CLIXON_DEFAULT_CONFIG = @CLIXON_DEFAULT_CONFIG@
CC = @CC@
CFLAGS = @CFLAGS@ -rdynamic -fPIC
@ -56,6 +58,8 @@ CLI_PLUGIN = $(APPNAME)_cli.so
NETCONF_PLUGIN = $(APPNAME)_netconf.so
RESTCONF_PLUGIN = $(APPNAME)_restconf.so
# Example docker image. PLEASE CHANGE THIS
IMAGE = olofhagsand/clixon_example
@ -120,6 +124,7 @@ distclean: clean
install: $(YANGSPECS) $(CLISPECS) $(BE_PLUGIN) $(BE2_PLUGIN) $(CLI_PLUGIN) $(NETCONF_PLUGIN) $(RESTCONF_PLUGIN) $(APPNAME).xml
install -d -m 0755 $(DESTDIR)$(sysconfdir)
install -m 0644 $(APPNAME).xml $(DESTDIR)$(sysconfdir)
# install -m 0644 $(APPNAME).xml $(DESTDIR)$(CLIXON_DEFAULT_CONFIG)
install -d -m 0755 $(DESTDIR)$(datarootdir)/$(APPNAME)/yang
install -m 0644 $(YANGSPECS) $(DESTDIR)$(datarootdir)/$(APPNAME)/yang
install -d -m 0755 $(DESTDIR)$(libdir)/$(APPNAME)/cli

View file

@ -260,6 +260,7 @@ char *yang_find_myprefix(yang_stmt *ys);
int yang_order(yang_stmt *y);
int yang_print(FILE *f, yang_node *yn);
int yang_print_cbuf(cbuf *cb, yang_node *yn, int marginal);
int ys_populate(yang_stmt *ys, void *arg);
yang_stmt *yang_parse_file(int fd, const char *name, yang_spec *ysp);
int yang_parse(clicon_handle h, const char *filename,
const char *module, const char *dir,

View file

@ -203,6 +203,7 @@ stream_cb_add(clicon_handle h,
event_stream_t *es;
struct stream_subscription *ss;
clicon_debug(1, "%s", __FUNCTION__);
if ((es = stream_find(h, stream)) == NULL){
clicon_err(OE_CFG, ENOENT, "Stream %s not found", stream);
goto done;
@ -289,6 +290,7 @@ stream_notify_xml(clicon_handle h,
event_stream_t *es;
struct stream_subscription *ss;
clicon_debug(1, "%s", __FUNCTION__);
if ((es = stream_find(h, stream)) == NULL)
goto ok;
/* Go thru all global (handle) subscriptions and find matches */
@ -332,6 +334,7 @@ stream_notify(clicon_handle h,
char timestr[27];
struct timeval tv;
clicon_debug(1, "%s", __FUNCTION__);
va_start(args, event);
len = vsnprintf(NULL, 0, event, args) + 1;
va_end(args);

View file

@ -1435,7 +1435,7 @@ ys_populate_feature(clicon_handle h,
* See ys_parse_sub for first pass and what can be assumed
* After this pass, cv:s are set for LEAFs and LEAF-LISTs
*/
static int
int
ys_populate(yang_stmt *ys,
void *arg)
{