-
Notifications
You must be signed in to change notification settings - Fork 1
502 lines (398 loc) · 15.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
module ietf-if-flexible-encapsulation {
yang-version 1.1;
namespace
"urn:ietf:params:xml:ns:yang:ietf-if-flexible-encapsulation";
prefix if-flex;
import ietf-interfaces {
prefix if;
reference
"RFC 8343: A YANG Data Model For Interface Management";
}
import iana-if-type {
prefix ianaift;
reference
"RFC 7224: IANA Interface Type YANG Module";
}
import ieee802-dot1q-types {
prefix dot1q-types;
revision-date 2022-01-19;
reference
"IEEE Std 802.1Q-2022: IEEE Standard for Local and
metropolitan area networks -- Bridges and Bridged Networks";
}
import ietf-if-extensions {
prefix if-ext;
reference
"RFC XXXX: Common Interface Extension YANG Data Models";
}
organization
"IETF NETMOD (NETCONF Data Modeling Language) Working Group";
contact
"WG Web: <http://tools.ietf.org/wg/netmod/>
WG List: <mailto:[email protected]>
Editor: Robert Wilton
<mailto:[email protected]>";
description
"This YANG module describes interface configuration for flexible
classification and rewrites of IEEE 802.1Q VLAN tagged Ethernet
traffic.
Copyright (c) 2022 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject to
the license terms contained in, the Revised BSD License set
forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(https://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC XXXX
(https://www.rfc-editor.org/info/rfcXXXX); see the RFC itself
for full legal notices.
The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL
NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED',
'MAY', and 'OPTIONAL' in this document are to be interpreted as
described in BCP 14 (RFC 2119) (RFC 8174) when, and only when,
they appear in all capitals, as shown here.";
revision 2023-01-26 {
description
"Latest draft revision";
reference
"RFC XXXX: Sub-interface VLAN YANG Data Models";
}
feature flexible-rewrites {
description
"This feature indicates that the network element supports
specifying flexible rewrite operations.";
}
feature asymmetric-rewrites {
description
"This feature indicates that the network element supports
specifying different rewrite operations for the ingress
rewrite operation and egress rewrite operation.";
}
feature dot1q-tag-rewrites {
description
"This feature indicates that the network element supports the
flexible rewrite functionality specifying 802.1Q tag
rewrites.";
}
grouping flexible-match {
description
"Represents a flexible frame classification:
The rules for a flexible match are:
1. Match-type: default, untagged, priority tag, or tag
stack.
2. Each tag in the stack of tags matches:
a. tag type (802.1Q or 802.1ad) +
b. tag value:
i. single tag
ii. set of tag ranges/values.
iii. 'any' keyword";
choice match-type {
mandatory true;
description
"Provides a choice of how the frames may be
matched";
case default {
description
"Default match";
leaf default {
type empty;
description
"Default match. Matches all traffic not matched to any
other peer sub-interface by a more specific
encapsulation.";
}
}
case untagged {
description
"Match untagged Ethernet frames only";
leaf untagged {
type empty;
description
"Untagged match. Matches all untagged traffic.";
}
}
case dot1q-priority-tagged {
description
"Match 802.1Q priority tagged Ethernet frames only";
container dot1q-priority-tagged {
description
"802.1Q priority tag match";
leaf tag-type {
type dot1q-types:dot1q-tag-type;
mandatory true;
description
"The 802.1Q tag type of matched priority
tagged packets";
}
}
}
case dot1q-vlan-tagged {
container dot1q-vlan-tagged {
description
"Matches VLAN tagged frames";
container outer-tag {
must 'tag-type = "dot1q-types:s-vlan" or '
+ 'tag-type = "dot1q-types:c-vlan"' {
error-message
"Only C-VLAN and S-VLAN tags can be matched.";
description
"For IEEE 802.1Q interoperability, only C-VLAN and
S-VLAN tags can be matched.";
}
description
"Classifies traffic using the outermost (first) VLAN
tag on the frame.";
uses "dot1q-types:"
+ "dot1q-tag-ranges-or-any-classifier-grouping";
}
container second-tag {
must
'../outer-tag/tag-type = "dot1q-types:s-vlan" and '
+ 'tag-type = "dot1q-types:c-vlan"' {
error-message
"When matching two tags, the outermost (first) tag
must be specified and of S-VLAN type and the second
outermost tag must be of C-VLAN tag type.";
description
"For IEEE 802.1Q interoperability, when matching two
tags, it is required that the outermost (first) tag
exists and is an S-VLAN, and the second outermost
tag is a C-VLAN.";
}
presence "Also classify on the second VLAN tag.";
description
"Classifies traffic using the second outermost VLAN tag
on the frame.";
uses "dot1q-types:"
+ "dot1q-tag-ranges-or-any-classifier-grouping";
}
leaf match-exact-tags {
type empty;
description
"If set, indicates that all 802.1Q VLAN tags in the
Ethernet frame header must be explicitly matched, i.e.
the EtherType following the matched tags must not be a
802.1Q tag EtherType. If unset then extra 802.1Q VLAN
tags are allowed.";
}
}
}
}
}
grouping dot1q-tag-rewrite {
description
"Flexible rewrite grouping. Can be either be expressed
symmetrically, or independently in the ingress and/or egress
directions.";
leaf pop-tags {
type uint8 {
range "1..2";
}
description
"The number of 802.1Q VLAN tags to pop, or translate if used
in conjunction with push-tags.
Popped tags are the outermost tags on the frame.";
}
container push-tags {
presence "802.1Q tags are pushed or translated";
description
"The 802.1Q tags to push on the front of the frame, or
translate if configured in conjunction with pop-tags.";
container outer-tag {
must 'tag-type = "dot1q-types:s-vlan" or '
+ 'tag-type = "dot1q-types:c-vlan"' {
error-message "Only C-VLAN and S-VLAN tags can be pushed.";
description
"For IEEE 802.1Q interoperability, only C-VLAN and S-VLAN
tags can be pushed.";
}
description
"The outermost (first) VLAN tag to push onto the frame.";
uses dot1q-types:dot1q-tag-classifier-grouping;
}
container second-tag {
must '../outer-tag/tag-type = "dot1q-types:s-vlan" and '
+ 'tag-type = "dot1q-types:c-vlan"' {
error-message
"When pushing/rewriting two tags, the outermost tag must
be specified and of S-VLAN type and the second outermost
tag must be of C-VLAN tag type.";
description
"For IEEE 802.1Q interoperability, when pushing two tags,
it is required that the outermost tag exists and is an
S-VLAN, and the second outermost tag is a C-VLAN.";
}
presence
"In addition to the first tag, also push/rewrite a second
VLAN tag.";
description
"The second outermost VLAN tag to push onto the frame.";
uses dot1q-types:dot1q-tag-classifier-grouping;
}
}
}
grouping flexible-rewrite {
description
"Grouping for flexible rewrites of fields in the L2 header.
Restricted to flexible 802.1Q VLAN tag rewrites, but could be
extended to cover rewrites of other fields in the L2 header in
future.";
container dot1q-tag-rewrite {
if-feature "dot1q-tag-rewrites";
description
"802.1Q VLAN tag rewrite.
Translate operations are expressed as a combination of tag
push and pop operations. E.g., translating the outer tag is
expressed as popping a single tag, and pushing a single tag.
802.1Q tags that are translated SHOULD preserve the PCP and
DEI fields unless if a different QoS behavior has been
specified.";
uses dot1q-tag-rewrite;
}
}
augment "/if:interfaces/if:interface/if-ext:encapsulation/"
+ "if-ext:encaps-type" {
when "derived-from-or-self(../if:type,
'ianaift:ethernetCsmacd') or
derived-from-or-self(../if:type,
'ianaift:ieee8023adLag') or
derived-from-or-self(../if:type, 'ianaift:l2vlan') or
derived-from-or-self(../if:type,
'if-ext:ethSubInterface')" {
description
"Applies only to Ethernet-like interfaces and
sub-interfaces.";
}
description
"Augment the generic interface encapsulation with flexible
match and rewrite for VLAN sub-interfaces.";
case flexible {
description
"Flexible encapsulation and rewrite";
container flexible {
description
"Flexible encapsulation allows for the matching of ranges
and sets of 802.1Q VLAN Tags and performing rewrite
operations on the VLAN tags.
The structure is also designed to be extended to allow for
matching/rewriting other fields within the L2 frame header
if required.";
container match {
description
"Flexibly classifies Ethernet frames to a sub-interface
(or interface) based on the L2 header fields.
Only frames matching the classification configured on a
sub-interface/interface are processed on that
sub-interface/interface.
Frames that do not match any sub-interface are processed
directly on the parent interface, if it is associated
with a forwarding instance, otherwise they are dropped.
If a frame could be classified to multiple
sub-interfaces then they get classified to the
sub-interface with the most specific match. E.g.,
matching two VLAN tags in the frame is more specific
than matching the outermost VLAN tag, which is more
specific than the catch all 'default' match.";
uses flexible-match;
}
container rewrite {
if-feature "flexible-rewrites";
description
"L2 frame rewrite operations.
Rewrites allows for modifications to the L2 frame header
as it transits the interface/sub-interface. Examples
include adding a VLAN tag, removing a VLAN tag, or
rewriting the VLAN Id carried in a VLAN tag.";
choice direction {
description
"Whether the rewrite policy is symmetrical or
asymmetrical.";
case symmetrical {
container symmetrical {
uses flexible-rewrite;
description
"Symmetrical rewrite. Expressed in the ingress
direction, but the reverse operation is applied to
egress traffic.
E.g., if a tag is pushed on ingress traffic, then
the reverse operation is a 'pop 1', that is
performed on traffic egressing the interface, so
a peer device sees a consistent L2 encapsulation
for both ingress and egress traffic.";
}
}
case asymmetrical {
if-feature "asymmetric-rewrites";
description
"Asymmetrical rewrite.
Rewrite operations may be specified in only a single
direction, or different rewrite operations may be
specified in each direction.";
container ingress {
uses flexible-rewrite;
description
"A rewrite operation that only applies to ingress
traffic.
Ingress rewrite operations are performed before
the frame is subsequently processed by the
forwarding operation.";
}
container egress {
uses flexible-rewrite;
description
"A rewrite operation that only applies to egress
traffic.";
}
}
}
}
container local-traffic-default-encaps {
presence "A local traffic default encapsulation has been
specified.";
description
"Specifies the 802.1Q VLAN tags to use by default for
locally sourced traffic from the interface.
Used for encapsulations that match a range of VLANs (or
'any'), where the source VLAN Ids are otherwise
ambiguous.";
container outer-tag {
must 'tag-type = "dot1q-types:s-vlan" or '
+ 'tag-type = "dot1q-types:c-vlan"' {
error-message
"Only C-VLAN and S-VLAN tags can be matched.";
description
"For IEEE 802.1Q interoperability, only C-VLAN and
S-VLAN tags can be matched.";
}
description
"The outermost (first) VLAN tag for locally sourced
traffic.";
uses dot1q-types:dot1q-tag-classifier-grouping;
}
container second-tag {
must
'../outer-tag/tag-type = "dot1q-types:s-vlan" and '
+ 'tag-type = "dot1q-types:c-vlan"' {
error-message
"When specifying two tags, the outermost (first) tag
must be specified and of S-VLAN type and the second
outermost tag must be of C-VLAN tag type.";
description
"For IEEE 802.1Q interoperability, when specifying
two tags, it is required that the outermost (first)
tag exists and is an S-VLAN, and the second
outermost tag is a C-VLAN.";
}
presence
"Indicates existence of a second outermost VLAN tag.";
description
"The second outermost VLAN tag for locally sourced
traffic.";
uses dot1q-types:dot1q-tag-classifier-grouping;
}
}
}
}
}
}