Bug 3822: Improve error reporting for restconf PUT 50/27050/2
authorTom Pantelis <tpanteli@brocade.com>
Sat, 20 Jun 2015 08:09:47 +0000 (04:09 -0400)
committerJMorvay <jmorvay@cisco.com>
Wed, 16 Sep 2015 14:51:18 +0000 (16:51 +0200)
commitfa9c8c2f3a2f762e311510c977932bcf5a7e933e
treeac4185349576ff2b2263e8064648c142f38640b1
parent535539c42e6c506f3d709635780dff3f0856f905
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>
Signed-off-by: JMorvay <jmorvay@cisco.com>
opendaylight/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/RestconfDocumentedExceptionMapper.java
opendaylight/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java
opendaylight/restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java
opendaylight/restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfDocumentedExceptionMapperTest.java
opendaylight/restconf/sal-rest-connector/src/test/resources/full-versions/test-module/test-module.yang