I want to add my feature, which will should include both config and show commands. I think that you need to create the main container “my_feature” which consist of 2 containers: the first container “conf_feature” and the second “show_feature”. For example:
I want to enter command $ show my_feature, and invoke callback function for display my_feature summary information. I don`t understand how to implement.
Also I enter command $ show my_feature interface, Confd makes a call to a function callback for 2 branches of the brief and details at once, what do you need to specify so that by default it does only for the brief?
In case you need specializedoutpu in CLI, you can use custom clispec comand for operational mode. In callback of this clispec you can call regular CLI via maapi. E.g. clispec command show my_feature interface would call in callback maapi_cli_cmd with string parameter "show my_feature interface brief". See clispec section in ConfD User guide and confd_lib_maapi - command maapi_cli_cmd.
Hi mnovak, thnx for this answer. I read user guide Confd to chapters cli and maapi. I don’t need specializedoutput in CLI. I tried create 2 sub-modules. The first submodule consist of config parameters and it have main container “my_feature”. I create the second submodule which import the first submodule also augment “/my_feature” and consist of operational data. It’s working. I have problem. Custom help texts is shown both in config and show modes because it add in container “my_feature” in tailf:info Config commands my_feature. How to implement other text in show mode?
Confd makes a call to a function callback for 2 branches of the brief and details at once, what do you need to specify so that by default it does only for the brief?
U thought you need special CLI behavior (i.e. make show my_feature interface behave as show my_feature interface brief), which could be achieved with clispec.
By “2 sub-modules” , do you mean YANG submodules (submodule statment) or something elese? I’m not fully sure what kid of reuse do you try to achieve. maybe grouping statement can help here. Please, paste example.
If I got it right, I need do this command move src=“my_feature interface” dest=“my_feature interface brief”
I have question in my example. In grouping session has 2 list brief and detail. How to describe lists, that I could to will request both list with check key? For example:
$ show my_feature session brief
Confd check key “interface src_address dst_address”, and call get_object list brief.
$show my_feature session detail
Confd check key “interface src_address dst_address”, and call get_object list brief and list detail.
Then in callpoint (in C application) you can call maapi_cli_cmd("show my_feature interface brief"), so everytime you issue show my_feature interface it will be redirected to show my_feature interface brief.
Do you mean tailf:info "My_feature commands"; under my_feature container? In case you mix operational and config data (commands), I think you need to choose info statement that can be applied to both modes (as you datamodel is part of both modes). This info seems applicable for both modes.
What would be the purpose of calling get_object for brief if you are in detail list? Do you have some reuse in mind? If so, in C callback you can implement reuse in C (just extract common parts to some function). E.g. reuse to get key element values (as they are same for both - brief and detail).