leaf admin-status {
type enumeration {
enum UP {
description
"Ready to pass packets.";
}
enum DOWN {
description
"Not ready to pass packets and not in some test mode.";
}
enum TESTING {
description
"In some test mode.";
}
}
mandatory true;
The error:
(node:700819) UnhandledPromiseRejectionWarning: ExpressionError: [module(openconfig-interfaces)/grouping(interface-common-state)/leaf(admin-status)/mandatory] predicate validation error: AssertionError [ERR_ASSERTION]: data must be defined
at Function.error (src/node_modules/yang-js/lib/element.js:62:17)
at Function.error (src/node_modules/yang-js/lib/expression.js:140:21)
at Function.apply (src/node_modules/yang-js/lib/expression.js:110:22)
at Function.eval (src/node_modules/yang-js/lib/expression.js:127:23)
at Function.eval (src/node_modules/yang-js/lib/yang.js:238:22)
at Function.transform (src/node_modules/yang-js/lib/lang/extensions.js:1089:25)
at Function.apply (src/node_modules/yang-js/lib/expression.js:93:33)
at Property.<anonymous> (src/node_modules/yang-js/lib/property.js:199:34)
at Property.set (src/node_modules/yang-js/lib/property.js:203:12)
at Property.attach (src/node_modules/yang-js/lib/property.js:347:16)
If I change the value of mandatory to false, the validation is successful.
If I change the value to false and change admin-status to admin-status:"asdfasdfadsf" the validation will generate a correct enum error: (node:700190) UnhandledPromiseRejectionWarning: Error: [enumeration] type violation for 'asdfasdfadsf' on UP,DOWN,TESTING
Hey there, When validating mandatory fields in read-only data I receive a Data must be defined error.
The Code:
The Yang Model:
The error:
If I change the value of mandatory to false, the validation is successful.
If I change the value to false and change admin-status to
admin-status:"asdfasdfadsf"
the validation will generate a correct enum error:(node:700190) UnhandledPromiseRejectionWarning: Error: [enumeration] type violation for 'asdfasdfadsf' on UP,DOWN,TESTING
let me know if you have any questions