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