Added meter, action, group, flow models, mask and transactions support.
[controller.git] / opendaylight / md-sal / model / model-flow-base / src / main / yang / match-types.yang
1 module opendaylight-match-types {
2     namespace "urn:opendaylight:model:match:types";
3     prefix "match";
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
9     revision "2013-10-26" {
10         description "Initial revision of macth types";
11     }
12
13     grouping "mac-address-filter" {
14         leaf address {
15             mandatory true;
16             type yang:mac-address;
17         }
18         leaf mask {
19             type binary;
20         }
21     }
22     
23     grouping "of-metadata" {
24         leaf metadata {
25             type uint64;
26         }
27         
28         leaf metadata-mask {
29             type binary;
30         }
31     }
32
33      /** Match Groupings **/
34     grouping "ethernet-match-fields" {
35         container ethernet-source {
36             description "Ethernet source address.";
37             presence "Match field is active and set";
38             uses mac-address-filter;
39         }
40         container ethernet-destination {
41             description "Ethernet destination address.";
42             presence "Match field is active and set";
43             uses mac-address-filter;
44         }
45         container ethernet-type {
46             description "Ethernet frame type.";
47             presence "Match field is active and set";
48             
49             leaf type {
50                 mandatory true;
51                 type l2t:ether-type; // Needs to define that as general model
52             }
53
54             leaf mask {
55                 type binary;
56             }
57         }
58     }
59
60     grouping "vlan-match-fields" {
61         container vlan-id {
62             description "VLAN id.";
63             presence "Match field is active and set";
64             
65             leaf vlan-id {
66                 mandatory true;
67                 type l2t:vlan-id; 
68             }
69             leaf mask {
70                 type binary;
71             }
72         }
73         leaf vlan-pcp {
74             description "VLAN priority.";
75             type l2t:vlan-pcp;
76         }
77     }
78
79     grouping "ip-match-fields" {
80         leaf ip-protocol {
81                 description "IP protocol.";
82                 type uint8; 
83         }
84
85         leaf ip-dscp {
86             description "IP DSCP (6 bits in ToS field).";
87             type inet:dscp; 
88         }
89         
90         leaf ip-ecn {
91             description "IP ECN (2 bits in ToS field).";
92             type uint8; 
93         }
94         
95         leaf ip-proto {
96             description "IP Proto (IPv4 or IPv6 Protocol Number).";
97             type inet:ip-version; 
98         }
99     } 
100     
101     grouping "ipv4-match-fields" {
102         leaf ipv4-source {
103             description "IPv4 source address.";
104             type inet:ipv4-prefix;
105         }
106         
107         leaf ipv4-destination {
108             description "IPv4 destination address.";
109             type inet:ipv4-prefix;
110         }
111         
112     }
113     
114     grouping "ipv6-match-fields" {
115         leaf ipv6-source {
116             description "IPv6 source address.";
117             type inet:ipv6-prefix;
118         }
119     
120         leaf ipv6-destination {
121             description "IPv6 destination address.";
122             type inet:ipv6-prefix;
123         }
124         
125         leaf ipv6-nd-target {
126             description "IPv6 target address for neighbour discovery message";
127             type inet:ipv6-address;
128         }
129         
130         container "ipv6-label" {
131             leaf ipv6-flabel {
132                 type inet:ipv6-flow-label;
133             }
134             
135             leaf flabel-mask {
136                 type binary;
137             }
138         }
139         
140         leaf ipv6-nd-sll {
141             description "Link layer source address for neighbour discovery message";
142             type yang:mac-address;
143         }
144         
145         leaf ipv6-nd-tll {
146             description "Link layer target address for neighbour discovery message";
147             type yang:mac-address;
148         }
149             
150         leaf ipv6-exthdr {
151             description "IPv6 Extension Header field";
152             type uint16;
153         }
154     }
155
156     grouping "udp-match-fields" {
157         leaf udp-source-port {
158             description "UDP source port.";
159             type inet:port-number;
160         }
161         leaf udp-destination-port {
162             description "UDP destination port.";
163                 type inet:port-number;
164         }
165     }
166
167     grouping "protocol-match-fields" {
168         leaf mpls-label {
169             description "Label in the first MPLS shim header";
170             type uint32;
171         }
172         
173         leaf mpls-tc {
174             description "TC in the first MPLS shim header";
175             type uint8;
176         }
177         
178         leaf mpls-bos {
179             description "BoS bit in the first MPLS shim header";
180             type uint8;
181         }
182         
183         container "pbb" {
184             leaf pbb-isid {
185                 description "I-SID in the first PBB service instance tag";
186                 type uint32;
187             }  
188
189             leaf pbb-mask {
190                 type binary;
191             }
192         }
193     }
194     
195     grouping "tcp-match-fields" {
196         leaf tcp-source-port {
197             description "TCP source port.";
198             type inet:port-number;
199         }
200         leaf tcp-destination-port {
201             description "TCP destination port.";
202             type inet:port-number;
203         }
204     }
205
206     grouping "sctp-match-fields" {
207         leaf sctp-source-port {
208             description "SCTP source port.";
209             type inet:port-number;
210         }
211         leaf sctp-destination-port {
212             description "SCTP destination port.";
213             type inet:port-number;
214         }
215     }
216
217     grouping "icmpv4-match-fields" {
218         leaf icmpv4-type {
219         description "ICMP type.";
220             type uint8; // Define ICMP Type
221         }
222         description "ICMP code.";
223         leaf icmpv4-code {
224             type uint8; // Define ICMP Code
225         }
226     }
227     
228     grouping "icmpv6-match-fields" {
229         leaf icmpv6-type {
230         description "ICMP type.";
231             type uint8; // Define ICMP Type
232         }
233         description "ICMP code.";
234         leaf icmpv6-code {
235             type uint8; // Define ICMP Code
236         }
237     }
238
239     grouping "arp-match-fields" {
240         leaf arp-op {
241             type uint16;
242         }
243         
244         leaf arp-source-transport-address {
245             description "ARP source IPv4 address.";
246             type inet:ipv4-prefix;
247         }
248     
249         leaf arp-target-transport-address {
250             description "ARP target IPv4 address.";
251             type inet:ipv4-prefix;
252         }
253         container arp-source-hardware-address {
254             description "ARP source hardware address.";
255             presence "Match field is active and set";
256             uses mac-address-filter;
257         }
258         container arp-target-hardware-address {
259             description "ARP target hardware address.";
260             presence "Match field is active and set";
261             uses mac-address-filter;
262         }
263     }
264     
265     grouping match {
266         leaf in-port {
267             type uint32;
268         }
269         
270         leaf in-phy-port {
271             type uint32;
272         }
273         
274         container "metadata" {
275             uses of-metadata;
276         }
277         
278         container "tunnel" {
279             leaf tunnel-id {
280                 description "Metadata associated in the logical port";
281                 type uint64;
282             }
283             
284             leaf tunnel-mask {
285                 type binary;
286             }
287         }
288         
289         container "ethernet-match" {
290             uses "ethernet-match-fields";
291         }
292         
293         container "vlan-match" {
294             uses "vlan-match-fields";
295         }
296         
297         container "ip-match" {
298             uses "ip-match-fields";
299         }
300         
301         choice layer-3-match {
302             case "ipv4-match" {
303                 uses "ipv4-match-fields";
304             }
305             case "ipv6-match" {
306                 uses "ipv6-match-fields";
307             }
308             case "arp-match" {
309                 uses "arp-match-fields";
310             }
311         }
312         
313         choice layer-4-match {
314             case "udp-match" {
315                 uses "udp-match-fields";
316             }
317             case "tcp-match" {
318                 uses "tcp-match-fields";
319             }
320             case "sctp-match" {
321                 uses "sctp-match-fields";
322             }
323         }
324         
325         container "icmpv4-match" {
326             uses "icmpv4-match-fields";
327         }
328         
329         container "icmpv6-match" {
330             uses "icmpv6-match-fields";
331         }
332         
333         container "protocol-match-fields" {
334             uses "protocol-match-fields";
335         }
336     }
337 }