ConfD User Community

Cdb_subscribe with wild card pattern


#1

Hi,

We would like to subscribe for a object creation for the keys matching a specific pattern.

Eg:
If the keys are 1/2/1/1, 1/2/1/2, 1/3/1/1, 1/3/2/1. We would like to subscribe for creation of 1/2/* objects.

Could you please help us with the formatting required during the subscription?

cdb_subscribe(subsock, 0, servers__ns, &spoint,"/servers/server{1/2/*}"))

Regards,
Ramishet


#2

It would help if you can provide a YANG model for your list. Is that a single key with your example pattern defined as a string type or is that multiple keys?


#3

Thanks Waitai.

It’s a single key.

container servers
{
     list server
     {
           key "aid";
           leaf aid 
          {
                type string;
          }
     }
}

Regards
Ramishet


#4

According to the manpage description of cdb_subscribe, you can use ‘*’ to match all values of a key, or you can specify a specific value of a key, but you cannot use a general glob pattern in a subscription.