This section provides a sample of configuring a BGP-IPv4 unicast address family using the edit-config:merge method.
Operation |
XPATH |
---|---|
edit-config:merge |
|
Item |
Data |
Description |
---|---|---|
Integral AS number |
100 |
Enable BGP and enter the BGP view. |
Router ID |
3.3.3.3 |
Specifies a Router ID. |
GR function |
true |
Enable the GR function. |
Default route import |
true |
Import the default routes in the local IP routing table to the BGP routing table. |
Direct route import |
true |
Import direct routes. |
Static route import |
true |
Import static routes. |
IS-IS route import |
1 |
Import IS-IS routes of IS-IS process 1 into BGP. |
OSPF route import |
1 |
Import OSPF routes of OSPF process 1 into BGP. |
Peer IP address |
10.1.1.1 |
Specify a peer IP address. |
Peer AS number |
100 |
Configure an AS number for a peer. |
Source interface |
Vlanif100 |
Specify the type and number of the source interface that sends BGP packets. |
BGP peer |
true |
Enable a BGP peer. |
Route reflector |
true |
Enable the local end as a route reflector. |
Create VLANIF 100 and assign an IP address to it.
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="3" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <if:interfaces xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces"> <if:interface> <if:name>Vlanif100</if:name> <if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:propVirtual</if:type> <ip:ipv4 xmlns:ip="urn:ietf:params:xml:ns:yang:ietf-ip"> <ip:address> <ip:ip>10.1.1.1</ip:ip> <ip:prefix-length>24</ip:prefix-length> </ip:address> </ip:ipv4> </if:interface> </if:interfaces> </config> </edit-config> </rpc>
Configure a BGP-IPv4 unicast address family.
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="0" 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="merge"> <rt:name>bgp</rt:name> <rt:routing-protocols> <rt:routing-protocol> <rt:type xmlns:huawei-bgp="urn:huawei:params:xml:ns:yang:huawei-bgp">huawei-bgp:bgp-routing-protocol</rt:type> <rt:name>bgp</rt:name> <hw-bgp:bgp-routing xmlns:hw-bgp="urn:huawei:params:xml:ns:yang:huawei-bgp"> <hw-bgp:bgp-router> <hw-bgp:local-as-number>100</hw-bgp:local-as-number> <hw-bgp:router-id> <hw-bgp:ip-address>3.3.3.3</hw-bgp:ip-address> </hw-bgp:router-id> <hw-bgp:graceful-restart> <hw-bgp:enable>true</hw-bgp:enable> </hw-bgp:graceful-restart> <hw-bgp:af-configuration> <hw-bgp:ipv4> <hw-bgp:unicast> <hw-bgp:default-route-imported>true</hw-bgp:default-route-imported> <hw-bgp:protocol> <hw-bgp:direct>true</hw-bgp:direct> <hw-bgp:isis> <hw-bgp:isis-id>1</hw-bgp:isis-id> </hw-bgp:isis> <hw-bgp:ospf> <hw-bgp:ospf-id>1</hw-bgp:ospf-id> </hw-bgp:ospf> <hw-bgp:static>true</hw-bgp:static> </hw-bgp:protocol> </hw-bgp:unicast> </hw-bgp:ipv4> </hw-bgp:af-configuration> </hw-bgp:bgp-router> <hw-bgp:bgp-neighbors> <hw-bgp:bgp-neighbor> <hw-bgp:peer-address>10.1.1.1</hw-bgp:peer-address> <hw-bgp:remote-as>100</hw-bgp:remote-as> <hw-bgp:identifier-interface>Vlanif100</hw-bgp:identifier-interface> <hw-bgp:af-specific-config> <hw-bgp:ipv4> <hw-bgp:unicast> <hw-bgp:active>true</hw-bgp:active> <hw-bgp:route-reflector-client>true</hw-bgp:route-reflector-client> </hw-bgp:unicast> </hw-bgp:ipv4> </hw-bgp:af-specific-config> </hw-bgp:bgp-neighbor> </hw-bgp:bgp-neighbors> </hw-bgp:bgp-routing> </rt:routing-protocol> </rt:routing-protocols> </rt:routing-instance> </rt:routing> </config> </edit-config> </rpc>
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="10"> <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="10"> <rpc-error> <error-app-tag>-1</error-app-tag> <error-message> The type of the peer is not IBGP.</error-message> <error-info>Error on node /ietf-routing:routing/routing-instance[name="bgp"]/routing-protocols/routing-protocol[type="huawei-bgp:bgp-routing-protocol",name="bgp"]/huawei-bgp:bgp-routing/bgp-neighbors/bgp-neighbor[peer-address="10.1.1.1"]/af-specific-config/ipv4/unicast/route-reflector-client</error-info> </rpc-error> </rpc-reply>