Typedef/leafref and SNMP

We’re just starting to play around with the SNMP northbound interface and I’ve got an existing set of YANG models that have been working just fine for our CLI/restful/netconf interfaces, but is blowing up spectacularly when trying to build for SNMP:

~$ …/ConfD/dev/bin/confdc --emit-mib PORT-MIB.mib --join-names hyphen --no-comments -f …/ConfD/dev/etc/confd – port.fxs
Internal error
~/$

That’s it. “Internal error” and barf (a mangle MIB is generated at that point and if you try to convert the MIB to a .bin, you get nothing). I’ve narrowed it down to a typedef/leafref we have (hacking this out and all reference to it in the yang file at least gets me to compiling, but really breaks our model):

typedef port-ref {
type leafref {
path “/port:ports/port:port/port:display-name”;
}
description “This type is used by data models that need to reference configured ports.”;
}

Where the basic structure of the rest of this module is:

module port {
container ports {
list port {
leaf display-name {
}}}}

Now I cannot figure out if it’s just dumb-blind luck we’re working on all the other interfaces or what is up with SNMP, but the lack of any output on the compile fail is not really helpful…is there any sort of diagnostics mode that confdc can be run with to help this or anyone else have suggestions/ideas? Thanks!

There has bee a couple of bugs in the YANG-compiler that may be the cause of the error. This sounds like it might be an issue that was fixed in ConfD 6.1.1.

From the CHANGES file:

  • Toolchain: It was not possible to emit a MIB from a module with a
    typedef of type leafref. This has been fixed.

Try upgrade to the latest ConfD version and see if that takes care of the problem.

Unfortunately, 6.1.1 doesn’t look like an option…we’re stuck on 6.0. Any other options?

The note I found talks about “typedef of type leafref”, it’s not very elegant but you could try using the explicit type leafref-statement without the typedef until the point you are ready to upgrade.

Another option is to contact Tail-f support to see what the have to say and if it is the error I think it is get a back port of the fix to ConfD 6.0.

Unrolling the typedefs worked - as you say, not very elegant, but it works. Thanks!

FWIW, the fix mentioned by jjohansson was done also on the ConfD-6.0 branch, and is included in the ConfD-6.0.4 release (February 25, 2016).