CESNET / netopeer2

NETCONF toolset
BSD 3-Clause "New" or "Revised" License
300 stars 189 forks source link

Issues in specific Error tags generation #1556

Open Omnamasivaya26 opened 7 months ago

Omnamasivaya26 commented 7 months ago

As per RFC6241, I am supposed to push these errors using edit-config in Netopeer2, but I'm unable to get the below error tags. Instead, I'm getting an 'operation-failed' error-tag. I have checked with other Netopeer versions, including version 2.1.36, where it described the fix for Netconf error tags, but still, I'm unable to see the expected error-tag. Any guidance would be much appreciated.

1.error-tag: missing-attribute error-type: rpc, protocol, application error-severity: error error-info: : name of the missing attribute.

: name of the element that contains the unexpected attribute Description: An expected attribute is missing. 2.error-tag: unknown-attribute error-type: rpc, protocol, application error-severity: error error-info: : name of the unexpected attribute : name of the element that contains the unexpected attribute Description: An unexpected attribute is present. 3.error-tag: missing-element error-type: protocol, application error-severity: error error-info: : name of the missing element Description: An expected element is missing. 4.error-tag: resource-denied error-type: transport, rpc, protocol, application error-severity: error error-info: none Description: Request could not be completed because of insufficient resources. 5.error-tag: malformed-message error-type: rpc error-severity: error error-info: none Description: A message could not be handled because it failed to be parsed correctly. For example, the message is not well-formed XML or it uses an invalid character set.
michalvasko commented 7 months ago

Describe the exact use-cases for all of these errors and I can add them if it makes sense.

Omnamasivaya26 commented 7 months ago

Describe the exact use-cases for all of these errors and I can add them if it makes sense.

To validate or modify the Netconf server by pushing XMLs is the traditional approach, and the error-tag is essential for pinpointing exact issues within the XML.For example, If an XML includes an unknown or missing attribute, it should accurately trigger the specified error-tag. This precision is vital for ensuring proper validation of the Netconf server. Therefore, the error tags I have mentioned appear to be crucial for validation

1)While using edit-config, If the xml have an expected attribute missing then it should throw the missing-attribute error tag

2)Similarly, If the xml have an undefined attribute then it should throw the unknown-attribute error tag

3)Similarly, If the xml have an expected element missing then it should throw the missing-element error tag

4)Similarly, If the xml request failed due to insufficient resource then it should throw the resource-denied error tag

5)Similarly A message could not be handled because it failed to be parsed correctly. For example, the message is not well-formed XML or it uses an invalid character should throw the malformed-message error tag.

I'm relatively new, so forgive me if I'm mistaken. When I looked into RFC6241 Appendix B, I noticed the code file netconf.xsd. Does that kind of code need to be manually configured on the server side, or is it integrated with the Netopeer package? because that seems to be defining the error tag.

michalvasko commented 7 months ago

I may have not been clear enough, please provide the RPC message or the steps to generate the message that you think does not return the expected error. Most of them should be handled but some are not mostly because there is no way of generating such messages with libnetconf2 client API.

Omnamasivaya26 commented 7 months ago

Sorry , I couldn't get you properly. Basically consider any of the xml for this case , lets assume supervision xml , the original xml was

**<supervision-watchdog-reset xmlns="urn:o-ran:supervision:1.0">  
    <input>
         <supervision-notification-interval>60</supervision-notification-interval>
         <guard-timer-overhead>10</guard-timer-overhead>           
    </input>   
</supervision-watchdog-reset>**

Sorry if I'm wrong, when I'm about to add a new unknown attribute like michal='123' in the above xml ,


**<supervision-watchdog-reset xmlns="urn:o-ran:supervision:1.0"  michal='123' >  
    <input>
         <supervision-notification-interval>60</supervision-notification-interval>
         <guard-timer-overhead>10</guard-timer-overhead>           
    </input>   
</supervision-watchdog-reset>**

So now it should need to throw the error tag like

error-tag: unknown-attribute error-type: rpc, protocol, application error-severity: error error-info: : name of the unexpected attribute: name of the element that contains the unexpected attribute Description: An unexpected attribute is present.

but the actual output is ok , it doesn't bother about that undefined attribute.

similar process for the above error tags I've mentioned. The relatable information was defined in RFC6241 APPENDIX A,B,C --> https://datatracker.ietf.org/doc/html/rfc6241