Fixed: [locally scoped YANG typedef in grouping does not work #394](https://github.com/clicon/clixon/issues/394)

This commit is contained in:
Olof hagsand 2023-01-03 21:44:59 +01:00
parent 99c6f61637
commit bcca87b1a0
3 changed files with 34 additions and 1 deletions

View file

@ -68,6 +68,19 @@ module example{
namespace "urn:example:clixon";
prefix ex;
import example2 { prefix ex2; }
grouping gt{
description "test of local scoped type as defined in RFC7950 Section 5.5";
typedef ag {
type string {
pattern
'(([c-g])\.){3}[c-g]';
}
}
leaf gr{
type ag;
}
}
typedef ab {
type string {
pattern
@ -206,6 +219,7 @@ module example{
mandatory true;
}
}
uses gt;
}
EOF
@ -624,6 +638,22 @@ EOF
new "netconf discard-changes"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><discard-changes/></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"
#------ typedef scoped in grouping
new "type in grouping"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><gr xmlns=\"urn:example:clixon\">c.d.e.f</gr></config></edit-config></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"
new "validate grouping ok"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><validate><source><candidate/></source></validate></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"
new "type in grouping negatoive"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><gr xmlns=\"urn:example:clixon\">a.d.e.f</gr></config></edit-config></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"
new "validate grouping expect fail"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><validate><source><candidate/></source></validate></rpc>" "<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>bad-element</error-tag>"
new "netconf discard-changes"
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><discard-changes/></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"
#------ minus
new "type with minus"