# MOP\_MODIFIED leaf element in list

**URL:** <https://dmap-community.ductus.global/t/mop-modified-leaf-element-in-list/1330>\
**Category:** CDB and CDB API\
**Created:** [June 14, 2017, 5:52am UTC](https://dmap-community.ductus.global/t/mop-modified-leaf-element-in-list/1330 "2017-06-14T05:52:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![poornima11](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@poornima11](https://dmap-community.ductus.global/u/poornima11)\
**Post date:** [June 14, 2017, 5:52am UTC](https://dmap-community.ductus.global/t/mop-modified-leaf-element-in-list/1330/1 "2017-06-14T05:52:28Z")

</div>

Hello Team,

We work with an extremely large schema close to 2500 lines. We are maintaining a list of mac-address.

container server {  
list database {  
key “ip”;  
unique “ip”;  
leaf ip {  
type inet:ip-address;  
}  
leaf name {  
type string;  
}  
leaf m----n;  
}  
}

I have subscribed for any changes to the list CREATE / DELETE and entry using  
if ((status\_ = cdb\_subscribe(subsock\_, 0, network\_\_ns, &headpoint\_,  
“/server/database/”)) != CONFD\_OK)  
{  
std::cerr \<\< “Terminate: subscribe.” \<\< status\_ \<\< std::endl;  
return e\_confd\_failure;  
}

But I am also interested in any change to leaf name. When I use the cdb\_diff\_iter, the iterator halts at MOP\_MODIFIED. But I cannot access the xmltag name. The tag ends at database.

I am not very keen on using cdb\_get\_modifications since there are many leaves under the list and I am not interested in any of them. I only need to address the changes to particular leaf. Please help!

Best regards.

---

<div class="post-metadata">

**Author:** ![mnovak](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mnovak/32/183_2.png) [@mnovak](https://dmap-community.ductus.global/u/mnovak)\
**Post date:** [June 14, 2017, 9:49am UTC](https://dmap-community.ductus.global/t/mop-modified-leaf-element-in-list/1330/2 "2017-06-14T09:49:27Z")

</div>

From ConfD user guide:

```auto
MOP_MODIFIED

    A descendant of the list entry given by kp has been modified.
MOP_VALUE_SET

    The value of the leaf given by kp has been set to newv.

```

This means that `kp` contains the keypath of the list. You need to read `kp` in `MOP_VALUE_SET` to get the kyepath of the `leaf` (which is under `list`)

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [June 14, 2017, 9:53am UTC](https://dmap-community.ductus.global/t/mop-modified-leaf-element-in-list/1330/3 "2017-06-14T09:53:40Z")

</div>

First, a “unique” statement on a list key is redundant. The list key will be checked for uniqueness anyway.

In addition to @mnovak 's comment, adding something like

```
  <server xmlns="http://tail-f.com/ns/example/dhcpd">
  <database>
    <ip>192.168.0.2</ip>
    <name>some name here</name>
    <m>test</m>
  </database>
  </server>

```

Seems to work fine:

```
$ confd_cmd -d -d -c "subwait_iter /server/database 1 100"
subwait_iter "/server/database" "1" "100"
TRACE Connected (maapi) to ConfD
TRACE MAAPI_LOAD_ALL_NS
TRACE MAAPI_LOAD_HASH_DB
TRACE Connected (cdb) to ConfD
TRACE CDB_SUBSCRIBE /server/database --> CONFD_OK
TRACE CDB_SUBSCRIBE_DONE --> CONFD_OK
SUBSCRIBED TO /server/database
TRACE CDB_SUBSCRIPTION_EVENT --> 6
COMMIT
TRACE CDB_SUB_PROGRESS --> CONFD_OK
TRACE CDB_SUB_ITERATE 6
TRACE CDB_SUB_PROGRESS --> CONFD_OK
/server/database /server/database{192.168.0.2} created
TRACE CDB_SUB_PROGRESS --> CONFD_OK
/server/database /server/database{192.168.0.2}/ip set ( -> 192.168.0.2)
TRACE CDB_SUB_PROGRESS --> CONFD_OK
/server/database /server/database{192.168.0.2}/m set ( -> test)
TRACE CDB_SUB_PROGRESS --> CONFD_OK
/server/database /server/database{192.168.0.2}/name set ( -> some name here)
TRACE CDB_SUB_PROGRESS --> CONFD_OK
TRACE CDB_SYNC_SUB CDB_DONE_PRIORITY --> CONFD_OK
DONE
```
