Fixed deserialization of IdentityRefs in Restconf URI.
[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     
96     grouping "ipv4-match-fields" {
97         leaf ipv4-source {
98             description "IPv4 source address.";
99             type inet:ipv4-prefix;
100         }
101         
102         leaf ipv4-destination {
103             description "IPv4 destination address.";
104             type inet:ipv4-prefix;
105         }
106         
107     }
108     
109     grouping "ipv6-match-fields" {
110         leaf ipv6-source {
111             description "IPv6 source address.";
112             type inet:ipv6-prefix;
113         }
114     
115         leaf ipv6-destination {
116             description "IPv6 destination address.";
117             type inet:ipv6-prefix;
118         }
119         
120         leaf ipv6-nd-target {
121             description "IPv6 target address for neighbour discovery message";
122             type inet:ipv6-address;
123         }
124         
125         container "ipv6-label" {
126             leaf ipv6-flabel {
127                 type inet:ipv6-flow-label;
128             }
129             
130             leaf flabel-mask {
131                 type binary;
132             }
133         }
134         
135         leaf ipv6-nd-sll {
136             description "Link layer source address for neighbour discovery message";
137             type yang:mac-address;
138         }
139         
140         leaf ipv6-nd-tll {
141             description "Link layer target address for neighbour discovery message";
142             type yang:mac-address;
143         }
144         
145         container "ipv6-ext-header" {    
146             leaf ipv6-exthdr {
147                 description "IPv6 Extension Header field";
148                 type uint16;
149             }
150
151             leaf ipv6-exthdr-mask {
152                 type binary;
153             }
154         }
155     }
156
157     grouping "udp-match-fields" {
158         leaf udp-source-port {
159             description "UDP source port.";
160             type inet:port-number;
161         }
162         leaf udp-destination-port {
163             description "UDP destination port.";
164                 type inet:port-number;
165         }
166     }
167
168     grouping "protocol-match-fields" {
169         leaf mpls-label {
170             description "Label in the first MPLS shim header";
171             type uint32;
172         }
173         
174         leaf mpls-tc {
175             description "TC in the first MPLS shim header";
176             type uint8;
177         }
178         
179         leaf mpls-bos {
180             description "BoS bit in the first MPLS shim header";
181             type uint8;
182         }
183         
184         container "pbb" {
185             leaf pbb-isid {
186                 description "I-SID in the first PBB service instance tag";
187                 type uint32;
188             }  
189
190             leaf pbb-mask {
191                 type binary;
192             }
193         }
194     }
195     
196     grouping "tcp-match-fields" {
197         leaf tcp-source-port {
198             description "TCP source port.";
199             type inet:port-number;
200         }
201         leaf tcp-destination-port {
202             description "TCP destination port.";
203             type inet:port-number;
204         }
205     }
206
207     grouping "sctp-match-fields" {
208         leaf sctp-source-port {
209             description "SCTP source port.";
210             type inet:port-number;
211         }
212         leaf sctp-destination-port {
213             description "SCTP destination port.";
214             type inet:port-number;
215         }
216     }
217
218     grouping "icmpv4-match-fields" {
219         leaf icmpv4-type {
220         description "ICMP type.";
221             type uint8; // Define ICMP Type
222         }
223         description "ICMP code.";
224         leaf icmpv4-code {
225             type uint8; // Define ICMP Code
226         }
227     }
228     
229     grouping "icmpv6-match-fields" {
230         leaf icmpv6-type {
231         description "ICMP type.";
232             type uint8; // Define ICMP Type
233         }
234         description "ICMP code.";
235         leaf icmpv6-code {
236             type uint8; // Define ICMP Code
237         }
238     }
239
240     grouping "arp-match-fields" {
241         leaf arp-op {
242             type uint16;
243         }
244         
245         leaf arp-source-transport-address {
246             description "ARP source IPv4 address.";
247             type inet:ipv4-prefix;
248         }
249     
250         leaf arp-target-transport-address {
251             description "ARP target IPv4 address.";
252             type inet:ipv4-prefix;
253         }
254         container arp-source-hardware-address {
255             description "ARP source hardware address.";
256             presence "Match field is active and set";
257             uses mac-address-filter;
258         }
259         container arp-target-hardware-address {
260             description "ARP target hardware address.";
261             presence "Match field is active and set";
262             uses mac-address-filter;
263         }
264     }
265     
266     grouping match {
267         leaf in-port {
268             type uint32;
269         }
270         
271         leaf in-phy-port {
272             type uint32;
273         }
274         
275         container "metadata" {
276             uses of-metadata;
277         }
278         
279         container "tunnel" {
280             leaf tunnel-id {
281                 description "Metadata associated in the logical port";
282                 type uint64;
283             }
284             
285             leaf tunnel-mask {
286                 type binary;
287             }
288         }
289         
290         container "ethernet-match" {
291             uses "ethernet-match-fields";
292         }
293         
294         container "vlan-match" {
295             uses "vlan-match-fields";
296         }
297         
298         container "ip-match" {
299             uses "ip-match-fields";
300         }
301         
302         choice layer-3-match {
303             case "ipv4-match" {
304                 uses "ipv4-match-fields";
305             }
306             case "ipv6-match" {
307                 uses "ipv6-match-fields";
308             }
309             case "arp-match" {
310                 uses "arp-match-fields";
311             }
312         }
313         
314         choice layer-4-match {
315             case "udp-match" {
316                 uses "udp-match-fields";
317             }
318             case "tcp-match" {
319                 uses "tcp-match-fields";
320             }
321             case "sctp-match" {
322                 uses "sctp-match-fields";
323             }
324         }
325         
326         container "icmpv4-match" {
327             uses "icmpv4-match-fields";
328         }
329         
330         container "icmpv6-match" {
331             uses "icmpv6-match-fields";
332         }
333         
334         container "protocol-match-fields" {
335             uses "protocol-match-fields";
336         }
337     }
338 }