instance-identifier validation

123 views
Skip to first unread message

ingwhe...@gmail.com

unread,
Apr 16, 2015, 3:39:15 AM4/16/15
to libne...@googlegroups.com
Hello,

My apologies in advance if this is bone-headed post.

I was wondering if instance-identifier type is supported. Which stylesheets are required to validate instance-identifier and where would libnetconf look for those stylesheets?

It's possible that it's my own fault, because I installed libnetconf in an unconventional environment.

But I noticed that the relaxng-lib.rng that libnetconf's tool generated is different from the relaxng-lib.rng generated by yang2dsdl. The one from libnetconf's tool was missing the definition of __instance-identifier__. (It was missing __anyxml__ as well.)

When I added the __instance-identifier__ definition into relaxng-lib.rng, libnetconf was able to parse instance-identifier-model-data.rng file correctly, for a model that uses instance-identifier. (Using the relaxng-lib.rng created by libnetconf's tool, libnetconf couldn't parse the instance-identifier-model-data.rng .)

However, even though instance-identifier-model-data.rng is correctly parsed, at run-time, I run into trouble when the datastore validates the instance-identifier, because the function "evaluate" is not found.

It would be great if you could provide some hint of which stylesheet contains the "evaluate" function, where libnetconf expects to find such stylesheet, and if there's a way to configure the search directory of the stylesheet.

Thanks,
Helen

Radek Krejčí

unread,
Apr 16, 2015, 5:19:18 AM4/16/15
to ingwhe...@gmail.com, libne...@googlegroups.com
Hi Helen,

I've just pulled the changes of the RNG/Schematron generators from pyang, so lnctool should now (in master and 0.9.x branches) use the same generators as pyang (yang2dsdl).

To reflect the changes, you should regenerate your *.rng and *schematron.xsl files using lnctool .. validation command. libnetconf does not use the relaxng-lib.rng and gen-schematron.xsl directly, they are just used to generate *-config.rng and *schematron.xsl files for the specific data model. Validation is then done by libxml2 and libxsltusing the mentioned files.

Please, try to regenerate your validators and then let me know if it helped.

Regards,
Radek


Dne 15.4.2015 v 23:03 ingwhe...@gmail.com napsal(a):

ingwhe...@gmail.com

unread,
Apr 16, 2015, 4:10:10 PM4/16/15
to libne...@googlegroups.com, Ing-Wher (Helen) Chen
Hi Radek,

Thanks for your swift action.

I still see that the "evaluate" function isn't found. Any hints on how to fix this is appreciated.

I regenerated the validations files with the new lnctool using "lnctool --model ./model.yang validation", but the content of the generated didn't change. However, relaxng-lib.rng has changed to include the definition of __instance-identifier__, which means that I no longer need to use the relaxng-lib.rng file generated by yang2dsdl.

Thanks,
Helen

P.S. The error I still see is as follows:

D| RelaxNG validation on subdatastore 1804289384
D| Schematron validation on subdatastore 1804289384
xmlXPathCompOpEval: function evaluate not found
XPath error : Unregistered function
xmlXPathCompiledEval: 1 objects left on the stack.

P.P.S. It looks like relaxng-lib.rng is used at runtime to perform validation. The path to the file is included in a model's *-data.rng file. The initial setup, ncds_set_validation() , for *-data.rng happens correctly only if I point the included path to the actual relaxng-lib.rng file.

Radek Krejčí

unread,
Apr 17, 2015, 8:48:28 AM4/17/15
to ingwhe...@gmail.com, libne...@googlegroups.com
Hi Helen,

actually according to the log, the problem is not with the RelaxNG part, but with the schematron. Can you provide the <model-name>-schematron.xsl file generated by lnctool for your data model? And also the data model itself.

Regards,
Radek


Dne 16.4.2015 v 22:10 ingwhe...@gmail.com napsal(a):

ingwhe...@gmail.com

unread,
Apr 17, 2015, 12:33:35 PM4/17/15
to libne...@googlegroups.com, Ing-Wher (Helen) Chen
Thanks, Radek, for continuing to help. I've attached the two files.

Thanks,
Helen
references-schematron.xsl
references.yang

Radek Krejčí

unread,
Apr 20, 2015, 5:03:04 AM4/20/15
to ingwhe...@gmail.com, libne...@googlegroups.com
Hi Helen,
it works for me:

netconf> get-config running

Result:
<c xmlns="http://www.example.com/references">
<seq>1</seq>
</c><c xmlns="http://www.example.com/references">
<seq>2</seq>
<l1>
<name>one</name>
</l1>
<l1>
<name>two</name>
</l1>
</c><c xmlns="http://www.example.com/references">
<seq>3</seq>
<l2>
<id>1</id>
</l2>
<l2>
<id>2</id>
</l2>
</c><c xmlns="http://www.example.com/references">
<seq>4</seq>
<l1>
<name>one</name>
</l1>
<l1>
<name>two</name>
</l1>
<l2>
<id>1</id>
<l1-ref>
<name>/refs:c[4]/refs:l1[1]</name>
</l1-ref>
</l2>
</c>

... other config data I have in server

netconf> validate running

Result OK
netconf>


But I had to update the schematron file since it wasn't generated by the last lnctool using the update files from pyang. Please make sure, that you are running the current lnctoolto generate the validation files. If you run it locally from libnetconf source tree, do:

$ cd dev-tools/lnctool
$ ./lnctool --model references.yang validation


You can also check the netopeer-server, using -v 3 option. During the startup, you should see something like this. Make sure that the files used by the server are the files you want to use:

...
netopeer-server[5473]: Adding base model "/home/krejci/svn/libnetconf/test/references.yin"
netopeer-server[5473]: ncds_features_parse: no feature definitions found in data model references.
netopeer-server[5473]: ncds_new_internal: Relax NG validator set (/home/krejci/svn/libnetconf/test/references-config.rng)
netopeer-server[5473]: ncds_new_internal: Schematron validator set (/home/krejci/svn/libnetconf/test/references-schematron.xsl)
netopeer-server[5473]: Datastore references initiated with ID 1681692778.


I'm attaching the files I get from lnctool.You can compare them to files you got.

Regards,
Radek


Dne 17.4.2015 v 18:33 ingwhe...@gmail.com napsal(a):
references-config.rng
references-gdefs-config.rng
references-schematron.xsl
references.yin

Radek Krejčí

unread,
Apr 20, 2015, 6:14:06 AM4/20/15
to ingwhe...@gmail.com, libne...@googlegroups.com
Hi,
I googled a little bit and the problem can be in the libxslt (its version) you are using. Please check, that your libxslt supports the evaluate function needed by schematron:

$ xsltproc --dumpextensions | grep {http://exslt.org/dynamic}evaluate

If your output is empty, libxslt does not support it and you should /recompile it or update.

Radek


Dne 20.4.2015 v 11:03 Radek Krejčí napsal(a):
Reply all
Reply to author
Forward
0 new messages