aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/yang/openconfig/openconfig-routing-policy.yang
blob: ca4c7edceaf309adc2fc4bebc7256258282d8a90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
module openconfig-routing-policy {

  yang-version "1";

  // namespace
  namespace "http://openconfig.net/yang/routing-policy";

  prefix "oc-rpol";

  // import some basic types
  import openconfig-inet-types { prefix oc-inet; }
  import openconfig-interfaces { prefix oc-if; }
  import openconfig-policy-types { prefix oc-pol-types; }
  import openconfig-extensions { prefix oc-ext; }

  // meta
  organization
    "OpenConfig working group";

  contact
    "OpenConfig working group
    netopenconfig@googlegroups.com";

  description
    "This module describes a YANG model for routing policy
    configuration. It is a limited subset of all of the policy
    configuration parameters available in the variety of vendor
    implementations, but supports widely used constructs for managing
    how routes are imported, exported, and modified across different
    routing protocols.  This module is intended to be used in
    conjunction with routing protocol configuration models (e.g.,
    BGP) defined in other modules.

    Route policy expression:

    Policies are expressed as a set of top-level policy definitions,
    each of which consists of a sequence of policy statements. Policy
    statements consist of simple condition-action tuples. Conditions
    may include mutiple match or comparison operations, and similarly
    actions may be multitude of changes to route attributes or a
    final disposition of accepting or rejecting the route.

    Route policy evaluation:

    Policy definitions are referenced in routing protocol
    configurations using import and export configuration statements.
    The arguments are members of an ordered list of named policy
    definitions which comprise a policy chain, and optionally, an
    explicit default policy action (i.e., reject or accept).

    Evaluation of each policy definition proceeds by evaluating its
    corresponding individual policy statements in order.  When a
    condition statement in a policy statement is satisfied, the
    corresponding action statement is executed.  If the action
    statement has either accept-route or reject-route actions, policy
    evaluation of the current policy definition stops, and no further
    policy definitions in the chain are evaluated.

    If the condition is not satisfied, then evaluation proceeds to
    the next policy statement.  If none of the policy statement
    conditions are satisfied, then evaluation of the current policy
    definition stops, and the next policy definition in the chain is
    evaluated.  When the end of the policy chain is reached, the
    default route disposition action is performed (i.e., reject-route
    unless an an alternate default action is specified for the
    chain).

    Policy 'subroutines' (or nested policies) are supported by
    allowing policy statement conditions to reference another policy
    definition which applies conditions and actions from the
    referenced policy before returning to the calling policy
    statement and resuming evaluation.  If the called policy
    results in an accept-route (either explicit or by default), then
    the subroutine returns an effective true value to the calling
    policy.  Similarly, a reject-route action returns false.  If the
    subroutine returns true, the calling policy continues to evaluate
    the remaining conditions (using a modified route if the
    subroutine performed any changes to the route).";

  oc-ext:openconfig-version "3.1.0";

  revision "2018-06-05" {
    description
      "Add PIM, IGMP to INSTALL_PROTOCOL_TYPES identity";
    reference "3.1.0";
  }

  revision "2017-07-14" {
    description
      "Replace policy choice node/type with policy-result
      enumeration;simplified defined set naming;removed generic
      IGP actions; migrate to OpenConfig types; added mode for
      prefix sets";
    reference "3.0.0";
  }

  revision "2016-05-12" {
    description
      "OpenConfig public release";
    reference "2.0.1";
  }


  // typedef statements

  typedef default-policy-type {
    // this typedef retained for name compatibiity with default
    // import and export policy
    type enumeration {
      enum ACCEPT_ROUTE {
        description
          "Default policy to accept the route";
      }
      enum REJECT_ROUTE {
        description
          "Default policy to reject the route";
      }
    }
    description
      "Type used to specify route disposition in
      a policy chain";
  }

  typedef policy-result-type {
    type enumeration {
      enum ACCEPT_ROUTE {
        description "Policy accepts the route";
      }
      enum REJECT_ROUTE {
        description "Policy rejects the route";
      }
    }
    description
      "Type used to specify route disposition in
      a policy chain";
  }


  // grouping statements

