IPv4 Static Route Management
This section describes the configuration model of IPv4 static route management and provides XML packet examples.
Data Model
The configuration model files matching IPv4 static route management are ietf-routing.yang, ietf-ipv4-unicast-routing, and huawei-ipv4-static-route.
Object |
Description |
Value |
Remarks |
---|---|---|---|
/ietf-routing:routing/routing-instance/name |
Indicates a routing instance name. |
The value is a string of 1 to 31 case-sensitive characters without spaces. If the string is enclosed in double quotation marks (" "), the string can contain spaces.
|
N/A |
/ietf-routing:routing/routing-instance/routing-protocols/routing-protocol/type |
Indicates a route type. |
Currently, only static routes are supported. |
N/A |
/ietf-routing:routing/routing-instance/routing-protocols/routing-protocol/name |
Indicates a routing protocol instance name. |
The value is a string of 1 to 31 case-sensitive characters without spaces. If the string is enclosed in double quotation marks (" "), the string can contain spaces. |
N/A |
/ietf-routing:routing/routing-instance/routing-protocols/routing-protocol/static-routes/ietf-ipv4-unicast-routing:ipv4/route /destination-prefix |
Indicates the destination IPv4 address and mask length. |
The value is in the ipv4-address/mask-length format:
|
N/A |
/ietf-routing:routing/routing-instance/routing-protocols/routing-protocol/static-routes/ietf-ipv4-unicast-routing:ipv4/route /description |
Indicates the description of an IPv4 static route. |
The value is a string of 1 to 80 case-sensitive characters without question marks (?). It can contain spaces. |
N/A |
/ietf-routing:routing/routing-instance/routing-protocols/routing-protocol/static-routes/ietf-ipv4-unicast-routing:ipv4/route /next-hop/next-hop-address |
Indicates a next-hop IPv4 address. |
The value is in dotted decimal notation. |
N/A |
/ietf-routing:routing/routing-instance/routing-protocols/routing-protocol/static-routes/ietf-ipv4-unicast-routing:ipv4/route /next-hop/outgoing-interface |
Indicates a next-hop outbound interface. |
The value is a character string in the interface-typeinterface-number format, where interface-type indicates the interface type and interface-number indicates the interface number. |
N/A |
/ietf-routing:routing/routing-instance/routing-protocols/routing-protocol/static-routes/ietf-ipv4-unicast-routing:ipv4/route /next-hop/special-next-hop |
Indicates a special next hop. |
Currently, only a blackhole next hop is supported. |
N/A |
/ietf-routing:routing/routing-instance/routing-protocols/routing-protocol/static-routes/ietf-ipv4-unicast-routing:ipv4/route/next-hop/next-hop-options/huawei-ipv4-static-route:multiple-path/egress-interface-nexthop |
Indicates the next-hop outbound interface information of an IPv4 static route, which is configured through the following child objects:
|
The value ranges of the child objects are as follows:
|
N/A |
/ietf-routing:routing/routing-instance/routing-protocols/routing-protocol/static-routes/ietf-ipv4-unicast-routing:ipv4/route/next-hop/next-hop-options/huawei-ipv4-static-route:multiple-path/ipv4-address-nexthop |
Indicates the next-hop IPv4 address information of an IPv4 static route, which is configured through the following child objects:
|
The value ranges of the child objects are as follows:
|
N/A |
/ietf-routing:routing/routing-instance/routing-protocols/routing-protocol/static-routes/ietf-ipv4-unicast-routing:ipv4/route/next-hop/next-hop-options/huawei-ipv4-static-route:multiple-path/egress-interface-ipv4-nexthop |
Indicates the next-hop outbound interface and next-hop IPv4 address information of an IPv4 static route, which is configured through the following child objects:
|
The value ranges of the child objects are as follows:
|
N/A |
/ietf-routing:routing/routing-instance/routing-protocols/routing-protocol/static-routes/ietf-ipv4-unicast-routing:ipv4/route/next-hop/next-hop-options/huawei-ipv4-static-route:multiple-path/egress-routing-instance-ipv4-nexthop |
Indicates the destination VPN and next-hop IPv4 address information of an IPv4 static route, which is configured through the following child objects:
|
The value ranges of the child objects are as follows:
|
N/A |
/ietf-routing:routing/routing-instance/routing-protocols/routing-protocol/static-routes/ietf-ipv4-unicast-routing:ipv4/route/next-hop/next-hop-options/huawei-ipv4-static-route:multiple-path/egress-routing-instance-nexthop |
Indicates the destination VPN information of an IPv4 static route, with no next-hop IPv4 address specified. This object is configured through the following child objects:
|
The value ranges of the child objects are as follows:
|
N/A |
Configuring IPv4 Static Routes
This section describes how to configure IPv4 static routes using edit-config.
Operation |
XPATH |
---|---|
edit-config |
/ietf-routing:routing/routing-instance/name /ietf-routing:routing/routing-instance/routing-protocols/routing-protocol/type /ietf-routing:routing/routing-instance/routing-protocols/routing-protocol/name /ietf-routing:routing/routing-instance/routing-protocols/routing-protocol/static-routes/ietf-ipv4-unicast-routing:ipv4/route/destination-prefix /ietf-routing:routing/routing-instance/routing-protocols/routing-protocol/static-routes/ietf-ipv4-unicast-routing:ipv4/route/next-hop/next-hop-options/huawei-ipv4-static-route:multiple-path/ipv4-address-nexthop/next-hop-address /ietf-routing:routing/routing-instance/routing-protocols/routing-protocol/static-routes/ietf-ipv4-unicast-routing:ipv4/route/next-hop/next-hop-options/huawei-ipv4-static-route:multiple-path/ipv4-address-nexthop/preference /ietf-routing:routing/routing-instance/routing-protocols/routing-protocol/static-routes/ietf-ipv4-unicast-routing:ipv4/route/next-hop/next-hop-options/huawei-ipv4-static-route:multiple-path/ipv4-address-nexthop/description |
Data Requirements
Item |
Data |
Description |
---|---|---|
Routing instance name |
default-routing-instance |
A static route is configured on a public network. |
Route type |
static |
- |
Routing protocol instance name |
default-routing-instance |
- |
Destination IPv4 address and prefix length |
10.1.1.1/24 |
- |
Next-hop IPv4 address |
192.168.10.1 |
- |
Priority of an IPv4 static route |
100 |
- |
Description of an IPv4 static route |
default-routing-instance |
- |
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <rt:routing xmlns:rt="urn:ietf:params:xml:ns:yang:ietf-routing"> <rt:routing-instance> <rt:name>default-routing-instance</rt:name> <rt:routing-protocols> <rt:routing-protocol> <rt:type>static</rt:type> <rt:name>default-routing-instance</rt:name> <rt:static-routes> <v4ur:ipv4 xmlns:v4ur="urn:ietf:params:xml:ns:yang:ietf-ipv4-unicast-routing"> <v4ur:route> <v4ur:destination-prefix>10.1.1.1/24</v4ur:destination-prefix> <v4ur:next-hop> <hw-v4sr:ipv4-address-nexthop xmlns:hw-v4sr="urn:huawei:params:xml:ns:yang:hw-ipv4-static-route"> <hw-v4sr:next-hop-address>192.168.10.1</hw-v4sr:next-hop-address> <hw-v4sr:preference>100</hw-v4sr:preference> <hw-v4sr:description>default-routing-instance</hw-v4sr:description> </hw-v4sr:ipv4-address-nexthop> </v4ur:next-hop> </v4ur:route> </v4ur:ipv4> </rt:static-routes> </rt:routing-protocol> </rt:routing-protocols> </rt:routing-instance> </rt:routing> </config> </edit-config> </rpc>
Deletion Example
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <rt:routing xmlns:rt="urn:ietf:params:xml:ns:yang:ietf-routing"> <rt:routing-instance xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="delete"> <rt:name>default-routing-instance</rt:name> <rt:routing-protocols> <rt:routing-protocol> <rt:type>static</rt:type> <rt:name>default-routing-instance</rt:name> <rt:static-routes> <v4ur:ipv4 xmlns:v4ur="urn:ietf:params:xml:ns:yang:ietf-ipv4-unicast-routing"> <v4ur:route> <v4ur:destination-prefix>10.1.1.1/24</v4ur:destination-prefix> <v4ur:next-hop> <hw-v4sr:ipv4-address-nexthop xmlns:hw-v4sr="urn:huawei:params:xml:ns:yang:hw-ipv4-static-route"> <hw-v4sr:next-hop-address>192.168.10.1</hw-v4sr:next-hop-address> <hw-v4sr:preference>100</hw-v4sr:preference> <hw-v4sr:description>default-routing-instance</hw-v4sr:description> </hw-v4sr:ipv4-address-nexthop> </v4ur:next-hop> </v4ur:route> </v4ur:ipv4> </rt:static-routes> </rt:routing-protocol> </rt:routing-protocols> </rt:routing-instance> </rt:routing> </config> </edit-config> </rpc>
Response Example
# Sample of successful response
<?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
<?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>Service process failed.</error-message> <error-info>Error on node /ietf-routing:routing/routing-instance[name="default-routing-instance"]/routing-protocols/routing-protocol[type="static",name="default-routing-instance"]/static-routes/ietf-ipv4-unicast-routing:ipv4/route[destination-prefix="10.1.1.1/24"]/next-hop/huawei-ipv4-static-route:ipv4-address-nexthop[next-hop-address="192.168.10.1"]</error-info> </rpc-error> </rpc-reply>