NACM : Group name having space (' ') fails in nacm


I am trying to set a name (which contains white space) like this:
"project:user-self(test project;oper;system)”
(please notice white space between ‘test’ and ‘project’ in the name) on path

Without white space in group name it works fine. But with white space it gives error as below:


DEBUG badly formatted or nonexistent path - Bad key "project:user-self(test
project;oper;system)" (wrong number of identifiers) at: /nacm/groups/group
DEBUG operation in wrong state.

Api used:

maapi_sock_ = 887
trans_ = 82
fmt = "/nacm:nacm/nacm:groups/nacm:group{%s}”
args = "project:user-self(test project;oper;system)”
int ret = maapi_create(maapi_sock_, trans_, fmt, args);

This ‘ret’ returns failure.

If I understand it correct, as per ietf-netconf-acm, the type for group name should accept

typedef group-name-type {
    type string {
      length "1..max";
      pattern '[^\*].*';
      "Name of administrative group to which
       users can be assigned.";


Looks like asking for pain, even besides the one you’re seeing here:-) - think e.g. of a human trying to interpret (lists of) such group names when looking at the configuration. Typically you would assign an actual name (as in the natural-language meaning of the word), and put the description/definition elsewhere…

It should and it does - but by definition, the keys inside the {…} of paths that you pass to the CDB/MAAPI functions are space-separated, thus you need to quote key values that have embedded spaces in order to make the intended parsing possible. E.g. in your sample code, it should be:

args = "\"project:user-self(test project;oper;system)\"”

Side note: when you already have keys as confd_value_t and use the %x or %*x format specifiers, this quoting is done by the library, since it knows that it is dealing with a single value - but the argument for %s can be any string, including e.g. multiple space-separated keys. Thus another way to deal with the case that you have a key value that is a string with arbitrary contents (obviously zero-length strings, or strings containing ‘}’, will also require quoting) is to use CONFD_SET_STR() to turn it into a confd_value_t, and then in the path use %x with the confd_value_t instead of %s with the string.

Thanks @per!! Will give it a try and let you know.

@per, that worked. Thank you.