ConfD User Community

Leaf Value From Lookup Table


I have a model where 3 leaves are defined: leaf-a, leaf-b and leaf-c.

The value of leaf-c is directly dependent on the values of leaf-a and leaf-b. For instance, if a request with
“leaf-a = 10” and “leaf-b = 20” is sent, leaf-c will be set as 55
“leaf-a = 48” and “leaf-b = 12” is sent, leaf-c will be set as 82
according to a lookup table. Is it possible to define this relation on YANG model? If not, that means I need to implement it at application side and define leaf-c as state data, I guess.

To be honest, it does not seem like a valid use case but I wanted to be sure before implementation.


Populating the database like that is not recommended if you expose leaf-c over northbound interfaces such as NETCONF or RESTCONF as the manager would become out of sync with the configuration on the device.

Anyways, you need an application that uses a “transaction hook”. See ConfD UG chapter/section “Hooks” and the examples.confd/intro/11-c_hooks example (there are Java and Python examples too)

Thanks @cohult, that was my expectation as well.