[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
Platform: PC


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)
> 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.

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 {
list route {
key "route-key";

leaf route-key

{ type binary; }

}
}

After putting an entry with route-key "AAEAJwIAAAAAAAAAAQEAABoCAAAEAAAASAIBAAQoKCgoAgMABgAAAAAAQA==", a subsequent GET to:
/config/toaster:routes/route/AAEAJwIAAAAAAAAAAQEAABoCAAAEAAAASAIBAAQoKCgoAgMABgAAAAAAQA==

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 ]

Submitted: https://git.opendaylight.org/gerrit/#/c/7519/

Comment by Dana Kutenicsova [ 06/Jun/14 ]

Verified against original problem.

Generated at Wed Feb 07 19:52:43 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.