e265eb0991ae43b4b7d90fc9f7b832fa60a99c51
[openflowjava.git] / openflow-protocol-api / src / main / yang / openflow-extensible-match.yang
1 /*
2  * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8  
9  module openflow-extensible-match {
10     namespace "urn:opendaylight:openflow:oxm";
11     prefix "oxm";
12
13     import ietf-yang-types {prefix yang;}
14     import ietf-inet-types {prefix inet;}
15     import openflow-types {prefix oft;}
16
17     revision "2013-07-31" {
18         description "OpenFlow 1.3 - match model";
19     }
20
21     identity oxm-match-type {
22         description 
23            "The OpenFlow Extensible Match type must be supported by all OpenFlow
24             switches.";
25         base oft:match-type-base;
26     }
27     
28     // oxm classes
29         identity oxm-class-base {
30             description "Base identity for OXM classes";
31         }
32
33         identity nxm-0-class {
34             description "Match class for backward compatibility with NXM";
35             base oxm-class-base;
36         }
37         identity nxm-1-class {
38             description "Match class for backward compatibility with NXM";
39             base oxm-class-base;
40         }
41         identity openflow-basic-class {
42             description "Basic class for OpenFlow";
43             base oxm-class-base;
44         }
45         identity experimenter-class {
46             description 
47                 "Marks Experimenter match type class.
48                 All experimenter match classes MUST use this class as a base.";
49             base oxm-class-base;
50         }
51
52     // field types
53         identity match-field {
54             description "Base identity for OXM Fields";
55         }
56
57         identity in_port {
58             base match-field;
59             description "OXM field for Switch input port.";
60         }
61         identity in_phy_port {
62             base match-field;
63             description "OXM field for Switch physical input port.";
64         }
65         identity metadata {
66             base match-field;
67             description "OXM field for Metadata passed between tables.";
68         }
69         identity eth_dst {
70             base match-field;
71             description "OXM field for Ethernet destination address.";
72         }
73         identity eth_src {
74             base match-field;
75             description "OXM field for Ethernet source address.";
76         }
77         identity eth_type {
78             base match-field;
79             description "OXM field for Ethernet frame type.";
80         }
81         identity vlan_vid {
82             base match-field;
83             description "OXM field for VLAN id.";
84         }
85         identity vlan_pcp {
86             base match-field;
87             description "OXM field for VLAN priority.";
88         }
89         identity ip_dscp {
90             base match-field;
91             description "OXM field for IP DSCP (6 bits in ToS field).";
92         }
93         identity ip_ecn {
94             base match-field;
95             description "OXM field for IP ECN (2 bits in ToS field).";
96         }
97         identity ip_proto {
98             base match-field;
99             description "OXM field for IP protocol.";
100         }
101         identity ipv4_src {
102             base match-field;
103             description "OXM field for IPv4 source address.";
104         }
105         identity ipv4_dst {
106             base match-field;
107             description "OXM field for IPv4 destination address.";
108         }
109         identity tcp_src {
110             base match-field;
111             description "OXM field for TCP source port.";
112         }
113         identity tcp_dst {
114             base match-field;
115             description "OXM field for TCP destination port.";
116         }
117         identity udp_src {
118             base match-field;
119             description "OXM field for UDP source port.";
120         }
121         identity udp_dst {
122             base match-field;
123             description "OXM field for UDP destination port.";
124         }
125         identity sctp_src {
126             base match-field;
127             description "OXM field for SCTP source port.";
128         }
129         identity sctp_dst {
130             base match-field;
131             description "OXM field for SCTP destination port.";
132         }
133         identity icmpv4_type {
134             base match-field;
135             description "OXM field for ICMP type.";
136         }
137         identity icmpv4_code {
138             base match-field;
139             description "OXM field for ICMP code.";
140         }
141         identity arp_op {
142             base match-field;
143             description "OXM field for ARP opcode.";
144         }
145         identity arp_spa {
146             base match-field;
147             description "OXM field for ARP source IPv4 address.";
148         }
149         identity arp_tpa {
150             base match-field;
151             description "OXM field for ARP target IPv4 address.";
152         }
153         identity arp_sha {
154             base match-field;
155             description "OXM field for ARP source hardware address.";
156         }
157         identity arp_tha {
158             base match-field;
159             description "OXM field for ARP target hardware address.";
160         }
161         identity ipv6_src {
162             base match-field;
163             description "OXM field for IPv6 source address.";
164         }
165         identity ipv6_dst {
166             base match-field;
167             description "OXM field for IPv6 destination address.";
168         }
169         identity ipv6_flabel {
170             base match-field;
171             description "OXM field for IPv6 Flow Label";
172         }
173         identity icmpv6_type {
174             base match-field;
175             description "OXM field for ICMPv6 type.";
176         }
177         identity icmpv6_code {
178             base match-field;
179             description "OXM field for ICMPv6 code.";
180         }
181         identity ipv6_nd_target {
182             base match-field;
183             description "OXM field for Target address for ND.";
184         }
185         identity ipv6_nd_sll {
186             base match-field;
187             description "OXM field for Source link-layer for ND.";
188         }
189         identity ipv6_nd_tll {
190             base match-field;
191             description "OXM field for Target link-layer for ND.";
192         }
193         identity mpls_label {
194             base match-field;
195             description "OXM field for MPLS label.";
196         }
197         identity mpls_tc {
198             base match-field;
199             description "OXM field for MPLS TC.";
200         }
201         identity mpls_bos {
202             base match-field;
203             description "OXM field for MPLS BoS bit.";
204         }
205         identity pbb_isid {
206             base match-field;
207             description "OXM field for PBB I-SID.";
208         }
209         identity tunnel_id {
210             base match-field;
211             description "OXM field for Logical Port Metadata";
212         }
213         identity ipv6_exthdr {
214             base match-field;
215             description "OXM field for IPv6 Extension Header pseudo-field";
216         }
217         identity tcp_flag {
218             base match-field;
219             description "NXM field for NXM_NX_TCP_FLAGS";
220         }
221         identity tunnel_ipv4_dst {
222             base match-field;
223             description "NXM field for NXM_NX_TUN_IPV4_DST";
224         }
225         identity tunnel_ipv4_src {
226             base match-field;
227             description "NXM field for NXM_NX_TUN_IPV4_SRC";
228         }
229         container oxm-container {
230             uses oxm-fields-grouping;
231         }
232         
233         grouping oxm-fields-grouping {
234             list match-entries {
235                 description "OXM TLV-structures (Type Length Value)";
236                 config false;
237                 leaf oxm-class {
238                     type identityref {
239                         base oxm-class-base;
240                     }
241                 }
242                 leaf oxm-match-field {
243                     type identityref {
244                         base match-field;
245                     }
246                 }
247                 leaf has-mask {
248                     type boolean;
249                 } 
250             }
251         }
252
253         grouping match-grouping {
254             container match {
255                 description "Match structure (OF v1.3)";
256                 leaf type {
257                     type identityref {
258                         base oft:match-type-base;
259                     }
260                 }
261                 uses oxm-fields-grouping;
262             }
263         }
264
265         // OF1.0 structures
266         grouping match-v10-grouping {
267             container match-v10 {
268                 description "OF v1.0 match structure";
269                 leaf wildcards {
270                     description "Wildcard fields (only flags).";
271                     type oft:flow-wildcards-v10;
272                 }
273                 leaf nw-src-mask {
274                     description "IP source address mask (definition differs from OF v1.0.0 spec to ease
275                      understanding, library does the transformation into OF v1.0 spec correct data)";
276                     type uint8;
277                 }
278                 leaf nw-dst-mask {
279                     description "IP destination address mask (definition differs from OF v1.0.0 spec to ease
280                      understanding, library does the transformation into OF v1.0 spec correct data)";
281                     type uint8;
282                 }
283                 leaf in-port {
284                 description "Input switch port.";
285                     type uint16;
286                 }
287                 leaf dl-src {
288                     description "Ethernet source address.";
289                     type yang:mac-address;
290                 }
291                 leaf dl-dst {
292                     description "Ethernet destination address.";
293                     type yang:mac-address;
294                 }
295                 leaf dl-vlan {
296                     description "Input VLAN id.";
297                     type uint16;
298                 }
299                 leaf dl-vlan-pcp {
300                     description "Input VLAN priority.";
301                     type uint8;
302                 }
303                 leaf dl-type {
304                     description "Ethernet frame type.";
305                     type uint16;
306                 }
307                 leaf nw-tos {
308                     description "IP ToS (actually DSCP field, 6 bits).";
309                     type uint8;
310                 }
311                 leaf nw-proto {
312                     description "IP protocol or lower 8 bits of ARP opcode.";
313                     type uint8;
314                 }
315                 leaf nw-src {
316                     description "IP source address.";
317                     type inet:ipv4-address;
318                 }
319                 leaf nw-dst {
320                     description "IP destination address.";
321                     type inet:ipv4-address;
322                 }
323                 leaf tp-src {
324                     description "TCP/UDP source port.";
325                     type uint16;
326                 }
327                 leaf tp-dst {
328                     description "TCP/UDP destination port.";
329                     type uint16;
330                 }
331             }
332         }
333         
334 }