-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Copy pathsonic-port.yang
248 lines (194 loc) · 5.06 KB
/
sonic-port.yang
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
module sonic-port{
yang-version 1.1;
namespace "http://github.com/sonic-net/sonic-port";
prefix port;
import sonic-types {
prefix stypes;
}
import sonic-extension {
prefix ext;
}
import sonic-device_metadata {
prefix sdm;
}
import sonic-macsec {
prefix macsec;
}
description "PORT yang Module for SONiC OS";
revision 2019-07-01 {
description "First Revision";
}
container sonic-port{
container PORT {
description "PORT part of config_db.json";
list PORT_LIST {
key "name";
leaf name {
type string {
length 1..128;
}
}
leaf core_id {
description "The ASIC core where the port belongs to.";
type string {
length 1..16;
}
}
leaf core_port_id {
description "The ASIC core port for this port.";
type string {
length 1..16;
}
}
leaf num_voq {
description "The number of virtual output queue supportted on this port.";
type string {
length 1..16;
}
}
leaf alias {
type string {
length 1..128;
}
}
leaf lanes {
when "not(not(/sdm:sonic-device_metadata/sdm:DEVICE_METADATA/sdm:localhost/sdm:asic_name) and
((/sdm:sonic-device_metadata/sdm:DEVICE_METADATA/sdm:localhost/sdm:switch_type='voq') or
(/sdm:sonic-device_metadata/sdm:DEVICE_METADATA/sdm:localhost/sdm:switch_type='chassis-packet') or
(/sdm:sonic-device_metadata/sdm:DEVICE_METADATA/sdm:localhost/sdm:switch_type='fabric') or
(/sdm:sonic-device_metadata/sdm:DEVICE_METADATA/sdm:localhost/sdm:hwsku='msft_four_asic_vs') or
(/sdm:sonic-device_metadata/sdm:DEVICE_METADATA/sdm:localhost/sdm:hwsku='msft_multi_asic_vs')))";
description "Number of hardware lanes for the port. This is mandatory for all devices except for chassis devices";
mandatory true;
type string {
length 1..128;
}
}
leaf mode {
description "SwitchPort Modes possible values are routed|access|trunk. Default value for mode is routed";
type stypes:switchport_mode;
}
leaf description {
type string {
length 0..255;
}
}
leaf speed {
mandatory true;
type uint32 {
range 1..800000;
}
}
leaf dhcp_rate_limit {
description "DHCP DOS Mitigation Rate with default value 300";
type uint32;
default 300;
}
leaf link_training {
description "Port link training mode";
type string {
pattern "on|off";
}
}
leaf autoneg {
description "Port auto negotiation mode";
type string {
pattern "on|off";
}
}
leaf-list adv_speeds {
description "Port advertised speeds, valid value could be a list of interger or all";
type union {
type uint32 {
range 1..800000;
}
type string {
pattern "all";
}
}
}
must "(count(adv_speeds[text()='all']) = 0) or (count(adv_speeds) = 1)";
leaf interface_type {
description "Port interface type";
type stypes:interface_type;
}
leaf-list adv_interface_types {
description "Port advertised interface type, valid value could be a list of stypes:interface_type or all";
type union {
type stypes:interface_type;
type string {
pattern "all";
}
}
}
must "(count(adv_interface_types[text()='all']) = 0) or (count(adv_interface_types) = 1)";
leaf mtu {
type uint16 {
range 68..9216;
}
}
leaf subport {
description "Logical subport(s) for physical port breakout";
type uint8 {
range 0..8;
}
}
leaf index {
type uint16;
}
leaf asic_port_name {
type string;
description "port name in asic and asic name, e.g Eth0-ASIC1";
}
leaf role {
type string {
pattern "Ext|Int|Inb|Rec|Dpc";
}
description "Internal port or External port for multi-asic or SmartSwitch platform";
default "Ext";
}
leaf admin_status {
type stypes:admin_status;
default down;
}
leaf fec {
type string {
pattern "rs|fc|none|auto";
}
}
leaf dom_polling {
type stypes:admin_mode;
}
leaf pfc_asym {
type string {
pattern "on|off";
}
}
leaf tpid {
description "This leaf describes the possible TPID value that can be configured
to the specified port if the HW supports TPID configuration. The possible
values are 0x8100, 0x9100, 0x9200, 0x88a8, and 0x88A8";
type stypes:tpid_type;
}
leaf mux_cable {
type boolean;
}
leaf macsec {
type leafref {
path "/macsec:sonic-macsec/macsec:MACSEC_PROFILE/macsec:MACSEC_PROFILE_LIST/macsec:name";
}
}
leaf tx_power {
description "Target output power(dBm) for the 400G ZR transceiver";
type decimal64 {
fraction-digits 1;
}
}
leaf laser_freq {
description "Target laser frequency(GHz) for the 400G ZR transceiver";
type int32;
}
} /* end of list PORT_LIST */
} /* end of container PORT */
} /* end of container sonic-port */
} /* end of module sonic-port */