From 07536fc8d2cd8c68209afa7e907d3626501921bf Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Mon, 19 Sep 2022 10:57:15 +0200 Subject: [PATCH] With-default cli test, use xpath to only show config tree Make all tests independent of CLICON_STREAM_DISCOVERY_RFC8040 setting --- test/test_augment_state.sh | 1 + test/test_leafref_state.sh | 1 + test/test_yang_anydata.sh | 1 + test/test_yang_with_defaults.sh | 48 +++++++++++------------ yang/clixon/clixon-config@2022-03-21.yang | 13 ++++-- 5 files changed, 36 insertions(+), 28 deletions(-) diff --git a/test/test_augment_state.sh b/test/test_augment_state.sh index 0692cb5a..582b71a6 100755 --- a/test/test_augment_state.sh +++ b/test/test_augment_state.sh @@ -27,6 +27,7 @@ cat < $cfg /usr/local/lib/$APPNAME/backend /usr/local/var/$APPNAME false + false EOF diff --git a/test/test_leafref_state.sh b/test/test_leafref_state.sh index e0f1f2ee..c7e9d0c1 100755 --- a/test/test_leafref_state.sh +++ b/test/test_leafref_state.sh @@ -40,6 +40,7 @@ cat < $cfg /usr/local/var/$APPNAME/$APPNAME.pidfile /usr/local/var/$APPNAME true + false EOF diff --git a/test/test_yang_anydata.sh b/test/test_yang_anydata.sh index 9403a0ae..c232c424 100755 --- a/test/test_yang_anydata.sh +++ b/test/test_yang_anydata.sh @@ -145,6 +145,7 @@ function testrun() $dir false $unknown + false $F $RESTCONFIG diff --git a/test/test_yang_with_defaults.sh b/test/test_yang_with_defaults.sh index f8d3c38d..df861fd1 100755 --- a/test/test_yang_with_defaults.sh +++ b/test/test_yang_with_defaults.sh @@ -131,22 +131,22 @@ show("Show a particular state of the system"){ configuration("Show configuration") xml("Show configuration and state as XML") default("With-default mode"){ - report-all, cli_show_auto_mode("candidate", "xml", false, false, "report-all"); - trim, cli_show_auto_mode("candidate", "xml", false, false, "trim"); - explicit, cli_show_auto_mode("candidate", "xml", false, false, "explicit"); - report-all-tagged, cli_show_auto_mode("candidate", "xml", false, false, "report-all-tagged"); - report-all-tagged-default, cli_show_auto_mode("candidate", "xml", false, false, "report-all-tagged-default"); - report-all-tagged-strip, cli_show_auto_mode("candidate", "xml", false, false, "report-all-tagged-strip"); + report-all @datamodelshow, cli_show_auto("candidate", "xml", false, false, "report-all"); + trim @datamodelshow, cli_show_auto("candidate", "xml", false, false, "trim"); + explicit @datamodelshow, cli_show_auto("candidate", "xml", false, false, "explicit"); + report-all-tagged @datamodelshow, cli_show_auto("candidate", "xml", false, false, "report-all-tagged"); + report-all-tagged-default @datamodelshow, cli_show_auto("candidate", "xml", false, false, "report-all-tagged-default"); + report-all-tagged-strip @datamodelshow, cli_show_auto("candidate", "xml", false, false, "report-all-tagged-strip"); } state("Show configuration and state") xml("Show configuration and state as XML") default("With-default mode"){ - report-all, cli_show_auto_mode("running", "xml", false, true, "report-all"); - trim, cli_show_auto_mode("running", "xml", false, true, "trim"); - explicit, cli_show_auto_mode("running", "xml", false, true, "explicit"); - report-all-tagged, cli_show_auto_mode("running", "xml", false, true, "report-all-tagged"); - report-all-tagged-default, cli_show_auto_mode("running", "xml", false, true, "report-all-tagged-default"); - report-all-tagged-strip, cli_show_auto_mode("running", "xml", false, true, "report-all-tagged-strip"); + report-all @datamodelshow, cli_show_auto("running", "xml", false, true, "report-all"); + trim @datamodelshow, cli_show_auto("running", "xml", false, true, "trim"); + explicit @datamodelshow, cli_show_auto("running", "xml", false, true, "explicit"); + report-all-tagged @datamodelshow, cli_show_auto("running", "xml", false, true, "report-all-tagged"); + report-all-tagged-default @datamodelshow, cli_show_auto("running", "xml", false, true, "report-all-tagged-default"); + report-all-tagged-strip @datamodelshow, cli_show_auto("running", "xml", false, true, "report-all-tagged-strip"); } } EOF @@ -570,45 +570,45 @@ expectpart "$(curl $CURLOPTS -X GET -H 'Accept: application/yang-data+xml' $RCPR # CLI tests mode=explicit new "cli with-default config $mode" -expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode)" 0 "^eth08192eth1eth29000eth31500edv$" +expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode interfaces)" 0 "^eth08192eth1eth29000eth31500edv$" new "cli with-default state $mode" -expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode)" 0 "^eth08192oketh1oketh29000not feeling so goodeth31500waking upedv$" +expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode interfaces)" 0 "^eth08192oketh1oketh29000not feeling so goodeth31500waking upedv$" mode=report-all new "cli with-default config $mode" -expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode)" 0 "^eth08192eth11500eth29000eth31500edvdv$" +expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode interfaces)" 0 "^eth08192eth11500eth29000eth31500edvdv$" new "cli with-default state $mode" -expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode)" 0 "^eth08192oketh11500oketh29000not feeling so goodeth31500waking upedvdv$" +expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode interfaces)" 0 "^eth08192oketh11500oketh29000not feeling so goodeth31500waking upedvdv$" mode=report-all-tagged new "cli with-default config $mode" -expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode)" 0 "^eth08192eth11500eth29000eth31500edvdv$" +expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode interfaces)" 0 "^eth08192eth11500eth29000eth31500edvdv$" new "cli with-default state $mode" -expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode)" 0 "^eth08192oketh11500oketh29000not feeling so goodeth31500waking upedvdv$" +expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode interfaces)" 0 "^eth08192oketh11500oketh29000not feeling so goodeth31500waking upedvdv$" mode=trim new "cli with-default config $mode" -expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode)" 0 "^eth08192eth1eth29000eth3$" +expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode interfaces)" 0 "^eth08192eth1eth29000eth3$" new "cli with-default state $mode" -expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode)" 0 "^eth08192eth1eth29000not feeling so goodeth3waking up$" +expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode interfaces)" 0 "^eth08192eth1eth29000not feeling so goodeth3waking up$" mode=report-all-tagged-default new "cli with-default config $mode" -expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode)" 0 "^eth08192eth11500eth29000eth31500edvdv$" +expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode interfaces)" 0 "^eth08192eth11500eth29000eth31500edvdv$" new "cli with-default state $mode" -expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode)" 0 "^eth08192oketh11500oketh29000not feeling so goodeth31500waking upedvdv$" +expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode interfaces)" 0 "^eth08192oketh11500oketh29000not feeling so goodeth31500waking upedvdv$" mode=report-all-tagged-strip new "cli with-default config $mode" -expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode)" 0 "^eth08192eth1eth29000eth3$" +expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode interfaces)" 0 "^eth08192eth1eth29000eth3$" new "cli with-default state $mode" -expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode)" 0 "^eth08192eth1eth29000not feeling so goodeth3waking up$" +expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode interfaces)" 0 "^eth08192eth1eth29000not feeling so goodeth3waking up$" mode=negative-test new "cli with-default config $mode" diff --git a/yang/clixon/clixon-config@2022-03-21.yang b/yang/clixon/clixon-config@2022-03-21.yang index 3a6e3d91..00441a8b 100644 --- a/yang/clixon/clixon-config@2022-03-21.yang +++ b/yang/clixon/clixon-config@2022-03-21.yang @@ -1074,15 +1074,20 @@ module clixon-config { leaf CLICON_STREAM_DISCOVERY_RFC5277 { type boolean; default false; - description "Enable event stream discovery as described in RFC 5277 - sections 3.2. If enabled, available streams will appear - when doing netconf get or restconf GET"; + description + "Enable event stream discovery as described in RFC 5277 + sections 3.2. If enabled, available streams will appear + when doing netconf get or restconf GET"; } leaf CLICON_STREAM_DISCOVERY_RFC8040 { type boolean; default false; description - "Enable monitoring information for the RESTCONF protocol from RFC 8040"; + "Enable monitoring information for the RESTCONF protocol from RFC 8040 as specified + in module ietf-restconf-monitoring.yang + Note that the name of this option is misleading, the monitoring module defines state + for both capabilities and streams, not only streams which the name indicates. + Also, consider changinf default to true."; } leaf CLICON_STREAM_PATH { type string;