  grouping prefix-set-config {
    description
      "Configuration data for prefix sets used in policy
      definitions.";

    leaf name {
      type string;
      description
        "name / label of the prefix set -- this is used to
        reference the set in match conditions";
    }

    leaf mode {
      type enumeration {
        enum IPV4 {
          description
            "Prefix set contains IPv4 prefixes only";
        }
        enum IPV6 {
          description
            "Prefix set contains IPv6 prefixes only";
        }
        enum MIXED {
          description
            "Prefix set contains mixed IPv4 and IPv6 prefixes";
        }
      }
      description
        "Indicates the mode of the prefix set, in terms of which
        address families (IPv4, IPv6, or both) are present.  The
        mode provides a hint, but the device must validate that all
        prefixes are of the indicated type, and is expected to
        reject the configuration if there is a discrepancy.  The
        MIXED mode may not be supported on devices that require
        prefix sets to be of only one address family.";
    }

  }

  grouping prefix-set-state {
    description
      "Operational state data for prefix sets";
  }

  grouping prefix-set-top {
    description
      "Top-level data definitions for a list of IPv4 or IPv6
      prefixes which are matched as part of a policy";

    container prefix-sets {
      description
        "Enclosing container ";

      list prefix-set {
        key "name";
        description
          "List of the defined prefix sets";

        leaf name {
          type leafref {
            path "../config/name";
          }
          description
            "Reference to prefix name list key";
        }

        container config {
          description
            "Configuration data for prefix sets";

          uses prefix-set-config;
        }

        container state {

          config false;

          description
            "Operational state data ";

          uses prefix-set-config;
          uses prefix-set-state;
        }

        uses prefix-top;
      }
    }
  }

  grouping prefix-config {
    description
      "Configuration data for a prefix definition";

    leaf ip-prefix {
      type oc-inet:ip-prefix;
      mandatory true;
      description
        "The prefix member in CIDR notation -- while the
        prefix may be either IPv4 or IPv6, most
        implementations require all members of the prefix set
        to be the same address family.  Mixing address types in
        the same prefix set is likely to cause an error.";
    }

    leaf masklength-range {
      type string {
        pattern '^([0-9]+\.\.[0-9]+)|exact$';
      }
      description
        "Defines a range for the masklength, or 'exact' if
        the prefix has an exact length.

        Example: 10.3.192.0/21 through 10.3.192.0/24 would be
        expressed as prefix: 10.3.192.0/21,
        masklength-range: 21..24.

        Example: 10.3.192.0/21 would be expressed as
        prefix: 10.3.192.0/21,
        masklength-range: exact";
    }
  }

  grouping prefix-state {
    description
      "Operational state data for prefix definitions";
  }

  grouping prefix-top {
    description
      "Top-level grouping for prefixes in a prefix list";

    container prefixes {
      description
        "Enclosing container for the list of prefixes in a policy
        prefix list";

      list prefix {
        key "ip-prefix masklength-range";
        description
          "List of prefixes in the prefix set";

        leaf ip-prefix {
          type leafref {
            path "../config/ip-prefix";
          }
          description
            "Reference to the ip-prefix list key.";
        }

        leaf masklength-range {
          type leafref {
            path "../config/masklength-range";
          }
          description
            "Reference to the masklength-range list key";
        }

        container config {
          description
            "Configuration data for prefix definition";

          uses prefix-config;
        }

        container state {

          config false;

          description
            "Operational state data for prefix definition";

          uses prefix-config;
          uses prefix-state;
        }
      }
    }
  }

  grouping neighbor-set-config {
    description
      "Configuration data for neighbor set definitions";

    leaf name {
      type string;
      description
          "name / label of the neighbor set -- this is used to
          reference the set in match conditions";
    }

    leaf-list address {
      type oc-inet:ip-address;
      description
        "List of IP addresses in the neighbor set";
    }
  }

  grouping neighbor-set-state {
    description
      "Operational state data for neighbor set definitions";
  }

  grouping neighbor-set-top {
    description
      "Top-level data definition for a list of IPv4 or IPv6
      neighbors which can be matched in a routing policy";

    container neighbor-sets {
      description
        "Enclosing container for the list of neighbor set
        definitions";

      list neighbor-set {
        key "name";
        description
          "List of defined neighbor sets for use in policies.";

        leaf name {
          type leafref {
            path "../config/name";
          }
          description
            "Reference to the neighbor set name list key.";
        }

        container config {
          description
            "Configuration data for neighbor sets.";

          uses neighbor-set-config;
        }

        container state {

          config false;

          description
            "Operational state data for neighbor sets.";

          uses neighbor-set-config;
          uses neighbor-set-state;
        }
      }
    }
  }

