ConfD User Community

Expecting below cli in confd but not able to achieve

Hi,
this is yang code we are using

grouping modify-test {
        container MODIFY {
          description
            "Modification of a header";
          tailf:cli-flatten-container;
          tailf:cli-sequence-commands;
          tailf:cli-compact-syntax;
          tailf:cli-case-insensitive;
          leaf pattern {
            description
              "Match pattern";
            tailf:cli-drop-node-name;
            tailf:cli-incomplete-command;
            type string;
          }
          leaf replace-pattern {
            description
              "Replace pattern";
            tailf:cli-drop-node-name;
            tailf:cli-full-command;
            type string;
          }
}
}

where we want to generate below cli in confd

MODIFY "\".*(<sip:.*)" "\"Embassy of Jordan\" **\1"**

but when we try to generate below cli with \\1 we are able to see same in show running also same

MODIFY "\".*(<sip:.*)" "\"Embassy of Jordan\" **\\\1”**

with xml as below

native xmlns="https://tail-f.com/ns/example/generic-yang">
  <MODIFY>
    <pattern>".*(<sip:.*)</pattern>
    <replace-pattern>"Embassy of Jordan" \1</replace-pattern>
  </MODIFY>
</native>

where as we are not able to generate with \1 as below

MODIFY "\".*(<sip:.*)" "\"Embassy of Jordan\" **\1"**

please help me with this?
we want to generate below cli in confd.

MODIFY "\".*(<sip:.*)" "\"Embassy of Jordan\" \1"

I am afraid you cannot do much - backslash is an escape character and as such needs to be escaped too. There are flags like /confdConfig/cli/escapeBackslash in confd.conf or MAAPI_CONFIG_NO_BACKQUOTE for MAAPI, but I’m not sure how to use them; you can experiment with them.

Where do you want to have this output, by the way, in the CLI after “show running-config” and the like?

yes in show running it should show as below
MODIFY “”.(<sip:.)" ““Embassy of Jordan” \1”

I’m afraid this cannot be done. As I wrote, the backslash character needs to be treated specially, and it does not look like the mentioned flags can affect that in your use case.