[NETCONF-134] NullPointerException when entering data with undefined element at first level Created: 28/Jan/16  Updated: 15/Mar/19  Resolved: 24/Feb/16

Status: Resolved
Project: netconf
Component/s: netconf
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Jozef Behran Assignee: Tomas Cere
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Attachments: File karaf.log.xz    
External issue ID: 5125

 Description   

Tested on: stable/beryllium
Caught by: MDSAL Northbound suite (https://git.opendaylight.org/gerrit/33643/)

1. Make sure odl-clustering-test-app is NOT installed.
2. Open a Netconf connection to ODL and send the following request:

<rpc message-id="2" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target>
<candidate/>
</target>
<default-operation>merge</default-operation>
<config>
<cars xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car">
<car-entry>
<id>TOY001</id>
<model>Toyota Corolla</model>
<manufacturer>Toyota</manufacturer>
<year>2016</year>
<category>sedan</category>
</car-entry>
</cars>
<people xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:people">
<person>
<id>CUST001</id>
<age>32</age>
</person>
</people>
<car-people xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car-people">
<car-person>
<car-id>TOY001</car-id>
<person-id>CUST001</person-id>
</car-person>
</car-people>
</config>
</edit-config>
</rpc>

3. You will get the following response:

<rpc-reply a="64" message-id="2" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<rpc-error>
<error-type>application</error-type>
<error-tag>operation-failed</error-tag>
<error-severity>error</error-severity>
<error-message>Unexpected error</error-message>
<error-info>
<error>java.lang.NullPointerException</error>
</error-info>
</rpc-error>
</rpc-reply>

I expected something along the lines of "Element 'cars' not found" or "No model for element 'cars' found" or even "Unknown child element(s) ... 'cars' ...". Or something mentioning "people" or "car-people" or even their namespaces (urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:

{car|people|car-people}

).



 Comments   
Comment by Jozef Behran [ 28/Jan/16 ]

Attachment karaf.log.xz has been added with description: Compressed log from the test run exhibiting the bug

Comment by Jozef Behran [ 28/Jan/16 ]

I suspect the problem is caused by the element in the nonexistent namespace being in the first level (directly contained in <config>). I came to this conclusion after realizing that this request works (with the odl-clustering-test-app feature installed) (note the bogus element is contained within a valid element):

<rpc message-id="2" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target>
<candidate/>
</target>
<default-operation>merge</default-operation>
<config>
<cars xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:sal-clustering-it:car">
<does-not-exist xmlns="urn:this:is:in:a:nonexistent:namespace">
<entry>
<id>TOY001</id>
<name>Some Toy</name>
<year>2016</year>
<category>toys</category>
</entry>
</does-not-exist>
</cars>
</config>
</edit-config>
</rpc>

which gives this reply:

<rpc-reply message-id="2" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<rpc-error>
<error-type>application</error-type>
<error-tag>operation-failed</error-tag>
<error-severity>error</error-severity>
<error-message>Unexpected error</error-message>
<error-info>
<error>java.lang.IllegalStateException: Unknown child(ren) node(s) detected, identified by: (urn:this:is:in:a:nonexistent:namespace)does-not-exist, in: container cars</error>
</error-info>
</rpc-error>
</rpc-reply>

(note that the <error> element mentions both, "urn:this:is:in:a:nonexistent:namespace" and "does-not-exist")

while this request (note that the bogus element is directly under <config>):

<rpc message-id="2" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target>
<candidate/>
</target>
<default-operation>merge</default-operation>
<config>
<does-not-exist xmlns="urn:this:is:in:a:nonexistent:namespace">
<entry>
<id>TOY001</id>
<name>Some Toy</name>
<year>2016</year>
<category>toys</category>
</entry>
</does-not-exist>
</config>
</edit-config>
</rpc>

results in "java.lang.NullPointerException" in the <error> tag.

Comment by Jozef Behran [ 28/Jan/16 ]

Added a testcase against this into the MD-SAL suite: https://git.opendaylight.org/gerrit/33685

Comment by Tomas Cere [ 02/Feb/16 ]

https://git.opendaylight.org/gerrit/#/c/33904/

Generated at Wed Feb 07 20:14:15 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.