Condition Clauses

Condition clauses usually follow if or elseif and are used to set matching rules to filter routes.

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, element...}.

Condition Clauses That Are Based on the Route Cost

Condition Clause

Function

Parameters

Commands Used to Apply Condition Clauses

med eq med

Matches the BGP routes with the specified med.

med: indicates an integer ranging from 0 to 4294967295.

med ge med

Matches the BGP routes with the MED greater than or equal to the specified med.

med: indicates an integer ranging from 0 to 4294967295.

med le med

Matches the BGP routes with the MED less than or equal to the specified med.

med: indicates an integer ranging from 0 to 4294967295.

{ isis-cost | rip-cost | ospf-cost } eq cost

Matches the IS-IS/RIP/OSPF routes with the specified cost.

cost: indicates an integer ranging from 0 to 4294967295.

{ isis-cost | rip-cost | ospf-cost } ge cost

Matches the IS-IS/RIP/OSPF routes with the cost greater than or equal to the specified cost.

cost: indicates an integer ranging from 0 to 4294967295.

{ isis-cost | rip-cost | ospf-cost } le cost

Matches the IS-IS/RIP/OSPF routes with the cost less than or equal to the specified cost.

cost: indicates an integer ranging from 0 to 4294967295.

rib-cost eq cost

Matches all routes with the specified cost in the IP routing table.

cost: indicates an integer ranging from 0 to 4294967295.

rib-cost ge cost

Matches all routes with the cost greater than or equal to the specified cost in the IP routing table.

cost: indicates an integer ranging from 0 to 4294967295.

rib-cost le cost

Matches all routes with the cost less than or equal to the specified cost in the IP routing table.

cost: indicates an integer ranging from 0 to 4294967295.

preference eq preference

Matches the routes with the specified preference.

preference: indicates an integer ranging from 0 to 255.

preference le preference

Matches the routes whose priority is less than or equal to the specified preference.

preference: indicates an integer ranging from 0 to 255.

preference ge preference

Matches the routes whose priority is greater than or equal to the specified preference.

preference: indicates an integer ranging from 0 to 255.

Condition Clauses That Are Based on the Source Address, Destination Address, or Next Hop Address of a Route

Condition Clause

Function

Parameters

Commands Used to Apply Condition Clauses

ip route-source in { ip-prefix-list-name | ip-prefix-list }

Matches the IPv4 routes carrying the specified source address.

ip-prefix-list-name: indicates the name of an IPv4 prefix set. The value is a string of 1 to 200 case-sensitive characters, spaces and question marks are not supported. The string can contain letters, digits, underscores (_), hyphens (-), and dots (.). It must start with a letter or digit.

ip-prefix-list: indicates the IPv4 prefix set in the format of {element, element...}, in which the elements are IPv4 addresses carrying mask lengths, for example, { 1.1.1.0 24, 2.2.2.2 32 }.

ipv6 route-source in { ipv6-prefix-list-name | ipv6-prefix-list }

Matches the IPv6 routes carrying the specified source address.

ipv6-prefix-list-name: indicates the name of an IPv6 prefix set. The value is a string of 1 to 200 case-sensitive characters, spaces and question marks are not supported. The string can contain letters, digits, underscores (_), hyphens (-), and dots (.). It must start with a letter or digit.

ipv6-prefix-list: indicates the IPv6 prefix set in the format of {element, element...}, in which the elements are IPv6 addresses carrying mask lengths.

ip route-destination in { ip-prefix-list-name | ip-prefix-list }

Matches the IPv4 routes carrying the specified destination address.

ip-prefix-list-name: indicates the name of an IPv4 prefix set. The value is a string of 1 to 200 case-sensitive characters, spaces and question marks are not supported. The string can contain letters, digits, underscores (_), hyphens (-), and dots (.). It must start with a letter or digit.

ip-prefix-list: indicates the IPv4 prefix set in the format of {element, element...}, in which the elements are IPv4 addresses carrying mask lengths.

ipv6 route-destination in { ipv6-prefix-list-name | ipv6-prefix-list }

Matches the IPv6 routes carrying the specified destination IPv6 address.

ipv6-prefix-list-name: indicates the name of an IPv6 prefix set. The value is a string of 1 to 200 case-sensitive characters, spaces and question marks are not supported. The string can contain letters, digits, underscores (_), hyphens (-), and dots (.). It must start with a letter or digit.

ipv6-prefix-list: indicates the IPv6 prefix set in the format of {element, element...}, in which the elements are IPv6 addresses carrying mask lengths.

