Routing Policy
This section describes the configuration model of routing policies and provides examples of XML packets.
Data Model
The configuration model file matching routing policies is huawei-route-policy.yang.
Object |
Description |
Value |
Remarks |
---|---|---|---|
/huawei-route-policy:prefix-lists/prefix-list/prefix-list-name |
Specifies the name of an IP prefix list. |
The value is a string of 1 to 169 case-sensitive characters. If spaces are used, the string must be enclosed in double quotation marks (" "). |
N/A |
/huawei-route-policy:prefix-lists/prefix-list/prefixes/prefix/seq-nr |
Specifies the sequence number of an entry in an IP prefix list. |
The value is an integer in the range from 1 to 4294967295. A maximum of 65535 entries can be configured in an IP prefix list. |
N/A |
/huawei-route-policy:prefix-lists/prefix-list/prefixes/prefix/prefix-filter/match-mode |
Specifies the match mode of an IP prefix list. |
The value is of the enumerated type:
|
N/A |
/huawei-route-policy:prefix-lists/prefix-list/prefixes/prefix/prefix-filter/ip-address |
Specifies the IP address and mask length for an IP prefix list. |
The value is in the format ipv4-address/mask-length:
|
N/A |
/huawei-route-policy:prefix-lists/prefix-list/prefixes/prefix/prefix-filter/greater-equal |
Specifies the shortest mask length. |
The value is an integer in the range from 0 to 32. |
|
/huawei-route-policy:prefix-lists/prefix-list/prefixes/prefix/prefix-filter/less-equal |
Specifies the longest mask length. |
The value is an integer in the range from 0 to 32. |
|
/huawei-route-policy:prefix-lists/prefix-list/prefixes/prefix/prefix-filter/match-network |
Specifies whether to match a network address. |
The value is of the Boolean type:
|
N/A |
/huawei-route-policy:route-policys/route-policy/name |
Specifies the name of a route-policy. |
The value is a string of 1 to 40 case-sensitive characters without spaces. If the string is enclosed in double quotation marks (" "), the string can contain spaces. |
N/A |
/huawei-route-policy:route-policys/route-policy/nodes/node/node-index |
Specifies the node index of a route-policy. |
The value is an integer in the range from 0 to 65535. |
N/A |
/huawei-route-policy:route-policys/route-policy/nodes/node/match-mode |
Specifies the match mode of a node in a route-policy. |
The value is of the enumerated type:
|
N/A |
/huawei-route-policy:route-policys/route-policy/nodes/node/match-condition/destination/destination-mode/prefix-name/prefix-name |
Specifies the name of an IP prefix list used to match routes. |
The value is a string of 1 to 169 case-sensitive characters without spaces. If the string is enclosed in double quotation marks (" "), the string can contain spaces. |
|
/huawei-route-policy:route-policys/route-policy/nodes/node/match-condition/destination/destination-mode/acl-name-or-num/acl-name-or-num |
Specifies the number or name of the ACL used in a route-policy. |
|
In the same node of a route-policy, if this object is configured together with the /huawei-route-policy:route-policys/route-policy/nodes/node/match-condition/destination/destination-mode/prefix-name/prefix-name object, the latter overwrites the first (existing) configuration. |
/huawei-route-policy:route-policys/route-policy/nodes/node/apply-action/apply-cost/cost-value |
Specifies the new cost applied to the routes that match a route-policy. |
The value is an integer in the range from 0 to 4294967295. |
N/A |
/huawei-route-policy:route-policys/route-policy/nodes/node/apply-action/applay-tag-value |
Specifies the new tag applied to the routes that match a route-policy. |
The value is an integer in the range from 0 to 4294967295. |
N/A |
/huawei-route-policy:route-policys/route-policy/nodes/node/apply-action/preference |
Specifies the new priority applied to the routes that match a route-policy. |
The value is an integer in the range from 1 to 255. |
N/A |
/huawei-route-policy:route-policys/route-policy/nodes/node/apply-action/local-preference |
Specifies the local preference of BGP routes in the routing policy. |
The value is an integer in the range from 0 to 4294967295. |
N/A |
/huawei-route-policy:route-policys/route-policy/nodes/node/match-condition/ipv4-nexthop/nexthop-mode/prefix-name |
Specifies the name of an IP prefix list. |
The value is a string of 1 to 169 case-sensitive characters. It cannot contain spaces. |
N/A |
/huawei-route-policy:ipv6-prefix-lists/ipv6-prefix-list/ipv6-prefix-list-name |
Specifies the name of an IPv6 prefix list. |
The value is a string of 1 to 169 case-sensitive characters. If spaces are used, the string must be enclosed in double quotation marks (" "). |
N/A |
/huawei-route-policy:ipv6-prefix-lists/ipv6-prefix-list/ipv6-prefixes/ipv6-prefix/seq-nr |
Specifies the sequence number of an entry in the IPv6 prefix list. |
The value is an integer in the range from 1 to 4294967295. By default, the sequence number increases by 10 according to the configuration order, and the first sequence number is 10. A maximum of 65535 entries can be configured in an IP prefix list. |
N/A |
/huawei-route-policy:ipv6-prefix-lists/ipv6-prefix-list/ipv6-prefixes/ipv6-prefix/ipv6-prefix-filter/match-mode |
Specifies the match mode of an IPv6 prefix list. |
The value is of the enumerated type:
|
N/A |
/huawei-route-policy:ipv6-prefix-lists/ipv6-prefix-list/ipv6-prefixes/ipv6-prefix/ipv6-prefix-filter/ipv6-address |
Specifies an IPv6 prefix and prefix length for the IPv6 prefix list. |
The value is in the format ipv6-address/prefix-length.
|
N/A |
/huawei-route-policy:ipv6-prefix-lists/ipv6-prefix-list/ipv6-prefixes/ipv6-prefix/ipv6-prefix-filter/greater-equal |
Specifies the shortest mask length to be matched. |
The value is an integer in the range from 0 to 128. |
The value range is: prefix-length ≤ greater-equal ≤ less-equal ≤ 128. |
/huawei-route-policy:ipv6-prefix-lists/ipv6-prefix-list/ipv6-prefixes/ipv6-prefix/ipv6-prefix-filter/less-equal |
Specifies the longest mask length to be matched. |
The value is an integer in the range from 0 to 128. |
The value range is: prefix-length ≤ greater-equal ≤ less-equal ≤ 128. |
/huawei-route-policy:ipv6-prefix-lists/ipv6-prefix-list/ipv6-prefixes/ipv6-prefix/ipv6-prefix-filter/match-network |
Specifies whether to match a network address. |
The value is of the Boolean type:
The default value is false. |
The match-network parameter is used to match the routes of a specified network address. It can be configured only when the IP address generated after the AND operation is performed on ipv6-address and prefix-length is ::. |
/huawei-route-policy:route-policys/route-policy/nodes/node/match-condition/ipv6-address/prefix-name |
Specifies the name of an IPv6 prefix list for matching the destination address of IPv6 routes. |
The value is a string of 1 to 169 case-sensitive characters. If spaces are used, the string must be enclosed in double quotation marks (" "). |
Before configuring this object, ensure that a routing policy has been created. |
/huawei-route-policy:route-policys/route-policy/nodes/node/match-condition/ipv6-nexthop/nexthop-mode/prefix-name/prefix-name |
Specifies the name of the IPv6 prefix list for matching the next hop of a route. |
The name is a string of 1 to 169 case-sensitive characters, with spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string. |
Before configuring this object, ensure that a routing policy has been created. |
Configuring a Routing Policy
This section provides a sample of configuring a routing policy using the edit-config:merge method.
Operation |
XPATH |
---|---|
edit-config:merge |
|
Data Requirement 1: Configuring an IP Prefix List
Item |
Data |
Description |
---|---|---|
Name of an IP prefix list |
test |
- |
Sequence number of an entry in an IP prefix list |
10 |
- |
Match mode of an IP prefix list |
permit |
- |
IP address and mask length of an IP prefix list |
0.0.0.0/16 |
- |
Shortest mask length |
18 |
- |
Longest mask length |
25 |
- |
Whether to use a network address to match routes |
true |
- |
Request Example
<?xml version="1.0" encoding="utf-8"?> <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <edit-config> <target> <running/> </target> <config> <hw-route-policy:prefix-lists xmlns:hw-route-policy="urn:huawei:params:xml:ns:yang:huawei-route-policy"> <hw-route-policy:prefix-list> <hw-route-policy:prefix-list-name>test</hw-route-policy:prefix-list-name> <hw-route-policy:prefixes> <hw-route-policy:prefix> <hw-route-policy:seq-nr>10</hw-route-policy:seq-nr> <hw-route-policy:prefix-filter> <hw-route-policy:match-mode>permit</hw-route-policy:match-mode> <hw-route-policy:ip-address>0.0.0.0/16</hw-route-policy:ip-address> <hw-route-policy:greater-equal>18</hw-route-policy:greater-equal> <hw-route-policy:less-equal>25</hw-route-policy:less-equal> <hw-route-policy:match-network>true</hw-route-policy:match-network> </hw-route-policy:prefix-filter> </hw-route-policy:prefix> </hw-route-policy:prefixes> </hw-route-policy:prefix-list> </hw-route-policy:prefix-lists> </config> </edit-config> </rpc>
Response Example
# Sample of successful response
##### Ok Reply or Operation Successful ##### <?xml version="1.0" encoding="UTF-8"?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <ok/> </rpc-reply>
# Sample of failed response
##### Error Reply or Operation Failed ##### <?xml version="1.0" encoding="utf-8"?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <rpc-error> <error-app-tag>-1</error-app-tag> <error-message> The specified IP address must be zero.</error-message> <error-info>Error on node /huawei-route-policy:prefix-lists/prefix-list[prefix-list-name="test"]/prefixes/prefix[seq-nr="10"]</error-info> </rpc-error> </rpc-reply>
Data Requirement 2: Configuring a Match Rule Based on an IP Prefix List
Item |
Data |
Description |
---|---|---|
Name of a route-policy |
policy |
- |
Node index of a route-policy |
5 |
- |
Match mode of a node in a route-policy |
permit |
- |
Name of an IP prefix list used to match routes |
test |
- |
Request Example
<?xml version="1.0" encoding="utf-8"?> <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2"> <edit-config> <target> <running/> </target> <config> <hw-route-policy:route-policys xmlns:hw-route-policy="urn:huawei:params:xml:ns:yang:huawei-route-policy"> <hw-route-policy:route-policy> <hw-route-policy:name>policy</hw-route-policy:name> <hw-route-policy:nodes> <hw-route-policy:node> <hw-route-policy:node-index>5</hw-route-policy:node-index> <hw-route-policy:match-mode>permit</hw-route-policy:match-mode> <hw-route-policy:match-condition> <hw-route-policy:destination> <hw-route-policy:prefix-name>test</hw-route-policy:prefix-name> </hw-route-policy:destination> </hw-route-policy:match-condition> </hw-route-policy:node> </hw-route-policy:nodes> </hw-route-policy:route-policy> </hw-route-policy:route-policys> </config> </edit-config> </rpc>
Response Example
# Sample of successful response
##### Ok Reply or Operation Successful ##### <?xml version="1.0" encoding="UTF-8"?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2"> <ok/> </rpc-reply>
# Sample of failed response
##### Error Reply or Operation Failed ##### <?xml version="1.0" encoding="utf-8"?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2"> <rpc-error> <error-app-tag>-1</error-app-tag> <error-message> The specified ip-prefix does not exist.</error-message> <error-info>Error on node /huawei-route-policy:route-policys/route-policy[name="policy"]/nodes/node[node-index="5"]/match-condition/destination</error-info> </rpc-error> </rpc-reply>
Data Requirement 3: Configuring a Match Rule Based on an ACL
Item |
Data |
Description |
---|---|---|
Name of a route-policy |
policy |
- |
Node index of a route-policy |
10 |
- |
Match mode of a node in a route-policy |
permit |
- |
Number of the ACL used in a route-policy |
2000 |
- |
Request Example
<?xml version="1.0" encoding="utf-8"?> <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="3"> <edit-config> <target> <running/> </target> <config> <hw-route-policy:route-policys xmlns:hw-route-policy="urn:huawei:params:xml:ns:yang:huawei-route-policy"> <hw-route-policy:route-policy> <hw-route-policy:name>policy</hw-route-policy:name> <hw-route-policy:nodes> <hw-route-policy:node> <hw-route-policy:node-index>10</hw-route-policy:node-index> <hw-route-policy:match-mode>permit</hw-route-policy:match-mode> <hw-route-policy:match-condition> <hw-route-policy:destination> <hw-route-policy:acl-name-or-num>2000</hw-route-policy:acl-name-or-num> </hw-route-policy:destination> </hw-route-policy:match-condition> </hw-route-policy:node> </hw-route-policy:nodes> </hw-route-policy:route-policy> </hw-route-policy:route-policys> </config> </edit-config> </rpc>
Response Example
# Sample of successful response
##### Ok Reply or Operation Successful ##### <?xml version="1.0" encoding="UTF-8"?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="3"> <ok/> </rpc-reply>
# Sample of failed response
##### Error Reply or Operation Failed ##### <?xml version="1.0" encoding="utf-8"?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="3"> <rpc-error> <error-app-tag>-1</error-app-tag> <error-message>The configuration/operation does not support.</error-message> <error-info>Error on node /huawei-route-policy:route-policys/route-policy[name="policy"]/nodes/node[node-index="10"]/match-condition/destination</error-info> </rpc-error> </rpc-reply>
Data Requirement 4: Changing the Attributes of Routes Matching a Route-Policy
Item |
Data |
Description |
---|---|---|
Name of a route-policy |
policy |
- |
Node index of a route-policy |
5 |
- |
New cost applied to the routes that match a route-policy |
4 |
- |
New tag applied to the routes that match a route-policy |
5 |
- |
New priority applied to the routes that match a route-policy |
6 |
- |
Request Example
<?xml version="1.0" encoding="utf-8"?> <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="4"> <edit-config> <target> <running/> </target> <config> <hw-route-policy:route-policys xmlns:hw-route-policy="urn:huawei:params:xml:ns:yang:huawei-route-policy"> <hw-route-policy:route-policy> <hw-route-policy:name>policy</hw-route-policy:name> <hw-route-policy:nodes> <hw-route-policy:node> <hw-route-policy:node-index>5</hw-route-policy:node-index> <hw-route-policy:match-mode>permit</hw-route-policy:match-mode> <hw-route-policy:apply-action> <hw-route-policy:apply-cost> <hw-route-policy:cost-value>4</hw-route-policy:cost-value> </hw-route-policy:apply-cost> <hw-route-policy:apply-tag-value>5</hw-route-policy:apply-tag-value> <hw-route-policy:preference>6</hw-route-policy:preference> </hw-route-policy:apply-action> </hw-route-policy:node> </hw-route-policy:nodes> </hw-route-policy:route-policy> </hw-route-policy:route-policys> </config> </edit-config> </rpc>
Response Example
# Sample of successful response
##### Ok Reply or Operation Successful ##### <?xml version="1.0" encoding="UTF-8"?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="4"> <ok/> </rpc-reply>
# Sample of failed response
##### Error Reply or Operation Failed ##### <?xml version="1.0" encoding="utf-8"?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="4"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-path>/huawei-route-policy:route-policys/route-policy[name="policy"]/nodes/node[node-index="5"]/apply-action/preference</error-path> <error-message>parse rpc config error.(Value "256" does not satisfy the constraint "1..255" (range, length, or pattern).).</error-message> </rpc-error> </rpc-reply>