edward6018 / libnetconf

Automatically exported from code.google.com/p/libnetconf
Other
0 stars 0 forks source link

Yang MUST statement validation is failing #42

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
Yang File :
-----------
    container college-info {

        leaf college-name {         
            must "current() = 'NIT'";
            type string;
        }
    }
2.
Valid Configuration Data :
--------------------------
netconf> edit-config running
<college-info xmlns="http://www.adtran.com/ns/college"  
xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="create">
<college-name>NIT</college-name>
</college-info>

3.
Invalid Configuration Data :
----------------------------
netconf> edit-config running
<college-info xmlns="http://www.adtran.com/ns/college"  
xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="create">
<college-name>ABC</college-name>
</college-info>

4.
What is the expected output? What do you see instead?
Expected output :
-----------------
edit-config should pass for the valid configuration data
And
edit-config should fail for the invalid configuration data

Actual output :
----------------
edit-config is pass with even valid and invalid configuration data.

5. 
What version of the product are you using? On what operating system?
Version :
---------
libnetconf 0.8.0

Operating System :
-------------------
Ubuntu 12.04.4 LTS

6.
Please provide any additional information below.
Root Cause Analysis :
--------------------
Not properly parsing the result of xsltApplyStylesheet in datastore.c file, 
validate_ds function.

Code :
------
The below code/line is causing the problem.

if ((result = xmlXPathEvalExpression(BAD_CAST 
"/svrl:schematron-output/svrl:successful-report/svrl:text", ctxt)) != NULL) {

7.
Possible Solution:
------------------
By changing the above code as below, it is working properly.

if ((result = xmlXPathEvalExpression(BAD_CAST 
"/svrl:schematron-output/svrl:failed-assert/svrl:text", ctxt)) != NULL) {

8.
Summary :
Replaced "successful-report" with "failed-assert".

Original issue reported on code.google.com by hihar...@gmail.com on 24 Sep 2014 at 5:38

GoogleCodeExporter commented 9 years ago

Original comment by rkre...@cesnet.cz on 30 Sep 2014 at 7:27

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 2394e7def7b0.

Original comment by rkre...@cesnet.cz on 30 Sep 2014 at 8:22