ip next-hop in { ip-prefix-list-name | ip-prefix-list }

Matches the IPv4 routes carrying the specified next hop IP address.

ip-prefix-list-name: indicates the name of an IPv4 prefix set. The value is a string of 1 to 200 case-sensitive characters, spaces and question marks are not supported. The string can contain letters, digits, underscores (_), hyphens (-), and dots (.). It must start with a letter or digit.

ip-prefix-list: indicates the IPv4 prefix set in the format of {element, element...}, in which the elements are IPv4 addresses carrying mask lengths.

ipv6 next-hop in { ipv6-prefix-list-name | ipv6-prefix-list }

Matches the IPv6 routes carrying the specified next hop address.

ipv6-prefix-list-name: indicates the name of an IPv6 prefix set. The value is a string of 1 to 200 case-sensitive characters, spaces and question marks are not supported. The string can contain letters, digits, underscores (_), hyphens (-), and dots (.). It must start with a letter or digit.

ipv6-prefix-list: indicates the IPv6 prefix set in the format of {element, element...}, in which the elements are IPv6 addresses carrying mask lengths.

Condition Clauses That Are Based on the Tag of an OSPF, IS-IS or Static Route

Condition Clause

Function

Parameters

Commands Used to Apply Condition Clauses

tag eq tag

Matches the routes with the specified tag.

tag: indicates an integer ranging from 0 to 4294967295.

tag ge tag

Matches the routes with the tag greater than or equal to the specified tag.

tag: indicates an integer ranging from 0 to 4294967295.

tag le tag

Matches the BGP routes with the tag less than or equal to the specified tag.

tag: indicates an integer ranging from 0 to 4294967295.

Condition Clauses That Are Based on the Local_Pref Attribute of a BGP Route

Condition Clause

Function

Parameters

Commands Used to Apply Condition Clauses

local-preference eq preference

Matches the BGP routes with the Local_Pref value being preference.

preference: indicates an integer ranging from 0 to 4294967295.

local-preference ge preference

Matches the BGP routes with the Local_Pref value greater than or equal to preference.

preference: indicates an integer ranging from 0 to 4294967295.

local-preference le preference

Matches the BGP routes with the Local_Pref value less than or equal to preference.

preference: indicates an integer ranging from 0 to 4294967295.

Condition Clauses That Are Based on the AS_Path Attribute of a BGP Route

Condition Clause

Function

Parameters

Commands Used to Apply Condition Clauses

as-path in { as-path-list-name | as-path-list }

Matches the BGP routes carrying the AS_Path in the specified AS_Path set.

as-path-list-name: indicates the name of an AS_Path set. The value is a string of 1 to 200 case-sensitive characters, spaces and question marks are not supported. The string can contain letters, digits, underscores (_), hyphens (-), and dots (.). It must start with a letter or digit.

as-path-list: indicates the AS_Path set in the format of {element, element...}, in which the elements are in the format of regular+AS_Path regular expression.

as-path is-none

Matches the BGP routes carrying an empty AS_Path (locally generated BGP routes).

as-path origin as-path [ whole-match ]

Matches BGP routes with AS_Path whose rightmost AS numbers are the same as as-path.

as-path: indicates the AS_Path, enclosed in single quotation marks, with every two neighboring AS numbers separated with a space. whole-match: indicates that duplicate AS numbers are counted independently during matching. If this parameter is not specified, duplicate AS numbers are counted as one AS number during matching.

as-path pass as-path [ whole-match ]

Matches BGP routes with AS_Path whose contiguous AS numbers match as-path.

as-path: indicates the AS_Path, enclosed in single quotation marks, with every two neighboring AS numbers separated with a space. whole-match: indicates that duplicate AS numbers are counted independently during matching. If this parameter is not specified, duplicate AS numbers are counted as one AS number during matching.

as-path peer-is as-path [ whole-match ]

Matches BGP routes with AS_Path whose leftmost AS numbers are the same as as-path.

as-path: indicates the AS_Path, enclosed in single quotation marks, with every two neighboring AS numbers separated with a space. whole-match: indicates that duplicate AS numbers are counted independently during matching. If this parameter is not specified, duplicate AS numbers are counted as one AS number during matching.

as-path length { eq | ge | le } as-path-number

Matches the routes carrying the AS_Path with the length equal to the specified length, greater than or equal to the specified length, or less than or equal to the specified length.
  • eq: Equal to;
  • ge: Greater than or equal to;
  • le: Less than or equal to.

