Facing problem while reading the leafref node from config list

Hi ,

we have a low-level-tx-links configurable list having tx-array-carrier as leafref as below:

list low-level-tx-links {
      key name;
      description
        "Object model for low-level-tx-link configuration";

      leaf name {
        type string;
        description
          "Unique name of low-level-tx-link object.";
      }

     
      leaf tx-array-carrier {
        type leafref {
          path "/user-plane-configuration/tx-array-carriers/name";
        }
        mandatory true;
        description
          "Contains name of tx-array-carriers MO to be used as transport by low-level-tx-link";
      }

         }

I have subscribed to the configurable low-level-tx-link list using cdb_subscribe API. so when from netconf console executing netconf-console-tcp --host=10.10.11.172 -port=2023 link.xml getting call back. But I am not sure how to read the tx-array-carrier leaf node of low-level-tx-link list.
Previously before invoking the above command, I have pushed two instances of tx-array-carrier having key name as TXA0P00C00 and TXA0P00C01.
Basically, I would like to know which low-level-tx-link has been bonded with which tx-array-carrier.

I have tried as below,but it was giving error like :

  TRACE CDB_GET /user-plane-configuration/low-level-tx-endpoints/TXA0P00C00DEBUG badly formatted or 
   nonexistent path - Expected a key, not "'TXA0P00C00'" after: /user-plane-configuration/low-level-tx-endpoints

It will be helpful,if you can figure out the mistake or solution to achieve the same.
Code:

    if ((ret = cdb_start_session(cdbsock, CDB_RUNNING)) != CONFD_OK)
    alwaysLog("UPLANE: Cannot start Tx Link session\n");
    int maxInstance = cdb_num_instances(cdbsock,TxlinkPath);
     cfgTxlink=maxInstance;
      for(index=0; index< maxInstance; index++) {
    if (cdb_get(cdbsock, &key, "/user-plane-configuration/low-level-tx-links[%d]/name", index) !=
        CONFD_OK)
    {
      alwaysLog("UPLANE: Can't get key for low-level-tx-links");
    }
    else
    {
      unsigned char* buf;
      int buflen;
      ptr=(char *)CONFD_GET_BUFPTR(&key);
      strncpy(Tx_link[index],ptr,CONFD_GET_BUFSIZE(&key));
      printf("Tx_link[%d]:%s",index,Tx_link[index]);
      cdb_get_buf(cdbsock,&buf,&buflen,"/user-plane-configuration/tx-array-carrier/%s",Tx_link[index]);
      printf("TX ENDPOINT FROM TXLINK:%s",buf);
     }
    }
    cdb_end_session(cdbsock);

link.xml:

       <user-plane-configuration xmlns="urn:o-ran:uplane-conf:1.0">
       <low-level-tx-links>
     <name>TXA0P00C00</name>
     <tx-array-carrier>TXA0P00C01</tx-array-carrier>
    </low-level-tx-links>
    </user-plane-configuration>

Regards,
Biswajit

Hi ,
Found the mistake.
working code as below:

int maxInstance = cdb_num_instances(cdbsock,TxlinkPath);
cfgTxlink=maxInstance;
for(index=0; index< maxInstance; index++) {
 if (cdb_get(cdbsock, &key, "/user-plane-configuration/low-level-tx-links[%d]/name", index) !=
    CONFD_OK)
 {
   printf("UPLANE: Can't get key for low-level-tx-links");
 }
 else
 {
if (cdb_cd(cdbsock, "/user-plane-configuration/low-level-tx-links{%x}", key) != CONFD_OK)
{
  printf("UPLANE: Failed to cd  low-level-tx-links");
}

//cdb_get_buf(cdbsock,&tlink[index].carrier_key,&buflen,"tx-array-carrier");
cdb_get_buf(cdbsock,&buf,&buflen,"tx-array-carrier");
strncpy(tlink[index].carrier_key,(char *)buf,buflen);
//cdb_get_buf(cdbsock,&tlink[index].ep_key,&buflen,"low-level-tx-endpoint");
cdb_get_buf(cdbsock,&buf,&buflen,"low-level-tx-endpoint");
strncpy(tlink[index].ep_key,(char *)buf,buflen);

  ptr=(char *)CONFD_GET_BUFPTR(&key);
 strncpy(tlink[index].link_key,ptr,CONFD_GET_BUFSIZE(&key));

}
}
cdb_end_session(cdbsock);

Regards,
Biswajit