Use the following configuration statements to define interface classification scripts:
- shared network device name interface-classifier rule name {
- target target ;
- script script ;
- }
- shared network device name interface-classifier rule name condition name ...
A classification script can contain either a target and a condition or a script. If you do not define a script, the classifier must have both a target and a condition.
To define interface classification scripts:
- [edit shared network device erx-node1 interface-classifier
rule rule-3]
- user@host# set script script
OR
[edit shared network device erx-node1 interface-classifier rule rule-3]
user@host# show
target /sample/junose/PPP-special;
condition {
"pppLoginName=\"*@special.com\"";
}
[edit shared network device erx-node1 interface-classifier]
user@host# show
rule rule-1 {
script "
# Use the following syntax:
#
# descr-file ::= [script] section*
# section ::= ('[' type ']' nl conditions) | ('[*]' nl script)
# type ::= 'a-zA-Z0-9-_'*
# nl ::= '\\n'
# conditions ::= ((('#'|';') comment) |
# (['&'|'|'] field-name ( '='|'=='|'!=') match) nl)*
# field-name ::= member of InterfaceObject
# match ::= UNIX style filename matching
# script ::= regular python script, defined functions need to be
# included in the list \"classify\"
#
# the section-names correspond to a PolicyList object below
# o=Policies, o=umc:
# [name] => DN: \"policyGroupName=name, o=Policies, o=umc\"
#
# Use one of the following \"field names\":
# pppLoginName - set to \"user@realm\", if interface is PPP
# interfaceName - name of the ERX Interface in CLI syntax
# virtualRouterName - name of the VR the interface is connected to
";
}
rule rule-2 {
script "
# apply different default policies for PPP subscribers in realm \"special.com\"
def log(obj):
from net.juniper.smgt.sae import Main
icc = Main.theComponentRegistry.get(\"icc.component\")
if icc is None:
Main.theComponentRegistry.put(\"icc.component\", [])
else:
icc.append(obj)
classify.append(log)
";
}
rule rule-3 {
target /sample/junose/PPP-special;
condition {
"pppLoginName=\"*@special.com\"";
}
}
rule rule-4 {
target /sample/junose/PPP;
condition {
"pppLoginName!=\"\"";
}
}
rule rule-5 {
target /sample/junose/DHCP;
condition {
"interfaceName=\"fastEthernet*\"";
"interfaceName=\"atm*/*.*\"";
}
}
Use the fields in this section to define interface classification conditions.
broadcastAddr
ifAlias
ifDesc
interfaceName
For JUNOS routing platforms: interfaceName=“ fe-0/1/0.0”
For forwarding interface: interfaceName=“ FORWARDING_INTERFACE”
ipAddress
ipMask
mtu
nasPortId
pppLoginName
radiusClass
serviceBundle
userIpAddress
virtualRouterName
For JUNOS routing platforms: name of the routing instance