[j-nsp] commit scripts / slax
Curtis Call
ccall at juniper.net
Thu Feb 26 11:20:57 EST 2009
This might work for you. I wrote it out by hand and didn't test it so there might be syntax errors but hopefully it will point you in the right direction:
for-each( interfaces/interface[description == "****"] ) {
var $interface-name = name;
for-each( unit ) {
var $full-name = $interface-name _ "." _ name;
/* Check OSPF */
if( jcs:empty( protocols/ospf/area/interface[name==$full-name] ) ) {
/* It's not there...do something... */
}
/* Check LDP */
if( jcs:empty( protocols/ldp/interface[name==$full-name] ) ) {
/* It's not there...do something... */
} }
}
> -----Original Message-----
> From: juniper-nsp-bounces at puck.nether.net [mailto:juniper-nsp-
> bounces at puck.nether.net] On Behalf Of Cheikh-Moussa Ahmad
> Sent: Thursday, February 26, 2009 8:29 AM
> To: juniper-nsp at puck.nether.net
> Subject: [j-nsp] commit scripts / slax
>
> Hi Guys,
>
> I have a question regarding slax scripting. I have a script, which
> searches for a special description in the main interface and then
> check, whether unit 0 from this particular interface is configured
> under ospf and ldp. Now this works fine, but the drawback of the
> script is that it only checks the unit 0. My first idea was to concat
> the for-each statement, but unfortunately this doesn't work. I'am not
> really familiar with slax and it is new stuff for me.
>
> Anyone has an idea, how to concat for-each statements in slax, or does
> anyone has a better idea/hint to solve this ? It should be something
> like this :
>
> for-each (statemet) {
> if(description == '****') {
> for-each (statement) {
> check if interface is configured in protocolls
> }
> }
> }
>
>
> Regards,
> Ahmad
>
More information about the juniper-nsp
mailing list