diff --git a/.travis.yml b/.travis.yml
index b8c1a54e..23573a00 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,7 +3,6 @@ language: c
branches:
only:
- master
- - develop
before_script:
- sudo apt-get install -y libfcgi-dev
- ./test/travis/before_script.sh
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d5dbae38..bd58463e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,6 @@
# Clixon Changelog
-## 4.3.0 (Expected: ~December 2019)
+## 4.3.0 (Expected: December 2019)
### Minor changes
* Added "canonical" global namespace context: `nsctx_global`
@@ -12,6 +12,10 @@
* Fixed multi-namespace for augmented state which was not covered in 4.2.0.
### API changes on existing features (you may need to change your code)
+* Yang files reorganized into three classes: clixon, mandatory, optional (previous "standard" split into mandatory and optional).
+ * Clixon and mandatory yang spec are always installed
+ * Optional yang files are loaded only if configured with `--enable-optyangs` (flipped lofgic and changed from `disable-stdyangs`). NOTE: you must do this to run examples and tests.
+ * Optional yang files can be installed in a separate dir with `--with-opt-yang-installdir=DIR` (renamed from `with-std-yang-installdir`)
* The multi-namespace augment state may rearrange the XML namespace attributes.
* Main example yang changed to incorporate augmented state, new revision is 2019-11-15.
diff --git a/apps/backend/backend_plugin.c b/apps/backend/backend_plugin.c
index 866f4755..3f0925a3 100644
--- a/apps/backend/backend_plugin.c
+++ b/apps/backend/backend_plugin.c
@@ -149,6 +149,15 @@ clixon_plugin_statedata(clicon_handle h,
goto done;
goto fail;
}
+#if 1
+ if (debug){
+ cbuf *ccc=cbuf_new();
+ if (clicon_xml2cbuf(ccc, x, 0, 0, -1) < 0)
+ goto done;
+ clicon_debug(1, "%s MERGE: %s", __FUNCTION__, cbuf_get(ccc));
+ cbuf_free(ccc);
+ }
+#endif
if ((ret = netconf_trymerge(x, yspec, xret)) < 0)
goto done;
if (ret == 0)
diff --git a/configure b/configure
index 124aadbc..e0146b78 100755
--- a/configure
+++ b/configure
@@ -621,7 +621,7 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS
LIBOBJS
-STD_YANG_INSTALLDIR
+OPT_YANG_INSTALLDIR
YANG_INSTALLDIR
EGREP
GREP
@@ -633,7 +633,7 @@ YACC
CPP
wwwuser
wwwdir
-enable_stdyangs
+enable_optyangs
with_restconf
SH_SUFFIX
CLIXON_DEFAULT_CONFIG
@@ -711,14 +711,14 @@ ac_user_opts='
enable_option_checking
enable_debug
with_cligen
-enable_stdyangs
+enable_optyangs
enable_publish
with_restconf
with_wwwuser
with_configfile
with_libxml2
with_yang_installdir
-with_std_yang_installdir
+with_opt_yang_installdir
'
ac_precious_vars='build_alias
host_alias
@@ -1355,8 +1355,8 @@ Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-debug Build with debug symbols, default: no
- --disable-stdyangs Include standard yang files in clixon install,
- default: yes
+ --enable-optyangs Include standard yang files in clixon install,
+ default: no
--enable-publish Enable publish of notification streams using SSE and
curl
@@ -1369,7 +1369,7 @@ Optional Packages:
--with-configfile=FILE set default path to config file
--with-libxml2 use gnome/libxml2 regex engine
--with-yang-installdir=DIR Install Clixon yang files here (default: ${prefix}/share/clixon)
- --with-std-yang-installdir=DIR Install standard yang files here (default: ${prefix}/share/clixon)
+ --with-opt-yang-installdir=DIR Install standard yang files here (default: ${prefix}/share/clixon)
Some influential environment variables:
CC C compiler command
@@ -4247,22 +4247,22 @@ fi
# Disable/enable standard Yang files.
# If enable - include yang/standard/*.yang in clixon yang files (default)
# If disable - get standard yang files from elsewhere
-# Check whether --enable-stdyangs was given.
-if test "${enable_stdyangs+set}" = set; then :
- enableval=$enable_stdyangs;
+# Check whether --enable-optyangs was given.
+if test "${enable_optyangs+set}" = set; then :
+ enableval=$enable_optyangs;
if test "$enableval" = no; then
- enable_stdyangs=no
+ enable_optyangs=no
else
- enable_stdyangs=yes
+ enable_optyangs=yes
fi
else
- enable_stdyangs=yes
+ enable_optyangs=no
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: stdyangs is $enable_stdyangs" >&5
-$as_echo "stdyangs is $enable_stdyangs" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: optyangs is $enable_optyangs" >&5
+$as_echo "optyangs is $enable_optyangs" >&6; }
# Experimental: Curl publish notification stream to eg Nginx nchan.
# Check whether --enable-publish was given.
@@ -4933,8 +4933,8 @@ $as_echo "Have getsockopt SO_PEERCRED" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# YANG_INSTALLDIR is where clixon installs the Clixon yang files
-# (the files in in yang/clixon)
+# YANG_INSTALLDIR is where clixon installs the Clixon yang files and mandatory
+# standard yang files: the files in in yang/clixon and yang/mandatory
# Each application designer may need to place YANG_INSTALLDIR in their config:
# $YANG_INSTALLDIR
@@ -4950,22 +4950,22 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Clixon yang files are installed in ${YANG_INSTALLDIR}" >&5
$as_echo "Clixon yang files are installed in ${YANG_INSTALLDIR}" >&6; }
-# STD_YANG_INSTALLDIR is where clixon installs standard yang files
-# (the files in in yang/standard)
+# OPT_YANG_INSTALLDIR is where clixon installs standard yang files
+# ( the files in in yang/standard)
# that Clixon needs to run (or examples rely on). These may be retreived from
# elsewhere (eg yangmodels repo)
-# Check whether --with-std-yang-installdir was given.
-if test "${with_std_yang_installdir+set}" = set; then :
- withval=$with_std_yang_installdir; STD_YANG_INSTALLDIR="$withval"
+# Check whether --with-opt-yang-installdir was given.
+if test "${with_opt_yang_installdir+set}" = set; then :
+ withval=$with_opt_yang_installdir; OPT_YANG_INSTALLDIR="$withval"
else
- STD_YANG_INSTALLDIR="${prefix}/share/clixon"
+ OPT_YANG_INSTALLDIR="${prefix}/share/clixon"
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Standard yang files are installed in ${STD_YANG_INSTALLDIR}" >&5
-$as_echo "Standard yang files are installed in ${STD_YANG_INSTALLDIR}" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Optional yang files are installed in ${OPT_YANG_INSTALLDIR} (if enabled)" >&5
+$as_echo "Optional yang files are installed in ${OPT_YANG_INSTALLDIR} (if enabled)" >&6; }
# Default location for config file
@@ -4976,7 +4976,7 @@ _ACEOF
-ac_config_files="$ac_config_files Makefile lib/Makefile lib/src/Makefile lib/clixon/Makefile apps/Makefile apps/cli/Makefile apps/backend/Makefile apps/netconf/Makefile apps/restconf/Makefile include/Makefile etc/Makefile etc/clixonrc example/Makefile example/main/Makefile example/hello/Makefile extras/rpm/Makefile docker/Makefile docker/main/Makefile docker/base/Makefile util/Makefile yang/Makefile yang/clixon/Makefile yang/standard/Makefile doc/Makefile test/Makefile"
+ac_config_files="$ac_config_files Makefile lib/Makefile lib/src/Makefile lib/clixon/Makefile apps/Makefile apps/cli/Makefile apps/backend/Makefile apps/netconf/Makefile apps/restconf/Makefile include/Makefile etc/Makefile etc/clixonrc example/Makefile example/main/Makefile example/hello/Makefile extras/rpm/Makefile docker/Makefile docker/main/Makefile docker/base/Makefile util/Makefile yang/Makefile yang/clixon/Makefile yang/mandatory/Makefile yang/optional/Makefile doc/Makefile test/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -5692,7 +5692,8 @@ do
"util/Makefile") CONFIG_FILES="$CONFIG_FILES util/Makefile" ;;
"yang/Makefile") CONFIG_FILES="$CONFIG_FILES yang/Makefile" ;;
"yang/clixon/Makefile") CONFIG_FILES="$CONFIG_FILES yang/clixon/Makefile" ;;
- "yang/standard/Makefile") CONFIG_FILES="$CONFIG_FILES yang/standard/Makefile" ;;
+ "yang/mandatory/Makefile") CONFIG_FILES="$CONFIG_FILES yang/mandatory/Makefile" ;;
+ "yang/optional/Makefile") CONFIG_FILES="$CONFIG_FILES yang/optional/Makefile" ;;
"doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
"test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
diff --git a/configure.ac b/configure.ac
index c3cd8d3e..e82bf576 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,7 +89,7 @@ AC_SUBST(CLIXON_DEFAULT_CONFIG)
AC_SUBST(LIBS)
AC_SUBST(SH_SUFFIX)
AC_SUBST(with_restconf) # If yes, compile apps/restconf
-AC_SUBST(enable_stdyangs)
+AC_SUBST(enable_optyangs)
AC_SUBST(wwwdir,/www-data)
AC_SUBST(wwwuser,www-data)
@@ -151,16 +151,16 @@ fi
# Disable/enable standard Yang files.
# If enable - include yang/standard/*.yang in clixon yang files (default)
# If disable - get standard yang files from elsewhere
-AC_ARG_ENABLE(stdyangs, AS_HELP_STRING([--disable-stdyangs],[Include standard yang files in clixon install, default: yes]),[
+AC_ARG_ENABLE(optyangs, AS_HELP_STRING([--enable-optyangs],[Include optional yang files for examples and testing in clixon install, default: no]),[
if test "$enableval" = no; then
- enable_stdyangs=no
+ enable_optyangs=no
else
- enable_stdyangs=yes
+ enable_optyangs=yes
fi
],
- [ enable_stdyangs=yes])
+ [ enable_optyangs=no])
-AC_MSG_RESULT(stdyangs is $enable_stdyangs)
+AC_MSG_RESULT(optyangs is $enable_optyangs)
# Experimental: Curl publish notification stream to eg Nginx nchan.
AC_ARG_ENABLE(publish, AS_HELP_STRING([--enable-publish],[Enable publish of notification streams using SSE and curl]),[
@@ -229,8 +229,8 @@ AC_CHECK_FUNCS(inet_aton sigaction sigvec strlcpy strsep strndup alphasort versi
AC_TRY_COMPILE([#include ], [getsockopt(1, SOL_SOCKET, SO_PEERCRED, 0, 0);], [AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have getsockopt SO_PEERCRED])
AC_MSG_RESULT(Have getsockopt SO_PEERCRED)])
-# YANG_INSTALLDIR is where clixon installs the Clixon yang files
-# (the files in in yang/clixon)
+# YANG_INSTALLDIR is where clixon installs the Clixon yang files and mandatory
+# standard yang files: the files in in yang/clixon and yang/mandatory
# Each application designer may need to place YANG_INSTALLDIR in their config:
# $YANG_INSTALLDIR
AC_ARG_WITH(yang-installdir,
@@ -241,17 +241,17 @@ AC_ARG_WITH(yang-installdir,
AC_SUBST(YANG_INSTALLDIR)
AC_MSG_RESULT(Clixon yang files are installed in ${YANG_INSTALLDIR})
-# STD_YANG_INSTALLDIR is where clixon installs standard yang files
-# (the files in in yang/standard)
+# OPT_YANG_INSTALLDIR is where clixon installs standard yang files
+# ( the files in in yang/standard)
# that Clixon needs to run (or examples rely on). These may be retreived from
# elsewhere (eg yangmodels repo)
-AC_ARG_WITH(std-yang-installdir,
- [ --with-std-yang-installdir=DIR Install standard yang files here (default: ${prefix}/share/clixon) ],
- [STD_YANG_INSTALLDIR="$withval"],
- [STD_YANG_INSTALLDIR="${prefix}/share/clixon"]
+AC_ARG_WITH(opt-yang-installdir,
+ [ --with-opt-yang-installdir=DIR Install optional yang files here (default: ${prefix}/share/clixon) ],
+ [OPT_YANG_INSTALLDIR="$withval"],
+ [OPT_YANG_INSTALLDIR="${prefix}/share/clixon"]
)
-AC_SUBST(STD_YANG_INSTALLDIR)
-AC_MSG_RESULT(Standard yang files are installed in ${STD_YANG_INSTALLDIR})
+AC_SUBST(OPT_YANG_INSTALLDIR)
+AC_MSG_RESULT(Optional yang files are installed in ${OPT_YANG_INSTALLDIR} (if enabled))
# Default location for config file
AC_DEFINE_UNQUOTED(CLIXON_DEFAULT_CONFIG,"${CLIXON_DEFAULT_CONFIG}",[Location for apps to find default config file])
@@ -280,7 +280,8 @@ AC_OUTPUT(Makefile
util/Makefile
yang/Makefile
yang/clixon/Makefile
- yang/standard/Makefile
+ yang/mandatory/Makefile
+ yang/optional/Makefile
doc/Makefile
test/Makefile
)
diff --git a/doc/FAQ.md b/doc/FAQ.md
index 6c0cccc1..ae97a24a 100644
--- a/doc/FAQ.md
+++ b/doc/FAQ.md
@@ -77,12 +77,14 @@ One of the examples is [a hello world example](../example/hello). Please start w
## How do you build and install Clixon?
Clixon:
```
- ./configure;
+ ./configure --enable-optyang;
make;
sudo make install;
sudo make install-include
```
-The main example:
+(note: optyang enable only if you need to run the main example, otherwise it is not necessary).
+
+The main example:
```
cd example;
make;
diff --git a/docker/main/Dockerfile b/docker/main/Dockerfile
index dfa05546..630dc43b 100644
--- a/docker/main/Dockerfile
+++ b/docker/main/Dockerfile
@@ -62,7 +62,7 @@ RUN adduser -D -H www-data
RUN apk add --update nginx
# Configure, build and install clixon
-RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --with-wwwuser=www-data
+RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --with-wwwuser=www-data --enable-optyangs
RUN make
RUN make install
RUN make install-include
diff --git a/example/main/README.md b/example/main/README.md
index b5101aca..d5e98d50 100644
--- a/example/main/README.md
+++ b/example/main/README.md
@@ -30,13 +30,14 @@ This directory contains a Clixon example used primarily for testing. It can be u
* `example_netconf.c` Netconf callback plugin
* `Makefile.in` Example makefile where plugins are built and installed
-
## Compile and run
Before you start,
+* You must configure with: `--enable-optyangs` to run the main example.
* Make [group setup](../../doc/FAQ.md#do-i-need-to-setup-anything-important)
* Setup [restconf](../../doc/FAQ.md#how-do-i-use-restconf)
+
```
cd example
make && sudo make install
diff --git a/lib/src/clixon_xml.c b/lib/src/clixon_xml.c
index e948abde..f7dcf0d3 100644
--- a/lib/src/clixon_xml.c
+++ b/lib/src/clixon_xml.c
@@ -151,7 +151,6 @@ static const map_str2int xsmap[] = {
{NULL, -1}
};
-
/*! Translate from xml type in enum form to string keyword
* @param[in] type Xml type
* @retval str String keyword
diff --git a/lib/src/clixon_xml_sort.c b/lib/src/clixon_xml_sort.c
index 74e33291..1ee212f0 100644
--- a/lib/src/clixon_xml_sort.c
+++ b/lib/src/clixon_xml_sort.c
@@ -617,8 +617,8 @@ xml_insert2(cxobj *xp,
xc = xml_child_i(xp, mid);
if ((yc = xml_spec(xc)) == NULL){
if (xml_type(xc) != CX_ELMNT)
- clicon_err(OE_XML, 0, "No spec found %s (wrong xml type:%d)",
- xml_name(xc), xml_type(xc));
+ clicon_err(OE_XML, 0, "No spec found %s (wrong xml type:%s)",
+ xml_name(xc), xml_type2str(xml_type(xc)));
else
clicon_err(OE_XML, 0, "No spec found %s", xml_name(xc));
goto done;
diff --git a/yang/Makefile.in b/yang/Makefile.in
index d9ee3301..f816c8c9 100644
--- a/yang/Makefile.in
+++ b/yang/Makefile.in
@@ -37,12 +37,13 @@ prefix = @prefix@
bindir = @bindir@
includedir = @includedir@
datarootdir = @datarootdir@
-enable_stdyangs = @enable_stdyangs@
+enable_optyangs = @enable_optyangs@
SUBDIRS = clixon
+SUBDIRS += mandatory
# See configure.ac
-ifeq ($(enable_stdyangs),yes)
-SUBDIRS += standard
+ifeq ($(enable_optyangs),yes)
+SUBDIRS += optional
endif
.PHONY: all clean depend install $(SUBDIRS)
diff --git a/yang/README.md b/yang/README.md
new file mode 100644
index 00000000..89accf31
--- /dev/null
+++ b/yang/README.md
@@ -0,0 +1,14 @@
+# Yang files
+
+There are three classes of Yang files
+ * Clixon yang files.
+ * Mandatory: "Standard" yang files necessary for clixon lib/client/backend to run
+ * Optional: "Standard" yang files for examples and tests
+
+The first two (clixon and mandatory) are always installed. If you want
+to change where the are installed, configure with: `--with-yang-installdir=DIR`
+
+The third (optional) is only installed if configure flag
+`--enable-optyang` is set. Further, the optional yang files are
+installed in `--with-opt-yang-installdir=DIR` if given, otherwise in
+the same dir as the mandatory.
\ No newline at end of file
diff --git a/yang/clixon/Makefile.in b/yang/clixon/Makefile.in
index d924bf37..b199ba2d 100644
--- a/yang/clixon/Makefile.in
+++ b/yang/clixon/Makefile.in
@@ -38,7 +38,7 @@ bindir = @bindir@
includedir = @includedir@
datarootdir = @datarootdir@
-# See also STD_YANG_INSTALLDIR for the standard yang files
+# See also OPT_YANG_INSTALLDIR for the standard yang files
YANG_INSTALLDIR = @YANG_INSTALLDIR@
YANGSPECS = clixon-config@2019-09-11.yang
diff --git a/yang/clixon/clixon-config@2019-09-11.yang b/yang/clixon/clixon-config@2019-09-11.yang
index 7dedec8f..6cfd354f 100644
--- a/yang/clixon/clixon-config@2019-09-11.yang
+++ b/yang/clixon/clixon-config@2019-09-11.yang
@@ -358,7 +358,7 @@ module clixon-config {
type string;
default "base";
description
- "Startup CLI mode. This should match a CLICON_MODE set in
+ "Startup CLI mode. This should match a CLICON_MODE variable set in
one of the clispec files";
}
leaf CLICON_CLI_GENMODEL {
diff --git a/yang/standard/Makefile.in b/yang/mandatory/Makefile.in
similarity index 81%
rename from yang/standard/Makefile.in
rename to yang/mandatory/Makefile.in
index 44909ddb..eb7f016c 100644
--- a/yang/standard/Makefile.in
+++ b/yang/mandatory/Makefile.in
@@ -39,20 +39,15 @@ includedir = @includedir@
datarootdir = @datarootdir@
# See also YANG_INSTALLDIR for the clixon-specific yang files
-STD_YANG_INSTALLDIR = @STD_YANG_INSTALLDIR@
+YANG_INSTALLDIR = @YANG_INSTALLDIR@
-YANGSPECS = iana-if-type@2014-05-08.yang
-YANGSPECS += ietf-interfaces@2018-02-20.yang
-YANGSPECS += ietf-yang-types@2013-07-15.yang
-YANGSPECS += ietf-ip@2014-06-16.yang
-YANGSPECS += ietf-inet-types@2013-07-15.yang
-YANGSPECS += ietf-routing@2018-03-13.yang
-YANGSPECS += ietf-yang-library@2016-06-21.yang
+YANGSPECS = ietf-inet-types@2013-07-15.yang
YANGSPECS += ietf-netconf@2011-06-01.yang
YANGSPECS += ietf-netconf-acm@2018-02-14.yang
YANGSPECS += ietf-restconf@2017-01-26.yang
YANGSPECS += ietf-restconf-monitoring@2017-01-26.yang
-YANGSPECS += ietf-netconf-monitoring@2010-10-04.yang
+YANGSPECS += ietf-yang-library@2016-06-21.yang
+YANGSPECS += ietf-yang-types@2013-07-15.yang
all:
@@ -62,11 +57,11 @@ distclean: clean
rm -f Makefile *~ .depend
install: $(YANGSPECS)
- install -d -m 0755 $(DESTDIR)$(STD_YANG_INSTALLDIR)
- install -m 0644 $(YANGSPECS) $(DESTDIR)$(STD_YANG_INSTALLDIR)
+ install -d -m 0755 $(DESTDIR)$(YANG_INSTALLDIR)
+ install -m 0644 $(YANGSPECS) $(DESTDIR)$(YANG_INSTALLDIR)
uninstall:
- (cd $(DESTDIR)$(STD_YANG_INSTALLDIR); rm -rf *.yang)
+ (cd $(DESTDIR)$(YANG_INSTALLDIR); rm -rf *.yang)
install-include:
diff --git a/yang/standard/ietf-inet-types@2013-07-15.yang b/yang/mandatory/ietf-inet-types@2013-07-15.yang
similarity index 100%
rename from yang/standard/ietf-inet-types@2013-07-15.yang
rename to yang/mandatory/ietf-inet-types@2013-07-15.yang
diff --git a/yang/standard/ietf-netconf-acm@2018-02-14.yang b/yang/mandatory/ietf-netconf-acm@2018-02-14.yang
similarity index 100%
rename from yang/standard/ietf-netconf-acm@2018-02-14.yang
rename to yang/mandatory/ietf-netconf-acm@2018-02-14.yang
diff --git a/yang/standard/ietf-netconf@2011-06-01.yang b/yang/mandatory/ietf-netconf@2011-06-01.yang
similarity index 100%
rename from yang/standard/ietf-netconf@2011-06-01.yang
rename to yang/mandatory/ietf-netconf@2011-06-01.yang
diff --git a/yang/standard/ietf-restconf-monitoring@2017-01-26.yang b/yang/mandatory/ietf-restconf-monitoring@2017-01-26.yang
similarity index 100%
rename from yang/standard/ietf-restconf-monitoring@2017-01-26.yang
rename to yang/mandatory/ietf-restconf-monitoring@2017-01-26.yang
diff --git a/yang/standard/ietf-restconf@2017-01-26.yang b/yang/mandatory/ietf-restconf@2017-01-26.yang
similarity index 100%
rename from yang/standard/ietf-restconf@2017-01-26.yang
rename to yang/mandatory/ietf-restconf@2017-01-26.yang
diff --git a/yang/standard/ietf-yang-library@2016-06-21.yang b/yang/mandatory/ietf-yang-library@2016-06-21.yang
similarity index 100%
rename from yang/standard/ietf-yang-library@2016-06-21.yang
rename to yang/mandatory/ietf-yang-library@2016-06-21.yang
diff --git a/yang/standard/ietf-yang-types@2013-07-15.yang b/yang/mandatory/ietf-yang-types@2013-07-15.yang
similarity index 100%
rename from yang/standard/ietf-yang-types@2013-07-15.yang
rename to yang/mandatory/ietf-yang-types@2013-07-15.yang
diff --git a/yang/optional/Makefile.in b/yang/optional/Makefile.in
new file mode 100644
index 00000000..c95bb922
--- /dev/null
+++ b/yang/optional/Makefile.in
@@ -0,0 +1,70 @@
+#
+# ***** BEGIN LICENSE BLOCK *****
+#
+# Copyright (C) 2009-2019 Olof Hagsand and Benny Holmgren
+#
+# This file is part of CLIXON
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# the GNU General Public License Version 3 or later (the "GPL"),
+# in which case the provisions of the GPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of the GPL, and not to allow others to
+# use your version of this file under the terms of Apache License version 2,
+# indicate your decision by deleting the provisions above and replace them with
+# the notice and other provisions required by the GPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the Apache License version 2 or the GPL.
+#
+# ***** END LICENSE BLOCK *****
+#
+VPATH = @srcdir@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+prefix = @prefix@
+bindir = @bindir@
+includedir = @includedir@
+datarootdir = @datarootdir@
+
+# See also OPT_YANG_INSTALLDIR for optionali yang files
+OPT_YANG_INSTALLDIR = @OPT_YANG_INSTALLDIR@
+
+YANGSPECS = iana-if-type@2014-05-08.yang
+YANGSPECS += ietf-interfaces@2018-02-20.yang
+YANGSPECS += ietf-ip@2014-06-16.yang
+YANGSPECS += ietf-netconf-monitoring@2010-10-04.yang
+YANGSPECS += ietf-routing@2018-03-13.yang
+
+all:
+
+clean:
+
+distclean: clean
+ rm -f Makefile *~ .depend
+
+install: $(YANGSPECS)
+ install -d -m 0755 $(DESTDIR)$(OPT_YANG_INSTALLDIR)
+ install -m 0644 $(YANGSPECS) $(DESTDIR)$(OPT_YANG_INSTALLDIR)
+
+uninstall:
+ (cd $(DESTDIR)$(OPT_YANG_INSTALLDIR); rm -rf *.yang)
+
+install-include:
+
+depend:
+
+
+#include .depend
+
diff --git a/yang/standard/iana-if-type@2014-05-08.yang b/yang/optional/iana-if-type@2014-05-08.yang
similarity index 100%
rename from yang/standard/iana-if-type@2014-05-08.yang
rename to yang/optional/iana-if-type@2014-05-08.yang
diff --git a/yang/standard/ietf-interfaces@2018-02-20.yang b/yang/optional/ietf-interfaces@2018-02-20.yang
similarity index 100%
rename from yang/standard/ietf-interfaces@2018-02-20.yang
rename to yang/optional/ietf-interfaces@2018-02-20.yang
diff --git a/yang/standard/ietf-ip@2014-06-16.yang b/yang/optional/ietf-ip@2014-06-16.yang
similarity index 100%
rename from yang/standard/ietf-ip@2014-06-16.yang
rename to yang/optional/ietf-ip@2014-06-16.yang
diff --git a/yang/standard/ietf-netconf-monitoring@2010-10-04.yang b/yang/optional/ietf-netconf-monitoring@2010-10-04.yang
similarity index 100%
rename from yang/standard/ietf-netconf-monitoring@2010-10-04.yang
rename to yang/optional/ietf-netconf-monitoring@2010-10-04.yang
diff --git a/yang/standard/ietf-routing@2018-03-13.yang b/yang/optional/ietf-routing@2018-03-13.yang
similarity index 100%
rename from yang/standard/ietf-routing@2018-03-13.yang
rename to yang/optional/ietf-routing@2018-03-13.yang
diff --git a/yang/standard/ietf-module-revision@2018-08-08.yang b/yang/standard/ietf-module-revision@2018-08-08.yang
deleted file mode 100644
index b7b6b7a1..00000000
--- a/yang/standard/ietf-module-revision@2018-08-08.yang
+++ /dev/null
@@ -1,392 +0,0 @@
-module ietf-module-revision {
- yang-version 1.1;
- namespace "urn:ietf:params:xml:ns:yang:ietf-module-revision";
- prefix ml;
-
- import ietf-yang-library {
- prefix yanglib;
- }
- import ietf-yang-types {
- prefix yang;
- }
-
- organization
- "IETF Network Modeling (NETMOD) Working Group";
- contact
- "WG Web:
-
- WG List:
-
- Author: Qin Wu
-
- Zitao Wang
- ";
- description
- "This YANG module defines an module log.";
-
- revision 2018-08-08 {
- description
- "Initial revision.";
- reference "RFC XXXX: Using Metadata with YANG for Module revisions";
- }
-
- identity operation-type {
- description
- "Abstract base identity for the operation type ";
- }
-
- identity create {
- base operation-type;
- description
- "Denotes create new data nodes";
- }
-
- identity delete {
- base operation-type;
- description
- "Denotes delete the target node";
- }
-
- identity move {
- base operation-type;
- description
- "Denote move the target node.";
- }
-
- identity modify {
- base operation-type;
- description
- "Denote modify the target data node.";
- }
-
- identity statement-type {
- description
- "Base identity for statement type";
- }
-
- identity feature-statement {
- base statement-type;
- description
- "feature statement, if this type be chose, it means that the
- feature or if-feature statement been modified";
- }
- identity identity-statement {
- base statement-type;
- description
- "identity statement, if this type be chose, it means that the
- identity statement been modified, for example, add new identity, etc.";
- }
-
- identity grouping-statement {
- base statement-type;
- description
- "grouping statement, if this type be chose, it means that the grouping
- statement been modified.";
- }
-
- identity typedef-statement {
- base statement-type;
- description
- "typedef statement, if this type be chose, it means that the typedef
- statement been modified.";
- }
-
- identity augment-statement {
- base statement-type;
- description
- "augment statement, if this type be chose, it means that the augment
- statement been modified.";
- }
-
- identity rpc-statement {
- base statement-type;
- description
- "rpc statement, if this type be chose, it means that the rpc
- statement been modified.";
- }
-
- identity notification-statement {
- base statement-type;
- description
- "notification statement, if this type be chose, it means that the notification
- statement been modified.";
- }
-
- extension purpose {
- argument name;
- description
- "The purpose can be used to mark the data nodes change purpose.
- The name argument can be specified in the following recommended mode
- - bug-fix, which can help user to understand the data nodes' changes present bug fix,
- - new-function, which can help user to understand the data nodes' changes present new function,
- - nmda-conform, which can help user to understand the data nodes' changes conform to NMDA,
-
- and note that the user can argument the purpose name according to their sepcific requirements.";
- }
-
- grouping data-definition {
- container data-definition {
- leaf target-node {
- type yang:xpath1.0;
- mandatory true;
- description
- "Identifies the target data node for update.
- Notice that, if the update-type equal to move or delete,
- this target-node must point to the data node of old version.
- \t
- For example, suppose the target node is a YANG leaf named a,
- and the previous version is:
- \t
- container foo {
- leaf a { type string; }
- leaf b { type int32; }
- }
- \t
- the new version is:
- container foo {
- leaf b {type int32;}
- }
- \t
- Therefore, the targe-node should be /foo/a.";
- }
- leaf location-point {
- type yang:xpath1.0;
- description
- "Identifies the location point where the updates happened.";
- }
- leaf where {
- when "derived-from-or-self(../../change-operation, 'move')" {
- description
- "This leaf only applies for 'move'
- updates.";
- }
- type enumeration {
- enum "before" {
- description
- "Insert or move a data node before the data resource
- identified by the 'point' parameter.";
- }
- enum "after" {
- description
- "Insert or move a data node after the data resource
- identified by the 'point' parameter.";
- }
- enum "first" {
- description
- "Insert or move a data node so it becomes ordered
- as the first entry.";
- }
- enum "last" {
- description
- "Insert or move a data node so it becomes ordered
- as the last entry.";
- }
- }
- default "last";
- description
- "Identifies where a data resource will be inserted
- or moved.";
- }
- anydata data-definition {
- when "derived-from-or-self(../../change-operation, 'modify')" {
- description
- "This nodes only be present when
- the 'change-operation' equal to 'modify'.";
- }
- description
- "This nodes used for present the definitions before updated.
- And this nodes only be present when
- the 'change-operation' equal to 'modify'.";
- }
- description
- "Container for data statement";
- }
- description
- "Grouping for data definition";
- }
-
- grouping other-statement {
- container other-statement {
- leaf statement-name {
- type identityref {
- base statement-type;
- }
- description
- "Statement name, for example, identity, feature, typedef, etc.";
- }
- anydata statement-definition {
- description
- "This nodes used for present new the definitions.";
- }
- list substatements {
- key "statement-name";
- leaf statement-name {
- type identityref {
- base statement-type;
- }
- description
- "Statement name, for example, identity, feature, typedef, etc.";
- }
- anydata substatement-definition {
- description
- "This nodes used for present new the definitions.";
- }
- description
- "List for substatements updates";
- }
- description
- "Container for header statement updates";
- }
- description
- "Grouping for header statement";
- }
-
- grouping change-log {
- list revision-change-log {
- key "index";
- leaf index {
- type uint32;
- description
- "Index for module change log";
- }
- leaf change-operation {
- type identityref {
- base operation-type;
- }
- mandatory true;
- description
- "This leaf indicate the change operation, such as create, move, delete, modify, etc.";
- }
- choice yang-statements {
- description
- "Choice for various YANG statements that have been impacted.";
- case data-definition-statement {
- uses data-definition;
- }
- case other-statement {
- uses other-statement;
- }
- }
- description
- "List for module revision change log";
- }
- description
- "Grouping for module revision change log";
- }
-
- container yang-modules {
- config false;
- list module {
- key "name revision";
- leaf name {
- type yang:yang-identifier;
- description
- "The YANG module or submodule name.";
- }
- leaf revision {
- type yanglib:revision-identifier;
- description
- "The YANG module or submodule revision date. If no revision
- statement is present in the YANG module or submodule, this
- leaf is not instantiated.";
- }
- leaf backward-compatible {
- type boolean;
- description
- "Indicates whether it is a backward compatible version.
- If this parameter is set to true, it means that this version is
- a backwards compatible version";
- }
- uses change-log;
- description
- "List for module updated log";
- }
- description
- "This container present the modules updated log.";
- }
- augment "/yanglib:yang-library/yanglib:module-set/yanglib:module" {
- description
- "Augment the yang library with backward compatibility indication.";
- leaf backward-compatible {
- type boolean;
- description
- "backward compatibility indication.";
- }
- }
- augment "/yanglib:yang-library/yanglib:module-set/yanglib:module/yanglib:submodule" {
- description
- "Augment the yang library with backward compatibility indication.";
- leaf backward-compatible {
- type boolean;
- description
- "backward compatibility indication.";
- }
- }
- rpc module-revision-change {
- description
- "Module Node change query operation.";
- input {
- leaf source-module-name {
- type yang:yang-identifier;
- mandatory true;
- description
- "The Source YANG module or submodule name.";
- }
- leaf source-revision {
- type yanglib:revision-identifier;
- description
- "The Source YANG module revision date. If no revision
- statement is present in the YANG module or submodule, this
- leaf is not instantiated.";
- }
- leaf target-module-name {
- type yang:yang-identifier;
- mandatory true;
- description
- "The Target YANG module or submodule name.";
- }
- leaf target-revision {
- type yanglib:revision-identifier;
- description
- "The target YANG module revision date. If no revision
- statement is present in the YANG module or submodule, this
- leaf is not instantiated.";
- }
- }
- output {
- choice status-response{
- leaf wrong-match{
- type empty;
- description
- "This leaf indicates that two modules have nothing in common.";
- }
- list data-nodes {
- key "data-node-name";
- description
- "Each entry represents a data node of a given module that
- have been changed from source revision of
- a module to target revision of the module.";
- leaf data-node-name {
- type string;
- description
- "a data node name of a given module that
- has been changed.";
- }
- leaf is-new-node {
- type boolean;
- description
- "indicate the data node is newly introduced node in the target revision.";
- }
- leaf change-operation {
- type identityref {
- base operation-type;
- }
- description
- "This leaf indicate the change operation,
- such as create, move, delete, modify, etc.";
- }
- }
- }
- }
- }
-}