Bump versions to 0.21.8-SNAPSHOT
[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:** ``/rests/data/openconfig-network-instance:network-instances/network-instance=global-bgp/protocols``
21
22 **Method:** ``POST``
23
24 .. tabs::
25
26    .. tab:: XML
27
28       **Content-Type:** ``application/xml``
29
30       **Request Body:**
31
32       .. code-block:: xml
33
34          <protocol xmlns="http://openconfig.net/yang/network-instance">
35              <name>bgp-example</name>
36              <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
37              <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
38                  <global>
39                      <config>
40                          <router-id>192.0.2.2</router-id>
41                          <as>65000</as>
42                      </config>
43                      <afi-safis>
44                          <afi-safi>
45                              <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-UNICAST</afi-safi-name>
46                          </afi-safi>
47                          <afi-safi>
48                              <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-UNICAST</afi-safi-name>
49                          </afi-safi>
50                          <afi-safi>
51                              <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-MULTICAST</afi-safi-name>
52                          </afi-safi>
53                          <afi-safi>
54                              <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-MULTICAST</afi-safi-name>
55                          </afi-safi>
56                      </afi-safis>
57                  </global>
58              </bgp>
59          </protocol>
60
61    .. tab:: JSON
62
63       **Content-Type:** ``application/json``
64
65       **Request Body:**
66
67       .. code-block:: json
68
69          {
70              "protocol": [
71                  {
72                      "identifier": "openconfig-policy-types:BGP",
73                      "name": "bgp-example",
74                      "bgp-openconfig-extensions:bgp": {
75                          "global": {
76                              "config": {
77                                  "router-id": "192.0.2.2",
78                                  "as": 65000
79                              },
80                              "afi-safis": {
81                                  "afi-safi": [
82                                      {
83                                          "afi-safi-name": "openconfig-bgp-types:L3VPN-IPV4-UNICAST"
84                                      },
85                                      {
86                                          "afi-safi-name": "openconfig-bgp-types:L3VPN-IPV6-UNICAST"
87                                      },
88                                      {
89                                          "afi-safi-name": "openconfig-bgp-types:L3VPN-IPV4-MULTICAST"
90                                      },
91                                      {
92                                          "afi-safi-name": "openconfig-bgp-types:L3VPN-IPV6-MULTICAST"
93                                      }
94                                  ]
95                              }
96                          }
97                      }
98                  }
99              ]
100          }
101
102 BGP Peer
103 ''''''''
104 Here is an example for BGP peer configuration with enabled IPv4 and IPv6 L3VPN family.
105
106 **URL:** ``/rests/data/openconfig-network-instance:network-instances/network-instance=global-bgp/openconfig-network-instance:protocols/protocol=openconfig-policy-types:BGP/bgp-example/bgp/neighbors``
107
108 **Method:** ``POST``
109
110 .. tabs::
111
112    .. tab:: XML
113
114       **Content-Type:** ``application/xml``
115
116       **Request Body:**
117
118       .. code-block:: xml
119
120          <neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
121              <neighbor-address>192.0.2.1</neighbor-address>
122              <afi-safis>
123                  <afi-safi>
124                      <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV4-UNICAST</afi-safi-name>
125                  </afi-safi>
126                  <afi-safi>
127                      <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L3VPN-IPV6-UNICAST</afi-safi-name>
128                  </afi-safi>
129              </afi-safis>
130          </neighbor>
131
132    .. tab:: JSON
133
134       **Content-Type:** ``application/json``
135
136       **Request Body:**
137
138       .. code-block:: json
139
140          {
141              "neighbor": [
142                  {
143                      "neighbor-address": "192.0.2.1",
144                      "afi-safis": {
145                          "afi-safi": [
146                              {
147                                  "afi-safi-name": "openconfig-bgp-types:L3VPN-IPV4-UNICAST"
148                              },
149                              {
150                                  "afi-safi-name": "openconfig-bgp-types:L3VPN-IPV6-UNICAST"
151                              }
152                          ]
153                      }
154                  }
155              ]
156          }
157
158 IP L3VPN API
159 ^^^^^^^^^^^^
160 Following trees illustrate the BGP IP L3VPN routes structures.
161
162 IPv4 L3VPN Unicast Route
163 ''''''''''''''''''''''''
164 .. code-block:: console
165
166    :(vpn-ipv4-routes-case)
167       +--ro vpn-ipv4-routes
168          +--ro vpn-route* [route-key path-id]
169             +--ro route-key              string
170             +--ro path-id                path-id
171             +--ro label-stack*
172             |  +--ro label-value?   netc:mpls-label
173             +--ro prefix?                inet:ip-prefix
174             +--ro path-id?               path-id
175             +--ro route-distinguisher?   bgp-t:route-distinguisher
176             +--ro attributes
177             ...
178
179 IPv6 L3VPN Unicast Route
180 ''''''''''''''''''''''''
181 .. code-block:: console
182
183    :(vpn-ipv6-routes-case)
184       +--ro vpn-ipv6-routes
185          +--ro vpn-route* [route-key path-id]
186             +--ro route-key              string
187             +--ro path-id                path-id
188             +--ro label-stack*
189             |  +--ro label-value?   netc:mpls-label
190             +--ro prefix?                inet:ip-prefix
191             +--ro path-id?               path-id
192             +--ro route-distinguisher?   bgp-t:route-distinguisher
193             +--ro attributes
194             ...
195
196 IPv4 L3VPN Multicast Route
197 ''''''''''''''''''''''''''
198 .. code-block:: console
199
200    :(l3vpn-mcast-routes-ipv4-case)
201       +--ro l3vpn-mcast-routes-ipv4
202            +--ro l3vpn-mcast-route* [route-key path-id]
203               +--ro prefix?                inet:ip-prefix
204               +--ro route-distinguisher?   bgp-t:route-distinguisher
205
206 IPv6 L3VPN Multicast Route
207 ''''''''''''''''''''''''''
208 .. code-block:: console
209
210    :(l3vpn-mcast-routes-ipv6-case)
211       +--ro l3vpn-mcast-routes-ipv6
212            +--ro l3vpn-mcast-route* [route-key path-id]
213               +--ro prefix?                inet:ip-prefix
214               +--ro route-distinguisher?   bgp-t:route-distinguisher
215
216
217 Usage
218 ^^^^^
219 IPv4 L3VPN Unicast
220 ''''''''''''''''''
221 The IPv4 L3VPN Unicast table in an instance of the speaker's Loc-RIB can be verified via REST:
222
223 **URL:** ``/rests/data/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?content=nonconfig``
224
225 **Method:** ``GET``
226
227 .. tabs::
228
229    .. tab:: XML
230
231       **Response Body:**
232
233       .. code-block:: xml
234
235          <vpn-ipv4-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-vpn-ipv4">
236              <vpn-route>
237                  <path-id>0</path-id>
238                  <route-key>cAXdYQABrBAALABlCgIi</route-key>
239                  <label-stack>
240                      <label-value>24022</label-value>
241                  </label-stack>
242                  <attributes>
243                      <extended-communities>
244                          <transitive>true</transitive>
245                          <route-target-extended-community>
246                              <global-administrator>65000</global-administrator>
247                              <local-administrator>AAAAZQ==</local-administrator>
248                          </route-target-extended-community>
249                      </extended-communities>
250                      <origin>
251                          <value>igp</value>
252                      </origin>
253                      <as-path></as-path>
254                      <local-pref>
255                          <pref>100</pref>
256                      </local-pref>
257                      <ipv4-next-hop>
258                          <global>127.16.0.44</global>
259                      </ipv4-next-hop>
260                  </attributes>
261                  <route-distinguisher>172.16.0.44:101</route-distinguisher>
262                  <prefix>10.2.34.0/24</prefix>
263              </vpn-route>
264          </vpn-ipv4-routes>
265
266    .. tab:: JSON
267
268       **Response Body:**
269
270       .. code-block:: json
271
272          {
273              "bgp-vpn-ipv4:vpn-ipv4-routes": {
274                  "vpn-route": {
275                      "route-key": "cAXdYQABrBAALABlCgIi",
276                      "path-id": 0,
277                      "label-stack": {
278                          "label-value":24022
279                      },
280                      "attributes": {
281                          "extended-communities": {
282                              "transitive": true,
283                              "route-target-extended-community": {
284                                  "global-administrator": "65000",
285                                  "local-administrator": "AAAAZQ=="
286                              }
287                          },
288                          "origin": {
289                              "value": "igp"
290                          },
291                          "local-pref": {
292                              "pref": 100
293                          },
294                          "ipv4-next-hop": {
295                              "global": "127.16.0.44"
296                          }
297                      },
298                      "route-distinguisher": "172.16.0.44:101",
299                      "prefix":"10.2.34.0/24"
300                  }
301              }
302          }
303
304 IPv6 L3VPN Unicast
305 ''''''''''''''''''
306 The IPv6 L3VPN Unicast table in an instance of the speaker's Loc-RIB can be verified via REST:
307
308 **URL:** ``/rests/data/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?content=nonconfig``
309
310 **Method:** ``GET``
311
312 .. tabs::
313
314    .. tab:: XML
315
316       **Response Body:**
317
318       .. code-block:: xml
319
320          <vpn-ipv6-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp-vpn-ipv6">
321              <vpn-route>
322                  <path-id>0</path-id>
323                  <route-key>mAXdcQABrBAALABlKgILgAAAAAE=</route-key>
324                  <label-stack>
325                      <label-value>24023</label-value>
326                  </label-stack>
327                  <attributes>
328                      <local-pref>
329                          <pref>100</pref>
330                      </local-pref>
331                      <extended-communities>
332                          <route-target-extended-community>
333                              <global-administrator>65000</global-administrator>
334                              <local-administrator>AAAAZQ==</local-administrator>
335                          </route-target-extended-community>
336                          <transitive>true</transitive>
337                      </extended-communities>
338                      <ipv6-next-hop>
339                          <global>2a02:b80:0:2::1</global>
340                      </ipv6-next-hop>
341                      <origin>
342                          <value>igp</value>
343                      </origin>
344                      <as-path></as-path>
345                  </attributes>
346                  <route-distinguisher>172.16.0.44:101</route-distinguisher>
347                  <prefix>2a02:b80:0:1::/64</prefix>
348              </vpn-route>
349          </vpn-ipv6-routes>
350
351    .. tab:: JSON
352
353       **Response Body:**
354
355       .. code-block:: json
356
357          {
358              "bgp-vpn-ipv6:vpn-ipv6-routes": {
359                  "vpn-route": {
360                      "route-key": "mAXdcQABrBAALABlKgILgAAAAAE=",
361                      "path-id": 0,
362                      "label-stack": {
363                          "label-value":24023
364                      },
365                      "attributes": {
366                          "extended-communities": {
367                              "transitive": true,
368                              "route-target-extended-community": {
369                                  "global-administrator": "65000",
370                                  "local-administrator": "AAAAZQ=="
371                              }
372                          },
373                          "origin": {
374                              "value": "igp"
375                          },
376                          "local-pref": {
377                              "pref": 100
378                          },
379                          "ipv6-next-hop": {
380                              "global": "2a02:b80:0:2::1"
381                          }
382                      },
383                      "route-distinguisher": "172.16.0.44:101",
384                      "prefix":"2a02:b80:0:1::/64"
385                  }
386              }
387          }
388
389 IPv4 L3VPN Multicast
390 ''''''''''''''''''''
391 The IPv4 L3VPN Multicast table in an instance of the speaker's Loc-RIB can be verified via REST:
392
393 **URL:** ``/rests/data/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?content=nonconfig``
394
395 **Method:** ``GET``
396
397 .. tabs::
398
399    .. tab:: XML
400
401       **Response Body:**
402
403       .. code-block:: xml
404
405          <l3vpn-mcast-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp:l3vpn:mcast">
406              <l3vpn-mcast-route>
407                  <path-id>0</path-id>
408                  <route-key>mAXdcQABrBAALABlKgILgAAAAAE=</route-key>
409                  <route-distinguisher>172.16.0.44:101</route-distinguisher>
410                  <prefix>10.2.34.0/24</prefix>
411                  <attributes>
412                      <local-pref>
413                          <pref>100</pref>
414                      </local-pref>
415                      <extended-communities>
416                          <transitive>true</transitive>
417                          <vrf-route-import-extended-community>
418                              <inet4-specific-extended-community-common>
419                                  <global-administrator>10.0.0.1</global-administrator>
420                                  <local-administrator>123=</local-administrator>
421                              </inet4-specific-extended-community-common>
422                          </vrf-route-import-extended-community>
423                      </extended-communities>
424                      <ipv4-next-hop>
425                          <global>127.16.0.44</global>
426                      </ipv4-next-hop>
427                      <origin>
428                          <value>igp</value>
429                      </origin>
430                      <as-path></as-path>
431                  </attributes>
432              </l3vpn-mcast-route>
433          </l3vpn-mcast-routes>
434
435    .. tab:: JSON
436
437       **Response Body:**
438
439       .. code-block:: json
440
441          {
442              "bgp:l3vpn:mcast:l3vpn-mcast-routes": {
443                  "l3vpn-mcast-route": {
444                      "route-key": "mAXdcQABrBAALABlKgILgAAAAAE=",
445                      "path-id": 0,
446                      "attributes": {
447                          "extended-communities": {
448                              "transitive": true,
449                              "vrf-route-import-extended-community": {
450                                  "inet4-specific-extended-community-common": {
451                                      "global-administrator": "10.0.0.1",
452                                      "local-administrator": "123="
453                                  }
454                              }
455                          },
456                          "origin": {
457                              "value": "igp"
458                          },
459                          "local-pref": {
460                              "pref": 100
461                          },
462                          "ipv4-next-hop": {
463                              "global": "127.16.0.44"
464                          }
465                      },
466                      "route-distinguisher": "172.16.0.44:101",
467                      "prefix":"10.2.34.0/24"
468                  }
469              }
470          }
471
472 IPv6 L3VPN Multicast
473 ''''''''''''''''''''
474 The IPv4 L3VPN Multicast table in an instance of the speaker's Loc-RIB can be verified via REST:
475
476 **URL:** ``/rests/data/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?content=nonconfig``
477
478 **Method:** ``GET``
479
480 .. tabs::
481
482    .. tab:: XML
483
484       **Response Body:**
485
486       .. code-block:: xml
487
488          <l3vpn-mcast-routes xmlns="urn:opendaylight:params:xml:ns:yang:bgp:l3vpn:mcast">
489              <l3vpn-mcast-route>
490                  <path-id>0</path-id>
491                  <route-key>mAXdcQABrBAALABlKgILgAAAAAE=</route-key>
492                  <route-distinguisher>172.16.0.44:101</route-distinguisher>
493                  <prefix>2a02:b80:0:1::/64</prefix>
494                  <attributes>
495                      <local-pref>
496                          <pref>100</pref>
497                      </local-pref>
498                      <extended-communities>
499                          <transitive>true</transitive>
500                          <vrf-route-import-extended-community>
501                              <inet4-specific-extended-community-common>
502                                  <global-administrator>10.0.0.1</global-administrator>
503                                  <local-administrator>123=</local-administrator>
504                              </inet4-specific-extended-community-common>
505                          </vrf-route-import-extended-community>
506                      </extended-communities>
507                      <ipv6-next-hop>
508                          <global>2a02:b80:0:2::1</global>
509                      </ipv6-next-hop>
510                      <origin>
511                          <value>igp</value>
512                      </origin>
513                      <as-path></as-path>
514                  </attributes>
515              </l3vpn-mcast-route>
516          </l3vpn-mcast-routes>
517
518    .. tab:: JSON
519
520       **Response Body:**
521
522       .. code-block:: json
523
524          {
525              "bgp:l3vpn:mcast:l3vpn-mcast-routes": {
526                  "l3vpn-mcast-route": {
527                      "route-key": "mAXdcQABrBAALABlKgILgAAAAAE=",
528                      "path-id": 0,
529                      "attributes": {
530                          "extended-communities": {
531                              "transitive": true,
532                              "vrf-route-import-extended-community": {
533                                  "inet4-specific-extended-community-common": {
534                                      "global-administrator": "10.0.0.1",
535                                      "local-administrator": "123="
536                                  }
537                              }
538                          },
539                          "origin": {
540                              "value": "igp"
541                          },
542                          "local-pref": {
543                              "pref": 100
544                          },
545                          "ipv6-next-hop": {
546                              "global": "2a02:b80:0:2::1"
547                          }
548                      },
549                      "route-distinguisher": "172.16.0.44:101",
550                      "prefix":"2a02:b80:0:1::/64"
551                  }
552              }
553          }
554
555 Programming
556 ^^^^^^^^^^^
557 This examples show how to originate and remove IPv4 L3VPN Unicast route via programmable RIB.
558 Make sure the *Application Peer* is configured first.
559
560 **URL:** ``/rests/data/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``
561
562 **Method:** ``POST``
563
564 .. tabs::
565
566    .. tab:: XML
567
568       **Content-Type:** ``application/xml``
569
570       **Request Body:**
571
572       .. code-block:: xml
573
574          <vpn-route xmlns="urn:opendaylight:params:xml:ns:yang:bgp-vpn-ipv4">
575              <path-id>0</path-id>
576              <route-key>vpn1</route-key>
577              <label-stack>
578                  <label-value>123</label-value>
579              </label-stack>
580              <route-distinguisher>429496729:1</route-distinguisher>
581              <prefix>2.2.2.2/32</prefix>
582              <attributes>
583                  <ipv4-next-hop>
584                      <global>199.20.166.41</global>
585                  </ipv4-next-hop>
586                  <as-path/>
587                  <origin>
588                      <value>igp</value>
589                  </origin>
590                  <extended-communities>
591                      <route-target-extended-community>
592                          <global-administrator>65000</global-administrator>
593                          <local-administrator>AAAAZQ==</local-administrator>
594                      </route-target-extended-community>
595                      <transitive>true</transitive>
596                  </extended-communities>
597              </attributes>
598          </vpn-route>
599
600    .. tab:: JSON
601
602       **Content-Type:** ``application/json``
603
604       **Request Body:**
605
606       .. code-block:: json
607
608          {
609              "vpn-route": [
610                  {
611                      "route-key": "vpn1",
612                      "path-id": 0,
613                      "label-stack": [
614                          {
615                              "label-value": 123
616                          }
617                      ],
618                      "route-distinguisher": "429496729:1",
619                      "attributes": {
620                          "extended-communities": [
621                              {
622                                  "transitive": true,
623                                  "route-target-extended-community": {
624                                      "global-administrator": 65000,
625                                      "local-administrator": "AAAAZQ=="
626                                  }
627                              }
628                          ],
629                          "ipv4-next-hop": {
630                              "global": "199.20.166.41"
631                          },
632                          "origin": {
633                              "value": "igp"
634                          }
635                      },
636                      "prefix": "2.2.2.2/32"
637                  }
638              ]
639          }
640
641 -----
642
643 To remove the route added above, following request can be used:
644
645 **URL:** ``/rests/data/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``
646
647 **Method:** ``DELETE``
648
649 References
650 ^^^^^^^^^^
651 * `BGP/MPLS IP Virtual Private Networks (VPNs) <https://tools.ietf.org/html/rfc4364>`_
652 * `BGP-MPLS IP Virtual Private Network (VPN) Extension for IPv6 VPN <https://tools.ietf.org/html/rfc4659>`_
653 * `BGP/MPLS VPN Virtual PE <https://tools.ietf.org/html/draft-ietf-bess-virtual-pe-00>`_