blob: 7c99b801531983eb4d49d5e60e2e013de2521770 [file] [log] [blame]
Thomas Vachuska8ca75a22017-08-24 16:12:59 -07001module openconfig-packet-match-types {
2
3 yang-version "1";
4
5 // namespace
6 namespace "http://openconfig.net/yang/packet-match-types";
7
8 prefix "oc-pkt-match-types";
9
10 // import some basic types
11 import openconfig-inet-types { prefix oc-inet; }
12 import openconfig-extensions { prefix oc-ext; }
13
14
15 // meta
16 organization "OpenConfig working group";
17
18 contact
19 "OpenConfig working group
20 www.openconfig.net";
21
22 description
23 "This module defines common types for use in models requiring
24 data definitions related to packet matches.";
25
26 oc-ext:openconfig-version "1.0.0";
27
28 revision "2017-05-26" {
29 description
30 "Separated IP matches into AFs";
31 reference "1.0.0";
32 }
33
34 revision "2016-08-08" {
35 description
36 "OpenConfig public release";
37 reference "0.2.0";
38 }
39
40 revision "2016-04-27" {
41 description
42 "Initial revision";
43 reference "TBD";
44 }
45
46 // extension statements
47
48 // feature statements
49
50 // identity statements
51
52
53 //TODO: should replace this with an official IEEE module
54 // when available. Only a select number of types are
55 // defined in this identity.
56 identity ETHERTYPE {
57 description
58 "Base identity for commonly used Ethertype values used
59 in packet header matches on Ethernet frames. The Ethertype
60 indicates which protocol is encapsulated in the Ethernet
61 payload.";
62 reference
63 "IEEE 802.3";
64 }
65
66 identity ETHERTYPE_IPV4 {
67 base ETHERTYPE;
68 description
69 "IPv4 protocol (0x0800)";
70 }
71
72 identity ETHERTYPE_ARP {
73 base ETHERTYPE;
74 description
75 "Address resolution protocol (0x0806)";
76 }
77
78 identity ETHERTYPE_VLAN {
79 base ETHERTYPE;
80 description
81 "VLAN-tagged frame (as defined by IEEE 802.1q) (0x8100). Note
82 that this value is also used to represent Shortest Path
83 Bridging (IEEE 801.1aq) frames.";
84 }
85
86 identity ETHERTYPE_IPV6 {
87 base ETHERTYPE;
88 description
89 "IPv6 protocol (0x86DD)";
90 }
91
92 identity ETHERTYPE_MPLS {
93 base ETHERTYPE;
94 description
95 "MPLS unicast (0x8847)";
96 }
97
98 identity ETHERTYPE_LLDP {
99 base ETHERTYPE;
100 description
101 "Link Layer Discovery Protocol (0x88CC)";
102 }
103
104 identity ETHERTYPE_ROCE {
105 base ETHERTYPE;
106 description
107 "RDMA over Converged Ethernet (0x8915)";
108 }
109
110
111 //TODO: should replace this with an official IANA module when
112 //available. Only a select set of protocols are defined with
113 //this identity.
114 identity IP_PROTOCOL {
115 description
116 "Base identity for commonly used IP protocols used in
117 packet header matches";
118 reference
119 "IANA Assigned Internet Protocol Numbers";
120 }
121
122 identity IP_TCP {
123 base IP_PROTOCOL;
124 description
125 "Transmission Control Protocol (6)";
126 }
127
128 identity IP_UDP {
129 base IP_PROTOCOL;
130 description
131 "User Datagram Protocol (17)";
132 }
133
134 identity IP_ICMP {
135 base IP_PROTOCOL;
136 description
137 "Internet Control Message Protocol (1)";
138 }
139
140 identity IP_IGMP {
141 base IP_PROTOCOL;
142 description
143 "Internet Group Membership Protocol (2)";
144 }
145
146 identity IP_PIM {
147 base IP_PROTOCOL;
148 description
149 "Protocol Independent Multicast (103)";
150 }
151
152 identity IP_RSVP {
153 base IP_PROTOCOL;
154 description
155 "Resource Reservation Protocol (46)";
156 }
157
158 identity IP_GRE {
159 base IP_PROTOCOL;
160 description
161 "Generic Routing Encapsulation (47)";
162 }
163
164 identity IP_AUTH {
165 base IP_PROTOCOL;
166 description
167 "Authentication header, e.g., for IPSEC (51)";
168 }
169
170 identity IP_L2TP {
171 base IP_PROTOCOL;
172 description
173 "Layer Two Tunneling Protocol v.3 (115)";
174 }
175
176
177
178 identity TCP_FLAGS {
179 description
180 "Common TCP flags used in packet header matches";
181 reference
182 "IETF RFC 793 - Transmission Control Protocol
183 IETF RFC 3168 - The Addition of Explicit Congestion
184 Notification (ECN) to IP";
185 }
186
187 identity TCP_SYN {
188 base TCP_FLAGS;
189 description
190 "TCP SYN flag";
191 }
192
193 identity TCP_FIN {
194 base TCP_FLAGS;
195 description
196 "TCP FIN flag";
197 }
198
199 identity TCP_RST {
200 base TCP_FLAGS;
201 description
202 "TCP RST flag";
203 }
204
205 identity TCP_PSH {
206 base TCP_FLAGS;
207 description
208 "TCP push flag";
209 }
210
211 identity TCP_ACK {
212 base TCP_FLAGS;
213 description
214 "TCP ACK flag";
215 }
216
217 identity TCP_URG {
218 base TCP_FLAGS;
219 description
220 "TCP urgent flag";
221 }
222
223 identity TCP_ECE {
224 base TCP_FLAGS;
225 description
226 "TCP ECN-Echo flag. If the SYN flag is set, indicates that
227 the TCP peer is ECN-capable, otherwise indicates that a
228 packet with Congestion Experienced flag in the IP header
229 is set";
230 }
231
232 identity TCP_CWR {
233 base TCP_FLAGS;
234 description
235 "TCP Congestion Window Reduced flag";
236 }
237
238 // typedef statements
239
240 typedef port-num-range {
241 type union {
242 type string {
243 pattern '^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?' +
244 '[0-9]?)\.\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?' +
245 '[0-9]?[0-9]?)$';
246 }
247 type oc-inet:port-number;
248 type enumeration {
249 enum ANY {
250 description
251 "Indicates any valid port number (e.g., wildcard)";
252 }
253 }
254 }
255 description
256 "Port numbers may be represented as a single value,
257 an inclusive range as <lower>..<higher>, or as ANY to
258 indicate a wildcard.";
259 }
260
261 typedef ip-protocol-type {
262 type union {
263 type uint8 {
264 range 0..254;
265 }
266 type identityref {
267 base IP_PROTOCOL;
268 }
269 }
270 description
271 "The IP protocol number may be expressed as a valid protocol
272 number (integer) or using a protocol type defined by the
273 IP_PROTOCOL identity";
274 }
275
276 typedef ethertype-type {
277 type union {
278 type uint16 {
279 //Note range can only be expressed in decimal
280 //but value is expected in hex notation.
281 range 1..65535;
282 }
283 type identityref {
284 base ETHERTYPE;
285 }
286 }
287 description
288 "The Ethertype value may be expressed as a 16-bit number in
289 hexadecimal notation, or using a type defined by the
290 ETHERTYPE identity";
291 }
292
293}