-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathyang-models-basic
executable file
·594 lines (579 loc) · 17.2 KB
/
yang-models-basic
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
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
=======================================================================================================
DATA MODEL FOR DEFINING SWITCH HARDWARE
=======================================================================================================
module switches {
namespace "http://example.com/switches";
prefix "switches";
import ietf-inet-type {
prefix inet;
}
// Example usage of ietf-inet-type
// leaf interface_ip {
// type inet:ipv4-address;
// }
organization "Cisco Systems";
contact "[email protected]";
description "Module to Model switches. Lab for Cisco System IT NSO Training.";
//Defines the revision
revision 2018-09-19 {
description
"Initial revision.";
reference
"RFC 7317: A YANG Data Model for System Management";
}
list Switches {
key Model_Number;
description "Model that repersents generic switches across manufacturers";
leaf Manufacturer {
type enumeration {
enum 'Cisco' {
description "Cisco Systems, cisco.com";
reference "Ref goes here";
}
enum 'Juniper' {
description "Juniper Networks, juniper.com";
}
enum 'Arista' {
description "Arista Networks, arista.com";
}
enum 'HP' {
description "Hewlett Packard, hp.com";
}
}
description "Manufacturer of the switch";
}
leaf host-name {
type string;
description "Hostname for this system";
}
leaf Model_Number {
type string;
description "The PID or unique product identifier for the model";
}
leaf Platform_Series {
type string;
description "The model series that the PID belongs to. For example a 3850 would belong to the 3800 series switches";
}
list Interfaces {
key Interface_Type;
description "List of Interface Type adn number of interfaces available of that type";
leaf Interface_Type {
type enumeration {
enum 'FastEthernet' {
description "For FastEthernet interfaces";
}
enum 'GigabitEthernet'{
description "For GigabitEthernet interfaces";
}
enum 'TenGigabitEthernet' {
description "For TenGigEthernet interfaces";
}
enum 'FortyGigabitEthernet' {
description "For FortyGigEthernet interfaces";
}
enum 'Tunnel' {
description "For tunnel interfaces";
}
}
description "The physical type of interface. ie Fe, Ge, TeG, etc..";
}
leaf Number_of_Interfaces {
type int64 {
range "0 .. 48";
}
description "The number of interfaces of the provided type that the switch has.";
}
}
leaf MSRP {
type int64;
description "The Manufacturer Specified Retail Price of the switch in (currency of choice)";
}
}
}
=======================================================================================================
DATA MODEL FOR CONFIGURING A SWITCHPORT
=======================================================================================================
grouping config-interface-switchport-grouping {
container access {
description
"Set access mode characteristics of the interface";
container vlan {
description
"Set VLAN when interface is in access mode";
leaf vlan {
type union {
type uint16 {
range "1..4094";
}
type enumeration {
enum "dynamic";
}
}
}
leaf name {
description
"Vlan name";
type string;
}
}
}
// backup Set backup for the interface
// interface * / switchport block
container block {
description
"Disable forwarding of unknown uni/multi cast addresses";
leaf multicast {
description
"Block unknown multicast addresses";
type empty;
}
leaf unicast {
description
"Block unknown unicast addresses";
type empty;
}
}
// dot1q Set interface dot1q properties
// interface * / switchport mode
container mode {
description
"Set trunking mode of the interface";
choice mode-choice {
container access {
presence "true";
description
"Set trunking mode to ACCESS unconditionally";
}
container dot1q-tunnel {
presence "true";
description
"set trunking mode to TUNNEL unconditionally";
}
leaf dynamic {
description
"Set trunking mode to dynamically negotiate access or trunk mode";
type enumeration {
enum "auto";
enum "desirable";
}
}
container private-vlan {
description
"Set private-vlan mode";
leaf host {
description
"Set the mode to private-vlan host";
type empty;
}
leaf promiscuous {
description
"Set the mode to private-vlan promiscuous";
type empty;
}
}
container trunk {
presence "true";
description
"Set trunking mode to TRUNK unconditionally";
}
}
}
// interface * / switchport nonegotiate
leaf nonegotiate {
description
"Device will not engage in negotiation protocol on this interface";
type empty;
}
// interface * / switchport port-security
container port-security {
description
"Security related command";
presence "true";
container aging {
description
"Port-security aging commands";
leaf static {
description
"Enable aging for configured secure addresses";
type empty;
}
leaf time {
description
"Port-security aging time";
type uint16 {
range "1..1440";
}
}
leaf type {
description
"Port-security aging type";
type enumeration {
enum "absolute";
enum "inactivity";
}
}
}
container mac-address {
description
"Secure mac address";
leaf sticky {
description
"Configure dynamic secure addresses as sticky";
type empty;
}
leaf hw-address {
type yang:mac-address;
}
leaf vlan {
description
"set VLAN ID of the VLAN on which this address can be learned";
type uint16 {
range "1..4094";
}
}
}
container maximum {
description
"Max secure addresses";
leaf max-addresses {
type uint16 {
range "1..4097";
}
}
leaf vlan {
description
"Max secure addresses per vlan";
type string;
}
}
leaf violation {
description
"Security violation mode";
type enumeration {
enum "protect";
enum "restrict";
enum "shutdown";
}
}
}
// interface * / switchport trunk
container trunk {
description
"Set trunking characteristics of the interface";
// interface * / switchport trunk allowed
container allowed {
description
"Set allowed VLAN characteristics when interface is in trunking mode";
// interface * / switchport trunk allowed vlan
container vlan {
description
"Set allowed VLANs when interface is in trunking mode";
choice vlan-choice {
leaf vlans {
type string;
}
leaf add {
description
"VLAN IDs of the allowed VLANs when this port is in trunking mode";
type union {
type uint16;
type string;
}
}
leaf all {
description
"all VLANs";
type empty;
}
leaf-list except {
description
"all VLANs except the following";
type union {
type uint16;
type string;
}
}
leaf none {
description
"no VLANs";
type empty;
}
leaf remove {
description
"VLAN IDs of disallowed VLANS when this port is in trunking mode";
type union {
type uint16;
type string;
}
}
}
}
}
// interface * / switchport trunk encapsulation
leaf encapsulation {
description
"Set encapsulation format on trunk port";
type enumeration {
enum "dot1q";
enum "isl";
enum "negotiate";
}
}
// interface * / switchport trunk native
container native {
description
"Set trunking native characteristics when interface is in trunking mode";
leaf vlan {
description
"Set native VLAN when interface is in trunking mode";
type union {
type enumeration {
enum "tag";
}
type uint16 {
range "1..4094";
}
}
}
}
// interface * / switchport trunk pruning
container pruning {
description
"Set pruning VLAN characteristics when interface is in trunking mode";
container vlan {
description
"Set VLANs enabled for pruning when interface is in trunking mode";
choice vlan-choice {
leaf-list vlans {
type union {
type uint16;
type string;
}
}
leaf add {
description
"VLAN IDs of the allowed VLANs when this port is in trunking mode";
type union {
type uint16;
type string;
}
}
leaf-list except {
description
"all VLANs except the following";
type union {
type uint16;
type string;
}
}
leaf none {
description
"no VLANs";
type empty;
}
leaf remove {
description
"VLAN IDs of disallowed VLANS when this port is in trunking mode";
type union {
type uint16;
type string;
}
}
}
}
}
}
// interface * / switchport voice
container voice {
description
"Voice appliance attributes";
container vlan {
description
"Vlan for voice traffic";
leaf vlan {
type union {
type enumeration {
enum "dot1p";
enum "none";
enum "untagged";
}
type uint16 {
range "1..4094";
}
type string;
}
}
leaf name {
description
"Vlan name";
type string;
}
}
container detect {
description
"detection enhancement keyword";
container cisco-phone {
description
"Cisco IP phone";
presence "true";
leaf full-duplex {
description
"full duplex keyword";
type empty;
}
}
}
}
// interface * / switchport priority
container priority {
description
"Set appliance 802.1p priority";
container extend {
description
"Set appliance 802.1p priority";
choice trust-choice {
leaf trust {
description
"Trust 802.1p priorities of devices on appliance";
type empty;
}
leaf cos {
description
"Override 802.1p priority of devices on appliance";
type uint8 {
range "0..7";
}
}
}
}
}
// interface * / switchport autostate
container autostate {
description
"Include or exclude this port from vlan link up calculation";
leaf exclude {
description
"Exclude this port from vlan link up calculation";
type empty;
}
}
// interface * / switchport protected
leaf protected {
description
"Configure an interface to be a protected port";
type empty;
}
// interface * / switchport host
leaf host {
description
"Set port host";
type empty;
}
//interface * /switchport private-vlan
container private-vlan {
description
"Set the private VLAN configuration";
container association {
description
"Set the private VLAN association";
container host {
description
"Set the private VLAN host association";
leaf primary-range {
description
"Primary normal range VLAN ID of the private VLAN port association";
type uint16 {
range "2..1001 | 1006..4094";
}
}
leaf secondary-range {
description
"Secondary normal range VLAN ID of the private VLAN host port association";
type uint16 {
range "2..1001 | 1006..4094";
}
}
}
container mapping {
description
"Set the private VLAN promiscuous mapping";
leaf primary-range {
description
"Primary normal range VLAN ID of the private VLAN promiscuous port mapping";
type uint16 {
range "2..1001 | 1006..4094";
}
}
leaf secondary-range {
description
"Secondary VLAN IDs of the private VLAN promiscuous port mapping";
type string;
}
leaf add {
description
"Secondary VLAN IDs of the private VLAN promiscuous port mapping";
type string;
}
leaf remove {
description
"Secondary VLAN IDs of the private VLAN promiscuous port mapping";
type string;
}
}
}
container host-association {
description
"Set the private VLAN host association";
leaf primary-range {
description
"Primary normal range VLAN ID of the private VLAN port association";
type uint16 {
range "2..1001 | 1006..4094";
}
}
leaf secondary-range {
description
"Secondary normal range VLAN ID of the private VLAN host port association";
type uint16 {
range "2..1001 | 1006..4094";
}
}
}
container mapping {
description
"Set the private VLAN promiscuous mapping";
leaf primary-range {
description
"Primary normal range VLAN ID of the private VLAN promiscuous port mapping";
type uint16 {
range "2..1001 | 1006..4094";
}
}
leaf secondary-range {
description
"Secondary VLAN IDs of the private VLAN promiscuous port mapping";
type string;
}
leaf add {
description
"Secondary VLAN IDs of the private VLAN promiscuous port mapping";
type string;
}
leaf remove {
description
"Secondary VLAN IDs of the private VLAN promiscuous port mapping";
type string;
}
}
}
// interface * / switchport vepa enabled
container vepa {
description
"Reflective relay configuration";
leaf enabled {
description
"Enable reflective relay";
type empty;
}
}
}