XML chanelog revision

This commit is contained in:
Olof hagsand 2019-03-25 10:42:27 +01:00
parent 3f68cca06c
commit a0abf8436e
24 changed files with 948 additions and 848 deletions

View file

@ -3,7 +3,7 @@
# Ways of changes (operation-type) are:
# create, delete, move, modify
# In this example, example-a has the following changes:
# - Create y, delete x, modify host-name, move z
# - Create y, delete x, replace host-name, move z
# example-b is completely obsoleted
# Magic line must be first in script (see README.md)
@ -16,84 +16,103 @@ changelog=$dir/changelog.xml # Module revision changelog
changelog2=$dir/changelog2.xml # From draft appendix
exa01y=$dir/example-a@2017-12-01.yang
exa20y=$dir/example-a@2017-12-20.yang
exb20y=$dir/example-b@2017-12-20.yang
# draft-wang-netmod-module-revision-management-01
# 3.2.1 and 4.1 example-a revision 2017-12-01
cat <<EOF > $exa01y
module example-a{
yang-version 1.1;
namespace "urn:example:a";
prefix "a";
module example-a{
yang-version 1.1;
namespace "urn:example:a";
prefix "a";
organization "foo.";
contact "fo@example.com";
description
"foo.";
organization "foo.";
contact "fo@example.com";
description
"foo.";
revision 2017-12-01 {
description "Initial revision.";
}
revision 2017-12-01 {
description "Initial revision.";
}
container system {
leaf a {
type string;
description "no change";
}
leaf x {
type string;
description "delete";
}
leaf host-name {
type uint32;
description "modify type";
}
leaf z {
description "move to alt";
type string;
}
}
container alt {
}
}
container system {
leaf a {
type string;
description "no change";
}
leaf x {
type string;
description "delete";
}
leaf host-name {
type uint32;
description "modify type";
}
leaf z {
description "move to alt";
type string;
}
}
container alt {
}
}
EOF
# 3.2.1 and 4.1 example-a revision 2017-12-20
cat <<EOF > $exa20y
module example-a{
yang-version 1.1;
namespace "urn:example:a";
prefix "a";
module example-a {
yang-version 1.1;
namespace "urn:example:a";
prefix "a";
organization "foo.";
contact "fo@example.com";
description
"foo.";
organization "foo.";
contact "fo@example.com";
description
"foo.";
revision 2017-12-20 {
description "Create y, delete x, modify host-name, move z";
}
revision 2017-12-01 {
description "Initial revision.";
}
container system {
leaf a {
type string;
description "no change";
}
leaf host-name {
type string;
description "modify type";
}
leaf y {
type string;
description "create";
}
}
container alt {
leaf z {
description "move to alt";
type string;
}
}
revision 2017-12-20 {
description "Create y, delete x, replace host-name, move z";
}
revision 2017-12-01 {
description "Initial revision.";
}
container system {
leaf a {
type string;
description "no change";
}
leaf host-name {
type string;
description "replace";
}
leaf y {
type string;
description "create";
}
}
container alt {
leaf z {
description "move to alt";
type string;
}
}
}
EOF
# 3.2.1 and 4.1 example-a revision 2017-12-20
cat <<EOF > $exb20y
module example-b {
yang-version 1.1;
namespace "urn:example:b";
prefix "b";
organization "foo.";
contact "fo@example.com";
description
"foo.";
revision 2017-12-20 {
description "Remove all";
}
}
EOF
@ -129,12 +148,18 @@ cat <<EOF > $dir/startup_db
<x>remove me</x>
<z>move me</z>
</system>
<alt xmlns="urn:example:a">
</alt>
<system-b xmlns="urn:example:b">
<b>Obsolete</b>
</system-b>
</config>
EOF
# Wanted new XML
XML='<system xmlns="urn:example:a"><a>dont change me</a><host-name>i am modified</host-name><y>created</y></system><alt xmlns="urn:example:a"><z>move me</z></alt>'
# Create configuration
cat <<EOF > $cfg
<clixon-config xmlns="http://clicon.org/config">
@ -147,8 +172,8 @@ cat <<EOF > $cfg
<CLICON_XMLDB_DIR>$dir</CLICON_XMLDB_DIR>
<CLICON_XMLDB_PLUGIN>/usr/local/lib/xmldb/text.so</CLICON_XMLDB_PLUGIN>
<CLICON_XMLDB_MODSTATE>true</CLICON_XMLDB_MODSTATE>
<CLICON_MODULE_REVISION>true</CLICON_MODULE_REVISION>
<CLICON_MODULE_REVISION_CHANGELOG>$changelog</CLICON_MODULE_REVISION_CHANGELOG>
<CLICON_XML_CHANGELOG>true</CLICON_XML_CHANGELOG>
<CLICON_XML_CHANGELOG_FILE>$changelog</CLICON_XML_CHANGELOG_FILE>
<CLICON_CLISPEC_DIR>/usr/local/lib/$APPNAME/clispec</CLICON_CLISPEC_DIR>
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
@ -157,52 +182,44 @@ EOF
# Changelog of example-a:
cat <<EOF > $changelog
<yang-modules xmlns="http://clicon.org/yang-changelog">
<yang-modules xmlns="http://clicon.org/xml-changelog">
<module>
<name>example-b</name>
<revision>2017-12-01</revision>
<!--obsolete-->
<namespace>urn:example:b</namespace>
<revfrom>2017-12-01</revfrom>
<revision>2017-12-20</revision>
<change-log>
<index>0001</index>
<change-operation>delete</change-operation>
<target-node>/b:system-b</target-node>
</change-log>
</module>
<module>
<name>example-a</name>
<namespace>urn:example:a</namespace>
<revfrom>2017-12-01</revfrom>
<revision>2017-12-20</revision>
<backward-compatible>true</backward-compatible>
<revision-change-log>
<change-log>
<index>0001</index>
<change-operation>create</change-operation>
<data-definition>
<target-node>
/a:system/a:y;
</target-node>
</data-definition>
</revision-change-log>
<revision-change-log>
<change-operation>insert</change-operation>
<target-node>/a:system</target-node>
<transform>&lt;y&gt;created&lt;/y&gt;</transform>
</change-log>
<change-log>
<index>0002</index>
<change-operation>delete</change-operation>
<data-definition>
<target-node>
/a:system/a:x;
</target-node>
</data-definition>
</revision-change-log>
<revision-change-log>
<target-node>/a:system/a:x</target-node>
</change-log>
<change-log>
<index>0003</index>
<change-operation>modify</change-operation>
<data-definition>
<target-node>
/a:system/a:host-name;
</target-node>
</data-definition>
</revision-change-log>
<revision-change-log>
<change-operation>replace</change-operation>
<target-node>/a:system/a:host-name</target-node>
<transform>&lt;host-name&gt;i am modified&lt;/host-name&gt;</transform>
</change-log>
<change-log>
<index>0004</index>
<change-operation>move</change-operation>
<data-definition>
<target-node>
/a:system/a:z;
</target-node>
</data-definition>
</revision-change-log>
<target-node>/a:system/a:z</target-node>
<location-node>/a:alt</location-node>
</change-log>
</module>
</yang-modules>
EOF
@ -236,7 +253,7 @@ sleep $RCWAIT
new "Check failsafe (work in progress)"
new "Check running db content"
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc><get-config><source><running/></source></get-config></rpc>]]>]]>' '^<rpc-reply><data><system xmlns="urn:example:a"><a>Failsafe</a></system></data></rpc-reply>]]>]]>$'
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc><get-config><source><running/></source></get-config></rpc>]]>]]>' "^<rpc-reply><data>$XML</data></rpc-reply>]]>]]>$"
new "Kill restconf daemon"
stop_restconf