Hi!
Same problem here (not sure, if I have to call the sript with the '0' or '0.0' - so I tried both:
root@ex2> op show-if-ips interface ge-0/0/0.0
error: Invalid type
error: runtime error: file /var/db/scripts/op/show-if-ips.slax element for-each
error: Failed to evaluate the 'select' expression.
{master:0}
root@ex2> op show-if-ips interface ge-0/0/0
error: Invalid type
error: runtime error: file /var/db/scripts/op/show-if-ips.slax element for-each
error: Failed to evaluate the 'select' expression
Interface is of type ethernet-switching:
root@ex2> show configuration interfaces ge-0/0/0
unit 0 {
family ethernet-switching;
}
I downloaded the script twice in case a download had produced a corrupted file. Is this maybe duw to different junos-versions?
Anyway -I tried a different approach to get the ethernet-switching table:
template get-port($mac) {
var $rpc = <get-ethernet-switching-table-information> {
}
var $switch-output = jcs:invoke($rpc);
for-each($switch-output/ethernet-switching-table/mac-table-entry) {
if (contains(mac-address ,$mac)) {
<output> "IP "_ $ip _" has mac " _ $mac _" and is at port "_ mac-interfaces-list/mac-interfaces;
}
}
}
template get-port($mac) {
var $rpc = <get-ethernet-switching-table-information> {
}
var $switch-output = jcs:invoke($rpc);
for-each($switch-output/ethernet-switching-table/mac-table-entry) {
if (contains(mac-address ,$mac)) {
<output> "IP "_ $ip _" has mac " _ $mac _" and is at port "_ mac-interfaces-list/mac-interfaces;
}
}
}
My approach was a bit different though (tried to find out on what port a specific IP is reachable), but I guess, if you guys replace $mac with $interfcae, you should be able to loop thru the interfaces and retrive, what you're interested in.
HTH,
Kai