Overview of XPL

This section describes the concept of XPL, the paragraph editing interface, set and route-filter configuration steps, and XPL clauses.

Definition

Extended routing-policy language (XPL) is a language used to filter routes and modify route attributes. By modifying route attributes (including reachability), XPL changes the path through which network traffic passes. XPL provides the same functions as routing policies do, but it uses different editing and filtering methods from routing policies. Therefore, XPL can meet different customer requirements.

Table 1 compares XPL and routing policies.

Table 1 Comparison between XPL and routing policies

Item

Key Functions

Editing Method

Filtering Method

User Experience

XPL

Filters routes and modifies route attributes.

Line-by-line or paragraph-by-paragraph editing

Uses sets or single elements to filter routes.

Users can configure or modify policies as required in a text editor.

Routing policies

Filter routes and modify route attributes.

Line-by-line editing

Use filters or single elements to filter routes.

Users must follow strict command configuration rules.

For details about routing policies, see "Routing Policies" in HUAWEI NetEngine 8000 F SeriesRouter Feature Description — IP Routing.

Line-by-Line and Paragraph-by-Paragraph Editing

XPL supports line-by-line editing and paragraph-by-paragraph editing, whereas routing policies support line-by-line editing only. Line-by-line editing is a traditional configuration method, whereas paragraph-by-paragraph editing is an innovative configuration method. Table 2 compares the two methods.

Table 2 Line-by-line and paragraph-by-paragraph editing comparison

Item

Applicable to

Differences

Help and Error Correction Mechanisms

Line-by-line editing

Users who are used to the traditional configuration method or unfamiliar with XPL

Each command is run in a command view, and one command is presented in one line, which is considered a configuration unit.

NOTE:

To modify an existing global variable set, route attribute set, or route-filter through line-by-line editing, enter the specific command view and reconfigure the set or policy.

The desired command can be suggested using the command association function.

If any configuration error occurs, it is reported after the command is configured.

Paragraph-by-paragraph editing

Users who are familiar with XPL clause configuration and want to simplify the configuration process

The paragraph editing UI functions as a text editor, in which users edit XPL clauses. The XPL clauses are committed after a paragraph of them are configured, and each paragraph is considered a configuration unit.

The command association function is not supported, and complete clauses must be entered in the paragraph editing UI.

If any configuration error occurs, it is reported after the configurations of the whole paragraph are committed.

Paragraph Editing Interface

This section does not detail the line-by-line editing. For details about it, see the set or route-filter configuration process. During line-by-line editing of a set or route-filter, you can run the abort command to cancel the configurations that have not been committed in the current view and return to the system view or run the display this candidate command to check the configurations that have not been committed in the current view.

Paragraph-by-paragraph editing is described in terms of Paragraph Editing Interface and Configuration Procedures of Sets and Route-Filters Using the Paragraph Editing Mode. For details about XPL paragraph editing clauses, see XPL Paragraph Editing Clauses.

The paragraph editing interface functions as a text editor, in which users can edit XPL clauses to configure or modify sets and route-filters.

Common shortcut keys

Shortcut keys can be used in the paragraph editing interface. Table 3 lists common shortcut keys and their functions.

Table 3 Shortcut keys commonly used in the paragraph editing interface

Shortcut Key

Function

i

Enters the text editing mode. Sets or route-filters can be configured only in the text editing mode.

Esc

Exits from the text editing mode.

:q!

Exits from the paragraph editing interface view without saving configurations.
NOTE:

The shortcut key takes effect only after Enter is pressed.

:wq

Saves configurations and exits from the paragraph editing interface view.
NOTE:

The shortcut key takes effect only after Enter is pressed.

Paragraph editing interface views

The following lists the different paragraph editing interface views and the commands used to access them:

Configuration Procedures of Sets and Route-Filters Using the Paragraph Editing Mode

