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