  grouping tag-set-config {
    description
      "Configuration data for tag set definitions.";

    leaf name {
      type string;
      description
        "name / label of the tag set -- this is used to reference
        the set in match conditions";
    }

    leaf-list tag-value {
      type oc-pol-types:tag-type;
      description
        "Value of the tag set member";
    }
  }

  grouping tag-set-state {
    description
      "Operational state data for tag set definitions.";
  }

  grouping tag-set-top {
    description
      "Top-level data definitions for a list of tags which can
      be matched in policies";

    container tag-sets {
      description
        "Enclosing container for the list of tag sets.";

      list tag-set {
        key "name";
        description
          "List of tag set definitions.";

        leaf name {
          type leafref {
            path "../config/name";
          }
          description
            "Reference to the tag set name list key";
        }

        container config {
          description
            "Configuration data for tag sets";

          uses tag-set-config;
        }

        container state {

          config false;

          description
            "Operational state data for tag sets";

          uses tag-set-config;
          uses tag-set-state;
        }
      }
    }
  }

  grouping generic-defined-sets {
    description
      "Data definitions for pre-defined sets of attributes used in
      policy match conditions.  These sets are generic and can
      be used in matching conditions in different routing
      protocols.";

    uses prefix-set-top;
    uses neighbor-set-top;
    uses tag-set-top;
  }

  grouping match-set-options-group {
    description
      "Grouping containing options relating to how a particular set
      should be matched";

    leaf match-set-options {
      type oc-pol-types:match-set-options-type;
      description
        "Optional parameter that governs the behaviour of the
        match operation";
    }
  }

  grouping match-set-options-restricted-group {
    description
      "Grouping for a restricted set of match operation modifiers";

    leaf match-set-options {
      type oc-pol-types:match-set-options-restricted-type;
      description
        "Optional parameter that governs the behaviour of the
        match operation.  This leaf only supports matching on ANY
        member of the set or inverting the match.  Matching on ALL is
        not supported";
    }
  }

  grouping match-interface-condition-config {
    description
      "Configuration data for interface match condition";

    uses oc-if:interface-ref-common;
  }

  grouping match-interface-condition-state {
    description
      "Operational state data for interface match condition";
  }

  grouping match-interface-condition-top {
    description
      "Top-level grouping for the interface match condition";

    container match-interface {
      description
        "Top-level container for interface match conditions";

      container config {
        description
          "Configuration data for interface match conditions";

        uses match-interface-condition-config;
      }

      container state {

        config false;

        description
          "Operational state data for interface match conditions";

        uses match-interface-condition-config;
        uses match-interface-condition-state;
      }

    }
  }

  grouping prefix-set-condition-config {
    description
      "Configuration data for prefix-set conditions";

    leaf prefix-set {
        type leafref {
          path "../../../../../../../../defined-sets/" +
            "prefix-sets/prefix-set/config/name";
        }
        description "References a defined prefix set";
      }
      uses match-set-options-restricted-group;
  }


  grouping prefix-set-condition-state {
    description
      "Operational state data for prefix-set conditions";
  }

  grouping prefix-set-condition-top {
    description
      "Top-level grouping for prefix-set conditions";

    container match-prefix-set {
      description
        "Match a referenced prefix-set according to the logic
        defined in the match-set-options leaf";

      container config {
        description
          "Configuration data for a prefix-set condition";

        uses prefix-set-condition-config;
      }

      container state {

        config false;

        description
          "Operational state data for a prefix-set condition";

        uses prefix-set-condition-config;
        uses prefix-set-condition-state;
      }
    }
  }

  grouping neighbor-set-condition-config {
    description
      "Configuration data for neighbor-set conditions";

    leaf neighbor-set {
      type leafref {
        path "../../../../../../../../defined-sets/neighbor-sets/" +
        "neighbor-set/name";
        //TODO: require-instance should be added when it's
        //supported in YANG 1.1
        //require-instance true;
      }
      description "References a defined neighbor set";
    }

    uses match-set-options-restricted-group;
  }

  grouping neighbor-set-condition-state {
    description
      "Operational state data for neighbor-set conditions";
  }

  grouping neighbor-set-condition-top {
    description
      "Top-level grouping for neighbor-set conditions";

    container match-neighbor-set {
      description
        "Match a referenced neighbor set according to the logic
        defined in the match-set-options-leaf";

      container config {
        description
          "Configuration data ";

        uses neighbor-set-condition-config;
      }

      container state {

        config false;

        description
          "Operational state data ";

        uses neighbor-set-condition-config;
        uses neighbor-set-condition-state;
      }
    }
  }

