# Commit fails due to ordering issue in yang

**URL:** <https://dmap-community.ductus.global/t/commit-fails-due-to-ordering-issue-in-yang/2754>\
**Category:** YANG\
**Created:** [November 8, 2019, 9:02am UTC](https://dmap-community.ductus.global/t/commit-fails-due-to-ordering-issue-in-yang/2754 "2019-11-08T09:02:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sidbhatt](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@sidbhatt](https://dmap-community.ductus.global/u/sidbhatt)\
**Post date:** [November 8, 2019, 9:02am UTC](https://dmap-community.ductus.global/t/commit-fails-due-to-ordering-issue-in-yang/2754/1 "2019-11-08T09:02:02Z")

</div>

Issue : When a ‘node-address’ is already linked with one ‘node-group’ and if we want to move that ‘node-address’ to another ‘node-group’, bulk transaction fails.  
Probably this is due to ‘ordering issue’ as ‘Yang model’ is not taking care of ‘removal’ & ‘add’ order of ‘node-address’.

So could you please help to find exact ‘tail-f:XX’ yang annotation ?

-Example-

## Existing Config:

```
node A
ip address 1.1.1.1
node B
ip address 2.2.2.2

```

## CLI config:

```
router(config)# node B
router(config-node-B)# no ip address 2.2.2.2
router(config-node-B)# ex
router(config)# node A
router(config-node-A)# ip address 2.2.2.2
router(config-node-A)# ex
router(config)#
router(config)# show config
node A <<<<< this is wrong, ‘no ip address 2.2.2.2’ in node B should be first 
ip address 2.2.2.2
!
node B
no ip address 2.2.2.2
!
router(config)# commit <<<<<< here commit fails, since ip 2.2.2.2 is already configured to node B

```

## Sample Yang Model:

```
list node-group {
  description
    "node Group";
  tailf:cli-mode-name "config-node-group";
  key "name";
  leaf name {
    type string;
  }
  leaf-list node-address {
    description
      "node ip address";
    tailf:cli-list-syntax;
    type inet:ipv4-address;
  }
}
```

---

<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:** [December 6, 2019, 6:04pm UTC](https://dmap-community.ductus.global/t/commit-fails-due-to-ordering-issue-in-yang/2754/2 "2019-12-06T18:04:01Z")

</div>

For handling ordering on that level I believe the fundamentally correct way is to deal with that issue in your configuration subscriber application.

E.g. two subscribers that use cdb\_cli\_diff\_iterate(), one that handle deletes that need to happen before a create and has higher priority that the other that handle the rest.

More:

- ConfD 7.3 UG Chapter 7.6. “CDB subscriptions” under “When adding a subscription point the client must also provide a priority…”
- The confd\_lib\_cdb(3) man page “cdb\_subscribe(…)” under “The priority value is an integer…”
- examples.confd/cdb\_subscription/trigger/cdb\_client\_B.c and cdb\_client\_A.c
