aad1e55b6a89c528aeb61d03af5badc7e91504c0
[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 2016-12-19 {
14         description "Added support for flow-spec traffic profile";
15     }
16     revision 2016-11-28 {
17         description "Added support for activation-state, session-class-id and inactivity-timer";
18     }
19     revision 2016-11-07 {
20         description "Added priority field to all classifiers";
21     }
22     revision 2016-10-17 {
23         description "Modified service-flow-direction values to match the PCMM Spec";
24     }
25     revision 2015-11-01 {
26         description "Extended gates to support multiple classifiers.";
27     }
28     revision 2015-10-26 {
29         description "Corrected pluralization of containers/lists and added containers around lists where needed";
30     }
31     revision 2015-03-27 {
32         description "Initial revision of PCMM CCAP definitions";
33     }
34
35
36     // Global typedefs
37     typedef service-class-name {
38         type string { length "2..16"; }
39         description "The Service Class Name is MUST be 2-16 bytes.";
40     }
41     typedef service-flow-direction {
42         type enumeration {
43               enum ds {
44                 value "0";
45                 description "Downstream service flow.";
46               }
47               enum us {
48                 value "1";
49                 description "Upstream service flow.";
50               }
51           }
52         description "This value represents the service flow direction.";
53       }
54     
55       typedef classifier-activation-state {
56         type enumeration {
57           enum inactive {
58             value 0;
59             description "Inactive";
60           }
61           enum active {
62             value 1;
63             description "Active";
64           }
65         }
66         description "Instructs the CMTS to either activate or inactivate the classifier";
67       }
68      
69
70      typedef tp-protocol {
71          type uint16 {range "0..257";}
72         description "This value represents the IP transport protocol (or Next Header) where 256 is any protocol and 257 is TCP or UDP";
73      }
74      typedef tos-byte {
75          type uint8;
76          description "TOS/TC byte or mask";
77      }
78
79     identity ccap-context {
80         description "Identity used to mark ccap context";
81     }
82
83     identity app-context {
84         description "Identity used to mark app context";
85     }
86
87     // CCAP devices
88     container ccaps {
89         list ccap {
90             description "
91                 CCAP devices are known by their network name which is any string.
92                 Each CCAP device has a network address:port, a list of subscriber IP subnets,
93                 and a list of available Service Class Names.
94                 ";
95             key "ccapId";
96             ext:context-instance "ccap-context";
97             leaf ccapId {
98                 type string;
99                 description "CCAP Identity";
100                 mandatory true;
101             }
102             uses ccap-attributes;
103         }
104     }
105
106     grouping ccap-connection {
107          leaf ipAddress {
108                type inet:ip-address;
109                description "IP Address of CCAP";
110                mandatory true;
111            }
112            leaf port {
113                type inet:port-number;
114             description "COPS session TCP port number";
115              default 3918;
116         }
117         leaf connected {
118             config false;
119             type boolean;
120             description "COPS session state";
121             mandatory true;
122         }
123         leaf-list error {
124             config false;
125             type string;
126             description "Operational errors";
127         }
128 //        leaf idle-detect {
129 //            type uint8;
130 //            description "COPS connection idle timer (seconds)";
131 //          mandatory true;
132 //        }
133 //        leaf isIdle {
134 //            config false;
135 //            type boolean;
136 //            description "COPS connection idle state";
137 //          mandatory true;
138 //        }
139
140         leaf timestamp {
141             config false;
142             type yang:date-and-time;
143             description "Last update timestamp";
144             mandatory true;
145         }
146     }
147
148     grouping ccap-attributes {
149         description "
150             Each CCAP device has a COPS connection address:port,
151             a list of subscriber IP subnets, and
152             a list of available Service Class Names.
153             ";
154         container connection {
155             uses ccap-connection;
156         }
157         container amId {
158             leaf am-tag {
159                 type uint16;
160                 description "Application Manager Tag -- unique for this operator";
161                 mandatory true;
162             }
163             leaf am-type {
164                  type uint16;
165                 description "Application Manager Type -- unique for this AM tag";
166                 mandatory true;
167             }
168         }
169         leaf-list subscriber-subnets {
170             type inet:ip-prefix;
171         }
172         leaf-list upstream-scns {
173             type service-class-name;
174         }
175         leaf-list downstream-scns {
176             type service-class-name;
177         }
178         leaf-list error {
179             config false;
180             type string;
181             description "ccap data errors";
182         }
183     }
184
185     // PCMM QoS Gates
186     container qos {
187         description "
188             PCMM QoS Gates are organized as a tree by Application/Subscriber/Gate:
189                 Each Application is known by its appId which is any string.
190                 Each Subscriber is known by its subscriberId which is a CPE IP address in either IPv4 or IPv6 format.
191                 Each Gate is known by its gateId which is any string.
192
193             The subscriber's CPE IP address is used to locate the CCAP device that is currently hosting the
194             the Cable Modem that is connected to the subscriber's device. Therefore, it is not necessary
195             for the PCMM applications to know the topology of the CCAP devices and CMs in the network path
196             to their subscriber devices.
197
198             Note that each CCAP entry contains a list of connected subscriber IP subnets as well as a list
199             of all Service Class Names (SCNs) available on the CCAP device.
200             ";
201         uses pcmm-qos-gates;
202     }
203
204     grouping pcmm-qos-gates {
205         container apps {
206             list app {
207                 key "appId";
208                 ext:context-instance "app-context";
209                 leaf appId {
210                     type string;
211                     description "Application Identity";
212                 }
213                 container subscribers {
214                     list subscriber {
215                         key "subscriberId";
216                         leaf subscriberId {
217                             type string;
218                             description "Subscriber Identity -- must be a CM or CPE IP address";
219                             mandatory true;
220                         }
221                         container gates {
222                             list gate {
223                                 key "gateId";
224                                 leaf gateId {
225                                     type string;
226                                     description "Qos Gate Identity";
227                                     mandatory true;
228                                 }
229                                 uses gate-operational-attributes;
230                                 uses pcmm-qos-gate-attributes;
231                             }
232                         }
233                     }
234                 }
235             }
236         }
237     }
238
239     grouping gate-operational-attributes {
240                 leaf gatePath {
241                         config false;
242                     type string;
243                     description "FQ Gate path app/subscriber/gate";
244                     mandatory true;
245                 }
246                 leaf ccapId {
247                         config false;
248                     type string;
249                     description "CCAP Identity";
250                     mandatory true;
251                 }
252                 leaf cops-gate-state {
253                         config false;
254                         type string;
255                         description "Operational COPS Gate state";
256                         mandatory true;
257                 }
258                 leaf cops-gate-time-info {
259                         config false;
260                         type string;
261                         description "Operational COPS Gate time info";
262                         mandatory true;
263                 }
264                 leaf cops-gate-usage-info {
265           config false;
266           type string;
267           description "Operational COPS gate usage info";
268           mandatory true;
269         }
270         leaf cops-gateId {
271             config false;
272             type string;
273             description "Gate operational COPS Id";
274             mandatory true;
275         }
276         leaf-list error {
277             config false;
278             type string;
279             description "Gate operational error";
280         }
281         leaf timestamp {
282             config false;
283             type yang:date-and-time;
284             description "Gate operational attributes timestamp";
285             mandatory true;
286         }
287     }
288
289
290     grouping classifier-attributes {
291         container classifiers {
292             list classifier-container {
293                 key "classifier-id";
294                 leaf classifier-id {
295                     type uint8;
296                     description "Classifier ID and Gate classifier priority";
297                 }
298                    choice classifier-choice {
299                       case qos-classifier-choice {
300                         uses pcmm-qos-classifier;
301                     }
302                     case ext-classifier-choice {
303                         uses pcmm-qos-ext-classifier;
304                      }
305                      case ipv6-classifier-choice {
306                          uses pcmm-qos-ipv6-classifier;
307                      }
308                  }
309              }
310         }
311     }
312
313     grouping pcmm-qos-gate-attributes {
314          uses pcmm-qos-gate-spec;
315          uses pcmm-qos-traffic-profile;
316          uses classifier-attributes;
317     }
318
319     grouping pcmm-qos-gate-spec {
320         container gate-spec {
321             leaf direction {
322                 type service-flow-direction;
323                 description "Gate Direction (ignored for traffic profile SCN)";
324             }
325             leaf dscp-tos-overwrite {
326                 type tos-byte;
327                 description "Optional DSCP/TOS overwrite value";
328             }
329             leaf dscp-tos-mask {
330                 type tos-byte;
331                 description "Optional DSCP/TOS overwrite AND mask";
332             }
333             leaf inactivity-timer {
334                 type uint32;
335                 description "Service Flow inactivity timeout";
336             }
337             leaf session-class-id {
338                 type uint8;
339                 description "Identifies the proper admission control policy or parameters to be applied for this Gate";
340                 default 0;
341             }
342         }
343     }
344
345     grouping pcmm-qos-traffic-profile {
346         container traffic-profile {
347             choice traffic-profile-choice {
348                 case service-class-name-choice {
349                     uses pcmm-serviceclass-name-profile;
350                 } 
351                 case flow-spec-choice {
352                     uses pcmm-flow-spec-profile;
353                 }
354             }
355         }
356     }
357     
358   grouping pcmm-serviceclass-name-profile {
359     container service-class-name-profile {
360             leaf service-class-name {
361                 type service-class-name;
362                 description "The Service Class Name (SCN). This SCN must be pre-provisioned on the target CCAP";
363                 mandatory true;
364             }
365         }
366     }
367
368   grouping pcmm-flow-spec-profile {
369     container flow-spec-profile {
370       leaf token-bucket-rate {
371         type int32;
372         description "Token Bucket Rate value [r]";
373         mandatory true;
374       }
375       leaf token-bucket-size {
376         type int32; 
377         description "Token Bucket Size value [b]";
378         mandatory true;
379       }
380       leaf peak-data-rate {
381         type int32;
382         description "Peak Data Rate value [p]";
383         mandatory true;
384       } 
385       leaf minimum-policed-unit {
386         type int32;
387         description "Minimum Policed Unit value [m]";
388         mandatory true;
389       }
390       leaf maximum-packet-size {
391         type int32;
392         description "Maximum Packet Size value [M]";
393         mandatory true;
394       }
395       leaf rate {
396         type int32;
397         description "Rate value [R]";
398         mandatory true;
399       }
400       leaf slack-term {
401         type int32;
402         description "Slack Term value [S]";
403         mandatory true;
404       }
405     }
406   }
407     
408   grouping tp-port-match-ranges {
409         leaf srcPort-start {
410             type inet:port-number;
411             description "TCP/UDP source port range start.";
412         }
413         leaf srcPort-end {
414             type inet:port-number;
415             description "TCP/UDP source port range end.";
416         }
417         leaf dstPort-start {
418             type inet:port-number;
419             description "TCP/UDP destination port range start.";
420         }
421         leaf dstPort-end {
422             type inet:port-number;
423             description "TCP/UDP destination port range end.";
424         }
425     }
426
427     grouping pcmm-qos-classifier {
428         container classifier {
429             leaf srcIp {
430                 type inet:ipv4-address;
431                 description "Source IPv4 address (exact match)";
432             }
433             leaf dstIp {
434                 type inet:ipv4-address;
435                 description "Destination IPv4 address (exact match)";
436             }
437              leaf tos-byte {
438                  type tos-byte;
439                  description "TOS/DSCP match";
440              }
441              leaf tos-mask {
442                  type tos-byte;
443                  description "TOS/DSCP mask";
444              }
445              leaf protocol {
446                 type tp-protocol;
447                 description "IPv4 transport protocol";
448             }
449              leaf srcPort {
450                 type inet:port-number;
451                 description "TCP/UDP source port (exact match).";
452                }
453              leaf dstPort {
454                 type inet:port-number;
455                 description "TCP/UDP destination port (exact match).";
456                }
457              leaf priority {
458                type uint8;
459                description "Priority";
460                default 64;
461              }
462            }
463     }
464
465     grouping pcmm-qos-ext-classifier {
466         container ext-classifier {
467             leaf srcIp {
468                 type inet:ipv4-address;
469                 description "Source IPv4 address match";
470             }
471             leaf srcIpMask {
472                 type inet:ipv4-address;
473                 description "Source IPv4 mask";
474             }
475             leaf dstIp {
476                 type inet:ipv4-address;
477                 description "Destination IPv4 address match";
478             }
479             leaf dstIpMask {
480                 type inet:ipv4-address;
481                 description "Destination IPv4 mask";
482             }
483              leaf tos-byte {
484                  type tos-byte;
485                  description "TOS/DSCP match";
486              }
487              leaf tos-mask {
488                  type tos-byte;
489                  description "TOS/DSCP mask";
490              }
491              leaf protocol {
492                 type tp-protocol;
493                 description "IPv4 transport protocol";
494             }
495             uses tp-port-match-ranges;
496             leaf priority {
497               type uint8;
498               description "Priority";
499               default 64;
500             }
501             leaf activation-state {
502               type classifier-activation-state;
503               description "Activation state";
504               default active;
505             }
506
507            }
508     }
509
510     grouping pcmm-qos-ipv6-classifier {
511         container ipv6-classifier {
512             leaf srcIp6 {
513                 type inet:ipv6-prefix;
514                 description "Source IPv6 prefix match in  'address/len' notation";
515             }
516             leaf dstIp6 {
517                 type inet:ipv6-prefix;
518                 description "Destination IPv6 prefix match in 'address/len' notation";
519             }
520              leaf tc-low {
521                  type tos-byte;
522                  description "TC low range match";
523              }
524              leaf tc-high {
525                  type tos-byte;
526                  description "TC high range match";
527              }
528              leaf tc-mask {
529                  type tos-byte;
530                  description "TC mask";
531              }
532              leaf next-hdr {
533                 type tp-protocol;
534                 description "IPv6 Next Header";
535             }
536             leaf flow-label {
537                 type uint32 {
538                     range "0 .. 1048575";
539                 }
540                 description "IPv6 Flow Label (20 bits)";
541             }
542             uses tp-port-match-ranges;
543             leaf priority {
544               type uint8;
545               description "Priority";
546               default 64;
547             }
548             leaf activation-state {
549               type classifier-activation-state;
550               description "Activation state";
551               default active;
552             }
553            }
554     }
555
556             //RPCs
557     rpc ccap-set-connection {
558                 input {
559             leaf ccapId {
560                         type instance-identifier;
561                         ext:context-reference ccap-context;
562                 }
563                 container connection {
564                         leaf connected {
565                                 type boolean;
566                                 description "COPS session state";
567                         }
568 //                      leaf idle-detect {
569 //                                      type uint8;             
570 //                                      description "COPS connection idle timer";
571 //                              }
572                 }
573          }
574          output {
575                 container ccap {
576                         leaf ccapId {
577                                 type string;
578                         }
579                         container connection {
580                                         uses ccap-connection;
581                                 }
582                 }
583                 leaf response {
584                         type string;
585                 }
586                         leaf timestamp {
587                         type yang:date-and-time;
588                                 description "RPC timestamp";
589                 }
590          }
591     }
592     
593     rpc ccap-poll-connection {
594                 input {
595             leaf ccapId {
596                         type instance-identifier;
597                         ext:context-reference ccap-context;
598                 }
599          }
600          output {
601                 container ccap {
602                         leaf ccapId {
603                                 type string;
604                         }
605                         container connection {
606                                         uses ccap-connection;
607                                 }
608                 }
609                 leaf response {
610                         type string;
611                 }
612                         leaf timestamp {
613                         type yang:date-and-time;
614                                 description "RPC timestamp";
615                 }
616          }
617     }
618
619         rpc qos-poll-gates {
620                 input {
621             leaf appId {
622                 type instance-identifier;
623                         ext:context-reference app-context;
624                 }
625                 leaf subscriberId {
626                 type string;
627                 description "Subscriber Identity -- must be a CM or CPE IP address";
628                 }
629                 leaf gateId {
630                 type string;
631                 description "Qos Gate Identity";
632                 }
633          }
634          output {
635                         container gate {
636                                 uses gate-operational-attributes;
637                         }
638                         leaf response {
639                         type string;
640                 }
641                         leaf timestamp {
642                         type yang:date-and-time;
643                         description "RPC timestamp";
644                 }
645          }
646     }
647 }