The if command configures matching rules for a route-filter.
By default, no matching rules are configured for a route-filter, and all routes match the route-filter.
Parameter | Description | Value |
---|---|---|
not |
Filters routes against the opposite of the matching rule following not. |
- |
condition-clause |
Specifies a condition clause. |
For details of condition clauses, see the following descriptions:
|
and |
Filters routes against the matching rule of the previous condition clause and the one following and. |
- |
or |
Filters routes against the matching rule of the previous condition clause or the one following or. |
- |
then |
Introduces the action clause configured for the routes that meet matching rules. |
- |
Usage Scenario
Route-filters are used to filter routes based on sets or a single element and modify route attributes of the routes that meet matching rules. To configure matching rules for a route-filter, run the if command.
The parameters in condition clauses can be specific values or global variables referenced using $+global variable name. The parameters in a route-filter with pre-defined variables can be those defined in this route-filter. Global variables cannot be referenced by the route attribute sets in the format of {element A, element B...}.Follow-up Procedure
Run the apply, approve, refuse, finish, call route-filter, or break command to configure an action for the routes that meet matching rules.
Precautions
The maximum number of nested if clauses is 64. One if clause can connect 32 AND or OR Boolean operators. The keyword NOT can be consecutively nested for a maximum of 4 times.
If ip { route-source | route-destination | next-hop } in { ip-prefix-list-name | ip-prefix-list } is configured, the configuration applies to IPv4 prefixes, not to IPv6 prefixes, and IPv6 prefixes match the configuration by default. If IPv6 prefixes also need to be filtered, perform the following configurations: xpl ipv6-prefix-list ipv6-list-null end-list if ip { route-source | route-destination | next-hop } in { ip-prefix-list-name | ip-prefix-list } then if ipv6 { route-source | route-destination | next-hop } in ipv6-list-null then finish elseif ip { route-source | route-destination | next-hop } in { ip-prefix-list-name | ip-prefix-list } then apply action-clause endif endif If ipv6 { route-source | route-destination } in { ipv6-prefix-list-name | ipv6-prefix-list } is configured, the configuration applies to IPv6 prefixes, not to IPv4 prefixes, and IPv4 prefixes match the configuration by default. If IPv4 prefixes also need to be filtered, perform the following configurations: xpl ip-prefix-list ipv4-list-null end-list if ipv6 { route-source | route-destination | next-hop } in { ip-prefix-list-name | ip-prefix-list } then if ip { route-source | route-destination | next-hop } in ipv4-list-null then finish elseif ip { route-source | route-destination | next-hop } in { ip-prefix-list-name | ip-prefix-list } then apply action-clause endif endif<HUAWEI> system [~HUAWEI] xpl route-filter route-filter1 [~HUAWEI-xpl-filter] if med eq 100 then [~HUAWEI-xpl-filter-if] approve [~HUAWEI-xpl-filter-if] endif [~HUAWEI-xpl-filter] end-filter