This section provides a sample of configuring a BGP-VPN instance IPv4 address family using the edit-config:merge method.
Operation |
XPATH |
---|---|
edit-config:merge |
|
Item |
Data |
Description |
---|---|---|
VPN instance name of a BGP-VPN instance IPv4 address family |
vrf1 |
Specify the VPN instance name of a BGP-VPN instance IPv4 address family. |
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 |
Vbdif1 |
Specify the source interface that sends BGP packets. |
Route reflector |
true |
Enable the local end as a route reflector. |
Next-hop address |
true |
Enable a device to set its IP address as the next-hop IP address. |
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. |
RD of a VPN instance |
100:1 |
Specify an RD for the VPN instance. |
VPN-target value |
200:2 |
Set the VPN-target value. |
VPN-target direction |
both |
Configure the VPN-target direction. |
Create a VPN instance and configure an RD.
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="24" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <hw-l3vpn:vpn-instances xmlns:hw-l3vpn="urn:huawei:params:xml:ns:yang:huawei-l3vpn"> <hw-l3vpn:vpn-instance> <hw-l3vpn:vpn-instance-name>vrf1</hw-l3vpn:vpn-instance-name> <hw-bgp-vpn:ipv4-family xmlns:hw-bgp-vpn="urn:huawei:params:xml:ns:yang:huawei-bgp-l3vpn"> <hw-bgp-vpn:route-distinguisher>100:1</hw-bgp-vpn:route-distinguisher> </hw-bgp-vpn:ipv4-family> </hw-l3vpn:vpn-instance> </hw-l3vpn:vpn-instances> </config> </edit-config> </rpc>
Set the VPN-target value for a VPN instance.
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="25" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <hw-l3vpn:vpn-instances xmlns:hw-l3vpn="urn:huawei:params:xml:ns:yang:huawei-l3vpn"> <hw-l3vpn:vpn-instance> <hw-l3vpn:vpn-instance-name>vrf1</hw-l3vpn:vpn-instance-name> <hw-bgp-vpn:ipv4-family xmlns:hw-bgp-vpn="urn:huawei:params:xml:ns:yang:huawei-bgp-l3vpn"> <hw-bgp-vpn:route-distinguisher>100:1</hw-bgp-vpn:route-distinguisher> <hw-bgp-vpn:vpnTargets> <hw-bgp-vpn:vpnTarget> <hw-bgp-vpn:vrfRTValue>200:2</hw-bgp-vpn:vrfRTValue> <hw-bgp-vpn:vrfRTType>both</hw-bgp-vpn:vrfRTType> </hw-bgp-vpn:vpnTarget> </hw-bgp-vpn:vpnTargets> </hw-bgp-vpn:ipv4-family> </hw-l3vpn:vpn-instance> </hw-l3vpn:vpn-instances> </config> </edit-config> </rpc>
Configure the VBDIF1 interface.
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="13" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <bd:bridge-domains xmlns:bd="urn:huawei:params:xml:ns:yang:huawei-bd" xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"> <bd:bridge-domain xc:operation="merge"> <bd:id>1</bd:id> </bd:bridge-domain> </bd:bridge-domains> <if:interfaces xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces"> <if:interface xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="merge"> <if:name>Vbdif1</if:name> <if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:propVirtual</if:type> </if:interface> </if:interfaces> </config> </edit-config> </rpc>
Bind an interface to the VPN instance.
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="26" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <hw-l3vpn:vpn-interfaces xmlns:hw-l3vpn="urn:huawei:params:xml:ns:yang:huawei-l3vpn"> <hw-l3vpn:vpn-interface> <hw-l3vpn:name>Vbdif1</hw-l3vpn:name> <hw-l3vpn:vpn-instance-name>vrf1</hw-l3vpn:vpn-instance-name> </hw-l3vpn:vpn-interface> </hw-l3vpn:vpn-interfaces> </config> </edit-config> </rpc>
Create a BGP-VPN instance IPv4 address family view.
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="27" 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>test1</rt:name> <rt:routing-protocols> <rt:routing-protocol> <rt:type xmlns:hw-bgp="urn:huawei:params:xml:ns:yang:huawei-bgp">hw-bgp:bgp-routing-protocol</rt:type> <rt:name>test2</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-vpn:bgp-af-ipv4-vpn-instances xmlns:hw-bgp-vpn="urn:huawei:params:xml:ns:yang:huawei-bgp-l3vpn"> <hw-bgp-vpn:bgp-af-ipv4-vpn-instance> <hw-bgp-vpn:vpn-instance-name>vrf1</hw-bgp-vpn:vpn-instance-name> </hw-bgp-vpn:bgp-af-ipv4-vpn-instance> </hw-bgp-vpn:bgp-af-ipv4-vpn-instances> </hw-bgp:bgp-router> </hw-bgp:bgp-routing> </rt:routing-protocol> </rt:routing-protocols> </rt:routing-instance> </rt:routing> </config> </edit-config> </rpc>
Configure a peer, including specifying the source interface, enabling a route reflector, and specify a next-hop address.
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="28" 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>test1</rt:name> <rt:routing-protocols> <rt:routing-protocol> <rt:type xmlns:hw-bgp="urn:huawei:params:xml:ns:yang:huawei-bgp">hw-bgp:bgp-routing-protocol</rt:type> <rt:name>test2</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-vpn:bgp-af-ipv4-vpn-instances xmlns:hw-bgp-vpn="urn:huawei:params:xml:ns:yang:huawei-bgp-l3vpn"> <hw-bgp-vpn:bgp-af-ipv4-vpn-instance> <hw-bgp-vpn:vpn-instance-name>vrf1</hw-bgp-vpn:vpn-instance-name> <hw-bgp-vpn:bgp-peers> <hw-bgp-vpn:bgpPeer> <hw-bgp-vpn:peer-addr>10.1.1.1</hw-bgp-vpn:peer-addr> <hw-bgp-vpn:remote-as>100</hw-bgp-vpn:remote-as> <hw-bgp-vpn:identifier-interface>Vbdif1</hw-bgp-vpn:identifier-interface> <hw-bgp-vpn:route-reflector-client>true</hw-bgp-vpn:route-reflector-client> <hw-bgp-vpn:next-hop-local>true</hw-bgp-vpn:next-hop-local> </hw-bgp-vpn:bgpPeer> </hw-bgp-vpn:bgp-peers> </hw-bgp-vpn:bgp-af-ipv4-vpn-instance> </hw-bgp-vpn:bgp-af-ipv4-vpn-instances> </hw-bgp:bgp-router> </hw-bgp:bgp-routing> </rt:routing-protocol> </rt:routing-protocols> </rt:routing-instance> </rt:routing> </config> </edit-config> </rpc>
Import routes, including direct route, static routes, IS-IS routes, and OSPF routes.
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="29" 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>test1</rt:name> <rt:routing-protocols> <rt:routing-protocol> <rt:type xmlns:hw-bgp="urn:huawei:params:xml:ns:yang:huawei-bgp">hw-bgp:bgp-routing-protocol</rt:type> <rt:name>test2</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-vpn:bgp-af-ipv4-vpn-instances xmlns:hw-bgp-vpn="urn:huawei:params:xml:ns:yang:huawei-bgp-l3vpn"> <hw-bgp-vpn:bgp-af-ipv4-vpn-instance> <hw-bgp-vpn:vpn-instance-name>vrf1</hw-bgp-vpn:vpn-instance-name> <hw-bgp-vpn:protocol> <hw-bgp-vpn:direct>true</hw-bgp-vpn:direct> <hw-bgp-vpn:isis> <hw-bgp-vpn:isis-id>1</hw-bgp-vpn:isis-id> </hw-bgp-vpn:isis> <hw-bgp-vpn:ospf> <hw-bgp-vpn:ospf-id>1</hw-bgp-vpn:ospf-id> </hw-bgp-vpn:ospf> <hw-bgp-vpn:static>true</hw-bgp-vpn:static> </hw-bgp-vpn:protocol> </hw-bgp-vpn:bgp-af-ipv4-vpn-instance> </hw-bgp-vpn:bgp-af-ipv4-vpn-instances> </hw-bgp:bgp-router> </hw-bgp:bgp-routing> </rt:routing-protocol> </rt:routing-protocols> </rt:routing-instance> </rt:routing> </config> </edit-config> </rpc>
Enable default route import.
<?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> <rt:routing xmlns:rt="urn:ietf:params:xml:ns:yang:ietf-routing"> <rt:routing-instance> <rt:name>test1</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>test2</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-vpn:bgp-af-ipv4-vpn-instances xmlns:hw-bgp-vpn="urn:huawei:params:xml:ns:yang:huawei-bgp-l3vpn"> <hw-bgp-vpn:bgp-af-ipv4-vpn-instance> <hw-bgp-vpn:vpn-instance-name>vrf1</hw-bgp-vpn:vpn-instance-name> <hw-bgp-vpn:default-route-imported>true</hw-bgp-vpn:default-route-imported> </hw-bgp-vpn:bgp-af-ipv4-vpn-instance> </hw-bgp-vpn:bgp-af-ipv4-vpn-instances> </hw-bgp:bgp-router> </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="4"> <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="4"> <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="test1"]/routing-protocols/routing-protocol[type="huawei-bgp:bgp-routing-protocol",name="test2"]/huawei-bgp:bgp-routing/bgp-router/huawei-bgp-l3vpn:bgp-af-ipv4-vpn-instances/bgp-af-ipv4-vpn-instance[vpn-instance-name="vrf1"]/bgp-peers/bgpPeer[peer-addr="10.1.1.1"]/route-reflector-client</error-info> </rpc-error> </rpc-reply>