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