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