Add Openconfig YANG modules.
[sweetcomb.git] / src / plugins / yang / openconfig / openconfig-packet-match.yang
1 module openconfig-packet-match {
2
3   yang-version "1";
4
5   // namespace
6   namespace "http://openconfig.net/yang/header-fields";
7
8   prefix "oc-pkt-match";
9
10   // import some basic types
11   import openconfig-inet-types { prefix oc-inet; }
12   import openconfig-yang-types { prefix oc-yang; }
13   import openconfig-packet-match-types { prefix oc-pkt-match-types; }
14   import openconfig-extensions { prefix oc-ext; }
15
16   // meta
17   organization "OpenConfig working group";
18
19   contact
20     "OpenConfig working group
21     www.openconfig.net";
22
23   description
24     "This module defines data related to packet header fields
25     used in matching operations, for example in ACLs.  When a
26     field is omitted from a match expression, the effect is a
27     wildcard ('any') for that field.";
28
29   oc-ext:openconfig-version "1.1.0";
30
31   revision "2017-12-15" {
32     description
33       "Add MPLS packet field matches";
34     reference "1.1.0";
35   }
36
37   revision "2017-05-26" {
38     description
39       "Separated IP matches into AFs";
40     reference "1.0.0";
41   }
42
43   revision "2016-08-08" {
44     description
45       "OpenConfig public release";
46     reference "0.2.0";
47   }
48
49   revision "2016-04-27" {
50     description
51       "Initial revision";
52     reference "TBD";
53   }
54
55
56   // Physical Layer fields
57   // ethernet-header
58   grouping ethernet-header-config {
59     description
60       "Configuration data of fields in Ethernet header.";
61
62     leaf source-mac {
63       type oc-yang:mac-address;
64       description
65         "Source IEEE 802 MAC address.";
66     }
67
68     leaf source-mac-mask {
69       type oc-yang:mac-address;
70       description
71         "Source IEEE 802 MAC address mask.";
72     }
73
74     leaf destination-mac {
75       type oc-yang:mac-address;
76       description
77         "Destination IEEE 802 MAC address.";
78     }
79
80     leaf destination-mac-mask {
81       type oc-yang:mac-address;
82       description
83         "Destination IEEE 802 MAC address mask.";
84     }
85
86     leaf ethertype {
87       type oc-pkt-match-types:ethertype-type;
88       description
89         "Ethertype field to match in Ethernet packets";
90     }
91   }
92
93   grouping ethernet-header-state {
94     description
95       "State information of fields in Ethernet header.";
96   }
97
98   grouping ethernet-header-top {
99     description
100       "Top level container for fields in Ethernet header.";
101
102     container l2 {
103       description
104         "Ethernet header fields";
105
106       container config {
107         description
108           "Configuration data";
109         uses ethernet-header-config;
110       }
111
112       container state {
113         config false;
114         description
115           "State Information.";
116         uses ethernet-header-config;
117         uses ethernet-header-state;
118       }
119     }
120   }
121
122   grouping mpls-header-top {
123     description
124       "Top-level container for fields in an MPLS header.";
125
126     container mpls {
127       description
128         "MPLS header fields";
129
130       container config {
131         description
132           "Configuration parameters relating to fields within
133           the MPLS header.";
134         uses mpls-header-config;
135       }
136
137       container state {
138         config false;
139         description
140           "Operational state parameters relating to fields
141           within the MPLS header";
142         uses mpls-header-config;
143       }
144     }
145   }
146
147   grouping mpls-header-config {
148     description
149       "Configuration parameters relating to matches within
150       MPLS header fields.";
151
152     leaf traffic-class {
153       type uint8 {
154         range "0..7";
155       }
156       description
157         "The value of the MPLS traffic class (TC) bits,
158         formerly known as the EXP bits.";
159     }
160   }
161
162   grouping ip-protocol-fields-common-config {
163     description
164       "IP protocol fields common to IPv4 and IPv6";
165
166     leaf dscp {
167       type oc-inet:dscp;
168       description
169         "Value of diffserv codepoint.";
170     }
171
172     leaf protocol {
173       type oc-pkt-match-types:ip-protocol-type;
174       description
175         "The protocol carried in the IP packet, expressed either
176         as its IP protocol number, or by a defined identity.";
177     }
178
179     leaf hop-limit {
180       type uint8 {
181         range 0..255;
182       }
183       description
184         "The IP packet's hop limit -- known as TTL (in hops) in
185         IPv4 packets, and hop limit in IPv6";
186     }
187   }
188
189   // IP Layer
190   // ip-protocol-fields
191   grouping ipv4-protocol-fields-config {
192     description
193       "Configuration data of IP protocol fields
194       for IPv4";
195
196     leaf source-address {
197       type oc-inet:ipv4-prefix;
198       description
199         "Source IPv4 address prefix.";
200     }
201
202     leaf destination-address {
203       type oc-inet:ipv4-prefix;
204       description
205         "Destination IPv4 address prefix.";
206     }
207
208     uses ip-protocol-fields-common-config;
209
210   }
211
212   grouping ipv4-protocol-fields-state {
213     description
214       "State information of IP header fields for IPv4";
215   }
216
217   grouping ipv4-protocol-fields-top {
218     description
219       "IP header fields for IPv4";
220
221     container ipv4 {
222       description
223         "Top level container for IPv4 match field data";
224
225       container config {
226         description
227           "Configuration data for IPv4 match fields";
228         uses ipv4-protocol-fields-config;
229       }
230
231       container state {
232         config false;
233         description
234           "State information for IPv4 match fields";
235         uses ipv4-protocol-fields-config;
236         uses ipv4-protocol-fields-state;
237       }
238     }
239   }
240
241   grouping ipv6-protocol-fields-config {
242     description
243       "Configuration data for IPv6 match fields";
244
245     leaf source-address {
246       type oc-inet:ipv6-prefix;
247       description
248         "Source IPv6 address prefix.";
249     }
250
251     leaf source-flow-label {
252       type oc-inet:ipv6-flow-label;
253       description
254         "Source IPv6 Flow label.";
255     }
256
257     leaf destination-address {
258       type oc-inet:ipv6-prefix;
259       description
260         "Destination IPv6 address prefix.";
261     }
262
263     leaf destination-flow-label {
264       type oc-inet:ipv6-flow-label;
265       description
266         "Destination IPv6 Flow label.";
267     }
268
269     uses ip-protocol-fields-common-config;
270   }
271
272   grouping ipv6-protocol-fields-state {
273     description
274       "Operational state data for IPv6 match fields";
275   }
276
277   grouping ipv6-protocol-fields-top {
278     description
279       "Top-level grouping for IPv6 match fields";
280
281     container ipv6 {
282       description
283         "Top-level container for IPv6 match field data";
284
285       container config {
286         description
287           "Configuration data for IPv6 match fields";
288
289         uses ipv6-protocol-fields-config;
290       }
291
292       container state {
293
294         config false;
295
296         description
297           "Operational state data for IPv6 match fields";
298
299         uses ipv6-protocol-fields-config;
300         uses ipv6-protocol-fields-state;
301       }
302     }
303   }
304
305   // Transport fields
306   grouping transport-fields-config {
307     description
308       "Configuration data of transport-layer packet fields";
309
310     leaf source-port {
311       type oc-pkt-match-types:port-num-range;
312       description
313         "Source port or range";
314     }
315
316     leaf destination-port {
317       type oc-pkt-match-types:port-num-range;
318       description
319         "Destination port or range";
320     }
321
322     leaf-list tcp-flags {
323       type identityref {
324         base oc-pkt-match-types:TCP_FLAGS;
325       }
326       description
327         "List of TCP flags to match";
328     }
329   }
330
331   grouping transport-fields-state {
332     description
333       "State data of transport-fields";
334   }
335
336   grouping transport-fields-top {
337     description
338       "Destination transport-fields top level grouping";
339
340     container transport {
341       description
342         "Transport fields container";
343
344       container config {
345         description
346           "Configuration data";
347         uses transport-fields-config;
348       }
349
350       container state {
351         config false;
352         description
353           "State data";
354         uses transport-fields-config;
355         uses transport-fields-state;
356       }
357     }
358   }
359
360 }