Tailf:callpoint tailf:transform when config true

I have the following schema:

container cont-a {
    tailf:callpoint "my_cp" {
        tailf:transform true;
    }
    leaf leaf-a {
        type uint32;
    }
}

I want to treat leaf-a in the following way:

.1. On read: I want to read the actual leaf value that is stored in the cdb (might be with struct confd_data_cbs get_elem, but is there a way to receive the leaf’s value from there? I couldn’t find any confd_data_reply_value()-like function in order to do that. and if I try to get the value with maapi_get_elem() and the path of the leaf itself I get a timeout, I think because of recursive call).

.2. On write: I want to do some external stuff, like an ordinary callpoint (with struct confd_data_cbs set_elem)

Is it possbile?

Thanks

Let me first briefly explain the purpose of a transformation. It is to transform an original data model that is stored either in CDB or external DB into a different data model that doesn’t have its own storage. This feature is fully explained in Chapter 10 of the ConfD UG.

In your use case above, leaf-a will need to be mapped to the original data model for both read and write purposes.

When you invoke the maapi_get_elem( ) call in your get_elem( ) callback implementation for the transformation, you need to specify the keypath of the original data model and not leaf-a.

In your set_elem( ) callback for the transformation, you can make use of the maapi_set_elem( ) call and specify the keypath of the original data model as its function argument.

You can also refer to examples.confd/misc/aaa_transform as an example.

1 Like