List with mixed type leafs

Good day,

I have a question regarding lists with mixed config- and op-data leafs. Assuming we have a YANG defined as;

list mylist {
    key list_index;
    leaf list_index {
        type int32;
    leaf config_data {
        config true;        
        type string;
    leaf oper_data {
        config false;
        type string;

The scenario is that we would like to save a set of operational data, to leaf “oper_data”, and evetually also write some config data to “config_data”.

From what we understand we need to use the management-agent-API to write config data, as opossed to writing op data using the cdb-API. So whenever we save op-data we need to use a cdb-API cdb_create() to populate a list, but when we save config data we have to use maapi_create(). As such we find it a bit tricky to have to know what type of data we are writing to the leafs, in order to create a list instance.

Assuming we want to save a lot of op-data prior to config data, does it not impose a heavy load on ConfD using maapi_create() multiple times to register op-data? Or are we missing something here?

The mixing of config and oper data is not always ideal. New NMDA standard can hopefully simplify this.

As you wrote, you first need to created mylist list entry (config), so you have entry to store you operational data into. You can use maapi API (maapi_create`) to do it, as you describe (create transaction, configure, commit).

If you use dataprovider, you return operational data in callback.
If you use operational data stored in CDB, you set it with cdb_set_... function.

If you want to set many list elements, it is good to create all config list entries (maapi) in one transaction and then set operational data on them.

1 Like