ConfD User Community

Yang path for the container is not backward compatible


#1

Hi All,

I have the following yang model defined:

container idb {
    leaf end_point {
        type string;
    }
    leaf enabled {
        type boolean;
    }
}

In ConfD-4.0.7.1, /idb[0] is accepted as valid path.

In ConfD-6.4.2, /idb[0] is not valid.

Could you please let me know whether there is any config/yang directive which keeps the old behavior?

Thanks,
-karthi


#2

Already in 4.0 (and earlier), the [n] format was only documented as being possible to use for lists - from the PATHS section of the confd_lib_cdb(3) man page there:

   Thus instead of an actually instantiated key inside a pair of curly
   braces {key}, we can use a temporary integer key inside a pair of
   brackets [n].

It was indeed possible to use [0] for a container, unclear if it was a bug or a misfeature, but it was removed when fixing an error reporting issue for paths using [n] as documented - from ConfD-5.1 CHANGES (April 2014):

  - CDB: If cdb_exists() was given a path with an instance index that was
    out of range, it would fail with CONFD_ERR_BADPATH instead of returning
    0. This has been fixed. Additionally, if instance index [0] was used for
    a node that wasn't a list, it was silently ignored - now this fails with
    CONFD_ERR_BADPATH.

There isn’t. Just drop it - saves 3 useless characters in the path…