Configuring a Route-Filter
A route-filter can use its condition clause to filter routes and use its action clause to set or modify route attributes of the routes that match the condition clause. This section describes how to configure route-filters.
Usage Scenario
- Condition clause: A condition clause is defined based on a set or single element, beginning with an introductory condition clause in most cases. The action specified in the action clause is applied only to the routes that match the conditions specified in the condition clause.
- Action clause: An action clause specifies an action to be applied to the routes that match the conditions specified in the condition clause. An action clause determines whether the routes match the route-filter or modifies their route attributes.
Pre-configuration Tasks
- Determine whether to configure route attribute sets.
- Configure a global variable set if some values need to be frequently used.
Procedure
- Configure a route-filter using the paragraph editing mode.
- Configure a route-filter using the line editing mode.
Example
If only paragraph editing is used as an example, the corresponding line editing is similar. To use the line editing mode, perform the operations described in paragraph editing.
For detailed set and route-filter configuration steps, see Set and Route-Filter Configuration Steps. For details about XPL clauses, see XPL Paragraph Editing Clauses.
Objective |
Configure a route-filter to set the priorities of the BGP routes destined for 1.1.1.1 to 200. |
Configuration Example 1 |
<HUAWEI> edit xpl route-filter r1
xpl route-filter r1
if ip route-destination in { 1.1.1.1 32 } then
apply preference 200
endif
end-filter
The IPv4 prefix set used by the route-filter r1 includes only one element. In this situation, use the format of {element A} to present the IPv4 prefix set. |
Objective |
Create a route-filter named para with a pre-defined variable and configure another route-filter named r2 to reference para. |
Configuration Example 2 |
<HUAWEI> edit xpl route-filter para
xpl route-filter para($var)
apply med $var
end-filter
<HUAWEI> edit xpl route-filter r2
xpl route-filter r2
if ip route-destination in aaa then
call route-filter para(20)
elseif ip route-destination in bbb then
call route-filter para(30)
endif
end-filter
aaa and bbb specified in r2 are IPv4 prefix sets, and a maximum of eight parameters can be referenced by each route-filter. |
Objective |
Configure a route-filter to set the priorities of the BGP routes carrying destination IP address 1.1.1.1 and MPLS labels to 50. |
Configuration Example 3 |
<HUAWEI> edit xpl route-filter r3
xpl route-filter r3
if ip route-destination in { 1.1.1.1 32 } and mpls-label exist then
apply preference 50
endif
end-filter
The conditions in a condition clause can be connected with the Boolean operator NOT, AND, or OR. |
Checking the Configurations
After configuring route-filters, check the configurations.
Run the display xpl route-filter [ route-filter-name [ verbose | used-object | expanded ] ] command to check XPL route-filter configurations or references.
Run the display xpl route-filter state [ attached | unattached ] [ verbose ] command to check information about route attribute set configurations and references.
Run the display xpl statistics command to check XPL line and route-filter specifications and current statistics.
- (Option) Run the reset xpl-filterfilter-name counters command to clear statistics about the routes matching the specified route-filter.