Decode and display value set by CONFD_SET_TAG_BINARY

In our application, we are setting the “/lldp/interfaces/interface/neighbors/neighbor/custom-tlvs/tlv/state/value” which is of type binary using CONFD_SET_TAG_BINARY API. I am setting the value as “hello world” in value leaf. When we display it using C-style CLI, it prints in non-readable (aGVsbG8gd29ybGQ=) format.

  1. How can we display the binary value properly in CLI which is set by the application?
    (or)
  2. How can we map/decode this non-readable value displayed in CLI?

C-Style CLI Display:

partition1# show lldp interfaces interface neighbors neighbor custom-tlvs tlv | nomore
OUI OUI
TYPE OUI SUBTYPE CONFIG TYPE OUI SUBTYPE VALUE

127 IEEE8021 PVID - 127 IEEE8021 PVID aGVsbG8gd29ybGQ=

CONFD_SET_TAG for setting the values:

CONFD_SET_TAG_XMLBEGIN(&tv[i++], oc_lldp_custom_tlvs, oc_lldp__ns);
CONFD_SET_TAG_XMLBEGIN(&tv[i++], oc_lldp_tlv, oc_lldp__ns);
CONFD_SET_TAG_INT32(&tv[i++], oc_lldp_type, 127);
CONFD_SET_TAG_STR(&tv[i++], oc_lldp_oui, "IEEE8021");
CONFD_SET_TAG_STR(&tv[i++], oc_lldp_oui_subtype, "PVID");
CONFD_SET_TAG_XMLBEGIN(&tv[i++], oc_lldp_state, oc_lldp__ns);
CONFD_SET_TAG_INT32(&tv[i++], oc_lldp_type, 127);
CONFD_SET_TAG_STR(&tv[i++], oc_lldp_oui, "IEEE8021");
CONFD_SET_TAG_STR(&tv[i++], oc_lldp_oui_subtype, "PVID");
unsigned const char *ucs = (unsigned const char *)"hello world";
CONFD_SET_TAG_BINARY(&tv[i++], oc_lldp_value, ucs, strlen((char *)ucs));
CONFD_SET_TAG_XMLEND(&tv[i++], oc_lldp_state, oc_lldp__ns);
CONFD_SET_TAG_XMLEND(&tv[i++], oc_lldp_tlv, oc_lldp__ns);
CONFD_SET_TAG_XMLEND(&tv[i++], oc_lldp_custom_tlvs, oc_lldp__ns);

The string aGVsbG8gd29ybGQ= is base64 encoding of the value “hello world” - for ConfD the leaf type is binary and its content cannot be reliably displayed as is, so it encodes it before displaying.

To me it sounds like tlv can be pretty much anything, but there are some options (apart from changing the type to string) if you are sure that value is always printable.

Thank you for the reply.