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 |
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>