Fix to allow RESTCONF PUTing of Flows
[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         container "ipv6-ext-header" {    
151             leaf ipv6-exthdr {
152                 description "IPv6 Extension Header field";
153                 type uint16;
154             }
155
156             leaf ipv6-exthdr-mask {
157                 type binary;
158             }
159         }
160     }
161
162     grouping "udp-match-fields" {
163         leaf udp-source-port {
164             description "UDP source port.";
165             type inet:port-number;
166         }
167         leaf udp-destination-port {
168             description "UDP destination port.";
169                 type inet:port-number;
170         }
171     }
172
173     grouping "protocol-match-fields" {
174         leaf mpls-label {
175             description "Label in the first MPLS shim header";
176             type uint32;
177         }
178         
179         leaf mpls-tc {
180             description "TC in the first MPLS shim header";
181             type uint8;
182         }
183         
184         leaf mpls-bos {
185             description "BoS bit in the first MPLS shim header";
186             type uint8;
187         }
188         
189         container "pbb" {
190             leaf pbb-isid {
191                 description "I-SID in the first PBB service instance tag";
192                 type uint32;
193             }  
194
195             leaf pbb-mask {
196                 type binary;
197             }
198         }
199     }
200     
201     grouping "tcp-match-fields" {
202         leaf tcp-source-port {
203             description "TCP source port.";
204             type inet:port-number;
205         }
206         leaf tcp-destination-port {
207             description "TCP destination port.";
208             type inet:port-number;
209         }
210     }
211
212     grouping "sctp-match-fields" {
213         leaf sctp-source-port {
214             description "SCTP source port.";
215             type inet:port-number;
216         }
217         leaf sctp-destination-port {
218             description "SCTP destination port.";
219             type inet:port-number;
220         }
221     }
222
223     grouping "icmpv4-match-fields" {
224         leaf icmpv4-type {
225         description "ICMP type.";
226             type uint8; // Define ICMP Type
227         }
228         description "ICMP code.";
229         leaf icmpv4-code {
230             type uint8; // Define ICMP Code
231         }
232     }
233     
234     grouping "icmpv6-match-fields" {
235         leaf icmpv6-type {
236         description "ICMP type.";
237             type uint8; // Define ICMP Type
238         }
239         description "ICMP code.";
240         leaf icmpv6-code {
241             type uint8; // Define ICMP Code
242         }
243     }
244
245     grouping "arp-match-fields" {
246         leaf arp-op {
247             type uint16;
248         }
249         
250         leaf arp-source-transport-address {
251             description "ARP source IPv4 address.";
252             type inet:ipv4-prefix;
253         }
254     
255         leaf arp-target-transport-address {
256             description "ARP target IPv4 address.";
257             type inet:ipv4-prefix;
258         }
259         container arp-source-hardware-address {
260             description "ARP source hardware address.";
261             presence "Match field is active and set";
262             uses mac-address-filter;
263         }
264         container arp-target-hardware-address {
265             description "ARP target hardware address.";
266             presence "Match field is active and set";
267             uses mac-address-filter;
268         }
269     }
270     
271     grouping match {
272         leaf in-port {
273             type uint32;
274         }
275         
276         leaf in-phy-port {
277             type uint32;
278         }
279         
280         container "metadata" {
281             uses of-metadata;
282         }
283         
284         container "tunnel" {
285             leaf tunnel-id {
286                 description "Metadata associated in the logical port";
287                 type uint64;
288             }
289             
290             leaf tunnel-mask {
291                 type binary;
292             }
293         }
294         
295         container "ethernet-match" {
296             uses "ethernet-match-fields";
297         }
298         
299         container "vlan-match" {
300             uses "vlan-match-fields";
301         }
302         
303         container "ip-match" {
304             uses "ip-match-fields";
305         }
306         
307         choice layer-3-match {
308             case "ipv4-match" {
309                 uses "ipv4-match-fields";
310             }
311             case "ipv6-match" {
312                 uses "ipv6-match-fields";
313             }
314             case "arp-match" {
315                 uses "arp-match-fields";
316             }
317         }
318         
319         choice layer-4-match {
320             case "udp-match" {
321                 uses "udp-match-fields";
322             }
323             case "tcp-match" {
324                 uses "tcp-match-fields";
325             }
326             case "sctp-match" {
327                 uses "sctp-match-fields";
328             }
329         }
330         
331         container "icmpv4-match" {
332             uses "icmpv4-match-fields";
333         }
334         
335         container "icmpv6-match" {
336             uses "icmpv6-match-fields";
337         }
338         
339         container "protocol-match-fields" {
340             uses "protocol-match-fields";
341         }
342     }
343 }