ConfD User Community

Reg must constraint for leaf can be updated only once

Hi,
My yang is like this

container c1 {
leaf l1;
leaf l2;

}
we have a requirement like, one one time leaf value can be set. After that, leaf values must not be modified . Only user can delete and change these values back. Is there any provision to support this through yang must constraint.

Thanks
Phani

The standard approach is to disable modifications of those two leaves using NACM rules denying the update operation; something like

nacm rule-list myrule
 group [ myusers ]
 rule l1
  module-name       mymodule
  path              /c1/l1
  access-operations update
  action            deny
 !
 rule l2
  module-name       mymodule
  path              /c1/l2
  access-operations update
  action            deny
 !
!

The group myusers should contain all users that should be afffected by these rules; or you can use * to affect really everyone.