You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that some values, like leafrefs which aren't defined, end up as a False sort of thing, but represented as a YANGBaseClass object. Trying to determine in python whether this value is referenced to something real or not is difficult, since python thinks something is there, but the thing is a False YANGBaseClass. The workaround I'm using for this is to string cast the object, which results in "False", and then compare that with "False". Seems like a silly a way to do it, so I'm wondering if there is a better way, like an actual boolean attribute on the YANGBaseClass, perhaps. Or maybe this is unintended behavior of undefined leafrefs, I'm not sure. Here is a basic reproduction:
module leafref {
namespace "http://example.com/leafref";
prefix "leafref";
leaf-list test {
type string;
}
container leafref-test {
leaf test {
type leafref {
path "/test";
}
}
}
}
Hello,
It seems that some values, like leafrefs which aren't defined, end up as a False sort of thing, but represented as a YANGBaseClass object. Trying to determine in python whether this value is referenced to something real or not is difficult, since python thinks something is there, but the thing is a False YANGBaseClass. The workaround I'm using for this is to string cast the object, which results in "False", and then compare that with "False". Seems like a silly a way to do it, so I'm wondering if there is a better way, like an actual boolean attribute on the YANGBaseClass, perhaps. Or maybe this is unintended behavior of undefined leafrefs, I'm not sure. Here is a basic reproduction:
And some code:
The text was updated successfully, but these errors were encountered: