Eliminate blueprint for southbound-cli commands
[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     grouping packet-type-fields {
37         leaf packet-type {
38             description
39               "Outermost header type of a packet. It's a 4 byte
40                 value, the 2 most significant bytes are the
41                 namespace and the next 2 bytes are the type.";
42             type uint32;
43         }
44     }
45
46      /** Match Groupings **/
47     grouping "ethernet-match-fields" {
48         container ethernet-source {
49             description "Ethernet source address.";
50             presence "Match field is active and set";
51             uses mac-address-filter;
52         }
53         container ethernet-destination {
54             description "Ethernet destination address.";
55             presence "Match field is active and set";
56             uses mac-address-filter;
57         }
58         container ethernet-type {
59             description "Ethernet frame type.";
60             presence "Match field is active and set";
61
62             leaf type {
63                 mandatory true;
64                 type l2t:ether-type; // Needs to define that as general model
65             }
66         }
67     }
68
69     grouping "vlan-match-fields" {
70         container vlan-id {
71             description "VLAN id.";
72             presence "Match field is active and set";
73
74             leaf vlan-id-present {
75                 type boolean;
76             }
77
78             leaf vlan-id {
79                 type l2t:vlan-id;
80             }
81         }
82         leaf vlan-pcp {
83             description "VLAN priority.";
84             type l2t:vlan-pcp;
85         }
86     }
87
88     grouping "ip-match-fields" {
89         leaf ip-protocol {
90                 description "IP protocol.";
91                 type uint8;
92         }
93
94         leaf ip-dscp {
95             description "IP DSCP (6 bits in ToS field).";
96             type inet:dscp;
97         }
98
99         leaf ip-ecn {
100             description "IP ECN (2 bits in ToS field).";
101             type uint8;
102         }
103
104         leaf ip-proto {
105            description "IP Proto (IPv4 or IPv6 Protocol Number).";
106                type inet:ip-version;
107                 }
108     }
109
110     grouping "ipv4-match-fields" {
111         leaf ipv4-source {
112             description "IPv4 source address.";
113             type inet:ipv4-prefix;
114         }
115
116         leaf ipv4-destination {
117             description "IPv4 destination address.";
118             type inet:ipv4-prefix;
119         }
120
121     }
122
123     grouping "ipv6-match-fields" {
124         leaf ipv6-source {
125             description "IPv6 source address.";
126             type inet:ipv6-prefix;
127         }
128
129         leaf ipv6-destination {
130             description "IPv6 destination address.";
131             type inet:ipv6-prefix;
132         }
133
134         leaf ipv6-nd-target {
135             description "IPv6 target address for neighbour discovery message";
136             type inet:ipv6-address;
137         }
138
139         container "ipv6-label" {
140             leaf ipv6-flabel {
141                 type inet:ipv6-flow-label;
142             }
143
144             leaf flabel-mask {
145                 type inet:ipv6-flow-label;
146             }
147         }
148
149         leaf ipv6-nd-sll {
150             description "Link layer source address for neighbour discovery message";
151             type yang:mac-address;
152         }
153
154         leaf ipv6-nd-tll {
155             description "Link layer target address for neighbour discovery message";
156             type yang:mac-address;
157         }
158
159         container "ipv6-ext-header" {
160             leaf ipv6-exthdr {
161                 description "IPv6 Extension Header field";
162                 type uint16;
163             }
164
165             leaf ipv6-exthdr-mask {
166                 type uint16 {
167                   range "0..512";
168                 }
169             }
170         }
171     }
172
173     grouping "udp-match-fields" {
174         leaf udp-source-port {
175             description "UDP source port.";
176             type inet:port-number;
177         }
178         leaf udp-source-port-mask {
179             description "UDP source port mask.";
180             type inet:port-number;
181         }
182         leaf udp-destination-port {
183             description "UDP destination port.";
184             type inet:port-number;
185         }
186         leaf udp-destination-port-mask {
187             description "UDP destination port mask.";
188             type inet:port-number;
189         }
190     }
191
192     grouping "protocol-match-fields" {
193         leaf mpls-label {
194             description "Label in the first MPLS shim header";
195             type uint32;
196         }
197
198         leaf mpls-tc {
199             description "TC in the first MPLS shim header";
200             type uint8;
201         }
202
203         leaf mpls-bos {
204             description "BoS bit in the first MPLS shim header";
205             type uint8;
206         }
207
208         container "pbb" {
209             leaf pbb-isid {
210                 description "I-SID in the first PBB service instance tag";
211                 type uint32;
212             }
213
214             leaf pbb-mask {
215                 type uint32 {
216                   range "0..16777216";
217                 }
218             }
219         }
220     }
221
222     grouping "tcp-match-fields" {
223         leaf tcp-source-port {
224             description "TCP source port.";
225             type inet:port-number;
226         }
227         leaf tcp-source-port-mask {
228             description "TCP source port mask.";
229             type inet:port-number;
230         }
231         leaf tcp-destination-port {
232             description "TCP destination port.";
233             type inet:port-number;
234         }
235         leaf tcp-destination-port-mask {
236             description "TCP destination port mask.";
237             type inet:port-number;
238         }
239     }
240
241     grouping "sctp-match-fields" {
242         leaf sctp-source-port {
243             description "SCTP source port.";
244             type inet:port-number;
245         }
246         leaf sctp-destination-port {
247             description "SCTP destination port.";
248             type inet:port-number;
249         }
250     }
251
252     grouping "icmpv4-match-fields" {
253         leaf icmpv4-type {
254         description "ICMP type.";
255             type uint8; // Define ICMP Type
256         }
257         description "ICMP code.";
258         leaf icmpv4-code {
259             type uint8; // Define ICMP Code
260         }
261     }
262
263     grouping "icmpv6-match-fields" {
264         leaf icmpv6-type {
265         description "ICMP type.";
266             type uint8; // Define ICMP Type
267         }
268         description "ICMP code.";
269         leaf icmpv6-code {
270             type uint8; // Define ICMP Code
271         }
272     }
273
274     grouping "arp-match-fields" {
275         leaf arp-op {
276             type uint16;
277         }
278
279         leaf arp-source-transport-address {
280             description "ARP source IPv4 address.";
281             type inet:ipv4-prefix;
282         }
283
284         leaf arp-target-transport-address {
285             description "ARP target IPv4 address.";
286             type inet:ipv4-prefix;
287         }
288         container arp-source-hardware-address {
289             description "ARP source hardware address.";
290             presence "Match field is active and set";
291             uses mac-address-filter;
292         }
293         container arp-target-hardware-address {
294             description "ARP target hardware address.";
295             presence "Match field is active and set";
296             uses mac-address-filter;
297         }
298     }
299
300     grouping "tcp-flags-match-fields" {
301         leaf tcp-flags {
302             description "Tcp flags for match";
303             type uint16;
304         }
305         leaf tcp-flags-mask {
306             description "Mask for tcp flags";
307             type uint16;
308         }
309     }
310
311     grouping "tunnel-ipv4-match-fields" {
312         leaf tunnel-ipv4-source {
313             description "IPv4 source tunnel endpoint address.";
314             type inet:ipv4-prefix;
315         }
316         leaf tunnel-ipv4-destination {
317             description "IPv4 destination tunnel endpoint address.";
318             type inet:ipv4-prefix;
319         }
320     }
321
322     grouping match {
323         leaf in-port {
324             type inv:node-connector-id;
325         }
326
327         leaf in-phy-port {
328             type inv:node-connector-id;
329         }
330
331         container packet-type-match {
332             uses packet-type-fields;
333         }
334
335         container "metadata" {
336             uses of-metadata;
337         }
338
339         container "tunnel" {
340             leaf tunnel-id {
341                 description "Metadata associated in the logical port";
342                 type uint64;
343             }
344
345             leaf tunnel-mask {
346                 type uint64;
347             }
348         }
349
350         container "ethernet-match" {
351             uses "ethernet-match-fields";
352         }
353
354         container "vlan-match" {
355             uses "vlan-match-fields";
356         }
357
358         container "ip-match" {
359             uses "ip-match-fields";
360         }
361
362         choice layer-3-match {
363             case "ipv4-match" {
364                 uses "ipv4-match-fields";
365             }
366             case "ipv4-match-arbitrary-bit-mask"{
367                 uses "mask:ipv4-match-arbitrary-bitmask-fields";
368             }
369             case "ipv6-match" {
370                 uses "ipv6-match-fields";
371             }
372             case "ipv6-match-arbitrary-bit-mask"{
373                 uses ipv6-arbitrary-mask:ipv6-match-arbitrary-bitmask-fields;
374             }
375             case "arp-match" {
376                 uses "arp-match-fields";
377             }
378             case "tunnel-ipv4-match" {
379                 uses "tunnel-ipv4-match-fields";
380             }
381         }
382
383         choice layer-4-match {
384             case "udp-match" {
385                 uses "udp-match-fields";
386             }
387             case "tcp-match" {
388                 uses "tcp-match-fields";
389             }
390             case "sctp-match" {
391                 uses "sctp-match-fields";
392             }
393         }
394
395         container "icmpv4-match" {
396             uses "icmpv4-match-fields";
397         }
398
399         container "icmpv6-match" {
400             uses "icmpv6-match-fields";
401         }
402
403         container "protocol-match-fields" {
404             uses "protocol-match-fields";
405         }
406
407         container tcp-flags-match {
408             uses "tcp-flags-match-fields";
409         }
410     }
411 }