Migrate bgpcep docs to the bgpcep project
[bgpcep.git] / docs / bgp / bgp-user-guide-l3vpn-family.rst
1 .. _ip-l3vpn-family:
2
3 IP L3VPN Family
4 ===============
5 The BGP/MPLS IP Virtual Private Networks (BGP L3VPN) Multiprotocol extension can be used to exchange particular VPN (customer) routes among the provider's routers attached to that VPN.
6 Also, routes are distributed to specific VPN remote sites.
7
8 .. contents:: Contents
9    :depth: 2
10    :local:
11
12 Configuration
13 ^^^^^^^^^^^^^
14 This section shows a way to enable IPv4 and IPv6 L3VPN family in BGP speaker and peer configuration.
15
16 BGP Speaker
17 '''''''''''
18 To enable IPv4 and IPv6 L3VPN support in BGP plugin, first configure BGP speaker instance:
19
20 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols``
21
22 **Method:** ``POST``
23
24 **Content-Type:** ``application/xml``
25
26 **Request Body:**
27
28 .. code-block:: xml
29
30    <protocol xmlns="http://openconfig.net/yang/network-instance">
31        <name>bgp-example</name>
32        <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
33        <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
34            <global>
35                <config>
36                    <router-id>192.0.2.2</router-id>
37                    <as>65000</as>
38                </config>
39                <afi-safis>
40                    <afi-safi>
41                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-UNICAST</afi-safi-name>
42                    </afi-safi>
43                    <afi-safi>
44                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-UNICAST</afi-safi-name>
45                    </afi-safi>
46                    <afi-safi>
47                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-MULTICAST</afi-safi-name>
48                    </afi-safi>
49                    <afi-safi>
50                        <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-MULTICAST</afi-safi-name>
51                    </afi-safi>
52                </afi-safis>
53            </global>
54        </bgp>
55    </protocol>
56
57 BGP Peer
58 ''''''''
59 Here is an example for BGP peer configuration with enabled IPv4 and IPv6 L3VPN family.
60
61 **URL:** ``/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/neighbors``
62
63 **Method:** ``POST``
64
65 **Content-Type:** ``application/xml``
66
67 **Request Body:**
68
69 .. code-block:: xml
70
71    <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
72        <neighbor-address>192.0.2.1</neighbor-address>
73        <afi-safis>
74            <afi-safi>
75                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-UNICAST</afi-safi-name>
76            </afi-safi>
77            <afi-safi>
78                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-UNICAST</afi-safi-name>
79            </afi-safi>
80        </afi-safis>
81    </neighbor>
82
83 IP L3VPN API
84 ^^^^^^^^^^^^
85 Following trees illustrate the BGP IP L3VPN routes structures.
86
87 IPv4 L3VPN Unicast Route
88 ''''''''''''''''''''''''
89 .. code-block:: console
90
91    :(vpn-ipv4-routes-case)
92       +--ro vpn-ipv4-routes
93          +--ro vpn-route* [route-key path-id]
94             +--ro route-key              string
95             +--ro path-id                path-id
96             +--ro label-stack*
97             |  +--ro label-value?   netc:mpls-label
98             +--ro prefix?                inet:ip-prefix
99             +--ro path-id?               path-id
100             +--ro route-distinguisher?   bgp-t:route-distinguisher
101             +--ro attributes
102             ...
103
104 IPv6 L3VPN Unicast Route
105 ''''''''''''''''''''''''
106 .. code-block:: console
107
108    :(vpn-ipv6-routes-case)
109       +--ro vpn-ipv6-routes
110          +--ro vpn-route* [route-key path-id]
111             +--ro route-key              string
112             +--ro path-id                path-id
113             +--ro label-stack*
114             |  +--ro label-value?   netc:mpls-label
115             +--ro prefix?                inet:ip-prefix
116             +--ro path-id?               path-id
117             +--ro route-distinguisher?   bgp-t:route-distinguisher
118             +--ro attributes
119             ...
120
121 IPv4 L3VPN Multicast Route
122 ''''''''''''''''''''''''''
123 .. code-block:: console
124
125    :(l3vpn-mcast-routes-ipv4-case)
126       +--ro l3vpn-mcast-routes-ipv4
127            +--ro l3vpn-mcast-route* [route-key path-id]
128               +--ro prefix?                inet:ip-prefix
129               +--ro route-distinguisher?   bgp-t:route-distinguisher
130
131 IPv6 L3VPN Multicast Route
132 ''''''''''''''''''''''''''
133 .. code-block:: console
134
135    :(l3vpn-mcast-routes-ipv6-case)
136       +--ro l3vpn-mcast-routes-ipv6
137            +--ro l3vpn-mcast-route* [route-key path-id]
138               +--ro prefix?                inet:ip-prefix
139               +--ro route-distinguisher?   bgp-t:route-distinguisher
140
141
142 Usage
143 ^^^^^
144 IPv4 L3VPN Unicast
145 ''''''''''''''''''
146 The IPv4 L3VPN Unicast table in an instance of the speaker's Loc-RIB can be verified via REST:
147
148 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv4-address-family/bgp-types:mpls-labeled-vpn-subsequent-address-family/bgp-vpn-ipv4:vpn-ipv4-routes``
149
150 **Method:** ``GET``
151
152 **Response Body:**
153
154 .. code-block:: xml
155
156    <vpn-ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-vpn-ipv4">
157        <vpn-route>
158            <path-id>0</path-id>
159            <route-key>cAXdYQABrBAALABlCgIi</route-key>
160            <label-stack>
161                <label-value>24022</label-value>
162            </label-stack>
163            <attributes>
164                <extended-communities>
165                    <transitive>true</transitive>
166                    <route-target-extended-community>
167                        <global-administrator>65000</global-administrator>
168                        <local-administrator>AAAAZQ==</local-administrator>
169                    </route-target-extended-community>
170                </extended-communities>
171                <origin>
172                    <value>igp</value>
173                </origin>
174                <as-path></as-path>
175                <local-pref>
176                    <pref>100</pref>
177                </local-pref>
178                <ipv4-next-hop>
179                    <global>127.16.0.44</global>
180                </ipv4-next-hop>
181            </attributes>
182            <route-distinguisher>172.16.0.44:101</route-distinguisher>
183            <prefix>10.2.34.0/24</prefix>
184        </vpn-route>
185    </vpn-ipv4-routes>
186
187 IPv6 L3VPN Unicast
188 ''''''''''''''''''
189 The IPv6 L3VPN Unicast table in an instance of the speaker's Loc-RIB can be verified via REST:
190
191 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv6-address-family/bgp-types:mpls-labeled-vpn-subsequent-address-family/bgp-vpn-ipv6:vpn-ipv6-routes``
192
193 **Method:** ``GET``
194
195 **Response Body:**
196
197 .. code-block:: xml
198
199    <vpn-ipv6-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-vpn-ipv6">
200        <vpn-route>
201            <path-id>0</path-id>
202            <route-key>mAXdcQABrBAALABlKgILgAAAAAE=</route-key>
203            <label-stack>
204                <label-value>24023</label-value>
205            </label-stack>
206            <attributes>
207                <local-pref>
208                    <pref>100</pref>
209                </local-pref>
210                <extended-communities>
211                    <route-target-extended-community>
212                        <global-administrator>65000</global-administrator>
213                        <local-administrator>AAAAZQ==</local-administrator>
214                    </route-target-extended-community>
215                    <transitive>true</transitive>
216                </extended-communities>
217                <ipv6-next-hop>
218                    <global>2a02:b80:0:2::1</global>
219                </ipv6-next-hop>
220                <origin>
221                    <value>igp</value>
222                </origin>
223                <as-path></as-path>
224            </attributes>
225            <route-distinguisher>172.16.0.44:101</route-distinguisher>
226            <prefix>2a02:b80:0:1::/64</prefix>
227        </vpn-route>
228    </vpn-ipv6-routes>
229
230 IPv4 L3VPN Multicast
231 ''''''''''''''''''''
232 The IPv4 L3VPN Multicast table in an instance of the speaker's Loc-RIB can be verified via REST:
233
234 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv4-address-family/bgp-types:mcast-mpls-labeled-vpn-subsequent-address-family/bgp-l3vpn-mcast:l3vpn-mcast-routes``
235
236 **Method:** ``GET``
237
238 **Response Body:**
239
240 .. code-block:: xml
241
242    <l3vpn-mcast-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp:l3vpn:mcast">
243        <l3vpn-mcast-route>
244            <path-id>0</path-id>
245            <route-key>mAXdcQABrBAALABlKgILgAAAAAE=</route-key>
246            <route-distinguisher>172.16.0.44:101</route-distinguisher>
247            <prefix>10.2.34.0/24</prefix>
248            <attributes>
249                <local-pref>
250                    <pref>100</pref>
251                </local-pref>
252                <extended-communities>
253                    <transitive>true</transitive>
254                    <vrf-route-import-extended-community>
255                        <inet4-specific-extended-community-common>
256                            <global-administrator>10.0.0.1</global-administrator>
257                            <local-administrator>123=</local-administrator>
258                         </inet4-specific-extended-community-common>
259                     </vrf-route-import-extended-community>
260                </extended-communities>
261                <ipv4-next-hop>
262                    <global>127.16.0.44</global>
263                </ipv4-next-hop>
264                <origin>
265                    <value>igp</value>
266                </origin>
267                <as-path></as-path>
268            </attributes>
269        </l3vpn-mcast-route>
270    </l3vpn-mcast-routes>
271
272 IPv6 L3VPN Multicast
273 ''''''''''''''''''''
274 The IPv4 L3VPN Multicast table in an instance of the speaker's Loc-RIB can be verified via REST:
275
276 **URL:** ``/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example/loc-rib/tables/bgp-types:ipv6-address-family/bgp-types:mcast-mpls-labeled-vpn-subsequent-address-family/bgp-l3vpn-mcast:l3vpn-mcast-routes``
277
278 **Method:** ``GET``
279
280 **Response Body:**
281
282 .. code-block:: xml
283
284    <l3vpn-mcast-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp:l3vpn:mcast">
285        <l3vpn-mcast-route>
286            <path-id>0</path-id>
287            <route-key>mAXdcQABrBAALABlKgILgAAAAAE=</route-key>
288            <route-distinguisher>172.16.0.44:101</route-distinguisher>
289            <prefix>2a02:b80:0:1::/64</prefix>
290            <attributes>
291                <local-pref>
292                    <pref>100</pref>
293                </local-pref>
294                <extended-communities>
295                    <transitive>true</transitive>
296                    <vrf-route-import-extended-community>
297                        <inet4-specific-extended-community-common>
298                            <global-administrator>10.0.0.1</global-administrator>
299                            <local-administrator>123=</local-administrator>
300                         </inet4-specific-extended-community-common>
301                     </vrf-route-import-extended-community>
302                </extended-communities>
303                <ipv6-next-hop>
304                    <global>2a02:b80:0:2::1</global>
305                </ipv6-next-hop>
306                <origin>
307                    <value>igp</value>
308                </origin>
309                <as-path></as-path>
310            </attributes>
311        </l3vpn-mcast-route>
312    </l3vpn-mcast-routes>
313
314 Programming
315 ^^^^^^^^^^^
316 This examples show how to originate and remove IPv4 L3VPN Unicast route via programmable RIB.
317 Make sure the *Application Peer* is configured first.
318
319 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-types:mpls-labeled-vpn-subsequent-address-family/bgp-vpn-ipv4:vpn-ipv4-routes``
320
321 **Method:** ``POST``
322
323 **Content-Type:** ``application/xml``
324
325 **Request Body:**
326
327 .. code-block:: xml
328
329    <vpn-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-vpn-ipv4">
330        <path-id>0</path-id>
331        <route-key>vpn1</route-key>
332        <label-stack>
333            <label-value>123</label-value>
334        </label-stack>
335        <route-distinguisher>429496729:1</route-distinguisher>
336        <prefix>2.2.2.2/32</prefix>
337        <attributes>
338            <ipv4-next-hop>
339                <global>199.20.166.41</global>
340            </ipv4-next-hop>
341            <as-path/>
342            <origin>
343                <value>igp</value>
344            </origin>
345            <extended-communities>
346                <route-target-extended-community>
347                    <global-administrator>65000</global-administrator>
348                    <local-administrator>AAAAZQ==</local-administrator>
349                </route-target-extended-community>
350                <transitive>true</transitive>
351            </extended-communities>
352        </attributes>
353    </vpn-route>
354
355 -----
356
357 To remove the route added above, following request can be used:
358
359 **URL:** ``/restconf/config/bgp-rib:application-rib/10.25.1.9/tables/bgp-types:ipv4-address-family/bgp-types:mpls-labeled-vpn-subsequent-address-family/bgp-vpn-ipv4:vpn-ipv4-routes/vpn-route/vpn1/0``
360
361 **Method:** ``DELETE``
362
363 References
364 ^^^^^^^^^^
365 * `BGP/MPLS IP Virtual Private Networks (VPNs) <https://tools.ietf.org/html/rfc4364>`_
366 * `BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN <https://tools.ietf.org/html/rfc4659>`_
367 * `BGP/MPLS VPN Virtual PE <https://tools.ietf.org/html/draft-ietf-bess-virtual-pe-00>`_