Rome hackathon work integrated onto boron.
[unimgr.git] / cisco-xrmodels / src / main / yang / Cisco-IOS-XR-asr9k-policymgr-cfg@2015-05-18.yang
1 module Cisco-IOS-XR-asr9k-policymgr-cfg {
2
3   namespace 
4     "http://cisco.com/ns/yang/Cisco-IOS-XR-asr9k-policymgr-cfg";
5   
6   prefix "asr9k-policymgr-cfg";
7     
8   import ietf-inet-types { 
9     prefix inet;
10   }
11     
12   import ietf-yang-types { 
13     prefix yang;
14   }
15     
16   organization "Cisco Systems, Inc.";
17
18   contact
19     "Cisco Systems, Inc.
20      Customer Service
21
22      Postal: 170 West Tasman Drive
23      San Jose, CA 95134
24
25      Tel: +1 800 553-NETS
26
27      E-mail: cs-yang@cisco.com";
28
29   description 
30     "This module contains a collection of YANG definitions
31      for Cisco IOS-XR ASR9k policy manager configuration.
32
33      Copyright (c) 2013, 2015 by Cisco Systems, Inc.
34      All rights reserved.";
35
36   revision "2015-05-18" {
37     description
38       "IOS XR 5.3.2 revision.";
39   }
40
41   revision "2013-07-22" {
42     description
43       "Initial revision.";
44   }
45
46   typedef Class-map-type {
47     type enumeration {
48       enum qos {
49         value 1;
50         description "QoS Classmap.";
51       }
52       enum traffic {
53         value 3;
54         description "TRAFFIC Classmap.";
55       }
56       enum control {
57         value 4;
58         description "Control Subscriber Classmap.";
59       }
60     }
61     description "Policy manager class-map type.";
62   }
63
64   typedef Alarm-severity {
65     type string {
66       pattern "(informational)|(notification)|(warning)|(error)|"+
67               "(critical)|(alert)|(emergency)";
68     }
69     description "Alaram severity types.";
70   }
71
72   typedef Policy-map-type {
73     type enumeration {
74       enum qos {
75         value 1;
76         description "QoS Policymap";
77       }
78       enum pbr {
79         value 2;
80         description "PBR Policymap";
81       }
82       enum traffic {
83         value 3;
84         description "TRAFFIC Policymap";
85       }
86       enum subscriber-control {
87         value 4;
88         description "SUBSCRIBER-CONTROL Policymap";
89       }
90       enum redirect {
91         value 6;
92         description "REDIRECT Policy map";
93       }
94       enum flow-monitor {
95         value 7;
96         description "FLOWMONITOR Policy map";
97       }
98     }
99     description "Policy manager policy-map type.";
100   }
101
102   typedef Service-policy-type {
103     type string {
104       pattern "(PBR)|(QOS)|(REDIRECT)|(TRAFFIC)
105                |(pbr)|(qos)|(redirect)|(traffic)";
106     }
107     description "Policy manager service-policy type.";
108   }
109
110   typedef Pmap-class-map-type {
111     type enumeration {
112       enum qos {
113         value 1;
114         description "QoS Classmap.";
115       }
116       enum traffic {
117         value 2;
118         description "TRAFFIC Classmap.";
119       }
120       enum subscriber-control {
121         value 3;
122         description "Subscriber Control Classmap.";
123       }
124     }
125     description "Policy manager class-map type.";
126   }
127
128   typedef Bandwidth-units {
129     type string {
130       pattern "(bps)|(kbps)|(mbps)|(gbps)|(percent)|(per-million)|"+
131               "(per-thousand)";
132     }
133     description "Supported units for bandwidth.
134                  bps          - units in Bits/Sec
135                  kbps         - units in KiloBits/Sec
136                  mbps         - units in MegaBits/Sec
137                  gbps         - units in GigaBits/Sec
138                  percent      - units in Percentage
139                  per-million  - parts per-million bandwidth value
140                  per-thousand - Parts per-thousand bandwidth value";
141   }
142
143   typedef Bandwidth-remaining-units {
144     type string {
145       pattern "(percent)|(ratio)";
146     }
147     description "Supported units for bandwidth remaining.
148                  percent      - units in Percentage
149                  ratio        - units in Ratio";
150   }
151
152   typedef Rate-units {
153     type string {
154       pattern "(bps)|(kbps)|(mbps)|(gbps)|(pps)|(percent)";
155     }
156     description "Supported units for police rate or peak-rate.
157                  bps     - units in Bits/Sec
158                  kbps    - units in KiloBits/Sec
159                  mbps    - units in MegaBits/Sec
160                  gbps    - units in GigaBits/Sec
161                  pps     - units in Packets/Sec
162                  percent - units in Percentage";
163   }
164
165   typedef Cac-rate-units {
166     type string {
167       pattern "(bps)|(kbps)|(mbps)|(gbps)|(cellsps)";
168     }
169     description "Supported units for CAC rate or flow-rate.
170                  bps     - units in Bits/Sec
171                  kbps    - units in KiloBits/Sec
172                  mbps    - units in MegaBits/Sec
173                  gbps    - units in GigaBits/Sec
174                  cellsps - units in Cells/Sec";
175   }
176
177   typedef Queue-units {
178     type string {
179       pattern "(bytes)|(kbytes)|(mbytes)|(gbytes)|(us)|(ms)|"+
180               "(packets)|(cells)";
181     }
182     description "Supported units for queue.
183                  bytes   - units in Bytes
184                  kbytes  - units in KiloBytes
185                  mbytes  - units in MegaBytes
186                  gbytes  - units in Gigabytes
187                  us      - units in Microseconds
188                  ms      - units in Milliseconds
189                  packets - units in Packets
190                  cells   - units in Cells";
191   }
192   
193   typedef Threshold-units {
194     type string {
195       pattern "(bytes)|(kbytes)|(mbytes)|(gbytes)|(us)|(ms)|"+
196               "(packets)|(cells)";
197     }
198     description "Supported units for RED threshold.
199                  bytes   - units in Bytes
200                  kbytes  - units in KiloBytes
201                  mbytes  - units in MegaBytes
202                  gbytes  - units in GigaBytes
203                  us      - units in Microseconds
204                  ms      - units in Milliseconds
205                  packets - units in Packets
206                  cells   - units in Cells";
207   }
208
209   typedef Float-str {
210     type string {
211       pattern "[0-9]+(\.[0-9]+)?";
212     }
213     description "Floating point number string representation.";
214   }
215   
216   typedef Dscp {
217     type string {
218       pattern "([0-9]|[1-5][0-9]|6[0-3])|"+
219               "(af11)|(af12)|(af13)|(af21)|(af22)|(af23)|(af31)|"+
220               "(af32)|(af33)|(af41)|(af42)|(af43)|(ef)|(default)|"+
221               "(cs1)|(cs2)|(cs3)|(cs4)|(cs5)|(cs6)|(cs7)";
222     }
223     description "DSCP value string representation.
224                  Should be single value 0..63 or predefined string.";
225   }
226
227   typedef Dscp-range {
228     type string {
229       pattern "([0-9]|[1-5][0-9]|6[0-3])|"+
230               "(([0-9]|[1-5][0-9]|6[0-3])-"+
231               "([0-9]|[1-5][0-9]|6[0-3]))|"+
232               "(af11)|(af12)|(af13)|(af21)|(af22)|(af23)|(af31)|"+
233               "(af32)|(af33)|(af41)|(af42)|(af43)|(ef)|(default)|"+
234               "(cs1)|(cs2)|(cs3)|(cs4)|(cs5)|(cs6)|(cs7)";
235     }
236     description "DSCP value or range string representation.
237                  Should be single value 0..63 or predefined string 
238                  or range <min>-<max>.";
239   }
240   
241   typedef Num-range {
242     type string {
243       pattern "(\d+)|(\d+\-\d+)";
244     }
245     description "Numeric value or range string representation.
246                  Should be single value or range <min>-<max>.";
247   }
248   
249   typedef Protocol {
250     type string {
251       pattern 
252         "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])|"+
253         "(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\-"+
254         "([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]))|"+
255         "((ahp)|(dhcpv4)|(dhcpv6)|(eigrp)|(esp)|(gre)|(icmp)|"+
256         "(igmp)|(igrp)|(ipinip)|(ipv4)|(ipv6)|(ipv6icmp)|(mpls)|"+
257         "(nos)|(ospf)|(pcp)|(pim)|(ppp)|(sctp)|(tcp)|(udp))";
258     }
259     description "Numeric value or range or string representation.
260                  Should be single value or range 0..255.";
261   }
262   
263   typedef Ethertype {
264     type string {
265       pattern 
266         "((153[6-9]|15[4-9][0-9]|1[6-9][0-9][0-9]|[2-9][0-9][0-9][0-9])|"+
267         "([1-5][0-9][0-9][0-9][0-9]|6[0-4][0-9][0-9][0-9])|"+
268         "(65[0-4][0-9][0-9]|655[0-2][0-9]|6553[0-5]))|"+
269         "((arp)|(ipv4)|(ipv6))";
270     }
271     description "Numeric value or string representation.
272                  Should be single value 1536..65535 or predefined string.";
273   }
274
275   typedef Precedence {
276     type union {
277       type uint8 {
278         range "0..7";
279       }
280       type string {
281         pattern "(critical)|(flash)|(flash-override)|(immediate)|"+
282                 "(internet)|(network)|(priority)|(routine)";
283       }
284     }
285     description "Precedence value.
286                  critical        Critical precedence (5)
287                  flash           Flash precedence (3)
288                  flash-override  Flash override precedence (4)
289                  immediate       Immediate precedence (2)
290                  internet        Internetwork control precedence (6)
291                  network         Network control precedence (7)
292                  priority        Priority precedence (1)
293                  routine         Routine precedence (0)";
294   }
295   
296   typedef Cos {
297     type uint8 {
298       range "0..7";
299     }
300     description "Cos value.";
301   }
302
303   typedef Idle-timeout-number {
304     type uint16 {
305       range "10..2550";
306     }
307     units "seconds";
308     description "String that idle-timeout can take.";
309   }
310   
311   typedef Idle-timeout-string {
312     type string {
313       pattern "(None)|(none)";
314     }
315     description "This flow does not expire.";
316   }
317   
318   typedef Idle-timeout {
319     type union {
320       type Idle-timeout-number;
321       type Idle-timeout-string;
322     }
323     description "Idle timeout.";
324   }
325   
326   typedef Event-type {
327     type enumeration {
328       enum account-logoff {
329         description "Account logoff event.";
330       }
331       enum account-logon {
332         description "Account logon event.";
333       }
334       enum authentication-failure {
335         description "Authentication failure event.";
336       }
337       enum authentication-no-response {
338         description "Authentication no response event.";
339       }
340       enum authorization-failure {
341         description "Authorization failure event.";
342       }
343       enum authorization-no-response {
344         description "Authorization no response event.";
345       }
346       enum credit-exhausted {
347         description "Credit exhaustion event.";
348       }
349       enum exception {
350         description "Exception event.";
351       }
352       enum idle-timeout {
353         description "Idle timeout event.";
354       }
355       enum quota-depleted {
356         description "Quota depletion event.";
357       }
358       enum service-start {
359         description "Service start event.";
360       }
361       enum service-stop {
362         description "Service stop event.";
363       }
364       enum session-activate {
365         description "Session activate event.";
366       }
367       enum session-start {
368         description "Session start event.";
369       }
370       enum session-stop {
371         description "Session stop event.";
372       }
373       enum timer-expiry {
374         description "Timer expiry event.";
375       }
376     }
377     description "Event type.";
378   }
379   
380   typedef Execution-strategy {
381     type enumeration {
382       enum do-all {
383         description "Do all actions.";
384       }
385       enum do-until-failure {
386         description "Do all actions until failure.";
387       }
388       enum do-until-success {
389         description "Do all actions until success.";
390       }
391     }
392     description "Executuion strategy.";
393   }
394   
395   typedef Authorize-identifier {
396     type enumeration {
397       enum circuit-id {
398         description "Authorize circuit ID.";
399       }
400       enum remote-id {
401         description "Authorize remote ID.";
402       }
403       enum source-address-ipv4 {
404         description "Authorize source IPv4 address.";
405       }
406       enum source-address-ipv6 {
407         description "Authorize source IPv6 address.";
408       }
409       enum source-address-mac {
410         description "Authorize source MAC address.";
411       }
412       enum username {
413         description "Authorize username.";
414       }
415     }
416     description "Authorize identifier.";
417   }
418   
419   grouping MATCH {
420     description "Supported 'match' or 'match-not' actions.";
421     leaf-list ipv4-dscp {
422       type Dscp-range;
423       max-elements 8;
424       description "Match IPv4 DSCP.";
425     }
426     leaf-list ipv6-dscp {
427       type Dscp-range;
428       max-elements 8;
429       description "Match IPv6 DSCP.";
430     }
431     leaf-list dscp {
432       type Dscp-range;
433       max-elements 8;
434       description "Match DSCP.";
435     }
436     leaf-list ipv4-precedence {
437       type Precedence;
438       max-elements 8;
439       description "Match IPv4 precedence.";
440     }
441     leaf-list ipv6-precedence {
442       type Precedence;
443       max-elements 8;
444       description "Match IPv6 precedence.";
445     }
446     leaf-list precedence {
447       type Precedence;
448       max-elements 8;
449       description "Match precedence.";
450     }
451     leaf-list qos-group {
452       type Num-range;
453       max-elements 8;
454       description "Match QoS group.
455                    Should be value 0..512 or range.";
456     }
457     leaf-list cos {
458       type Cos;
459       max-elements 8;
460       description "Match CoS.";
461     }
462     leaf-list inner-cos {
463       type Cos;
464       max-elements 8;
465       description "Match inner CoS.";
466     }
467     leaf-list protocol {
468       type Protocol;
469       max-elements 7;
470       description "Match protocol.";
471     }
472     leaf ipv4-acl {
473       type string {
474         length "1..64";
475       }
476       description "Match IPv4 ACL.";
477     }
478     leaf ipv6-acl {
479       type string {
480         length "1..64";
481       }
482       description "Match IPv6 ACL.";
483     }
484     leaf-list mpls-experimental-topmost {
485       type Cos;
486       max-elements 8;
487       description "Match MPLS experimental topmost label.";
488     }
489     leaf-list mpls-experimental-imposition {
490       type Cos;
491       max-elements 8;
492       description "Match MPLS experimental imposition label.";
493     }
494     leaf-list discard-class {
495       type Cos;
496       max-elements 8;
497       description "Match discard class.";
498     }
499     leaf-list ipv4-packet-length {
500       type Num-range;
501       max-elements 8;
502       description "Match IPv4 packet length.
503                    Should be value 0..65535 or range.";
504     }
505     leaf-list ipv6-packet-length {
506       type Num-range;
507       max-elements 8;
508       description "Match IPv6 packet length. 
509                    Should be value 0..65535 or range.";
510     }
511     leaf-list packet-length {
512       type Num-range;
513       max-elements 8;
514       description "Match packet length. 
515                    Should be value 0..65535 or range.";
516     }
517     leaf mpls-disposition-ipv4-access-list {
518       type string {
519         length "1..32";
520       }
521       description "Match MPLS Label Disposition IPv4 access list.";
522     }
523     leaf mpls-disposition-ipv6-access-list {
524       type string {
525         length "1..32";
526       }
527       description "Match MPLS Label Disposition IPv6 access list.";
528     }
529     leaf-list vlan {
530       type Num-range;
531       max-elements 8;
532       description "Match VLAN ID.";
533     }
534     leaf-list inner-vlan {
535       type Num-range;
536       max-elements 8;
537       description "Match inner VLAN ID.";
538     }
539     leaf-list flow-tag {
540       type Num-range;
541       max-elements 8;
542       description "Match flow-tag. Should be value 1..63 or range.";
543     }
544     leaf-list ethertype {
545       type Ethertype;
546       max-elements 8;
547       description "Match Ethertype.";
548     }
549     list destination-address-ipv4 {
550       key "address netmask";
551       max-elements 8;
552       description "Match destination IPv4 address.";
553       leaf address {
554         type inet:ipv4-address-no-zone;
555         description "IPv4 address.";
556       }
557       leaf netmask {
558         type inet:ipv4-address-no-zone;
559         description "IPv4 netmask.";
560       }
561     }
562     list destination-address-ipv6 {
563       key "address prefix-length";
564       max-elements 8;
565       description "Match destination IPv6 address.";
566       leaf address {
567         type inet:ipv6-address-no-zone;
568         description "IPv6 address.";
569       }
570       leaf prefix-length {
571         type uint8 {
572           range "0..128";
573         }
574         description "IPv6 prefix length.";
575       }
576     }
577     leaf-list destination-port {
578       type Num-range;
579       max-elements 8;
580       description "Match destination port. 
581                    Should be value 0..65535 or range.";
582     }
583     leaf-list fragment-type {
584       type string {
585         pattern "(first-fragment)|(is-fragment)|(last-fragment)";
586       }
587       max-elements 3;
588       description "Match fragment type for a packet.";
589     }
590     leaf-list frame-relay-dlci {
591       type Num-range;
592       max-elements 8;
593       description "Match frame-relay DLCI value. 
594                    Should be value 16..1007 or range.";
595     }
596     leaf fr-de {
597         type uint8 {
598           range "0..1";
599         }
600         description "Set FrameRelay DE bit.";
601     }
602     leaf-list icmpv4-code {
603       type Num-range;
604       max-elements 8;
605       description "Match IPv4 ICMP code. 
606                    Should be value 0..255 or range.";
607     }
608     leaf-list icmpv4-type {
609       type Num-range;
610       max-elements 8;
611       description "Match IPv4 ICMP type. 
612                    Should be value 0..255 or range.";
613     }
614     leaf-list icmpv6-code {
615       type Num-range;
616       max-elements 8;
617       description "Match IPv6 ICMP code. 
618                    Should be value 0..255 or range.";
619     }
620     leaf-list icmpv6-type {
621       type Num-range;
622       max-elements 8;
623       description "Match IPv6 ICMP type. 
624                    Should be value 0..255 or range.";
625     }
626     list source-address-ipv4 {
627       key "address netmask";
628       max-elements 8;
629       description "Match source IPv4 address.";
630       leaf address {
631         type inet:ipv4-address-no-zone;
632         description "IPv4 address.";
633       }
634       leaf netmask {
635         type inet:ipv4-address-no-zone;
636         description "IPv4 netmask.";
637       }
638     }
639     list source-address-ipv6 {
640       key "address prefix-length";
641       max-elements 8;
642       description "Match source IPv6 address.";
643       leaf address {
644         type inet:ipv6-address-no-zone;
645         description "IPv6 address.";
646       }
647       leaf prefix-length {
648         type uint8 {
649           range "0..128";
650         }
651         description "IPv6 prefix length.";
652       }
653     }
654     leaf-list source-port {
655       type Num-range;
656       max-elements 8;
657       description "Match source port. 
658                    Should be value 0..65535 or range.";
659     }
660     leaf tcp-flag {
661       type uint16 {
662         range "1..4095";
663       }
664       description "Match TCP flag.";
665     }
666     leaf authen-status {
667       type string {
668         pattern "(authenticated)|(unauthenticated)";
669       }
670       description "Match authentication status.";
671     }
672     list domain-name {
673       key "name format";
674       max-elements 8;
675       description "Match domain name.";
676       leaf name {
677         type string {
678           length "1..32";
679         }
680         description "Domain name or regular expression.";
681       }
682       leaf format {
683         type string {
684           length "1..32";
685         }
686         description "Domain-format name.";
687       }
688     }
689     leaf-list service-name {
690       type string {
691         length "1..32";
692       }
693       max-elements 8;
694       description "Match servicve name.";
695     }
696     leaf-list service-name-regex {
697       type string {
698         length "1..32";
699       }
700       max-elements 8;
701       description "Match servicve name regular expression.";
702     }
703     leaf-list timer {
704       type string {
705         length "1..32";
706       }
707       max-elements 8;
708       description "Match timer.";
709     }
710     leaf-list timer-regex {
711       type string {
712         length "1..32";
713       }
714       max-elements 8;
715       description "Match timer regular expression.";
716     }
717     leaf-list user-name {
718       type string {
719         length "1..32";
720       }
721       max-elements 8;
722       description "Match user name.";
723     }
724     leaf-list user-name-regex {
725       type string {
726         length "1..32";
727       }
728       max-elements 8;
729       description "Match user name regular expression.";
730     }
731   }
732   
733   grouping MATCH-MATCHNOT {
734     description "match or match-not containers.";
735     container match {
736       description "Match rules.";
737       uses MATCH;
738       leaf source-mac {
739         type yang:mac-address;
740         description "Match source MAC address.";
741       }
742       leaf destination-mac {
743         type yang:mac-address;
744         description "Match destination MAC address.";
745       }
746       leaf atm-clp {
747         type uint8 {
748           range "0..1";
749         }
750        description "Match ATM CLP bit.";
751       }
752       leaf atm-oam {
753         type empty;
754         description "Match ATM OAM.";
755       }
756       leaf cac-admit {
757         type empty;
758         description "Match CAC admitted.";
759       }
760       leaf cac-unadmit {
761         type empty;
762         description "Match CAC unadmitted.";
763       }
764       container flow {
765         description "Match flow.";
766         leaf-list flow-key {
767           type string {
768             pattern "(SourceIP)|(DestinationIP)|(5Tuple)";
769           }
770           max-elements 2;
771           description "Configure the flow-key parameters.";
772         }
773         container flow-cache {
774           description "Configure the flow-cache parameters";
775           leaf idle-timeout {
776             type Idle-timeout;
777             description "Maximum time of inactivity for a flow.";
778           }
779         }
780       }
781     }
782     container match-not {
783       description "Match not rules.";
784       uses MATCH;
785     }  
786   }
787   grouping CLASS-MAP-RULE {
788     description "Class-map rule";
789     leaf class-map-mode-match-any {
790       when "count(../class-map-mode-match-all) = 0" {
791           description "Class MUST have only one mode.";
792       }
793       type empty;
794       description "Match all match criteria";
795     }
796     leaf class-map-mode-match-all {
797       when "count(../class-map-mode-match-any) = 0" {
798           description "Class MUST have only one mode.";
799       }
800       type empty;
801       description "Match any match criteria.";
802     }
803     uses MATCH-MATCHNOT;
804     leaf description {
805       type string;
806       description "Description for this policy-map.";
807     }
808   }
809   
810   grouping POLICY-MARK {
811     description "Policy packet marking actions.";
812     leaf dscp {
813       type Dscp;
814       description 
815         "Marks a packet by setting the DSCP in the ToS byte.";
816     }
817     leaf qos-group {
818       type uint16 {
819         range "0..512";
820       }
821       description
822         "Sets the QoS group identifiers on IPv4 or MPLS packets.
823          The set qos-group is supported only on an ingress policy.";
824     }
825     leaf discard-class {
826       type uint8 {
827         range "0..7";
828       }
829       description
830         "Sets the discard class on IPv4 or MPLS packets.
831          The discard-class can be used only in service policies 
832          that are attached in the ingress policy.";
833     }
834     leaf forward-class {
835       type uint8 {
836         range "0..7";
837       }
838       description 
839         "Sets the discard class.";
840     }
841     leaf df {
842       type uint8 {
843         range "0..1";
844       }
845       description "Set DF bit.";
846     }
847     leaf cos {
848       type uint8 {
849         range "0..7";
850       }
851       description 
852         "Sets the specific IEEE 802.1Q Layer 2 CoS value of an
853          outgoing packet.
854          This command should be used by a router if a user wants
855          to mark a packet that is being sent to a switch. 
856          Switches can leverage Layer 2 header information, 
857          including a CoS value marking. Packets entering an 
858          interface cannot be set with a CoS value.";
859     }
860     leaf inner-cos {
861       type uint8 {
862         range "0..7";
863       }
864       description "Set inner cos.";
865     }
866     leaf precedence {
867       type Precedence;
868       description "Sets the precedence value in the IP header.";
869     }
870     leaf precedence-tunnel {
871       type Precedence;
872       description "Sets the precedence tunnel value for ipsec.";
873     }
874     leaf mpls-experimental-top-most {
875       type uint8 {
876         range "0..7";
877       }
878       description 
879         "Sets the experimental value of the MPLS packet top-most
880          labels.";
881     }
882     leaf mpls-experimental-imposition {
883       type uint8 {
884          range "0..7";
885       }
886       description
887         "Sets the experimental value of the MPLS packet 
888          imposition labels.
889          Imposition can be used only in service policies that 
890          are attached in the ingress policy";
891     }
892     leaf srp-priority {
893       type uint8 {
894         range "0..7";
895       }
896       description 
897         "Sets the spatial reuse protocol priority value of an 
898          outgoing packet.";
899     }
900     leaf fr-de {
901         type uint8 {
902           range "0..1";
903         }
904         description "Set FrameRelay DE bit.";
905     }
906   }
907   
908   grouping CAC-RATE-VALUE {
909     description "CAC rate value.";
910     leaf value {
911       type uint32 {
912         range "1..4294967295";
913       }
914       must "../units" {
915         description "units must be set.";
916       }
917       description "Rate value.";
918     }
919     leaf units {
920       type Cac-rate-units;
921       description "Rate units.";
922     }
923   }
924   
925   grouping POLICE-ACTION {
926     description "Police action.";
927     leaf Transmit {
928       type empty;
929       description "Police action transmit.";
930     }
931     leaf drop {
932       type empty;
933       description "Police action drop.";
934     }
935     container set {
936       description "Police action packet marking.";
937       uses POLICY-MARK;
938     }
939   }
940   
941   grouping POLICY-MAP-RULE {
942     description "Class-map rule.";
943     list event {
944       key "event-type";
945       description "Policy event.";
946       leaf event-type {
947         type Event-type;
948         description "Event type.";
949       }
950       leaf event-mode-match-all {
951         when "count(../event-modematch-first) = 0" {
952           description "Event MUST have only one mode.";
953         }
954         type empty;
955         description "Execute all the matched classes.";
956       }
957       leaf event-modematch-first {
958         when "count(../event-modematch-all) = 0" {
959           description "Event MUST have only one mode.";
960         }
961         type empty;
962         description "Execute only the first matched class.";
963       }
964       list class {
965         key "class-name class-type";
966         description "Class-map rule.";
967         leaf class-name {
968           type string {
969             pattern "[a-zA-Z0-9][a-zA-Z0-9\._@$%+#:=<>\-]{0,62}";
970           }
971           description "Name of class.";
972         }
973         leaf class-type {
974           type Pmap-class-map-type;
975           description "Type of class.";
976         }
977         leaf class-execution-strategy {
978           type Execution-strategy;
979           description "Class execution strategy.";
980         }
981         list action-rule {
982           key "action-sequence-number";
983           description "Action rule.";
984           leaf action-sequence-number {
985             type uint16 {
986               range "1..65535";
987             }
988             description "Sequence number for this action.";
989           }
990           container activate-dynamic-template {
991             presence "This container is present only if actions is
992                       related to dynamic templates.";
993             description "Activate dynamic templates.";
994             leaf name {
995               type string;
996               mandatory true;
997               description "Dynamic template name.";
998             }
999             leaf aaa-list {
1000               type string;
1001               description "Name of the AAA method list.";
1002             }
1003           }
1004           container authenticate {
1005             description "Authentication related configuration.";
1006             leaf aaa-list {
1007               type string;
1008               description "Name of the AAA method list.";
1009             }
1010           }
1011           container authorize {
1012             must "format or identifier" {
1013               description "format or identifier must be set.";
1014             }
1015             presence "This container is present only if actions is
1016                       related to authorization.";
1017             description "Authorize.";
1018             leaf aaa-list {
1019               type string;
1020               mandatory true;
1021               description "Name of the AAA method list.";
1022             }
1023             leaf format {
1024               type string;
1025               description "Specify an Authorize format name.";
1026             }
1027             leaf identifier {
1028               type Authorize-identifier;
1029               description "Specify an Authorize format name.";
1030             }
1031             leaf password {
1032               type string;
1033               mandatory true;
1034               description "Specify a password to be used for AAA
1035                            request.";
1036             }
1037           }
1038           container deactivate-dynamic-template {
1039             presence "This container is present only if actions is
1040                       related to dynamic templates.";
1041             description "Deactivate dynamic templates.";
1042             leaf name {
1043               type string;
1044               mandatory true;
1045               description "Dynamic template name.";
1046             }
1047             leaf aaa-list {
1048               type string;
1049               description "Name of the AAA method list.";
1050             }
1051           }
1052           leaf disconnect {
1053             type empty;
1054             description "Disconnect session.";
1055           }
1056           leaf monitor {
1057             type empty;
1058             description "Monitor session.";
1059           }
1060           container set-timer {
1061             presence "This container is present only if actions is
1062                       related to timer.";
1063             description "Set a timer to execute a rule on its 
1064                          expiry";
1065             leaf timer-name {
1066               type string;
1067               mandatory true;
1068               description "Name of the timer.";
1069             }
1070             leaf timer-value {
1071               type uint32;
1072               units "minutes";
1073               mandatory true;
1074               description "Timer value in minutes.";
1075             }
1076           }
1077           container stop-timer {
1078             description "Disable timer before it expires.";
1079             leaf timer-name {
1080               type string;
1081               description "Name of the timer.";
1082             }
1083           }
1084         }
1085       }
1086     }
1087     list policy-map-rule {
1088       key "class-name class-type";
1089       description "Class-map rule.";
1090       leaf class-name {
1091         type string {
1092           pattern "[a-zA-Z0-9][a-zA-Z0-9\._@$%+#:=<>\-]{0,62}";
1093         }
1094         description "Name of class-map.";
1095       }
1096       leaf class-type {
1097         type Pmap-class-map-type;
1098         description "Type of class-map.";
1099       }
1100       container shape {
1101         must "rate" {
1102           description "rate container must be present.";
1103         }
1104         description "Policy action shape.";
1105         container rate {
1106           description "Rate configuration.";
1107           leaf value {
1108             type uint32;
1109             must "../unit" {
1110               description "unit must be set.";
1111             }
1112             description "Shape bandwidth value.";
1113           }
1114           leaf unit {
1115             type Bandwidth-units;
1116             description "Shape bandwidth units.";
1117           }
1118         }
1119         container burst {
1120           description "Burst size configuration.";
1121           leaf value {
1122             type uint32;
1123             must "../units" {
1124               description "units must be set.";
1125             }
1126             description "Burst size value.";
1127           }
1128           leaf units {
1129             type Threshold-units;
1130             description "Burst size units.";
1131           }
1132         }
1133       }
1134       container min-bandwidth {
1135         description "Policy action minimum bandwidth queue.";
1136         leaf value {
1137           type uint32;
1138           must "../unit" {
1139             description "unit must be set.";
1140           }
1141           description "Minimum bandwidth value.";
1142         }
1143         leaf unit {
1144           type Bandwidth-units;
1145           description "Minimum bandwidth units.";
1146         }
1147       }
1148       container bandwidth-remaining {
1149         description "Policy action bandwidth remaining queue.";
1150         leaf value {
1151           type uint32;
1152           must "../unit" {
1153             description "unit must be set.";
1154           }
1155           description "Remaining bandwidth value.";
1156         }
1157         leaf unit {
1158           type Bandwidth-remaining-units;
1159           description "Remaining bandwidth units.";
1160         }
1161       }
1162       container queue-limit {
1163         description "Policy action queue limit.";
1164         leaf value {
1165           type uint32;
1166           must "../unit" {
1167             description "unit must be set.";
1168           }
1169           description "Remaining bandwidth value.";
1170         }
1171         leaf unit {
1172           type Queue-units;
1173           description "Remaining bandwidth units.";
1174         }
1175       }
1176       leaf priority-level {
1177         type uint8 {
1178           range "1..7";
1179         }
1180         description "Priority level.";
1181       }
1182       leaf default-red {
1183         type empty;
1184         description "Default random early detection";
1185       }
1186       leaf ecn-red {
1187         type empty;
1188         description "ECN based random early detection";
1189       }
1190       list random-detect {
1191         key "threshold-min-value threshold-min-units "+
1192             "threshold-max-value threshold-max-units";
1193         description "Random early detection.
1194                      All RED profiles in a class must be based
1195                      on the same field.";
1196         leaf threshold-min-value {
1197           type uint32;
1198           description "Minimum RED threshold value.";
1199         }
1200         leaf threshold-min-units {
1201           type Threshold-units;
1202           description "Minimum RED threshold units.";
1203         }
1204         leaf threshold-max-value {
1205           type uint32;
1206           description "Maximum RED threshold value.";
1207         }
1208         leaf threshold-max-units {
1209           type Threshold-units;
1210           description "Maximum RED threshold units.";
1211         }
1212         leaf-list cos {
1213           type Dscp-range;
1214           max-elements 8;
1215           description "WRED based on CoS.";
1216         }
1217         leaf-list discard-class {
1218           type Cos;
1219           max-elements 8;
1220           description "WRED based on discard class.";
1221         }
1222         leaf-list dscp {
1223           type Dscp-range;
1224           max-elements 8;
1225           description "WRED based on DSCP.";
1226         }
1227         leaf-list mpls-exp {
1228           type Cos;
1229           max-elements 8;
1230           description "MPLS Experimental value based WRED.";
1231         }
1232         leaf-list precedence {
1233           type Precedence;
1234           max-elements 8;
1235           description "WRED based on precedence.";
1236         }
1237         leaf dei {
1238           type uint8 {
1239             range "0..1";
1240           }
1241           description "DEI based WRED.";
1242         }
1243       }
1244       container set {
1245         description "Policy action packet marking.";
1246         uses POLICY-MARK;
1247       }
1248       container police {
1249         must "rate" {
1250           description "rate container must be present.";
1251         }
1252         description "Configures traffic policing action.";
1253         container rate {
1254           description "Rate configuration.";
1255           leaf value {
1256             type uint32;
1257             must "../units" {
1258               description "units must be set.";
1259             }
1260             description "Rate value.";
1261           }
1262           leaf units {
1263             type Rate-units;
1264             description "Rate units.";
1265           }
1266         }
1267         container peak-rate {
1268           description "Peak rate configuration.";
1269           leaf value {
1270             type uint32;
1271             must "../units" {
1272               description "units must be set.";
1273             }
1274             description "Peak rate value.";
1275           }
1276           leaf units {
1277             type Rate-units;
1278             description "Peak rate units.";
1279           }
1280         }
1281         container burst {
1282           description "Burst configuration.";
1283           leaf value {
1284             type uint32;
1285             must "../units" {
1286               description "units must be set.";
1287             }
1288             description "Burst value.";
1289           }
1290           leaf units {
1291             type Threshold-units;
1292             description "Burst units.";
1293           }
1294         }
1295         container peak-burst {
1296           description "Peak burst configuration.";
1297           leaf value {
1298             type uint32;
1299             must "../units" {
1300               description "units must be set.";
1301             }
1302             description "Peak burst value.";
1303           }
1304           leaf units {
1305             type Threshold-units;
1306             description "Peak burst units.";
1307           }
1308         }
1309         container conform-action {
1310           description 
1311             "Configures the action to take on packets that conform 
1312              to the rate limit.";
1313           uses POLICE-ACTION;
1314         }
1315         container exceed-action {
1316           description 
1317             "Configures the action to take on packets that exceed 
1318              the rate limit.";
1319           uses POLICE-ACTION;
1320         }
1321         container violate-action {
1322           description
1323             "Configures the action to take on packets that violate
1324              the rate limit.";
1325           uses POLICE-ACTION;
1326         }
1327       }
1328       container service-policy {
1329         description 
1330           "Configure a child service policy.";
1331         leaf policy-name {
1332           type string {
1333             pattern "[a-zA-Z0-9][a-zA-Z0-9\._@$%+#:=<>\-]{0,62}";
1334           }
1335           description "Name of service-policy.";
1336         }
1337         leaf type {
1338           type Service-policy-type;
1339           description "Type of service-policy.";
1340         }
1341       }
1342       container cac-local {
1343         description "Policy action CAC.";
1344         container rate {
1345           description "The rate allocated for all flows.";
1346           uses CAC-RATE-VALUE;
1347         }
1348         container flow-rate {
1349           description "The rate allocated per flow.";
1350           uses CAC-RATE-VALUE;
1351         }
1352         leaf flow-idle-timeout {
1353           type Idle-timeout;
1354           description "The interval after which a flow is removed, 
1355                        if there is no activity.
1356                        If timeout is 0 this flow does not expire.";
1357         }
1358       }
1359       container flow-params {
1360         description "Policy flow monitoring action.";
1361         leaf max-flow {
1362           type uint16 {
1363             range "0..4096";
1364           }
1365           description 
1366             "Max simultaneous flows monitored per policy class";
1367         }
1368         leaf interval-duration {
1369           type uint32;
1370           units "seconds";
1371           description "Monitored interval duration.";
1372         }
1373         leaf history {
1374           type uint32;
1375           description 
1376             "Keep stats/metrics on box for so many intervals.";
1377         }
1378         leaf timeout {
1379           type uint32;
1380           units "seconds";
1381           description "Declare a flow dead if no packets received in
1382                        so much time";
1383         }
1384       }
1385       container metrics-ipcbr {
1386         description "Policy IP-CBR metric action.";
1387         container rate {
1388           description "Nominal per-flow data rate.";
1389           leaf layer3 {
1390             type uint32;
1391             units "bps";
1392             description "Nominal rate specified at the L3 (IP).";
1393           }
1394           leaf packet {
1395             type uint32;
1396             units "pps";
1397             description "Nominal IP layer packet rate (in pps).";
1398           }
1399           leaf media {
1400             type uint32 {
1401               range "1..3000000000";
1402             }
1403             units "bps";
1404             description 
1405               "Nominal data rate of the media flow (ip payload).";
1406           }
1407         }
1408         container media-packet {
1409           description "Media-packet structure.";
1410           leaf size {
1411             type uint16;
1412             units "bytes";
1413             description "Nominal size of the media-packet.";
1414           }
1415           leaf count-in-layer3 {
1416             type uint8 {
1417               range "1..64";
1418             }
1419             units "packets";
1420             description 
1421               "Nominal number of media packets in an IP payload.";
1422           }
1423         }
1424       }
1425       container react {
1426         description "Policy action react.";
1427         leaf descrition {
1428           type string;
1429           description "String describing the react statement.";
1430         }
1431         container action {
1432           description "Action on alert.";
1433           leaf syslog {
1434             type empty;
1435             description "Syslog.";
1436           }
1437           leaf snmp {
1438             type empty;
1439             description "SNMP.";
1440           }
1441         }
1442         container alarm {
1443           description "Alaram settings.";
1444           container type {
1445             description "Alarm type.";
1446             leaf discrete {
1447               type empty;
1448               description "Discrete alarm type.";
1449             }
1450             leaf group-count {
1451               type uint16;
1452               units "number of flows";
1453               description "Number of flows to reach before 
1454                            triggering alarm";
1455             }
1456             leaf group-percent {
1457               type uint16;
1458               units "percentage";
1459               description "Percent to reach before triggering alarm";
1460             }
1461           }
1462           leaf severity {
1463             type Alarm-severity;
1464             description "Severity of the alarm.";
1465           }
1466         }
1467         container treshold {
1468           description "Alarm threshold settings.";
1469           container trigger-value {
1470             description "Alarm trigger value settings.";
1471             leaf greater-than {
1472               type string;
1473               description "Greater than";
1474             }
1475             leaf greater-than-equal {
1476               type string;
1477               description "Greater than equal";
1478             }
1479             leaf less-than {
1480               type string;
1481               description "Less than";
1482             }
1483             leaf less-than-equal {
1484               type string;
1485               description "Less than equal";
1486             }
1487             leaf range {
1488               type string;
1489               description "Range";
1490             }
1491           }
1492           container trigger-type {
1493             description "Alarm trigger type settings.";
1494             leaf immediate {
1495               type empty;
1496               description "Immediate trigger.";
1497             }
1498             leaf average {
1499               type uint32;
1500               description "Trigger averaged over N intervals.";
1501             }
1502           }
1503         }
1504         leaf criterion-delay-factor {
1505           type empty;
1506           description "React criterion delay factor.";
1507         }
1508         leaf criterion-media-stop {
1509           type empty;
1510           description "React criterion media stop.";
1511         }
1512         leaf criterion-mrv {
1513           type empty;
1514           description "React criterion mrv.";
1515         }
1516         leaf criterion-flow-count {
1517           type empty;
1518           description "React criterion flow count.";
1519         }
1520         leaf criterion-packet-rate {
1521           type empty;
1522           description "React criterion packet rate.";
1523         }
1524       }
1525       container pbr {
1526         description "Policy action PBR.";
1527         leaf http-redirect {
1528           type string;
1529           description "Policy action http redirect.
1530                        Redirect to this url.";
1531         }
1532         leaf pbr-transmit {
1533           type empty;
1534           description "Policy action PBR transmit.";
1535         }
1536         leaf pbr-drop {
1537           type empty;
1538           description "Policy action PBR drop.";
1539         }
1540         container pbr-forward {
1541           description "Policy action PBR forward.";
1542           leaf default {
1543             type empty;
1544             description "Use system default routing table.";
1545           }
1546           container next-hop {
1547             description "Use specific next-hop.
1548                          Here we present 5 different combination 
1549                          for the pbf next-hop.
1550                           1. vrf with v6 address
1551                           2. vrf with v4 address
1552                           3. vrf 
1553                           4. v4 address
1554                           5. v6 address";
1555             leaf vrf {
1556               type string;
1557               description "VRF name.";
1558             }
1559             leaf ipv4-address {
1560               type inet:ipv4-address;
1561               description "IPv4 address.";
1562             }
1563             leaf ipv6-address {
1564               type inet:ipv6-address;
1565               description "IPv6 address.";
1566             }
1567           }
1568         }
1569         container set {
1570           description "PBR action packet marking.";
1571           uses POLICY-MARK;
1572         }
1573       }
1574       leaf service-fragment {
1575         type string;
1576         description "Policy action service fragment. 
1577                      Service fragment name";
1578       }
1579       leaf fragment {
1580         type string;
1581         description "Policy action fragment. Fragment name";
1582       }
1583     }
1584     leaf description {
1585       type string;
1586       description "Description for this policy-map.";
1587     }
1588   }
1589   
1590   container policy-manager {
1591     description "Global Policy Manager configuration.";
1592     
1593     container class-maps {
1594       description "Class-maps configuration.";
1595       list class-map {
1596         key "type name";
1597         description "Class-map configuration.";
1598         leaf type {
1599           type Class-map-type;
1600           description "Type of class-map.";  
1601         }
1602         leaf name {
1603           type string {
1604             pattern "[a-zA-Z0-9][a-zA-Z0-9\._@$%+#:=<>\-]{0,62}";
1605           }
1606           description "Name of class-map.";
1607         }
1608         
1609         uses CLASS-MAP-RULE;
1610       }
1611     }
1612     
1613     container policy-maps {
1614       description "Policy-maps configuration.";
1615       list policy-map {
1616         key "type name";
1617         description "Policy-map configuration.";
1618         leaf type {
1619           type Policy-map-type;
1620           description "Type of policy-map.";
1621         }
1622         leaf name {
1623           type string {
1624             pattern "[a-zA-Z0-9][a-zA-Z0-9\._@$%+#:=<>\-]{0,62}";
1625           }
1626           description "Name of policy-map.";
1627         }
1628         
1629         uses POLICY-MAP-RULE;
1630       }
1631     }
1632   }
1633 }