Hi,
I have a nested list(list within list).Inside low-level-tx-endpoints list there is number-of-prb-per-scs inner list having scs as key of inner list.
< low-level-tx-endpoints >
< name >LLTE-DCH-0 < /name >
< cp-length-other > 72 < /cp-length-other >
< number-of-prb-per-scs >
< scs>KHZ_15 < /scs >
< number-of-prb > 273 < /number-of-prb >
< /number-of-prb-per-scs >
</low-level-tx-endpoints>
I have subscribed to outer list through cdb_subscribe, so that any modification in any leaf my call back is getting invoked.
I am able to read all the leaf nodes of outer list.But i am not able to read any leaf node of inner list.
static void read_db_key_based_TxEndpoint(int cdbsock, confd_value_t *key)
{
int index = 0;
int pos = -1;
char tmp_key[30];
char *ptr;
confd_value_t key1;
/* which position should we overwrite */
for (index=0; index< MAX_ENDPOINT; index++) {
ptr=(char *)CONFD_GET_BUFPTR(key);
strncpy(tmp_key,ptr,CONFD_GET_BUFSIZE(key));
if (strcmp(tmp_key,Tx_EndPoints[index].KeyName)==0) {
pos = index;
break;
}
}
if (pos == -1) { /* pick first */
for (index=0; index < MAX_ENDPOINT; index++) {
if (!Tx_EndPoints[index].inuse) {
pos = index;
break;
}
}
}
alwaysLog("Picking %d\n", pos);
TxEndPoints *hp = &Tx_EndPoints[pos];
if (cdb_cd(cdbsock, "/user-plane-configuration/low-level-tx-endpoints{%x}", key) != CONFD_OK)
{
alwaysLog("Failed to cd");
}
ptr=(char *)CONFD_GET_BUFPTR(key);
strcpy(hp->KeyName ,ptr);
hp->inuse = 1;
if (cdb_get_int32(cdbsock,&(hp->OffsetabsCenterFreq),"offset-to-absolute-frequency-center") != CONFD_OK)
alwaysLog("offset-to-absolute-frequency-center Read data failed");
int maxInstance = cdb_num_instances(cdbsock,"/user-plane-configuration/low-level-tx-endpoints{%x}/number-of-prb-per-scs",key);
alwaysLog("found prb instances:%d",maxInstance);
for(index=0; index< maxInstance; index++) {
if (cdb_get(cdbsock, &key1, "/user-plane-configuration/low-level-tx-endpoints{%x}/number-of-prb-per-scs[%d]/scs", key,index) !=
CONFD_OK) alwaysLog("Can't get key");
else alwaysLog("PRB FOUND Key****");
if (cdb_cd(cdbsock, "/user-plane-configuration/low-level-tx-endpoints{%x}/number-of-prb-per-scs{%x}", key,key1) != CONFD_OK)
{
alwaysLog("Failed to cd scs");
}
if (cdb_get_enum_value(cdbsock,(int32_t *)&(hp->TxprbConfig[index].scs),"scs") != CONFD_OK)
alwaysLog("SCS Read data failed");
}
}
OUTPUT:
On multiple change of only scs the number of instances are keep increasing even if i am modifying against same key value of outer list
Not sure what went wrong.
It will be really helpful if you can figure out my mistake.
Regards,
Biswajit