Create YANG builders for all relevant model types
[openflowplugin.git] / model / model-flow-base / src / main / yang / opendaylight-flow-types.yang
1 module opendaylight-flow-types {
2     namespace "urn:opendaylight:flow:types";
3     prefix flow;
4
5     import ietf-yang-types {prefix yang; revision-date "2013-07-15";}
6     import opendaylight-match-types {prefix match; revision-date "2013-10-26";}
7     import opendaylight-action-types {prefix action;}
8     import opendaylight-meter-types {prefix meter; revision-date "2013-09-18";}
9     import openflow-protocol { prefix ofproto; revision-date "2013-07-31"; }
10     import openflow-types { prefix oft; revision-date "2013-07-31"; }
11
12     revision "2013-10-26" {
13         description "Initial revision of flow service";
14     }
15     
16     typedef flow-ref {
17         type instance-identifier;
18     }
19     
20     typedef flow-cookie {
21         description "openflow specific type - flow cookie / flow cookie mask";
22         type uint64;
23     }
24     
25     typedef output-port-values {
26         type enumeration {
27             enum MAX {
28                 value 1;
29             }
30             enum IN_PORT {
31                 value 2;
32             }
33             enum TABLE {
34                 value 3;
35             }
36             enum NORMAL {
37                 value 4;
38             }
39             enum FLOOD {
40                 value 5;
41             }
42             enum ALL {
43                 value 6;
44             }
45             enum CONTROLLER {
46                 value 7;
47             }
48             enum LOCAL {
49                 value 8;
50             }
51             enum ANY {
52                 value 9;
53             }
54              enum NONE {
55                 value 10;
56             }
57
58         }
59     }
60     grouping instruction-list {
61         list instruction {
62             key "order";
63             uses action:ordered;
64             uses instruction;
65         }
66     }
67
68      grouping instruction {
69          choice instruction {
70             case go-to-table-case {
71                 container go-to-table {
72                  leaf table_id {
73                      type uint8;
74                  }
75              }
76             }
77              
78             case write-metadata-case {
79                 container write-metadata {
80                  leaf metadata {
81                      type uint64;
82                  }
83                  
84                  leaf metadata-mask {
85                      type uint64;
86                  }
87              }
88             }
89              
90             case write-actions-case {
91                 container write-actions {
92                  uses action:action-list;
93              }
94             }
95              
96             case apply-actions-case {
97                 container apply-actions {
98                  uses action:action-list;
99              }
100             }
101              
102             case clear-actions-case {
103                 container clear-actions {
104                  uses action:action-list;
105              }
106             }
107              
108             case meter-case {
109                 container meter {
110                      leaf meter-id {
111                         type meter:meter-id;
112                      } 
113                  }
114              }
115          }
116     }
117     
118     typedef flow-mod-flags {
119         type bits {
120             bit CHECK_OVERLAP;
121             bit RESET_COUNTS;
122             bit NO_PKT_COUNTS;
123             bit NO_BYT_COUNTS;
124             bit SEND_FLOW_REM;
125         }
126     }
127
128     typedef removed_reason_flags {
129         type bits {
130             bit IDLE_TIMEOUT;
131             bit HARD_TIMEOUT;
132             bit DELETE;
133             bit GROUP_DELETE;
134         }
135     }
136     
137     grouping generic_flow_attributes {
138         leaf priority {
139             type uint16;
140         }
141         
142         leaf idle-timeout {
143             type uint16;
144         }
145         
146         leaf hard-timeout {
147             type uint16;
148         }
149         
150         leaf cookie {
151             type flow-cookie;
152         }
153         
154         leaf table_id {
155             type uint8;
156         }
157     }
158     
159     grouping flow {
160         container match {
161             uses match:match;
162         }
163         
164         container instructions {
165             uses instruction-list;
166         }          
167          
168         uses generic_flow_attributes;
169         
170         leaf container-name {
171             type string; 
172         }
173         
174         leaf cookie_mask {
175             type flow-cookie;
176         }
177         
178         leaf buffer_id {
179             type uint32;
180         }
181         
182         leaf out_port {
183             type uint64;
184         }
185         
186         leaf out_group {
187             type uint32;
188         }
189         
190         leaf flags {
191             type flow-mod-flags;
192         }
193         
194         leaf flow-name {
195             type string;
196         }
197         
198         leaf installHw {
199             type boolean;
200         }
201
202         leaf barrier {
203             type boolean;
204         }
205
206         leaf strict {
207             type boolean;
208             default "false";
209         }
210
211     }
212
213     grouping flow-statistics {
214         leaf packet-count {
215             type yang:counter64;
216         }
217
218         leaf byte-count {
219             type yang:counter64;
220         }
221
222         container duration {
223             leaf second {
224                 type yang:counter64;
225             }
226             leaf nanosecond {
227                 type yang:counter64;
228             }
229         }
230     }
231
232     grouping flow-table-statistics {
233         leaf active {
234             type yang:counter64;
235         } 
236
237         leaf lookup {
238             type yang:counter64;
239         }
240
241         leaf matched {
242             type yang:counter64;   
243         }
244     }
245     
246     grouping flow-mod-removed {
247         uses generic_flow_attributes;
248         
249         leaf removed_reason {
250             type removed_reason_flags;
251         }
252
253         leaf duration_nsec {
254             type uint32;
255         }
256         
257         leaf duration_sec {
258             type uint32;
259         }
260
261         leaf packet_count {
262             type uint64;
263         }
264
265         leaf byte_count {
266             type uint64;
267         }
268                 
269         container match {
270             uses match:match;
271         }
272     }
273
274     container flow-message {
275         uses flow;
276         uses ofproto:ofHeader;
277
278         leaf command {
279             type oft:flow-mod-command;
280         }
281     }
282 }