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