YANG deviation: Resolve deviated types lexically in deviation context
This commit is contained in:
parent
1709537701
commit
b1a4656f72
4 changed files with 84 additions and 6 deletions
|
|
@ -230,7 +230,7 @@ testrun true false true false
|
|||
cat <<EOF > $fyangdev
|
||||
module example-deviations{
|
||||
yang-version 1.1;
|
||||
prefix md;
|
||||
prefix ed;
|
||||
namespace "urn:example:deviations";
|
||||
import example-base {
|
||||
prefix base;
|
||||
|
|
@ -246,7 +246,9 @@ EOF
|
|||
new "5. deviate delete"
|
||||
testrun true false false true
|
||||
|
||||
# Replace example from RFC 7950 Sec 7.20.3.3
|
||||
# Here follows advanced deviations (from arista/openconfig deviations)
|
||||
new "6. deviate replace default"
|
||||
|
||||
cat <<EOF > $fyangdev
|
||||
module example-deviations{
|
||||
yang-version 1.1;
|
||||
|
|
@ -268,8 +270,6 @@ module example-deviations{
|
|||
}
|
||||
EOF
|
||||
|
||||
new "6. deviate replace default"
|
||||
|
||||
if [ "$BE" -ne 0 ]; then
|
||||
new "kill old backend"
|
||||
sudo clixon_backend -zf "$cfg"
|
||||
|
|
@ -309,6 +309,63 @@ if [ "$BE" -ne 0 ]; then
|
|||
stop_backend -f "$cfg"
|
||||
fi
|
||||
|
||||
# lexically scoped
|
||||
new "7. deviate with own type"
|
||||
cat <<EOF > $fyangdev
|
||||
module example-deviations{
|
||||
yang-version 1.1;
|
||||
prefix ed;
|
||||
namespace "urn:example:deviations";
|
||||
import example-base {
|
||||
prefix base;
|
||||
}
|
||||
typedef mytype {
|
||||
type int8;
|
||||
}
|
||||
deviation /base:system/base:my {
|
||||
deviate replace {
|
||||
type ed:mytype;
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
if [ "$BE" -ne 0 ]; then
|
||||
new "kill old backend"
|
||||
sudo clixon_backend -zf "$cfg"
|
||||
if [ $? -ne 0 ]; then
|
||||
err
|
||||
fi
|
||||
new "start backend -s init -f $cfg"
|
||||
start_backend -s init -f "$cfg"
|
||||
fi
|
||||
|
||||
new "wait backend"
|
||||
wait_backend
|
||||
|
||||
new "set negative value"
|
||||
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><system xmlns=\"urn:example:base\"><daytime>Sept17</daytime><my>-77</my></system></config></edit-config></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"
|
||||
|
||||
new "netconf validate ok"
|
||||
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><validate><source><candidate/></source></validate></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"
|
||||
|
||||
new "set large value"
|
||||
expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><system xmlns=\"urn:example:base\"><my>98735</my></system></config></edit-config></rpc>" "" "<rpc-reply $DEFAULTNS><ok/></rpc-reply>"
|
||||
|
||||
new "netconf validate 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><error-info><bad-element>my</bad-element></error-info><error-severity>error</error-severity><error-message>Number 98735 out of range: -128 - 127</error-message></rpc-error></rpc-reply>"
|
||||
|
||||
if [ "$BE" -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f "$cfg"
|
||||
fi
|
||||
|
||||
rm -rf "$dir"
|
||||
|
||||
new "endtest"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue