* Added ordering sanity check for YANG modules and sub-modules

* If YANG sub-statements are placed in wrong order, clixon fails on error.
This commit is contained in:
Olof hagsand 2021-06-24 21:56:36 +02:00
parent caf396cbda
commit 940f4d4fb9
14 changed files with 404 additions and 374 deletions

View file

@ -52,8 +52,8 @@ cat <<EOF > $fyang2
module ietf-interfaces {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-interfaces";
revision "2019-03-04";
prefix if;
revision "2019-03-04";
identity interface-type {
description
"Base identity from which specific interface types are
@ -110,10 +110,10 @@ module example-augment {
yang-version 1.1;
namespace "urn:example:augment";
prefix mymod;
revision "2019-03-04";
import ietf-interfaces {
prefix if;
}
revision "2019-03-04";
identity some-new-iftype {
base if:interface-type;
}

View file

@ -35,8 +35,8 @@ cat <<EOF > $fyang2
module example-lib {
yang-version 1.1;
namespace "urn:example:lib";
revision "2019-03-04";
prefix lib;
revision "2019-03-04";
container global-state {
config false;
leaf gbds{
@ -81,10 +81,10 @@ module example-augment {
yang-version 1.1;
namespace "urn:example:augment";
prefix aug;
revision "2020-09-25";
import example-lib {
prefix lib;
}
revision "2020-09-25";
/* Augments global state */
augment "/lib:global-state" {
leaf gads{

View file

@ -38,8 +38,8 @@ cat <<EOF > $fyang
module example-lib {
yang-version 1.1;
namespace "urn:example:lib";
revision "2019-03-04";
prefix lib;
revision "2019-03-04";
container base-config {
}
/* No prefix */
@ -61,10 +61,10 @@ module example-augment1 {
yang-version 1.1;
namespace "urn:example:augment1";
prefix aug1;
revision "2020-09-25";
import example-lib {
prefix lib;
}
revision "2020-09-25";
/* Augments config */
augment "/lib:base-config/lib:parameter" {
container aug1{
@ -80,13 +80,13 @@ module example-augment2 {
yang-version 1.1;
namespace "urn:example:augment2";
prefix aug2;
revision "2020-09-25";
import example-lib {
prefix lib;
}
import example-augment1 {
prefix aug1;
}
revision "2020-09-25";
/* Augments config */
augment "/lib:base-config/lib:parameter/aug1:aug1" {
/* when 'lib:name="foobar" and aug:aug1="foobar"'; */

View file

@ -37,8 +37,8 @@ EOF
cat <<EOF > $fyangA
module A{
prefix a;
revision 2020-02-11;
namespace "urn:example:a";
revision 2020-02-11;
container x {
container y {
}
@ -56,11 +56,11 @@ EOF
cat <<EOF > $fyangB
module B{
prefix b;
revision 2020-02-11;
namespace "urn:example:b";
import A {
prefix "a";
}
revision 2020-02-11;
augment "/a:x/a:y" {
container z {
leaf w {

View file

@ -46,10 +46,10 @@ cat <<EOF > $fyang
module nacm-example{
yang-version 1.1;
namespace "urn:example:nacm";
prefix nacm;
import clixon-example {
prefix ex;
}
prefix nacm;
container authentication {
presence "To keep this from auto-expanding";
description "Example code for enabling www basic auth and some example

View file

@ -47,9 +47,9 @@ module example3{
EOF
cat <<EOF > $fyang2
module example2{
import example3 { prefix ex3; }
namespace "urn:example:example2";
prefix ex2;
import example3 { prefix ex3; }
grouping gr2 {
leaf talle{
type ex3:t;

View file

@ -50,9 +50,9 @@ module example3{
EOF
cat <<EOF > $fyang2
module example2{
import example3 { prefix ex3; }
namespace "urn:example:example2";
prefix ex2;
import example3 { prefix ex3; }
grouping gr2 {
leaf talle{
type ex3:t;

View file

@ -44,8 +44,8 @@ EOF
cat <<EOF > $fyang2
module A{
prefix a;
revision 2021-01-01;
namespace "urn:example:a";
revision 2021-01-01;
container upgraded{
}
}
@ -95,8 +95,8 @@ for oldyang in true false; do
cat <<EOF > $fyang1
module A{
prefix a;
revision 2016-01-01;
namespace "urn:example:a";
revision 2016-01-01;
container old{
}
}

View file

@ -38,8 +38,8 @@ fyangB=$dir/B@2019-01-01.yang
cat <<EOF > $fyangA0
module A{
prefix a;
revision 0814-01-28;
namespace "urn:example:a";
revision 0814-01-28;
leaf a0{
type string;
}
@ -53,9 +53,9 @@ EOF
cat <<EOF > $fyangA1
module A{
prefix a;
namespace "urn:example:a";
revision 2019-01-01;
revision 0814-01-28;
namespace "urn:example:a";
/* leaf a0 has been removed */
leaf a1{
description "exists in both versions";
@ -72,8 +72,8 @@ EOF
cat <<EOF > $fyangB
module B{
prefix b;
revision 2019-01-01;
namespace "urn:example:b";
revision 2019-01-01;
leaf b{
type string;
}
@ -84,8 +84,8 @@ EOF
cat <<EOF > /dev/null
module C{
prefix c;
revision 2019-01-01;
namespace "urn:example:c";
revision 2019-01-01;
leaf c{
type string;
}

View file

@ -46,8 +46,8 @@ touch $log
cat <<EOF > $fyangb
module B{
prefix b;
revision 2016-01-01;
namespace "urn:example:b";
revision 2016-01-01;
container dummy{
}
}
@ -258,8 +258,8 @@ function testall()
cat <<EOF > $fyang
module A{
prefix a;
revision 2016-01-01;
namespace "urn:example:interfaces";
revision 2016-01-01;
container dummy{
}
}

View file

@ -23,8 +23,8 @@ NEWXML='<a2 xmlns="urn:example:a">new version</a2>'
cat <<EOF > $fyangA0
module A{
prefix a;
revision 0814-01-28;
namespace "urn:example:a";
revision 0814-01-28;
leaf a0{
type string;
}
@ -38,9 +38,9 @@ EOF
cat <<EOF > $fyangA1
module A{
prefix a;
namespace "urn:example:a";
revision 2019-01-01;
revision 0814-01-28;
namespace "urn:example:a";
/* leaf a0 has been removed */
leaf a1{
description "exists in both versions";

View file

@ -22,9 +22,9 @@ fyang3=$dir/other.yang
cat <<EOF > $fyang1
module example{
prefix ex;
namespace "urn:example:clixon";
revision $NEWDATE;
revision $OLDDATE;
namespace "urn:example:clixon";
leaf newex{
type string;
}
@ -35,8 +35,8 @@ EOF
cat <<EOF > $fyang2
module example{
prefix ex;
revision $OLDDATE;
namespace "urn:example:clixon";
revision $OLDDATE;
leaf oldex{
type string;
}
@ -47,8 +47,8 @@ EOF
cat <<EOF > $fyang3
module other{
prefix oth;
revision $NEWDATE;
namespace "urn:example:clixon2";
revision $NEWDATE;
leaf other{
type string;
}