Model updated with descriptions
[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 clazz {
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 clazz;
36         }
37         identity nxm-1-class {
38             description "Match class for backward compatibility with NXM";
39             base clazz;
40         }
41         identity openflow-basic-class {
42             description "Basic class for OpenFlow";
43             base clazz;
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 clazz;
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
218         container oxm-container {
219             uses oxm-fields;
220         }
221         
222         grouping oxm-fields {
223             list match-entries {
224                 description "OXM TLV-structures (Type Length Value)";
225                 key "oxm-class oxm-match-field has-mask";
226                 leaf oxm-class {
227                     type identityref {
228                         base clazz;
229                     }
230                 }
231                 leaf oxm-match-field {
232                     type identityref {
233                         base match-field;
234                     }
235                 }
236                 leaf has-mask {
237                     type boolean;
238                 } 
239             }
240         }
241         
242         // OF1.0 structures
243         grouping match-v10-grouping {
244             container match-v10 {
245                 description "OF v1.0 match structure";
246                 leaf wildcards {
247                     description "Wildcard fields (only flags).";
248                     type oft:flow-wildcards-v10;
249                 }
250                 leaf nw-src-mask {
251                     description "IP source address mask (definition differs from OF v1.0.0 spec to ease
252                      understanding, library does the transformation into OF v1.0 spec correct data)";
253                     type uint8;
254                 }
255                 leaf nw-dst-mask {
256                     description "IP destination address mask (definition differs from OF v1.0.0 spec to ease
257                      understanding, library does the transformation into OF v1.0 spec correct data)";
258                     type uint8;
259                 }
260                 leaf in-port {
261                 description "Input switch port.";
262                     type uint16;
263                 }
264                 leaf dl-src {
265                     description "Ethernet source address.";
266                     type yang:mac-address;
267                 }
268                 leaf dl-dst {
269                     description "Ethernet destination address.";
270                     type yang:mac-address;
271                 }
272                 leaf dl-vlan {
273                     description "Input VLAN id.";
274                     type uint16;
275                 }
276                 leaf dl-vlan-pcp {
277                     description "Input VLAN priority.";
278                     type uint8;
279                 }
280                 leaf dl-type {
281                     description "Ethernet frame type.";
282                     type uint16;
283                 }
284                 leaf nw-tos {
285                     description "IP ToS (actually DSCP field, 6 bits).";
286                     type uint8;
287                 }
288                 leaf nw-proto {
289                     description "IP protocol or lower 8 bits of ARP opcode.";
290                     type uint8;
291                 }
292                 leaf nw-src {
293                     description "IP source address.";
294                     type inet:ipv4-address;
295                 }
296                 leaf nw-dst {
297                     description "IP destination address.";
298                     type inet:ipv4-address;
299                 }
300                 leaf tp-src {
301                     description "TCP/UDP source port.";
302                     type uint16;
303                 }
304                 leaf tp-dst {
305                     description "TCP/UDP destination port.";
306                     type uint16;
307                 }
308             }
309         }
310         
311 }