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