ConfD User Community

Setting a config-false leaf based on another leaf value


#1

Hi,
I need some help implementing the following in my yang model.
What I have

  1. a list of events (event_list) with the name (ev_name) status (ev_status).
  2. a script which can change the ev_status for a particular ev_name in event_list.
  3. a list of interfaces (if_list) which can be configured with any of these events from event_list. I already have a subscription handler written for interface param updates.
 list event_list {
	key ev_name;
	leaf ev_name {
		 config true;
		 type string;
	 }
	 leaf ev_status{
		 config false;
		 tailf:writable true;
		 tailf:cdb-oper;
		 type uint8 ;
		 default true;
	}
  }
	 
  list if_list{
    leaf if_ev_name {
	    type string;
	}
	leaf if_ev_status {
	    type uint8 ;
		must "(. != /event_list[ev_name = current()/../if_ev_name]/if_ev_status)"{
			error-message "Event status is wrong";
			tailf:dependency "/event_list/ev_status";
		 }

Lets consider the following is configured initially

event_list[n].ev_status = disbale
event_list[n].ev_name = e1 ;

if_list[x].if_ev_name = e1;
if_list[x].if_ev_status = disable;

Now, my requirement is when the script is run to set for example as following
for event e1; event_list[n].ev_status = enable ;
if_list[x].if_ev_status also should be updated as “enable” and eventually interface-subscription-handler should be called.

Can it be done by using yang model options (using tailf dependency) ? Or do i need to write specific callpoint to do this?

Any help is appreciated.

Thanks,
Manisha.


#2

I think you need to implement set-hook callpoint (see Hooks section in ConfD user guide).
I see that ev_status is config false. I’m not fully sure if you can attach hook to config false element, even though it is in CDB, please try.