[NETCONF-31] Improve error reporting when controller-config mount operation fails Created: 19/Jun/15 Updated: 15/Mar/19 Resolved: 24/Nov/15 |
|
| Status: | Resolved |
| Project: | netconf |
| Component/s: | netconf |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Tom Pantelis | Assignee: | Tom Pantelis |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: All |
||
| External issue ID: | 3822 |
| Priority: | High |
| Description |
|
After a new netconf connector config is POSTED, you can't update it via restconf (nor DELETE or GET). With POST you get "data already exists", which makes sense since POST is create-if-not-exists (although this erroneously worked in Helium). PUT with, eg, the following URL: should work but fails with error: "odl-sal-netconf-connector-cfg:sal-netconf-connector from URI can't be resolved. For key which is of type identityref it should be in format module_name:identity_name." Clearly "odl-sal-netconf-connector-cfg:sal-netconf-connector" is in the correct format. The problem is in RestCodec.ObjectCodec#deserialize: if (type instanceof IdentityrefTypeDefinition) { logger.debug("Value is not instance of IdentityrefTypeDefinition but is {}. Therefore NULL is used as translation of - {}", It expects the 'input' value to be of type IdentityValuesDTO but it's a String. In fact the calling code in ControllerContext#addKeyValue specifically treats the value as a String. So there's a disconnect between ControllerContext and RestCodec.ObjectCodec. I'm not sure what the intent is here, ie who is supposed to parse the identityref string into an IdentityValuesDTO instance. I locally changed ObjectCodec#deserialize to check for instanceof String and parse into an IdentityValuesDTO. This fixed the problem. Note: with this bug no config module can be updated via restconf, including OOB ones. |
| Comments |
| Comment by Tom Pantelis [ 19/Jun/15 ] |
|
This might be a Lithium blocker. |
| Comment by Tom Pantelis [ 19/Jun/15 ] |
|
OK - now I'm confused. I realized there's another code path in ControllerContext#addKeyValue to handle identityrefs: Object decoded = codec.deserialize(urlDecoded); } So it simply parses the QName from the colon-separated string which is basically what I did in my changes. I removed my changes and now this code path works. I don't know why I was getting the error before. However, if you do a PUT with partial payload as outlined in https://wiki.opendaylight.org/view/OpenDaylight_Controller:Config:Examples:Netconf, it fails with 500 code but no error output or exception. |
| Comment by Tom Pantelis [ 19/Jun/15 ] |
|
Actually there is an error: 2015-06-19 07:11:40,424 | WARN | entLoopGroup-2-2 | ConfigTransactionControllerImpl | 333 | 189 - org.opendaylight.controller.config-manager - 0.3.0.SNAPSHOT | | Validation exception in ConfigTransaction-44-67 Since PUT is a replace, you need to specify the entire config. |
| Comment by Tom Pantelis [ 20/Jun/15 ] |
|
I'm going to use this bug improve the error reporting to the user. We should emit error info with the 500 response. |
| Comment by Robert Varga [ 13/Nov/15 ] |
|
Move to NETCONF project |
| Comment by Tomas Cere [ 24/Nov/15 ] |