CDB Subscribe : Subscription path format

Hi,

We are using ietf interface yang file and each interface has type attribute .

We want to subscribe for changes only related to specific type.

container interfaces
{
list interface
{
key “name”

leaf name
{
type string;
}

leaf type {
type identityref {
base interface-type;
}
}
}

Could you please help to know how we can achieve this subscription?

Below format doesn’t seems to be valid.

cdb_subscribe(subsock, 0, if__ns, &spoint,“/interfaces/interface[type=ethSubInterface]”))

Regards,
ramishet

cdb_subscribe(subsock, 0, if__ns, &spoint,"/interfaces/interface/type")) should do it.

See section 5.6. CDB subscriptions in the UG explains this further, specifically this part:

/named/options/pid-file
a subscription to a leaf. Only changes to this leaf will generate a notification.

/servers
Means that we subscribe to any changes in the subtree rooted at /servers. This includes additions or removals of server instances, as well as changes to already existing server instances.

/servers/server{www}/ip
Means that we only want to be notified when the server "www" changes its ip address.

/servers/server/ip
Means we want to be notified when the leaf ip is changed in any server instance.

Thanks for the reply. Sorry, the need for the subscription is as below

1.The interfaces can be of two types, “Type1” interface and “Type2” interface. Type is a attribute in the interface
2.The application wants to subscribe for the creation of the interface which is of “Type1” only

Regards,
Ramishet

You can not do that with cdb_subscribe() but see cdb_diff_iterate() and cdb_diff_match() for ways of filtering subscription notifications to extract relevant configuration changes.

Thank you. We shall use this approach instead.