c6f72046906a8b119257109c641782509ebfa147
[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      typedef removed-flow-reason {
128             type enumeration {
129                 enum OFPRR_IDLE_TIMEOUT{
130                     value 0;
131                     description "Flow idle time exceeded idle_timeout.";
132                 }
133                 enum OFPRR_HARD_TIMEOUT {
134                     value 1;
135                     description "Time exceeded hard_timeout.";
136                 }
137                 enum OFPRR_DELETE {
138                     value 2;
139                     description "Evicted by a DELETE flow mod.";
140                 }
141                 enum OFPRR_GROUP_DELETE {
142                     value 3;
143                     description "Group was removed.";
144                 }
145
146             }
147      }
148     
149     grouping generic_flow_attributes {
150         leaf priority {
151             type uint16;
152         }
153         
154         leaf idle-timeout {
155             type uint16;
156         }
157         
158         leaf hard-timeout {
159             type uint16;
160         }
161         
162         leaf cookie {
163             type flow-cookie;
164         }
165         
166         leaf table_id {
167             type uint8;
168         }
169     }
170     
171     grouping flow {
172         container match {
173             uses match:match;
174         }
175         
176         container instructions {
177             uses instruction-list;
178         }          
179          
180         uses generic_flow_attributes;
181         
182         leaf container-name {
183             type string; 
184         }
185         
186         leaf cookie_mask {
187             type flow-cookie;
188         }
189         
190         leaf buffer_id {
191             type uint32;
192         }
193         
194         leaf out_port {
195             type uint64;
196         }
197         
198         leaf out_group {
199             type uint32;
200         }
201         
202         leaf flags {
203             type flow-mod-flags;
204         }
205         
206         leaf flow-name {
207             type string;
208         }
209         
210         leaf installHw {
211             type boolean;
212         }
213
214         leaf barrier {
215             type boolean;
216         }
217
218         leaf strict {
219             type boolean;
220             default "false";
221         }
222
223     }
224
225     grouping flow-statistics {
226         leaf packet-count {
227             type yang:counter64;
228         }
229
230         leaf byte-count {
231             type yang:counter64;
232         }
233
234         container duration {
235             leaf second {
236                 type yang:counter64;
237             }
238             leaf nanosecond {
239                 type yang:counter64;
240             }
241         }
242     }
243
244     grouping flow-table-statistics {
245         leaf active {
246             type yang:counter64;
247         } 
248
249         leaf lookup {
250             type yang:counter64;
251         }
252
253         leaf matched {
254             type yang:counter64;   
255         }
256     }
257     
258     grouping flow-mod-removed {
259         uses generic_flow_attributes;
260         
261         leaf removed_reason {
262             type removed-flow-reason;
263         }
264
265         leaf duration_nsec {
266             type uint32;
267         }
268         
269         leaf duration_sec {
270             type uint32;
271         }
272
273         leaf packet_count {
274             type uint64;
275         }
276
277         leaf byte_count {
278             type uint64;
279         }
280                 
281         container match {
282             uses match:match;
283         }
284     }
285
286     container flow-message {
287         uses flow;
288         uses ofproto:ofHeader;
289
290         leaf command {
291             type oft:flow-mod-command;
292         }
293     }
294 }