Updated flow capable models and affected code
[controller.git] / opendaylight / md-sal / model / model-flow-base / src / main / yang / flow-types.yang
1 module opendaylight-flow-types {
2     namespace "urn:opendaylight:flow:types";
3     prefix flow;
4
5     import ietf-inet-types {prefix inet;}
6     import opendaylight-match-types {prefix match;}
7     import ietf-yang-types {prefix yang;}
8     import opendaylight-l2-types {prefix l2t;}
9
10     revision "2013-10-26" {
11         description "Initial revision of flow service";
12     }
13     
14     
15     typedef vlan-cfi {
16            type int32;    
17     }
18     
19     
20     grouping action-list {
21         list action {
22             key "order";
23             leaf order {
24                 type int32;
25             }
26             uses action;
27         }
28     }
29     
30     grouping address {
31         choice address {
32             case ipv4 {
33                 leaf ipv4-address {
34                     type inet:ipv4-prefix;
35                 }
36             }
37             case ipv6 {
38                 leaf ipv6-address {
39                     type inet:ipv6-prefix;
40                 }
41             }
42         }
43     }    
44
45     grouping instruction-list {
46             list instruction {
47                 key "order";
48                 leaf order {
49                     type int32;
50                 }
51                 uses instruction;
52             }
53     }
54
55     grouping instruction {
56         choice instruction {
57             case go-to-table {
58                 leaf table_id {
59                     type uint8;
60                 }
61             }
62             
63             case write-metadata {
64                 leaf metadata {
65                     type uint64;
66                 }
67                 
68                 leaf metadata-mask {
69                     type uint64;
70                 }
71             }
72             
73             case write-actions {
74                 uses action-list;
75             }
76             
77             case apply-actions {
78                 uses action-list;
79             }
80             
81             case clear-actions {
82                 uses action-list;
83             }
84             
85             case meter {
86                 leaf meter {
87                     type string;
88                 }
89             }   
90         }
91     }
92     
93     grouping action {
94         choice action {
95             case output-action {
96                 leaf-list output-node-connector {
97                     type inet:uri;
98                 }
99                 
100                 leaf max-length {
101                     type uint16 {
102                         range "0..65294";
103                     }
104                 }                
105             }
106
107             case controller-action {
108                 leaf max-length {
109                     type uint16 {
110                         range "0..65294";
111                     }
112                 }
113             }
114
115             case set-queue-action {
116                 leaf queue {
117                     type string; 
118                 }
119             }
120
121             case pop-mpls-action {
122                 leaf ethernet-type {
123                     type uint16; // TODO: define ethertype type
124                 }
125             }
126
127             case set-mpls-ttl-action {
128                 leaf mpls-ttl {
129                     type uint8;
130                 }
131             }
132
133             case set-nw-ttl-action {
134                 leaf nw-ttl {
135                     type uint8;
136                 }
137             }
138
139             case push-pbb-action {
140                 leaf ethernet-type {
141                     type uint16; // TODO: define ethertype type
142                 }
143             }
144
145             case pop-pbb-action {
146                 
147             }
148             
149             case push-mpls-action {
150                 leaf ethernet-type {
151                     type uint16; // TODO: define ethertype type
152                 }
153             }
154             
155             case dec-mpls-ttl {
156             }
157             
158             case dec-nw-ttl {
159             }
160             
161             case drop-action {
162             }
163             
164             case flood-action {
165             }
166             
167             case flood-all-action {
168             }
169             
170             case hw-path-action {
171             }
172             
173             case loopback-action {
174             }
175             
176             case pop-vlan-action {
177             }
178             
179             case push-vlan-action {
180                 leaf tag {               // TPID - 16 bits
181                     type int32;
182                 } 
183                 leaf pcp {               // PCP - 3 bits
184                     type int32;
185                 }
186                 leaf cfi {               // CFI - 1 bit (drop eligible)
187                     type vlan-cfi;
188                 }
189                 leaf vlan-id {           // VID - 12 bits
190                     type l2t:vlan-id;
191                 }
192 //                leaf tci {               //TCI = [PCP + CFI + VID]
193 //                }
194 //                leaf header {            //header = [TPID + TCI] 
195 //                }
196             }
197             
198             case copy-ttl-out {
199             }
200             
201             case copy-ttl-in {
202             }
203             
204             case set-dl-dst-action {
205                 leaf address {
206                     type yang:mac-address;
207                 }
208             }
209             
210             case set-dl-src-action {
211                 leaf address {
212                     type yang:mac-address;
213                 }
214             }
215             case group-action {
216                 leaf group {
217                     type string;
218                 }
219             }
220             
221             case set-dl-type-action {
222                 leaf dl-type {
223                     type l2t:ether-type;
224                 }
225             }
226             
227             case set-next-hop-action {
228                 uses address;
229             }
230             
231             case set-nw-dst-action {
232                 uses address;            
233             }
234             
235             case set-nw-src-action{
236                 uses address;            
237             }
238             
239             case set-nw-tos-action {
240                 leaf tos {
241                     type int32;
242                 }
243             }
244             
245             case set-tp-dst-action {
246                 leaf port {
247                     type inet:port-number;
248                 }                
249             }
250             case set-tp-src-action {
251                 leaf port {
252                     type inet:port-number;
253                 }                
254             }
255             case set-vlan-cfi-action {
256                 leaf vlan-cfi {
257                     type vlan-cfi;
258                 }
259             }
260             
261             case set-vlan-id-action {
262                 leaf vlan-id {
263                     type l2t:vlan-id;
264                 } 
265             }
266             
267             case set-vlan-pcp-action {
268                 leaf vlan-pcp {
269                     type l2t:vlan-pcp;
270                 }            
271             }
272             
273             case sw-path-action {            
274             }  
275         }
276     }
277
278     typedef flow-mod-flags {
279         type bits {
280             bit CHECK_OVERLAP;
281             bit RESET_COUNTS;
282             bit NO_PKT_COUNTS;
283             bit NO_BYT_COUNTS;
284         }
285     }
286     
287     grouping flow {
288         container match {
289             uses match:match;
290         }
291         
292         container instructions {
293             uses instruction-list;
294         }
295                 
296         leaf priority {
297             type uint16;
298         }
299         
300         leaf idle-timeout {
301             type uint16;
302         }
303         
304         leaf hard-timeout {
305             type uint16;
306         }
307         
308         leaf cookie {
309             type uint64;
310         }
311         
312         leaf container-name {
313             type string; 
314         }
315         
316         leaf cookie_mask {
317             type uint8;
318         }
319         
320         leaf table_id {
321             type uint8;
322         }
323         
324         leaf buffer_id {
325             type uint32;
326         }
327         
328         leaf out_port {
329             type uint64;
330         }
331         
332         leaf out_group {
333             type uint32;
334         }
335         
336         leaf flags{
337             type flow-mod-flags;
338         }
339         
340         leaf flow-name{
341             type string;
342         }
343     }
344
345     grouping flow-statistics {
346         leaf packet-count {
347             type yang:counter64;
348         } 
349
350         leaf byte-count {
351             type yang:counter64;
352         }
353
354         container duration {
355             leaf second {
356                 type yang:counter64;
357             }
358             leaf nanosecond {
359                 type yang:counter64;
360             }
361         }
362     }
363
364     grouping flow-table-statistics {
365         leaf active {
366             type yang:counter64;
367         } 
368
369         leaf lookup {
370             type yang:counter64;
371         }
372
373         leaf matched {
374             type yang:counter64;   
375         }
376     }
377 }