  grouping tag-set-condition-config {
    description
      "Configuration data for tag-set condition statements";

    leaf tag-set {
      type leafref {
        path "../../../../../../../../defined-sets/tag-sets/tag-set" +
        "/name";
        //TODO: require-instance should be added when it's
        //supported in YANG 1.1
        //require-instance true;
      }
      description "References a defined tag set";
    }
    uses match-set-options-restricted-group;
  }

  grouping tag-set-condition-state {
    description
      "Operational state data for tag-set condition statements";
  }

  grouping tag-set-condition-top {
    description
      "Top-level grouping for tag-set conditions";

    container match-tag-set {
      description
        "Match a referenced tag set according to the logic defined
        in the match-options-set leaf";

      container config {
        description
          "Configuration data for tag-set conditions";

        uses tag-set-condition-config;
      }

      container state {

        config false;

        description
          "Operational state data tag-set conditions";

        uses tag-set-condition-config;
        uses tag-set-condition-state;
      }
    }
  }

  grouping generic-conditions {
    description "Condition statement definitions for checking
    membership in a generic defined set";

    uses match-interface-condition-top;
    uses prefix-set-condition-top;
    uses neighbor-set-condition-top;
    uses tag-set-condition-top;

  }

  grouping generic-actions {
    description
      "Definitions for common set of policy action statements that
      manage the disposition or control flow of the policy";

    leaf policy-result {
      type policy-result-type;
      description
        "Select the final disposition for the route, either
        accept or reject.";
    }
  }


  grouping policy-conditions-config {
    description
      "Configuration data for general policy conditions, i.e., those
      not related to match-sets";

      leaf call-policy {
        type leafref {
          path "../../../../../../../" +
            "oc-rpol:policy-definitions/" +
            "oc-rpol:policy-definition/oc-rpol:name";
          //TODO: require-instance should be added when
          //it is supported in YANG 1.1
          //require-instance true;
        }
        description
          "Applies the statements from the specified policy
          definition and then returns control the current
          policy statement. Note that the called policy may
          itself call other policies (subject to
          implementation limitations). This is intended to
          provide a policy 'subroutine' capability.  The
          called policy should contain an explicit or a
          default route disposition that returns an
          effective true (accept-route) or false
          (reject-route), otherwise the behavior may be
          ambiguous and implementation dependent";
      }

      leaf install-protocol-eq {
        type identityref {
          base oc-pol-types:INSTALL_PROTOCOL_TYPE;
        }
        description
          "Condition to check the protocol / method used to install
          the route into the local routing table";
      }
  }

  grouping policy-conditions-state {
    description
      "Operational state data for policy conditions";
  }

  grouping policy-conditions-top {
    description
      "Top-level grouping for policy conditions";

    container conditions {
      description
        "Condition statements for the current policy statement";

      container config {
        description
          "Configuration data for policy conditions";

        uses policy-conditions-config;
      }

      container state {

        config false;

        description
          "Operational state data for policy conditions";

        uses policy-conditions-config;
        uses policy-conditions-state;
      }
      uses generic-conditions;
    }
  }

  grouping policy-statements-config {
    description
      "Configuration data for policy statements";

    leaf name {
      type string;
      description
        "name of the policy statement";
    }
  }

  grouping policy-statements-state {
    description
      "Operational state data for policy statements";
  }



  grouping policy-actions-config {
    description
      "Configuration data for policy actions";

    uses generic-actions;
  }

  grouping policy-actions-state {
    description
      "Operational state data for policy actions";
  }

  grouping policy-actions-top {
    description
      "Top-level grouping for policy actions";

    container actions {
      description
        "Top-level container for policy action statements";

      container config {
        description
          "Configuration data for policy actions";

        uses policy-actions-config;
      }

      container state {

        config false;

        description
          "Operational state data for policy actions";

        uses policy-actions-config;
        uses policy-actions-state;
      }
    }
  }

