CESNET / libnetconf

C NETCONF library
Other
113 stars 84 forks source link

libnetconf don't support "must" statement ? #264

Closed zyboy2000 closed 7 years ago

zyboy2000 commented 7 years ago

libnetconf don't support "must" statement,because it has no xpath support ?? container devinfo { leaf devicename { type string; config false; } leaf testname { type string; must "../devicename='DCI'"{ } } }

error printf "Datastore fails to validate: condition "../devicename='DCI'" must be true ,

but devicename in get_state_data() already assignment “DCI” xmlNewChild(container_cur, container_cur->ns, BAD_CAST "devicename", BAD_CAST "DCI")

rkrejci commented 7 years ago

xpath support is mainly about xpath support in filters - see the xpath: capability in RFC 6020. The problem with your module is that you reference state data from the configuration data - see RFC 6020, section 7.5.3, the first point about the accessible tree.

zyboy2000 commented 7 years ago

thanks for your answer, you mean libnetconf don't support "must"? but code show some xmlpath functions(xmlXPathNewContext(), xmlxPathEvalExpression()), it can't work ?

michalvasko commented 7 years ago

Hi, what Radek meant is that the must condition of configuration leaf testname references state leaf devicename, which is in conflict with the mentioned RFC 6020 section. That is the reason it fails to validate, if you fix this problem, it should validate properly.

Regards, Michal

zyboy2000 commented 7 years ago

thanks. you mean devicename is illegal
leaf devicename { type string; config false; //this is wrong when it as a "must" condition? }

rkrejci commented 7 years ago

problem is the combination of both (refering config false data from config true data), as described in the referenced RFC text, read it. It is actually not illegal, but you simply cannot see status data from config data.