if-match as-path length

Function

The if-match as-path length command configures a matching rule that is based on the AS_Path length.

The undo if-match as-path length command deletes a matching rule that is based on the AS_Path length.

By default, no matching rules that are based on the AS_Path length are configured.

Format

if-match as-path length lengthVal

if-match as-path length greater-equal greEqualVal less-equal lessEqualVal

if-match as-path length { greater-equal greEqualVal | less-equal lessEqualVal }

undo if-match as-path length [ lengthVal | greater-equal greEqualVal less-equal lessEqualVal | { greater-equal greEqualVal | less-equal lessEqualVal } ]

Parameters

Parameter Description Value
lengthVal

Specifies the AS_Path length.

The value is an integer ranging from 0 to 2047.

greater-equal greEqualVal

Specifies the minimum AS_Path length for matching.

The value is an integer ranging from 0 to 2046.

less-equal lessEqualVal

Specifies the maximum AS_Path length for matching.

The value is an integer ranging from 1 to 2047.

Views

Route-policy view

Default Level

2: Configuration level

Task Name and Operations

Task Name Operations
route-base write

Usage Guidelines

Usage Scenario

To configure a matching rule that is based on the AS_Path length, run the if-match as-path length command. After the matching rule is configured, attributes of the routes that match the matching rule can be modified based on the apply clause.

Precautions

AS_Path is a private attribute of BGP. Therefore, matching rules that are based on the AS_Path length are mainly used to filter BGP routes.

If greEqualVal is configured, but lessEqualVal is not, the maximum value 2047 of lessEqualVal is used. If lessEqualVal is configured, but greEqualVal is not, the minimum value 0 of greEqualVal is used. If both greEqualVal and lessEqualVal are configured, lessEqualVal must be greater than greEqualVal.

Example

# Configure a matching rule to match routes with the AS_Path length of 8.
<HUAWEI> system-view
[~HUAWEI] route-policy test permit node 10
[*HUAWEI-route-policy] if-match as-path length 8
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >