With-default cli test, use xpath to only show config tree

Make all tests independent of CLICON_STREAM_DISCOVERY_RFC8040 setting
This commit is contained in:
Olof hagsand 2022-09-19 10:57:15 +02:00
parent 3bf8a7dca3
commit 07536fc8d2
5 changed files with 36 additions and 28 deletions

View file

@ -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 "^<interfaces xmlns=\"http://example.com/ns/interfaces\"><interface><name>eth0</name><mtu>8192</mtu></interface><interface><name>eth1</name></interface><interface><name>eth2</name><mtu>9000</mtu></interface><interface><name>eth3</name><mtu>1500</mtu></interface><cedv><edv>edv</edv></cedv></interfaces>$"
expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode interfaces)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\"><interface><name>eth0</name><mtu>8192</mtu></interface><interface><name>eth1</name></interface><interface><name>eth2</name><mtu>9000</mtu></interface><interface><name>eth3</name><mtu>1500</mtu></interface><cedv><edv>edv</edv></cedv></interfaces>$"
new "cli with-default state $mode"
expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\"><interface><name>eth0</name><mtu>8192</mtu><status>ok</status></interface><interface><name>eth1</name><status>ok</status></interface><interface><name>eth2</name><mtu>9000</mtu><status>not feeling so good</status></interface><interface><name>eth3</name><mtu>1500</mtu><status>waking up</status></interface><cedv><edv>edv</edv></cedv></interfaces>$"
expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode interfaces)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\"><interface><name>eth0</name><mtu>8192</mtu><status>ok</status></interface><interface><name>eth1</name><status>ok</status></interface><interface><name>eth2</name><mtu>9000</mtu><status>not feeling so good</status></interface><interface><name>eth3</name><mtu>1500</mtu><status>waking up</status></interface><cedv><edv>edv</edv></cedv></interfaces>$"
mode=report-all
new "cli with-default config $mode"
expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\"><interface><name>eth0</name><mtu>8192</mtu></interface><interface><name>eth1</name><mtu>1500</mtu></interface><interface><name>eth2</name><mtu>9000</mtu></interface><interface><name>eth3</name><mtu>1500</mtu></interface><cedv><edv>edv</edv></cedv><cdv><dv>dv</dv></cdv></interfaces>$"
expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode interfaces)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\"><interface><name>eth0</name><mtu>8192</mtu></interface><interface><name>eth1</name><mtu>1500</mtu></interface><interface><name>eth2</name><mtu>9000</mtu></interface><interface><name>eth3</name><mtu>1500</mtu></interface><cedv><edv>edv</edv></cedv><cdv><dv>dv</dv></cdv></interfaces>$"
new "cli with-default state $mode"
expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\"><interface><name>eth0</name><mtu>8192</mtu><status>ok</status></interface><interface><name>eth1</name><mtu>1500</mtu><status>ok</status></interface><interface><name>eth2</name><mtu>9000</mtu><status>not feeling so good</status></interface><interface><name>eth3</name><mtu>1500</mtu><status>waking up</status></interface><cedv><edv>edv</edv></cedv><cdv><dv>dv</dv></cdv></interfaces>$"
expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode interfaces)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\"><interface><name>eth0</name><mtu>8192</mtu><status>ok</status></interface><interface><name>eth1</name><mtu>1500</mtu><status>ok</status></interface><interface><name>eth2</name><mtu>9000</mtu><status>not feeling so good</status></interface><interface><name>eth3</name><mtu>1500</mtu><status>waking up</status></interface><cedv><edv>edv</edv></cedv><cdv><dv>dv</dv></cdv></interfaces>$"
mode=report-all-tagged
new "cli with-default config $mode"
expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\" xmlns:wd=\"urn:ietf:params:xml:ns:netconf:default:1.0\"><interface><name>eth0</name><mtu>8192</mtu></interface><interface><name>eth1</name><mtu wd:default=\"true\">1500</mtu></interface><interface><name>eth2</name><mtu>9000</mtu></interface><interface><name>eth3</name><mtu wd:default=\"true\">1500</mtu></interface><cedv><edv wd:default=\"true\">edv</edv></cedv><cdv><dv wd:default=\"true\">dv</dv></cdv></interfaces>$"
expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode interfaces)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\" xmlns:wd=\"urn:ietf:params:xml:ns:netconf:default:1.0\"><interface><name>eth0</name><mtu>8192</mtu></interface><interface><name>eth1</name><mtu wd:default=\"true\">1500</mtu></interface><interface><name>eth2</name><mtu>9000</mtu></interface><interface><name>eth3</name><mtu wd:default=\"true\">1500</mtu></interface><cedv><edv wd:default=\"true\">edv</edv></cedv><cdv><dv wd:default=\"true\">dv</dv></cdv></interfaces>$"
new "cli with-default state $mode"
expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\" xmlns:wd=\"urn:ietf:params:xml:ns:netconf:default:1.0\"><interface><name>eth0</name><mtu>8192</mtu><status wd:default=\"true\">ok</status></interface><interface><name>eth1</name><mtu wd:default=\"true\">1500</mtu><status wd:default=\"true\">ok</status></interface><interface><name>eth2</name><mtu>9000</mtu><status>not feeling so good</status></interface><interface><name>eth3</name><mtu wd:default=\"true\">1500</mtu><status>waking up</status></interface><cedv><edv wd:default=\"true\">edv</edv></cedv><cdv><dv wd:default=\"true\">dv</dv></cdv></interfaces>$"
expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode interfaces)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\" xmlns:wd=\"urn:ietf:params:xml:ns:netconf:default:1.0\"><interface><name>eth0</name><mtu>8192</mtu><status wd:default=\"true\">ok</status></interface><interface><name>eth1</name><mtu wd:default=\"true\">1500</mtu><status wd:default=\"true\">ok</status></interface><interface><name>eth2</name><mtu>9000</mtu><status>not feeling so good</status></interface><interface><name>eth3</name><mtu wd:default=\"true\">1500</mtu><status>waking up</status></interface><cedv><edv wd:default=\"true\">edv</edv></cedv><cdv><dv wd:default=\"true\">dv</dv></cdv></interfaces>$"
mode=trim
new "cli with-default config $mode"
expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\"><interface><name>eth0</name><mtu>8192</mtu></interface><interface><name>eth1</name></interface><interface><name>eth2</name><mtu>9000</mtu></interface><interface><name>eth3</name></interface></interfaces>$"
expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode interfaces)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\"><interface><name>eth0</name><mtu>8192</mtu></interface><interface><name>eth1</name></interface><interface><name>eth2</name><mtu>9000</mtu></interface><interface><name>eth3</name></interface></interfaces>$"
new "cli with-default state $mode"
expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\"><interface><name>eth0</name><mtu>8192</mtu></interface><interface><name>eth1</name></interface><interface><name>eth2</name><mtu>9000</mtu><status>not feeling so good</status></interface><interface><name>eth3</name><status>waking up</status></interface></interfaces>$"
expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode interfaces)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\"><interface><name>eth0</name><mtu>8192</mtu></interface><interface><name>eth1</name></interface><interface><name>eth2</name><mtu>9000</mtu><status>not feeling so good</status></interface><interface><name>eth3</name><status>waking up</status></interface></interfaces>$"
mode=report-all-tagged-default
new "cli with-default config $mode"
expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\" xmlns:wd=\"urn:ietf:params:xml:ns:netconf:default:1.0\"><interface><name>eth0</name><mtu>8192</mtu></interface><interface><name>eth1</name><mtu>1500</mtu></interface><interface><name>eth2</name><mtu>9000</mtu></interface><interface><name>eth3</name><mtu>1500</mtu></interface><cedv><edv>edv</edv></cedv><cdv><dv>dv</dv></cdv></interfaces>$"
expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode interfaces)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\" xmlns:wd=\"urn:ietf:params:xml:ns:netconf:default:1.0\"><interface><name>eth0</name><mtu>8192</mtu></interface><interface><name>eth1</name><mtu>1500</mtu></interface><interface><name>eth2</name><mtu>9000</mtu></interface><interface><name>eth3</name><mtu>1500</mtu></interface><cedv><edv>edv</edv></cedv><cdv><dv>dv</dv></cdv></interfaces>$"
new "cli with-default state $mode"
expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\" xmlns:wd=\"urn:ietf:params:xml:ns:netconf:default:1.0\"><interface><name>eth0</name><mtu>8192</mtu><status>ok</status></interface><interface><name>eth1</name><mtu>1500</mtu><status>ok</status></interface><interface><name>eth2</name><mtu>9000</mtu><status>not feeling so good</status></interface><interface><name>eth3</name><mtu>1500</mtu><status>waking up</status></interface><cedv><edv>edv</edv></cedv><cdv><dv>dv</dv></cdv></interfaces>$"
expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode interfaces)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\" xmlns:wd=\"urn:ietf:params:xml:ns:netconf:default:1.0\"><interface><name>eth0</name><mtu>8192</mtu><status>ok</status></interface><interface><name>eth1</name><mtu>1500</mtu><status>ok</status></interface><interface><name>eth2</name><mtu>9000</mtu><status>not feeling so good</status></interface><interface><name>eth3</name><mtu>1500</mtu><status>waking up</status></interface><cedv><edv>edv</edv></cedv><cdv><dv>dv</dv></cdv></interfaces>$"
mode=report-all-tagged-strip
new "cli with-default config $mode"
expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\" xmlns:wd=\"urn:ietf:params:xml:ns:netconf:default:1.0\"><interface><name>eth0</name><mtu>8192</mtu></interface><interface><name>eth1</name></interface><interface><name>eth2</name><mtu>9000</mtu></interface><interface><name>eth3</name></interface></interfaces>$"
expectpart "$($clixon_cli -1 -f $cfg show config xml default $mode interfaces)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\" xmlns:wd=\"urn:ietf:params:xml:ns:netconf:default:1.0\"><interface><name>eth0</name><mtu>8192</mtu></interface><interface><name>eth1</name></interface><interface><name>eth2</name><mtu>9000</mtu></interface><interface><name>eth3</name></interface></interfaces>$"
new "cli with-default state $mode"
expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\" xmlns:wd=\"urn:ietf:params:xml:ns:netconf:default:1.0\"><interface><name>eth0</name><mtu>8192</mtu></interface><interface><name>eth1</name></interface><interface><name>eth2</name><mtu>9000</mtu><status>not feeling so good</status></interface><interface><name>eth3</name><status>waking up</status></interface></interfaces>$"
expectpart "$($clixon_cli -1 -f $cfg show state xml default $mode interfaces)" 0 "^<interfaces xmlns=\"http://example.com/ns/interfaces\" xmlns:wd=\"urn:ietf:params:xml:ns:netconf:default:1.0\"><interface><name>eth0</name><mtu>8192</mtu></interface><interface><name>eth1</name></interface><interface><name>eth2</name><mtu>9000</mtu><status>not feeling so good</status></interface><interface><name>eth3</name><status>waking up</status></interface></interfaces>$"
mode=negative-test
new "cli with-default config $mode"