Add ietf-system-capabilities and adapt all tests

This commit is contained in:
Olof hagsand 2024-07-09 17:37:14 +02:00
parent 28bede2c8f
commit ad5312d824
13 changed files with 205 additions and 29 deletions

View file

@ -126,13 +126,13 @@ function testrun()
new "get config"
if [ -z "$config" ]; then
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><running/></source><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults></get-config></rpc>" "^<rpc-reply $DEFAULTNS><data/></rpc-reply>$"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><running/></source><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">explicit</with-defaults></get-config></rpc>" "^<rpc-reply $DEFAULTNS><data/></rpc-reply>$"
else
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><running/></source><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults></get-config></rpc>" "^<rpc-reply $DEFAULTNS><data>$config</data></rpc-reply>$"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><running/></source><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">explicit</with-defaults></get-config></rpc>" "^<rpc-reply $DEFAULTNS><data>$config</data></rpc-reply>$"
fi
new "get state"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults></get></rpc>" "^<rpc-reply $DEFAULTNS><data>$state</data></rpc-reply>$"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">explicit</with-defaults></get></rpc>" "^<rpc-reply $DEFAULTNS><data>$state</data></rpc-reply>$"
}
new "test params: -f $cfg"

View file

@ -134,7 +134,7 @@ show("Show a particular state of the system"){
text("Show comparison in text"), compare_dbs("running", "candidate", "text");
}
configuration("Show configuration"), cli_show_auto_mode("candidate", "text", true, false);{
cli("Show configuration as CLI commands"), cli_show_auto_mode("candidate", "cli", true, false, "report-all", "set ");
cli("Show configuration as CLI commands"), cli_show_auto_mode("candidate", "cli", true, false, "explicit", "set ");
xml("Show configuration as XML"), cli_show_auto_mode("candidate", "xml", true, false);
text("Show configuration as TEXT"), cli_show_auto_mode("candidate", "text", true, false);
}
@ -194,8 +194,8 @@ expectpart "$($clixon_cli -1 -f $cfg show conf cli)" 0 "^$"
new "cli configure set interfaces"
expectpart "$($clixon_cli -1 -f $cfg set interfaces interface eth/0/0)" 0 "^$"
new "cli show configuration"
expectpart "$($clixon_cli -1 -f $cfg show conf cli)" 0 "^set interfaces interface eth/0/0" "^set interfaces interface eth/0/0 enabled true"
new "cli show configuration XX"
expectpart "$($clixon_cli -1 -f $cfg show conf cli)" 0 "^set interfaces interface eth/0/0"
new "cli configure using encoded chars data <&"
# problems in changing to expectpart with escapes
@ -247,7 +247,7 @@ new "cli load"
expectpart "$($clixon_cli -1 -f $cfg -l o load $dir/foo cli)" 0 "^$"
new "cli check load"
expectpart "$($clixon_cli -1 -f $cfg -l o show conf cli)" 0 "interfaces interface eth/0/0 ipv4 enabled true"
expectpart "$($clixon_cli -1 -f $cfg -l o show conf cli)" 0 "interfaces interface eth/0/0 ipv4"
new "cli debug set"
expectpart "$($clixon_cli -1 -f $cfg -l o debug cli 1)" 0 "^$"

View file

