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