[j-nsp] Could JUNOS script accept 2 variable to generate a filter name

Chen Jiang ilovebgp4 at gmail.com
Mon Dec 28 07:50:53 EST 2015


Hi! Experts

Sorry for disturbing, I use 2 user input params: $users and $meter to
generate firewall filter name, but JUNOS has gave a error:

...
var $arguments = {
    <argument> {
    <name> "users";
    <description> "Required: to which users to put the bandwidth policer";
    }
    <argument> {
    <name> "src-add";
    <description> "Required: which prefix to put the bandwidth policer";
    }

    <argument> {
    <name> "meter";
    <description> "Required: policer bandwidth meter";
    }
}

param $users;
param $src-add;
param $meter;
...
<firewall>{
                <family>{
                    <inet>{
                        <filter>{
                            <name>"metro-user_rate-up";
                            <term>{
                                <name>"connect-to-"_$users_$meter;
                                <from>{
                                    <source-address>{
                                        <name>$src-add;
                                        }
                                    }
                                <then>{
                                    <policer>$meter;
                                        <accept>;
                                    }
                                }
}
...

lab at mx# run op fw users my-ff src-add 192.168.1/24 meter 50m detail
2015-12-20 08:15:23 UTC: reading op script input details
2015-12-20 08:15:23 UTC: testing op details
2015-12-20 08:15:23 UTC: running op script 'fw.slax'
2015-12-20 08:15:23 UTC: opening op script '/var/db/scripts/op/fw.slax'
2015-12-20 08:15:23 UTC: reading op script 'fw.slax'
error: /var/db/scripts/op/fw.slax:45: unexpected input: '$meter'; expected
semi-colon (';')
error: /var/db/scripts/op/fw.slax:57: unexpected input: '$meter'; expected
semi-colon (';')
error: /var/db/scripts/op/fw.slax: 2 errors detected during parsing (0)
error: error reading stylesheet: fw.slax

Could you pls shed some light on this? Thanks!

-- 
BR!



           James Chen


More information about the juniper-nsp mailing list