Why the other list callpoint called?

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?

Since you have a keyless da list, it gets slightly complicated to explain the format of your output. Let me go with the scenario that you have 14 instances in the “da” list, each with 1 unique key. The first two columns show the values for the level1 list and the last 2 columns show the values for the level2 list. The first 3 instances of your da list only consist of 1 level1 entry each. The 4th instance has 1 level1 entry and 1 level2 entry. The next 3 consists of 1 level2 entry each, and so on. The CLI show output will line up level1 and level2 list entries that belong to the same da list instance on the same row. If only level2 entries exist for that da list instance, the first 2 columns will be blank.

The filtering is being done for the entire da list, not just the level1 sublist. If a match occurs within a “da” list instance, the entire instance which may consist of multiple level1 of level2 list entires will be shown.

How can I only filter level1 list?

You can do the following:

show da | select level1

to show just the level1 list. You can also pipe the output of the above to the “include” command to do further filtering as necessary.

Hi All,

Sorry to bump up an old thread …

but is it always mandatory to have multiple call points (da,da-l1,da-l2 ) in the first place (in the yang file).

I was hoping registration done by daemon for “da” would get called for any of its lower levels ,
OR does one call point only handle a single list element in yang ??

~ascesh

It isn’t mandatory to have multiple callpoints in the example YANG model used in this posting. It is perfectly fine to define just a single callpoint at the top level for the da list and implement your callbacks accordingly to support the entire nested list.