[CONTROLLER-192] Restconf is unable to handle anyxml attributes Created: 06/Mar/14  Updated: 25/Jul/23  Resolved: 30/Jun/14

Status: Resolved
Project: controller
Component/s: restconf
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Ashwin Pankaj Assignee: Tom Pantelis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Linux
Platform: PC


Attachments: Text File file_484.txt    
External issue ID: 484
Priority: High

 Description   

My yang model has anyxml attributes which contains XML data not related to my data model. Restconf is unable to ignore this and always complains about unknown tags.



 Comments   
Comment by Jozef Gloncak [ 07/Mar/14 ]

investigating

Comment by Jozef Gloncak [ 07/Mar/14 ]

I worked with following scenario
YANG file

module xml-test {
namespace "xml:test";
prefix "yang";

revision 2014-3-7 {
}

container cont {
leaf lf

{ type string; }

anyxml data {
}
}
}

I tried to PUT http://192.168.1.101:8080/restconf/config/xml-test:cont
following data
<cont xmlns="xml:test">
<lf>something</lf>
<data>
<data-inner>
<data-inner1>data1</data-inner1>
<data-inner1>data2</data-inner1>
</data-inner>
</data>
</cont>

I obtained following message
Schema node "data" was not found in module.

I found problem in RestconfImpl class and I did some fixes
https://git.opendaylight.org/gerrit/#/c/5565/

but I wasn't able to completely test it because of other error occured (see attachment). I wasn't able to found the reason. It seems to me that controller can't see *.class files which were generated for my YANG module.

Comment by Jozef Gloncak [ 07/Mar/14 ]

Attachment file_484.txt has been added with description: part of error message from osgi console

Comment by Tom Pantelis [ 22/May/14 ]

The DeserializationException no longer occurs with the new data store impl.

I was able to get this to work with some changes in RestConfImpl, DataNormalizationOperation and JsonMapper.

I defined an AnyXml yang container:

container AnyXml {
leaf leaf

{ type string; }

anyxml data {
}
}

PUT:
{
AnyXml:
{
leaf: "something",
data :
{
data-inner:

{ data-inner1 : "data1", data-inner2 : "data2", }

}
}
}

GET:
{
AnyXml:
{
leaf: "something"
data:
{
data-inner:

{ data-inner1: "data1" data-inner2: "data2" }

}
}
}

PUT with XML works but GET fails - needs minor changes in XmlDocumentUtils in yangtools.

One thing to note is that the generated AnyXml interface only contains the getLeaf() method - there's no method to retrieve the anyxml data. So it appears anyxml isn't supported by the yang code generator so it wouldn't be available to a binding-aware client.

Comment by Tom Pantelis [ 22/May/14 ]

Pushed:

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

with proposed changes. It depends on a draft for CONTROLLER-472 so not ready to merge but I'd welcome code review.

Comment by Tom Pantelis [ 23/May/14 ]

Pushed https://git.opendaylight.org/gerrit/#/c/7339/ to fix issue in XmlDocumentUtils.

Comment by Jozef Gloncak [ 17/Jun/14 ]

PatchSet9 was devided as follows (merging order in parenthesis):

Also AnyXmlNode is used in AnyXmlNormalization.normalize as was requested by Tony.

How should be JSON output which contains anyxml data printed? like XML (isn't implemented) or like JSON (is implemented by Tom)

Generated at Wed Feb 07 19:52:25 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.