ConfD User Community

Rename the enumeration


I have one scenario where I want to map the enumeration node with some number in the backend code
For example the yang code has

leaf myenum {
  type enumeration {
    enum true {
       description "example enum";
       tailf:code-name "1";
    enum false {
      description "example enum";
      tailf:code-name "2";

If I execute ‘set myenum true’
It should set value 1 in CDB
If I do ‘show myenum’ It should show the value as 1
Is it possible to rename the node like this?
Are there any tailf tags? Tried with code-name. Not worked


Using tailf:code-name changes name only in generated code (header file) to avoid possible
conflicts with other nodes having same name.

Unfortunately, tailf:alt-name (which is proper way to rename elements in CLI) cannot be used under enumeration.

You can do is to use

type enumeration {
    enum 1;
    enum 2;

In CLI you can enter 1, 2 and convert the values to true and false in your application (CDB subscriber).



I want to change the existing enum name for a leaf, for example,
from --> enum none {
value “1”
to --> enum ais-none {
value “1”

would this update be handled by confd db upgrade automatically and the value of the leaf, if was set to ‘none’, now set to ais-none?


Thanks @mnovak . I have used enum value
The enum name will be true and false but the value of enum will be 1 and 2 . In the application code we are retrieving enum values .This has solved my first question