Newline characters not interpreted in confd_cli

I have an operational variable which contains some text (type string in yang file) and I’d like to print it in the confd_cli (I have confd 6.0).

The problem is, this text contains new line characters (\n) and confd_cli does not seem to interpret them. It just prints \n.

In the Python code that feeds confd with this variable, I simply do:

import _confd
import _confd.dp as dp
V = _confd.Value
# [...]
def cb_get_elem(self, tctx, kp):
    # [...]
    text = "Hi,\n This is my value"
    value = V(text, V.C_BUF)
    dp.data_reply_value(tctx, value)

Is casting to V.C_BUF the right way of doing it? Are there alternatives which handle \n?

You can use the tailf:cli-preformatted YANG-extension to suppress quoting of newlines etc. For more information, see the tailf_yang_cli_extensions(5) man-page.