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

@ -83,6 +83,7 @@ Developers may need to change their code
### Corrected Bugs
* Fixed: [locally scoped YANG typedef in grouping does not work #394](https://github.com/clicon/clixon/issues/394)
* Fixed: [leafref in new type no work in union type](https://github.com/clicon/clixon/issues/388)
* Fixed: [must statement check int value failed](https://github.com/clicon/clixon/issues/386)
* Fixed: [Defaults in choice does not work properly](https://github.com/clicon/clixon/issues/390)

View file

@ -1105,7 +1105,9 @@ static inline int
ys_typedef(yang_stmt *ys)
{
return yang_keyword_get(ys) == Y_MODULE || yang_keyword_get(ys) == Y_SUBMODULE ||
yang_keyword_get(ys) == Y_CONTAINER || yang_keyword_get(ys) == Y_LIST;
yang_keyword_get(ys) == Y_CONTAINER || yang_keyword_get(ys) == Y_LIST ||
yang_keyword_get(ys) == Y_GROUPING
;
}
/* find next ys up which can contain a typedef */

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"