我是杨造型的新手。我想从一长串列表中创建一个 show command(config: false)。在不使用 tailf:cli-show-template 的情况下,我能够将列表的值作为两列输出:- (Leaf-name, value)。但是,我想用漂亮的缩进和描述性文本来格式化显示输出。因此,我尝试使用 tailf:cli-show-template,如下所示:-
list summary {
tailf:info "Show bgp neighbors summary";
config false;
tailf:callpoint show_bgp_neighbor_summary;
tailf:cli-suppress-table;
tailf:cli-suppress-mode;
tailf:cli-show-template-legend 'BGP neighbors Summary\n';
tailf:cli-show-template
'Peer: $(peer_ip) Vrf: $(vrf_name)\n' +
'As: $(as_number) \n' +
'State: $(peer_state) \n' +
'BGP Routes summary:\n' +
' Received: $(received_count)\n' +
' Accepted: $(accepted_count)\n' +
' Advertised: $(advertised_count)\n';
key "peer_ip";
leaf peer_ip {
tailf:info "Neighbor IP Address";
type inet:ip-address;
}
leaf vrf_name {
tailf:info "VRF name";
type string;
}
leaf as_number {
tailf:info "AS Number";
type inet:as-number;
}
leaf peer_state {
tailf:info "Peer State";
type string;
}
leaf received_count {
tailf:info "Number of routes received";
type uint64;
}
leaf accepted_count {
tailf:info "Number of routes received";
type uint64;
}
leaf advertised_count {
tailf:info "Number of routes advertised";
type uint64;
}
但是,由于某种原因,只有键 - “peer_ip”被替换为 cli-show-template.Sample 输出中的值: -
router# show ip bgp neighbor summary
BGP neighbors Summary
Peer: 172.16.2.106 Vrf:
As:
State:
BGP Routes summary:
Received:
Accepted:
Advertised:
router#
更新:- 上面的列表在 bgp 容器内,并且该容器在一个分组内。我将分组用作“ip”容器内的“使用 bgp_group”。请帮忙。