as-path-number: indicates the AS_Path length. The value is an integer ranging from 0 to 2047.

as-path unique-length { eq | ge | le } as-path-number

Matches the routes carrying the AS_Path with the length equal to the specified length, greater than or equal to the specified length, or less than or equal to the specified length (with duplicate AS numbers counted as one AS number).
  • eq: Equal to;
  • ge: Greater than or equal to;
  • le: Less than or equal to.

as-path-number: indicates the AS_Path length. The value is an integer ranging from 0 to 2047.

Condition Clauses That Are Based on the Community Attribute of a BGP Route

Condition Clause

Function

Parameters

Commands Used to Apply Condition Clauses

community matches-any { community-list-name | community-list }

Matches the BGP routes carrying at least one of the communities specified in the community set.

community-list-name: indicates the name of a community set. The value is a string of 1 to 200 case-sensitive characters, spaces and question marks are not supported. The string can contain letters, digits, underscores (_), hyphens (-), and dots (.). It must start with a letter or digit.

community-list: indicates the community set in the format of {element, element...}, in which the elements are in the format of aa:nn, a community number, or a known community (internet, no-export-subconfed, no-advertise, or no-export).

community matches-all { community-list-name | community-list }

Matches the BGP routes carrying the communities of which the specified community set is a subset.

community-list-name: indicates the name of a community set. The value is a string of 1 to 200 case-sensitive characters, spaces and question marks are not supported. The string can contain letters, digits, underscores (_), hyphens (-), and dots (.). It must start with a letter or digit.

community-list: indicates the community set in the format of {element, element...}, in which the elements are in the format of aa:nn, a community number, or a known community (internet, no-export-subconfed, no-advertise, or no-export).

community matches-within { community-list-name | community-list }

Matches the BGP routes carrying the communities listed in the specified community set or less communities.

community-list-name: indicates the name of a community set. The value is a string of 1 to 200 case-sensitive characters, spaces and question marks are not supported. The string can contain letters, digits, underscores (_), hyphens (-), and dots (.). It must start with a letter or digit.

community-list: indicates the community set in the format of {element, element...}, in which the elements are in the format of aa:nn, a community number, or a known community (internet, no-export-subconfed, no-advertise, or no-export).

community is-none

Matches the BGP routes with an empty community.

-

Condition Clauses That Are Based on an Attribute of a VPN Route

Condition Clause

Function

Parameters

Commands Used to Apply Condition Clauses

rd in { rd-list-name | rd-list }

Matches the VPN routes with RDs in the specified RD set.

rd-list-name: indicates the name of an RD set. The value is a string of 1 to 200 case-sensitive characters, spaces and question marks are not supported. The string can contain letters, digits, underscores (_), hyphens (-), and dots (.). It must start with a letter or digit.

rd-list: indicates the RD set in the format of {element, element...}. For details about RD element values, see RD element values.

extcommunity rt matches-any { rt-list-name | rt-list }

Matches the VPN routes carrying at least one of the RTs specified in the route target set.

rt-list-name: indicates the name of a route target set. The value is a string of 1 to 200 case-sensitive characters, spaces and question marks are not supported. The string can contain letters, digits, underscores (_), hyphens (-), and dots (.). It must start with a letter or digit.

rt-list: indicates the route target set in the format of {element, element...}. For details about RT element values, see RT element values.

extcommunity rt matches-all { rt-list-name | rt-list }

Matches the VPN routes carrying the RTs listed in the specified route target set or more RTs.

rt-list-name: indicates the name of a route target set. The value is a string of 1 to 200 case-sensitive characters, spaces and question marks are not supported. The string can contain letters, digits, underscores (_), hyphens (-), and dots (.). It must start with a letter or digit.

rt-list: indicates the route target set in the format of {element, element...}. For details about RT element values, see RT element values.

extcommunity rt matches-within { rt-list-name | rt-list }

Matches the VPN routes carrying the RTs listed in the specified route target set or less RTs.

rt-list-name: indicates the name of a route target set. The value is a string of 1 to 200 case-sensitive characters, spaces and question marks are not supported. The string can contain letters, digits, underscores (_), hyphens (-), and dots (.). It must start with a letter or digit.

rt-list: indicates the route target set in the format of {element, element...}. For details about RT element values, see RT element values.

extcommunity rt is-none

Matches the VPN routes with an empty RT.

-

extcommunity soo matches-any { soo-list-name | soo-list }

