How to get the confd_cli prompt?

Hi,

I want to get confd_cli prompt:

Example:
sim_1rp-ssr1# show isis

The part before ‘#’ in above command.

Is there any confd_maapi can do that?

Refer to the man page for confd.conf on the following configurable parameters that can be used to configure the confd_cli prompt:

/confdConfig/cli/prompt1 (xs:string) [\u@\h> ]
  Prompt used in operational mode.

/confdConfig/cli/prompt2 (xs:string) [\u@\h% ]
  Prompt used in configuration mode.

If you enable the feature to store ConfD’s configuration in CDB as described in Chapter 27.4.2, Storing ConfD configuration parameters in CDB, of the ConfD User Guide, you will be able to retrieve their current values by accessing CDB.

Thanks Wai!

I guess what we can get is the prompt format like “\u@\h%”, but I just need the prompt string like “sim_1rp-ssr1” which is the actual hostname.

Is there any such method can confd provide?

You can get the hostname by using the gethostbyname( ) system call. It is also available in your shell environment as HOSTNAME.

Thanks Wai,

Yes, but that will only handle the ‘\h’. ConfD provides a lot more other arguments for prompt.

Especially for prompt2, it will take in the list instance’s key name as part of the prompt.

How can we get the prompt length then?