  grouping policy-statements-top {
    description
      "Top-level grouping for the policy statements list";

    container statements {
      description
        "Enclosing container for policy statements";

      list statement {
        key "name";
        // TODO: names of policy statements within a policy
        // definition should probably be optional, however, YANG
        // requires a unique id for lists
        ordered-by user;
        description
          "Policy statements group conditions and actions
          within a policy definition.  They are evaluated in
          the order specified (see the description of policy
          evaluation at the top of this module.";

        leaf name {
          type leafref {
            path "../config/name";
          }
          description
            "Reference to list key";
        }

        container config {
          description
            "Configuration data for policy statements";

          uses policy-statements-config;
        }

        container state {

          config false;

          description
            "Operational state data for policy statements";

          uses policy-statements-config;
          uses policy-statements-state;
        }

        uses policy-conditions-top;
        uses policy-actions-top;
      }
    }
  }

  grouping defined-sets-top {
    description
      "Top-level grouping for defined set definitions";

    container defined-sets {
      description
        "Predefined sets of attributes used in policy match
        statements";

      uses generic-defined-sets;
    }
  }

  grouping policy-definitions-config {
    description
      "Configuration data for policy definitions";

    leaf name {
      type string;
      description
        "Name of the top-level policy definition -- this name
        is used in references to the current policy";
    }
  }

  grouping policy-definitions-state {
    description
      "Operational state data for policy definitions";
  }

  grouping policy-definitions-top {
    description
      "Top-level grouping for the policy definition list";

    container policy-definitions {
      description
        "Enclosing container for the list of top-level policy
          definitions";

      list policy-definition {
        key "name";
        description
          "List of top-level policy definitions, keyed by unique
          name.  These policy definitions are expected to be
          referenced (by name) in policy chains specified in import
          or export configuration statements.";

        leaf name {
          type leafref {
            path "../config/name";
          }
          description
            "Reference to the list key";
        }

        container config {
          description
            "Configuration data for policy defintions";

          uses policy-definitions-config;
        }

        container state {

          config false;

          description
            "Operational state data for policy definitions";

          uses policy-definitions-config;
          uses policy-definitions-state;
        }

        uses policy-statements-top;
      }
    }
  }

  grouping routing-policy-top {
    description
      "Top level container for OpenConfig routing policy";

    container routing-policy {
      description
        "Top-level container for all routing policy configuration";


      uses defined-sets-top;

      uses policy-definitions-top;
    }
  }

  grouping apply-policy-import-config {
    description
      "Configuration data for applying import policies";

    leaf-list import-policy {
      type leafref {
        path "/oc-rpol:routing-policy/oc-rpol:policy-definitions/" +
          "oc-rpol:policy-definition/oc-rpol:name";
        //TODO: require-instance should be added when it's
        //supported in YANG 1.1
        //require-instance true;
      }
      ordered-by user;
      description
        "list of policy names in sequence to be applied on
        receiving a routing update in the current context, e.g.,
        for the current peer group, neighbor, address family,
        etc.";
    }

    leaf default-import-policy {
      type default-policy-type;
      default REJECT_ROUTE;
      description
        "explicitly set a default policy if no policy definition
        in the import policy chain is satisfied.";
    }

  }

  grouping apply-policy-export-config {
    description
      "Configuration data for applying export policies";

    leaf-list export-policy {
      type leafref {
        path "/oc-rpol:routing-policy/oc-rpol:policy-definitions/" +
          "oc-rpol:policy-definition/oc-rpol:name";
        //TODO: require-instance should be added when it's
        //supported in YANG 1.1
        //require-instance true;
      }
      ordered-by user;
      description
        "list of policy names in sequence to be applied on
        sending a routing update in the current context, e.g.,
        for the current peer group, neighbor, address family,
        etc.";
    }

    leaf default-export-policy {
      type default-policy-type;
      default REJECT_ROUTE;
      description
        "explicitly set a default policy if no policy definition
        in the export policy chain is satisfied.";
    }
  }


  grouping apply-policy-config {
    description
      "Configuration data for routing policies";

    uses apply-policy-import-config;
    uses apply-policy-export-config;

  }



  grouping apply-policy-state {
    description
      "Operational state associated with routing policy";

    //TODO: identify additional state data beyond the intended
    //policy configuration.
  }

  grouping apply-policy-group {
    description
      "Top level container for routing policy applications. This
      grouping is intended to be used in routing models where
      needed.";

    container apply-policy {
      description
        "Anchor point for routing policies in the model.
        Import and export policies are with respect to the local
        routing table, i.e., export (send) and import (receive),
        depending on the context.";

      container config {
        description
          "Policy configuration data.";

        uses apply-policy-config;
      }

      container state {

        config false;
        description
          "Operational state for routing policy";

        uses apply-policy-config;
        uses apply-policy-state;
      }
    }
  }

  uses routing-policy-top;

}