Added GateInfo to Op Ds and RPCs to support gate update requests
[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             mandatory true;
323         }
324         leaf srcPort-end {
325             type inet:port-number;
326             description "TCP/UDP source port range end.";
327             mandatory true;
328         }
329         leaf dstPort-start {
330             type inet:port-number;
331             description "TCP/UDP destination port range start.";
332             mandatory true;
333         }
334         leaf dstPort-end {
335             type inet:port-number;
336             description "TCP/UDP destination port range end.";
337             mandatory true;
338         }
339     }
340
341     grouping pcmm-qos-classifier {
342         container classifier {
343             leaf srcIp {
344                 type inet:ipv4-address;
345                 description "Source IPv4 address (exact match)";
346                 mandatory true;
347             }
348             leaf dstIp {
349                 type inet:ipv4-address;
350                 description "Destination IPv4 address (exact match)";
351                 mandatory true;
352             }
353              leaf tos-byte {
354                  type tos-byte;
355                  description "TOS/DSCP match";
356                  mandatory true;
357              }
358              leaf tos-mask {
359                  type tos-byte;
360                  description "TOS/DSCP mask";
361                  mandatory true;
362              }
363              leaf protocol {
364                 type tp-protocol;
365                 description "IPv4 transport protocol";
366                 mandatory true;
367             }
368              leaf srcPort {
369                 type inet:port-number;
370                 description "TCP/UDP source port (exact match).";
371                 mandatory true;
372                }
373              leaf dstPort {
374                 type inet:port-number;
375                 description "TCP/UDP destination port (exact match).";
376                 mandatory true;
377                }
378            }
379     }
380
381     grouping pcmm-qos-ext-classifier {
382         container ext-classifier {
383             leaf srcIp {
384                 type inet:ipv4-address;
385                 description "Source IPv4 address match";
386                 mandatory true;
387             }
388             leaf srcIpMask {
389                 type inet:ipv4-address;
390                 description "Source IPv4 mask";
391                 mandatory true;
392             }
393             leaf dstIp {
394                 type inet:ipv4-address;
395                 description "Destination IPv4 address match";
396                 mandatory true;
397             }
398             leaf dstIpMask {
399                 type inet:ipv4-address;
400                 description "Destination IPv4 mask";
401                 mandatory true;
402             }
403              leaf tos-byte {
404                  type tos-byte;
405                  description "TOS/DSCP match";
406                  mandatory true;
407              }
408              leaf tos-mask {
409                  type tos-byte;
410                  description "TOS/DSCP mask";
411                  mandatory true;
412              }
413              leaf protocol {
414                 type tp-protocol;
415                 description "IPv4 transport protocol";
416                 mandatory true;
417             }
418             uses tp-port-match-ranges;
419            }
420     }
421
422     grouping pcmm-qos-ipv6-classifier {
423         container ipv6-classifier {
424             leaf srcIp6 {
425                 type inet:ipv6-prefix;
426                 description "Source IPv6 prefix match in  'address/len' notation";
427                 mandatory true;
428             }
429             leaf dstIp6 {
430                 type inet:ipv6-prefix;
431                 description "Destination IPv6 prefix match in 'address/len' notation";
432                 mandatory true;
433             }
434              leaf tc-low {
435                  type tos-byte;
436                  description "TC low range match";
437                  mandatory true;
438              }
439              leaf tc-high {
440                  type tos-byte;
441                  description "TC high range match";
442                  mandatory true;
443              }
444              leaf tc-mask {
445                  type tos-byte;
446                  description "TC mask";
447                  mandatory true;
448              }
449              leaf next-hdr {
450                 type tp-protocol;
451                 description "IPv6 Next Header";
452                 mandatory true;
453             }
454             leaf flow-label {
455                 type uint32 {
456                     range "0 .. 1048575";
457                 }
458                 description "IPv6 Flow Label (20 bits)";
459                 mandatory true;
460             }
461                uses tp-port-match-ranges;
462            }
463     }
464
465             //RPCs
466     rpc ccap-set-connection {
467                 input {
468             leaf ccapId {
469                         type instance-identifier;
470                         ext:context-reference ccap-context;
471                 }
472                 container connection {
473                         leaf connected {
474                                 type boolean;
475                                 description "COPS session state";
476                         }
477 //                      leaf idle-detect {
478 //                                      type uint8;             
479 //                                      description "COPS connection idle timer";
480 //                              }
481                 }
482          }
483          output {
484                 container ccap {
485                         leaf ccapId {
486                                 type string;
487                         }
488                         container connection {
489                                         uses ccap-connection;
490                                 }
491                 }
492                 leaf response {
493                         type string;
494                 }
495                         leaf timestamp {
496                         type yang:date-and-time;
497                                 description "RPC timestamp";
498                 }
499          }
500     }
501     
502     rpc ccap-poll-connection {
503                 input {
504             leaf ccapId {
505                         type instance-identifier;
506                         ext:context-reference ccap-context;
507                 }
508          }
509          output {
510                 container ccap {
511                         leaf ccapId {
512                                 type string;
513                         }
514                         container connection {
515                                         uses ccap-connection;
516                                 }
517                 }
518                 leaf response {
519                         type string;
520                 }
521                         leaf timestamp {
522                         type yang:date-and-time;
523                                 description "RPC timestamp";
524                 }
525          }
526     }
527
528         rpc qos-poll-gates {
529                 input {
530             leaf appId {
531                 type instance-identifier;
532                         ext:context-reference app-context;
533                 }
534                 leaf subscriberId {
535                 type string;
536                 description "Subscriber Identity -- must be a CM or CPE IP address";
537                 }
538                 leaf gateId {
539                 type string;
540                 description "Qos Gate Identity";
541                 }
542          }
543          output {
544                         container gate {
545                                 uses gate-operational-attributes;
546                         }
547                         leaf response {
548                         type string;
549                 }
550                         leaf timestamp {
551                         type yang:date-and-time;
552                         description "RPC timestamp";
553                 }
554          }
555     }
556 }