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