ConfD User Community

What data type should we use in the python script for implementing the show command of a leaf having enumeration as the data type in YANG file?

What data type should we use in the python script for implementing the show command of a leaf having enumeration as the data type in YANG file?

leaf link-speed {
   type enumeration {
      enum auto_or_link_down {
        value 0;
        description
          "Auto Negotiation or link down.";
      }
      enum link-10hd {
        value 1;
        description
          "Link 10 Half-duplex.";
      }
      enum link-10fd {
        value 2;
        description
          "Link 10 Full-duplex.";
      }
      enum link-100hd {
        value 3;
        description
          "Link 100 Half-duplex.";
      }
      enum link-100fd {
        value 4;
        description
          "Link 100 Full-duplex.";
      }
   }
}

show link-speed should display any of the below-mentioned speeds as mentioned below?
auto_or_link_down, link-100fd, link-10hd, link-100hd

It should not print 0,1,2,3 instead it should print the actual speed.

I have used the _confD.C_ENUMHASH but it displays error that ENUMHASH is not a member of _confD.

Can you please help me with this?

How are you using the Python API? Are you trying to implement your own show command using the Python API, rather than using the ConfD CLI? The ConfD CLI should use the enum string itself rather than the value (see examples.confd/intro/1-2-3-start-query-model and the log-level enum defined in dhcpd.yang)