OK, I've got a little closer, but I'm getting an error I can't figure what the cause is:
re0:
error: load of commit script changes failed
Not the most verbose error message. Attached is my full script that is causing this error.
I did have a couple questions about the original script. Particularly the $match-descr variable. I'm not sure I understand what this does:
var $match-descr = "CUST";
var $police_if = contains($match-descr, "CUST");
1. Does this make $police_if always true?
var $policer_in = $top/interfaces/interface[name == $phyifname]/unit[name == name]/family[name == inet || name == vpls || name == ccc]/policer/input;
if (not($policer_in) && $police_if) {
2. Does this say "if no policer is currently applied, then..." ?
I feel like I'm fairly close to having this work. Part of my problem is I'm not to confident on how to convert from the xml of the policer config to slax format. Here is the original xml:
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/9.2R3/junos">
<configuration junos:changed-seconds="1258781324" junos:changed-localtime="2009-11-20 23:28:44 CST">
<firewall>
<policer>
<name>2m</name>
<if-exceeding>
<bandwidth-limit>2m</bandwidth-limit>
<burst-size-limit>1m</burst-size-limit>
</if-exceeding>
<then>
<discard/>
</then>
</policer>
</firewall>
</configuration>
</rpc-reply>
Last, it seems that these lines:
var $policer_in = $top/interfaces/interface[name == $phyifname]/unit[name == $unit]/family[name == inet || name == vpls || name == ccc]/policer/input;
var $policer_out = $top/interfaces/interface[name == $phyifname]/unit[name == $unit]/family[name == inet || name == vpls || name == ccc]/policer/output;
don't work as you'd expect. the two variables are always emtpy. I'm trying to figure a way to accomplish the same thing.
Thanks in advance,
Josh
#JUNOS#bandwidth#policer#Slax#junoscript