Add and run some linters via tox and pre-commit
[bgpcep.git] / docs / bgp / bgp-user-guide-rib-config-policies.rst
1 .. _bgp-user-guide-rib-config-policies:
2
3 RIB Policy Configuration
4 ========================
5
6 The OpenDaylight BGP implementation supports configurable RIB policies that allow the modification of import and export policies.
7
8 .. note:: Default ODL BGP RIB Config Policy is provided. Any config policy to be used by Protocol must be configured and present before than Protocol configuration is added. If policy is reconfigured, protocol must be re configured again.
9
10 **URL:** ``/restconf/config/openconfig-routing-policy:routing-policy``
11
12 **RFC8040 URL:** ``/rests/data/openconfig-routing-policy:routing-policy?content=config``
13
14 **Method:** ``GET``
15
16 .. tabs::
17
18    .. tab:: XML
19
20       **Content-Type:** ``application/xml``
21
22       **Request Body:**
23
24       .. code-block:: xml
25          :linenos:
26          :emphasize-lines: 2,15
27
28          <routing-policy xmlns="http://openconfig.net/yang/routing-policy">
29              <defined-sets>
30                  <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
31                      <cluster-id-sets xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
32                          ...
33                      </cluster-id-sets>
34                      <role-sets xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
35                          ...
36                      </role-sets>
37                      <originator-id-sets xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
38                          ...
39                      </originator-id-sets>
40                  </bgp-defined-sets>
41              </defined-sets>
42              <policy-definitions>
43                  <policy-definition>
44                      <name>default-odl-export-policy</name>
45                      <statements>
46                          <statement>
47                              <name>to-odl-internal</name>
48                              <actions>
49                                  <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
50                                      ...
51                                  </bgp-actions>
52                              </actions>
53                              <conditions>
54                                  <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
55                                      ...
56                                  </bgp-conditions>
57                              </conditions>
58                          </statement>
59                          ...
60                      </statements>
61                  </policy-definition>
62                  <policy-definition>
63                      <name>default-odl-import-policy</name>
64                      ...
65                  </policy-definition>
66              </policy-definitions>
67          </routing-policy>
68
69       @line 2: BGP defined sets.
70
71       @line 15: Policy definitions.
72
73    .. tab:: JSON
74
75       **Content-Type:** ``application/json``
76
77       **Request Body:**
78
79       .. code-block:: json
80          :linenos:
81          :emphasize-lines: 3,10
82
83          {
84              "routing-policy": {
85                  "defined-sets": {
86                      "bgp-defined-sets": {
87                          "cluster-id-sets": "...",
88                          "role-sets": "...",
89                          "originator-id-sets": "..."
90                      }
91                  },
92                  "policy-definitions": {
93                      "policy-definition": [
94                          {
95                              "name": "default-odl-export-policy",
96                              "statements": {
97                                  "statement": {
98                                      "name": "to-odl-internal",
99                                      "actions": {
100                                          "bgp-actions": "..."
101                                      },
102                                      "conditions": {
103                                          "bgp-conditions": "..."
104                                      }
105                                  },
106                                  "#text": "..."
107                              }
108                          },
109                          {
110                              "name": "default-odl-import-policy",
111                              "#text": "..."
112                          }
113                      ]
114                  }
115              }
116          }
117
118       @line 3: BGP defined sets.
119
120       @line 10: Policy definitions.
121
122
123 Policy Configuration
124 --------------------
125
126 Conditions may include multiple match or comparison operations; similarly, actions may consist of a multitude of changes to route attributes or a final disposition regarding the acceptance or rejection of the route.
127
128 **URL:** ``/restconf/config/openconfig-routing-policy:routing-policy/openconfig-routing-policy:policy-definitions/``
129
130 **RFC8040 URL:** ``/rests/data/openconfig-routing-policy:routing-policy/openconfig-routing-policy:policy-definitions``
131
132 **Method:** ``POST``
133
134 .. tabs::
135
136    .. tab:: XML
137
138       **Content-Type:** ``application/xml``
139
140       **Request Body:**
141
142       .. code-block:: xml
143          :linenos:
144          :emphasize-lines: 2,5,7,10
145
146          <policy-definition xmlns="http://openconfig.net/yang/routing-policy">
147              <name>odl-policy-example</name>
148              <statements>
149                  <statement>
150                      <name>reject-all-incoming-routes</name>
151                      <actions>
152                          <reject-route/>
153                      </actions>
154                      <conditions>
155                          <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
156                              <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
157                                  <from-role>
158                                     <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
159                                  </from-role>
160                              </match-role-set>
161                          </bgp-conditions>
162                      </conditions>
163                  </statement>
164              </statements>
165          </policy-definition>
166
167       @line 2: The unique policy instance identifier.
168
169       @line 5: Policy Statement Identifier.
170
171       @line 7: Actions.
172
173       @line 10: BGP Conditions.
174
175    .. tab:: JSON
176
177       **Content-Type:** ``application/json``
178
179       **Request Body:**
180
181       .. code-block:: json
182          :linenos:
183          :emphasize-lines: 4,8,10,15
184
185          {
186              "policy-definition": [
187                  {
188                      "name": "odl-policy-example",
189                      "statements": {
190                          "statement": [
191                              {
192                                  "name": "reject-all-incoming-routes",
193                                  "actions": {
194                                      "reject-route": [
195                                          null
196                                      ]
197                                  },
198                                  "conditions": {
199                                      "openconfig-bgp-policy:bgp-conditions": {
200                                          "odl-bgp-policy:match-role-set": {
201                                              "from-role": {
202                                                  "role-set": "/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name=\"all\"]"
203                                              }
204                                          }
205                                      }
206                                  }
207                              }
208                          ]
209                      }
210                  }
211              ]
212          }
213
214       @line 4: The unique policy instance identifier.
215
216       @line 8: Policy Statement Identifier.
217
218       @line 10: Actions.
219
220       @line 15: BGP Conditions.
221
222 -----
223
224 The new instance presence can be verified via REST:
225
226 **URL:** ``/restconf/config/openconfig-routing-policy:routing-policy/openconfig-routing-policy:policy-definitions/policy-definition/odl-policy-example``
227
228 **RFC8040 URL:** ``/rests/data/openconfig-routing-policy:routing-policy/openconfig-routing-policy:policy-definitions/policy-definition=odl-policy-example``
229
230 **Method:** ``GET``
231
232 .. tabs::
233
234    .. tab:: XML
235
236       **Response Body:**
237
238       .. code-block:: xml
239          :linenos:
240          :emphasize-lines: 2,5
241
242          <policy-definition xmlns="http://openconfig.net/yang/routing-policy">
243              <name>odl-policy-example</name>
244              <statements>
245                  <statement>
246                      <name>reject-all-incoming-routes</name>
247                      <actions>
248                          <reject-route></reject-route>
249                      </actions>
250                      <conditions>
251                          <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
252                              <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
253                                  <from-role>
254                                      <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
255                                      <match-set-options>ANY</match-set-options>
256                                  </from-role>
257                              </match-role-set>
258                          </bgp-conditions>
259                      </conditions>
260                  </statement>
261              </statements>
262          </policy-definition>
263
264       @line 2: Policy definition Identifier.
265
266       @line 5: Policy Statement Identifier.
267
268    .. tab:: JSON
269
270       **Response Body:**
271
272       .. code-block:: json
273          :linenos:
274          :emphasize-lines: 4,8
275
276          {
277              "policy-definition": [
278                  {
279                      "name": "odl-policy-example",
280                      "statements": {
281                          "statement": [
282                              {
283                                  "name": "reject-all-incoming-routes",
284                                  "actions": {
285                                      "reject-route": [
286                                          null
287                                      ]
288                                  },
289                                  "conditions": {
290                                      "openconfig-bgp-policy:bgp-conditions": {
291                                          "odl-bgp-policy:match-role-set": {
292                                              "from-role": {
293                                                  "role-set": "/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name=\"all\"]"
294                                              }
295                                          }
296                                      }
297                                  }
298                              }
299                          ]
300                      }
301                  }
302              ]
303          }
304
305       @line 4: Policy definition Identifier.
306
307       @line 8: Policy Statement Identifier.
308
309 Actions
310 ```````
311 ODL BGP by default provides support for a group of BGP Actions.
312
313 Accept
314 ''''''
315 Default policy to accept the route.
316
317 .. tabs::
318
319    .. tab:: XML
320
321       .. code-block:: xml
322          :linenos:
323          :emphasize-lines: 2
324
325          <actions>
326              <accept-route/>
327          </actions>
328
329    .. tab:: JSON
330
331       .. code-block:: json
332          :linenos:
333          :emphasize-lines: 2
334
335          {
336              "actions": {
337                  "accept-route": {
338                  }
339              }
340          }
341
342 Reject
343 ''''''
344 Default policy to reject the route.
345
346 .. tabs::
347
348    .. tab:: XML
349
350       .. code-block:: xml
351          :linenos:
352          :emphasize-lines: 2
353
354          <actions>
355             <reject-route/>
356          </actions>
357
358    .. tab:: JSON
359
360       .. code-block:: json
361          :linenos:
362          :emphasize-lines: 2
363
364          {
365              "actions": {
366                  "reject-route" : {
367                  }
368              }
369          }
370
371 As-path prepend
372 '''''''''''''''
373 Action to prepend local AS number to the AS-path
374
375 .. tabs::
376
377    .. tab:: XML
378
379       .. code-block:: xml
380          :linenos:
381          :emphasize-lines: 3
382
383          <actions>
384             <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
385                 <set-as-path-prepend/>
386             </bgp-actions>
387          </actions>
388
389    .. tab:: JSON
390
391       .. code-block:: json
392          :linenos:
393          :emphasize-lines: 2
394
395          {
396              "actions": {
397                  "bgp-actions" : {
398                      "set-as-path-prepend": {
399                      }
400                  }
401              }
402          }
403
404 Originator Id prepend
405 '''''''''''''''''''''''''
406 Action to prepend Originator Id. In case there is non Originator Id present, local Originator Id is prepend.
407
408 * Local
409
410 .. tabs::
411
412    .. tab:: XML
413
414       .. code-block:: xml
415          :linenos:
416          :emphasize-lines: 2
417
418          <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
419             <set-originator-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
420          </bgp-actions>
421
422    .. tab:: JSON
423
424       .. code-block:: json
425          :linenos:
426          :emphasize-lines: 2
427
428          {
429              "bgp-actions" : {
430                  "set-originator-id-prepend": {
431                  }
432              }
433          }
434
435 * By value
436
437 .. tabs::
438
439    .. tab:: XML
440
441       .. code-block:: xml
442          :linenos:
443          :emphasize-lines: 2
444
445          <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
446              <set-originator-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
447                  <originator-id>192.0.2.1</originator-id>
448              </set-originator-id-prepend>
449          </bgp-actions>
450
451    .. tab:: JSON
452
453       .. code-block:: json
454          :linenos:
455          :emphasize-lines: 2
456
457          {
458              "bgp-actions" : {
459                  "set-originator-id-prepend": {
460                      "originator-id": "192.0.2.1"
461                  }
462              }
463          }
464
465 Cluster Id prepend
466 ''''''''''''''''''
467 Action to prepend local Cluster Id to Cluster Id List.
468
469 .. tabs::
470
471    .. tab:: XML
472
473       .. code-block:: xml
474          :linenos:
475          :emphasize-lines: 3
476
477          <actions>
478              <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
479                  <set-cluster-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
480              </bgp-actions>
481          </actions>
482
483    .. tab:: JSON
484
485       .. code-block:: json
486          :linenos:
487          :emphasize-lines: 3
488
489          {
490              "actions": {
491                  "bgp-actions" : {
492                      "set-cluster-id-prepend": {
493                      }
494                  }
495              }
496          }
497
498 Set Route Origin
499 ''''''''''''''''
500 Set the origin attribute to the specified value.
501
502 .. tabs::
503
504    .. tab:: XML
505
506       .. code-block:: xml
507          :linenos:
508          :emphasize-lines: 3
509
510          <actions>
511              <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
512                  <set-route-origin>IGP</set-route-origin>
513              </bgp-actions>
514          </actions>
515
516    .. tab:: JSON
517
518       .. code-block:: json
519          :linenos:
520          :emphasize-lines: 3
521
522          {
523              "actions": {
524                  "bgp-actions" : {
525                      "set-route-origin": "IGP"
526                  }
527              }
528          }
529
530 Set Local Preference
531 ''''''''''''''''''''
532 Set the local pref attribute on the route update.
533
534 .. tabs::
535
536    .. tab:: XML
537
538       .. code-block:: xml
539          :linenos:
540          :emphasize-lines: 3
541
542          <actions>
543              <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
544                  <set-local-pref>100</set-local-pref>
545              </bgp-actions>
546          </actions>
547
548    .. tab:: JSON
549
550       .. code-block:: json
551          :linenos:
552          :emphasize-lines: 3
553
554          {
555              "actions": {
556                  "bgp-actions" : {
557                      "set-local-pref": 100
558                  }
559              }
560          }
561
562 Set NextHop
563 '''''''''''
564 Set the next-hop attribute in the route update.
565
566 * Local
567
568 .. tabs::
569
570    .. tab:: XML
571
572       .. code-block:: xml
573          :linenos:
574          :emphasize-lines: 3
575
576          <actions>
577              <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
578                  <set-next-hop>SELF</set-next-hop>
579              </bgp-actions>
580          </actions>
581
582    .. tab:: JSON
583
584       .. code-block:: json
585          :linenos:
586          :emphasize-lines: 3
587
588          {
589              "actions": {
590                  "bgp-actions" : {
591                      "set-next-hop": "SELF"
592                  }
593              }
594          }
595
596 * By value
597
598 .. tabs::
599
600    .. tab:: XML
601
602       .. code-block:: xml
603          :linenos:
604          :emphasize-lines: 3
605
606          <actions>
607              <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
608                  <set-next-hop>4.5.6.7</set-next-hop>
609              </bgp-actions>
610          </actions>
611
612    .. tab:: JSON
613
614       .. code-block:: json
615          :linenos:
616          :emphasize-lines: 3
617
618          {
619              "actions": {
620                  "bgp-actions" : {
621                      "set-next-hop": "4.5.6.7"
622                  }
623              }
624          }
625
626 Set MED
627 '''''''
628 Set the med metric attribute in the route update.
629
630 .. tabs::
631
632    .. tab:: XML
633
634       .. code-block:: xml
635          :linenos:
636          :emphasize-lines: 3
637
638          <actions>
639              <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
640                  <set-med>15</set-med>
641              </bgp-actions>
642          </actions>
643
644    .. tab:: JSON
645
646       .. code-block:: json
647          :linenos:
648          :emphasize-lines: 3
649
650          {
651              "actions": {
652                  "bgp-actions" : {
653                      "set-med": 15
654                  }
655              }
656          }
657
658 Community set prepend
659 '''''''''''''''''''''
660 Action to set the community attributes of the route, along with options to modify how the community is modified.
661
662 * Inline
663
664 .. tabs::
665
666    .. tab:: XML
667
668       .. code-block:: xml
669          :linenos:
670          :emphasize-lines: 3
671
672          <actions>
673              <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
674                  <set-community>
675                      <communities>
676                          <as-number>65</as-number>
677                          <semantics>10</semantics>
678                      </communities>
679                      <communities>
680                          <as-number>66</as-number>
681                          <semantics>11</semantics>
682                      </communities>
683                      <options>ADD</options>
684                  </set-community>
685              </bgp-actions>
686          </actions>
687
688       @line 3: Set Community.
689
690    .. tab:: JSON
691
692       .. code-block:: json
693          :linenos:
694          :emphasize-lines: 4
695
696          {
697              "actions": {
698                  "bgp-actions" : {
699                      "set-community": {
700                          "communities": [
701                              {
702                                  "as-number": 65,
703                                  "semantics": 10
704                              },
705                              {
706                                  "as-number": 66,
707                                  "semantics": 11
708                              }
709                          ],
710                          "options": "ADD"
711                      }
712                  }
713              }
714          }
715
716       @line 4: Set Community.
717
718 * By reference
719
720 .. tabs::
721
722    .. tab:: XML
723
724       .. code-block:: xml
725          :linenos:
726          :emphasize-lines: 3,5,7
727
728          <actions>
729              <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
730                  <set-community>
731                      <community-set-ref>
732                          /rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name="community-set-name-example"]
733                      </community-set-ref>
734                      <options>ADD</options>
735                  </set-community>
736              </bgp-actions>
737          </actions>
738
739       @line 3: Set Community.
740
741       @line 5: Community set reference.
742
743       @line 7: Options are ADD, REMOVE, REPLACE.
744
745    .. tab:: JSON
746
747       .. code-block:: json
748          :linenos:
749          :emphasize-lines: 4,5,6
750
751          {
752              "actions": {
753                  "bgp-actions" : {
754                      "set-community": {
755                         "community-set-ref": "/rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name=\"community-set-name-example\"]",
756                          "options": "ADD"
757                      }
758                  }
759              }
760          }
761
762       @line 4: Set Community.
763
764       @line 5: Community set reference.
765
766       @line 6: Options are ADD, REMOVE, REPLACE.
767
768 -----
769
770 Defined set
771
772 .. tabs::
773
774    .. tab:: XML
775
776       .. code-block:: xml
777          :linenos:
778          :emphasize-lines: 3
779
780          <defined-sets>
781              <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
782                  <community-sets>
783                      <community-set>
784                          <community-set-name>community-set-name-test</community-set-name>
785                          <communities>
786                              <as-number>65</as-number>
787                              <semantics>10</semantics>
788                          </communities>
789                          <communities>
790                              <as-number>66</as-number>
791                              <semantics>11</semantics>
792                          </communities>
793                      </community-set>
794                  </community-sets>
795              </bgp-defined-sets>
796          </defined-sets>
797
798       @line 3: Community set.
799
800    .. tab:: JSON
801
802       .. code-block:: json
803          :linenos:
804          :emphasize-lines: 4
805
806          {
807              "defined-sets": {
808                  "bgp-defined-sets" : {
809                      "community-sets": {
810                          "community-set": {
811                              "community-set-name": "community-set-name-test",
812                              "communities": [
813                                  {
814                                      "as-number": 65,
815                                      "semantics": 10
816                                  },
817                                  {
818                                      "as-number": 66,
819                                      "semantics": 11
820                                  }
821                              ]
822                          }
823                      }
824                  }
825              }
826          }
827
828       @line 4: Set Community.
829
830 Extended Community set action
831 ''''''''''''''''''''''''''''''
832 Action to set the extended community attributes of the route, along with options to modify how the community is modified.
833
834 * Inline
835
836 .. tabs::
837
838    .. tab:: XML
839
840       .. code-block:: xml
841          :linenos:
842          :emphasize-lines: 3
843
844          <actions>
845              <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
846                  <set-ext-community>
847                      <ext-community-member>
848                          <encapsulation-extended-community>
849                              <tunnel-type>vxlan</tunnel-type>
850                          </encapsulation-extended-community>
851                      </ext-community-member>
852                      <ext-community-member>
853                          <as-4-route-origin-extended-community>
854                              <as-4-specific-common>
855                                  <as-number>65000</as-number>
856                                  <local-administrator>123</local-administrator>
857                              </as-4-specific-common>
858                          </as-4-route-origin-extended-community>
859                      </ext-community-member>
860                      <options>ADD</options>
861                  </set-ext-community>
862              </bgp-actions>
863          </actions>
864
865       @line 3: Set Extended Community.
866
867    .. tab:: JSON
868
869       .. code-block:: json
870          :linenos:
871          :emphasize-lines: 4
872
873          {
874              "actions": {
875                  "bgp-actions": {
876                      "set-ext-community": {
877                          "ext-community-member": [
878                              {
879                                  "encapsulation-extended-community": {
880                                      "tunnel-type": "vxlan"
881                                  }
882                              },
883                              {
884                                  "as-4-route-origin-extended-community": {
885                                      "as-4-specific-common": {
886                                          "as-number": "65000",
887                                          "local-administrator": "123"
888                                      }
889                                  }
890                              }
891                          ],
892                          "options": "ADD"
893                      }
894                  }
895              }
896          }
897
898       @line 4: Set Extended Community.
899
900 * By reference
901
902 .. tabs::
903
904    .. tab:: XML
905
906       .. code-block:: xml
907          :linenos:
908          :emphasize-lines: 3,5,7
909
910          <actions>
911              <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
912                  <set-ext-community>
913                      <ext-community-set-ref>
914                          /rpol:routing-policy/rpol:defined-sets/rpol:ext-community-sets/ext-community-set[ext-community-set-name="ext-community-set-name-example"]
915                      </ext-community-set-ref>
916                      <options>REMOVE</options>
917                  </set-ext-community>
918              </bgp-actions>
919          </actions>
920
921       @line 3: Set Extended Community.
922
923       @line 5: Extended Community set reference.
924
925       @line 7: Options are ADD, REMOVE, REPLACE.
926
927    .. tab:: JSON
928
929       .. code-block:: json
930          :linenos:
931          :emphasize-lines: 4,5,6
932
933          {
934              "actions": {
935                  "bgp-actions" : {
936                      "set-ext-community": {
937                         "ext-community-set-ref": "/rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name=\"community-set-name-example\"]",
938                          "options": "REMOVE"
939                      }
940                  }
941              }
942          }
943
944       @line 4: Set Extended Community.
945
946       @line 5: Extended Community set reference.
947
948       @line 6: Options are ADD, REMOVE, REPLACE.
949
950 -----
951
952 Defined set
953
954 .. tabs::
955
956    .. tab:: XML
957
958       .. code-block:: xml
959          :linenos:
960          :emphasize-lines: 3,5
961
962          <defined-sets>
963              <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
964                  <ext-community-sets>
965                      <ext-community-set>
966                          <ext-community-set-name>ext-community-set-name-test</ext-community-set-name>
967                          <ext-community-member>
968                              <encapsulation-extended-community>
969                                  <tunnel-type>vxlan</tunnel-type>
970                              </encapsulation-extended-community>
971                          </ext-community-member>
972                          <ext-community-member>
973                              <as-4-route-origin-extended-community>
974                                  <as-4-specific-common>
975                                      <as-number>65000</as-number>
976                                      <local-administrator>123</local-administrator>
977                                  </as-4-specific-common>
978                              </as-4-route-origin-extended-community>
979                          </ext-community-member>
980                      </ext-community-set>
981                  </ext-community-sets>
982              </bgp-defined-sets>
983          </defined-sets>
984
985       @line 3: Extendend Community set.
986
987       @line 5: Extendend Community set name.
988
989    .. tab:: JSON
990
991       .. code-block:: json
992          :linenos:
993          :emphasize-lines: 4,5
994
995          {
996              "defined-sets": {
997                  "bgp-defined-sets" : {
998                      "ext-community-sets": {
999                          "ext-community-set": {
1000                              "ext-community-set-name": "ext-community-set-name-test",
1001                              "ext-community-member": [
1002                                  {
1003                                      "encapsulation-extended-community": {
1004                                          "tunnel-type": "vxlan"
1005                                      },
1006                                      "as-4-route-origin-extended-community": {
1007                                          "as-4-specific-common": {
1008                                              "as-number": 65000,
1009                                              "local-administrator": 123
1010                                          }
1011                                      }
1012                                  }
1013                              ]
1014                          }
1015                      }
1016                  }
1017              }
1018          }
1019
1020       @line 4: Extendend Community set.
1021
1022       @line 5: Extendend Community set name.
1023
1024 Filter Non transitive attributes
1025 ''''''''''''''''''''''''''''''''
1026 Filters attributes, removing non transitive attributes.
1027
1028 .. tabs::
1029
1030    .. tab:: XML
1031
1032       .. code-block:: xml
1033          :linenos:
1034          :emphasize-lines: 3
1035
1036          <actions>
1037              <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
1038                  <non-transitive-attributes-filter xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
1039              </bgp-actions>
1040          </actions>
1041
1042    .. tab:: JSON
1043
1044       .. code-block:: json
1045          :linenos:
1046          :emphasize-lines: 4
1047
1048          {
1049              "actions": {
1050                  "bgp-actions" : {
1051                      "non-transitive-attributes-filter": {
1052                      }
1053                  }
1054              }
1055          }
1056
1057 Client Attribute Prepend
1058 ''''''''''''''''''''''''
1059 Replace attributes per any VPN Route attributes from client Peer, if present.
1060
1061 .. tabs::
1062
1063    .. tab:: XML
1064
1065       .. code-block:: xml
1066          :linenos:
1067          :emphasize-lines: 3
1068
1069          <actions>
1070              <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
1071                  <client-attribute-prepend xmlns="urn:opendaylight:params:xml:ns:yang:bgp:route:target:constrain"/>
1072              </bgp-actions>
1073          </actions>
1074
1075    .. tab:: JSON
1076
1077       .. code-block:: json
1078          :linenos:
1079          :emphasize-lines: 4
1080
1081          {
1082              "actions": {
1083                  "bgp-actions" : {
1084                      "client-attribute-prepend": {
1085                      }
1086                  }
1087              }
1088          }
1089
1090 Conditions
1091 ``````````
1092 ODL BGP by default provides support for a group of BGP Conditions.
1093
1094 Match BGP Neighbor Set
1095 ''''''''''''''''''''''
1096
1097 .. tabs::
1098
1099    .. tab:: XML
1100
1101       .. code-block:: xml
1102          :linenos:
1103          :emphasize-lines: 3,4,5,6
1104
1105          <conditions>
1106              <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
1107                  <match-bgp-neighbor-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
1108                      <from-neighbor>
1109                          <neighbor-set>/rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="bgp-neighbor-set-example"]</neighbor-set>
1110                          <match-set-options>INVERT</match-set-options>
1111                      </from-neighbor>
1112                  </match-bgp-neighbor-set>
1113              </bgp-conditions>
1114          </conditions>
1115
1116       @line 3: Match BGP Neighbor Condition set.
1117
1118       @line 4: Match BGP Neighbor from whom we receive the route.
1119
1120       @line 5: Match BGP Neighbor Set reference.
1121
1122       @line 6: Match Set Options (ANY, INVERT)
1123
1124    .. tab:: JSON
1125
1126       .. code-block:: json
1127          :linenos:
1128          :emphasize-lines: 4,5,6,7
1129
1130          {
1131              "conditions": {
1132                  "bgp-conditions" : {
1133                      "match-bgp-neighbor-set": {
1134                          "from-neighbor": {
1135                              "neighbor-set": "/rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name=\"bgp-neighbor-set-example\"]",
1136                              "match-set-options": "INVERT"
1137                          }
1138                      }
1139                  }
1140              }
1141          }
1142
1143       @line 4: Match BGP Neighbor Condition set.
1144
1145       @line 5: Match BGP Neighbor from whom we receive the route.
1146
1147       @line 6: Match BGP Neighbor Set reference.
1148
1149       @line 7: Match Set Options (ANY, INVERT)
1150
1151 .. tabs::
1152
1153    .. tab:: XML
1154
1155       .. code-block:: xml
1156          :linenos:
1157          :emphasize-lines: 3,4,5,6
1158
1159          <conditions>
1160              <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
1161                  <match-bgp-neighbor-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
1162                      <to-neighbor>
1163                          <neighbor-set>/rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="bgp-neighbor-set-example"]</neighbor-set>
1164                          <match-set-options>INVERT</match-set-options>
1165                      </to-neighbor>
1166                  </match-bgp-neighbor-set>
1167              </bgp-conditions>
1168          </conditions>
1169
1170      @line 3: Match BGP Neighbor Condition set.
1171
1172      @line 4: Match BGP Neighbor to whom we send the route.
1173
1174      @line 5: Match BGP Neighbor Set reference.
1175
1176      @line 6: Match Set Options (ANY, INVERT)
1177
1178    .. tab:: JSON
1179
1180       .. code-block:: json
1181          :linenos:
1182          :emphasize-lines: 4,5,6,7
1183
1184          {
1185              "conditions": {
1186                  "bgp-conditions" : {
1187                      "match-bgp-neighbor-set": {
1188                          "to-neighbor": {
1189                              "neighbor-set": "/rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name=\"bgp-neighbor-set-example\"]",
1190                              "match-set-options": "INVERT"
1191                          }
1192                      }
1193                  }
1194              }
1195          }
1196
1197       @line 4: Match BGP Neighbor Condition set.
1198
1199       @line 5: Match BGP Neighbor to whom we receive the route.
1200
1201       @line 6: Match BGP Neighbor Set reference.
1202
1203       @line 7: Match Set Options (ANY, INVERT)
1204
1205 .. tabs::
1206
1207    .. tab:: XML
1208
1209       .. code-block:: xml
1210          :linenos:
1211          :emphasize-lines: 3,4,5,7,8,9
1212
1213          <conditions>
1214              <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
1215                  <match-bgp-neighbor-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
1216                      <from-neighbor>
1217                          <neighbor-set>/rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="bgp-neighbor-set-example"]</neighbor-set>
1218                      </from-neighbor>
1219                      <to-neighbor>
1220                          <neighbor-set>/rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="bgp-neighbor-set-example"]</neighbor-set>
1221                          <match-set-options>INVERT</match-set-options>
1222                      </to-neighbor>
1223                  </match-bgp-neighbor-set>
1224              </bgp-conditions>
1225          </conditions>
1226
1227       @line 3: Match BGP Neighbor Condition set.
1228
1229       @line 4: Match BGP Neighbor from whom we receive the route.
1230
1231       @line 5: Match BGP Neighbor Set reference.
1232
1233       @line 7: Match BGP Neighbor to whom we send the route.
1234
1235       @line 8: Match BGP Neighbor Set reference.
1236
1237       @line 9: Match Set Options (ANY, INVERT)
1238
1239    .. tab:: JSON
1240
1241       .. code-block:: json
1242          :linenos:
1243          :emphasize-lines: 4,5,6,8,9,10
1244
1245          {
1246              "conditions": {
1247                  "bgp-conditions" : {
1248                      "match-bgp-neighbor-set": {
1249                          "from-neighbor": {
1250                              "neighbor-set": "/rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name=\"bgp-neighbor-set-example\"]",
1251                          },
1252                          "to-neighbor": {
1253                              "neighbor-set": "/rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name=\"bgp-neighbor-set-example\"]",
1254                              "match-set-options": "INVERT"
1255                          }
1256                      }
1257                  }
1258              }
1259          }
1260
1261       @line 4: Match BGP Neighbor Condition set.
1262
1263       @line 5: Match BGP Neighbor from whom we receive the route.
1264
1265       @line 6: Match BGP Neighbor Set reference.
1266
1267       @line 8: Match BGP Neighbor to whom we send the route.
1268
1269       @line 9: Match BGP Neighbor Set reference.
1270
1271       @line 10: Match Set Options (ANY, INVERT)
1272
1273 -----
1274
1275 Defined set
1276
1277 .. tabs::
1278
1279    .. tab:: XML
1280
1281       .. code-block:: xml
1282          :linenos:
1283          :emphasize-lines: 3,5
1284
1285          <defined-sets>
1286              <neighbor-sets>
1287                  <neighbor-set>
1288                      <neighbor-set-name>bgp-neighbor-set-example</neighbor-set-name>
1289                      <neighbor>
1290                          <address>127.0.0.1</address>
1291                      </neighbor>
1292                      <neighbor>
1293                          <address>127.0.0.2</address>
1294                      </neighbor>
1295                  </neighbor-set>
1296              </neighbor-sets>
1297          </defined-sets>
1298
1299       @line 3: Originator Id Set.
1300
1301       @line 5: Originator Id Set name.
1302
1303    .. tab:: JSON
1304
1305       .. code-block:: json
1306          :linenos:
1307          :emphasize-lines: 4,5
1308
1309          {
1310              "defined-sets": {
1311                  "neighbor-sets": {
1312                      "neighbor-set": {
1313                          "neighbor-set-name": "bgp-neighbor-set-example",
1314                           "neighbor": [
1315                               {
1316                                   "address": "127.0.0.1"
1317                               },
1318                               {
1319                                   "address": "127.0.0.2"
1320                               }
1321                           ]
1322                      }
1323                  }
1324              }
1325          }
1326
1327       @line 4: Originator Id Set.
1328
1329       @line 5: Originator Id Set name.
1330
1331 Match Originator Id Set
1332 '''''''''''''''''''''''
1333
1334 .. tabs::
1335
1336    .. tab:: XML
1337
1338       .. code-block:: xml
1339          :linenos:
1340          :emphasize-lines: 3,5,7
1341
1342          <conditions>
1343              <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
1344                  <match-originator-id-set-condition xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
1345                      <originator-id-set>
1346                          /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/originator-id-sets/originator-id-set[originator-set-name="local-originator-id"]
1347                      </originator-id-set>
1348                      <match-set-options>INVERT</match-set-options>
1349                  </match-originator-id-set-condition>
1350              </bgp-conditions>
1351          </conditions>
1352
1353       @line 3: Match Originator Id Condition set.
1354
1355       @line 5: Match Originator Id Set reference.
1356
1357       @line 7: Match Set Options (ANY, INVERT)
1358
1359    .. tab:: JSON
1360
1361       .. code-block:: json
1362          :linenos:
1363          :emphasize-lines: 4,5,6
1364
1365          {
1366              "conditions": {
1367                  "bgp-conditions" : {
1368                      "match-originator-id-set-condition": {
1369                          "originator-id-set": "/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/originator-id-sets/originator-id-set[originator-set-name=\"local-originator-id\"]",
1370                          "match-set-options": "INVERT"
1371                      }
1372                  }
1373              }
1374          }
1375
1376       @line 4: Match Originator Id Condition set.
1377
1378       @line 5: Match Originator Id Set reference.
1379
1380       @line 6: Match Set Options (ANY, INVERT)
1381
1382 -----
1383
1384 Defined set
1385
1386 .. tabs::
1387
1388    .. tab:: XML
1389
1390       .. code-block:: xml
1391          :linenos:
1392          :emphasize-lines: 3,5
1393
1394          <defined-sets>
1395              <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
1396                  <originator-id-sets xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
1397                      <originator-id-set>
1398                          <originator-id-set-name>local-originator-id</originator-id-set-name>
1399                          <local/>
1400                      </originator-id-set>
1401                  </originator-id-sets>
1402              </bgp-defined-sets>
1403          </defined-sets>
1404
1405       @line 3: Originator Id Set.
1406
1407       @line 5: Originator Id Set name.
1408
1409    .. tab:: JSON
1410
1411       .. code-block:: json
1412          :linenos:
1413          :emphasize-lines: 4,5
1414
1415          {
1416              "defined-sets": {
1417                  "bgp-defined-sets" : {
1418                      "originator-id-sets": {
1419                          "originator-id-set": {
1420                              "originator-id-set-name": "local-originator-id"
1421                          }
1422                      }
1423                  }
1424              }
1425          }
1426
1427       @line 4: Originator Id Set.
1428
1429       @line 5: Originator Id Set name.
1430
1431 Match Cluster Id Set
1432 ''''''''''''''''''''
1433
1434 .. tabs::
1435
1436    .. tab:: XML
1437
1438       .. code-block:: xml
1439          :linenos:
1440          :emphasize-lines: 3,5
1441
1442          <conditions>
1443              <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
1444                  <match-cluster-id-set-condition xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
1445                      <cluster-id-set>
1446                          /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/cluster-id-sets/cluster-id-set[cluster-set-name="local-cluster-id"]
1447                      </cluster-id-set>
1448                      <match-set-options>INVERT</match-set-options>
1449                  </match-cluster-id-set-condition>
1450              </bgp-conditions>
1451          </conditions>
1452
1453       @line 3: Match Cluster Id Condition set.
1454
1455       @line 5: Match Cluster Id Set reference.
1456
1457    .. tab:: JSON
1458
1459       .. code-block:: json
1460          :linenos:
1461          :emphasize-lines: 4,5
1462
1463          {
1464              "conditions": {
1465                  "bgp-conditions" : {
1466                      "match-cluster-id-set-condition": {
1467                          "cluster-id-set": "/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/cluster-id-sets/cluster-id-set[cluster-set-name=\"local-cluster-id\"]",
1468                          "match-set-options": "INVERT"
1469                      }
1470                  }
1471              }
1472          }
1473
1474       @line 4: Match Cluster Id Condition set.
1475
1476       @line 5: Match Cluster Id Set reference.
1477
1478 -----
1479
1480 Defined set
1481
1482 .. tabs::
1483
1484    .. tab:: XML
1485
1486       .. code-block:: xml
1487          :linenos:
1488          :emphasize-lines: 3,5
1489
1490          <defined-sets>
1491              <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
1492                  <cluster-id-sets xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
1493                      <cluster-id-set>
1494                          <cluster-id-set-name>local-cluster-id</cluster-id-set-name>
1495                          <local/>
1496                      </cluster-id-set>
1497                  </cluster-id-sets>
1498              </bgp-defined-sets>
1499          </defined-sets>
1500
1501       @line 3: Cluster Id Set.
1502
1503       @line 5: Cluster Id Set name.
1504
1505    .. tab:: JSON
1506
1507       .. code-block:: json
1508          :linenos:
1509          :emphasize-lines: 4,5
1510
1511          {
1512              "defined-sets": {
1513                  "bgp-defined-sets" : {
1514                      "cluster-id-sets": {
1515                          "cluster-id-set": {
1516                              "cluster-id-set-name": "local-cluster-id"
1517                          }
1518                      }
1519                  }
1520              }
1521          }
1522
1523       @line 4: Cluster Id Set.
1524
1525       @line 5: Cluster Id Set name.
1526
1527 Match Peer Role Set
1528 '''''''''''''''''''
1529
1530 .. tabs::
1531
1532    .. tab:: XML
1533
1534       .. code-block:: xml
1535          :linenos:
1536          :emphasize-lines: 3,5,6
1537
1538          <conditions>
1539              <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
1540                  <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
1541                      <from-role>
1542                          <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
1543                          <match-set-options>INVERT</match-set-options>
1544                      </from-role>
1545                      <to-role>
1546                          <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
1547                      <to-role>
1548                  </match-role-set>
1549              </bgp-conditions>
1550          </conditions>
1551
1552       @line 3: Match Role Set.
1553
1554       @line 5: Match Role Set reference.
1555
1556       @line 6: Match Set Options (ANY, INVERT)
1557
1558    .. tab:: JSON
1559
1560       .. code-block:: json
1561          :linenos:
1562          :emphasize-lines: 4,6,7
1563
1564          {
1565              "conditions": {
1566                  "bgp-conditions" : {
1567                      "match-role-set": {
1568                          "from-role": {
1569                              "role-set": "/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name=\"only-ibgp\"]"
1570                              "match-set-options": "INVERT"
1571                          },
1572                          "to-role": {
1573                              "role-set": "/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name=\"all\"]"
1574                          }
1575                      }
1576                  }
1577              }
1578          }
1579
1580       @line 4: Match Role Set.
1581
1582       @line 6: Match Role Set reference.
1583
1584       @line 7: Match Set Options (ANY, INVERT)
1585
1586 -----
1587
1588 Defined set
1589
1590 .. tabs::
1591
1592    .. tab:: XML
1593
1594       .. code-block:: xml
1595          :linenos:
1596          :emphasize-lines: 3,4,10,11
1597
1598          <defined-sets>
1599              <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
1600                  <role-set>
1601                      <role-set-name>all</role-set-name>
1602                      <role>ebgp</role>
1603                      <role>ibgp</role>
1604                      <role>rr-client</role>
1605                      <role>internal</role>
1606                  </role-set>
1607                  <role-set>
1608                      <role-set-name>only-ibgp</role-set-name>
1609                      <role>ibgp</role>
1610                  </role-set>
1611              </bgp-defined-sets>
1612          </defined-sets>
1613
1614       @line 3: Role Set.
1615
1616       @line 4: Role Set name.
1617
1618       @line 10: Role Set.
1619
1620       @line 11: Role Id Set name.
1621
1622    .. tab:: JSON
1623
1624       .. code-block:: json
1625          :linenos:
1626          :emphasize-lines: 4,6,14,15
1627
1628          {
1629              "defined-sets": {
1630                  "bgp-defined-sets" : {
1631                      "role-set": [
1632                          {
1633                              "role-set-name": "all",
1634                              "role": [
1635                                  "ebgp",
1636                                  "ibgp",
1637                                  "rr-client",
1638                                  "internal"
1639                              ]
1640                          },
1641                          {
1642                              "role-set-name": "only-ibgp",
1643                              "role": "ibgp"
1644                          }
1645                      ]
1646                  }
1647              }
1648          }
1649
1650       @line 4: Role Set.
1651
1652       @line 6: Role Set name.
1653
1654       @line 14: Role Set.
1655
1656       @line 15: Role Id Set name.
1657
1658 Match AS Path Set
1659 '''''''''''''''''
1660
1661 .. tabs::
1662
1663    .. tab:: XML
1664
1665       .. code-block:: xml
1666          :linenos:
1667          :emphasize-lines: 3,5,7
1668
1669          <conditions>
1670              <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
1671                  <match-as-path-set>
1672                      <as-path-set>
1673                          /rpol:routing-policy/rpol:defined-sets/bgp-pol:bgp-defined-sets/bgp-pol:as-path-sets/bgp-pol:as-path-set/[as-path-set-name="as-path-set-example"]
1674                      </as-path-set>
1675                      <match-set-options>ANY</match-set-options>
1676                  </match-as-path-set>
1677              </bgp-conditions>
1678          </conditions>
1679
1680       @line 3: Match AS Path Set.
1681
1682       @line 5: AS Path Set reference.
1683
1684       @line 7: Match Set Option(ANY, ALL, INVERT).
1685
1686    .. tab:: JSON
1687
1688       .. code-block:: json
1689          :linenos:
1690          :emphasize-lines: 4,6,7
1691
1692          {
1693              "conditions": {
1694                  "bgp-conditions" : {
1695                      "match-as-path-set": {
1696                              "as-path-set": "/rpol:routing-policy/bgp-pol:bgp-defined-sets/bgp-pol:as-path-sets/bgp-pol:as-path-set/[as-path-set-name=\"as-path-set-example\"]"
1697                              "match-set-options": "INVERT"
1698                      }
1699                  }
1700              }
1701          }
1702
1703       @line 4: Match AS Path Set.
1704
1705       @line 6: AS Path Set reference.
1706
1707       @line 7: Match Set Option(ANY, ALL, INVERT).
1708
1709 -----
1710
1711 Defined set
1712
1713 .. tabs::
1714
1715    .. tab:: XML
1716
1717       .. code-block:: xml
1718          :linenos:
1719          :emphasize-lines: 4,5,6
1720
1721          <defined-sets>
1722              <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
1723                  <as-path-sets>
1724                      <as-path-set>
1725                          <as-path-set-name>as-path-set-example</as-path-set-name>
1726                          <as-path-set-member>65</as-path-set-member>
1727                          <as-path-set-member>64</as-path-set-member>
1728                          <as-path-set-member>63</as-path-set-member>
1729                      </as-path-set>
1730                  </as-path-sets>
1731              </bgp-defined-sets>
1732          </defined-sets>
1733
1734       @line 4: AS Path Set.
1735
1736       @line 5: AS Path Set name.
1737
1738       @line 6: AS Path set member
1739
1740    .. tab:: JSON
1741
1742       .. code-block:: json
1743          :linenos:
1744          :emphasize-lines: 4,5,6
1745
1746          {
1747              "defined-sets": {
1748                  "bgp-defined-sets" : {
1749                      "as-path-sets": {
1750                          "as-path-set-name": "as-path-set-example",
1751                          "as-path-set-member": [
1752                               65,
1753                               64,
1754                               63
1755                          ]
1756                      }
1757                  }
1758              }
1759          }
1760
1761       @line 4: AS Path Set.
1762
1763       @line 5: AS Path Set name.
1764
1765       @line 6: AS Path set member
1766
1767 Match Community Set
1768 '''''''''''''''''''
1769
1770 .. tabs::
1771
1772    .. tab:: XML
1773
1774       .. code-block:: xml
1775          :linenos:
1776          :emphasize-lines: 3,5,7
1777
1778          <conditions>
1779              <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
1780                  <match-community-set>
1781                      <community-set>
1782                          /rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name="community-set-name-example"]
1783                      </community-set>
1784                      <match-set-options>ANY</match-set-options>
1785                  </match-community-set>
1786              </bgp-conditions>
1787          </conditions>
1788
1789       @line 3: Match Community Set.
1790
1791       @line 5: Match Community Set reference.
1792
1793       @line 7: Match Set Option(ANY, ALL, INVERT).
1794
1795    .. tab:: JSON
1796
1797       .. code-block:: json
1798          :linenos:
1799          :emphasize-lines: 4,6,7
1800
1801          {
1802              "conditions": {
1803                  "bgp-conditions" : {
1804                      "match-community-set": {
1805                              "community-set": "/rpol:routing-policy/rpol:bgp-defined-sets/rpol:community-sets/community-set[community-set-name=\"community-set-name-example\"]"
1806                              "match-set-options": "ANY"
1807                      }
1808                  }
1809              }
1810          }
1811
1812       @line 4: Match Community Set.
1813
1814       @line 6: Match Community Set reference.
1815
1816       @line 7: Match Set Option(ANY, ALL, INVERT).
1817
1818 -----
1819
1820 Defined set
1821
1822 .. tabs::
1823
1824    .. tab:: XML
1825
1826       .. code-block:: xml
1827          :linenos:
1828          :emphasize-lines: 4,5,6,10
1829
1830          <defined-sets>
1831              <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
1832                  <community-sets>
1833                      <community-set>
1834                          <community-set-name>community-set-name-example</community-set-name>
1835                          <communities>
1836                              <as-number>65</as-number>
1837                              <semantics>10</semantics>
1838                          </communities>
1839                          <communities>
1840                              <as-number>66</as-number>
1841                              <semantics>11</semantics>
1842                          </communities>
1843                      </community-set>
1844                  </community-sets>
1845              </bgp-defined-sets>
1846          </defined-sets>
1847
1848       @line 4: Community Set.
1849
1850       @line 5: Community Set name.
1851
1852       @line 6: Communities.
1853
1854       @line 10: Communities.
1855
1856    .. tab:: JSON
1857
1858       .. code-block:: json
1859          :linenos:
1860          :emphasize-lines: 5,6,7,12
1861
1862          {
1863              "defined-sets": {
1864                  "bgp-defined-sets" : {
1865                      "community-sets": {
1866                          "community-set": {
1867                              "community-set-name": "community-set-name-example",
1868                              "communities": [
1869                                  {
1870                                      "as-number": "65",
1871                                      "semantics": "10"
1872                                  },
1873                                  {
1874                                      "as-number": "66",
1875                                      "semantics": "11"
1876                                  }
1877                              ]
1878                          }
1879                      }
1880                  }
1881              }
1882          }
1883
1884       @line 5: Community Set.
1885
1886       @line 6: Community Set name.
1887
1888       @line 7: Communities.
1889
1890       @line 12: Communities.
1891
1892 Match Extended Community Set
1893 ''''''''''''''''''''''''''''
1894 .. tabs::
1895
1896    .. tab:: XML
1897
1898       .. code-block:: xml
1899          :linenos:
1900          :emphasize-lines: 3,5,7
1901
1902          <conditions>
1903              <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
1904                  <match-ext-community-set>
1905                      <ext-community-set>
1906                          /rpol:routing-policy/rpol:defined-sets/rpol:ext-community-sets/ext-community-set[ext-community-set-name="ext-community-set-name-test"]
1907                      </ext-community-set>
1908                      <match-set-options>ANY</match-set-options>
1909                  </match-ext-community-set>
1910              </bgp-conditions>
1911          </conditions>
1912
1913       @line 3: Match Extended Community Set.
1914
1915       @line 5: Match Extended Community Set reference.
1916
1917       @line 7: Match Set Option(ANY, ALL, INVERT).
1918
1919    .. tab:: JSON
1920
1921       .. code-block:: json
1922          :linenos:
1923          :emphasize-lines: 4,6,7
1924
1925          {
1926              "conditions": {
1927                  "bgp-conditions" : {
1928                      "match-ext-community-set": {
1929                              "ext-community-set": "/rpol:routing-policy/rpol:bgp-defined-sets/rpol:ext-community-sets/ext-community-set[ext-community-set-name=\"ext-community-set-name-test\"]"
1930                              "match-set-options": "ANY"
1931                      }
1932                  }
1933              }
1934          }
1935
1936       @line 4: Match Extended Community Set.
1937
1938       @line 6: Match Extended Community Set reference.
1939
1940       @line 7: Match Set Option(ANY, ALL, INVERT).
1941
1942 -----
1943
1944 Defined set
1945
1946 .. tabs::
1947
1948    .. tab:: XML
1949
1950       .. code-block:: xml
1951          :linenos:
1952          :emphasize-lines: 4,5,6,11
1953
1954          <defined-sets>
1955              <bgp-defined-sets xmlns="http://openconfig.net/yang/bgp-policy">
1956                  <ext-community-sets>
1957                      <ext-community-set>
1958                          <ext-community-set-name>ext-community-set-name-test</ext-community-set-name>
1959                          <ext-community-member>
1960                              <encapsulation-extended-community>
1961                                  <tunnel-type>vxlan</tunnel-type>
1962                              </encapsulation-extended-community>
1963                          </ext-community-member>
1964                          <ext-community-member>
1965                              <as-4-route-origin-extended-community>
1966                                  <as-4-specific-common>
1967                                      <as-number>65000</as-number>
1968                                      <local-administrator>123</local-administrator>
1969                                  </as-4-specific-common>
1970                              </as-4-route-origin-extended-community>
1971                          </ext-community-member>
1972                      </ext-community-set>
1973                  </ext-community-sets>
1974              </bgp-defined-sets>
1975          </defined-sets>
1976
1977       @line 4: Extended Community Set.
1978
1979       @line 5: Extended Community Set name.
1980
1981       @line 6: Extended Communities.
1982
1983       @line 11: Extended Communities.
1984
1985    .. tab:: JSON
1986
1987       .. code-block:: json
1988          :linenos:
1989          :emphasize-lines: 5,6,7,12
1990
1991          {
1992              "defined-sets": {
1993                  "bgp-defined-sets" : {
1994                      "ext-community-sets": {
1995                          "ext-community-set": {
1996                              "ext-community-set-name": "ext-community-set-name-test",
1997                              "ext-community-member": [
1998                                  {
1999                                      "encapsulation-extended-community": {
2000                                          "tunnel-type": "vxlan"
2001                                      },
2002                                      "as-4-route-origin-extended-community": {
2003                                          "as-4-specific-common": {
2004                                              "as-number": 65000,
2005                                              "local-administrator": 123
2006                                          }
2007                                      }
2008                                  }
2009                              ]
2010                          }
2011                      }
2012                  }
2013              }
2014          }
2015
2016       @line 5: Extended Community Set.
2017
2018       @line 6: Extended Community Set name.
2019
2020       @line 7: Extended Communities.
2021
2022       @line 12: Extended Communities.
2023
2024 Match in Afi Safi
2025 '''''''''''''''''
2026 .. tabs::
2027
2028    .. tab:: XML
2029
2030       .. code-block:: xml
2031          :linenos:
2032          :emphasize-lines: 3
2033
2034          <conditions>
2035              <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
2036                  <afi-safi-in xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-in>
2037              </bgp-conditions>
2038          </conditions>
2039
2040       @line 3: Afi Safi match.
2041
2042    .. tab:: JSON
2043
2044       .. code-block:: json
2045          :linenos:
2046          :emphasize-lines: 4
2047
2048          {
2049              "conditions": {
2050                  "bgp-conditions" : {
2051                      "afi-safi-in": "x:IPV4-UNICAST"
2052                  }
2053              }
2054          }
2055
2056       @line 4: Afi Safi match.
2057
2058 Match not in Afi Safi
2059 '''''''''''''''''''''
2060 .. tabs::
2061
2062    .. tab:: XML
2063
2064       .. code-block:: xml
2065          :linenos:
2066          :emphasize-lines: 3
2067
2068          <conditions>
2069              <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
2070                  <afi-safi-not-in xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"
2071                  xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-not-in>
2072                  <afi-safi-not-in xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"
2073                  xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-not-in>
2074              </bgp-conditions>
2075          </conditions>
2076
2077       @line 3: Afi Safi not in match.
2078
2079    .. tab:: JSON
2080
2081       .. code-block:: json
2082          :linenos:
2083          :emphasize-lines: 4
2084
2085          {
2086              "conditions": {
2087                  "bgp-conditions" : {
2088                      "afi-safi-not-in": [
2089                          "x:IPV4-UNICAST",
2090                          "x:IPV6-UNICAST"
2091                      ]
2092                  }
2093              }
2094          }
2095
2096       @line 4: Afi Safi not in match.
2097
2098 Match As Path Length
2099 ''''''''''''''''''''
2100 .. tabs::
2101
2102    .. tab:: XML
2103
2104       .. code-block:: xml
2105          :linenos:
2106          :emphasize-lines: 3
2107
2108          <conditions>
2109              <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
2110                  <as-path-length>
2111                      <operator xmlns:x="http://openconfig.net/yang/policy-types">x:attribute-eq</operator>
2112                      <value>2</value>
2113                  </as-path-length>
2114              </bgp-conditions>
2115          </conditions>
2116
2117       @line 3: As Path Length match.
2118
2119    .. tab:: JSON
2120
2121       .. code-block:: json
2122          :linenos:
2123          :emphasize-lines: 4
2124
2125          {
2126              "conditions": {
2127                  "bgp-conditions" : {
2128                      "as-path-length": {
2129                          "operator": "x:attribute-eq",
2130                          "value": 2
2131                      }
2132                  }
2133              }
2134          }
2135
2136       @line 4: As Path Length match.
2137
2138 Match Local Pref
2139 ''''''''''''''''
2140 .. tabs::
2141
2142    .. tab:: XML
2143
2144       .. code-block:: xml
2145          :linenos:
2146          :emphasize-lines: 3
2147
2148          <conditions>
2149              <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
2150                  <local-pref-eq>100</local-pref-eq>
2151              </bgp-conditions>
2152          </conditions>
2153
2154       @line 3: Local Preference match.
2155
2156    .. tab:: JSON
2157
2158       .. code-block:: json
2159          :linenos:
2160          :emphasize-lines: 4
2161
2162          {
2163              "conditions": {
2164                  "bgp-conditions" : {
2165                      "local-pref-eq": 100
2166                  }
2167              }
2168          }
2169
2170       @line 4: Local Preference match.
2171
2172 Match Origin
2173 ''''''''''''
2174 .. tabs::
2175
2176    .. tab:: XML
2177
2178       .. code-block:: xml
2179          :linenos:
2180          :emphasize-lines: 3
2181
2182          <conditions>
2183              <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
2184                  <origin-eq>IGP</origin-eq>
2185              </bgp-conditions>
2186          </conditions>
2187
2188       @line 3: Origin match.
2189
2190    .. tab:: JSON
2191
2192       .. code-block:: json
2193          :linenos:
2194          :emphasize-lines: 4
2195
2196          {
2197              "conditions": {
2198                  "bgp-conditions" : {
2199                      "origin-eq": "IGP"
2200                  }
2201              }
2202          }
2203
2204       @line 4: Origin match.
2205
2206 Match MED
2207 '''''''''
2208 .. tabs::
2209
2210    .. tab:: XML
2211
2212       .. code-block:: xml
2213          :linenos:
2214          :emphasize-lines: 3
2215
2216          <conditions>
2217              <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
2218                  <med-eq>100</med-eq>
2219              </bgp-conditions>
2220          </conditions>
2221
2222       @line 3: MED match.
2223
2224    .. tab:: JSON
2225
2226       .. code-block:: json
2227          :linenos:
2228          :emphasize-lines: 4
2229
2230          {
2231              "conditions": {
2232                  "bgp-conditions" : {
2233                      "med-eq": 100
2234                  }
2235              }
2236          }
2237
2238       @line 4: MED match.
2239
2240 Match Next Hop
2241 ''''''''''''''
2242 .. tabs::
2243
2244    .. tab:: XML
2245
2246       .. code-block:: xml
2247          :linenos:
2248          :emphasize-lines: 3
2249
2250          <conditions>
2251              <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
2252                  <next-hop-in>192.168.2.2</next-hop-in>
2253                  <next-hop-in>42.42.42.42</next-hop-in>
2254              </bgp-conditions>
2255          </conditions>
2256
2257       @line 3: Next hop match.
2258
2259    .. tab:: JSON
2260
2261       .. code-block:: json
2262          :linenos:
2263          :emphasize-lines: 4
2264
2265          {
2266              "conditions": {
2267                  "bgp-conditions" : {
2268                      "next-hop-in": [
2269                          "192.168.2.2",
2270                          "42.42.42.42"
2271                      ]
2272                  }
2273              }
2274          }
2275
2276       @line 4: Next hop match.
2277
2278 Match VPN Non member
2279 ''''''''''''''''''''
2280
2281 True if Route Targets attributes does not match with any Route Target Contrain advertized per Advertized peer.
2282
2283 .. tabs::
2284
2285    .. tab:: XML
2286
2287       .. code-block:: xml
2288          :linenos:
2289          :emphasize-lines: 3
2290
2291          <conditions>
2292              <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
2293                  <vpn-non-member xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
2294              </bgp-conditions>
2295          </conditions>
2296
2297       @line 3: VPN Non member match.
2298
2299    .. tab:: JSON
2300
2301       .. code-block:: json
2302          :linenos:
2303          :emphasize-lines: 4
2304
2305          {
2306              "conditions": {
2307                  "bgp-conditions" : {
2308                      "vpn-non-member": {
2309                      }
2310                  }
2311              }
2312          }
2313
2314       @line 4: Next hop match.