-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathczechlight-network@2026-03-09.yang
More file actions
282 lines (237 loc) · 11.6 KB
/
czechlight-network@2026-03-09.yang
File metadata and controls
282 lines (237 loc) · 11.6 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
module czechlight-network {
yang-version 1.1;
namespace "http://czechlight.cesnet.cz/yang/czechlight-network";
prefix cla-network;
import ietf-interfaces {
prefix if;
}
import ietf-routing {
prefix rt;
}
import ietf-ip {
prefix ip;
}
import iana-if-type {
prefix ianaift;
}
import ietf-ipv4-unicast-routing {
prefix v4ur;
}
import ietf-ipv6-unicast-routing {
prefix v6ur;
}
import ietf-rib-extension {
prefix rib-ext;
}
revision 2026-03-09 {
description
"Add options to control use of DNS and NTP servers from DHCPv4,
and to accept or reject DNS server advertisements from IPv6 RA.";
}
revision 2025-06-06 {
description
"Split into generic parts and hardware-specific parts. This module contains only
generic constraints for CzechLight systems, hardware-specific constraints are
in their own modules";
}
revision 2021-02-22 {
description
"Initial version. Removes interface statistics in ietf-interfaces model, removes deprecated container
ietf-interfaces:interface-state and makes the nodes in ietf-interfaces model config false.";
}
// We don't support discontinuity time (yet)
deviation /if:interfaces/if:interface/if:statistics/if:discontinuity-time { deviate not-supported; }
// IPv6 router advertisements is not supported, as per RFC8349 App. B.
deviation /if:interfaces/if:interface/ip:ipv6/v6ur:ipv6-router-advertisements { deviate not-supported; }
// Remove deprecated ietf-interfaces-state and ietf-routing containers. Beware, rt:routing-state references if:interfaces-state.
deviation /rt:routing-state { deviate not-supported; }
deviation /if:interfaces-state { deviate not-supported; }
// We do not support configuring some parts of if:interfaces tree
deviation /if:interfaces/if:interface/ip:ipv4/ip:forwarding { deviate add { config false; } }
deviation /if:interfaces/if:interface/ip:ipv4/ip:mtu { deviate add { config false; } }
deviation /if:interfaces/if:interface/ip:ipv4/ip:neighbor { deviate add { config false; } }
deviation /if:interfaces/if:interface/ip:ipv6/ip:forwarding { deviate add { config false; } }
deviation /if:interfaces/if:interface/ip:ipv6/ip:mtu { deviate add { config false; } }
deviation /if:interfaces/if:interface/ip:ipv6/ip:neighbor { deviate add { config false; } }
deviation /if:interfaces/if:interface/ip:ipv6/ip:dup-addr-detect-transmits { deviate add { config false; } }
deviation /if:interfaces/if:interface/if:type {
deviate add {
must 'not(re-match(../if:name, "br\d+")) or . = "ianaift:bridge"' {
error-message "The if:type of a 'br*' interface must be set to ianaift:bridge";
}
must 'not(re-match(../if:name, "eth\d+")) or . = "ianaift:ethernetCsmacd"' {
error-message "The if:type of a 'eth*' interface must be set to ianaift:ethernetCsmacd";
}
must 'not(re-match(../if:name, "osc.*")) or . = "ianaift:ethernetCsmacd"' {
error-message "The if:type of a 'osc*' interface must be set to ianaift:ethernetCsmacd";
}
must 'not(re-match(../if:name, "sfp.*")) or . = "ianaift:ethernetCsmacd"' {
error-message "The if:type of a 'sfp*' interface must be set to ianaift:ethernetCsmacd";
}
}
}
augment /if:interfaces/if:interface {
description "Add the option to add this link to a bridge.";
leaf bridge {
must '../if:type = "ianaift:ethernetCsmacd"' {
error-message "Only ethernet interfaces can be enslaved to a bridge.";
}
must '/if:interfaces/if:interface[if:name = current()]/if:type = "ianaift:bridge"' {
error-message "An interface can be only enslaved to a bridge";
}
must '(not(../ip:ipv4) or ../ip:ipv4/ip:enabled[.="false"]) and
(not(../ip:ipv6) or ../ip:ipv6/ip:enabled[.="false"])' {
error-message "IP protocols must be disabled for enslaved link.";
}
type if:interface-ref;
mandatory false;
description "The name of the bridge to add the link to.";
}
}
deviation /if:interfaces {
deviate add {
must 'count(if:interface[if:enabled = "true"]) > 0' {
error-message "At least one interface must be enabled.";
}
}
}
// Make it hard to accidentally lose connection by removing ipv4/ipv6 presence containers or all IP addresses
deviation /if:interfaces/if:interface {
deviate add {
must 'if:enabled = "false" or
ip:ipv4/ip:enabled = "true" or
ip:ipv6/ip:enabled = "true" or
cla-network:bridge' {
error-message "Enabled interface must always have at least one protocol active or it must be connected in the bridge.";
}
}
deviate add {
must 'if:type != "ianaift:bridge" or
(if:enabled != "true") or
(count(../if:interface[(if:enabled = "true") and (cla-network:bridge = current()/name)]) > 0)' {
error-message "All enabled bridges must have at least one enabled enslaved interface";
}
}
}
augment /if:interfaces/if:interface/ip:ipv4 {
description "Add the IPv4 autoconfiguration option (DHCP client).";
container dhcp-client {
presence
"Enables DHCPv4 client unless the 'enabled' leaf
(which defaults to 'true') is set to 'false'";
description
"Parameters for the DHCPv4 client.";
leaf enabled {
type boolean;
default true;
description "Enable DHCP client.";
}
leaf use-dns {
type boolean;
default true;
description "Use DNS servers provided by DHCP server.";
}
leaf use-ntp {
type boolean;
default true;
description "Use NTP servers provided by DHCP server.";
}
}
}
augment /if:interfaces/if:interface/ip:ipv6/ip:autoconf {
description "Add the option to accept DNS advertising from router advertisements.";
leaf accept-dns-advertisements {
type boolean;
default true;
description "Accept DNS server addresses from router advertisements.";
}
}
deviation /if:interfaces/if:interface/ip:ipv4 {
deviate add {
must 'ip:enabled = "false" or ../if:enabled = "false" or count(ip:address) > 0 or cla-network:dhcp-client/cla-network:enabled = "true"' {
error-message "There must always be at least one IPv4 address or the autoconfiguration must be turned on unless the interface or protocol is disabled.";
}
}
}
deviation /if:interfaces/if:interface/ip:ipv6 {
deviate add {
must 'ip:enabled = "false" or ../if:enabled = "false" or count(ip:address) > 0 or ip:autoconf/ip:create-global-addresses = "true"' {
error-message "There must always be at least one IPv6 address or the autoconfiguration must be turned on unless the interface or protocol is disabled.";
}
}
}
identity dhcp {
base rt:routing-protocol;
description "Identity for route installed by DHCP.";
}
identity ra {
base rt:routing-protocol;
description "Identity for route installed by router advertisement.";
}
// We do not support user defined RIBs (RFC 8349, App. B)
deviation /rt:routing/rt:ribs {
deviate add {
config false;
}
}
deviation /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol {
deviate add {
must '(./rt:name = "static") and (./rt:type = "rt:static")' {
error-message "Only one control-plane-protocol named 'static' with type 'ietf-routing:static' is supported.";
}
}
}
// Special routing options are not supported
deviation /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/rt:static-routes/v4ur:ipv4/v4ur:route/v4ur:next-hop/v4ur:next-hop-options/v4ur:special-next-hop {
deviate not-supported;
}
deviation /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/rt:static-routes/v4ur:ipv4/v4ur:route/v4ur:next-hop/v4ur:next-hop-options/v4ur:next-hop-list {
deviate not-supported;
}
deviation /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/rt:static-routes/v6ur:ipv6/v6ur:route/v6ur:next-hop/v6ur:next-hop-options/v6ur:special-next-hop {
deviate not-supported;
}
deviation /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/rt:static-routes/v6ur:ipv6/v6ur:route/v6ur:next-hop/v6ur:next-hop-options/v6ur:next-hop-list {
deviate not-supported;
}
// Our implementation requires that the static routes have both interfaces and next hop address specified.
// Please note that this model intentionally does not require static routes to be configured when the interface is configured with static IP address.
// If the interface is configured with static IP address, the routing protocol will automatically add a route to the network of the interface.
// This is done to avoid confusion and to keep the configuration simple. On the other hand, administrators must be careful not to lock themselves out.
deviation /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/rt:static-routes/v4ur:ipv4/v4ur:route/v4ur:next-hop/v4ur:next-hop-options/v4ur:simple-next-hop/v4ur:outgoing-interface {
deviate add {
mandatory true;
}
}
deviation /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/rt:static-routes/v4ur:ipv4/v4ur:route/v4ur:next-hop/v4ur:next-hop-options/v4ur:simple-next-hop/v4ur:next-hop-address {
deviate add {
mandatory true;
}
}
deviation /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/rt:static-routes/v6ur:ipv6/v6ur:route/v6ur:next-hop/v6ur:next-hop-options/v6ur:simple-next-hop/v6ur:outgoing-interface {
deviate add {
mandatory true;
}
}
deviation /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/rt:static-routes/v6ur:ipv6/v6ur:route/v6ur:next-hop/v6ur:next-hop-options/v6ur:simple-next-hop/v6ur:next-hop-address {
deviate add {
mandatory true;
}
}
// Executing active-route is not supported
deviation /rt:routing/rt:ribs/rt:rib/rt:active-route {
deviate not-supported;
}
deviation /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/rt:static-routes/v4ur:ipv4/v4ur:route/v4ur:next-hop/v4ur:next-hop-options/v4ur:simple-next-hop/rib-ext:tag {
deviate not-supported;
}
deviation /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/rt:static-routes/v6ur:ipv6/v6ur:route/v6ur:next-hop/v6ur:next-hop-options/v6ur:simple-next-hop/rib-ext:tag {
deviate not-supported;
}
deviation /rt:routing/rt:ribs/rt:rib/rt:routes/rt:route/rt:next-hop/rt:next-hop-options/rt:simple-next-hop/rib-ext:repair-path {
deviate not-supported;
}
deviation /rt:routing/rt:ribs/rt:rib/rt:routes/rt:route/rt:next-hop/rt:next-hop-options/rt:next-hop-list/rt:next-hop-list/rt:next-hop/rib-ext:repair-path {
deviate not-supported;
}
}