get keypath from confd_cs_node

48 views
Skip to first unread message

Rogerio Guerreiro

unread,
Sep 22, 2014, 3:25:33 PM9/22/14
to confd-us...@googlegroups.com
Is there a way yo get a keypath from a arbitrary confd_cs_node? I'm trying something like this:


while(obj_node != NULL)
{
      std::cout << obj_node->tag << "\n";
      obj_node = obj_node->parent;
}

And using the tag information to construct the path, but it don't work with keys, because it just get the tag value from key not the value. Someone have any ideas?

Thx...

Per Hedeland

unread,
Sep 25, 2014, 2:34:40 AM9/25/14
to confd-us...@googlegroups.com
Rogerio Guerreiro <rogerio.g...@gmail.com> wrote:
>
>Is there a way yo get a keypath from a arbitrary confd_cs_node? I'm trying
>something like this:

No - by definition. The confd_cs_node tree is a representation of the
schema, i.e. it is static for a given YANG model. It doesn't have any
instance data, and in particular, no keys for list entries. You *could*
do some combination of traversing the schema and using the info to
retrieve instance data such as keys from MAAPI or CDB, but not knowing
your use case, it is difficult to give any specific advice. Most lists
have more than one entry...

--Per Hedeland

Rogerio Guerreiro

unread,
Sep 25, 2014, 7:18:38 AM9/25/14
to confd-us...@googlegroups.com
Yes. Yesterday i solve my problem using exact this solution: using a mix combination transversing the schema and use a info retrieve to get key values by using cdb_get
, and it's working for me.

Thx Per
Reply all
Reply to author
Forward
0 new messages