BUG-9223:Remove hardcoded value of lldp interval
[openflowplugin.git] / 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 "2013-07-15";}
6     import ietf-yang-types {prefix yang; revision-date "2013-07-15";}
7     import opendaylight-l2-types {prefix l2t;revision-date "2013-08-27";}
8     import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}
9     import opendaylight-arbitrary-bitmask-fields {prefix mask; revision-date "2016-01-30";}
10     import opendaylight-ipv6-arbitrary-bitmask-fields {prefix ipv6-arbitrary-mask; revision-date "2016-02-24";}
11
12     revision "2013-10-26" {
13         description "Initial revision of match types";
14     }
15
16     grouping "mac-address-filter" {
17         leaf address {
18             mandatory true;
19             type yang:mac-address;
20         }
21         leaf mask {
22             type yang:mac-address;
23         }
24     }
25
26     grouping "of-metadata" {
27         leaf metadata {
28             type uint64;
29         }
30
31         leaf metadata-mask {
32             type uint64;
33         }
34     }
35
36      /** Match Groupings **/
37     grouping "ethernet-match-fields" {
38         container ethernet-source {
39             description "Ethernet source address.";
40             presence "Match field is active and set";
41             uses mac-address-filter;
42         }
43         container ethernet-destination {
44             description "Ethernet destination address.";
45             presence "Match field is active and set";
46             uses mac-address-filter;
47         }
48         container ethernet-type {
49             description "Ethernet frame type.";
50             presence "Match field is active and set";
51
52             leaf type {
53                 mandatory true;
54                 type l2t:ether-type; // Needs to define that as general model
55             }
56         }
57     }
58
59     grouping "vlan-match-fields" {
60         container vlan-id {
61             description "VLAN id.";
62             presence "Match field is active and set";
63
64             leaf vlan-id-present {
65                 type boolean;
66             }
67
68             leaf vlan-id {
69                 type l2t:vlan-id;
70             }
71         }
72         leaf vlan-pcp {
73             description "VLAN priority.";
74             type l2t:vlan-pcp;
75         }
76     }
77
78     grouping "ip-match-fields" {
79         leaf ip-protocol {
80                 description "IP protocol.";
81                 type uint8;
82         }
83
84         leaf ip-dscp {
85             description "IP DSCP (6 bits in ToS field).";
86             type inet:dscp;
87         }
88
89         leaf ip-ecn {
90             description "IP ECN (2 bits in ToS field).";
91             type uint8;
92         }
93
94         leaf ip-proto {
95            description "IP Proto (IPv4 or IPv6 Protocol Number).";
96                type inet:ip-version;
97                 }
98     }
99
100     grouping "ipv4-match-fields" {
101         leaf ipv4-source {
102             description "IPv4 source address.";
103             type inet:ipv4-prefix;
104         }
105
106         leaf ipv4-destination {
107             description "IPv4 destination address.";
108             type inet:ipv4-prefix;
109         }
110
111     }
112
113     grouping "ipv6-match-fields" {
114         leaf ipv6-source {
115             description "IPv6 source address.";
116             type inet:ipv6-prefix;
117         }
118
119         leaf ipv6-destination {
120             description "IPv6 destination address.";
121             type inet:ipv6-prefix;
122         }
123
124         leaf ipv6-nd-target {
125             description "IPv6 target address for neighbour discovery message";
126             type inet:ipv6-address;
127         }
128
129         container "ipv6-label" {
130             leaf ipv6-flabel {
131                 type inet:ipv6-flow-label;
132             }
133
134             leaf flabel-mask {
135                 type inet:ipv6-flow-label;
136             }
137         }
138
139         leaf ipv6-nd-sll {
140             description "Link layer source address for neighbour discovery message";
141             type yang:mac-address;
142         }
143
144         leaf ipv6-nd-tll {
145             description "Link layer target address for neighbour discovery message";
146             type yang:mac-address;
147         }
148
149         container "ipv6-ext-header" {
150             leaf ipv6-exthdr {
151                 description "IPv6 Extension Header field";
152                 type uint16;
153             }
154
155             leaf ipv6-exthdr-mask {
156                 type uint16 {
157                   range "0..512";
158                 }
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 uint32 {
198                   range "0..16777216";
199                 }
200             }
201         }
202     }
203
204     grouping "tcp-match-fields" {
205         leaf tcp-source-port {
206             description "TCP source port.";
207             type inet:port-number;
208         }
209         leaf tcp-destination-port {
210             description "TCP destination port.";
211             type inet:port-number;
212         }
213     }
214
215     grouping "sctp-match-fields" {
216         leaf sctp-source-port {
217             description "SCTP source port.";
218             type inet:port-number;
219         }
220         leaf sctp-destination-port {
221             description "SCTP destination port.";
222             type inet:port-number;
223         }
224     }
225
226     grouping "icmpv4-match-fields" {
227         leaf icmpv4-type {
228         description "ICMP type.";
229             type uint8; // Define ICMP Type
230         }
231         description "ICMP code.";
232         leaf icmpv4-code {
233             type uint8; // Define ICMP Code
234         }
235     }
236
237     grouping "icmpv6-match-fields" {
238         leaf icmpv6-type {
239         description "ICMP type.";
240             type uint8; // Define ICMP Type
241         }
242         description "ICMP code.";
243         leaf icmpv6-code {
244             type uint8; // Define ICMP Code
245         }
246     }
247
248     grouping "arp-match-fields" {
249         leaf arp-op {
250             type uint16;
251         }
252
253         leaf arp-source-transport-address {
254             description "ARP source IPv4 address.";
255             type inet:ipv4-prefix;
256         }
257
258         leaf arp-target-transport-address {
259             description "ARP target IPv4 address.";
260             type inet:ipv4-prefix;
261         }
262         container arp-source-hardware-address {
263             description "ARP source hardware address.";
264             presence "Match field is active and set";
265             uses mac-address-filter;
266         }
267         container arp-target-hardware-address {
268             description "ARP target hardware address.";
269             presence "Match field is active and set";
270             uses mac-address-filter;
271         }
272     }
273
274     grouping "tcp-flags-match-fields" {
275         leaf tcp-flags {
276             description "Tcp flags for match";
277             type uint16;
278         }
279         leaf tcp-flags-mask {
280             description "Mask for tcp flags";
281             type uint16;
282         }
283     }
284
285     grouping "tunnel-ipv4-match-fields" {
286         leaf tunnel-ipv4-source {
287             description "IPv4 source tunnel endpoint address.";
288             type inet:ipv4-prefix;
289         }
290         leaf tunnel-ipv4-destination {
291             description "IPv4 destination tunnel endpoint address.";
292             type inet:ipv4-prefix;
293         }
294     }
295
296     grouping match {
297         leaf in-port {
298             type inv:node-connector-id;
299         }
300
301         leaf in-phy-port {
302             type inv:node-connector-id;
303         }
304
305         container "metadata" {
306             uses of-metadata;
307         }
308
309         container "tunnel" {
310             leaf tunnel-id {
311                 description "Metadata associated in the logical port";
312                 type uint64;
313             }
314
315             leaf tunnel-mask {
316                 type uint64;
317             }
318         }
319
320         container "ethernet-match" {
321             uses "ethernet-match-fields";
322         }
323
324         container "vlan-match" {
325             uses "vlan-match-fields";
326         }
327
328         container "ip-match" {
329             uses "ip-match-fields";
330         }
331
332         choice layer-3-match {
333             case "ipv4-match" {
334                 uses "ipv4-match-fields";
335             }
336             case "ipv4-match-arbitrary-bit-mask"{
337                 uses "mask:ipv4-match-arbitrary-bitmask-fields";
338             }
339             case "ipv6-match" {
340                 uses "ipv6-match-fields";
341             }
342             case "ipv6-match-arbitrary-bit-mask"{
343                 uses ipv6-arbitrary-mask:ipv6-match-arbitrary-bitmask-fields;
344             }
345             case "arp-match" {
346                 uses "arp-match-fields";
347             }
348             case "tunnel-ipv4-match" {
349                 uses "tunnel-ipv4-match-fields";
350             }
351         }
352
353         choice layer-4-match {
354             case "udp-match" {
355                 uses "udp-match-fields";
356             }
357             case "tcp-match" {
358                 uses "tcp-match-fields";
359             }
360             case "sctp-match" {
361                 uses "sctp-match-fields";
362             }
363         }
364
365         container "icmpv4-match" {
366             uses "icmpv4-match-fields";
367         }
368
369         container "icmpv6-match" {
370             uses "icmpv6-match-fields";
371         }
372
373         container "protocol-match-fields" {
374             uses "protocol-match-fields";
375         }
376
377         container tcp-flags-match {
378             uses "tcp-flags-match-fields";
379         }
380     }
381 }