I’ve got three list, one is da, the other two are level1 and level2 inner list da. I set different callpoint on each list which are “da”, “da-l1”, “da-l2”, and then I wanna the show each
list da {
config false;
tailf:callpoint "da";
list level1 {
tailf:callpoint "da-l1";
key id;
leaf id {type uint32;}
leaf v{type string;}
}
list level2 {
tailf:callpoint "da-l2";
key id;
leaf id {type uint32;}
leaf v{type string;}
}
}
int get_da_next(struct confd_trans_ctx *tctx, confd_hkeypath_t *keypath, long next)
{
confd_value_t vs[6];
int n = 0;
CONFD_SET_INT64(&vs[0], next); n++;
if (next < 1)
{
confd_data_reply_next_key(tctx, vs, n, ++next);
}
else
{
confd_data_reply_next_key(tctx, NULL, 0, -1);
}
return CONFD_OK;
}
int get_da_elem(struct confd_trans_ctx *tctx, confd_hkeypath_t *kp)
{
confd_value_t v = {0};
confd_data_reply_value(tctx, &v);
return CONFD_OK;
}
int get_dal_next(struct confd_trans_ctx *tctx, confd_hkeypath_t *keypath, long next)
{
confd_value_t vs[6];
int n = 0;
CONFD_SET_INT32(&vs[0], next); n++;
if (next < 3)
{
confd_data_reply_next_key(tctx, vs, n, ++next);
}
else
{
confd_data_reply_next_key(tctx, NULL, 0, -1);
}
return WCONFD_OK;
}
int get_dal_elem(struct confd_trans_ctx *tctx, confd_hkeypath_t *kp)
{
confd_value_t v;
char buf[32] = {0};
switch(CONFD_GET_XMLTAG(&kp->v[0][0]))
{
case wdemo_id:
CONFD_SET_UINT32(&v, 1);
break;
case wdemo_v:
sprintf(buf, "level:%d in da[%d]", CONFD_GET_XMLTAG(&kp->v[2][0]) == wdemo_level1?1:2, CONFD_GET_INT64(&kp->v[3][0]));
CONFD_SET_STR(&v, buf);
break;
}
confd_data_reply_value(tctx, &v);
return CONFD_OK;
}
First the output of show da is hard to read(to da entries, 4 level1 entries and 4 level2 entries), I know that use show template could make a pretty look, but why the default show like this?
localhost# show da
ID V ID V
----------------------------------------------
-1 level:1 in da[-1]
0 level:1 in da[-1]
1 level:1 in da[-1]
2 level:1 in da[-1] -1 level:2 in da[-1]
0 level:2 in da[-1]
1 level:2 in da[-1]
2 level:2 in da[-1]
-1 level:1 in da[0]
0 level:1 in da[0]
1 level:1 in da[0]
2 level:1 in da[0] -1 level:2 in da[0]
0 level:2 in da[0]
1 level:2 in da[0]
2 level:2 in da[0]
localhost#
Second if I wanna show only level1 or level2 it works as expected:
localhost# show da level1
ID V
-----------------------
-1 level:1 in da[-1]
0 level:1 in da[-1]
1 level:1 in da[-1]
2 level:1 in da[-1]
-1 level:1 in da[0]
0 level:1 in da[0]
1 level:1 in da[0]
2 level:1 in da[0]
localhost# show da level2
ID V
-----------------------
-1 level:2 in da[-1]
0 level:2 in da[-1]
1 level:2 in da[-1]
2 level:2 in da[-1]
-1 level:2 in da[0]
0 level:2 in da[0]
1 level:2 in da[0]
2 level:2 in da[0]
But when I wanna filter the output by some leaf:
localhost# show da level1 v "level:1 in da[0]"
ID V ID V
--------------------------------------------
-1 level:1 in da[0]
0 level:1 in da[0]
1 level:1 in da[0]
2 level:1 in da[0] -1 level:2 in da[0]
0 level:2 in da[0]
1 level:2 in da[0]
2 level:2 in da[0]
It show me the output not as expected which expected to be
localhost# show da level1 v "level:1 in da[0]"
ID V ID V
--------------------------------------------
-1 level:1 in da[0]
0 level:1 in da[0]
1 level:1 in da[0]
2 level:1 in da[0]
I wanna know why the level2 list callpoint called too?