Get_element failed from NETCONF but succeeded from CLI with when clause

Hi, I have a yang that uses the when clause for one of the elements. The edit-conf keeps failing because of the when clause. However, from CLI and web GUI, it is fine. Can someone shed some light on this issue ? thx

Is the XPath expression in your when clause true when you try to do the ? Ultimately when ConfD processes the change from any northbound interface it won’t matter which northbound interface was used, only the current state of the configuration and what is being changed in the transaction.

Can you give the snippet of your YANG model with the when clause?

No, the xpath trace returns false when clause evaluated to false. However, with GUI or web GUI, it is evaluated to true. The when clause actually comes from operational data and we have a data provide for that. I am not sure if it makes any difference though. In terms of yang snippet, here it is:

list assignment-lists {
when “/org-mycompany-device/info/device-type=‘router’”;
key “assignment-number”;
uses assignment;
}

Where device-type is from operational data. The assignment is actually a group of leaf nodes.

Is the data here config-true data? RFC 6020 section 7.19.5 (first bullet on page 108 of the PDF version), says that the data looked at in the when statement has to come from the datastore where the operation is against, most likely the running datastore, which means that it also has to be config data. If you think about it, since operational data can change in ways difficult to predict, it really doesn’t make sense to have the presence or absence of configuration data depend on an operational data value.

However if this data is operational (impossible to tell from the little bit in your reply), then you can use operational data in the XPath expression.

thanks for the response.

The when case is actually operational (device-type=router) is an enum and it is operational. However, the assignment node is 100% config… Since you mentioned about data store. The data store when edit-config is entered, is the candidate. When I changed to running when doing the edit-config, it is actually, fine, but when the data store is candidate, then it is not working from netconf session.