# Setting "no" to leaf deletes entire list

**URL:** https://dmap-community.ductus.global/t/setting-no-to-leaf-deletes-entire-list/3025
**Category:** YANG
**Created:** [April 23, 2020, 6:46am UTC](https://dmap-community.ductus.global/t/setting-no-to-leaf-deletes-entire-list/3025 "2020-04-23T06:46:22Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![iymmu](https://avatars.discourse-cdn.com/v4/letter/i/9fc29f/32.png) [@iymmu](https://dmap-community.ductus.global/u/iymmu)
#### Post date: [April 23, 2020, 6:46am UTC](https://dmap-community.ductus.global/t/setting-no-to-leaf-deletes-entire-list/3025/1 "2020-04-23T06:46:22Z")

</div>

Model is having a leaf node with default value “true”.  
When I give the “no” form of configuration it is deleting the list entry instead of setting “flase” to the leaf node.

Model example:

```auto
container box{
	list Item {
		tailf:cli-supress-mode;
		tailf:cli-delete-when-empty;
		key "name";
 		leaf name{
			type string;
		}
		container element {
			leaf leaf_name {
				tailf:cli-full-command;
				tailf:cli-boolean-no;
				tailf:cli-trim-default;
				type boolean;
				default "true";
			}
		}
	}
}

```

the config is :

box item item\_name element leaf\_name

If I give “no box Item item\_name element leaf\_name” it is not setting the “false” to the leaf.

Instead, it is deleting the list item. How to make “no” command, in this case, to set “false” to leaf node instead of deleting the list?

Confd generated XML for the “no” form of config.

```auto
  <box>
    <item operation="delete">
        <name>blue</name>
      </item>
  </box>

```

---

<div class="post-metadata">

### Author: ![mvf](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mvf/32/182_2.png) [@mvf](https://dmap-community.ductus.global/u/mvf)
#### Post date: [April 23, 2020, 8:21am UTC](https://dmap-community.ductus.global/t/setting-no-to-leaf-deletes-entire-list/3025/2 "2020-04-23T08:21:27Z")

</div>

Do you insist on all those `tailf:cli-...` statements? The combination of them is most likely what confuses ConfD. I don’t see anything that is outright prohibited, but do you need all of them, cannot you drop, for instance, the `cli-delete-when-empty` statement?

---

<div class="post-metadata">

### Author: ![iymmu](https://avatars.discourse-cdn.com/v4/letter/i/9fc29f/32.png) [@iymmu](https://dmap-community.ductus.global/u/iymmu)
#### Post date: [April 23, 2020, 9:08am UTC](https://dmap-community.ductus.global/t/setting-no-to-leaf-deletes-entire-list/3025/3 "2020-04-23T09:08:18Z")

</div>

thanks for your reply. cli-delete-when-empty is needed here, without that we have empty list configuration on CONFD. the empty list configuration is not accepted by device cli. Also when we delete the top level container box that empty list command creates problem in device cli.  
Is there any other way to set false to the end leaf ?

---

<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: [April 23, 2020, 9:53am UTC](https://dmap-community.ductus.global/t/setting-no-to-leaf-deletes-entire-list/3025/4 "2020-04-23T09:53:40Z")

</div>

> [@iymmu](#):
>
> Is there any other way to set false to the end leaf ?

As @mvf points out, tailf:cli-delete-when-empty deletes the list entry.

1. You seem to be using cdb\_get\_modifications() to “generate” XML according to the “examples.confd/cdb\_subscription/modifications”. You will not get deleted children in a list entry from cdb\_get\_modifications() when you delete it.
2. You have set the default value of “leaf\_name” to “true”, so the resulting config will always be “true” (never “false”) when you delete “leaf\_name”.

---

<div class="post-metadata">

### Author: ![mvf](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mvf/32/182_2.png) [@mvf](https://dmap-community.ductus.global/u/mvf)
#### Post date: [April 23, 2020, 10:09am UTC](https://dmap-community.ductus.global/t/setting-no-to-leaf-deletes-entire-list/3025/5 "2020-04-23T10:09:24Z")

</div>

> [@iymmu](#):
>
> the empty list configuration is not accepted by device cli

So you want to prevent empty lists. But `delete-when-empty` does not really help you with that. First, it only works on deletion, it does not do anything to prevent that the list is created empty. Second, it works only for CLI, and of that only for C- and I-style CLI; but you may want to assure this for other interfaces or other means of configuration.

What about stating your requirement using `must`? It might be a bit less convenient for a CLI operator, but more robust, in my opinion.
