[CONTROLLER-315] Unable to descend in RESTCONF when key is type binary Created: 14/Apr/14 Updated: 25/Jul/23 Resolved: 06/Jun/14 |
|
| Status: | Verified |
| Project: | controller |
| Component/s: | restconf |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Dana Kutenicsova | 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 |
||
| External issue ID: | 724 |
| Priority: | High |
| Description |
|
restconf/operational/bgp-rib:bgp-rib/rib/example-bgp-rib/loc-rib/tables/bgp-linkstate:linkstate-address-family/bgp-linkstate:linkstate-subsequent-address-family/linkstate-routes Returns correct xml, but if I want to descend to one concrete linkstate-route <linkstate-route><route-key>AAEAJwIAAAAAAAAAAQEAABoCAAAEAAAASAIBAAQoKCgoAgMABgAAAAAAQA==</route-key><identifier>1</identifier> restconf/operational/bgp-rib:bgp-rib/rib/example-bgp-rib/loc-rib/tables/bgp-linkstate:linkstate-address-family/bgp-linkstate:linkstate-subsequent-address-family/linkstate-routes/linkstate-route/AAEAJwIAAAAAAAAAAQEAABoCAAAEAAAASAIBAAQoKCgoAgMABgAAAAAAQA== I get: No data exists. |
| Comments |
| Comment by Debolina Bandyopadhyay [ 24/Apr/14 ] |
|
(In reply to Dana Kutenicsova from comment #0) Hello Dana, It will be really helpful to reproduce this bug, if you can tell us the steps you followed, while you came across this bug. The configurations which you have done for this bug. |
| Comment by Tom Pantelis [ 29/May/14 ] |
|
I was able to reproduce the issue with this simple yang (added to the toaster): container routes { leaf route-key { type binary; } } After putting an entry with route-key "AAEAJwIAAAAAAAAAAQEAABoCAAAEAAAASAIBAAQoKCgoAgMABgAAAAAAQA==", a subsequent GET to: didn't return any data. The InstanceIdentifier lookup in the data store failed to return the node. I tracked the problem to the InstanceIdentifier.NodeIdentifierWithPredicates class hashCode/equals methods. It contains a key value Map and calls Map#hashCode and Map#equals. The problem is that the binary type is represented as a byte[] and Map performs shallow hashCode/equals so it would only work properly if the byte[] instances in the maps were the same. The same issue can occur with the NodeWithValue class. I think an ideal solution would be to wrap the byte[] in a Binary class that would perform the deep hashCode/equals but the byte[] representation is entrenched in he code generation and other places. In lieu of that, the InstanceIdentifier classes need to perform deep hashCode/equals on the key values. |
| Comment by Tom Pantelis [ 03/Jun/14 ] |
| Comment by Dana Kutenicsova [ 06/Jun/14 ] |
|
Verified against original problem. |