Classifying Interfaces (SRC CLI)
Use the following configuration statements to define interface classification scripts:
- shared network device name interface-classifier rule name {
- target target ;
- script script ;
- include include ;
- }
- 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:
- From configuration mode, enter the interface classifier
configuration for a device.
- user@host# edit shared network device erx-node1 interface-classifier
- Create a rule for the subscriber classifier. You can create
multiple rules for the classifier.
- [edit shared network device erx-node1 interface-classifier]
- user@host# edit rule rule-3
- Configure either a script, a target, or an included script
for the rule.
- [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# set target target
OR
- [edit shared sae group west-region subscriber-classifier rule rule-2]
- user@host# set include include
Where include identifies a script that has already been created.
- If you configured a target for the rule, you must configure
a match condition for the rule. You can create multiple conditions
for the rule. See Interface Classification Conditions.
- [edit shared network device erx-node1 interface-classifier rule rule-3]
- user@host# set condition name
- (Optional) Change the order of rules.
- [edit shared network device erx-node1 interface-classifier]
- user@host# insert rule rule-5 before rule-4
- (Optional) Rename a rule.
- [edit shared network device erx-node1 interface-classifier]
- user@host# rename rule rule-5 to DHCP
- (Optional) Verify the classifier rule configuration.
[edit shared network device erx-node1 interface-classifier rule rule-3] user@host# show target /sample/junose/PPP-special; condition { "pppLoginName=\"*@special.com\""; } - (Optional) Verify the interface classifier configuration.
[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*/*.*\""; } }
Interface Classification Conditions
Use the fields in this section to define interface classification conditions.
broadcastAddr
- Interface broadcast address.
- Value—Valid broadcast address format
- Example—broadcastAddr.hostAddress=“ 255.255.255.255”
ifAlias
- Description of an interface.
- Value—Interface description that is configured on the router. For JUNOSe routers, it is the description configured with the interface description command.
- Example—ifAlias=“ 1st pppoe int”
ifDesc
- Alternate name of the interface that is used by SNMP. This name is a system-generated name.
- Value
- Example—ifDesc=“ IP3/1.1”
interfaceName
- Name of the interface.
- Value
- Name of the interface in your router CLI syntax
- FORWARDING_INTERFACE for routing instance (used by traffic mirroring)
- Example—For JUNOSe routers: interfaceName=“ fastethernet6/0.1”
For JUNOS routing platforms: interfaceName=“ fe-0/1/0.0”
For forwarding interface: interfaceName=“ FORWARDING_INTERFACE”
ipAddress
- Interface IP address.
- Value—Valid IPv4 IP address format
- Example—ipAddress=“ 10.10.30.1”
ipMask
- Interface network mask.
- Value—Valid IPv4 IP network mask format
- Example—ipMask=“ 255.255.255.255”
mtu
- Maximum transfer unit configured on the interface.
- Value—32-integer value
- Example—mtu=“ 1492”
nasPortId
- Port identifier of an interface.
- Value—Includes interface name and additional layer 2 information
- Example—nasPortId=“ fastEthernet 3/1” (There is a space between fastEthernet and slot number 3/1 in the nasPortId.)
pppLoginName
- Login name for PPP subscribers.
- Value—Login name in the format username@domain
- Example—pppLoginName=“ pebbles@virneo.net”
radiusClass
- RADIUS class attribute.
- Value—RADIUS class name
- Example—radiusClass=“ Premium”
serviceBundle
- Content of the vendor-specific RADIUS attribute for the service bundle.
- Value—Name of a service bundle
userIpAddress
- Subscriber IP address (PPP only).
- Value—valid IPv4 address
- Example—userIpAddress=“ 192.168.30.15”
virtualRouterName
- Name of the virtual router or routing instance.
- Value—For JUNOSe routers: name of the virtual router
in the format vrname@hostname
For JUNOS routing platforms: name of the routing instance
- Example—virtualRouterName=“ default@erx5”