@ -73,7 +73,7 @@ commit("Commit the changes"), cli_commit();
show("Show a particular state of the system"){
version("Show version"), cli_show_version("candidate", "text", "/");
configuration("Show configuration"), cli_show_auto_mode("candidate", "xml", true, false);{
@|show, cli_show_auto_mode("candidate", "xml", true, false, "report-all");
@|show, cli_show_auto_mode("candidate", "xml", true, false);
@datamodelshow, cli_show_auto("candidate", "xml", true, false, "report-all", "set ", true);
}
autocli("Generated tree") @datamodelshow, cli_show_auto("candidate", "xml", true, false, "report-all");

View file

@ -124,13 +124,13 @@ new "wait backend"
wait_backend
new "Default value expected: interval=30"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data><transfer xmlns=\"urn:example:transfer\"><interval>30</interval></transfer></data></rpc-reply>"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source><filter type=\"xpath\" select=\"/tr:transfer\" xmlns:tr=\"urn:example:transfer\"/><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data><transfer xmlns=\"urn:example:transfer\"><interval>30</interval></transfer></data></rpc-reply>"
new "Set transfer/daily"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><transfer xmlns=\"urn:example:transfer\"><daily/></transfer></config></edit-config></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"
new "Default value expected: time-of-day=01:00"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data><transfer xmlns=\"urn:example:transfer\"><daily/><time-of-day>01.00</time-of-day></transfer></data></rpc-reply>"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source><filter type=\"xpath\" select=\"/tr:transfer\" xmlns:tr=\"urn:example:transfer\"/><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data><transfer xmlns=\"urn:example:transfer\"><daily/><time-of-day>01.00</time-of-day></transfer></data></rpc-reply>"
new "Set list element transfer container"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><li xmlns=\"urn:example:transfer\"><x>42</x></li></config></edit-config></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"

View file

@ -139,7 +139,7 @@ new "get config"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data/></rpc-reply>"
new "get config(report-all)"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults><source><candidate/></source></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data>$XML</data></rpc-reply>"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults><source><candidate/></source></get-config></rpc>" "<rpc-reply $DEFAULTNS><data>$XML"
new "Change default value r1"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><r1 xmlns=\"urn:example:clixon\">99</r1></config></edit-config></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"
@ -157,7 +157,7 @@ new "get config"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data/></rpc-reply>"
new "get config(report-all)"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults><source><candidate/></source></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data>$XML</data></rpc-reply>"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults><source><candidate/></source></get-config></rpc>" "<rpc-reply $DEFAULTNS><data>$XML"
new "Set x list element"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><xs-config xmlns=\"urn:example:clixon\"><x><name>a</name></x></xs-config></config></edit-config></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"
@ -166,7 +166,7 @@ new "get config (should not contain y/inside+outside)"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data><xs-config xmlns=\"urn:example:clixon\"><x><name>a</name></x></xs-config></data></rpc-reply>"
new "get config(report-all) (should contain y/inside+outside)"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults><source><candidate/></source></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data>$XML<xs-config xmlns=\"urn:example:clixon\"><x><name>a</name><y><inside>false</inside></y><outside>false</outside></x></xs-config></data></rpc-reply>"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults><source><candidate/></source></get-config></rpc>" "<rpc-reply $DEFAULTNS><data>$XML<xs-config xmlns=\"urn:example:clixon\"><x><name>a</name><y><inside>false</inside></y><outside>false</outside></x></xs-config>"
# Set s3 leaf to 99 triggering when condition for default values
new "Set s3 to 99"
@ -220,7 +220,7 @@ expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS>
new "get(report-all) startup config"
# Should have all defaults, except r1 that is set to 99
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults><source><candidate/></source></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data>$XML</data></rpc-reply>"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults><source><candidate/></source></get-config></rpc>" "<rpc-reply $DEFAULTNS><data>$XML"
# permission kludges
sudo chmod 666 $dir/running_db
@ -283,7 +283,7 @@ new "get startup config with presence"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data><p4 xmlns=\"urn:example:clixon\"/></data></rpc-reply>"
new "get(report-all) startup config with presence"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults><source><candidate/></source></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data>$XML</data></rpc-reply>"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults><source><candidate/></source></get-config></rpc>" "<rpc-reply $DEFAULTNS><data>$XML"
if [ $BE -ne 0 ]; then
new "Kill backend"
@ -318,7 +318,7 @@ new "get startup config with list default"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data><xs-config xmlns=\"urn:example:clixon\"><x><name>a</name></x></xs-config></data></rpc-reply>"
new "get(report-all) startup config with list default"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults><source><candidate/></source></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data>$XML<xs-config xmlns=\"urn:example:clixon\"><x><name>a</name><y><inside>false</inside></y><outside>false</outside></x></xs-config></data></rpc-reply>"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults><source><candidate/></source></get-config></rpc>" "<rpc-reply $DEFAULTNS><data>$XML<xs-config xmlns=\"urn:example:clixon\"><x><name>a</name><y><inside>false</inside></y><outside>false</outside></x></xs-config>"
if [ $BE -ne 0 ]; then
new "Kill backend"

View file

@ -299,7 +299,7 @@ new "netconf get replaced config"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data><interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\"><interface><name>eth&amp;</name><type>t&lt;&gt;</type></interface><interface xmlns:ex=\"urn:example:clixon\"><name>eth1</name><type>ex:eth</type></interface><interface xmlns:ex=\"urn:example:clixon\"><name>eth2</name><type>ex:eth</type></interface></interfaces></data></rpc-reply>"
new "netconf get replaced config (report-all)"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data><interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\"><interface><name>eth&amp;</name><type>t&lt;&gt;</type><enabled>true</enabled></interface><interface xmlns:ex=\"urn:example:clixon\"><name>eth1</name><type>ex:eth</type><enabled>true</enabled></interface><interface xmlns:ex=\"urn:example:clixon\"><name>eth2</name><type>ex:eth</type><enabled>true</enabled></interface></interfaces></data></rpc-reply>"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults></get-config></rpc>" "<rpc-reply $DEFAULTNS><data><interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\"><interface><name>eth&amp;</name><type>t&lt;&gt;</type><enabled>true</enabled></interface><interface xmlns:ex=\"urn:example:clixon\"><name>eth1</name><type>ex:eth</type><enabled>true</enabled></interface><interface xmlns:ex=\"urn:example:clixon\"><name>eth2</name><type>ex:eth</type><enabled>true</enabled></interface></interfaces>"
new "cli show configuration eth& - encoding tests"
expectpart "$($clixon_cli -1 -f $cfg show conf)" 0 "interfaces interface eth& type t<>

View file

@ -96,7 +96,7 @@ new "Set local-definition"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><certificate xmlns=\"urn:example:clixon\"><local-definition/></certificate></config></edit-config></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"
new "Get config expected foo2 refined default value (report-all)"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data><certificate xmlns=\"urn:example:clixon\"><local-definition><dummy1>foo2</dummy1></local-definition></certificate></data></rpc-reply>"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults></get-config></rpc>" "<rpc-reply $DEFAULTNS><data><certificate xmlns=\"urn:example:clixon\"><local-definition><dummy1>foo2</dummy1></local-definition></certificate>"
new "Get config expected foo2 refined default value"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data><certificate xmlns=\"urn:example:clixon\"><local-definition/></certificate></data></rpc-reply>"
@ -105,7 +105,7 @@ new "Set keystore-reference"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><certificate xmlns=\"urn:example:clixon\"><keystore-reference/></certificate></config></edit-config></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"
new "Get config expected bar2 refined default value (report-all)"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data><certificate xmlns=\"urn:example:clixon\"><keystore-reference><dummy2>bar2</dummy2></keystore-reference></certificate></data></rpc-reply>"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults></get-config></rpc>" "<rpc-reply $DEFAULTNS><data><certificate xmlns=\"urn:example:clixon\"><keystore-reference><dummy2>bar2</dummy2></keystore-reference></certificate>"
new "Get config expected bar2 refined default value"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data><certificate xmlns=\"urn:example:clixon\"><keystore-reference/></certificate></data></rpc-reply>"

View file

@ -173,7 +173,7 @@ new "restconf GET null datastore"
expectpart "$(curl $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/example:cont1)" 0 "HTTP/$HVER 404" '{"ietf-restconf:errors":{"error":{"error-type":"application","error-tag":"invalid-value","error-severity":"error","error-message":"Instance does not exist"}}}'
new "restconf PUT initial datastore"
expectpart "$(curl $CURLOPTS -X PUT -H "Content-Type: application/yang-data+json" -d '{"ietf-restconf:data":{"example:cont1":{"interface":{"name":"local0","type":"regular"}}}}' $RCPROTO://localhost/restconf/data)" 0 "HTTP/$HVER 201"
expectpart "$(curl $CURLOPTS -X PUT -H "Content-Type: application/yang-data+json" -d '{"ietf-restconf:data":{"example:cont1":{"interface":{"name":"local0","type":"regular"}}}}' $RCPROTO://localhost/restconf/data)" 0 "HTTP/$HVER 204" # 201 Created (new resource) -> 204 No Content (existing modified)
new "restconf GET datastore"
expectpart "$(curl $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/example:cont1)" 0 "HTTP/$HVER 200" '{"example:cont1":{"interface":\[{"name":"local0","type":"regular"}\]}}'

View file

@ -114,7 +114,7 @@ if [ $? -ne 0 ]; then
fi
new "check running defaults (report-all)"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults><source><running/></source></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data><a xmlns=\"urn:example:default\"><d0>88</d0><b><c>0</c><d1>foo</d1><d2>42</d2></b></a></data></rpc-reply>"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults><source><running/></source></get-config></rpc>" "<rpc-reply $DEFAULTNS><data><a xmlns=\"urn:example:default\"><d0>88</d0><b><c>0</c><d1>foo</d1><d2>42</d2></b></a>"
new "check running defaults"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><running/></source></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data><a xmlns=\"urn:example:default\"><b><c>0</c></b></a></data></rpc-reply>"
@ -129,7 +129,7 @@ new "set new list element"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><a xmlns=\"urn:example:default\"><b><c>17</c></b></a></config></edit-config></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"
new "get the list top (report-all)"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults><source><candidate/></source></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data><a xmlns=\"urn:example:default\"><d0>88</d0><b><c>17</c><d1>foo</d1><d2>42</d2></b></a></data></rpc-reply>"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults><source><candidate/></source></get-config></rpc>" "<rpc-reply $DEFAULTNS><data><a xmlns=\"urn:example:default\"><d0>88</d0><b><c>17</c><d1>foo</d1><d2>42</d2></b></a>"
new "get the list top"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data><a xmlns=\"urn:example:default\"><b><c>17</c></b></a></data></rpc-reply>"

View file

@ -113,8 +113,8 @@ function testrun()
new "netconf set match"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><table xmlns=\"urn:example:clixon\"><parameter><name>kalle</name></parameter></table></config><default-operation>merge</default-operation></edit-config></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"
new "netconf get default value set"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults></get-config></rpc>" "" "<rpc-reply $DEFAULTNS><data><table xmlns=\"urn:example:clixon\"><parameter><name>kalle</name><value>foo</value></parameter></table></data></rpc-reply>"
new "netconf get default value set X"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><get-config><source><candidate/></source><with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all</with-defaults></get-config></rpc>" "<rpc-reply $DEFAULTNS><data><table xmlns=\"urn:example:clixon\"><parameter><name>kalle</name><value>foo</value></parameter></table>"
new "netconf set non-match value expect ok"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><table xmlns=\"urn:example:clixon\"><parameter><name>kalle</name><value>42</value></parameter></table></config><default-operation>merge</default-operation></edit-config></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"

View file

@ -51,6 +51,8 @@ YANGSPECS += ietf-yang-library@2019-01-04.yang
YANGSPECS += ietf-yang-types@2013-07-15.yang
YANGSPECS += ietf-datastores@2018-02-14.yang
YANGSPECS += ietf-yang-patch@2017-02-22.yang
YANGSPECS += ietf-system-capabilities@2021-04-02.yang
# In RFC 8528 YANG Schema Mount
YANGSPECS += ietf-yang-schema-mount@2019-01-14.yang

View file

@ -21,15 +21,13 @@ module ietf-list-pagination {
reference
"RFC 7952: Defining and Using Metadata with YANG";
}
/* XXX Clixon FIXME: system-capabilities brings in NACM that breaks clixon testing
import ietf-system-capabilities {
prefix sysc;
reference
"RFC 9196: YANG Modules Describing Capabilities for Systems and
Datastore Update Notifications";
}
*/
organization
"IETF NETCONF (Network Configuration) Working Group";
@ -344,7 +342,6 @@ module ietf-list-pagination {
}
}
/* XXX Clixon FIXME: system-capabilities brings in NACM that breaks clixon testing
// Protocol-accessible nodes
augment
"/sysc:system-capabilities/sysc:datastore-capabilities"
@ -386,5 +383,4 @@ module ietf-list-pagination {
'cursor' parameter.";
}
}
*/
}

