Added support for RTP and UGS gate traffic profiles
[packetcable.git] / packetcable-policy-model / src / main / yang / packetcable.yang
1 module packetcable
2 {
3     namespace "urn:packetcable";
4     prefix "pcmm";
5
6     import ietf-yang-types     { prefix yang;  revision-date "2013-07-15"; }
7     import ietf-inet-types     { prefix inet; revision-date "2013-07-15"; }
8     import yang-ext { prefix ext; revision-date "2013-07-09"; }
9
10     description "This module contains the PCMM Converged Cable Access Platform (CCAP) definitions";
11     organization "OpenDaylight Project";
12
13     revision 2017-01-25 {
14         description "Added support for UGS and RTP traffic profiles";
15     }
16     revision 2016-12-19 {
17         description "Added support for flow-spec traffic profile";
18     }
19     revision 2016-11-28 {
20         description "Added support for activation-state, session-class-id and inactivity-timer";
21     }
22     revision 2016-11-07 {
23         description "Added priority field to all classifiers";
24     }
25     revision 2016-10-17 {
26         description "Modified service-flow-direction values to match the PCMM Spec";
27     }
28     revision 2015-11-01 {
29         description "Extended gates to support multiple classifiers.";
30     }
31     revision 2015-10-26 {
32         description "Corrected pluralization of containers/lists and added containers around lists where needed";
33     }
34     revision 2015-03-27 {
35         description "Initial revision of PCMM CCAP definitions";
36     }
37
38     // Global typedefs
39
40     typedef s-type {
41         type uint8;
42         description "RSVP sub-type per PCMM specification.";
43     }
44     
45     typedef service-class-name {
46         type string { length "2..16"; }
47         description "The Service Class Name is MUST be 2-16 bytes.";
48     }
49     typedef service-flow-direction {
50         type enumeration {
51             enum ds {
52                 value "0";
53                 description "Downstream service flow.";
54             }
55             enum us {
56                 value "1";
57                 description "Upstream service flow.";
58             }
59         }
60         description "This value represents the service flow direction.";
61     }
62     
63     typedef classifier-activation-state {
64         type enumeration {
65             enum inactive {
66                 value 0;
67                 description "Inactive";
68             }
69             enum active {
70                 value 1;
71                 description "Active";
72             }
73         }
74         description "Instructs the CMTS to either activate or inactivate the classifier";
75     }
76      
77     typedef classifier-action {
78         type enumeration {
79             enum add {
80                 value 0;
81                 description "Add classifier";
82             }
83             enum replace {
84                 value 1;
85                 description "Replace classifier";
86             }
87             enum delete {
88                 value 2;
89                 description "Delete classifier";
90             }
91             enum nochange {
92                 value 3;
93                 description "No change to classifier";
94             }
95         }
96         description "Instructs the CMTS to add,replace,delete or leave the classifier";
97     }
98
99     typedef tp-protocol {
100         type uint16 {range "0..257";}
101         description "This value represents the IP transport protocol (or Next Header) where 256 is any protocol and 257 is TCP or UDP";
102     }
103     typedef tos-byte {
104         type uint8;
105         description "TOS/TC byte or mask";
106     }
107
108     identity ccap-context {
109         description "Identity used to mark ccap context";
110     }
111
112     // CCAP devices
113     container ccaps {
114         list ccap {
115             description "
116                 CCAP devices are known by their network name which is any string.
117                 Each CCAP device has a network address:port, a list of subscriber IP subnets,
118                 and a list of available Service Class Names.
119                 ";
120             key "ccapId";
121             ext:context-instance "ccap-context";
122             leaf ccapId {
123                 type string;
124                 description "CCAP Identity";
125                 mandatory true;
126             }
127             uses ccap-attributes;
128         }
129     }
130
131     identity app-context {
132         description "Identity used to mark app context";
133     }
134
135     container apps {
136         list app {
137             key "id";
138             ext:context-instance "app-context";
139             leaf "id" {
140                 type string;
141                 mandatory true;
142             }
143         }
144     }
145
146     grouping ccap-connection {
147         leaf ipAddress {
148             type inet:ip-address;
149             description "IP Address of CCAP";
150             mandatory true;
151         }
152         leaf port {
153             type inet:port-number;
154             description "COPS session TCP port number";
155             default 3918;
156         }
157         leaf connected {
158             config false;
159             type boolean;
160             description "COPS session state";
161             mandatory true;
162         }
163         leaf-list error {
164             config false;
165             type string;
166             description "Operational errors";
167         }
168         leaf timestamp {
169             config false;
170             type yang:date-and-time;
171             description "Last update timestamp";
172             mandatory true;
173         }
174     }
175
176     grouping ccap-attributes {
177         description "
178             Each CCAP device has a COPS connection address:port,
179             a list of subscriber IP subnets, and
180             a list of available Service Class Names.
181             ";
182         container connection {
183             uses ccap-connection;
184         }
185         container amId {
186             leaf am-tag {
187                 type uint16;
188                 description "Application Manager Tag -- unique for this operator";
189                 mandatory true;
190             }
191             leaf am-type {
192                 type uint16;
193                 description "Application Manager Type -- unique for this AM tag";
194                 mandatory true;
195             }
196         }
197         leaf-list subscriber-subnets {
198             type inet:ip-prefix;
199         }
200         leaf-list upstream-scns {
201             type service-class-name;
202         }
203         leaf-list downstream-scns {
204             type service-class-name;
205         }
206         leaf-list error {
207             config false;
208             type string;
209             description "ccap data errors";
210         }
211     }
212
213     // PCMM QoS Gates
214     container qos {
215         description "
216             PCMM QoS Gates are organized as a tree by Application/Subscriber/Gate:
217                 Each Application is known by its appId which is any string.
218                 Each Subscriber is known by its subscriberId which is a CPE IP address in either IPv4 or IPv6 format.
219                 Each Gate is known by its gateId which is any string.
220
221             The subscriber's CPE IP address is used to locate the CCAP device that is currently hosting the
222             the Cable Modem that is connected to the subscriber's device. Therefore, it is not necessary
223             for the PCMM applications to know the topology of the CCAP devices and CMs in the network path
224             to their subscriber devices.
225
226             Note that each CCAP entry contains a list of connected subscriber IP subnets as well as a list
227             of all Service Class Names (SCNs) available on the CCAP device.
228             ";
229         uses pcmm-qos-gates;
230     }
231
232     grouping pcmm-qos-gates {
233         container apps {
234             list app {
235                 key "appId";
236                 ext:context-instance "app-context";
237                 leaf appId {
238                     type string;
239                     description "Application Identity";
240                 }
241                 container subscribers {
242                     list subscriber {
243                         key "subscriberId";
244                         leaf subscriberId {
245                             type string;
246                             description "Subscriber Identity -- must be a CM or CPE IP address";
247                             mandatory true;
248                         }
249                         container gates {
250                             list gate {
251                                 key "gateId";
252                                 leaf gateId {
253                                     type string;
254                                     description "Qos Gate Identity";
255                                     mandatory true;
256                                 }
257                                 uses gate-operational-attributes;
258                                 uses pcmm-qos-gate-attributes;
259                             }
260                         }
261                     }
262                 }
263             }
264         }
265     }
266
267     grouping gate-operational-attributes {
268         leaf gatePath {
269             config false;
270             type string;
271             description "FQ Gate path app/subscriber/gate";
272             mandatory true;
273         }
274         leaf ccapId {
275             config false;
276             type string;
277             description "CCAP Identity";
278             mandatory true;
279         }
280         leaf cops-gate-state {
281             config false;
282             type string;
283             description "Operational COPS Gate state";
284             mandatory true;
285         }
286         leaf cops-gate-time-info {
287             config false;
288             type string;
289             description "Operational COPS Gate time info";
290             mandatory true;
291         }
292         leaf cops-gate-usage-info {
293             config false;
294             type string;
295             description "Operational COPS gate usage info";
296             mandatory true;
297         }
298         leaf cops-gateId {
299             config false;
300             type string;
301             description "Gate operational COPS Id";
302             mandatory true;
303         }
304         leaf-list error {
305             config false;
306             type string;
307             description "Gate operational error";
308         }
309         leaf timestamp {
310             config false;
311             type yang:date-and-time;
312             description "Gate operational attributes timestamp";
313             mandatory true;
314         }
315     }
316
317
318     grouping classifier-attributes {
319         container classifiers {
320             list classifier-container {
321                 key "classifier-id";
322                 leaf classifier-id {
323                     type uint8;
324                     description "Classifier ID and Gate classifier priority";
325                 }
326                 choice classifier-choice {
327                     case qos-classifier-choice {
328                         uses pcmm-qos-classifier;
329                     }
330                     case ext-classifier-choice {
331                         uses pcmm-qos-ext-classifier;
332                     }
333                     case ipv6-classifier-choice {
334                         uses pcmm-qos-ipv6-classifier;
335                     }
336                 }
337             }
338         }
339     }
340
341     grouping pcmm-qos-gate-attributes {
342         uses pcmm-qos-gate-spec;
343         uses pcmm-qos-traffic-profile;
344         uses classifier-attributes;
345     }
346
347     grouping pcmm-qos-gate-spec {
348         container gate-spec {
349             leaf direction {
350                 type service-flow-direction;
351                 description "Gate Direction (ignored for traffic profile SCN)";
352             }
353             leaf dscp-tos-overwrite {
354                 type tos-byte;
355                 description "Optional DSCP/TOS overwrite value";
356             }
357             leaf dscp-tos-mask {
358                 type tos-byte;
359                 description "Optional DSCP/TOS overwrite AND mask";
360             }
361             leaf inactivity-timer {
362                 type uint32;
363                 description "Service Flow inactivity timeout";
364             }
365             leaf session-class-id {
366                 type uint8;
367                 description "Identifies the proper admission control policy or parameters to be applied for this Gate";
368                 default 0;
369             }
370         }
371     }
372
373     grouping pcmm-qos-traffic-profile {
374         container traffic-profile {
375             choice traffic-profile-choice {
376                 case ugs-choice {
377                     uses pcmm-ugs-profile;
378                 }
379                 case rtp-choice {
380                     uses pcmm-rtp-profile;
381                 }
382                 case service-class-name-choice {
383                     uses pcmm-serviceclass-name-profile;
384                 } 
385                 case flow-spec-choice {
386                     uses pcmm-flow-spec-profile;
387                 }
388             }
389         }
390     }
391     
392     grouping pcmm-serviceclass-name-profile {
393         container service-class-name-profile {
394             leaf service-class-name {
395                 type service-class-name;
396                 description "The Service Class Name (SCN). This SCN must be pre-provisioned on the target CCAP";
397                 mandatory true;
398             }
399         }
400     }
401
402     grouping pcmm-flow-spec-profile {
403         container flow-spec-profile {
404             leaf token-bucket-rate {
405                 type int32;
406                 description "Token Bucket Rate value [r]";
407                 mandatory true;
408             }
409             leaf token-bucket-size {
410                 type int32; 
411                 description "Token Bucket Size value [b]";
412                 mandatory true;
413             }
414             leaf peak-data-rate {
415                 type int32;
416                 description "Peak Data Rate value [p]";
417                 mandatory true;
418             } 
419             leaf minimum-policed-unit {
420                 type int32;
421                 description "Minimum Policed Unit value [m]";
422                 mandatory true;
423             }
424             leaf maximum-packet-size {
425                 type int32;
426                 description "Maximum Packet Size value [M]";
427                 mandatory true;
428             }
429             leaf rate {
430                 type int32;
431                 description "Rate value [R]";
432                 mandatory true;
433             }
434             leaf slack-term {
435                 type int32;
436                 description "Slack Term value [S]";
437                 mandatory true;
438             }
439         }
440     }
441     
442     grouping pcmm-ugs-profile {
443         container ugs-profile {
444             leaf request-transmission-policy {
445                 type uint32;
446                 description "Request Transmission Policy";
447                 mandatory true;
448             }
449             leaf unsolicited-grant-size {
450                 type uint32;
451                 description "Unsolicited Grant Size";
452                 mandatory true;
453             }
454             leaf grants-per-interval {
455                 type uint8;
456                 description "Grants per Interval";
457                 mandatory true;
458             }
459             leaf nominal-grant-interval {
460                 type uint32;
461                 description "Nominal Grant Interval";
462                 mandatory true;
463             } 
464             leaf tolerated-grant-jitter {
465                 type uint32;
466                 description "Tolerated Grant Jitter";
467                 mandatory true;
468             }
469             leaf upstream-peak-traffic-rate {
470                 type uint32;
471                 description "Upstream Peak Traffic Interval";
472                 mandatory true;
473             }
474             leaf required-attribute-mask {
475                 type uint32;
476                 description "Required Attribute Mask";
477                 mandatory true;
478             }
479             leaf forbidden-attribute-mask {
480                 type uint32;
481                 description "Forbidden Attribute Mask";
482                 mandatory true;
483             }
484             leaf attribute-aggregation-rule-mask {
485                 type uint32;
486                 description "Attribute Aggregation Rule Mask";
487                 mandatory true;
488             }
489             leaf minimum-buffer {
490                 type uint32;
491                 description "Minimum Buffer";
492             }
493             leaf target-buffer {
494                 type uint32;
495                 description "Forbidden Attribute Mask";
496             }
497             leaf maximum-buffer {
498                 type uint32;
499                 description "Forbidden Attribute Mask";
500             }
501         }
502     }
503
504     grouping pcmm-rtp-profile {
505         container rtp-profile {
506             leaf request-transmission-policy {
507                 type uint32;
508                 description "Request Transmission Policy";
509                 mandatory true;
510             }
511             leaf maximum-sustained-traffic-rate {
512                 type uint32;
513                 description "Maximum Sustained Traffic Rate";
514                 default 0;
515             }
516             leaf maximum-traffic-burst {
517                 type uint32;
518                 description "Maximum Traffic Burst";
519                 default 3044;
520             }
521             leaf minimum-reserved-traffic-rate {
522                 type uint32;
523                 description "Minimum Reserved Traffic Rate";
524                 default 0;
525             }
526             leaf amrtr-packet-size {
527                 type uint16;
528                 description "Assumed Minimum Reserved Traffic Rate Packet Size";
529                 default 0;
530             }
531             leaf maximum-concatenated-burst {
532                 type uint16;
533                 description "Maximum Concatenated Burst";
534                 default 1522;
535             }
536             leaf nominal-polling-interval {
537                 type uint32;
538                 description "Nominal Polling Interval";
539                 mandatory true;
540             }
541             leaf tolerated-poll-jitter {
542                 type uint32;
543                 description "Tolerated Poll Jitter";
544                 default 0;
545             }
546             leaf upstream-peak-traffic-rate {
547                 type uint32;
548                 description "Upstream Peak Traffic Rate";
549                 mandatory true;
550             }
551             leaf required-attribute-mask {
552                 type uint32;
553                 description "Required Attribute Mask";
554                 mandatory true;
555             }
556             leaf forbidden-attribute-mask {
557                 type uint32;
558                 description "Forbidden Attribute Mask";
559                 mandatory true;
560             }
561             leaf attribute-aggregation-rule-mask {
562                 type uint32;
563                 description "Attribute Aggregation Rule Mask";
564                 mandatory true;
565             }
566             leaf minimum-buffer {
567                 type uint32;
568                 description "Minimum Buffer";
569             }
570             leaf target-buffer {
571                 type uint32;
572                 description "Forbidden Attribute Mask";
573             }
574             leaf maximum-buffer {
575                 type uint32;
576                 description "Forbidden Attribute Mask";
577             }
578         }
579     }
580
581     grouping tp-port-match-ranges {
582         leaf srcPort-start {
583             type inet:port-number;
584             description "TCP/UDP source port range start.";
585             mandatory true;
586         }
587         leaf srcPort-end {
588             type inet:port-number;
589             description "TCP/UDP source port range end.";
590             mandatory true;
591         }
592         leaf dstPort-start {
593             type inet:port-number;
594             description "TCP/UDP destination port range start.";
595             mandatory true;
596         }
597         leaf dstPort-end {
598             type inet:port-number;
599             description "TCP/UDP destination port range end.";
600             mandatory true;
601         }
602     }
603
604     grouping pcmm-qos-classifier {
605         container classifier {
606             leaf srcIp {
607                 type inet:ipv4-address;
608                 description "Source IPv4 address (exact match)";
609                 mandatory true;
610             }
611             leaf dstIp {
612                 type inet:ipv4-address;
613                 description "Destination IPv4 address (exact match)";
614                 mandatory true;
615             }
616             leaf tos-byte {
617                 type tos-byte;
618                 description "TOS/DSCP match";
619                 mandatory true;
620             }
621             leaf tos-mask {
622                 type tos-byte;
623                 description "TOS/DSCP mask";
624                 mandatory true;
625             }
626             leaf protocol {
627                 type tp-protocol;
628                 description "IPv4 transport protocol";
629                 mandatory true;
630             }
631             leaf srcPort {
632                 type inet:port-number;
633                 description "TCP/UDP source port (exact match).";
634                 mandatory true;
635             }
636             leaf dstPort {
637                 type inet:port-number;
638                 description "TCP/UDP destination port (exact match).";
639                 mandatory true;
640             }
641             leaf priority {
642                 type uint8;
643                 description "Priority";
644                 default 64;
645             }
646         }
647     }
648
649     grouping pcmm-qos-ext-classifier {
650         container ext-classifier {
651             leaf srcIp {
652                 type inet:ipv4-address;
653                 description "Source IPv4 address match";
654                 mandatory true;
655             }
656             leaf srcIpMask {
657                 type inet:ipv4-address;
658                 description "Source IPv4 mask";
659                 mandatory true;
660             }
661             leaf dstIp {
662                 type inet:ipv4-address;
663                 description "Destination IPv4 address match";
664                 mandatory true;
665             }
666             leaf dstIpMask {
667                 type inet:ipv4-address;
668                 description "Destination IPv4 mask";
669                 mandatory true;
670             }
671             leaf tos-byte {
672                 type tos-byte;
673                 description "TOS/DSCP match";
674                 mandatory true;
675             }
676             leaf tos-mask {
677                 type tos-byte;
678                 description "TOS/DSCP mask";
679                 mandatory true;
680             }
681             leaf protocol {
682                 type tp-protocol;
683                 description "IPv4 transport protocol";
684                 mandatory true;
685             }
686             leaf priority {
687                 type uint8;
688                 description "Priority";
689                 default 64;
690             }
691             uses tp-port-match-ranges;
692             leaf activation-state {
693                 type classifier-activation-state;
694                 description "Activation state";
695                 default active;
696             }
697             leaf action {
698                 type classifier-action;
699                 description "Action";
700                 default add;
701             }
702         }
703     }
704
705     grouping pcmm-qos-ipv6-classifier {
706         container ipv6-classifier {
707             leaf srcIp6 {
708                 type inet:ipv6-prefix;
709                 description "Source IPv6 prefix match in  'address/len' notation";
710                 mandatory true;
711             }
712             leaf dstIp6 {
713                 type inet:ipv6-prefix;
714                 description "Destination IPv6 prefix match in 'address/len' notation";
715                 mandatory true;
716             }
717             leaf tc-low {
718                 type tos-byte;
719                 description "TC low range match";
720                 mandatory true;
721             }
722             leaf tc-high {
723                 type tos-byte;
724                 description "TC high range match";
725                 mandatory true;
726             }
727             leaf tc-mask {
728                 type tos-byte;
729                 description "TC mask";
730                 mandatory true;
731             }
732             leaf next-hdr {
733                 type tp-protocol;
734                 description "IPv6 Next Header";
735                 mandatory true;
736             }
737             leaf flow-label {
738                 type uint32 {
739                     range "0 .. 1048575";
740                 }
741                 description "IPv6 Flow Label (20 bits)";
742                 mandatory true;
743             }
744             leaf priority {
745                 type uint8;
746                 description "Priority";
747                 default 64;
748             }
749             uses tp-port-match-ranges;
750             leaf activation-state {
751                 type classifier-activation-state;
752                 description "Activation state";
753                 default active;
754             }
755             leaf action {
756                 type classifier-action;
757                 description "Action";
758                 default add;
759             }
760         }
761     }
762
763     //RPCs
764     rpc ccap-set-connection {
765         input {
766             leaf ccapId {
767                 type "instance-identifier";
768                 ext:context-reference "ccap-context";
769             }
770             container connection {
771                 leaf connected {
772                     type boolean;
773                     description "COPS session state";
774                 }
775             }
776         }
777         output {
778             container ccap {
779                 leaf ccapId {
780                     type string;
781                 }
782                 container connection {
783                     uses ccap-connection;
784                 }
785             }
786             leaf response {
787                 type string;
788             }
789             leaf timestamp {
790                 type yang:date-and-time;
791                 description "RPC timestamp";
792             }
793         }
794     }
795     
796     rpc ccap-poll-connection {
797         input {
798             leaf ccapId {
799                 type "instance-identifier";
800                 ext:context-reference "ccap-context";
801             }
802         }
803         output {
804             container ccap {
805                 leaf ccapId {
806                     type string;
807                 }
808                 container connection {
809                     uses ccap-connection;
810                 }
811             }
812             leaf response {
813                 type string;
814             }
815             leaf timestamp {
816                 type yang:date-and-time;
817                 description "RPC timestamp";
818             }
819         }
820     }
821
822     rpc qos-poll-gates {
823         input {
824             leaf appId {
825                 type instance-identifier;
826                 ext:context-reference app-context;
827             }
828             leaf subscriberId {
829                 type string;
830                 description "Subscriber Identity -- must be a CM or CPE IP address";
831             }
832             leaf gateId {
833                 type string;
834                 description "Qos Gate Identity";
835             }
836         }
837         output {
838             container gate {
839                 uses gate-operational-attributes;
840             }
841             leaf response {
842                 type string;
843             }
844             leaf timestamp {
845                 type yang:date-and-time;
846                 description "RPC timestamp";
847             }
848         }
849     }
850 }