Commit fails due to ordering issue in yang

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;
  }
}

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