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