Consider this yang model :
container servers { list server { key name; max-elements 64; leaf name { type string; } leaf ip { type inet:ip-address; } } }
When I try to get a list element in maapi side using keypath with index, using maapi_get_ipv4(/servers/server[index]/ip, &ip_addr), it gives the following error :
DEBUG badly formatted or nonexistent path - Expected a key, not “[0]” after: /servers/server
But in case of cdb_get_ipv4 for the same path(cdb_get_ipv4(/servers/server[index]/ip, &ip_addr)), it gives proper output as expected. I don’t understand why this is happening. Do explain if I am doing something wrong.
Thanks,
Smruti Ranjan