# CDB Subscribe : Subscription path format

**URL:** <https://dmap-community.ductus.global/t/cdb-subscribe-subscription-path-format/1446>\
**Category:** CDB and CDB API\
**Created:** [August 3, 2017, 6:18am UTC](https://dmap-community.ductus.global/t/cdb-subscribe-subscription-path-format/1446 "2017-08-03T06:18:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramishet](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@ramishet](https://dmap-community.ductus.global/u/ramishet)\
**Post date:** [August 3, 2017, 6:18am UTC](https://dmap-community.ductus.global/t/cdb-subscribe-subscription-path-format/1446/1 "2017-08-03T06:18:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jjohansson](https://avatars.discourse-cdn.com/v4/letter/j/b782af/32.png) [@jjohansson](https://dmap-community.ductus.global/u/jjohansson)\
**Post date:** [August 3, 2017, 1:23pm UTC](https://dmap-community.ductus.global/t/cdb-subscribe-subscription-path-format/1446/2 "2017-08-03T13:23:46Z")

</div>

`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:

```auto
/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.

```

---

<div class="post-metadata">

**Author:** ![ramishet](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@ramishet](https://dmap-community.ductus.global/u/ramishet)\
**Post date:** [August 4, 2017, 8:33am UTC](https://dmap-community.ductus.global/t/cdb-subscribe-subscription-path-format/1446/3 "2017-08-04T08:33:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jjohansson](https://avatars.discourse-cdn.com/v4/letter/j/b782af/32.png) [@jjohansson](https://dmap-community.ductus.global/u/jjohansson)\
**Post date:** [August 4, 2017, 11:57am UTC](https://dmap-community.ductus.global/t/cdb-subscribe-subscription-path-format/1446/4 "2017-08-04T11:57:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ramishet](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@ramishet](https://dmap-community.ductus.global/u/ramishet)\
**Post date:** [August 8, 2017, 8:55am UTC](https://dmap-community.ductus.global/t/cdb-subscribe-subscription-path-format/1446/5 "2017-08-08T08:55:33Z")

</div>

Thank you. We shall use this approach instead.
