dnode does not gives the pointer to dnode of the leafref.
There are two tables lib and routing.
routing table has the leafref to one entry in the lib table.
typedef interface-ref {
type leafref {
path "/lib/interface/name";
require-instance false;
}
description
"Reference to a interface";
}
container lib {
list interface {
key "name";
leaf name {
type string {
length "1..36";
}
description
"interface name.";
}
}
}
container routing {
list interface-list {
key "interface";
leaf interface {
type interface-ref;
description
"Leaf ref to interface table";
}
}
}
Now we have configured both the tables.
suppose lib has dnodes as below :
/lib/interface/ens193 ---> A
/lib/interface/ens194 ---> B
suppose routing has dnodes as below :
/routing/interface-list/ens193 ----> X
Now if we dereference Node X then our expectation is it should have a pointer to A.
But at present it returns the value type LY_TYPE_STRING, It should be LY_TYPE_LEAFREF and points to dnode A.
A small snippet from our code base :
(gdb) p *(const struct lyd_node_leaf_list *)dnode
$1 = {schema = 0x55555561d9b0, validity = 0 '\000', dflt = 0 '\000', when_status = 6 '\006', attr = 0x0, next = 0x0, prev = 0x5555556f1de0,
parent = 0x5555556ef280, priv = 0x0, hash = 3268422503, value_str = 0x555555635aa0 "ens193", value = {binary = 0x555555635aa0 "ens193",
bit = 0x555555635aa0, bln = -96 '\240', dec64 = 93824993155744, enm = 0x555555635aa0, ident = 0x555555635aa0, instance = 0x555555635aa0,
int8 = -96 '\240', int16 = 23200, int32 = 1432574624, int64 = 93824993155744, leafref = 0x555555635aa0, string = 0x555555635aa0 "ens193",
uint8 = 160 '\240', uint16 = 23200, uint32 = 1432574624, uint64 = 93824993155744, ptr = 0x555555635aa0}, value_type = LY_TYPE_STRING,
value_flags = 1 '\001'}
dnode does not gives the pointer to dnode of the leafref.
There are two tables lib and routing.
routing table has the leafref to one entry in the lib table.
Now we have configured both the tables.
suppose lib has dnodes as below :
/lib/interface/ens193 ---> A
/lib/interface/ens194 ---> B
suppose routing has dnodes as below :
/routing/interface-list/ens193 ----> X
Now if we dereference Node X then our expectation is it should have a pointer to A.
But at present it returns the value type LY_TYPE_STRING, It should be LY_TYPE_LEAFREF and points to dnode A.
(gdb) p *(const struct lyd_node_leaf_list *)dnode
$1 = {schema = 0x55555561d9b0, validity = 0 '\000', dflt = 0 '\000', when_status = 6 '\006', attr = 0x0, next = 0x0, prev = 0x5555556f1de0,
parent = 0x5555556ef280, priv = 0x0, hash = 3268422503, value_str = 0x555555635aa0 "ens193", value = {binary = 0x555555635aa0 "ens193",
bit = 0x555555635aa0, bln = -96 '\240', dec64 = 93824993155744, enm = 0x555555635aa0, ident = 0x555555635aa0, instance = 0x555555635aa0,
int8 = -96 '\240', int16 = 23200, int32 = 1432574624, int64 = 93824993155744, leafref = 0x555555635aa0, string = 0x555555635aa0 "ens193",
uint8 = 160 '\240', uint16 = 23200, uint32 = 1432574624, uint64 = 93824993155744, ptr = 0x555555635aa0}, value_type = LY_TYPE_STRING,
value_flags = 1 '\001'}