Sets and route-filters can be configured as follows:
  • To configure a global variable set:
    1. Configure a start clause for a global variable set using the xpl global-value command.
    2. Configure set elements in the format of variable name+value in the global variable set view.
      • Each variable name is a string of 1 to 200 case-sensitive characters, spaces and question marks (?) not supported. The value must start with a letter or digit and consist of letters, digits, underscores (_), hyphens (-), and dots (.). The variable name cannot be abort, display, end-global-value, or their abbreviations, such as a, ab, abo, di, e, and end.
      • Use single quotation marks to enclose specific values, for example, aaa '12', bbb '34', and aaa '1.2.3.4'. Separate elements with commas (,).
    3. Configure an end clause using the end-global-value command for the global variable set.
  • To configure an IPv4 prefix set:
    1. Configure a start clause using the xpl ip-prefix-list ip-prefix-list-name command for an IPv4 prefix set.
    2. Configure elements (IPv4 addresses with a mask length, 1.1.1.0 24 for example) for the set and separate every two neighboring elements with a comma (,). You can use eq, ge, or le to specify the mask length. For example, 1.1.1.0 24 ge 26 le 30 matches the routes in network segment 1.1.1.0/24 with the mask length ranging from 26 to 30.
    3. Configure an end clause using the end-list command for the IPv4 prefix set.
  • To configure an IPv6 prefix set:
    1. Configure a start clause using the xpl ipv6-prefix-list ipv6-prefix-list-name command for an IPv6 prefix set.
    2. Configure elements (IPv6 addresses with a mask length, 2001:db8:0:1:: 64 for example) for the set and separate every two neighboring elements with a comma (,). You can use eq, ge, or le to specify the mask length. For example, 2001:db8:0:1:: 64 ge 96 le 100 matches the routes in network segment 2001:db8:0:1::/64 with the mask length ranging from 96 to 100.
    3. Configure an end clause using the end-list command for the IPv6 prefix set.
  • To configure an AS_Path set:
    1. Configure a start clause using the xpl as-path-list as-path-list-name command for an AS_Path set.
    2. Configure elements for the set and separate every two neighboring elements with a comma (,). The elements can be configured in any of the following formats:
      • length { eq | ge | le } as-length: eq, ge, and le match the BGP routes with the AS_Path length equal to, greater than or equal to, and less than or equal to as-length, respectively. The value of as-length is an integer ranging from 0 to 2047.
      • unique-length { eq | ge | le } as-length: eq, ge, and le match the BGP routes with the AS_Path length (with duplicate AS numbers counted as one AS number) equal to, greater than or equal to, and less than or equal to as-length, respectively. The value of as-length is an integer ranging from 0 to 2047.
      • origin as-path [ whole-match ]: matches the BGP routes with AS_Path in which rightmost AS numbers match the specified AS_Path. The as-path parameter is enclosed in single quotation marks, with every two neighboring AS numbers separated with a space. Duplicate AS numbers are cumulatively counted if whole-match is configured. If whole-match is not configured, duplicate AS numbers are counted as one AS number.
      • peer-is as-path [ whole-match ]: matches the BGP routes with AS_Path in which leftmost AS numbers match the specified AS_Path. The as-path parameter is enclosed in single quotation marks, with every two neighboring AS numbers separated with a space. Duplicate AS numbers are cumulatively counted if whole-match is configured. If whole-match is not configured, duplicate AS numbers are counted as one AS number.
      • pass as-path [ whole-match ]: matches the BGP routes with AS_Path in which some contiguous AS numbers match the specified AS_Path. The as-path parameter is enclosed in single quotation marks, with every two neighboring AS numbers separated with a space. Duplicate AS numbers are cumulatively counted if whole-match is configured. If whole-match is not configured, duplicate AS numbers are counted as one AS number.
      • regular regular-expression: matches the BGP routes with AS_Path that matches the specified regular-expression.

        Regular expression matching is intensive processing of CPU computing. When a large number of regular expressions are configured in an XPL policy to match a BGP route attribute and the length of the route attribute is long, the processing performance of the XPL policy deteriorates. To improve the processing performance of the routing policy, decrease the number of regular expressions or use a non-regular expression matching command.

        It is recommended that a maximum of 100 regular expressions be configured for each policy.

    3. Configure an end clause using the end-list command for the AS_Path set.
  • To configure a community set:
    1. Configure a start clause using the xpl community-list community-list-name command for a community set.
    2. Configure elements (100:1, for example) in the format of aa:nn, a community number, or a known community (internet, no-export-subconfed, no-advertise, or no-export) for the community set and separate every two neighboring elements with a comma (,). Alternatively, configure elements in the format of regular regular-expression, which matches the routes with community attributes matching the specified regular-expression.

      Regular expression matching is intensive processing of CPU computing. When a large number of regular expressions are configured in an XPL policy to match a BGP route attribute and the length of the route attribute is long, the processing performance of the XPL policy deteriorates. To improve the processing performance of the routing policy, decrease the number of regular expressions or use a non-regular expression matching command.

      It is recommended that a maximum of 100 regular expressions be configured for each policy.

      The regular-expression can be set to a character string in either the aa:nn format or integer format. For example:

      The regular ^1:1$ configuration matches routes that carry the community value of 65537 or 1:1.

      The regular ^65537$ configuration also matches routes that carry the community value of 65537 or 1:1.

    3. Configure an end clause using the end-list command for the community set.
  • Large-Community set:
    1. Configure a start clause using the xpl large-community-list large-community-list-name command for the Large-Community set.
    2. Configure elements in the format of aa:bb:cc (100:1:1 for example) for the Large-Community set and separate every two neighboring elements with a comma (,). Alternatively, configure elements in the format of regular regular-expression, which matches routes with the Large-Community attribute matching the specified regular-expression.

      Regular expression matching is intensive processing of CPU computing. When a large number of regular expressions are configured in an XPL policy to match a BGP route attribute and the length of the route attribute is long, the processing performance of the XPL policy deteriorates. To improve the processing performance of the routing policy, decrease the number of regular expressions or use a non-regular expression matching command.

      It is recommended that a maximum of 100 regular expressions be configured for each policy.

    3. Configure an end clause using the end-list command for the Large-Community set.
  • To configure a route-filter:
    1. Configure a start clause in the format of xpl route-filter route-filter-name($var1,$var2,...) for a route-filter. A maximum of eight parameters can be configured in a start clause, and the parameters can be used in condition or action clauses.
    2. Configure matching conditions in the format of if+condition clause+then and connect the conditions in the clause with the Boolean operator not, and, or or. Use then at the end of this line to introduce an action clause.

      Route-filters can have only action clauses and can also be empty (configured with only a start clause and an end clause). In this case, the default action refuse is used. If an empty route-filter is specified in another route-filter using a call clause, the empty route-filter does not take effect.

    3. Configure an action clause.
      • Multiple action clauses can be configured if they do not conflict with each other.
      • Action clauses (excluding approve, refuse, finish, call route-filter route-filter-name, and break) must follow apply.
    4. (Optional) Configure elseif+condition clause+then to filter the routes that fail to match the conditions specified in the if clause and specify an action clause for the elseif clause. You can configure multiple elseif clauses to filter the routes that fail to meet the previous matching rule or configure an else clause to match all the routes that fail to meet the previous matching rule and configure an action for them.
    5. Configure a conclusive condition clause using the endif command.

      Steps 2 to 5 describe how to configure an if condition branch. One route-filter can have multiple if condition branches, which can be configured in two modes, and both the two modes can be used in the same route-filter.

      • One if condition branch is followed by another.
      • The if+condition clause+then or elseif+condition clause+then is followed by another if condition branch. Such a configuration further filters the routes that match if+condition clause+then or elseif+condition clause+then against the second if condition branch.

      Regardless of the configuration mode, route filtering continues until finish, break, refuse, or the last if condition branch is implemented.

    6. Configure an end clause using the end-filter command for the route-filter.

The easiest method to configure route-filters to reference route attribute sets is to use the format {element A, element B...}, if ip route-source in { 1.1.1.0 24, 2.2.2.2 32 } then for example. However, if a route-filter needs to reference a set multiple times, configure named route attribute sets.

Purpose

When advertising, receiving, or importing routes, the router can use XPL based on actual networking requirements to filter routes and modify route attributes. XPL serves the following purposes:

  • Controls route advertisement.

    Only routes that match the rules specified in the XPL are advertised.

  • Controls route acceptance.

    Only necessary and valid routes are accepted, which reduces the routing table size and improves network security.

  • Filters and controls imported routes.

    A routing protocol may import routes discovered by other routing protocols. XPL ensures that only the routes that meet certain conditions are imported and route attributes of the imported routes are modified to meet the requirements of the protocol.

  • Modifies route attributes.

    Attributes of the routes that match the specified route-filter can be modified as required.

Benefits

XPL offers the following benefits:
  • Saves system resources by controlling the routing table size.
  • Improves network security by controlling route advertisement and acceptance.
  • Improves network performance by modifying route attributes for effective traffic planning.
  • Simplifies routing policy configurations.
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
Next topic >