Matches the VPN routes carrying at least one of the site or origins (SoOs) specified in the SoO set.

soo-list-name: indicates the name of an SoO set. The value is a string of 1 to 200 case-sensitive characters, spaces and question marks are not supported. The string can contain letters, digits, underscores (_), hyphens (-), and dots (.). It must start with a letter or digit.

soo-list: indicates the SoO set in the format of {element, element...}. For details about SoO element values, see SoO element values.

extcommunity soo matches-all { soo-list-name | soo-list }

Matches the VPN routes carrying the SoOs listed in the specified SoO set or more SoOs.

soo-list-name: indicates the name of an SoO set. The value is a string of 1 to 200 case-sensitive characters, spaces and question marks are not supported. The string can contain letters, digits, underscores (_), hyphens (-), and dots (.). It must start with a letter or digit.

soo-list: indicates the SoO set in the format of {element, element...}. For details about SoO element values, see SoO element values.

extcommunity soo matches-within { soo-list-name | soo-list }

Matches the VPN routes carrying the SoOs listed in the specified SoO set or less SoOs.

soo-list-name: indicates the name of an SoO set. The value is a string of 1 to 200 case-sensitive characters, spaces and question marks are not supported. The string can contain letters, digits, underscores (_), hyphens (-), and dots (.). It must start with a letter or digit.

soo-list: indicates the SoO set in the format of {element, element...}. For details about SoO element values, see SoO element values.

extcommunity soo is-none

Matches the VPN routes with an empty SoO.

-

Condition Clauses That Are Based on Any of Other Attributes

Condition Clause

Function

Parameters

Commands Used to Apply Condition Clauses

mpls-label exist

Matches the routes carrying MPLS labels.

origin is origin-type

Matches the BGP routes carrying the specified origin-type.

The value of origin-type can be any of the following items:

  • egp: indicates the routes learned through the EGP.
  • igp: indicates the routes that are added to the BGP routing table using the network (BGP) command.
  • incomplete: indicates the routes imported using the import-route (BGP) command.

protocol is protocol-type

Matches the routes of the specified routing protocol.

The value of protocol-type can be any of the following items:

  • bgp
  • direct
  • isis
  • ospf
  • rip
  • static

protocol in protocol-type

Matches the routes of the specified routing protocol.

The value of protocol-type can be any of the following items:

  • bgp
  • direct
  • isis
  • ospf
  • rip
  • static

route-type is route-type

Matches the routes of the specified type.

The value of route-type can be any of the following items:

  • external-type1: indicates Type 1 external OSPF routes.
  • external-type2: indicates Type 2 external OSPF routes.
  • internal: indicates internal routes, including inter-area and intra-area OSPF routes.
  • nssa-external-type1: indicates Not-So-Stubby Area (NSSA) Type 1 external OSPF routes.
  • nssa-external-type2: indicates NSSA Type 2 external OSPF routes.
  • is-is-level-1: indicates Level-1 IS-IS routes.
  • is-is-level-2: indicates Level-2 IS-IS routes.

path-type is path-type

Matches the BGP routes of the specified type.

The value of path-type indicates the BGP route origin, which can be either of the following items:

  • ibgp: indicates IBGP routes.
  • ebgp: indicates EBGP routes.

rpki is rpki-type

Matches the BGP routes with the specified origin AS validation result.

The value of rpki-type can be any of the following items:

  • invalid: indicates that the origin AS is incorrect.
  • not-found: indicates that the origin AS is not found.
  • valid: indicates that the origin AS is correct.

orf-prefix in { ip-prefix-list-name | ip-prefix-list }

Matches the BGP routes with the outbound route filtering (ORF) prefixes in the specified IPv4 prefix set.

ip-prefix-list-name: indicates the name of an IPv4 prefix set. The value is a string of 1 to 200 case-sensitive characters, spaces and question marks are not supported. The string can contain letters, digits, underscores (_), hyphens (-), and dots (.). It must start with a letter or digit.

ip-prefix-list: indicates the IPv4 prefix set in the format of {element, element...}, in which the elements are IPv4 addresses carrying mask lengths.

None

interface in interface-list-name

Matches the routes of which the outbound interfaces are in the specified outbound interface list.

interface-list-name: indicates the name of an outbound interface list. The value is a string of 1 to 64 case-sensitive characters, spaces not supported. The string can contain letters, digits, underscores (_), hyphens (-), and dots (.). It must start with a letter or digit. interface-list-name must have been set using the xpl interface-list section-name command.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >