ConfD User Community

Rename the enumeration


#1

Hi
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";
    }
}

So In CLI
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


#2

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).