Bug 3822: Improve error reporting for restconf PUT 43/23043/5
authorTom Pantelis <tpanteli@brocade.com>
Sat, 20 Jun 2015 08:09:47 +0000 (04:09 -0400)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 13 Aug 2015 20:35:46 +0000 (20:35 +0000)
commitd06705d3b01cbadbe8413cac7c24e14a66dbc219
treef11a62ff315529a660d0e0aed01a889dd0a428b9
parentd720d5e4c8c9baa7bee2a6bbca467a901fbc0f7d
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: I4bb0d767bb8008023e7ef10a439025e2e591f9cd
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