Hi all,
I am on a project which want to get data from "show subscribers summary port" command. I wrote a script to do that but it getting not enough data.
Here are the script:
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";
match / {
<op-script-results> {
var $cmd = <command> "show subscribers summary port";
var $results = jcs:invoke($cmd);
for-each ( $results/counters/port-name ) {
<output> "The number subscribers of interface "_ . _ " is " _ ../port-count;
}
}
}
and this is the output when run this script:
datnt@juniper> op sub
The number subscribers of interface xe-0/2/1 is 5916
The number subscribers of interface xe-11/0/1 is 5916
The number subscribers of interface xe-11/1/1 is 5916
The output of script dont match the output of command. I am very pleasure if anyone can help me fix it .
Here are the output of the command:
datnt@juniper> show subscribers summary port
Interface Count
xe-0/2/1 5916
xe-11/0/1 10121
xe-11/1/1 2544
datnt@juniper> show subscribers summary port | display xml
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/11.4X27/junos">
<subscribers-summary-information xmlns="http://xml.juniper.net/junos/11.4X27/junos-subscribers">
<counters junos:style="port-summary">
<port-name>xe-0/2/1</port-name>
<port-count>5916</port-count>
<port-name>xe-11/0/1</port-name>
<port-count>10122</port-count>
<port-name>xe-11/1/1</port-name>
<port-count>2544</port-count>
</counters>
<counters junos:style="port-summary-total">
<port-total>18578</port-total>
</counters>
</subscribers-summary-information>
<cli>
<banner>{master}</banner>
</cli>
</rpc-reply>