[sysrepo-devel] setting a list that has no leafs

Milan Lenčo Milan.Lenco at pantheon.tech
Fri Oct 21 07:15:32 UTC 2016


Hi Joan,


check out the documentation for sr_set_item. The most relevant information for you is:


"To create a list use xpath with key values included and pass NULL as value argument."


So, in your case you would do:


sr_set_item(session, "/module:abc/def[name='new-key-value']", NULL, options)


Regards,

Milan


________________________________
Od: Joan Landry <JoLandry at advaoptical.com>
Odoslané: 20. októbra 2016 20:55
Komu: sysrepo-devel at sysrepo.org
Predmet: [sysrepo-devel] setting a list that has no leafs

I would like to know a way to set an entry in a list where the list only contains a key.
The existing       rc = sr_set_item(session, xpath_buf, &value, SR_EDIT_DEFAULT);
expects a value and in the example below there is no value, just a key.

    container abc {
    list def {
      key "name";
      leaf name {
        type string;
      }
  }
}
If I try to use the key element as a value I get the following error from sysrepo:
ERR] (cl_request_process:483) Error by processing of the set-item request (session id=1497336400): Value of the key can not be set.
[ERR] (sr_set_item:1699) Error by processing of the request.
Error by sr_set_item: Invalid argument

Thanks for any info on how to do this.

MilanLenčo
Software Developer

Sídlo / Mlynské Nivy 56 / 821 05 Bratislava / Slovakia
R&D centrum / Janka Kráľa 9 /  974 01 Banská Bystrica / Slovakia
/ Milan.Lenco at pantheon.tech
reception: +421 2 206 65 114 / www.pantheon.sk

[logo]


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sysrepo.org/archives/sysrepo-devel/attachments/20161021/b06c061e/attachment.html>


More information about the sysrepo-devel mailing list