-
Notifications
You must be signed in to change notification settings - Fork 0
/
bgp-summary.slax
33 lines (27 loc) · 1.23 KB
/
bgp-summary.slax
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
version 1.0;
ns junos = "http://xml.juniper.net/junos/*/junos";
ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
import "../import/junos.xsl";
match / {
<op-script-results> {
var $neighbors = jcs:invoke(<command> 'show bgp neighbor');
var $summary = jcs:invoke(<command> 'show bgp summary');
var $format = "%-24s%-8s%-12s%-12s%-8s%-8s%-16s%-16s%-20s%s";
<output> jcs:printf($format,
"Peer", "AS", "InPkt", "OutPkt", "OutQ", "Flaps", "Last Up/Dwn", "State", "Group", "Description |#Active/Received/Accepted/Damped...");
<bgp-information> {
for-each($neighbors/bgp-peer){
var $peer-address = jcs:split("[+]",peer-address)[1];
var $elapsed = $summary//bgp-peer[peer-address == $peer-address]/elapsed-time ;
<output> jcs:printf($format,
$peer-address,peer-as, input-messages, output-messages, bgp-output-queue/count, flap-count, $elapsed, peer-state, peer-group, description);
for-each(bgp-rib) {
if (!jcs:empty(name)) {
<output> " " _ name _ ": " _ active-prefix-count _ "/" _ received-prefix-count _ "/" _ accepted-prefix-count _ "/" _ suppressed-prefix-count ;
}
}
}
}
}
}