Yang files reorganized into three classes: clixon, mandatory, optional

This commit is contained in:
Olof hagsand 2019-11-26 21:51:28 +01:00
parent 9575d10887
commit 0d22a8b6d0
29 changed files with 166 additions and 462 deletions

View file

@ -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)

14
yang/README.md Normal file
View file

@ -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.

View file

@ -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

View file

@ -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 {

View file

@ -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:

70
yang/optional/Makefile.in Normal file
View file

@ -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

View file

@ -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: <https://datatracker.ietf.org/wg/netmod/>
WG List: <mailto:netmod@ietf.org>
Author: Qin Wu
<mailto:bill.wu@huawei.com>
Zitao Wang
<mailto:wangzitao@huawei.com>";
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.";
}
}
}
}
}
}