Bug 3822: Improve error reporting for restconf PUT 37/25337/2
authorTom Pantelis <tpanteli@brocade.com>
Sat, 20 Jun 2015 08:09:47 +0000 (04:09 -0400)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 2 Sep 2015 00:33:31 +0000 (00:33 +0000)
commitd94951e2d26e87275f7af0aacec97eb805c6c1e3
tree533b01c90828166b9701800acbc0d4ab3ff07390
parent766df8b58cc1decd7b40e0adbf41d3657fc21f2c
Bug 3822: Improve error reporting for restconf PUT

A runtime exception can be emitted by the netconf mount point which
should be reported to the user, otherwise you get a 500 response with
no error info which isn't very helpful.

Also the fucntionality to output the error-info field was ommitted with
the conversion from CompositeNode to NormalizedNode so I re-implemeneted
it. It was originally ommitted with a TODO b/c the
NormalizedNodeStreamWriters validate against the schema and error-info
is defined as an empty container in the restconf yang. So there's no way
to create a ContainerNode to represent the error-info data that conforms
to the schema. To work around this, I created a leaf node and special-cased
error-info in the stream writer to elide schema validation.

I also added a regression unit test for the case where the URL contains
an identityref.

Change-Id: I93b4aea25c829af1232d539180f02dd61e252d50
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfDocumentedExceptionMapper.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfDocumentedExceptionMapperTest.java
opendaylight/md-sal/sal-rest-connector/src/test/resources/full-versions/test-module/test-module.yang