ConfD User Community

How to use when statement with identityref

Hello all,

I am trying to display notify-update-retry-count leaf only when interface-type is set to n1 with below YANG model.

identity INTERFACE_TYPE {
    description
        "The interface type of the endpoint";
}
identity n1 { base INTERFACE_TYPE; tailf:info "Interface n1"; }
identity n2 { base INTERFACE_TYPE; tailf:info "Interface n2"; }


    list interface {
        tailf:info "Configure Interfaces";
        key "interface-type";
      unique "port";
        leaf interface-type {
            type identityref {
                tailf:info "Configure NF Interfaces";
                base INTERFACE_TYPE;
            }
        }
        leaf-list ip {
            tailf:info "Specify ip for the interface";
            type inet:ip-address;
      }
      leaf port {
        	tailf:info "Port for Interface";
        	type int32;
        }

        leaf outbound-request-timeout-ms {
            tailf:info "Timeout in milliseconds for outbound requests";
            type int32;
        }
  
        leaf notify-update-retry-count {
  	tailf:display-when "../interface-type = 'n1'";
            tailf:info "outbound requests";
  		type int32;
            default 1;
        }
  
        leaf notify-test-count {
            tailf:info "Checking the simple change";
  		type int32;
            default 1;
        }	    
    } 

However, with above YANG, notify-update-retry-count is not getting displayed at all.

Please let me know if I am missing something.

Thanks for your help in advance.

As per the examples provided at https://tools.ietf.org/html/rfc7950#page-164, issue got resolved after using prefix ‘pcf’.

Below is the updated when condition.

leaf notify-update-retry-count {
    	tailf:display-when "../interface-type = 'pcf:n1'";
    tailf:info "outbound requests";
	type int32;
    default 1;
}