cd91b1322f950a8f4306b481b349bd5a583ffad0
[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 "Backward compatibility with NXM";
35             base clazz;
36         }
37         identity nxm-1-class {
38             description "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 "Match for Switch input port.";
60         }
61         identity in_phy_port {
62             base match-field;
63             description "Match for Switch physical input port.";
64         }
65         identity metadata {
66             base match-field;
67             description "Match for Metadata passed between tables.";
68         }
69         identity eth_dst {
70             base match-field;
71             description "Match for Ethernet destination address.";
72         }
73         identity eth_src {
74             base match-field;
75             description "Match for Ethernet source address.";
76         }
77         identity eth_type {
78             base match-field;
79             description "Match for Ethernet frame type.";
80         }
81         identity vlan_vid {
82             base match-field;
83             description "Match for VLAN id.";
84         }
85         identity vlan_pcp {
86             base match-field;
87             description "Match for VLAN priority.";
88         }
89         identity ip_dscp {
90             base match-field;
91             description "Match for IP DSCP (6 bits in ToS field).";
92         }
93         identity ip_ecn {
94             base match-field;
95             description "Match for IP ECN (2 bits in ToS field).";
96         }
97         identity ip_proto {
98             base match-field;
99             description "Match for IP protocol.";
100         }
101         identity ipv4_src {
102             base match-field;
103             description "Match for IPv4 source address.";
104         }
105         identity ipv4_dst {
106             base match-field;
107             description "Match for IPv4 destination address.";
108         }
109         identity tcp_src {
110             base match-field;
111             description "Match for TCP source port.";
112         }
113         identity tcp_dst {
114             base match-field;
115             description "Match for TCP destination port.";
116         }
117         identity udp_src {
118             base match-field;
119             description "Match for UDP source port.";
120         }
121         identity udp_dst {
122             base match-field;
123             description "Match for UDP destination port.";
124         }
125         identity sctp_src {
126             base match-field;
127             description "Match for SCTP source port.";
128         }
129         identity sctp_dst {
130             base match-field;
131             description "Match for SCTP destination port.";
132         }
133         identity icmpv4_type {
134             base match-field;
135             description "Match for ICMP type.";
136         }
137         identity icmpv4_code {
138             base match-field;
139             description "Match for ICMP code.";
140         }
141         identity arp_op {
142             base match-field;
143             description "Match for ARP opcode.";
144         }
145         identity arp_spa {
146             base match-field;
147             description "Match for ARP source IPv4 address.";
148         }
149         identity arp_tpa {
150             base match-field;
151             description "Match for ARP target IPv4 address.";
152         }
153         identity arp_sha {
154             base match-field;
155             description "Match for ARP source hardware address.";
156         }
157         identity arp_tha {
158             base match-field;
159             description "Match for ARP target hardware address.";
160         }
161         identity ipv6_src {
162             base match-field;
163             description "Match for IPv6 source address.";
164         }
165         identity ipv6_dst {
166             base match-field;
167             description "Match for IPv6 destination address.";
168         }
169         identity ipv6_flabel {
170             base match-field;
171             description "Match for IPv6 Flow Label";
172         }
173         identity icmpv6_type {
174             base match-field;
175             description "Match for ICMPv6 type.";
176         }
177         identity icmpv6_code {
178             base match-field;
179             description "Match for ICMPv6 code.";
180         }
181         identity ipv6_nd_target {
182             base match-field;
183             description "Match for Target address for ND.";
184         }
185         identity ipv6_nd_sll {
186             base match-field;
187             description "Match for Source link-layer for ND.";
188         }
189         identity ipv6_nd_tll {
190             base match-field;
191             description "Match for Target link-layer for ND.";
192         }
193         identity mpls_label {
194             base match-field;
195             description "Match for MPLS label.";
196         }
197         identity mpls_tc {
198             base match-field;
199             description "Match for MPLS TC.";
200         }
201         identity mpls_bos {
202             base match-field;
203             description "Match for MPLS BoS bit.";
204         }
205         identity pbb_isid {
206             base match-field;
207             description "Match for PBB I-SID.";
208         }
209         identity tunnel_id {
210             base match-field;
211             description "Match for Logical Port Metadata";
212         }
213         identity ipv6_exthdr {
214             base match-field;
215             description "Match 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                 key "oxm-class oxm-match-field has-mask";
225                 leaf oxm-class {
226                     type identityref {
227                         base clazz;
228                     }
229                 }
230                 leaf oxm-match-field {
231                     type identityref {
232                         base match-field;
233                     }
234                 }
235                 leaf has-mask {
236                     type boolean;
237                 } 
238             }
239         }
240         
241         // OF1.0 structures
242         grouping match-v10-grouping {
243             container match-v10 {
244                 leaf wildcards {
245                     type oft:flow-wildcards-v10;
246                 }
247                 leaf nw-src-mask {
248                     type uint8;
249                 }
250                 leaf nw-dst-mask {
251                     type uint8;
252                 }
253                 leaf in-port {
254                     type uint16;
255                 }
256                 leaf dl-src {
257                     type yang:mac-address;
258                 }
259                 leaf dl-dst {
260                     type yang:mac-address;
261                 }
262                 leaf dl-vlan {
263                     type uint16;
264                 }
265                 leaf dl-vlan-pcp {
266                     type uint8;
267                 }
268                 leaf dl-type {
269                     type uint16;
270                 }
271                 leaf nw-tos {
272                     type uint8;
273                 }
274                 leaf nw-proto {
275                     type uint8;
276                 }
277                 leaf nw-src {
278                     type inet:ipv4-address;
279                 }
280                 leaf nw-dst {
281                     type inet:ipv4-address;
282                 }
283                 leaf tp-src {
284                     type uint16;
285                 }
286                 leaf tp-dst {
287                     type uint16;
288                 }
289             }
290         }
291         
292 }