View file

@ -0,0 +1,178 @@
module ietf-system-capabilities {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-system-capabilities";
prefix sysc;
import ietf-netconf-acm {
prefix nacm;
reference
"RFC 8341: Network Configuration Access Control Model";
}
import ietf-yang-library {
prefix yanglib;
description
"This module requires ietf-yang-library to be implemented.
Revision 2019-01-04 or a revision derived from it
is REQUIRED.";
reference
"RFC8525: YANG Library";
}
organization
"IETF NETCONF (Network Configuration) Working Group";
contact
"WG Web: <https://datatracker.ietf.org/wg/netconf/>
WG List: <mailto:netconf@ietf.org>
Editor: Balazs Lengyel
<mailto:balazs.lengyel@ericsson.com>";
description
"This module specifies a structure to specify system
capabilities for a server or a publisher. System capabilities
may include capabilities of a NETCONF or RESTCONF server or a
notification publisher.
This module does not contain any specific capabilities, it only
provides a structure where containers containing the actual
capabilities are augmented in.
Capability values can be specified on system level,
datastore level (by selecting all nodes in the datastore) or
for specific data nodes of a specific datastore (and their
contained sub-trees).
Capability values specified for a specific datastore or
node-set override values specified on the system/publisher level.
To find a capability value for a specific data node in a
specific datastore the user SHALL:
1) search for a datastore-capabilities list entry for
the specific datastore. When stating a specific capability, the
relative path for any specific capability must be the same
under the system-capabilities container and under the
per-node-capabilities list: the same grouping for defining
the capabilities MUST be used.
2) If the datastore entry is found within that entry, process all
per-node-capabilities entries in the order they appear in the list.
The first entry that specifies the specific capability and has a
node-selector selecting the specific data node defines the
capability value.
3) If the capability value is not found above and the specific
capability is specified under the system-capabilities container
(outside the datastore-capabilities list), this value shall be
used.
4) If no values are found in the previous steps, the
system/publisher is not capable of providing a value. Possible
reasons are: it is unknown, the capability is changing for some
reason, there is no specified limit, etc. In this case the
system's behavior is unspecified.
The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL',
'SHALL NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED',
'NOT RECOMMENDED', 'MAY', and 'OPTIONAL' in this document
are to be interpreted as described in BCP 14 (RFC 2119)
(RFC 8174) when, and only when, they appear in all
capitals, as shown here.
Copyright (c) 2021 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject to
the license terms contained in, the Simplified BSD License set
forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(https://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC XXXX
(https://www.rfc-editor.org/info/rfcXXXX); see the RFC itself
for full legal notices.";
// RFC Ed.: replace XXXX with actual RFC number and remove this
// note.
revision 2021-04-02 {
description
"Initial version
NOTE TO RFC EDITOR:
(1)Please replace the above revision date to
the date of RFC publication when published.
(2) Please replace the date in the file name
(ietf-system-capabilities@2021-04-02.yang)
to the date of RFC publication.
(3) Please replace the following reference
with RFC number when published
(i.e. RFC xxxx).";
reference
"RFC XXXX: YANG Modules describing Capabilities for Systems
and Datastore Update Notifications";
}
container system-capabilities {
config false;
description
"System capabilities.
Capability values specified here at the system level
are valid for all datastores and are used when the
capability is not specified on the datastore level
or for specific data nodes.";
/*
* "Augmentation point for system level capabilities."
*/
list datastore-capabilities {
key "datastore";
description
"Capabilities values per datastore.
For non-NMDA servers/publishers 'config false' data is
considered as if it was part of the running datastore.";
leaf datastore {
type leafref {
path
"/yanglib:yang-library/yanglib:datastore/yanglib:name";
}
description
"The datastore for which capabilities are defined.
Only one specific datastore can be specified
e.g., ds:conventional, which represents a set of
configuration datastores, must not be used.";
}
list per-node-capabilities {
description
"Each list entry specifies capabilities for the selected
data nodes. The same capabilities apply for the data nodes
in the subtree below the selected nodes.
The system SHALL order the entries according to their
precedence. The order of the entries MUST NOT change unless
the underlying capabilities also change.
Note that the longest patch matching can be achieved
by ordering more specific matches before less
specific ones.";
choice node-selection {
description
"A method to select some or all nodes within a datastore.";
leaf node-selector {
type nacm:node-instance-identifier;
description
"Selects the data nodes for which capabilities are
specified. The special value '/' denotes all data nodes
in the datastore, consistent with the path leaf node on
page 41 [RFC8341].";
reference
"RFC 8341: Network Configuration Access Control Model";
}
}
/*
* "Augmentation point for datastore or data node level
* capabilities."
*/
}
}
}
}