# Get-next is being called multiple times with next (-1)

**URL:** <https://dmap-community.ductus.global/t/get-next-is-being-called-multiple-times-with-next-1/3441>\
**Category:** CDB and CDB API\
**Created:** [January 5, 2021, 12:44pm UTC](https://dmap-community.ductus.global/t/get-next-is-being-called-multiple-times-with-next-1/3441 "2021-01-05T12:44:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Haripriya](https://avatars.discourse-cdn.com/v4/letter/h/3d9bf3/32.png) [@Haripriya](https://dmap-community.ductus.global/u/Haripriya)\
**Post date:** [January 5, 2021, 12:44pm UTC](https://dmap-community.ductus.global/t/get-next-is-being-called-multiple-times-with-next-1/3441/1 "2021-01-05T12:44:46Z")

</div>

Hi,

I have a nested list with a single tailf callpoint as shown below.

While executing the “show RMANB du riu”, I do get the get\_next call multiple  
times with -1 **even though all the keys values are set and sent back to Confd on the 1st call itself.**

```auto
258 CONFD_SET_IPV4(&v[0], curr->ip4);
259 CONFD_SET_STR(&v[1], curr->iface);
260 confd_data_reply_next_key(tctx, &v[0], 2, (long)curr->next);

```

Would appreciate any feedback on why I am getting so.

```auto
===============Log Trace==============================

TRACE CALL data get_next(thandle=202, /RMANB/du, -1) 
----------------->Set Keys!!
 --> CONFD_OK
TRACE CALL data get_next(thandle=202, /RMANB/du, -1) 
----------------->Set Keys!!
  --> CONFD_OK
TRACE CALL data get_next(thandle=202, /RMANB/du{10.24.12.1 ens32}/riu, -1) 
----------------->Set Keys!!
 --> CONFD_OK
TRACE CALL data get_next(thandle=202, /RMANB/du{10.24.12.1 ens32}/riu, -1) 
----------------->Set Keys!!
 --> CONFD_OK
TRACE CALL data get_elem(thandle=202,/RMANB/du{10.24.12.1 ens32}/riu{10.24.12.1 ens32}/hwaddr)
 
 ("e8:f7:24:9d:3e:64") --> CONFD_OK
......

```

```auto
=======================YANG ========================

  container RMANB {
    config false;
    **tailf:callpoint du;**
    list du {
      key "ip ifname";
      max-elements 1024;
      leaf ip {
        type inet:ip-address;
      }
      leaf ifname {
        type string;
      }
      leaf hwaddr {
        type string;
        mandatory true;
      }
      list riu {
        key "ip iface";
        max-elements 1024;
        leaf ip {
           type inet:ip-address;
        }
        leaf iface {
          type string;
        }
        leaf hwaddr {
          type string;
        }
      }
    }
  }

```

Note:  
Reference- confd-7.3.1/examples.confd/intro/5-c\_stats.

Thank you in advance.

Regards,  
Haripriya

---

<div class="post-metadata">

**Author:** ![Haripriya](https://avatars.discourse-cdn.com/v4/letter/h/3d9bf3/32.png) [@Haripriya](https://dmap-community.ductus.global/u/Haripriya)\
**Post date:** [January 6, 2021, 2:06pm UTC](https://dmap-community.ductus.global/t/get-next-is-being-called-multiple-times-with-next-1/3441/2 "2021-01-06T14:06:30Z")

</div>

As per the comment in one of the earlier post getting (-1) multiple times is not a problem as long as its being handled properly.

> [@Get\_next is called many time before get\_object, when CLI command is executed twice](http://dmap-community.ductus.global/t/get-next-is-called-many-time-before-get-object-when-cli-command-is-executed-twice/3364):
>
> Guys I am totally stuck with this issue. I have two elements to print. Example item1 and item2 When the command is executed from CLI once, then everything works smoothly. get\_next calls twice with -1, then it calls with valid next address i.e. get\_next(-1) -\> get\_next(-1) -\> get\_next(item1 address) -\> get\_object() -\> get\_next(item2 address) -\> get\_object If I execute the CLI command again within a second after the previous command. Then get\_next is called twice with -1 then get\_next twic…

Please do let me know if I am missing something here.

---

<div class="post-metadata">

**Author:** ![mvf](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mvf/32/182_2.png) [@mvf](https://dmap-community.ductus.global/u/mvf)\
**Post date:** [January 7, 2021, 10:31am UTC](https://dmap-community.ductus.global/t/get-next-is-being-called-multiple-times-with-next-1/3441/3 "2021-01-07T10:31:55Z")

</div>

Yes, your data provider callbacks should not make any assumptions about how often the iteration can be restarted; and in particular in case of CLI it is always the case that a command like `show RMANB du riu` causes two `get_next(-1)` invocations.
