Updated model yang file to use recommended practices found on wiki, then updated...
[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; }
7     import ietf-inet-types      { prefix inet; }
8
9     description "This module contains the PCMM Converged Cable Access Platform (CCAP) definitions";
10     organization "OpenDaylight Project";
11         
12     revision 2015-10-26 {
13         description "Corrected pluralization of containers/lists and added containers around lists where needed";
14     }
15     revision 2015-03-27 {
16         description "Initial revision of PCMM CCAP definitions";
17     }
18
19
20         // Global typedefs
21         typedef service-class-name {
22         type string { length "2..16"; }
23         description "The Service Class Name is MUST be 2-16 bytes.";
24     }
25     typedef service-flow-direction {
26             type enumeration {
27                       enum us {
28                         value "1";
29                         description "Upstream service flow.";
30                       }
31                       enum ds {
32                         value "2";
33                         description "Downstream service flow.";
34                       }
35                 }
36         description "This value represents the service flow direction.";
37         }
38         typedef tp-protocol {
39                 type uint16 {range "0..257";}
40             description "This value represents the IP transport protocol (or Next Header) where 256 is any protocol and 257 is TCP or UDP";
41          }
42          typedef tos-byte {
43                 type uint8;
44                 description "TOS/TC byte or mask";
45          }
46
47
48         // CCAP devices
49         container ccaps {
50                 list ccap {
51                         description "
52                                 CCAP devices are known by their network name which is any string.
53                                 Each CCAP device has a network address:port, a list of subscriber IP subnets,
54                                 and a list of available Service Class Names.
55                                 ";
56                     key "ccapId";
57                         leaf ccapId {
58                             type string;
59                                 description "CCAP Identity";
60                             }
61                     uses ccap-attributes;
62             }
63     }
64
65         grouping ccap-attributes {
66                 description "
67                         Each CCAP device has a COPS connection address:port,
68                         a list of subscriber IP subnets, and
69                         a list of available Service Class Names.
70                         ";
71                 container connection {
72                         leaf ipAddress {
73                         type inet:ip-address;
74                         description "IP Address of CCAP";
75                 }
76                 leaf port {
77                         type inet:port-number;
78                         description "COPS session TCP port number";
79                         default 3918;
80                 }
81         }
82         container amId {
83                 leaf am-tag {
84                         type uint16;
85                         description "Application Manager Tag -- unique for this operator";
86                 }
87                 leaf am-type {
88                         type uint16;
89                         description "Application Manager Type -- unique for this AM tag";
90                 }
91         }
92                 leaf-list subscriber-subnets {
93                         type inet:ip-prefix;
94                 }
95                 leaf-list upstream-scns {
96                         type service-class-name;
97                 }
98                 leaf-list downstream-scns {
99                         type service-class-name;
100                 }
101         }
102
103         // PCMM QoS Gates
104     container qos {
105         description "
106                 PCMM QoS Gates are organized as a tree by Application/Subscriber/Gate:
107                         Each Application is known by its appId which is any string.
108                         Each Subscriber is known by its subId which is a CPE IP address in either IPv4 or IPv6 format.
109                         Each Gate is known by its gateId which is any string.
110
111                 The subscriber's CPE IP address is used to locate the CCAP device that is currently hosting the
112                 the Cable Modem that is connected to the subscriber's device. Therefore, it is not necessary
113                 for the PCMM applications to know the topology of the CCAP devices and CMs in the network path
114                 to their subscriber devices.
115
116                 Note that each CCAP entry contains a list of connected subscriber IP subnets as well as a list
117                 of all Service Class Names (SCNs) available on the CCAP device.
118                 ";
119                 uses pcmm-qos-gates;
120     }
121
122     grouping pcmm-qos-gates {
123         container apps {
124                 list app {
125                     key "appId";
126                             leaf appId {
127                                 type string;
128                                 description "Application Identity";
129                             }
130                             container subscribers {
131                             list subscriber {
132                                 key "subscriberId";
133                                             leaf subscriberId {
134                                             type string;
135                                                 description "Subscriber Identity -- must be a CM or CPE IP address";
136                                             }
137                                             container gates {
138                                             list gate {
139                                                 key "gateId";
140                                                             leaf gateId {
141                                                                 type string;
142                                                                 description "Qos Gate Identity";
143                                                             }
144                                                             uses pcmm-qos-gate-attributes;
145                                             }
146                                             }
147                             }
148                             }
149                 }
150         }
151     }
152
153     grouping pcmm-qos-gate-attributes {
154         uses pcmm-qos-gate-spec;
155         uses pcmm-qos-traffic-profile;
156                 uses pcmm-qos-classifier;
157                 uses pcmm-qos-ext-classifier;
158                 uses pcmm-qos-ipv6-classifier;
159     }
160
161     grouping pcmm-qos-gate-spec {
162         container gate-spec {
163                         leaf direction {
164                                 type service-flow-direction;
165                                 description "Gate Direction (ignored for traffic profile SCN)";
166                         }
167                         leaf dscp-tos-overwrite {
168                                 type tos-byte;
169                                 description "Optional DSCP/TOS overwrite value";
170                         }
171                         leaf dscp-tos-mask {
172                                 type tos-byte;
173                                 description "Optional DSCP/TOS overwrite AND mask";
174                         }
175                 }
176     }
177
178     grouping pcmm-qos-traffic-profile {
179         container traffic-profile {
180                     leaf service-class-name {
181                         type service-class-name;
182                         description "The Service Class Name (SCN). This SCN must be pre-provisioned on the target CCAP";
183                     }
184                 }
185     }
186
187     grouping tp-port-match-ranges {
188         leaf srcPort-start {
189             type inet:port-number;
190             description "TCP/UDP source port range start.";
191         }
192         leaf srcPort-end {
193             type inet:port-number;
194             description "TCP/UDP source port range end.";
195         }
196         leaf dstPort-start {
197             type inet:port-number;
198             description "TCP/UDP destination port range start.";
199         }
200         leaf dstPort-end {
201             type inet:port-number;
202             description "TCP/UDP destination port range end.";
203         }
204     }
205
206     grouping pcmm-qos-classifier {
207         container classifier {
208                 leaf srcIp {
209                         type inet:ipv4-address;
210                         description "Source IPv4 address (exact match)";
211                         }
212                 leaf dstIp {
213                         type inet:ipv4-address;
214                         description "Destination IPv4 address (exact match)";
215                         }
216                         leaf tos-byte {
217                                 type tos-byte;
218                                 description "TOS/DSCP match";
219                         }
220                         leaf tos-mask {
221                                 type tos-byte;
222                                 description "TOS/DSCP mask";
223                         }
224                 leaf protocol {
225                         type tp-protocol;
226                         description "IPv4 transport protocol";
227                         }
228                         leaf srcPort {
229                         type inet:port-number;
230                         description "TCP/UDP source port (exact match).";
231                         }
232                         leaf dstPort {
233                         type inet:port-number;
234                         description "TCP/UDP destination port (exact match).";
235                         }
236                 }
237     }
238
239     grouping pcmm-qos-ext-classifier {
240         container ext-classifier {
241                 leaf srcIp {
242                         type inet:ipv4-address;
243                         description "Source IPv4 address match";
244                         }
245                 leaf srcIpMask {
246                         type inet:ipv4-address;
247                         description "Source IPv4 mask";
248                         }
249                 leaf dstIp {
250                         type inet:ipv4-address;
251                         description "Destination IPv4 address match";
252                         }
253                 leaf dstIpMask {
254                         type inet:ipv4-address;
255                         description "Destination IPv4 mask";
256                         }
257                         leaf tos-byte {
258                                 type tos-byte;
259                                 description "TOS/DSCP match";
260                         }
261                         leaf tos-mask {
262                                 type tos-byte;
263                                 description "TOS/DSCP mask";
264                         }
265                 leaf protocol {
266                         type tp-protocol;
267                         description "IPv4 transport protocol";
268                         }
269                         uses tp-port-match-ranges;
270                 }
271     }
272
273     grouping pcmm-qos-ipv6-classifier {
274         container ipv6-classifier {
275                 leaf srcIp6 {
276                         type inet:ipv6-prefix;
277                         description "Source IPv6 prefix match in  <address/len> notation";
278                         }
279                 leaf dstIp6 {
280                         type inet:ipv6-prefix;
281                         description "Destination IPv6 prefix match in <address/len> notation";
282                         }
283                         leaf tc-low {
284                                 type tos-byte;
285                                 description "TC low range match";
286                         }
287                         leaf tc-high {
288                                 type tos-byte;
289                                 description "TC high range match";
290                         }
291                         leaf tc-mask {
292                                 type tos-byte;
293                                 description "TC mask";
294                         }
295                 leaf next-hdr {
296                         type tp-protocol;
297                         description "IPv6 Next Header";
298                         }
299                         leaf flow-label {
300                                 type uint32 {
301                                         range "0 .. 1048575";
302                                 }
303                                 description "IPv6 Flow Label (20 bits)";
304                         }
305                         uses tp-port-match-ranges;
306                 }
307     }
308
309 }
310