submodule my_feature_conf
{
belong-to main_yang { prefix main_yang; }
import tailf-common { prefix tailf; }
grouping MyFeatureGlobalCommands{
leaf Set1{
type Set1;
tailf:info "Set 1";
}
leaf Set2{
type Set2;
tailf:info "Set 2;
}
}
uses MyFeatureCommonCommands;
}
}
container my_feature{
tailf:info "My_feature commands";
tailf:cli-add-mode;
uses MyFeatureGlobalCommands;
}
}
/******************* my_feature-show-command ************************************/
submodule my_feature_show
{
belong-to main_yang { prefix main_yang; }
import tailf-common { prefix tailf; }
import ietf-inet-types { prefix inet; }
include my_feature_conf;
grouping my_feature_session_brief
{
list brief
{
tailf:info "Show my_feature session brief format";
tailf:cli-show-template-enter "";
tailf:cli-show-template-footer "\n";
tailf:cli-table-legend "Flags: Legend information\n" ;
tailf:cli-full-show-path { tailf:cli-max-keys 1; }
tailf:cli-enforce-table;
tailf:sort-order unsorted;
key "interface destination source";
leaf interface { type string; }
leaf destination { type inet:ipv4-address; }
leaf source { type inet:ipv4-address; }
leaf type { type session_type; }
leaf owner { type string; }
}
}
grouping my_feature_session_detail
{
list detail
{
tailf:info "Show my_feature session detail format";
tailf:cli-full-show-path { tailf:cli-max-keys 1; }
tailf:cli-suppress-table;
tailf:cli-show-template-enter "";
tailf:cli-show-template-footer "\n";
tailf:cli-show-template-legend "Flags: Legend information\n";
tailf:cli-show-template "\n"
+ "Interface $(interface)\n"
+ "Source address: $(src_address)\n"
+ "Destination address: $(dst_address)\n"
+ "State: $(state)\n"
+ "...........AND SO ON..........................";
tailf:sort-order unsorted;
key "interface src_address dst_address";
leaf interface { type string; }
leaf src_address { type inet:ipv4-address; }
leaf dst_address { type inet:ipv4-address; }
leaf state { type session_type; }
/*.............AND SO ON................*/
}
}
grouping my_feature_show_session {
container session {
tailf:info "Show my_feature session information";
config false;
uses my_feature_session_brief;
uses my_feature_session_detail;
}
}
grouping MyFeatureShowData {
container my_feature_show{
tailf:cli-drop-node-name;
tailf:info "Show my_feature information";
tailf:callpoint MyFeatureShow {}
config false;
list client {
tailf:info "Show my_feature client information";
tailf:sort-order unsorted;
key "name state";
leaf name { type string; }
leaf state { type string; }
leaf num-sessions { type uint32; }
uses my_feature_show_summary;
uses my_feature_show_session;
uses my_feature_show_neighbor;
uses my_feature_show_counters;
uses my_feature_show_interface;
}
uses my_feature_show_summary;
uses my_feature_show_session;
uses my_feature_show_neighbor;
uses my_feature_show_counters;
uses my_feature_show_interface;
}
}
augment "/my_feature" { uses MyFeatureShowData;}
}
I pasted 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.