Configurable leaf for free form text

I would like to define a configurable leaf in the data model which can take free form notes i.e it should take the input as below

Contact info:
Office: +1-123-456-7891

178 Lincoln Dr. East
San Jose, CA 95135
Site contact: John Smith +1-609-xxx

Hardware lab
Rack 6B
RU 13-14

Please let me know what should be the leaf type?


why not use regular string?
you may need to escape newlines when passing data, but that would have to be addressed for “special” format either way…

Thanks for your reply. I tried using regular string but it seems it doesn’t work as i expected.

Device(config)# system notes "Location:  San Jose\nContact: John Smith\n"

Device(config)# do show running-config system notes 
system notes "Location:  San Jose\nContact: John Smith\n"

What i expect is

Device(config)# system notes "Location:  San Jose

                                                   Contact: John Smith"

Device(config)# do show running-config system notes 
system notes "Location:  San Jose
                        Contact: John Smith"

 leaf notes {
            type string {
                length "0..4000";
            tailf:info "
                Custom free form notes providing device information";

Can you explain more with an example on what you mentioned about addressing “special” format

I confused some things when answering originally, sorry for that…

You could try CLI annotations for the target leaf to achieve similar/almost same behavior:

I tested by editing/adding leaf to confd’s example.confd/intro/1-2-3... example
YANG model:

leaf long {
    type string;

These are described in e.g. bash man tailf_yang_cli_extensions (man pages) output…

And CLI session example:

DEV(config)# dhcp long
[Multiline mode, exit with ctrl-D.]
> one
> two
> two
> two
DEV(config)# show full-configuration dhcp long
dhcp long one



With your example it works for me now. But with this change, i see issue when i try to apply running configuration.

So i made configuration change for the leaf “dhcp long”

stretchvbx# show running-config dhcp long
dhcp long Location: XXX             

Then clear the “dhcp long” and apply the saved configuration which has the above config, “dhcp long” configuration is not applied.

Do we need to add any other additional CLI annotations to make apply config work?

We save and load running configuration in ‘C’ format


Hmm, i observe the same, and i didn’t find any usable/helpful annotation that could allow copy&pasting the config in multi-line mode (not sure if/how the “^D” can be applied)…
Maybe someone else has experience with multi-line solutions and can chime in?