]>
Commit | Line | Data |
---|---|---|
acddc0ed | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
20bd27e2 EDP |
2 | /* |
3 | * Copyright (C) 2001,2002 Sampo Saaristo | |
4 | * Tampere University of Technology | |
5 | * Institute of Communications Engineering | |
6 | * Copyright (C) 2018 Volta Networks | |
7 | * Emanuele Di Pascale | |
20bd27e2 EDP |
8 | */ |
9 | ||
10 | #include <zebra.h> | |
11 | ||
12 | #include "if.h" | |
13 | #include "vrf.h" | |
14 | #include "log.h" | |
15 | #include "prefix.h" | |
16 | #include "command.h" | |
17 | #include "northbound_cli.h" | |
18 | #include "libfrr.h" | |
19 | #include "yang.h" | |
20 | #include "lib/linklist.h" | |
21 | #include "isisd/isisd.h" | |
2a1c520e | 22 | #include "isisd/isis_nb.h" |
20bd27e2 EDP |
23 | #include "isisd/isis_misc.h" |
24 | #include "isisd/isis_circuit.h" | |
25 | #include "isisd/isis_csm.h" | |
f46e34f8 | 26 | #include "isisd/isis_flex_algo.h" |
20bd27e2 | 27 | |
20bd27e2 | 28 | #include "isisd/isis_cli_clippy.c" |
20bd27e2 EDP |
29 | |
30 | #ifndef FABRICD | |
31 | ||
aaf2fd21 EDP |
32 | /* |
33 | * XPath: /frr-isisd:isis/instance | |
34 | */ | |
65251ce8 | 35 | DEFPY_YANG_NOSH(router_isis, router_isis_cmd, |
36 | "router isis WORD$tag [vrf NAME$vrf_name]", | |
37 | ROUTER_STR | |
38 | "ISO IS-IS\n" | |
39 | "ISO Routing area tag\n" VRF_CMD_HELP_STR) | |
aaf2fd21 EDP |
40 | { |
41 | int ret; | |
42 | char base_xpath[XPATH_MAXLEN]; | |
43 | ||
65251ce8 | 44 | if (!vrf_name) |
45 | vrf_name = VRF_DEFAULT_NAME; | |
46 | ||
aaf2fd21 | 47 | snprintf(base_xpath, XPATH_MAXLEN, |
65251ce8 | 48 | "/frr-isisd:isis/instance[area-tag='%s'][vrf='%s']", tag, |
49 | vrf_name); | |
aaf2fd21 | 50 | nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); |
eab88f36 | 51 | |
ae08de9f | 52 | ret = nb_cli_apply_changes(vty, "%s", base_xpath); |
aaf2fd21 EDP |
53 | if (ret == CMD_SUCCESS) |
54 | VTY_PUSH_XPATH(ISIS_NODE, base_xpath); | |
55 | ||
56 | return ret; | |
57 | } | |
58 | ||
65251ce8 | 59 | DEFPY_YANG(no_router_isis, no_router_isis_cmd, |
60 | "no router isis WORD$tag [vrf NAME$vrf_name]", | |
61 | NO_STR ROUTER_STR | |
62 | "ISO IS-IS\n" | |
63 | "ISO Routing area tag\n" VRF_CMD_HELP_STR) | |
aaf2fd21 | 64 | { |
65251ce8 | 65 | if (!vrf_name) |
66 | vrf_name = VRF_DEFAULT_NAME; | |
67 | ||
3bb513c3 | 68 | if (!yang_dnode_existsf( |
65251ce8 | 69 | vty->candidate_config->dnode, |
70 | "/frr-isisd:isis/instance[area-tag='%s'][vrf='%s']", tag, | |
71 | vrf_name)) { | |
aaf2fd21 EDP |
72 | vty_out(vty, "ISIS area %s not found.\n", tag); |
73 | return CMD_ERR_NOTHING_TODO; | |
74 | } | |
75 | ||
95ce849b | 76 | nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); |
aaf2fd21 | 77 | |
fd396924 | 78 | return nb_cli_apply_changes_clear_pending( |
65251ce8 | 79 | vty, "/frr-isisd:isis/instance[area-tag='%s'][vrf='%s']", tag, |
80 | vrf_name); | |
aaf2fd21 EDP |
81 | } |
82 | ||
25605051 | 83 | void cli_show_router_isis(struct vty *vty, const struct lyd_node *dnode, |
aaf2fd21 EDP |
84 | bool show_defaults) |
85 | { | |
65251ce8 | 86 | const char *vrf = NULL; |
87 | ||
88 | vrf = yang_dnode_get_string(dnode, "./vrf"); | |
89 | ||
aaf2fd21 | 90 | vty_out(vty, "!\n"); |
31200a29 | 91 | vty_out(vty, "router isis %s", |
aaf2fd21 | 92 | yang_dnode_get_string(dnode, "./area-tag")); |
65251ce8 | 93 | if (!strmatch(vrf, VRF_DEFAULT_NAME)) |
31200a29 | 94 | vty_out(vty, " vrf %s", yang_dnode_get_string(dnode, "./vrf")); |
65251ce8 | 95 | vty_out(vty, "\n"); |
aaf2fd21 EDP |
96 | } |
97 | ||
25605051 | 98 | void cli_show_router_isis_end(struct vty *vty, const struct lyd_node *dnode) |
07679ad9 IR |
99 | { |
100 | vty_out(vty, "exit\n"); | |
101 | } | |
102 | ||
aaf2fd21 EDP |
103 | /* |
104 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/ | |
105 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv4-routing | |
106 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv6-routing | |
107 | * XPath: /frr-isisd:isis/instance | |
108 | */ | |
65251ce8 | 109 | DEFPY_YANG(ip_router_isis, ip_router_isis_cmd, |
1457b1d5 | 110 | "ip router isis WORD$tag", |
65251ce8 | 111 | "Interface Internet Protocol config commands\n" |
112 | "IP router interface commands\n" | |
113 | "IS-IS routing protocol\n" | |
1457b1d5 | 114 | "Routing process tag\n") |
aaf2fd21 | 115 | { |
aaf8e809 IR |
116 | nb_cli_enqueue_change(vty, "./frr-isisd:isis", NB_OP_CREATE, NULL); |
117 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag", NB_OP_MODIFY, | |
118 | tag); | |
aaf8e809 IR |
119 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv4-routing", |
120 | NB_OP_MODIFY, "true"); | |
aaf2fd21 EDP |
121 | |
122 | return nb_cli_apply_changes(vty, NULL); | |
123 | } | |
124 | ||
1457b1d5 IR |
125 | ALIAS_HIDDEN(ip_router_isis, ip_router_isis_vrf_cmd, |
126 | "ip router isis WORD$tag vrf NAME$vrf_name", | |
127 | "Interface Internet Protocol config commands\n" | |
128 | "IP router interface commands\n" | |
129 | "IS-IS routing protocol\n" | |
130 | "Routing process tag\n" VRF_CMD_HELP_STR) | |
131 | ||
65251ce8 | 132 | DEFPY_YANG(ip6_router_isis, ip6_router_isis_cmd, |
1457b1d5 | 133 | "ipv6 router isis WORD$tag", |
65251ce8 | 134 | "Interface Internet Protocol config commands\n" |
135 | "IP router interface commands\n" | |
136 | "IS-IS routing protocol\n" | |
1457b1d5 | 137 | "Routing process tag\n") |
aaf2fd21 | 138 | { |
aaf8e809 IR |
139 | nb_cli_enqueue_change(vty, "./frr-isisd:isis", NB_OP_CREATE, NULL); |
140 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag", NB_OP_MODIFY, | |
141 | tag); | |
aaf8e809 IR |
142 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv6-routing", |
143 | NB_OP_MODIFY, "true"); | |
aaf2fd21 EDP |
144 | |
145 | return nb_cli_apply_changes(vty, NULL); | |
146 | } | |
147 | ||
1457b1d5 IR |
148 | ALIAS_HIDDEN(ip6_router_isis, ip6_router_isis_vrf_cmd, |
149 | "ipv6 router isis WORD$tag vrf NAME$vrf_name", | |
150 | "Interface Internet Protocol config commands\n" | |
151 | "IP router interface commands\n" | |
152 | "IS-IS routing protocol\n" | |
153 | "Routing process tag\n" VRF_CMD_HELP_STR) | |
154 | ||
ca77b518 | 155 | DEFPY_YANG(no_ip_router_isis, no_ip_router_isis_cmd, |
1457b1d5 | 156 | "no <ip|ipv6>$ip router isis [WORD]$tag", |
65251ce8 | 157 | NO_STR |
158 | "Interface Internet Protocol config commands\n" | |
159 | "IP router interface commands\n" | |
160 | "IP router interface commands\n" | |
161 | "IS-IS routing protocol\n" | |
1457b1d5 | 162 | "Routing process tag\n") |
aaf2fd21 | 163 | { |
472c3dae | 164 | const struct lyd_node *dnode; |
aaf2fd21 | 165 | |
3bb513c3 CH |
166 | dnode = yang_dnode_getf(vty->candidate_config->dnode, |
167 | "%s/frr-isisd:isis", VTY_CURR_XPATH); | |
472c3dae RW |
168 | if (!dnode) |
169 | return CMD_SUCCESS; | |
170 | ||
171 | /* | |
172 | * If both ipv4 and ipv6 are off delete the interface isis container. | |
aaf2fd21 | 173 | */ |
472c3dae RW |
174 | if (strmatch(ip, "ipv6")) { |
175 | if (!yang_dnode_get_bool(dnode, "./ipv4-routing")) | |
aaf2fd21 | 176 | nb_cli_enqueue_change(vty, "./frr-isisd:isis", |
95ce849b | 177 | NB_OP_DESTROY, NULL); |
aaf2fd21 EDP |
178 | else |
179 | nb_cli_enqueue_change(vty, | |
180 | "./frr-isisd:isis/ipv6-routing", | |
5f1e5e3f | 181 | NB_OP_MODIFY, "false"); |
472c3dae RW |
182 | } else { |
183 | if (!yang_dnode_get_bool(dnode, "./ipv6-routing")) | |
aaf2fd21 | 184 | nb_cli_enqueue_change(vty, "./frr-isisd:isis", |
95ce849b | 185 | NB_OP_DESTROY, NULL); |
aaf2fd21 EDP |
186 | else |
187 | nb_cli_enqueue_change(vty, | |
188 | "./frr-isisd:isis/ipv4-routing", | |
5f1e5e3f | 189 | NB_OP_MODIFY, "false"); |
aaf2fd21 EDP |
190 | } |
191 | ||
192 | return nb_cli_apply_changes(vty, NULL); | |
193 | } | |
194 | ||
1457b1d5 IR |
195 | ALIAS_HIDDEN(no_ip_router_isis, no_ip_router_isis_vrf_cmd, |
196 | "no <ip|ipv6>$ip router isis WORD$tag vrf NAME$vrf_name", | |
197 | NO_STR | |
198 | "Interface Internet Protocol config commands\n" | |
199 | "IP router interface commands\n" | |
200 | "IP router interface commands\n" | |
201 | "IS-IS routing protocol\n" | |
202 | "Routing process tag\n" | |
203 | VRF_CMD_HELP_STR) | |
204 | ||
25605051 | 205 | void cli_show_ip_isis_ipv4(struct vty *vty, const struct lyd_node *dnode, |
aaf2fd21 EDP |
206 | bool show_defaults) |
207 | { | |
5f1e5e3f EDP |
208 | if (!yang_dnode_get_bool(dnode, NULL)) |
209 | vty_out(vty, " no"); | |
1457b1d5 | 210 | vty_out(vty, " ip router isis %s\n", |
aaf2fd21 EDP |
211 | yang_dnode_get_string(dnode, "../area-tag")); |
212 | } | |
213 | ||
25605051 | 214 | void cli_show_ip_isis_ipv6(struct vty *vty, const struct lyd_node *dnode, |
aaf2fd21 EDP |
215 | bool show_defaults) |
216 | { | |
5f1e5e3f EDP |
217 | if (!yang_dnode_get_bool(dnode, NULL)) |
218 | vty_out(vty, " no"); | |
1457b1d5 | 219 | vty_out(vty, " ipv6 router isis %s\n", |
aaf2fd21 EDP |
220 | yang_dnode_get_string(dnode, "../area-tag")); |
221 | } | |
222 | ||
c3e6ac0b RZ |
223 | /* |
224 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring | |
225 | */ | |
ca77b518 | 226 | DEFPY_YANG(isis_bfd, |
c3e6ac0b RZ |
227 | isis_bfd_cmd, |
228 | "[no] isis bfd", | |
4affdba7 | 229 | NO_STR PROTO_HELP |
c3e6ac0b RZ |
230 | "Enable BFD support\n") |
231 | { | |
232 | const struct lyd_node *dnode; | |
233 | ||
3bb513c3 CH |
234 | dnode = yang_dnode_getf(vty->candidate_config->dnode, |
235 | "%s/frr-isisd:isis", VTY_CURR_XPATH); | |
8222b997 RZ |
236 | if (dnode == NULL) { |
237 | vty_out(vty, "ISIS is not enabled on this circuit\n"); | |
c3e6ac0b | 238 | return CMD_SUCCESS; |
8222b997 | 239 | } |
c3e6ac0b | 240 | |
4affdba7 | 241 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/bfd-monitoring/enabled", |
c3e6ac0b RZ |
242 | NB_OP_MODIFY, no ? "false" : "true"); |
243 | ||
244 | return nb_cli_apply_changes(vty, NULL); | |
245 | } | |
246 | ||
4affdba7 G |
247 | /* |
248 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring/profile | |
249 | */ | |
ca77b518 | 250 | DEFPY_YANG(isis_bfd_profile, |
4affdba7 | 251 | isis_bfd_profile_cmd, |
c022a581 | 252 | "[no] isis bfd profile BFDPROF$profile", |
4affdba7 G |
253 | NO_STR PROTO_HELP |
254 | "Enable BFD support\n" | |
255 | "Use a pre-configured profile\n" | |
256 | "Profile name\n") | |
257 | { | |
258 | const struct lyd_node *dnode; | |
259 | ||
3bb513c3 CH |
260 | dnode = yang_dnode_getf(vty->candidate_config->dnode, |
261 | "%s/frr-isisd:isis", VTY_CURR_XPATH); | |
4affdba7 G |
262 | if (dnode == NULL) { |
263 | vty_out(vty, "ISIS is not enabled on this circuit\n"); | |
264 | return CMD_SUCCESS; | |
265 | } | |
266 | ||
bb28b985 IR |
267 | if (no) |
268 | nb_cli_enqueue_change(vty, | |
269 | "./frr-isisd:isis/bfd-monitoring/profile", | |
270 | NB_OP_DESTROY, NULL); | |
271 | else | |
272 | nb_cli_enqueue_change(vty, | |
273 | "./frr-isisd:isis/bfd-monitoring/profile", | |
274 | NB_OP_MODIFY, profile); | |
4affdba7 G |
275 | |
276 | return nb_cli_apply_changes(vty, NULL); | |
277 | } | |
278 | ||
25605051 IR |
279 | void cli_show_ip_isis_bfd_monitoring(struct vty *vty, |
280 | const struct lyd_node *dnode, | |
c3e6ac0b RZ |
281 | bool show_defaults) |
282 | { | |
081f9b29 IR |
283 | if (!yang_dnode_get_bool(dnode, "./enabled")) { |
284 | if (show_defaults) | |
285 | vty_out(vty, " no isis bfd\n"); | |
286 | } else { | |
287 | vty_out(vty, " isis bfd\n"); | |
288 | } | |
4affdba7 | 289 | |
bb28b985 IR |
290 | if (yang_dnode_exists(dnode, "./profile")) |
291 | vty_out(vty, " isis bfd profile %s\n", | |
292 | yang_dnode_get_string(dnode, "./profile")); | |
c3e6ac0b RZ |
293 | } |
294 | ||
f084ea55 EDP |
295 | /* |
296 | * XPath: /frr-isisd:isis/instance/area-address | |
297 | */ | |
ca77b518 | 298 | DEFPY_YANG(net, net_cmd, "[no] net WORD", |
f084ea55 EDP |
299 | "Remove an existing Network Entity Title for this process\n" |
300 | "A Network Entity Title for this process (OSI only)\n" | |
301 | "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") | |
302 | { | |
303 | nb_cli_enqueue_change(vty, "./area-address", | |
95ce849b | 304 | no ? NB_OP_DESTROY : NB_OP_CREATE, net); |
f084ea55 EDP |
305 | |
306 | return nb_cli_apply_changes(vty, NULL); | |
307 | } | |
308 | ||
25605051 | 309 | void cli_show_isis_area_address(struct vty *vty, const struct lyd_node *dnode, |
f084ea55 EDP |
310 | bool show_defaults) |
311 | { | |
312 | vty_out(vty, " net %s\n", yang_dnode_get_string(dnode, NULL)); | |
313 | } | |
314 | ||
e6bdae69 EDP |
315 | /* |
316 | * XPath: /frr-isisd:isis/instance/is-type | |
317 | */ | |
ca77b518 | 318 | DEFPY_YANG(is_type, is_type_cmd, "is-type <level-1|level-1-2|level-2-only>$level", |
e6bdae69 EDP |
319 | "IS Level for this routing process (OSI only)\n" |
320 | "Act as a station router only\n" | |
321 | "Act as both a station router and an area router\n" | |
322 | "Act as an area router only\n") | |
323 | { | |
324 | nb_cli_enqueue_change(vty, "./is-type", NB_OP_MODIFY, | |
325 | strmatch(level, "level-2-only") ? "level-2" | |
326 | : level); | |
327 | ||
328 | return nb_cli_apply_changes(vty, NULL); | |
329 | } | |
330 | ||
ca77b518 | 331 | DEFPY_YANG(no_is_type, no_is_type_cmd, |
e6bdae69 EDP |
332 | "no is-type [<level-1|level-1-2|level-2-only>]", |
333 | NO_STR | |
334 | "IS Level for this routing process (OSI only)\n" | |
335 | "Act as a station router only\n" | |
336 | "Act as both a station router and an area router\n" | |
337 | "Act as an area router only\n") | |
338 | { | |
fd506bbb | 339 | nb_cli_enqueue_change(vty, "./is-type", NB_OP_MODIFY, NULL); |
e6bdae69 EDP |
340 | |
341 | return nb_cli_apply_changes(vty, NULL); | |
342 | } | |
343 | ||
25605051 | 344 | void cli_show_isis_is_type(struct vty *vty, const struct lyd_node *dnode, |
e6bdae69 EDP |
345 | bool show_defaults) |
346 | { | |
347 | int is_type = yang_dnode_get_enum(dnode, NULL); | |
348 | ||
349 | switch (is_type) { | |
350 | case IS_LEVEL_1: | |
351 | vty_out(vty, " is-type level-1\n"); | |
352 | break; | |
353 | case IS_LEVEL_2: | |
354 | vty_out(vty, " is-type level-2-only\n"); | |
355 | break; | |
356 | case IS_LEVEL_1_AND_2: | |
357 | vty_out(vty, " is-type level-1-2\n"); | |
358 | break; | |
359 | } | |
360 | } | |
361 | ||
6bb043cd EDP |
362 | /* |
363 | * XPath: /frr-isisd:isis/instance/dynamic-hostname | |
364 | */ | |
ca77b518 | 365 | DEFPY_YANG(dynamic_hostname, dynamic_hostname_cmd, "[no] hostname dynamic", |
6bb043cd EDP |
366 | NO_STR |
367 | "Dynamic hostname for IS-IS\n" | |
368 | "Dynamic hostname\n") | |
369 | { | |
370 | nb_cli_enqueue_change(vty, "./dynamic-hostname", NB_OP_MODIFY, | |
371 | no ? "false" : "true"); | |
372 | ||
373 | return nb_cli_apply_changes(vty, NULL); | |
374 | } | |
375 | ||
25605051 IR |
376 | void cli_show_isis_dynamic_hostname(struct vty *vty, |
377 | const struct lyd_node *dnode, | |
6bb043cd EDP |
378 | bool show_defaults) |
379 | { | |
380 | if (!yang_dnode_get_bool(dnode, NULL)) | |
381 | vty_out(vty, " no"); | |
382 | ||
383 | vty_out(vty, " hostname dynamic\n"); | |
384 | } | |
385 | ||
05a3f9f0 EDP |
386 | /* |
387 | * XPath: /frr-isisd:isis/instance/overload | |
388 | */ | |
ca77b518 | 389 | DEFPY_YANG(set_overload_bit, set_overload_bit_cmd, "[no] set-overload-bit", |
05a3f9f0 EDP |
390 | "Reset overload bit to accept transit traffic\n" |
391 | "Set overload bit to avoid any transit traffic\n") | |
392 | { | |
01ea9b03 | 393 | nb_cli_enqueue_change(vty, "./overload/enabled", NB_OP_MODIFY, |
5f1e5e3f | 394 | no ? "false" : "true"); |
05a3f9f0 EDP |
395 | |
396 | return nb_cli_apply_changes(vty, NULL); | |
397 | } | |
398 | ||
25605051 | 399 | void cli_show_isis_overload(struct vty *vty, const struct lyd_node *dnode, |
05a3f9f0 EDP |
400 | bool show_defaults) |
401 | { | |
5f1e5e3f EDP |
402 | if (!yang_dnode_get_bool(dnode, NULL)) |
403 | vty_out(vty, " no"); | |
05a3f9f0 EDP |
404 | vty_out(vty, " set-overload-bit\n"); |
405 | } | |
406 | ||
01ea9b03 IL |
407 | /* |
408 | * XPath: /frr-isisd:isis/instance/overload/on-startup | |
409 | */ | |
410 | DEFPY_YANG(set_overload_bit_on_startup, set_overload_bit_on_startup_cmd, | |
411 | "set-overload-bit on-startup (0-86400)$val", | |
412 | "Set overload bit to avoid any transit traffic\n" | |
413 | "Set overload bit on startup\n" | |
414 | "Set overload time in seconds\n") | |
415 | { | |
416 | nb_cli_enqueue_change(vty, "./overload/on-startup", NB_OP_MODIFY, | |
417 | val_str); | |
418 | ||
419 | return nb_cli_apply_changes(vty, NULL); | |
420 | } | |
421 | ||
422 | DEFPY_YANG(no_set_overload_bit_on_startup, no_set_overload_bit_on_startup_cmd, | |
423 | "no set-overload-bit on-startup [(0-86400)$val]", | |
424 | NO_STR | |
425 | "Reset overload bit to accept transit traffic\n" | |
426 | "Set overload bit on startup\n" | |
427 | "Set overload time in seconds\n") | |
428 | { | |
429 | nb_cli_enqueue_change(vty, "./overload/on-startup", NB_OP_DESTROY, | |
430 | NULL); | |
431 | ||
432 | return nb_cli_apply_changes(vty, NULL); | |
433 | } | |
434 | ||
435 | void cli_show_isis_overload_on_startup(struct vty *vty, | |
436 | const struct lyd_node *dnode, | |
437 | bool show_defaults) | |
438 | { | |
439 | vty_out(vty, " set-overload-bit on-startup %s\n", | |
440 | yang_dnode_get_string(dnode, NULL)); | |
441 | } | |
442 | ||
d74f913c IL |
443 | /* |
444 | * XPath: /frr-isisd:isis/instance/advertise-high-metrics | |
445 | */ | |
446 | DEFPY_YANG(advertise_high_metrics, advertise_high_metrics_cmd, | |
447 | "[no] advertise-high-metrics", | |
448 | NO_STR "Advertise high metric value on all interfaces\n") | |
449 | { | |
450 | nb_cli_enqueue_change(vty, "./advertise-high-metrics", NB_OP_MODIFY, | |
451 | no ? "false" : "true"); | |
452 | ||
453 | return nb_cli_apply_changes(vty, NULL); | |
454 | } | |
455 | ||
456 | void cli_show_advertise_high_metrics(struct vty *vty, | |
457 | const struct lyd_node *dnode, | |
458 | bool show_defaults) | |
459 | { | |
460 | if (yang_dnode_get_bool(dnode, NULL)) | |
461 | vty_out(vty, " advertise-high-metrics\n"); | |
462 | else if (show_defaults) | |
463 | vty_out(vty, " no advertise-high-metrics\n"); | |
464 | } | |
465 | ||
f3abc412 | 466 | /* |
467 | * XPath: /frr-isisd:isis/instance/attach-send | |
468 | */ | |
469 | DEFPY_YANG(attached_bit_send, attached_bit_send_cmd, "[no] attached-bit send", | |
470 | "Reset attached bit\n" | |
471 | "Set attached bit for inter-area traffic\n" | |
472 | "Set attached bit in LSP sent to L1 router\n") | |
473 | { | |
474 | nb_cli_enqueue_change(vty, "./attach-send", NB_OP_MODIFY, | |
5f1e5e3f | 475 | no ? "false" : "true"); |
05a3f9f0 EDP |
476 | |
477 | return nb_cli_apply_changes(vty, NULL); | |
478 | } | |
479 | ||
25605051 | 480 | void cli_show_isis_attached_send(struct vty *vty, const struct lyd_node *dnode, |
f3abc412 | 481 | bool show_defaults) |
482 | { | |
483 | if (!yang_dnode_get_bool(dnode, NULL)) | |
484 | vty_out(vty, " no"); | |
485 | vty_out(vty, " attached-bit send\n"); | |
486 | } | |
487 | ||
488 | /* | |
489 | * XPath: /frr-isisd:isis/instance/attach-receive-ignore | |
490 | */ | |
491 | DEFPY_YANG( | |
492 | attached_bit_receive_ignore, attached_bit_receive_ignore_cmd, | |
493 | "[no] attached-bit receive ignore", | |
494 | "Reset attached bit\n" | |
495 | "Set attach bit for inter-area traffic\n" | |
496 | "If LSP received with attached bit set, create default route to neighbor\n" | |
497 | "Do not process attached bit\n") | |
498 | { | |
499 | nb_cli_enqueue_change(vty, "./attach-receive-ignore", NB_OP_MODIFY, | |
500 | no ? "false" : "true"); | |
501 | ||
502 | return nb_cli_apply_changes(vty, NULL); | |
503 | } | |
504 | ||
25605051 IR |
505 | void cli_show_isis_attached_receive(struct vty *vty, |
506 | const struct lyd_node *dnode, | |
f3abc412 | 507 | bool show_defaults) |
05a3f9f0 | 508 | { |
5f1e5e3f EDP |
509 | if (!yang_dnode_get_bool(dnode, NULL)) |
510 | vty_out(vty, " no"); | |
f3abc412 | 511 | vty_out(vty, " attached-bit receive ignore\n"); |
05a3f9f0 EDP |
512 | } |
513 | ||
e0df3206 EDP |
514 | /* |
515 | * XPath: /frr-isisd:isis/instance/metric-style | |
516 | */ | |
ca77b518 | 517 | DEFPY_YANG(metric_style, metric_style_cmd, |
f34ab52d | 518 | "metric-style <narrow|transition|wide>$style", |
e0df3206 EDP |
519 | "Use old-style (ISO 10589) or new-style packet formats\n" |
520 | "Use old style of TLVs with narrow metric\n" | |
521 | "Send and accept both styles of TLVs during transition\n" | |
522 | "Use new style of TLVs to carry wider metric\n") | |
523 | { | |
524 | nb_cli_enqueue_change(vty, "./metric-style", NB_OP_MODIFY, style); | |
525 | ||
526 | return nb_cli_apply_changes(vty, NULL); | |
527 | } | |
528 | ||
ca77b518 | 529 | DEFPY_YANG(no_metric_style, no_metric_style_cmd, |
f34ab52d EDP |
530 | "no metric-style [narrow|transition|wide]", |
531 | NO_STR | |
532 | "Use old-style (ISO 10589) or new-style packet formats\n" | |
e0df3206 EDP |
533 | "Use old style of TLVs with narrow metric\n" |
534 | "Send and accept both styles of TLVs during transition\n" | |
535 | "Use new style of TLVs to carry wider metric\n") | |
536 | { | |
fd506bbb | 537 | nb_cli_enqueue_change(vty, "./metric-style", NB_OP_MODIFY, NULL); |
e0df3206 EDP |
538 | |
539 | return nb_cli_apply_changes(vty, NULL); | |
540 | } | |
541 | ||
25605051 | 542 | void cli_show_isis_metric_style(struct vty *vty, const struct lyd_node *dnode, |
e0df3206 EDP |
543 | bool show_defaults) |
544 | { | |
545 | int metric = yang_dnode_get_enum(dnode, NULL); | |
546 | ||
547 | switch (metric) { | |
548 | case ISIS_NARROW_METRIC: | |
549 | vty_out(vty, " metric-style narrow\n"); | |
550 | break; | |
551 | case ISIS_WIDE_METRIC: | |
552 | vty_out(vty, " metric-style wide\n"); | |
553 | break; | |
554 | case ISIS_TRANSITION_METRIC: | |
555 | vty_out(vty, " metric-style transition\n"); | |
556 | break; | |
557 | } | |
558 | } | |
559 | ||
933536e3 EDP |
560 | /* |
561 | * XPath: /frr-isisd:isis/instance/area-password | |
562 | */ | |
ca77b518 | 563 | DEFPY_YANG(area_passwd, area_passwd_cmd, |
933536e3 EDP |
564 | "area-password <clear|md5>$pwd_type WORD$pwd [authenticate snp <send-only|validate>$snp]", |
565 | "Configure the authentication password for an area\n" | |
566 | "Clear-text authentication type\n" | |
567 | "MD5 authentication type\n" | |
568 | "Level-wide password\n" | |
569 | "Authentication\n" | |
570 | "SNP PDUs\n" | |
571 | "Send but do not check PDUs on receiving\n" | |
572 | "Send and check PDUs on receiving\n") | |
573 | { | |
574 | nb_cli_enqueue_change(vty, "./area-password", NB_OP_CREATE, NULL); | |
575 | nb_cli_enqueue_change(vty, "./area-password/password", NB_OP_MODIFY, | |
576 | pwd); | |
577 | nb_cli_enqueue_change(vty, "./area-password/password-type", | |
578 | NB_OP_MODIFY, pwd_type); | |
579 | nb_cli_enqueue_change(vty, "./area-password/authenticate-snp", | |
580 | NB_OP_MODIFY, snp ? snp : "none"); | |
581 | ||
582 | return nb_cli_apply_changes(vty, NULL); | |
583 | } | |
584 | ||
25605051 | 585 | void cli_show_isis_area_pwd(struct vty *vty, const struct lyd_node *dnode, |
933536e3 EDP |
586 | bool show_defaults) |
587 | { | |
588 | const char *snp; | |
589 | ||
590 | vty_out(vty, " area-password %s %s", | |
591 | yang_dnode_get_string(dnode, "./password-type"), | |
592 | yang_dnode_get_string(dnode, "./password")); | |
593 | snp = yang_dnode_get_string(dnode, "./authenticate-snp"); | |
594 | if (!strmatch("none", snp)) | |
595 | vty_out(vty, " authenticate snp %s", snp); | |
596 | vty_out(vty, "\n"); | |
597 | } | |
598 | ||
599 | /* | |
600 | * XPath: /frr-isisd:isis/instance/domain-password | |
601 | */ | |
ca77b518 | 602 | DEFPY_YANG(domain_passwd, domain_passwd_cmd, |
933536e3 EDP |
603 | "domain-password <clear|md5>$pwd_type WORD$pwd [authenticate snp <send-only|validate>$snp]", |
604 | "Set the authentication password for a routing domain\n" | |
605 | "Clear-text authentication type\n" | |
606 | "MD5 authentication type\n" | |
607 | "Level-wide password\n" | |
608 | "Authentication\n" | |
609 | "SNP PDUs\n" | |
610 | "Send but do not check PDUs on receiving\n" | |
611 | "Send and check PDUs on receiving\n") | |
612 | { | |
613 | nb_cli_enqueue_change(vty, "./domain-password", NB_OP_CREATE, NULL); | |
614 | nb_cli_enqueue_change(vty, "./domain-password/password", NB_OP_MODIFY, | |
615 | pwd); | |
616 | nb_cli_enqueue_change(vty, "./domain-password/password-type", | |
617 | NB_OP_MODIFY, pwd_type); | |
618 | nb_cli_enqueue_change(vty, "./domain-password/authenticate-snp", | |
619 | NB_OP_MODIFY, snp ? snp : "none"); | |
620 | ||
621 | return nb_cli_apply_changes(vty, NULL); | |
622 | } | |
623 | ||
ca77b518 | 624 | DEFPY_YANG(no_area_passwd, no_area_passwd_cmd, |
933536e3 EDP |
625 | "no <area-password|domain-password>$cmd", |
626 | NO_STR | |
627 | "Configure the authentication password for an area\n" | |
628 | "Set the authentication password for a routing domain\n") | |
629 | { | |
95ce849b | 630 | nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); |
933536e3 EDP |
631 | |
632 | return nb_cli_apply_changes(vty, "./%s", cmd); | |
633 | } | |
634 | ||
25605051 | 635 | void cli_show_isis_domain_pwd(struct vty *vty, const struct lyd_node *dnode, |
933536e3 EDP |
636 | bool show_defaults) |
637 | { | |
638 | const char *snp; | |
639 | ||
640 | vty_out(vty, " domain-password %s %s", | |
641 | yang_dnode_get_string(dnode, "./password-type"), | |
642 | yang_dnode_get_string(dnode, "./password")); | |
643 | snp = yang_dnode_get_string(dnode, "./authenticate-snp"); | |
644 | if (!strmatch("none", snp)) | |
645 | vty_out(vty, " authenticate snp %s", snp); | |
646 | vty_out(vty, "\n"); | |
647 | } | |
648 | ||
1d6fe72e | 649 | /* |
d2c970ff EDP |
650 | * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/generation-interval |
651 | * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/generation-interval | |
1d6fe72e | 652 | */ |
ca77b518 | 653 | DEFPY_YANG(lsp_gen_interval, lsp_gen_interval_cmd, |
1d6fe72e EDP |
654 | "lsp-gen-interval [level-1|level-2]$level (1-120)$val", |
655 | "Minimum interval between regenerating same LSP\n" | |
656 | "Set interval for level 1 only\n" | |
657 | "Set interval for level 2 only\n" | |
658 | "Minimum interval in seconds\n") | |
659 | { | |
660 | if (!level || strmatch(level, "level-1")) | |
d2c970ff EDP |
661 | nb_cli_enqueue_change( |
662 | vty, "./lsp/timers/level-1/generation-interval", | |
663 | NB_OP_MODIFY, val_str); | |
1d6fe72e | 664 | if (!level || strmatch(level, "level-2")) |
d2c970ff EDP |
665 | nb_cli_enqueue_change( |
666 | vty, "./lsp/timers/level-2/generation-interval", | |
667 | NB_OP_MODIFY, val_str); | |
1d6fe72e EDP |
668 | |
669 | return nb_cli_apply_changes(vty, NULL); | |
670 | } | |
671 | ||
ca77b518 | 672 | DEFPY_YANG(no_lsp_gen_interval, no_lsp_gen_interval_cmd, |
1d6fe72e EDP |
673 | "no lsp-gen-interval [level-1|level-2]$level [(1-120)]", |
674 | NO_STR | |
675 | "Minimum interval between regenerating same LSP\n" | |
676 | "Set interval for level 1 only\n" | |
677 | "Set interval for level 2 only\n" | |
678 | "Minimum interval in seconds\n") | |
679 | { | |
680 | if (!level || strmatch(level, "level-1")) | |
d2c970ff EDP |
681 | nb_cli_enqueue_change( |
682 | vty, "./lsp/timers/level-1/generation-interval", | |
683 | NB_OP_MODIFY, NULL); | |
1d6fe72e | 684 | if (!level || strmatch(level, "level-2")) |
d2c970ff EDP |
685 | nb_cli_enqueue_change( |
686 | vty, "./lsp/timers/level-2/generation-interval", | |
687 | NB_OP_MODIFY, NULL); | |
1d6fe72e EDP |
688 | |
689 | return nb_cli_apply_changes(vty, NULL); | |
690 | } | |
691 | ||
7e869004 | 692 | /* |
d2c970ff EDP |
693 | * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/refresh-interval |
694 | * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/refresh-interval | |
7e869004 | 695 | */ |
ca77b518 | 696 | DEFPY_YANG(lsp_refresh_interval, lsp_refresh_interval_cmd, |
7e869004 EDP |
697 | "lsp-refresh-interval [level-1|level-2]$level (1-65235)$val", |
698 | "LSP refresh interval\n" | |
699 | "LSP refresh interval for Level 1 only\n" | |
700 | "LSP refresh interval for Level 2 only\n" | |
701 | "LSP refresh interval in seconds\n") | |
702 | { | |
703 | if (!level || strmatch(level, "level-1")) | |
d2c970ff EDP |
704 | nb_cli_enqueue_change(vty, |
705 | "./lsp/timers/level-1/refresh-interval", | |
7e869004 EDP |
706 | NB_OP_MODIFY, val_str); |
707 | if (!level || strmatch(level, "level-2")) | |
d2c970ff EDP |
708 | nb_cli_enqueue_change(vty, |
709 | "./lsp/timers/level-2/refresh-interval", | |
7e869004 EDP |
710 | NB_OP_MODIFY, val_str); |
711 | ||
712 | return nb_cli_apply_changes(vty, NULL); | |
713 | } | |
714 | ||
ca77b518 | 715 | DEFPY_YANG(no_lsp_refresh_interval, no_lsp_refresh_interval_cmd, |
7e869004 EDP |
716 | "no lsp-refresh-interval [level-1|level-2]$level [(1-65235)]", |
717 | NO_STR | |
718 | "LSP refresh interval\n" | |
719 | "LSP refresh interval for Level 1 only\n" | |
720 | "LSP refresh interval for Level 2 only\n" | |
721 | "LSP refresh interval in seconds\n") | |
722 | { | |
723 | if (!level || strmatch(level, "level-1")) | |
d2c970ff EDP |
724 | nb_cli_enqueue_change(vty, |
725 | "./lsp/timers/level-1/refresh-interval", | |
7e869004 EDP |
726 | NB_OP_MODIFY, NULL); |
727 | if (!level || strmatch(level, "level-2")) | |
d2c970ff EDP |
728 | nb_cli_enqueue_change(vty, |
729 | "./lsp/timers/level-2/refresh-interval", | |
7e869004 EDP |
730 | NB_OP_MODIFY, NULL); |
731 | ||
732 | return nb_cli_apply_changes(vty, NULL); | |
733 | } | |
734 | ||
ea120aa0 | 735 | /* |
d2c970ff EDP |
736 | * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/maximum-lifetime |
737 | * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/maximum-lifetime | |
ea120aa0 | 738 | */ |
d2c970ff | 739 | |
ca77b518 | 740 | DEFPY_YANG(max_lsp_lifetime, max_lsp_lifetime_cmd, |
ea120aa0 EDP |
741 | "max-lsp-lifetime [level-1|level-2]$level (350-65535)$val", |
742 | "Maximum LSP lifetime\n" | |
743 | "Maximum LSP lifetime for Level 1 only\n" | |
744 | "Maximum LSP lifetime for Level 2 only\n" | |
745 | "LSP lifetime in seconds\n") | |
746 | { | |
747 | if (!level || strmatch(level, "level-1")) | |
d2c970ff EDP |
748 | nb_cli_enqueue_change(vty, |
749 | "./lsp/timers/level-1/maximum-lifetime", | |
ea120aa0 EDP |
750 | NB_OP_MODIFY, val_str); |
751 | if (!level || strmatch(level, "level-2")) | |
d2c970ff EDP |
752 | nb_cli_enqueue_change(vty, |
753 | "./lsp/timers/level-2/maximum-lifetime", | |
ea120aa0 EDP |
754 | NB_OP_MODIFY, val_str); |
755 | ||
756 | return nb_cli_apply_changes(vty, NULL); | |
757 | } | |
758 | ||
ca77b518 | 759 | DEFPY_YANG(no_max_lsp_lifetime, no_max_lsp_lifetime_cmd, |
ea120aa0 EDP |
760 | "no max-lsp-lifetime [level-1|level-2]$level [(350-65535)]", |
761 | NO_STR | |
762 | "Maximum LSP lifetime\n" | |
763 | "Maximum LSP lifetime for Level 1 only\n" | |
764 | "Maximum LSP lifetime for Level 2 only\n" | |
765 | "LSP lifetime in seconds\n") | |
766 | { | |
767 | if (!level || strmatch(level, "level-1")) | |
d2c970ff EDP |
768 | nb_cli_enqueue_change(vty, |
769 | "./lsp/timers/level-1/maximum-lifetime", | |
ea120aa0 EDP |
770 | NB_OP_MODIFY, NULL); |
771 | if (!level || strmatch(level, "level-2")) | |
d2c970ff EDP |
772 | nb_cli_enqueue_change(vty, |
773 | "./lsp/timers/level-2/maximum-lifetime", | |
ea120aa0 EDP |
774 | NB_OP_MODIFY, NULL); |
775 | ||
776 | return nb_cli_apply_changes(vty, NULL); | |
777 | } | |
778 | ||
d2c970ff EDP |
779 | /* unified LSP timers command |
780 | * XPath: /frr-isisd:isis/instance/lsp/timers | |
781 | */ | |
782 | ||
ca77b518 | 783 | DEFPY_YANG(lsp_timers, lsp_timers_cmd, |
d2c970ff EDP |
784 | "lsp-timers [level-1|level-2]$level gen-interval (1-120)$gen refresh-interval (1-65235)$refresh max-lifetime (350-65535)$lifetime", |
785 | "LSP-related timers\n" | |
786 | "LSP-related timers for Level 1 only\n" | |
787 | "LSP-related timers for Level 2 only\n" | |
788 | "Minimum interval between regenerating same LSP\n" | |
789 | "Generation interval in seconds\n" | |
790 | "LSP refresh interval\n" | |
791 | "LSP refresh interval in seconds\n" | |
792 | "Maximum LSP lifetime\n" | |
793 | "Maximum LSP lifetime in seconds\n") | |
ea120aa0 | 794 | { |
d2c970ff EDP |
795 | if (!level || strmatch(level, "level-1")) { |
796 | nb_cli_enqueue_change( | |
797 | vty, "./lsp/timers/level-1/generation-interval", | |
798 | NB_OP_MODIFY, gen_str); | |
799 | nb_cli_enqueue_change(vty, | |
800 | "./lsp/timers/level-1/refresh-interval", | |
801 | NB_OP_MODIFY, refresh_str); | |
802 | nb_cli_enqueue_change(vty, | |
803 | "./lsp/timers/level-1/maximum-lifetime", | |
804 | NB_OP_MODIFY, lifetime_str); | |
805 | } | |
806 | if (!level || strmatch(level, "level-2")) { | |
807 | nb_cli_enqueue_change( | |
808 | vty, "./lsp/timers/level-2/generation-interval", | |
809 | NB_OP_MODIFY, gen_str); | |
810 | nb_cli_enqueue_change(vty, | |
811 | "./lsp/timers/level-2/refresh-interval", | |
812 | NB_OP_MODIFY, refresh_str); | |
813 | nb_cli_enqueue_change(vty, | |
814 | "./lsp/timers/level-2/maximum-lifetime", | |
815 | NB_OP_MODIFY, lifetime_str); | |
816 | } | |
ea120aa0 | 817 | |
d2c970ff EDP |
818 | return nb_cli_apply_changes(vty, NULL); |
819 | } | |
820 | ||
ca77b518 | 821 | DEFPY_YANG(no_lsp_timers, no_lsp_timers_cmd, |
d2c970ff EDP |
822 | "no lsp-timers [level-1|level-2]$level [gen-interval (1-120) refresh-interval (1-65235) max-lifetime (350-65535)]", |
823 | NO_STR | |
824 | "LSP-related timers\n" | |
825 | "LSP-related timers for Level 1 only\n" | |
826 | "LSP-related timers for Level 2 only\n" | |
827 | "Minimum interval between regenerating same LSP\n" | |
828 | "Generation interval in seconds\n" | |
829 | "LSP refresh interval\n" | |
830 | "LSP refresh interval in seconds\n" | |
831 | "Maximum LSP lifetime\n" | |
832 | "Maximum LSP lifetime in seconds\n") | |
833 | { | |
834 | if (!level || strmatch(level, "level-1")) { | |
835 | nb_cli_enqueue_change( | |
836 | vty, "./lsp/timers/level-1/generation-interval", | |
837 | NB_OP_MODIFY, NULL); | |
838 | nb_cli_enqueue_change(vty, | |
839 | "./lsp/timers/level-1/refresh-interval", | |
840 | NB_OP_MODIFY, NULL); | |
841 | nb_cli_enqueue_change(vty, | |
842 | "./lsp/timers/level-1/maximum-lifetime", | |
843 | NB_OP_MODIFY, NULL); | |
844 | } | |
845 | if (!level || strmatch(level, "level-2")) { | |
846 | nb_cli_enqueue_change( | |
847 | vty, "./lsp/timers/level-2/generation-interval", | |
848 | NB_OP_MODIFY, NULL); | |
849 | nb_cli_enqueue_change(vty, | |
850 | "./lsp/timers/level-2/refresh-interval", | |
851 | NB_OP_MODIFY, NULL); | |
852 | nb_cli_enqueue_change(vty, | |
853 | "./lsp/timers/level-2/maximum-lifetime", | |
854 | NB_OP_MODIFY, NULL); | |
855 | } | |
856 | ||
857 | return nb_cli_apply_changes(vty, NULL); | |
858 | } | |
859 | ||
25605051 | 860 | void cli_show_isis_lsp_timers(struct vty *vty, const struct lyd_node *dnode, |
d2c970ff EDP |
861 | bool show_defaults) |
862 | { | |
863 | const char *l1_refresh = | |
864 | yang_dnode_get_string(dnode, "./level-1/refresh-interval"); | |
865 | const char *l2_refresh = | |
866 | yang_dnode_get_string(dnode, "./level-2/refresh-interval"); | |
867 | const char *l1_lifetime = | |
868 | yang_dnode_get_string(dnode, "./level-1/maximum-lifetime"); | |
869 | const char *l2_lifetime = | |
870 | yang_dnode_get_string(dnode, "./level-2/maximum-lifetime"); | |
871 | const char *l1_gen = | |
872 | yang_dnode_get_string(dnode, "./level-1/generation-interval"); | |
873 | const char *l2_gen = | |
874 | yang_dnode_get_string(dnode, "./level-2/generation-interval"); | |
875 | if (strmatch(l1_refresh, l2_refresh) | |
876 | && strmatch(l1_lifetime, l2_lifetime) && strmatch(l1_gen, l2_gen)) | |
877 | vty_out(vty, | |
878 | " lsp-timers gen-interval %s refresh-interval %s max-lifetime %s\n", | |
879 | l1_gen, l1_refresh, l1_lifetime); | |
ea120aa0 | 880 | else { |
d2c970ff EDP |
881 | vty_out(vty, |
882 | " lsp-timers level-1 gen-interval %s refresh-interval %s max-lifetime %s\n", | |
883 | l1_gen, l1_refresh, l1_lifetime); | |
884 | vty_out(vty, | |
885 | " lsp-timers level-2 gen-interval %s refresh-interval %s max-lifetime %s\n", | |
886 | l2_gen, l2_refresh, l2_lifetime); | |
ea120aa0 EDP |
887 | } |
888 | } | |
889 | ||
27a45d16 EDP |
890 | /* |
891 | * XPath: /frr-isisd:isis/instance/lsp/mtu | |
892 | */ | |
ca77b518 | 893 | DEFPY_YANG(area_lsp_mtu, area_lsp_mtu_cmd, "lsp-mtu (128-4352)$val", |
27a45d16 EDP |
894 | "Configure the maximum size of generated LSPs\n" |
895 | "Maximum size of generated LSPs\n") | |
896 | { | |
897 | nb_cli_enqueue_change(vty, "./lsp/mtu", NB_OP_MODIFY, val_str); | |
898 | ||
899 | return nb_cli_apply_changes(vty, NULL); | |
900 | } | |
901 | ||
ca77b518 | 902 | DEFPY_YANG(no_area_lsp_mtu, no_area_lsp_mtu_cmd, "no lsp-mtu [(128-4352)]", |
27a45d16 EDP |
903 | NO_STR |
904 | "Configure the maximum size of generated LSPs\n" | |
905 | "Maximum size of generated LSPs\n") | |
906 | { | |
907 | nb_cli_enqueue_change(vty, "./lsp/mtu", NB_OP_MODIFY, NULL); | |
908 | ||
909 | return nb_cli_apply_changes(vty, NULL); | |
910 | } | |
911 | ||
25605051 | 912 | void cli_show_isis_lsp_mtu(struct vty *vty, const struct lyd_node *dnode, |
27a45d16 EDP |
913 | bool show_defaults) |
914 | { | |
915 | vty_out(vty, " lsp-mtu %s\n", yang_dnode_get_string(dnode, NULL)); | |
916 | } | |
917 | ||
3f3608d8 DO |
918 | /* |
919 | * XPath: /frr-isisd:isis/instance/advertise-passive-only | |
920 | */ | |
921 | DEFPY_YANG(advertise_passive_only, advertise_passive_only_cmd, | |
922 | "[no] advertise-passive-only", | |
923 | NO_STR "Advertise prefixes of passive interfaces only\n") | |
924 | { | |
925 | nb_cli_enqueue_change(vty, "./advertise-passive-only", NB_OP_MODIFY, | |
926 | no ? "false" : "true"); | |
927 | ||
928 | return nb_cli_apply_changes(vty, NULL); | |
929 | } | |
930 | ||
931 | void cli_show_advertise_passive_only(struct vty *vty, | |
932 | const struct lyd_node *dnode, | |
933 | bool show_defaults) | |
934 | { | |
935 | if (!yang_dnode_get_bool(dnode, NULL)) | |
936 | vty_out(vty, " no"); | |
937 | ||
938 | vty_out(vty, " advertise-passive-only\n"); | |
939 | } | |
940 | ||
dcb1dcd6 EDP |
941 | /* |
942 | * XPath: /frr-isisd:isis/instance/spf/minimum-interval | |
943 | */ | |
ca77b518 | 944 | DEFPY_YANG(spf_interval, spf_interval_cmd, |
dcb1dcd6 EDP |
945 | "spf-interval [level-1|level-2]$level (1-120)$val", |
946 | "Minimum interval between SPF calculations\n" | |
947 | "Set interval for level 1 only\n" | |
948 | "Set interval for level 2 only\n" | |
949 | "Minimum interval between consecutive SPFs in seconds\n") | |
950 | { | |
951 | if (!level || strmatch(level, "level-1")) | |
952 | nb_cli_enqueue_change(vty, "./spf/minimum-interval/level-1", | |
953 | NB_OP_MODIFY, val_str); | |
954 | if (!level || strmatch(level, "level-2")) | |
955 | nb_cli_enqueue_change(vty, "./spf/minimum-interval/level-2", | |
956 | NB_OP_MODIFY, val_str); | |
957 | ||
958 | return nb_cli_apply_changes(vty, NULL); | |
959 | } | |
960 | ||
ca77b518 | 961 | DEFPY_YANG(no_spf_interval, no_spf_interval_cmd, |
dcb1dcd6 EDP |
962 | "no spf-interval [level-1|level-2]$level [(1-120)]", |
963 | NO_STR | |
964 | "Minimum interval between SPF calculations\n" | |
965 | "Set interval for level 1 only\n" | |
966 | "Set interval for level 2 only\n" | |
967 | "Minimum interval between consecutive SPFs in seconds\n") | |
968 | { | |
969 | if (!level || strmatch(level, "level-1")) | |
970 | nb_cli_enqueue_change(vty, "./spf/minimum-interval/level-1", | |
971 | NB_OP_MODIFY, NULL); | |
972 | if (!level || strmatch(level, "level-2")) | |
973 | nb_cli_enqueue_change(vty, "./spf/minimum-interval/level-2", | |
974 | NB_OP_MODIFY, NULL); | |
975 | ||
976 | return nb_cli_apply_changes(vty, NULL); | |
977 | } | |
978 | ||
25605051 IR |
979 | void cli_show_isis_spf_min_interval(struct vty *vty, |
980 | const struct lyd_node *dnode, | |
dcb1dcd6 EDP |
981 | bool show_defaults) |
982 | { | |
983 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
984 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
985 | ||
986 | if (strmatch(l1, l2)) | |
987 | vty_out(vty, " spf-interval %s\n", l1); | |
988 | else { | |
989 | vty_out(vty, " spf-interval level-1 %s\n", l1); | |
990 | vty_out(vty, " spf-interval level-2 %s\n", l2); | |
991 | } | |
992 | } | |
993 | ||
5336ba30 EDP |
994 | /* |
995 | * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay | |
996 | */ | |
ca77b518 | 997 | DEFPY_YANG(spf_delay_ietf, spf_delay_ietf_cmd, |
5336ba30 EDP |
998 | "spf-delay-ietf init-delay (0-60000) short-delay (0-60000) long-delay (0-60000) holddown (0-60000) time-to-learn (0-60000)", |
999 | "IETF SPF delay algorithm\n" | |
1000 | "Delay used while in QUIET state\n" | |
1001 | "Delay used while in QUIET state in milliseconds\n" | |
1002 | "Delay used while in SHORT_WAIT state\n" | |
1003 | "Delay used while in SHORT_WAIT state in milliseconds\n" | |
1004 | "Delay used while in LONG_WAIT\n" | |
1005 | "Delay used while in LONG_WAIT state in milliseconds\n" | |
1006 | "Time with no received IGP events before considering IGP stable\n" | |
1007 | "Time with no received IGP events before considering IGP stable (in milliseconds)\n" | |
1008 | "Maximum duration needed to learn all the events related to a single failure\n" | |
1009 | "Maximum duration needed to learn all the events related to a single failure (in milliseconds)\n") | |
1010 | { | |
1011 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay", NB_OP_CREATE, | |
1012 | NULL); | |
1013 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/init-delay", | |
1014 | NB_OP_MODIFY, init_delay_str); | |
1015 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/short-delay", | |
1016 | NB_OP_MODIFY, short_delay_str); | |
1017 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/long-delay", | |
1018 | NB_OP_MODIFY, long_delay_str); | |
1019 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/hold-down", | |
1020 | NB_OP_MODIFY, holddown_str); | |
1021 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/time-to-learn", | |
1022 | NB_OP_MODIFY, time_to_learn_str); | |
1023 | ||
1024 | return nb_cli_apply_changes(vty, NULL); | |
1025 | } | |
1026 | ||
ca77b518 | 1027 | DEFPY_YANG(no_spf_delay_ietf, no_spf_delay_ietf_cmd, |
5336ba30 EDP |
1028 | "no spf-delay-ietf [init-delay (0-60000) short-delay (0-60000) long-delay (0-60000) holddown (0-60000) time-to-learn (0-60000)]", |
1029 | NO_STR | |
f34ab52d | 1030 | "IETF SPF delay algorithm\n" |
5336ba30 EDP |
1031 | "Delay used while in QUIET state\n" |
1032 | "Delay used while in QUIET state in milliseconds\n" | |
1033 | "Delay used while in SHORT_WAIT state\n" | |
1034 | "Delay used while in SHORT_WAIT state in milliseconds\n" | |
1035 | "Delay used while in LONG_WAIT\n" | |
1036 | "Delay used while in LONG_WAIT state in milliseconds\n" | |
1037 | "Time with no received IGP events before considering IGP stable\n" | |
1038 | "Time with no received IGP events before considering IGP stable (in milliseconds)\n" | |
1039 | "Maximum duration needed to learn all the events related to a single failure\n" | |
1040 | "Maximum duration needed to learn all the events related to a single failure (in milliseconds)\n") | |
1041 | { | |
95ce849b | 1042 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay", NB_OP_DESTROY, |
5336ba30 EDP |
1043 | NULL); |
1044 | ||
1045 | return nb_cli_apply_changes(vty, NULL); | |
1046 | } | |
1047 | ||
25605051 IR |
1048 | void cli_show_isis_spf_ietf_backoff(struct vty *vty, |
1049 | const struct lyd_node *dnode, | |
5336ba30 EDP |
1050 | bool show_defaults) |
1051 | { | |
1052 | vty_out(vty, | |
1053 | " spf-delay-ietf init-delay %s short-delay %s long-delay %s holddown %s time-to-learn %s\n", | |
1054 | yang_dnode_get_string(dnode, "./init-delay"), | |
1055 | yang_dnode_get_string(dnode, "./short-delay"), | |
1056 | yang_dnode_get_string(dnode, "./long-delay"), | |
1057 | yang_dnode_get_string(dnode, "./hold-down"), | |
1058 | yang_dnode_get_string(dnode, "./time-to-learn")); | |
1059 | } | |
1060 | ||
d20b14bc RW |
1061 | /* |
1062 | * XPath: /frr-isisd:isis/instance/spf/prefix-priorities/medium/access-list-name | |
1063 | */ | |
1064 | DEFPY_YANG(spf_prefix_priority, spf_prefix_priority_cmd, | |
c60dec36 | 1065 | "spf prefix-priority <critical|high|medium>$priority ACCESSLIST_NAME$acl_name", |
d20b14bc RW |
1066 | "SPF configuration\n" |
1067 | "Configure a prefix priority list\n" | |
1068 | "Specify critical priority prefixes\n" | |
1069 | "Specify high priority prefixes\n" | |
1070 | "Specify medium priority prefixes\n" | |
1071 | "Access-list name\n") | |
1072 | { | |
1073 | char xpath[XPATH_MAXLEN]; | |
1074 | ||
1075 | snprintf(xpath, XPATH_MAXLEN, | |
1076 | "./spf/prefix-priorities/%s/access-list-name", priority); | |
1077 | nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, acl_name); | |
1078 | ||
1079 | return nb_cli_apply_changes(vty, NULL); | |
1080 | } | |
1081 | ||
1082 | DEFPY_YANG(no_spf_prefix_priority, no_spf_prefix_priority_cmd, | |
c60dec36 | 1083 | "no spf prefix-priority <critical|high|medium>$priority [ACCESSLIST_NAME]", |
d20b14bc RW |
1084 | NO_STR |
1085 | "SPF configuration\n" | |
1086 | "Configure a prefix priority list\n" | |
1087 | "Specify critical priority prefixes\n" | |
1088 | "Specify high priority prefixes\n" | |
1089 | "Specify medium priority prefixes\n" | |
1090 | "Access-list name\n") | |
1091 | { | |
1092 | char xpath[XPATH_MAXLEN]; | |
1093 | ||
1094 | snprintf(xpath, XPATH_MAXLEN, | |
1095 | "./spf/prefix-priorities/%s/access-list-name", priority); | |
1096 | nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL); | |
1097 | ||
1098 | return nb_cli_apply_changes(vty, NULL); | |
1099 | } | |
1100 | ||
25605051 IR |
1101 | void cli_show_isis_spf_prefix_priority(struct vty *vty, |
1102 | const struct lyd_node *dnode, | |
d20b14bc RW |
1103 | bool show_defaults) |
1104 | { | |
1105 | vty_out(vty, " spf prefix-priority %s %s\n", | |
1106 | dnode->parent->schema->name, | |
1107 | yang_dnode_get_string(dnode, NULL)); | |
1108 | } | |
1109 | ||
66e45e10 EDP |
1110 | /* |
1111 | * XPath: /frr-isisd:isis/instance/purge-originator | |
1112 | */ | |
ca77b518 | 1113 | DEFPY_YANG(area_purge_originator, area_purge_originator_cmd, "[no] purge-originator", |
66e45e10 EDP |
1114 | NO_STR "Use the RFC 6232 purge-originator\n") |
1115 | { | |
5f1e5e3f EDP |
1116 | nb_cli_enqueue_change(vty, "./purge-originator", NB_OP_MODIFY, |
1117 | no ? "false" : "true"); | |
66e45e10 EDP |
1118 | |
1119 | return nb_cli_apply_changes(vty, NULL); | |
1120 | } | |
1121 | ||
25605051 | 1122 | void cli_show_isis_purge_origin(struct vty *vty, const struct lyd_node *dnode, |
66e45e10 EDP |
1123 | bool show_defaults) |
1124 | { | |
5f1e5e3f EDP |
1125 | if (!yang_dnode_get_bool(dnode, NULL)) |
1126 | vty_out(vty, " no"); | |
66e45e10 EDP |
1127 | vty_out(vty, " purge-originator\n"); |
1128 | } | |
1129 | ||
f46e34f8 | 1130 | |
46fb37cf HS |
1131 | /* |
1132 | * XPath: /frr-isisd:isis/instance/admin-group-send-zero | |
1133 | */ | |
1134 | DEFPY_YANG(isis_admin_group_send_zero, isis_admin_group_send_zero_cmd, | |
1135 | "[no] admin-group-send-zero", | |
1136 | NO_STR | |
1137 | "Allow sending the default admin-group value of 0x00000000.\n") | |
1138 | { | |
1139 | nb_cli_enqueue_change(vty, "./admin-group-send-zero", NB_OP_MODIFY, | |
1140 | no ? "false" : "true"); | |
1141 | ||
1142 | return nb_cli_apply_changes(vty, NULL); | |
1143 | } | |
1144 | ||
1145 | void cli_show_isis_admin_group_send_zero(struct vty *vty, | |
1146 | const struct lyd_node *dnode, | |
1147 | bool show_defaults) | |
1148 | { | |
1149 | if (!yang_dnode_get_bool(dnode, NULL)) | |
1150 | vty_out(vty, " no"); | |
1151 | vty_out(vty, " admin-group-send-zero\n"); | |
1152 | } | |
1153 | ||
1154 | ||
1155 | /* | |
1156 | * XPath: /frr-isisd:isis/instance/asla-legacy-flag | |
1157 | */ | |
1158 | DEFPY_HIDDEN(isis_asla_legacy_flag, isis_asla_legacy_flag_cmd, | |
1159 | "[no] asla-legacy-flag", | |
1160 | NO_STR "Set the legacy flag (aka. L-FLAG) in the ASLA Sub-TLV.\n") | |
1161 | { | |
1162 | nb_cli_enqueue_change(vty, "./asla-legacy-flag", NB_OP_MODIFY, | |
1163 | no ? "false" : "true"); | |
1164 | ||
1165 | return nb_cli_apply_changes(vty, NULL); | |
1166 | } | |
1167 | ||
1168 | void cli_show_isis_asla_legacy_flag(struct vty *vty, | |
1169 | const struct lyd_node *dnode, | |
1170 | bool show_defaults) | |
1171 | { | |
1172 | if (!yang_dnode_get_bool(dnode, NULL)) | |
1173 | vty_out(vty, " no"); | |
1174 | vty_out(vty, " asla-legacy-flag\n"); | |
1175 | } | |
1176 | ||
d1a80ef6 | 1177 | /* |
2e2a8b91 | 1178 | * XPath: /frr-isisd:isis/instance/mpls-te |
d1a80ef6 | 1179 | */ |
ca77b518 | 1180 | DEFPY_YANG(isis_mpls_te_on, isis_mpls_te_on_cmd, "mpls-te on", |
d1a80ef6 EDP |
1181 | MPLS_TE_STR "Enable the MPLS-TE functionality\n") |
1182 | { | |
2e2a8b91 | 1183 | nb_cli_enqueue_change(vty, "./mpls-te", NB_OP_CREATE, |
d1a80ef6 EDP |
1184 | NULL); |
1185 | ||
1186 | return nb_cli_apply_changes(vty, NULL); | |
1187 | } | |
1188 | ||
ca77b518 | 1189 | DEFPY_YANG(no_isis_mpls_te_on, no_isis_mpls_te_on_cmd, "no mpls-te [on]", |
d1a80ef6 EDP |
1190 | NO_STR |
1191 | "Disable the MPLS-TE functionality\n" | |
2e2a8b91 | 1192 | "Disable the MPLS-TE functionality\n") |
d1a80ef6 | 1193 | { |
2e2a8b91 | 1194 | nb_cli_enqueue_change(vty, "./mpls-te", NB_OP_DESTROY, |
d1a80ef6 EDP |
1195 | NULL); |
1196 | ||
1197 | return nb_cli_apply_changes(vty, NULL); | |
1198 | } | |
1199 | ||
25605051 | 1200 | void cli_show_isis_mpls_te(struct vty *vty, const struct lyd_node *dnode, |
d1a80ef6 EDP |
1201 | bool show_defaults) |
1202 | { | |
dab1fb8d | 1203 | vty_out(vty, " mpls-te on\n"); |
d1a80ef6 EDP |
1204 | } |
1205 | ||
1206 | /* | |
2e2a8b91 | 1207 | * XPath: /frr-isisd:isis/instance/mpls-te/router-address |
d1a80ef6 | 1208 | */ |
ca77b518 | 1209 | DEFPY_YANG(isis_mpls_te_router_addr, isis_mpls_te_router_addr_cmd, |
d1a80ef6 EDP |
1210 | "mpls-te router-address A.B.C.D", |
1211 | MPLS_TE_STR | |
1212 | "Stable IP address of the advertising router\n" | |
1213 | "MPLS-TE router address in IPv4 address format\n") | |
1214 | { | |
2e2a8b91 | 1215 | nb_cli_enqueue_change(vty, "./mpls-te/router-address", |
d1a80ef6 EDP |
1216 | NB_OP_MODIFY, router_address_str); |
1217 | ||
1218 | return nb_cli_apply_changes(vty, NULL); | |
1219 | } | |
1220 | ||
ca77b518 | 1221 | DEFPY_YANG(no_isis_mpls_te_router_addr, no_isis_mpls_te_router_addr_cmd, |
2e2a8b91 OD |
1222 | "no mpls-te router-address [A.B.C.D]", |
1223 | NO_STR MPLS_TE_STR | |
1224 | "Delete IP address of the advertising router\n" | |
1225 | "MPLS-TE router address in IPv4 address format\n") | |
1226 | { | |
1227 | nb_cli_enqueue_change(vty, "./mpls-te/router-address", | |
1228 | NB_OP_DESTROY, NULL); | |
1229 | ||
1230 | return nb_cli_apply_changes(vty, NULL); | |
1231 | } | |
1232 | ||
25605051 IR |
1233 | void cli_show_isis_mpls_te_router_addr(struct vty *vty, |
1234 | const struct lyd_node *dnode, | |
d1a80ef6 EDP |
1235 | bool show_defaults) |
1236 | { | |
dab1fb8d | 1237 | vty_out(vty, " mpls-te router-address %s\n", |
d1a80ef6 EDP |
1238 | yang_dnode_get_string(dnode, NULL)); |
1239 | } | |
1240 | ||
173f8887 OD |
1241 | /* |
1242 | * XPath: /frr-isisd:isis/instance/mpls-te/router-address-v6 | |
1243 | */ | |
1244 | DEFPY_YANG(isis_mpls_te_router_addr_v6, isis_mpls_te_router_addr_v6_cmd, | |
1245 | "mpls-te router-address ipv6 X:X::X:X", | |
1246 | MPLS_TE_STR | |
1247 | "Stable IP address of the advertising router\n" | |
1248 | "IPv6 address\n" | |
1249 | "MPLS-TE router address in IPv6 address format\n") | |
1250 | { | |
1251 | nb_cli_enqueue_change(vty, "./mpls-te/router-address-v6", NB_OP_MODIFY, | |
1252 | ipv6_str); | |
1253 | ||
1254 | return nb_cli_apply_changes(vty, NULL); | |
1255 | } | |
1256 | ||
1257 | DEFPY_YANG(no_isis_mpls_te_router_addr_v6, no_isis_mpls_te_router_addr_v6_cmd, | |
1258 | "no mpls-te router-address ipv6 [X:X::X:X]", | |
1259 | NO_STR MPLS_TE_STR | |
1260 | "Delete IP address of the advertising router\n" | |
1261 | "IPv6 address\n" | |
1262 | "MPLS-TE router address in IPv6 address format\n") | |
1263 | { | |
1264 | nb_cli_enqueue_change(vty, "./mpls-te/router-address-v6", NB_OP_DESTROY, | |
1265 | NULL); | |
1266 | ||
1267 | return nb_cli_apply_changes(vty, NULL); | |
1268 | } | |
1269 | ||
1270 | void cli_show_isis_mpls_te_router_addr_ipv6(struct vty *vty, | |
1271 | const struct lyd_node *dnode, | |
1272 | bool show_defaults) | |
1273 | { | |
1274 | vty_out(vty, " mpls-te router-address ipv6 %s\n", | |
1275 | yang_dnode_get_string(dnode, NULL)); | |
1276 | } | |
1277 | ||
ca77b518 | 1278 | DEFPY_YANG(isis_mpls_te_inter_as, isis_mpls_te_inter_as_cmd, |
d1a80ef6 EDP |
1279 | "[no] mpls-te inter-as [level-1|level-1-2|level-2-only]", |
1280 | NO_STR MPLS_TE_STR | |
1281 | "Configure MPLS-TE Inter-AS support\n" | |
1282 | "AREA native mode self originate INTER-AS LSP with L1 only flooding scope\n" | |
1283 | "AREA native mode self originate INTER-AS LSP with L1 and L2 flooding scope\n" | |
1284 | "AS native mode self originate INTER-AS LSP with L2 only flooding scope\n") | |
1285 | { | |
2e2a8b91 | 1286 | vty_out(vty, "MPLS-TE Inter-AS is not yet supported\n"); |
d1a80ef6 EDP |
1287 | return CMD_SUCCESS; |
1288 | } | |
1289 | ||
ed6189a9 OD |
1290 | /* |
1291 | * XPath: /frr-isisd:isis/instance/mpls-te/export | |
1292 | */ | |
1293 | DEFPY_YANG(isis_mpls_te_export, isis_mpls_te_export_cmd, "mpls-te export", | |
1294 | MPLS_TE_STR "Enable export of MPLS-TE Link State information\n") | |
1295 | { | |
1296 | nb_cli_enqueue_change(vty, "./mpls-te/export", NB_OP_MODIFY, "true"); | |
1297 | ||
1298 | return nb_cli_apply_changes(vty, NULL); | |
1299 | } | |
1300 | ||
1301 | DEFPY_YANG(no_isis_mpls_te_export, no_isis_mpls_te_export_cmd, | |
1302 | "no mpls-te export", | |
1303 | NO_STR MPLS_TE_STR | |
1304 | "Disable export of MPLS-TE Link State information\n") | |
1305 | { | |
1306 | nb_cli_enqueue_change(vty, "./mpls-te/export", NB_OP_MODIFY, "false"); | |
1307 | ||
1308 | return nb_cli_apply_changes(vty, NULL); | |
1309 | } | |
1310 | ||
1311 | void cli_show_isis_mpls_te_export(struct vty *vty, const struct lyd_node *dnode, | |
1312 | bool show_defaults) | |
1313 | { | |
1314 | if (!yang_dnode_get_bool(dnode, NULL)) | |
1315 | vty_out(vty, " no"); | |
1316 | ||
1317 | vty_out(vty, " mpls-te export\n"); | |
1318 | } | |
1319 | ||
8b104c10 EDP |
1320 | /* |
1321 | * XPath: /frr-isisd:isis/instance/default-information-originate | |
1322 | */ | |
ca77b518 | 1323 | DEFPY_YANG(isis_default_originate, isis_default_originate_cmd, |
70dd370f | 1324 | "[no] default-information originate <ipv4|ipv6>$ip <level-1|level-2>$level [always]$always [{metric (0-16777215)$metric|route-map RMAP_NAME$rmap}]", |
8b104c10 EDP |
1325 | NO_STR |
1326 | "Control distribution of default information\n" | |
1327 | "Distribute a default route\n" | |
1328 | "Distribute default route for IPv4\n" | |
1329 | "Distribute default route for IPv6\n" | |
1330 | "Distribute default route into level-1\n" | |
1331 | "Distribute default route into level-2\n" | |
1332 | "Always advertise default route\n" | |
1333 | "Metric for default route\n" | |
6aa15aeb | 1334 | "IS-IS default metric\n" |
8b104c10 EDP |
1335 | "Route map reference\n" |
1336 | "Pointer to route-map entries\n") | |
1337 | { | |
1338 | if (no) | |
95ce849b | 1339 | nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); |
8b104c10 EDP |
1340 | else { |
1341 | nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); | |
5f1e5e3f EDP |
1342 | nb_cli_enqueue_change(vty, "./always", NB_OP_MODIFY, |
1343 | always ? "true" : "false"); | |
8b104c10 | 1344 | nb_cli_enqueue_change(vty, "./route-map", |
95ce849b | 1345 | rmap ? NB_OP_MODIFY : NB_OP_DESTROY, |
8b104c10 | 1346 | rmap ? rmap : NULL); |
82c25998 DT |
1347 | nb_cli_enqueue_change(vty, "./metric", NB_OP_MODIFY, |
1348 | metric_str ? metric_str : NULL); | |
8b104c10 EDP |
1349 | if (strmatch(ip, "ipv6") && !always) { |
1350 | vty_out(vty, | |
1351 | "Zebra doesn't implement default-originate for IPv6 yet\n"); | |
1352 | vty_out(vty, | |
1353 | "so use with care or use default-originate always.\n"); | |
1354 | } | |
1355 | } | |
1356 | ||
1357 | return nb_cli_apply_changes( | |
1358 | vty, "./default-information-originate/%s[level='%s']", ip, | |
1359 | level); | |
1360 | } | |
1361 | ||
25605051 | 1362 | static void vty_print_def_origin(struct vty *vty, const struct lyd_node *dnode, |
f34ab52d EDP |
1363 | const char *family, const char *level, |
1364 | bool show_defaults) | |
8b104c10 | 1365 | { |
8b104c10 | 1366 | vty_out(vty, " default-information originate %s %s", family, level); |
5f1e5e3f | 1367 | if (yang_dnode_get_bool(dnode, "./always")) |
8b104c10 EDP |
1368 | vty_out(vty, " always"); |
1369 | ||
1370 | if (yang_dnode_exists(dnode, "./route-map")) | |
1371 | vty_out(vty, " route-map %s", | |
1372 | yang_dnode_get_string(dnode, "./route-map")); | |
82c25998 DT |
1373 | if (show_defaults || !yang_dnode_is_default(dnode, "./metric")) |
1374 | vty_out(vty, " metric %s", | |
1375 | yang_dnode_get_string(dnode, "./metric")); | |
1376 | ||
8b104c10 EDP |
1377 | vty_out(vty, "\n"); |
1378 | } | |
1379 | ||
25605051 IR |
1380 | void cli_show_isis_def_origin_ipv4(struct vty *vty, |
1381 | const struct lyd_node *dnode, | |
8b104c10 EDP |
1382 | bool show_defaults) |
1383 | { | |
1384 | const char *level = yang_dnode_get_string(dnode, "./level"); | |
1385 | ||
1386 | vty_print_def_origin(vty, dnode, "ipv4", level, show_defaults); | |
1387 | } | |
1388 | ||
25605051 IR |
1389 | void cli_show_isis_def_origin_ipv6(struct vty *vty, |
1390 | const struct lyd_node *dnode, | |
8b104c10 EDP |
1391 | bool show_defaults) |
1392 | { | |
1393 | const char *level = yang_dnode_get_string(dnode, "./level"); | |
1394 | ||
1395 | vty_print_def_origin(vty, dnode, "ipv6", level, show_defaults); | |
1396 | } | |
1397 | ||
a041ac8e EDP |
1398 | /* |
1399 | * XPath: /frr-isisd:isis/instance/redistribute | |
1400 | */ | |
ca77b518 | 1401 | DEFPY_YANG(isis_redistribute, isis_redistribute_cmd, |
1bfee936 IR |
1402 | "[no] redistribute <ipv4$ip " PROTO_IP_REDIST_STR "$proto|ipv6$ip " |
1403 | PROTO_IP6_REDIST_STR "$proto> <level-1|level-2>$level" | |
70dd370f | 1404 | "[{metric (0-16777215)|route-map RMAP_NAME$route_map}]", |
a041ac8e EDP |
1405 | NO_STR REDIST_STR |
1406 | "Redistribute IPv4 routes\n" | |
1bfee936 IR |
1407 | PROTO_IP_REDIST_HELP |
1408 | "Redistribute IPv6 routes\n" | |
1409 | PROTO_IP6_REDIST_HELP | |
a041ac8e EDP |
1410 | "Redistribute into level-1\n" |
1411 | "Redistribute into level-2\n" | |
1412 | "Metric for redistributed routes\n" | |
6aa15aeb | 1413 | "IS-IS default metric\n" |
a041ac8e EDP |
1414 | "Route map reference\n" |
1415 | "Pointer to route-map entries\n") | |
1416 | { | |
1417 | if (no) | |
95ce849b | 1418 | nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); |
a041ac8e EDP |
1419 | else { |
1420 | nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); | |
1421 | nb_cli_enqueue_change(vty, "./route-map", | |
95ce849b | 1422 | route_map ? NB_OP_MODIFY : NB_OP_DESTROY, |
a041ac8e | 1423 | route_map ? route_map : NULL); |
82c25998 DT |
1424 | nb_cli_enqueue_change(vty, "./metric", NB_OP_MODIFY, |
1425 | metric_str ? metric_str : NULL); | |
a041ac8e EDP |
1426 | } |
1427 | ||
1428 | return nb_cli_apply_changes( | |
1429 | vty, "./redistribute/%s[protocol='%s'][level='%s']", ip, proto, | |
1430 | level); | |
1431 | } | |
1432 | ||
25605051 IR |
1433 | static void vty_print_redistribute(struct vty *vty, |
1434 | const struct lyd_node *dnode, | |
82c25998 | 1435 | bool show_defaults, const char *family) |
a041ac8e EDP |
1436 | { |
1437 | const char *level = yang_dnode_get_string(dnode, "./level"); | |
1438 | const char *protocol = yang_dnode_get_string(dnode, "./protocol"); | |
1439 | ||
1440 | vty_out(vty, " redistribute %s %s %s", family, protocol, level); | |
82c25998 | 1441 | if (show_defaults || !yang_dnode_is_default(dnode, "./metric")) |
a041ac8e EDP |
1442 | vty_out(vty, " metric %s", |
1443 | yang_dnode_get_string(dnode, "./metric")); | |
82c25998 | 1444 | if (yang_dnode_exists(dnode, "./route-map")) |
a041ac8e EDP |
1445 | vty_out(vty, " route-map %s", |
1446 | yang_dnode_get_string(dnode, "./route-map")); | |
1447 | vty_out(vty, "\n"); | |
1448 | } | |
1449 | ||
25605051 IR |
1450 | void cli_show_isis_redistribute_ipv4(struct vty *vty, |
1451 | const struct lyd_node *dnode, | |
a041ac8e EDP |
1452 | bool show_defaults) |
1453 | { | |
82c25998 | 1454 | vty_print_redistribute(vty, dnode, show_defaults, "ipv4"); |
a041ac8e | 1455 | } |
25605051 IR |
1456 | void cli_show_isis_redistribute_ipv6(struct vty *vty, |
1457 | const struct lyd_node *dnode, | |
a041ac8e EDP |
1458 | bool show_defaults) |
1459 | { | |
82c25998 | 1460 | vty_print_redistribute(vty, dnode, show_defaults, "ipv6"); |
a041ac8e EDP |
1461 | } |
1462 | ||
22af6a80 EDP |
1463 | /* |
1464 | * XPath: /frr-isisd:isis/instance/multi-topology | |
1465 | */ | |
a15014f3 PG |
1466 | DEFPY_YANG( |
1467 | isis_topology, isis_topology_cmd, | |
1468 | "[no] topology <standard|ipv4-unicast|ipv4-mgmt|ipv6-unicast|ipv4-multicast|ipv6-multicast|ipv6-mgmt|ipv6-dstsrc>$topology [overload]$overload", | |
1469 | NO_STR | |
1470 | "Configure IS-IS topologies\n" | |
1471 | "standard topology\n" | |
1472 | "IPv4 unicast topology\n" | |
1473 | "IPv4 management topology\n" | |
1474 | "IPv6 unicast topology\n" | |
1475 | "IPv4 multicast topology\n" | |
1476 | "IPv6 multicast topology\n" | |
1477 | "IPv6 management topology\n" | |
1478 | "IPv6 dst-src topology\n" | |
1479 | "Set overload bit for topology\n") | |
22af6a80 EDP |
1480 | { |
1481 | char base_xpath[XPATH_MAXLEN]; | |
1482 | ||
a15014f3 | 1483 | /* Since standard is not configurable it is not present in the |
22af6a80 EDP |
1484 | * YANG model, so we need to validate it here |
1485 | */ | |
a15014f3 PG |
1486 | if (strmatch(topology, "standard") || |
1487 | strmatch(topology, "ipv4-unicast")) { | |
1488 | vty_out(vty, | |
1489 | "Cannot configure IPv4 unicast (Standard) topology\n"); | |
22af6a80 EDP |
1490 | return CMD_WARNING_CONFIG_FAILED; |
1491 | } | |
1492 | ||
1493 | if (strmatch(topology, "ipv4-mgmt")) | |
1494 | snprintf(base_xpath, XPATH_MAXLEN, | |
1495 | "./multi-topology/ipv4-management"); | |
1496 | else if (strmatch(topology, "ipv6-mgmt")) | |
1497 | snprintf(base_xpath, XPATH_MAXLEN, | |
1498 | "./multi-topology/ipv6-management"); | |
1499 | else | |
1500 | snprintf(base_xpath, XPATH_MAXLEN, "./multi-topology/%s", | |
1501 | topology); | |
1502 | ||
1503 | if (no) | |
95ce849b | 1504 | nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); |
22af6a80 EDP |
1505 | else { |
1506 | nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); | |
5f1e5e3f EDP |
1507 | nb_cli_enqueue_change(vty, "./overload", NB_OP_MODIFY, |
1508 | overload ? "true" : "false"); | |
22af6a80 EDP |
1509 | } |
1510 | ||
ae08de9f | 1511 | return nb_cli_apply_changes(vty, "%s", base_xpath); |
22af6a80 EDP |
1512 | } |
1513 | ||
25605051 IR |
1514 | void cli_show_isis_mt_ipv4_multicast(struct vty *vty, |
1515 | const struct lyd_node *dnode, | |
22af6a80 EDP |
1516 | bool show_defaults) |
1517 | { | |
1518 | vty_out(vty, " topology ipv4-multicast"); | |
5f1e5e3f | 1519 | if (yang_dnode_get_bool(dnode, "./overload")) |
22af6a80 EDP |
1520 | vty_out(vty, " overload"); |
1521 | vty_out(vty, "\n"); | |
1522 | } | |
1523 | ||
25605051 | 1524 | void cli_show_isis_mt_ipv4_mgmt(struct vty *vty, const struct lyd_node *dnode, |
22af6a80 EDP |
1525 | bool show_defaults) |
1526 | { | |
1527 | vty_out(vty, " topology ipv4-mgmt"); | |
5f1e5e3f | 1528 | if (yang_dnode_get_bool(dnode, "./overload")) |
22af6a80 EDP |
1529 | vty_out(vty, " overload"); |
1530 | vty_out(vty, "\n"); | |
1531 | } | |
1532 | ||
25605051 IR |
1533 | void cli_show_isis_mt_ipv6_unicast(struct vty *vty, |
1534 | const struct lyd_node *dnode, | |
22af6a80 EDP |
1535 | bool show_defaults) |
1536 | { | |
1537 | vty_out(vty, " topology ipv6-unicast"); | |
5f1e5e3f | 1538 | if (yang_dnode_get_bool(dnode, "./overload")) |
22af6a80 EDP |
1539 | vty_out(vty, " overload"); |
1540 | vty_out(vty, "\n"); | |
1541 | } | |
1542 | ||
25605051 IR |
1543 | void cli_show_isis_mt_ipv6_multicast(struct vty *vty, |
1544 | const struct lyd_node *dnode, | |
22af6a80 EDP |
1545 | bool show_defaults) |
1546 | { | |
1547 | vty_out(vty, " topology ipv6-multicast"); | |
5f1e5e3f | 1548 | if (yang_dnode_get_bool(dnode, "./overload")) |
22af6a80 EDP |
1549 | vty_out(vty, " overload"); |
1550 | vty_out(vty, "\n"); | |
1551 | } | |
1552 | ||
25605051 | 1553 | void cli_show_isis_mt_ipv6_mgmt(struct vty *vty, const struct lyd_node *dnode, |
22af6a80 EDP |
1554 | bool show_defaults) |
1555 | { | |
1556 | vty_out(vty, " topology ipv6-mgmt"); | |
5f1e5e3f | 1557 | if (yang_dnode_get_bool(dnode, "./overload")) |
22af6a80 EDP |
1558 | vty_out(vty, " overload"); |
1559 | vty_out(vty, "\n"); | |
1560 | } | |
1561 | ||
25605051 | 1562 | void cli_show_isis_mt_ipv6_dstsrc(struct vty *vty, const struct lyd_node *dnode, |
22af6a80 EDP |
1563 | bool show_defaults) |
1564 | { | |
1565 | vty_out(vty, " topology ipv6-dstsrc"); | |
5f1e5e3f | 1566 | if (yang_dnode_get_bool(dnode, "./overload")) |
22af6a80 EDP |
1567 | vty_out(vty, " overload"); |
1568 | vty_out(vty, "\n"); | |
1569 | } | |
1570 | ||
8f6c8936 RW |
1571 | /* |
1572 | * XPath: /frr-isisd:isis/instance/segment-routing/enabled | |
1573 | */ | |
ca77b518 | 1574 | DEFPY_YANG (isis_sr_enable, |
8f6c8936 RW |
1575 | isis_sr_enable_cmd, |
1576 | "segment-routing on", | |
1577 | SR_STR | |
1578 | "Enable Segment Routing\n") | |
1579 | { | |
1580 | nb_cli_enqueue_change(vty, "./segment-routing/enabled", NB_OP_MODIFY, | |
1581 | "true"); | |
1582 | ||
1583 | return nb_cli_apply_changes(vty, NULL); | |
1584 | } | |
1585 | ||
ca77b518 | 1586 | DEFPY_YANG (no_isis_sr_enable, |
8f6c8936 RW |
1587 | no_isis_sr_enable_cmd, |
1588 | "no segment-routing [on]", | |
1589 | NO_STR | |
1590 | SR_STR | |
1591 | "Disable Segment Routing\n") | |
1592 | { | |
1593 | nb_cli_enqueue_change(vty, "./segment-routing/enabled", NB_OP_MODIFY, | |
1594 | "false"); | |
1595 | ||
1596 | return nb_cli_apply_changes(vty, NULL); | |
1597 | } | |
1598 | ||
25605051 | 1599 | void cli_show_isis_sr_enabled(struct vty *vty, const struct lyd_node *dnode, |
8f6c8936 RW |
1600 | bool show_defaults) |
1601 | { | |
1602 | if (!yang_dnode_get_bool(dnode, NULL)) | |
1603 | vty_out(vty, " no"); | |
1604 | ||
1605 | vty_out(vty, " segment-routing on\n"); | |
1606 | } | |
1607 | ||
1608 | /* | |
01d43141 | 1609 | * XPath: /frr-isisd:isis/instance/segment-routing/label-block |
8f6c8936 | 1610 | */ |
01d43141 EDP |
1611 | |
1612 | DEFPY_YANG( | |
1613 | isis_sr_global_block_label_range, isis_sr_global_block_label_range_cmd, | |
1614 | "segment-routing global-block (16-1048575)$gb_lower_bound (16-1048575)$gb_upper_bound [local-block (16-1048575)$lb_lower_bound (16-1048575)$lb_upper_bound]", | |
1615 | SR_STR | |
1616 | "Segment Routing Global Block label range\n" | |
1617 | "The lower bound of the global block\n" | |
1618 | "The upper bound of the global block (block size may not exceed 65535)\n" | |
1619 | "Segment Routing Local Block label range\n" | |
1620 | "The lower bound of the local block\n" | |
1621 | "The upper bound of the local block (block size may not exceed 65535)\n") | |
1622 | { | |
1623 | nb_cli_enqueue_change(vty, | |
1624 | "./segment-routing/label-blocks/srgb/lower-bound", | |
1625 | NB_OP_MODIFY, gb_lower_bound_str); | |
1626 | nb_cli_enqueue_change(vty, | |
1627 | "./segment-routing/label-blocks/srgb/upper-bound", | |
1628 | NB_OP_MODIFY, gb_upper_bound_str); | |
1629 | ||
1630 | nb_cli_enqueue_change( | |
1631 | vty, "./segment-routing/label-blocks/srlb/lower-bound", | |
1632 | NB_OP_MODIFY, lb_lower_bound ? lb_lower_bound_str : NULL); | |
1633 | nb_cli_enqueue_change( | |
1634 | vty, "./segment-routing/label-blocks/srlb/upper-bound", | |
1635 | NB_OP_MODIFY, lb_upper_bound ? lb_upper_bound_str : NULL); | |
8f6c8936 RW |
1636 | |
1637 | return nb_cli_apply_changes(vty, NULL); | |
1638 | } | |
1639 | ||
01d43141 EDP |
1640 | DEFPY_YANG(no_isis_sr_global_block_label_range, |
1641 | no_isis_sr_global_block_label_range_cmd, | |
1642 | "no segment-routing global-block [(16-1048575) (16-1048575) local-block (16-1048575) (16-1048575)]", | |
1643 | NO_STR SR_STR | |
1644 | "Segment Routing Global Block label range\n" | |
1645 | "The lower bound of the global block\n" | |
1646 | "The upper bound of the global block (block size may not exceed 65535)\n" | |
1647 | "Segment Routing Local Block label range\n" | |
1648 | "The lower bound of the local block\n" | |
1649 | "The upper bound of the local block (block size may not exceed 65535)\n") | |
8f6c8936 | 1650 | { |
01d43141 EDP |
1651 | nb_cli_enqueue_change(vty, |
1652 | "./segment-routing/label-blocks/srgb/lower-bound", | |
1653 | NB_OP_MODIFY, NULL); | |
1654 | nb_cli_enqueue_change(vty, | |
1655 | "./segment-routing/label-blocks/srgb/upper-bound", | |
1656 | NB_OP_MODIFY, NULL); | |
1657 | nb_cli_enqueue_change(vty, | |
1658 | "./segment-routing/label-blocks/srlb/lower-bound", | |
8f6c8936 | 1659 | NB_OP_MODIFY, NULL); |
01d43141 EDP |
1660 | nb_cli_enqueue_change(vty, |
1661 | "./segment-routing/label-blocks/srlb/upper-bound", | |
8f6c8936 RW |
1662 | NB_OP_MODIFY, NULL); |
1663 | ||
1664 | return nb_cli_apply_changes(vty, NULL); | |
1665 | } | |
1666 | ||
25605051 | 1667 | void cli_show_isis_label_blocks(struct vty *vty, const struct lyd_node *dnode, |
01d43141 | 1668 | bool show_defaults) |
8f6c8936 | 1669 | { |
01d43141 EDP |
1670 | vty_out(vty, " segment-routing global-block %s %s", |
1671 | yang_dnode_get_string(dnode, "./srgb/lower-bound"), | |
1672 | yang_dnode_get_string(dnode, "./srgb/upper-bound")); | |
1673 | if (!yang_dnode_is_default(dnode, "./srlb/lower-bound") | |
1674 | || !yang_dnode_is_default(dnode, "./srlb/upper-bound")) | |
1675 | vty_out(vty, " local-block %s %s", | |
1676 | yang_dnode_get_string(dnode, "./srlb/lower-bound"), | |
1677 | yang_dnode_get_string(dnode, "./srlb/upper-bound")); | |
1678 | vty_out(vty, "\n"); | |
8f6c8936 RW |
1679 | } |
1680 | ||
1681 | /* | |
1682 | * XPath: /frr-isisd:isis/instance/segment-routing/msd/node-msd | |
1683 | */ | |
ca77b518 | 1684 | DEFPY_YANG (isis_sr_node_msd, |
8f6c8936 RW |
1685 | isis_sr_node_msd_cmd, |
1686 | "segment-routing node-msd (1-16)$msd", | |
1687 | SR_STR | |
1688 | "Maximum Stack Depth for this router\n" | |
1689 | "Maximum number of label that can be stack (1-16)\n") | |
1690 | { | |
1691 | nb_cli_enqueue_change(vty, "./segment-routing/msd/node-msd", | |
1692 | NB_OP_MODIFY, msd_str); | |
1693 | ||
1694 | return nb_cli_apply_changes(vty, NULL); | |
1695 | } | |
1696 | ||
ca77b518 | 1697 | DEFPY_YANG (no_isis_sr_node_msd, |
8f6c8936 RW |
1698 | no_isis_sr_node_msd_cmd, |
1699 | "no segment-routing node-msd [(1-16)]", | |
1700 | NO_STR | |
1701 | SR_STR | |
1702 | "Maximum Stack Depth for this router\n" | |
1703 | "Maximum number of label that can be stack (1-16)\n") | |
1704 | { | |
1705 | nb_cli_enqueue_change(vty, "./segment-routing/msd/node-msd", | |
1706 | NB_OP_DESTROY, NULL); | |
1707 | ||
1708 | return nb_cli_apply_changes(vty, NULL); | |
1709 | } | |
1710 | ||
25605051 | 1711 | void cli_show_isis_node_msd(struct vty *vty, const struct lyd_node *dnode, |
8f6c8936 RW |
1712 | bool show_defaults) |
1713 | { | |
1714 | vty_out(vty, " segment-routing node-msd %s\n", | |
1715 | yang_dnode_get_string(dnode, NULL)); | |
1716 | } | |
1717 | ||
1718 | /* | |
1719 | * XPath: /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid | |
1720 | */ | |
ca77b518 | 1721 | DEFPY_YANG (isis_sr_prefix_sid, |
8f6c8936 RW |
1722 | isis_sr_prefix_sid_cmd, |
1723 | "segment-routing prefix\ | |
1724 | <A.B.C.D/M|X:X::X:X/M>$prefix\ | |
26f6acaf | 1725 | <absolute$sid_type (16-1048575)$sid_value|index$sid_type (0-65535)$sid_value>\ |
01983712 | 1726 | [<no-php-flag|explicit-null>$lh_behavior] [n-flag-clear$n_flag_clear]", |
8f6c8936 RW |
1727 | SR_STR |
1728 | "Prefix SID\n" | |
1729 | "IPv4 Prefix\n" | |
1730 | "IPv6 Prefix\n" | |
02c671af | 1731 | "Specify the absolute value of Prefix Segment ID\n" |
8f6c8936 | 1732 | "The Prefix Segment ID value\n" |
02c671af | 1733 | "Specify the index of Prefix Segment ID\n" |
8f6c8936 RW |
1734 | "The Prefix Segment ID index\n" |
1735 | "Don't request Penultimate Hop Popping (PHP)\n" | |
01983712 RW |
1736 | "Upstream neighbor must replace prefix-sid with explicit null label\n" |
1737 | "Not a node SID\n") | |
8f6c8936 RW |
1738 | { |
1739 | nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); | |
1740 | nb_cli_enqueue_change(vty, "./sid-value-type", NB_OP_MODIFY, sid_type); | |
1741 | nb_cli_enqueue_change(vty, "./sid-value", NB_OP_MODIFY, sid_value_str); | |
1742 | if (lh_behavior) { | |
1743 | const char *value; | |
1744 | ||
1745 | if (strmatch(lh_behavior, "no-php-flag")) | |
1746 | value = "no-php"; | |
4c94922c | 1747 | else if (strmatch(lh_behavior, "explicit-null")) |
8f6c8936 | 1748 | value = "explicit-null"; |
4c94922c LS |
1749 | else |
1750 | value = "php"; | |
8f6c8936 RW |
1751 | |
1752 | nb_cli_enqueue_change(vty, "./last-hop-behavior", NB_OP_MODIFY, | |
1753 | value); | |
1754 | } else | |
1755 | nb_cli_enqueue_change(vty, "./last-hop-behavior", NB_OP_MODIFY, | |
1756 | NULL); | |
01983712 RW |
1757 | nb_cli_enqueue_change(vty, "./n-flag-clear", NB_OP_MODIFY, |
1758 | n_flag_clear ? "true" : "false"); | |
8f6c8936 RW |
1759 | |
1760 | return nb_cli_apply_changes( | |
1761 | vty, "./segment-routing/prefix-sid-map/prefix-sid[prefix='%s']", | |
1762 | prefix_str); | |
1763 | } | |
1764 | ||
ca77b518 | 1765 | DEFPY_YANG (no_isis_sr_prefix_sid, |
8f6c8936 RW |
1766 | no_isis_sr_prefix_sid_cmd, |
1767 | "no segment-routing prefix <A.B.C.D/M|X:X::X:X/M>$prefix\ | |
01983712 RW |
1768 | [<absolute$sid_type (16-1048575)|index (0-65535)> [<no-php-flag|explicit-null>]]\ |
1769 | [n-flag-clear]", | |
8f6c8936 RW |
1770 | NO_STR |
1771 | SR_STR | |
1772 | "Prefix SID\n" | |
1773 | "IPv4 Prefix\n" | |
1774 | "IPv6 Prefix\n" | |
02c671af | 1775 | "Specify the absolute value of Prefix Segment ID\n" |
8f6c8936 | 1776 | "The Prefix Segment ID value\n" |
02c671af | 1777 | "Specify the index of Prefix Segment ID\n" |
8f6c8936 RW |
1778 | "The Prefix Segment ID index\n" |
1779 | "Don't request Penultimate Hop Popping (PHP)\n" | |
01983712 RW |
1780 | "Upstream neighbor must replace prefix-sid with explicit null label\n" |
1781 | "Not a node SID\n") | |
8f6c8936 RW |
1782 | { |
1783 | nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); | |
1784 | ||
1785 | return nb_cli_apply_changes( | |
1786 | vty, "./segment-routing/prefix-sid-map/prefix-sid[prefix='%s']", | |
1787 | prefix_str); | |
1788 | } | |
1789 | ||
25605051 | 1790 | void cli_show_isis_prefix_sid(struct vty *vty, const struct lyd_node *dnode, |
8f6c8936 RW |
1791 | bool show_defaults) |
1792 | { | |
1793 | const char *prefix; | |
1794 | const char *lh_behavior; | |
1795 | const char *sid_value_type; | |
1796 | const char *sid_value; | |
01983712 | 1797 | bool n_flag_clear; |
8f6c8936 RW |
1798 | |
1799 | prefix = yang_dnode_get_string(dnode, "./prefix"); | |
1800 | lh_behavior = yang_dnode_get_string(dnode, "./last-hop-behavior"); | |
1801 | sid_value_type = yang_dnode_get_string(dnode, "./sid-value-type"); | |
1802 | sid_value = yang_dnode_get_string(dnode, "./sid-value"); | |
01983712 | 1803 | n_flag_clear = yang_dnode_get_bool(dnode, "./n-flag-clear"); |
8f6c8936 RW |
1804 | |
1805 | vty_out(vty, " segment-routing prefix %s", prefix); | |
1806 | if (strmatch(sid_value_type, "absolute")) | |
1807 | vty_out(vty, " absolute"); | |
1808 | else | |
1809 | vty_out(vty, " index"); | |
1810 | vty_out(vty, " %s", sid_value); | |
1811 | if (strmatch(lh_behavior, "no-php")) | |
1812 | vty_out(vty, " no-php-flag"); | |
1813 | else if (strmatch(lh_behavior, "explicit-null")) | |
1814 | vty_out(vty, " explicit-null"); | |
01983712 RW |
1815 | if (n_flag_clear) |
1816 | vty_out(vty, " n-flag-clear"); | |
8f6c8936 RW |
1817 | vty_out(vty, "\n"); |
1818 | } | |
1819 | ||
67409447 | 1820 | #ifndef FABRICD |
cc4926c1 HS |
1821 | /* |
1822 | * XPath: | |
1823 | * /frr-isisd:isis/instance/segment-routing/algorithm-prefix-sids/algorithm-prefix-sid | |
1824 | */ | |
67409447 HS |
1825 | DEFPY_YANG( |
1826 | isis_sr_prefix_sid_algorithm, isis_sr_prefix_sid_algorithm_cmd, | |
1827 | "segment-routing prefix <A.B.C.D/M|X:X::X:X/M>$prefix\ | |
1828 | algorithm (128-255)$algorithm\ | |
1829 | <absolute$sid_type (16-1048575)$sid_value|index$sid_type (0-65535)$sid_value>\ | |
1830 | [<no-php-flag|explicit-null>$lh_behavior] [n-flag-clear$n_flag_clear]", | |
1831 | SR_STR | |
1832 | "Prefix SID\n" | |
1833 | "IPv4 Prefix\n" | |
1834 | "IPv6 Prefix\n" | |
1835 | "Algorithm Specific Prefix SID Configuration\n" | |
1836 | "Algorithm number\n" | |
1837 | "Specify the absolute value of Prefix Segment ID\n" | |
1838 | "The Prefix Segment ID value\n" | |
1839 | "Specify the index of Prefix Segment ID\n" | |
1840 | "The Prefix Segment ID index\n" | |
1841 | "Don't request Penultimate Hop Popping (PHP)\n" | |
1842 | "Upstream neighbor must replace prefix-sid with explicit null label\n" | |
1843 | "Not a node SID\n") | |
1844 | { | |
1845 | nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); | |
1846 | nb_cli_enqueue_change(vty, "./sid-value-type", NB_OP_MODIFY, sid_type); | |
1847 | nb_cli_enqueue_change(vty, "./sid-value", NB_OP_MODIFY, sid_value_str); | |
1848 | if (lh_behavior) { | |
1849 | const char *value; | |
1850 | ||
1851 | if (strmatch(lh_behavior, "no-php-flag")) | |
1852 | value = "no-php"; | |
1853 | else if (strmatch(lh_behavior, "explicit-null")) | |
1854 | value = "explicit-null"; | |
1855 | else | |
1856 | value = "php"; | |
1857 | ||
1858 | nb_cli_enqueue_change(vty, "./last-hop-behavior", NB_OP_MODIFY, | |
1859 | value); | |
1860 | } else | |
1861 | nb_cli_enqueue_change(vty, "./last-hop-behavior", NB_OP_MODIFY, | |
1862 | NULL); | |
1863 | nb_cli_enqueue_change(vty, "./n-flag-clear", NB_OP_MODIFY, | |
1864 | n_flag_clear ? "true" : "false"); | |
1865 | ||
1866 | return nb_cli_apply_changes( | |
1867 | vty, | |
1868 | "./segment-routing/algorithm-prefix-sids/algorithm-prefix-sid[prefix='%s'][algo='%s']", | |
1869 | prefix_str, algorithm_str); | |
1870 | } | |
1871 | ||
1872 | DEFPY_YANG( | |
1873 | no_isis_sr_prefix_algorithm_sid, no_isis_sr_prefix_sid_algorithm_cmd, | |
1874 | "no segment-routing prefix <A.B.C.D/M|X:X::X:X/M>$prefix\ | |
1875 | algorithm (128-255)$algorithm\ | |
1876 | [<absolute$sid_type (16-1048575)|index (0-65535)> [<no-php-flag|explicit-null>]]\ | |
1877 | [n-flag-clear]", | |
1878 | NO_STR SR_STR | |
1879 | "Prefix SID\n" | |
1880 | "IPv4 Prefix\n" | |
1881 | "IPv6 Prefix\n" | |
1882 | "Algorithm Specific Prefix SID Configuration\n" | |
1883 | "Algorithm number\n" | |
1884 | "Specify the absolute value of Prefix Segment ID\n" | |
1885 | "The Prefix Segment ID value\n" | |
1886 | "Specify the index of Prefix Segment ID\n" | |
1887 | "The Prefix Segment ID index\n" | |
1888 | "Don't request Penultimate Hop Popping (PHP)\n" | |
1889 | "Upstream neighbor must replace prefix-sid with explicit null label\n" | |
1890 | "Not a node SID\n") | |
1891 | { | |
1892 | nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); | |
1893 | ||
1894 | return nb_cli_apply_changes( | |
1895 | vty, | |
1896 | "./segment-routing/algorithm-prefix-sids/algorithm-prefix-sid[prefix='%s'][algo='%s']", | |
1897 | prefix_str, algorithm_str); | |
1898 | return CMD_SUCCESS; | |
1899 | } | |
1900 | #endif /* ifndef FABRICD */ | |
1901 | ||
cc4926c1 HS |
1902 | void cli_show_isis_prefix_sid_algorithm(struct vty *vty, |
1903 | const struct lyd_node *dnode, | |
1904 | bool show_defaults) | |
1905 | { | |
1906 | const char *prefix; | |
1907 | const char *lh_behavior; | |
1908 | const char *sid_value_type; | |
1909 | const char *sid_value; | |
1910 | bool n_flag_clear; | |
1911 | uint32_t algorithm; | |
1912 | ||
1913 | prefix = yang_dnode_get_string(dnode, "./prefix"); | |
1914 | sid_value_type = yang_dnode_get_string(dnode, "./sid-value-type"); | |
1915 | sid_value = yang_dnode_get_string(dnode, "./sid-value"); | |
1916 | algorithm = yang_dnode_get_uint32(dnode, "./algo"); | |
1917 | lh_behavior = yang_dnode_get_string(dnode, "./last-hop-behavior"); | |
1918 | n_flag_clear = yang_dnode_get_bool(dnode, "./n-flag-clear"); | |
1919 | ||
1920 | vty_out(vty, " segment-routing prefix %s", prefix); | |
1921 | vty_out(vty, " algorithm %u", algorithm); | |
1922 | if (strmatch(sid_value_type, "absolute")) | |
1923 | vty_out(vty, " absolute"); | |
1924 | else | |
1925 | vty_out(vty, " index"); | |
1926 | vty_out(vty, " %s", sid_value); | |
1927 | ||
1928 | if (strmatch(lh_behavior, "no-php")) | |
1929 | vty_out(vty, " no-php-flag"); | |
1930 | else if (strmatch(lh_behavior, "explicit-null")) | |
1931 | vty_out(vty, " explicit-null"); | |
1932 | if (n_flag_clear) | |
1933 | vty_out(vty, " n-flag-clear"); | |
1934 | vty_out(vty, "\n"); | |
1935 | } | |
d20b14bc RW |
1936 | |
1937 | /* | |
1938 | * XPath: /frr-isisd:isis/instance/fast-reroute/level-{1,2}/lfa/priority-limit | |
1939 | */ | |
1940 | DEFPY_YANG (isis_frr_lfa_priority_limit, | |
1941 | isis_frr_lfa_priority_limit_cmd, | |
1942 | "[no] fast-reroute priority-limit <critical|high|medium>$priority [<level-1|level-2>$level]", | |
1943 | NO_STR | |
1944 | "Configure Fast ReRoute\n" | |
1945 | "Limit backup computation up to the prefix priority\n" | |
1946 | "Compute for critical priority prefixes only\n" | |
1947 | "Compute for critical & high priority prefixes\n" | |
1948 | "Compute for critical, high & medium priority prefixes\n" | |
1949 | "Set priority-limit for level-1 only\n" | |
1950 | "Set priority-limit for level-2 only\n") | |
1951 | { | |
1952 | if (!level || strmatch(level, "level-1")) { | |
1953 | if (no) { | |
1954 | nb_cli_enqueue_change( | |
1955 | vty, | |
1956 | "./fast-reroute/level-1/lfa/priority-limit", | |
1957 | NB_OP_DESTROY, NULL); | |
1958 | } else { | |
1959 | nb_cli_enqueue_change( | |
1960 | vty, | |
1961 | "./fast-reroute/level-1/lfa/priority-limit", | |
1962 | NB_OP_CREATE, priority); | |
1963 | } | |
1964 | } | |
1965 | if (!level || strmatch(level, "level-2")) { | |
1966 | if (no) { | |
1967 | nb_cli_enqueue_change( | |
1968 | vty, | |
1969 | "./fast-reroute/level-2/lfa/priority-limit", | |
1970 | NB_OP_DESTROY, NULL); | |
1971 | } else { | |
1972 | nb_cli_enqueue_change( | |
1973 | vty, | |
1974 | "./fast-reroute/level-2/lfa/priority-limit", | |
1975 | NB_OP_CREATE, priority); | |
1976 | } | |
1977 | } | |
1978 | ||
1979 | return nb_cli_apply_changes(vty, NULL); | |
1980 | } | |
1981 | ||
1982 | void cli_show_isis_frr_lfa_priority_limit(struct vty *vty, | |
25605051 | 1983 | const struct lyd_node *dnode, |
d20b14bc RW |
1984 | bool show_defaults) |
1985 | { | |
1986 | vty_out(vty, " fast-reroute priority-limit %s %s\n", | |
1987 | yang_dnode_get_string(dnode, NULL), | |
1988 | dnode->parent->parent->schema->name); | |
1989 | } | |
1990 | ||
1991 | /* | |
1992 | * XPath: /frr-isisd:isis/instance/fast-reroute/level-{1,2}/lfa/tiebreaker | |
1993 | */ | |
1994 | DEFPY_YANG (isis_frr_lfa_tiebreaker, | |
1995 | isis_frr_lfa_tiebreaker_cmd, | |
1996 | "[no] fast-reroute lfa\ | |
1997 | tiebreaker <downstream|lowest-backup-metric|node-protecting>$type\ | |
1998 | index (1-255)$index\ | |
1999 | [<level-1|level-2>$level]", | |
2000 | NO_STR | |
2001 | "Configure Fast ReRoute\n" | |
2002 | "LFA configuration\n" | |
2003 | "Configure tiebreaker for multiple backups\n" | |
2004 | "Prefer backup path via downstream node\n" | |
2005 | "Prefer backup path with lowest total metric\n" | |
2006 | "Prefer node protecting backup path\n" | |
2007 | "Set preference order among tiebreakers\n" | |
2008 | "Index\n" | |
2009 | "Configure tiebreaker for level-1 only\n" | |
2010 | "Configure tiebreaker for level-2 only\n") | |
2011 | { | |
2012 | char xpath[XPATH_MAXLEN]; | |
2013 | ||
2014 | if (!level || strmatch(level, "level-1")) { | |
2015 | if (no) { | |
2016 | snprintf( | |
2017 | xpath, XPATH_MAXLEN, | |
2018 | "./fast-reroute/level-1/lfa/tiebreaker[index='%s']", | |
2019 | index_str); | |
2020 | nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL); | |
2021 | } else { | |
2022 | snprintf( | |
2023 | xpath, XPATH_MAXLEN, | |
2024 | "./fast-reroute/level-1/lfa/tiebreaker[index='%s']/type", | |
2025 | index_str); | |
2026 | nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, type); | |
2027 | } | |
2028 | } | |
2029 | if (!level || strmatch(level, "level-2")) { | |
2030 | if (no) { | |
2031 | snprintf( | |
2032 | xpath, XPATH_MAXLEN, | |
2033 | "./fast-reroute/level-2/lfa/tiebreaker[index='%s']", | |
2034 | index_str); | |
2035 | nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL); | |
2036 | } else { | |
2037 | snprintf( | |
2038 | xpath, XPATH_MAXLEN, | |
2039 | "./fast-reroute/level-2/lfa/tiebreaker[index='%s']/type", | |
2040 | index_str); | |
2041 | nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, type); | |
2042 | } | |
2043 | } | |
2044 | ||
2045 | return nb_cli_apply_changes(vty, NULL); | |
2046 | } | |
2047 | ||
25605051 IR |
2048 | void cli_show_isis_frr_lfa_tiebreaker(struct vty *vty, |
2049 | const struct lyd_node *dnode, | |
d20b14bc RW |
2050 | bool show_defaults) |
2051 | { | |
2052 | vty_out(vty, " fast-reroute lfa tiebreaker %s index %s %s\n", | |
2053 | yang_dnode_get_string(dnode, "./type"), | |
2054 | yang_dnode_get_string(dnode, "./index"), | |
2055 | dnode->parent->parent->schema->name); | |
2056 | } | |
2057 | ||
2058 | /* | |
2059 | * XPath: /frr-isisd:isis/instance/fast-reroute/level-{1,2}/lfa/load-sharing | |
2060 | */ | |
2061 | DEFPY_YANG (isis_frr_lfa_load_sharing, | |
2062 | isis_frr_lfa_load_sharing_cmd, | |
2063 | "[no] fast-reroute load-sharing disable [<level-1|level-2>$level]", | |
2064 | NO_STR | |
2065 | "Configure Fast ReRoute\n" | |
2066 | "Load share prefixes across multiple backups\n" | |
2067 | "Disable load sharing\n" | |
2068 | "Disable load sharing for level-1 only\n" | |
2069 | "Disable load sharing for level-2 only\n") | |
2070 | { | |
2071 | if (!level || strmatch(level, "level-1")) { | |
2072 | if (no) { | |
2073 | nb_cli_enqueue_change( | |
2074 | vty, "./fast-reroute/level-1/lfa/load-sharing", | |
7ab5ca10 | 2075 | NB_OP_MODIFY, "true"); |
d20b14bc RW |
2076 | } else { |
2077 | nb_cli_enqueue_change( | |
2078 | vty, "./fast-reroute/level-1/lfa/load-sharing", | |
7ab5ca10 | 2079 | NB_OP_MODIFY, "false"); |
d20b14bc RW |
2080 | } |
2081 | } | |
2082 | if (!level || strmatch(level, "level-2")) { | |
2083 | if (no) { | |
2084 | nb_cli_enqueue_change( | |
2085 | vty, "./fast-reroute/level-2/lfa/load-sharing", | |
7ab5ca10 | 2086 | NB_OP_MODIFY, "true"); |
d20b14bc RW |
2087 | } else { |
2088 | nb_cli_enqueue_change( | |
2089 | vty, "./fast-reroute/level-2/lfa/load-sharing", | |
7ab5ca10 | 2090 | NB_OP_MODIFY, "false"); |
d20b14bc RW |
2091 | } |
2092 | } | |
2093 | ||
2094 | return nb_cli_apply_changes(vty, NULL); | |
2095 | } | |
2096 | ||
25605051 IR |
2097 | void cli_show_isis_frr_lfa_load_sharing(struct vty *vty, |
2098 | const struct lyd_node *dnode, | |
d20b14bc RW |
2099 | bool show_defaults) |
2100 | { | |
32931e1a | 2101 | if (yang_dnode_get_bool(dnode, NULL)) |
d20b14bc RW |
2102 | vty_out(vty, " no"); |
2103 | ||
2104 | vty_out(vty, " fast-reroute load-sharing disable %s\n", | |
2105 | dnode->parent->parent->schema->name); | |
2106 | } | |
2107 | ||
381200be RW |
2108 | /* |
2109 | * XPath: /frr-isisd:isis/instance/fast-reroute/level-{1,2}/remote-lfa/prefix-list | |
2110 | */ | |
2111 | DEFPY_YANG (isis_frr_remote_lfa_plist, | |
2112 | isis_frr_remote_lfa_plist_cmd, | |
2113 | "fast-reroute remote-lfa prefix-list WORD$plist [<level-1|level-2>$level]", | |
2114 | "Configure Fast ReRoute\n" | |
2115 | "Enable remote LFA related configuration\n" | |
2116 | "Filter PQ node router ID based on prefix list\n" | |
2117 | "Prefix-list name\n" | |
2118 | "Enable router ID filtering for level-1 only\n" | |
2119 | "Enable router ID filtering for level-2 only\n") | |
2120 | { | |
2121 | if (!level || strmatch(level, "level-1")) | |
2122 | nb_cli_enqueue_change( | |
2123 | vty, "./fast-reroute/level-1/remote-lfa/prefix-list", | |
2124 | NB_OP_MODIFY, plist); | |
2125 | if (!level || strmatch(level, "level-2")) | |
2126 | nb_cli_enqueue_change( | |
2127 | vty, "./fast-reroute/level-2/remote-lfa/prefix-list", | |
2128 | NB_OP_MODIFY, plist); | |
2129 | ||
2130 | return nb_cli_apply_changes(vty, NULL); | |
2131 | } | |
2132 | ||
2133 | DEFPY_YANG (no_isis_frr_remote_lfa_plist, | |
2134 | no_isis_frr_remote_lfa_plist_cmd, | |
2135 | "no fast-reroute remote-lfa prefix-list [WORD] [<level-1|level-2>$level]", | |
2136 | NO_STR | |
2137 | "Configure Fast ReRoute\n" | |
2138 | "Enable remote LFA related configuration\n" | |
2139 | "Filter PQ node router ID based on prefix list\n" | |
2140 | "Prefix-list name\n" | |
2141 | "Enable router ID filtering for level-1 only\n" | |
2142 | "Enable router ID filtering for level-2 only\n") | |
2143 | { | |
2144 | if (!level || strmatch(level, "level-1")) | |
2145 | nb_cli_enqueue_change( | |
2146 | vty, "./fast-reroute/level-1/remote-lfa/prefix-list", | |
2147 | NB_OP_DESTROY, NULL); | |
2148 | if (!level || strmatch(level, "level-2")) | |
2149 | nb_cli_enqueue_change( | |
2150 | vty, "./fast-reroute/level-2/remote-lfa/prefix-list", | |
2151 | NB_OP_DESTROY, NULL); | |
2152 | ||
2153 | return nb_cli_apply_changes(vty, NULL); | |
2154 | } | |
2155 | ||
25605051 IR |
2156 | void cli_show_isis_frr_remote_lfa_plist(struct vty *vty, |
2157 | const struct lyd_node *dnode, | |
381200be RW |
2158 | bool show_defaults) |
2159 | { | |
2160 | vty_out(vty, " fast-reroute remote-lfa prefix-list %s %s\n", | |
2161 | yang_dnode_get_string(dnode, NULL), | |
2162 | dnode->parent->parent->schema->name); | |
2163 | } | |
2164 | ||
a6a36c41 EDP |
2165 | /* |
2166 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/passive | |
2167 | */ | |
ca77b518 | 2168 | DEFPY_YANG(isis_passive, isis_passive_cmd, "[no] isis passive", |
a6a36c41 EDP |
2169 | NO_STR |
2170 | "IS-IS routing protocol\n" | |
2171 | "Configure the passive mode for interface\n") | |
2172 | { | |
5f1e5e3f EDP |
2173 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive", NB_OP_MODIFY, |
2174 | no ? "false" : "true"); | |
a6a36c41 EDP |
2175 | |
2176 | return nb_cli_apply_changes(vty, NULL); | |
2177 | } | |
2178 | ||
25605051 | 2179 | void cli_show_ip_isis_passive(struct vty *vty, const struct lyd_node *dnode, |
a6a36c41 EDP |
2180 | bool show_defaults) |
2181 | { | |
5f1e5e3f EDP |
2182 | if (!yang_dnode_get_bool(dnode, NULL)) |
2183 | vty_out(vty, " no"); | |
a6a36c41 EDP |
2184 | vty_out(vty, " isis passive\n"); |
2185 | } | |
2186 | ||
3e20c83a EDP |
2187 | /* |
2188 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/password | |
2189 | */ | |
2190 | ||
ca77b518 | 2191 | DEFPY_YANG(isis_passwd, isis_passwd_cmd, "isis password <md5|clear>$type WORD$pwd", |
3e20c83a EDP |
2192 | "IS-IS routing protocol\n" |
2193 | "Configure the authentication password for a circuit\n" | |
2194 | "HMAC-MD5 authentication\n" | |
2195 | "Cleartext password\n" | |
2196 | "Circuit password\n") | |
2197 | { | |
2198 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/password", NB_OP_CREATE, | |
2199 | NULL); | |
2200 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/password/password", | |
2201 | NB_OP_MODIFY, pwd); | |
2202 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/password/password-type", | |
2203 | NB_OP_MODIFY, type); | |
2204 | ||
2205 | return nb_cli_apply_changes(vty, NULL); | |
2206 | } | |
2207 | ||
ca77b518 | 2208 | DEFPY_YANG(no_isis_passwd, no_isis_passwd_cmd, "no isis password [<md5|clear> WORD]", |
3e20c83a EDP |
2209 | NO_STR |
2210 | "IS-IS routing protocol\n" | |
2211 | "Configure the authentication password for a circuit\n" | |
2212 | "HMAC-MD5 authentication\n" | |
2213 | "Cleartext password\n" | |
2214 | "Circuit password\n") | |
2215 | { | |
95ce849b | 2216 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/password", NB_OP_DESTROY, |
3e20c83a EDP |
2217 | NULL); |
2218 | ||
2219 | return nb_cli_apply_changes(vty, NULL); | |
2220 | } | |
2221 | ||
25605051 | 2222 | void cli_show_ip_isis_password(struct vty *vty, const struct lyd_node *dnode, |
3e20c83a EDP |
2223 | bool show_defaults) |
2224 | { | |
2225 | vty_out(vty, " isis password %s %s\n", | |
2226 | yang_dnode_get_string(dnode, "./password-type"), | |
2227 | yang_dnode_get_string(dnode, "./password")); | |
2228 | } | |
2229 | ||
be49219c EDP |
2230 | /* |
2231 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/metric | |
2232 | */ | |
ca77b518 | 2233 | DEFPY_YANG(isis_metric, isis_metric_cmd, |
be49219c EDP |
2234 | "isis metric [level-1|level-2]$level (0-16777215)$met", |
2235 | "IS-IS routing protocol\n" | |
2236 | "Set default metric for circuit\n" | |
2237 | "Specify metric for level-1 routing\n" | |
2238 | "Specify metric for level-2 routing\n" | |
2239 | "Default metric value\n") | |
2240 | { | |
2241 | if (!level || strmatch(level, "level-1")) | |
2242 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/metric/level-1", | |
2243 | NB_OP_MODIFY, met_str); | |
2244 | if (!level || strmatch(level, "level-2")) | |
2245 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/metric/level-2", | |
2246 | NB_OP_MODIFY, met_str); | |
2247 | ||
2248 | return nb_cli_apply_changes(vty, NULL); | |
2249 | } | |
2250 | ||
ca77b518 | 2251 | DEFPY_YANG(no_isis_metric, no_isis_metric_cmd, |
be49219c EDP |
2252 | "no isis metric [level-1|level-2]$level [(0-16777215)]", |
2253 | NO_STR | |
2254 | "IS-IS routing protocol\n" | |
2255 | "Set default metric for circuit\n" | |
2256 | "Specify metric for level-1 routing\n" | |
2257 | "Specify metric for level-2 routing\n" | |
2258 | "Default metric value\n") | |
2259 | { | |
2260 | if (!level || strmatch(level, "level-1")) | |
2261 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/metric/level-1", | |
2262 | NB_OP_MODIFY, NULL); | |
2263 | if (!level || strmatch(level, "level-2")) | |
2264 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/metric/level-2", | |
2265 | NB_OP_MODIFY, NULL); | |
2266 | ||
2267 | return nb_cli_apply_changes(vty, NULL); | |
2268 | } | |
2269 | ||
25605051 | 2270 | void cli_show_ip_isis_metric(struct vty *vty, const struct lyd_node *dnode, |
be49219c EDP |
2271 | bool show_defaults) |
2272 | { | |
2273 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
2274 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
2275 | ||
2276 | if (strmatch(l1, l2)) | |
2277 | vty_out(vty, " isis metric %s\n", l1); | |
2278 | else { | |
d32a4cac EDP |
2279 | vty_out(vty, " isis metric level-1 %s\n", l1); |
2280 | vty_out(vty, " isis metric level-2 %s\n", l2); | |
be49219c EDP |
2281 | } |
2282 | } | |
2283 | ||
356a2e3c EDP |
2284 | /* |
2285 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/interval | |
2286 | */ | |
ca77b518 | 2287 | DEFPY_YANG(isis_hello_interval, isis_hello_interval_cmd, |
356a2e3c EDP |
2288 | "isis hello-interval [level-1|level-2]$level (1-600)$intv", |
2289 | "IS-IS routing protocol\n" | |
2290 | "Set Hello interval\n" | |
2291 | "Specify hello-interval for level-1 IIHs\n" | |
2292 | "Specify hello-interval for level-2 IIHs\n" | |
2293 | "Holdtime 1 seconds, interval depends on multiplier\n") | |
2294 | { | |
2295 | if (!level || strmatch(level, "level-1")) | |
2296 | nb_cli_enqueue_change(vty, | |
2297 | "./frr-isisd:isis/hello/interval/level-1", | |
2298 | NB_OP_MODIFY, intv_str); | |
2299 | if (!level || strmatch(level, "level-2")) | |
2300 | nb_cli_enqueue_change(vty, | |
2301 | "./frr-isisd:isis/hello/interval/level-2", | |
2302 | NB_OP_MODIFY, intv_str); | |
2303 | ||
2304 | return nb_cli_apply_changes(vty, NULL); | |
2305 | } | |
2306 | ||
ca77b518 | 2307 | DEFPY_YANG(no_isis_hello_interval, no_isis_hello_interval_cmd, |
356a2e3c EDP |
2308 | "no isis hello-interval [level-1|level-2]$level [(1-600)]", |
2309 | NO_STR | |
2310 | "IS-IS routing protocol\n" | |
2311 | "Set Hello interval\n" | |
2312 | "Specify hello-interval for level-1 IIHs\n" | |
2313 | "Specify hello-interval for level-2 IIHs\n" | |
2314 | "Holdtime 1 second, interval depends on multiplier\n") | |
2315 | { | |
2316 | if (!level || strmatch(level, "level-1")) | |
2317 | nb_cli_enqueue_change(vty, | |
2318 | "./frr-isisd:isis/hello/interval/level-1", | |
2319 | NB_OP_MODIFY, NULL); | |
2320 | if (!level || strmatch(level, "level-2")) | |
2321 | nb_cli_enqueue_change(vty, | |
2322 | "./frr-isisd:isis/hello/interval/level-2", | |
2323 | NB_OP_MODIFY, NULL); | |
2324 | ||
2325 | return nb_cli_apply_changes(vty, NULL); | |
2326 | } | |
2327 | ||
25605051 IR |
2328 | void cli_show_ip_isis_hello_interval(struct vty *vty, |
2329 | const struct lyd_node *dnode, | |
356a2e3c EDP |
2330 | bool show_defaults) |
2331 | { | |
2332 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
2333 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
2334 | ||
2335 | if (strmatch(l1, l2)) | |
2336 | vty_out(vty, " isis hello-interval %s\n", l1); | |
2337 | else { | |
249312ab EDP |
2338 | vty_out(vty, " isis hello-interval level-1 %s\n", l1); |
2339 | vty_out(vty, " isis hello-interval level-2 %s\n", l2); | |
356a2e3c EDP |
2340 | } |
2341 | } | |
2342 | ||
4e75a67d EDP |
2343 | /* |
2344 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/multiplier | |
2345 | */ | |
ca77b518 | 2346 | DEFPY_YANG(isis_hello_multiplier, isis_hello_multiplier_cmd, |
4e75a67d EDP |
2347 | "isis hello-multiplier [level-1|level-2]$level (2-100)$mult", |
2348 | "IS-IS routing protocol\n" | |
2349 | "Set multiplier for Hello holding time\n" | |
2350 | "Specify hello multiplier for level-1 IIHs\n" | |
2351 | "Specify hello multiplier for level-2 IIHs\n" | |
2352 | "Hello multiplier value\n") | |
2353 | { | |
2354 | if (!level || strmatch(level, "level-1")) | |
2355 | nb_cli_enqueue_change( | |
2356 | vty, "./frr-isisd:isis/hello/multiplier/level-1", | |
2357 | NB_OP_MODIFY, mult_str); | |
2358 | if (!level || strmatch(level, "level-2")) | |
2359 | nb_cli_enqueue_change( | |
2360 | vty, "./frr-isisd:isis/hello/multiplier/level-2", | |
2361 | NB_OP_MODIFY, mult_str); | |
2362 | ||
2363 | return nb_cli_apply_changes(vty, NULL); | |
2364 | } | |
2365 | ||
ca77b518 | 2366 | DEFPY_YANG(no_isis_hello_multiplier, no_isis_hello_multiplier_cmd, |
4e75a67d EDP |
2367 | "no isis hello-multiplier [level-1|level-2]$level [(2-100)]", |
2368 | NO_STR | |
2369 | "IS-IS routing protocol\n" | |
2370 | "Set multiplier for Hello holding time\n" | |
2371 | "Specify hello multiplier for level-1 IIHs\n" | |
2372 | "Specify hello multiplier for level-2 IIHs\n" | |
2373 | "Hello multiplier value\n") | |
2374 | { | |
2375 | if (!level || strmatch(level, "level-1")) | |
2376 | nb_cli_enqueue_change( | |
2377 | vty, "./frr-isisd:isis/hello/multiplier/level-1", | |
2378 | NB_OP_MODIFY, NULL); | |
2379 | if (!level || strmatch(level, "level-2")) | |
2380 | nb_cli_enqueue_change( | |
2381 | vty, "./frr-isisd:isis/hello/multiplier/level-2", | |
2382 | NB_OP_MODIFY, NULL); | |
2383 | ||
2384 | return nb_cli_apply_changes(vty, NULL); | |
2385 | } | |
2386 | ||
25605051 | 2387 | void cli_show_ip_isis_hello_multi(struct vty *vty, const struct lyd_node *dnode, |
4e75a67d EDP |
2388 | bool show_defaults) |
2389 | { | |
2390 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
2391 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
2392 | ||
2393 | if (strmatch(l1, l2)) | |
2394 | vty_out(vty, " isis hello-multiplier %s\n", l1); | |
2395 | else { | |
249312ab EDP |
2396 | vty_out(vty, " isis hello-multiplier level-1 %s\n", l1); |
2397 | vty_out(vty, " isis hello-multiplier level-2 %s\n", l2); | |
4e75a67d EDP |
2398 | } |
2399 | } | |
2400 | ||
5f2ce446 EDP |
2401 | /* |
2402 | * XPath: | |
2403 | * /frr-interface:lib/interface/frr-isisd:isis/disable-three-way-handshake | |
2404 | */ | |
ca77b518 | 2405 | DEFPY_YANG(isis_threeway_adj, isis_threeway_adj_cmd, "[no] isis three-way-handshake", |
5f2ce446 EDP |
2406 | NO_STR |
2407 | "IS-IS commands\n" | |
2408 | "Enable/Disable three-way handshake\n") | |
2409 | { | |
2410 | nb_cli_enqueue_change(vty, | |
2411 | "./frr-isisd:isis/disable-three-way-handshake", | |
5f1e5e3f | 2412 | NB_OP_MODIFY, no ? "true" : "false"); |
5f2ce446 EDP |
2413 | |
2414 | return nb_cli_apply_changes(vty, NULL); | |
2415 | } | |
2416 | ||
25605051 IR |
2417 | void cli_show_ip_isis_threeway_shake(struct vty *vty, |
2418 | const struct lyd_node *dnode, | |
5f2ce446 EDP |
2419 | bool show_defaults) |
2420 | { | |
5f1e5e3f EDP |
2421 | if (yang_dnode_get_bool(dnode, NULL)) |
2422 | vty_out(vty, " no"); | |
2423 | vty_out(vty, " isis three-way-handshake\n"); | |
5f2ce446 EDP |
2424 | } |
2425 | ||
7b6b75e5 EDP |
2426 | /* |
2427 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/padding | |
2428 | */ | |
e36ec6ac | 2429 | DEFPY_YANG(isis_hello_padding, isis_hello_padding_cmd, |
06fbbf29 | 2430 | "[no] isis hello padding [during-adjacency-formation]$padding_type", |
e36ec6ac DO |
2431 | NO_STR |
2432 | "IS-IS routing protocol\n" | |
2433 | "Type of padding for IS-IS hello packets\n" | |
2434 | "Pad hello packets\n" | |
2435 | "Add padding to hello packets during adjacency formation only.\n") | |
7b6b75e5 | 2436 | { |
e36ec6ac DO |
2437 | if (no) { |
2438 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/hello/padding", | |
2439 | NB_OP_MODIFY, "disabled"); | |
2440 | } else { | |
2441 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/hello/padding", | |
2442 | NB_OP_MODIFY, | |
2443 | padding_type ? padding_type : "always"); | |
2444 | } | |
7b6b75e5 EDP |
2445 | return nb_cli_apply_changes(vty, NULL); |
2446 | } | |
2447 | ||
25605051 IR |
2448 | void cli_show_ip_isis_hello_padding(struct vty *vty, |
2449 | const struct lyd_node *dnode, | |
7b6b75e5 EDP |
2450 | bool show_defaults) |
2451 | { | |
e36ec6ac DO |
2452 | int hello_padding_type = yang_dnode_get_enum(dnode, NULL); |
2453 | if (hello_padding_type == ISIS_HELLO_PADDING_DISABLED) | |
7b6b75e5 | 2454 | vty_out(vty, " no"); |
e36ec6ac | 2455 | vty_out(vty, " isis hello padding"); |
06fbbf29 DO |
2456 | if (hello_padding_type == ISIS_HELLO_PADDING_DURING_ADJACENCY_FORMATION) |
2457 | vty_out(vty, " during-adjacency-formation"); | |
e36ec6ac | 2458 | vty_out(vty, "\n"); |
7b6b75e5 EDP |
2459 | } |
2460 | ||
9ce808b9 EDP |
2461 | /* |
2462 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval | |
2463 | */ | |
ca77b518 | 2464 | DEFPY_YANG(csnp_interval, csnp_interval_cmd, |
9ce808b9 EDP |
2465 | "isis csnp-interval (1-600)$intv [level-1|level-2]$level", |
2466 | "IS-IS routing protocol\n" | |
2467 | "Set CSNP interval in seconds\n" | |
2468 | "CSNP interval value\n" | |
2469 | "Specify interval for level-1 CSNPs\n" | |
2470 | "Specify interval for level-2 CSNPs\n") | |
2471 | { | |
2472 | if (!level || strmatch(level, "level-1")) | |
2473 | nb_cli_enqueue_change(vty, | |
2474 | "./frr-isisd:isis/csnp-interval/level-1", | |
2475 | NB_OP_MODIFY, intv_str); | |
2476 | if (!level || strmatch(level, "level-2")) | |
2477 | nb_cli_enqueue_change(vty, | |
2478 | "./frr-isisd:isis/csnp-interval/level-2", | |
2479 | NB_OP_MODIFY, intv_str); | |
2480 | ||
2481 | return nb_cli_apply_changes(vty, NULL); | |
2482 | } | |
2483 | ||
ca77b518 | 2484 | DEFPY_YANG(no_csnp_interval, no_csnp_interval_cmd, |
9ce808b9 EDP |
2485 | "no isis csnp-interval [(1-600)] [level-1|level-2]$level", |
2486 | NO_STR | |
2487 | "IS-IS routing protocol\n" | |
2488 | "Set CSNP interval in seconds\n" | |
2489 | "CSNP interval value\n" | |
2490 | "Specify interval for level-1 CSNPs\n" | |
2491 | "Specify interval for level-2 CSNPs\n") | |
2492 | { | |
2493 | if (!level || strmatch(level, "level-1")) | |
2494 | nb_cli_enqueue_change(vty, | |
2495 | "./frr-isisd:isis/csnp-interval/level-1", | |
2496 | NB_OP_MODIFY, NULL); | |
2497 | if (!level || strmatch(level, "level-2")) | |
2498 | nb_cli_enqueue_change(vty, | |
2499 | "./frr-isisd:isis/csnp-interval/level-2", | |
2500 | NB_OP_MODIFY, NULL); | |
2501 | ||
2502 | return nb_cli_apply_changes(vty, NULL); | |
2503 | } | |
2504 | ||
25605051 IR |
2505 | void cli_show_ip_isis_csnp_interval(struct vty *vty, |
2506 | const struct lyd_node *dnode, | |
9ce808b9 EDP |
2507 | bool show_defaults) |
2508 | { | |
2509 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
2510 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
2511 | ||
2512 | if (strmatch(l1, l2)) | |
2513 | vty_out(vty, " isis csnp-interval %s\n", l1); | |
2514 | else { | |
2515 | vty_out(vty, " isis csnp-interval %s level-1\n", l1); | |
2516 | vty_out(vty, " isis csnp-interval %s level-2\n", l2); | |
2517 | } | |
2518 | } | |
2519 | ||
2520 | /* | |
2521 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/psnp-interval | |
2522 | */ | |
ca77b518 | 2523 | DEFPY_YANG(psnp_interval, psnp_interval_cmd, |
9ce808b9 EDP |
2524 | "isis psnp-interval (1-120)$intv [level-1|level-2]$level", |
2525 | "IS-IS routing protocol\n" | |
2526 | "Set PSNP interval in seconds\n" | |
2527 | "PSNP interval value\n" | |
2528 | "Specify interval for level-1 PSNPs\n" | |
2529 | "Specify interval for level-2 PSNPs\n") | |
2530 | { | |
2531 | if (!level || strmatch(level, "level-1")) | |
2532 | nb_cli_enqueue_change(vty, | |
2533 | "./frr-isisd:isis/psnp-interval/level-1", | |
2534 | NB_OP_MODIFY, intv_str); | |
2535 | if (!level || strmatch(level, "level-2")) | |
2536 | nb_cli_enqueue_change(vty, | |
2537 | "./frr-isisd:isis/psnp-interval/level-2", | |
2538 | NB_OP_MODIFY, intv_str); | |
2539 | ||
2540 | return nb_cli_apply_changes(vty, NULL); | |
2541 | } | |
2542 | ||
ca77b518 | 2543 | DEFPY_YANG(no_psnp_interval, no_psnp_interval_cmd, |
9ce808b9 EDP |
2544 | "no isis psnp-interval [(1-120)] [level-1|level-2]$level", |
2545 | NO_STR | |
2546 | "IS-IS routing protocol\n" | |
2547 | "Set PSNP interval in seconds\n" | |
2548 | "PSNP interval value\n" | |
2549 | "Specify interval for level-1 PSNPs\n" | |
2550 | "Specify interval for level-2 PSNPs\n") | |
2551 | { | |
2552 | if (!level || strmatch(level, "level-1")) | |
2553 | nb_cli_enqueue_change(vty, | |
2554 | "./frr-isisd:isis/psnp-interval/level-1", | |
2555 | NB_OP_MODIFY, NULL); | |
2556 | if (!level || strmatch(level, "level-2")) | |
2557 | nb_cli_enqueue_change(vty, | |
2558 | "./frr-isisd:isis/psnp-interval/level-2", | |
2559 | NB_OP_MODIFY, NULL); | |
2560 | ||
2561 | return nb_cli_apply_changes(vty, NULL); | |
2562 | } | |
2563 | ||
25605051 IR |
2564 | void cli_show_ip_isis_psnp_interval(struct vty *vty, |
2565 | const struct lyd_node *dnode, | |
9ce808b9 EDP |
2566 | bool show_defaults) |
2567 | { | |
2568 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
2569 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
2570 | ||
2571 | if (strmatch(l1, l2)) | |
2572 | vty_out(vty, " isis psnp-interval %s\n", l1); | |
2573 | else { | |
2574 | vty_out(vty, " isis psnp-interval %s level-1\n", l1); | |
2575 | vty_out(vty, " isis psnp-interval %s level-2\n", l2); | |
2576 | } | |
2577 | } | |
2578 | ||
83d043f6 EDP |
2579 | /* |
2580 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/multi-topology | |
2581 | */ | |
ca77b518 | 2582 | DEFPY_YANG(circuit_topology, circuit_topology_cmd, |
a15014f3 | 2583 | "[no] isis topology<standard|ipv4-unicast|ipv4-mgmt|ipv6-unicast|ipv4-multicast|ipv6-multicast|ipv6-mgmt|ipv6-dstsrc>$topology", |
83d043f6 EDP |
2584 | NO_STR |
2585 | "IS-IS routing protocol\n" | |
2586 | "Configure interface IS-IS topologies\n" | |
a15014f3 | 2587 | "Standard topology\n" |
83d043f6 EDP |
2588 | "IPv4 unicast topology\n" |
2589 | "IPv4 management topology\n" | |
2590 | "IPv6 unicast topology\n" | |
2591 | "IPv4 multicast topology\n" | |
2592 | "IPv6 multicast topology\n" | |
2593 | "IPv6 management topology\n" | |
2594 | "IPv6 dst-src topology\n") | |
2595 | { | |
2596 | nb_cli_enqueue_change(vty, ".", NB_OP_MODIFY, no ? "false" : "true"); | |
2597 | ||
2598 | if (strmatch(topology, "ipv4-mgmt")) | |
2599 | return nb_cli_apply_changes( | |
2600 | vty, "./frr-isisd:isis/multi-topology/ipv4-management"); | |
2601 | else if (strmatch(topology, "ipv6-mgmt")) | |
2602 | return nb_cli_apply_changes( | |
2603 | vty, "./frr-isisd:isis/multi-topology/ipv6-management"); | |
a15014f3 PG |
2604 | if (strmatch(topology, "ipv4-unicast")) |
2605 | return nb_cli_apply_changes( | |
2606 | vty, "./frr-isisd:isis/multi-topology/standard"); | |
83d043f6 EDP |
2607 | else |
2608 | return nb_cli_apply_changes( | |
2609 | vty, "./frr-isisd:isis/multi-topology/%s", topology); | |
2610 | } | |
2611 | ||
a15014f3 PG |
2612 | void cli_show_ip_isis_mt_standard(struct vty *vty, const struct lyd_node *dnode, |
2613 | bool show_defaults) | |
83d043f6 EDP |
2614 | { |
2615 | if (!yang_dnode_get_bool(dnode, NULL)) | |
2616 | vty_out(vty, " no"); | |
a15014f3 | 2617 | vty_out(vty, " isis topology standard\n"); |
83d043f6 EDP |
2618 | } |
2619 | ||
25605051 IR |
2620 | void cli_show_ip_isis_mt_ipv4_multicast(struct vty *vty, |
2621 | const struct lyd_node *dnode, | |
83d043f6 EDP |
2622 | bool show_defaults) |
2623 | { | |
2624 | if (!yang_dnode_get_bool(dnode, NULL)) | |
2625 | vty_out(vty, " no"); | |
2626 | vty_out(vty, " isis topology ipv4-multicast\n"); | |
2627 | } | |
2628 | ||
25605051 IR |
2629 | void cli_show_ip_isis_mt_ipv4_mgmt(struct vty *vty, |
2630 | const struct lyd_node *dnode, | |
83d043f6 EDP |
2631 | bool show_defaults) |
2632 | { | |
2633 | if (!yang_dnode_get_bool(dnode, NULL)) | |
2634 | vty_out(vty, " no"); | |
2635 | vty_out(vty, " isis topology ipv4-mgmt\n"); | |
2636 | } | |
2637 | ||
25605051 IR |
2638 | void cli_show_ip_isis_mt_ipv6_unicast(struct vty *vty, |
2639 | const struct lyd_node *dnode, | |
83d043f6 EDP |
2640 | bool show_defaults) |
2641 | { | |
2642 | if (!yang_dnode_get_bool(dnode, NULL)) | |
2643 | vty_out(vty, " no"); | |
2644 | vty_out(vty, " isis topology ipv6-unicast\n"); | |
2645 | } | |
2646 | ||
25605051 IR |
2647 | void cli_show_ip_isis_mt_ipv6_multicast(struct vty *vty, |
2648 | const struct lyd_node *dnode, | |
83d043f6 EDP |
2649 | bool show_defaults) |
2650 | { | |
2651 | if (!yang_dnode_get_bool(dnode, NULL)) | |
2652 | vty_out(vty, " no"); | |
2653 | vty_out(vty, " isis topology ipv6-multicast\n"); | |
2654 | } | |
2655 | ||
25605051 IR |
2656 | void cli_show_ip_isis_mt_ipv6_mgmt(struct vty *vty, |
2657 | const struct lyd_node *dnode, | |
83d043f6 EDP |
2658 | bool show_defaults) |
2659 | { | |
2660 | if (!yang_dnode_get_bool(dnode, NULL)) | |
2661 | vty_out(vty, " no"); | |
2662 | vty_out(vty, " isis topology ipv6-mgmt\n"); | |
2663 | } | |
2664 | ||
25605051 IR |
2665 | void cli_show_ip_isis_mt_ipv6_dstsrc(struct vty *vty, |
2666 | const struct lyd_node *dnode, | |
83d043f6 EDP |
2667 | bool show_defaults) |
2668 | { | |
2669 | if (!yang_dnode_get_bool(dnode, NULL)) | |
2670 | vty_out(vty, " no"); | |
2671 | vty_out(vty, " isis topology ipv6-dstsrc\n"); | |
2672 | } | |
2673 | ||
9302fbb6 EDP |
2674 | /* |
2675 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/circuit-type | |
2676 | */ | |
ca77b518 | 2677 | DEFPY_YANG(isis_circuit_type, isis_circuit_type_cmd, |
9302fbb6 EDP |
2678 | "isis circuit-type <level-1|level-1-2|level-2-only>$type", |
2679 | "IS-IS routing protocol\n" | |
2680 | "Configure circuit type for interface\n" | |
2681 | "Level-1 only adjacencies are formed\n" | |
2682 | "Level-1-2 adjacencies are formed\n" | |
2683 | "Level-2 only adjacencies are formed\n") | |
2684 | { | |
2685 | nb_cli_enqueue_change( | |
2686 | vty, "./frr-isisd:isis/circuit-type", NB_OP_MODIFY, | |
2687 | strmatch(type, "level-2-only") ? "level-2" : type); | |
2688 | ||
2689 | return nb_cli_apply_changes(vty, NULL); | |
2690 | } | |
2691 | ||
ca77b518 | 2692 | DEFPY_YANG(no_isis_circuit_type, no_isis_circuit_type_cmd, |
9302fbb6 EDP |
2693 | "no isis circuit-type [level-1|level-1-2|level-2-only]", |
2694 | NO_STR | |
2695 | "IS-IS routing protocol\n" | |
2696 | "Configure circuit type for interface\n" | |
2697 | "Level-1 only adjacencies are formed\n" | |
2698 | "Level-1-2 adjacencies are formed\n" | |
2699 | "Level-2 only adjacencies are formed\n") | |
2700 | { | |
8685be73 | 2701 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/circuit-type", |
2f9a06f0 | 2702 | NB_OP_MODIFY, NULL); |
8685be73 RW |
2703 | |
2704 | return nb_cli_apply_changes(vty, NULL); | |
9302fbb6 EDP |
2705 | } |
2706 | ||
25605051 | 2707 | void cli_show_ip_isis_circ_type(struct vty *vty, const struct lyd_node *dnode, |
9302fbb6 EDP |
2708 | bool show_defaults) |
2709 | { | |
2710 | int level = yang_dnode_get_enum(dnode, NULL); | |
2711 | ||
2712 | switch (level) { | |
2713 | case IS_LEVEL_1: | |
2714 | vty_out(vty, " isis circuit-type level-1\n"); | |
2715 | break; | |
2716 | case IS_LEVEL_2: | |
2717 | vty_out(vty, " isis circuit-type level-2-only\n"); | |
2718 | break; | |
2719 | case IS_LEVEL_1_AND_2: | |
2720 | vty_out(vty, " isis circuit-type level-1-2\n"); | |
2721 | break; | |
2722 | } | |
2723 | } | |
2724 | ||
f46e34f8 HS |
2725 | static int ag_change(struct vty *vty, int argc, struct cmd_token **argv, |
2726 | const char *xpath, bool no, int start_idx) | |
2727 | { | |
2728 | for (int i = start_idx; i < argc; i++) | |
2729 | nb_cli_enqueue_change(vty, xpath, | |
2730 | no ? NB_OP_DESTROY : NB_OP_CREATE, | |
2731 | argv[i]->arg); | |
2732 | return nb_cli_apply_changes(vty, NULL); | |
2733 | } | |
2734 | ||
2735 | static int ag_iter_cb(const struct lyd_node *dnode, void *arg) | |
2736 | { | |
2737 | struct vty *vty = (struct vty *)arg; | |
2738 | ||
2739 | vty_out(vty, " %s", yang_dnode_get_string(dnode, ".")); | |
2740 | return YANG_ITER_CONTINUE; | |
2741 | } | |
2742 | ||
d0820765 EDP |
2743 | /* |
2744 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/network-type | |
2745 | */ | |
ca77b518 | 2746 | DEFPY_YANG(isis_network, isis_network_cmd, "[no] isis network point-to-point", |
d0820765 EDP |
2747 | NO_STR |
2748 | "IS-IS routing protocol\n" | |
2749 | "Set network type\n" | |
2750 | "point-to-point network type\n") | |
2751 | { | |
2752 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/network-type", | |
2753 | NB_OP_MODIFY, | |
2754 | no ? "broadcast" : "point-to-point"); | |
2755 | ||
2756 | return nb_cli_apply_changes(vty, NULL); | |
2757 | } | |
2758 | ||
25605051 IR |
2759 | void cli_show_ip_isis_network_type(struct vty *vty, |
2760 | const struct lyd_node *dnode, | |
d0820765 EDP |
2761 | bool show_defaults) |
2762 | { | |
2763 | if (yang_dnode_get_enum(dnode, NULL) != CIRCUIT_T_P2P) | |
2764 | vty_out(vty, " no"); | |
2765 | ||
2766 | vty_out(vty, " isis network point-to-point\n"); | |
2767 | } | |
2768 | ||
d59c2d6b EDP |
2769 | /* |
2770 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/priority | |
2771 | */ | |
ca77b518 | 2772 | DEFPY_YANG(isis_priority, isis_priority_cmd, |
d59c2d6b EDP |
2773 | "isis priority (0-127)$prio [level-1|level-2]$level", |
2774 | "IS-IS routing protocol\n" | |
2775 | "Set priority for Designated Router election\n" | |
2776 | "Priority value\n" | |
2777 | "Specify priority for level-1 routing\n" | |
2778 | "Specify priority for level-2 routing\n") | |
2779 | { | |
2780 | if (!level || strmatch(level, "level-1")) | |
2781 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-1", | |
2782 | NB_OP_MODIFY, prio_str); | |
2783 | if (!level || strmatch(level, "level-2")) | |
2784 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-2", | |
2785 | NB_OP_MODIFY, prio_str); | |
2786 | ||
2787 | return nb_cli_apply_changes(vty, NULL); | |
2788 | } | |
2789 | ||
ca77b518 | 2790 | DEFPY_YANG(no_isis_priority, no_isis_priority_cmd, |
d59c2d6b EDP |
2791 | "no isis priority [(0-127)] [level-1|level-2]$level", |
2792 | NO_STR | |
2793 | "IS-IS routing protocol\n" | |
2794 | "Set priority for Designated Router election\n" | |
2795 | "Priority value\n" | |
2796 | "Specify priority for level-1 routing\n" | |
2797 | "Specify priority for level-2 routing\n") | |
2798 | { | |
2799 | if (!level || strmatch(level, "level-1")) | |
2800 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-1", | |
2801 | NB_OP_MODIFY, NULL); | |
2802 | if (!level || strmatch(level, "level-2")) | |
2803 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-2", | |
2804 | NB_OP_MODIFY, NULL); | |
2805 | ||
2806 | return nb_cli_apply_changes(vty, NULL); | |
2807 | } | |
2808 | ||
25605051 | 2809 | void cli_show_ip_isis_priority(struct vty *vty, const struct lyd_node *dnode, |
d59c2d6b EDP |
2810 | bool show_defaults) |
2811 | { | |
2812 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
2813 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
2814 | ||
2815 | if (strmatch(l1, l2)) | |
2816 | vty_out(vty, " isis priority %s\n", l1); | |
2817 | else { | |
2818 | vty_out(vty, " isis priority %s level-1\n", l1); | |
2819 | vty_out(vty, " isis priority %s level-2\n", l2); | |
2820 | } | |
2821 | } | |
2822 | ||
ed5d7032 | 2823 | /* |
d20b14bc RW |
2824 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/fast-reroute |
2825 | */ | |
25605051 | 2826 | void cli_show_ip_isis_frr(struct vty *vty, const struct lyd_node *dnode, |
d20b14bc RW |
2827 | bool show_defaults) |
2828 | { | |
2829 | bool l1_enabled, l2_enabled; | |
2830 | bool l1_node_protection, l2_node_protection; | |
ce4eccfa | 2831 | bool l1_link_fallback, l2_link_fallback; |
d20b14bc RW |
2832 | |
2833 | /* Classic LFA */ | |
2834 | l1_enabled = yang_dnode_get_bool(dnode, "./level-1/lfa/enable"); | |
2835 | l2_enabled = yang_dnode_get_bool(dnode, "./level-2/lfa/enable"); | |
2836 | ||
2837 | if (l1_enabled || l2_enabled) { | |
2838 | if (l1_enabled == l2_enabled) { | |
2839 | vty_out(vty, " isis fast-reroute lfa\n"); | |
2840 | vty_out(vty, "\n"); | |
2841 | } else { | |
2842 | if (l1_enabled) | |
2843 | vty_out(vty, | |
2844 | " isis fast-reroute lfa level-1\n"); | |
2845 | if (l2_enabled) | |
2846 | vty_out(vty, | |
2847 | " isis fast-reroute lfa level-2\n"); | |
2848 | } | |
2849 | } | |
2850 | ||
381200be RW |
2851 | /* Remote LFA */ |
2852 | l1_enabled = yang_dnode_get_bool(dnode, "./level-1/remote-lfa/enable"); | |
2853 | l2_enabled = yang_dnode_get_bool(dnode, "./level-2/remote-lfa/enable"); | |
2854 | ||
2855 | if (l1_enabled || l2_enabled) { | |
2856 | if (l1_enabled == l2_enabled) { | |
2857 | vty_out(vty, | |
2858 | " isis fast-reroute remote-lfa tunnel mpls-ldp\n"); | |
2859 | vty_out(vty, "\n"); | |
2860 | } else { | |
2861 | if (l1_enabled) | |
2862 | vty_out(vty, | |
2863 | " isis fast-reroute remote-lfa tunnel mpls-ldp level-1\n"); | |
2864 | if (l2_enabled) | |
2865 | vty_out(vty, | |
2866 | " isis fast-reroute remote-lfa tunnel mpls-ldp level-2\n"); | |
2867 | } | |
2868 | } | |
2869 | ||
d20b14bc RW |
2870 | /* TI-LFA */ |
2871 | l1_enabled = yang_dnode_get_bool(dnode, "./level-1/ti-lfa/enable"); | |
2872 | l2_enabled = yang_dnode_get_bool(dnode, "./level-2/ti-lfa/enable"); | |
2873 | l1_node_protection = | |
2874 | yang_dnode_get_bool(dnode, "./level-1/ti-lfa/node-protection"); | |
2875 | l2_node_protection = | |
2876 | yang_dnode_get_bool(dnode, "./level-2/ti-lfa/node-protection"); | |
ce4eccfa FR |
2877 | l1_link_fallback = |
2878 | yang_dnode_get_bool(dnode, "./level-1/ti-lfa/link-fallback"); | |
2879 | l2_link_fallback = | |
2880 | yang_dnode_get_bool(dnode, "./level-2/ti-lfa/link-fallback"); | |
2881 | ||
d20b14bc RW |
2882 | |
2883 | if (l1_enabled || l2_enabled) { | |
2884 | if (l1_enabled == l2_enabled | |
ce4eccfa FR |
2885 | && l1_node_protection == l2_node_protection |
2886 | && l1_link_fallback == l2_link_fallback) { | |
d20b14bc RW |
2887 | vty_out(vty, " isis fast-reroute ti-lfa"); |
2888 | if (l1_node_protection) | |
2889 | vty_out(vty, " node-protection"); | |
ce4eccfa FR |
2890 | if (l1_link_fallback) |
2891 | vty_out(vty, " link-fallback"); | |
d20b14bc RW |
2892 | vty_out(vty, "\n"); |
2893 | } else { | |
2894 | if (l1_enabled) { | |
2895 | vty_out(vty, | |
2896 | " isis fast-reroute ti-lfa level-1"); | |
2897 | if (l1_node_protection) | |
2898 | vty_out(vty, " node-protection"); | |
ce4eccfa FR |
2899 | if (l1_link_fallback) |
2900 | vty_out(vty, " link-fallback"); | |
d20b14bc RW |
2901 | vty_out(vty, "\n"); |
2902 | } | |
2903 | if (l2_enabled) { | |
2904 | vty_out(vty, | |
2905 | " isis fast-reroute ti-lfa level-2"); | |
2906 | if (l2_node_protection) | |
2907 | vty_out(vty, " node-protection"); | |
ce4eccfa FR |
2908 | if (l2_link_fallback) |
2909 | vty_out(vty, " link-fallback"); | |
d20b14bc RW |
2910 | vty_out(vty, "\n"); |
2911 | } | |
2912 | } | |
2913 | } | |
2914 | } | |
2915 | ||
2916 | /* | |
2917 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-{1,2}/lfa/enable | |
2918 | */ | |
2919 | DEFPY(isis_lfa, isis_lfa_cmd, | |
2920 | "[no] isis fast-reroute lfa [level-1|level-2]$level", | |
2921 | NO_STR | |
2922 | "IS-IS routing protocol\n" | |
2923 | "Interface IP Fast-reroute configuration\n" | |
2924 | "Enable LFA computation\n" | |
2925 | "Enable LFA computation for Level 1 only\n" | |
2926 | "Enable LFA computation for Level 2 only\n") | |
2927 | { | |
2928 | if (!level || strmatch(level, "level-1")) { | |
2929 | if (no) { | |
2930 | nb_cli_enqueue_change( | |
2931 | vty, | |
2932 | "./frr-isisd:isis/fast-reroute/level-1/lfa/enable", | |
2933 | NB_OP_MODIFY, "false"); | |
2934 | } else { | |
2935 | nb_cli_enqueue_change( | |
2936 | vty, | |
2937 | "./frr-isisd:isis/fast-reroute/level-1/lfa/enable", | |
2938 | NB_OP_MODIFY, "true"); | |
2939 | } | |
2940 | } | |
2941 | if (!level || strmatch(level, "level-2")) { | |
2942 | if (no) { | |
2943 | nb_cli_enqueue_change( | |
2944 | vty, | |
2945 | "./frr-isisd:isis/fast-reroute/level-2/lfa/enable", | |
2946 | NB_OP_MODIFY, "false"); | |
2947 | } else { | |
2948 | nb_cli_enqueue_change( | |
2949 | vty, | |
2950 | "./frr-isisd:isis/fast-reroute/level-2/lfa/enable", | |
2951 | NB_OP_MODIFY, "true"); | |
2952 | } | |
2953 | } | |
2954 | ||
2955 | return nb_cli_apply_changes(vty, NULL); | |
2956 | } | |
2957 | ||
2958 | /* | |
2959 | * XPath: | |
2960 | * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-{1,2}/lfa/exclude-interface | |
2961 | */ | |
2962 | DEFPY(isis_lfa_exclude_interface, isis_lfa_exclude_interface_cmd, | |
2963 | "[no] isis fast-reroute lfa [level-1|level-2]$level exclude interface IFNAME$ifname", | |
2964 | NO_STR | |
2965 | "IS-IS routing protocol\n" | |
2966 | "Interface IP Fast-reroute configuration\n" | |
2967 | "Enable LFA computation\n" | |
2968 | "Enable LFA computation for Level 1 only\n" | |
2969 | "Enable LFA computation for Level 2 only\n" | |
2970 | "FRR exclusion information\n" | |
2971 | "Exclude an interface from computation\n" | |
2972 | "Interface name\n") | |
2973 | { | |
2974 | if (!level || strmatch(level, "level-1")) { | |
2975 | if (no) { | |
2976 | nb_cli_enqueue_change( | |
2977 | vty, | |
2978 | "./frr-isisd:isis/fast-reroute/level-1/lfa/exclude-interface", | |
2979 | NB_OP_DESTROY, ifname); | |
2980 | } else { | |
2981 | nb_cli_enqueue_change( | |
2982 | vty, | |
2983 | "./frr-isisd:isis/fast-reroute/level-1/lfa/exclude-interface", | |
2984 | NB_OP_CREATE, ifname); | |
2985 | } | |
2986 | } | |
2987 | if (!level || strmatch(level, "level-2")) { | |
2988 | if (no) { | |
2989 | nb_cli_enqueue_change( | |
2990 | vty, | |
2991 | "./frr-isisd:isis/fast-reroute/level-2/lfa/exclude-interface", | |
2992 | NB_OP_DESTROY, ifname); | |
2993 | } else { | |
2994 | nb_cli_enqueue_change( | |
2995 | vty, | |
2996 | "./frr-isisd:isis/fast-reroute/level-2/lfa/exclude-interface", | |
2997 | NB_OP_CREATE, ifname); | |
2998 | } | |
2999 | } | |
3000 | ||
3001 | return nb_cli_apply_changes(vty, NULL); | |
3002 | } | |
3003 | ||
25605051 IR |
3004 | void cli_show_frr_lfa_exclude_interface(struct vty *vty, |
3005 | const struct lyd_node *dnode, | |
d20b14bc RW |
3006 | bool show_defaults) |
3007 | { | |
3008 | vty_out(vty, " isis fast-reroute lfa %s exclude interface %s\n", | |
3009 | dnode->parent->parent->schema->name, | |
3010 | yang_dnode_get_string(dnode, NULL)); | |
3011 | } | |
3012 | ||
381200be RW |
3013 | /* |
3014 | * XPath: | |
3015 | * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-{1,2}/remote-lfa/enable | |
3016 | */ | |
3017 | DEFPY(isis_remote_lfa, isis_remote_lfa_cmd, | |
3018 | "[no] isis fast-reroute remote-lfa tunnel mpls-ldp [level-1|level-2]$level", | |
3019 | NO_STR | |
3020 | "IS-IS routing protocol\n" | |
3021 | "Interface IP Fast-reroute configuration\n" | |
3022 | "Enable remote LFA computation\n" | |
3023 | "Enable remote LFA computation using tunnels\n" | |
3024 | "Use MPLS LDP tunnel to reach the remote LFA node\n" | |
3025 | "Enable LFA computation for Level 1 only\n" | |
3026 | "Enable LFA computation for Level 2 only\n") | |
3027 | { | |
3028 | if (!level || strmatch(level, "level-1")) { | |
3029 | if (no) { | |
3030 | nb_cli_enqueue_change( | |
3031 | vty, | |
3032 | "./frr-isisd:isis/fast-reroute/level-1/remote-lfa/enable", | |
3033 | NB_OP_MODIFY, "false"); | |
3034 | } else { | |
3035 | nb_cli_enqueue_change( | |
3036 | vty, | |
3037 | "./frr-isisd:isis/fast-reroute/level-1/remote-lfa/enable", | |
3038 | NB_OP_MODIFY, "true"); | |
3039 | } | |
3040 | } | |
3041 | if (!level || strmatch(level, "level-2")) { | |
3042 | if (no) { | |
3043 | nb_cli_enqueue_change( | |
3044 | vty, | |
3045 | "./frr-isisd:isis/fast-reroute/level-2/remote-lfa/enable", | |
3046 | NB_OP_MODIFY, "false"); | |
3047 | } else { | |
3048 | nb_cli_enqueue_change( | |
3049 | vty, | |
3050 | "./frr-isisd:isis/fast-reroute/level-2/remote-lfa/enable", | |
3051 | NB_OP_MODIFY, "true"); | |
3052 | } | |
3053 | } | |
3054 | ||
3055 | return nb_cli_apply_changes(vty, NULL); | |
3056 | } | |
3057 | ||
3058 | /* | |
3059 | * XPath: | |
3060 | * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-{1,2}/remote-lfa/maximum-metric | |
3061 | */ | |
3062 | DEFPY(isis_remote_lfa_max_metric, isis_remote_lfa_max_metric_cmd, | |
3063 | "[no] isis fast-reroute remote-lfa maximum-metric (1-16777215)$metric [level-1|level-2]$level", | |
3064 | NO_STR | |
3065 | "IS-IS routing protocol\n" | |
3066 | "Interface IP Fast-reroute configuration\n" | |
3067 | "Enable remote LFA computation\n" | |
3068 | "Limit remote LFA node selection within the metric\n" | |
3069 | "Value of the metric\n" | |
3070 | "Enable LFA computation for Level 1 only\n" | |
3071 | "Enable LFA computation for Level 2 only\n") | |
3072 | { | |
3073 | if (!level || strmatch(level, "level-1")) { | |
3074 | if (no) { | |
3075 | nb_cli_enqueue_change( | |
3076 | vty, | |
3077 | "./frr-isisd:isis/fast-reroute/level-1/remote-lfa/maximum-metric", | |
3078 | NB_OP_DESTROY, NULL); | |
3079 | } else { | |
3080 | nb_cli_enqueue_change( | |
3081 | vty, | |
3082 | "./frr-isisd:isis/fast-reroute/level-1/remote-lfa/maximum-metric", | |
3083 | NB_OP_MODIFY, metric_str); | |
3084 | } | |
3085 | } | |
3086 | if (!level || strmatch(level, "level-2")) { | |
3087 | if (no) { | |
3088 | nb_cli_enqueue_change( | |
3089 | vty, | |
3090 | "./frr-isisd:isis/fast-reroute/level-2/remote-lfa/maximum-metric", | |
3091 | NB_OP_DESTROY, NULL); | |
3092 | } else { | |
3093 | nb_cli_enqueue_change( | |
3094 | vty, | |
3095 | "./frr-isisd:isis/fast-reroute/level-2/remote-lfa/maximum-metric", | |
3096 | NB_OP_MODIFY, metric_str); | |
3097 | } | |
3098 | } | |
3099 | ||
3100 | return nb_cli_apply_changes(vty, NULL); | |
3101 | } | |
3102 | ||
25605051 IR |
3103 | void cli_show_frr_remote_lfa_max_metric(struct vty *vty, |
3104 | const struct lyd_node *dnode, | |
381200be RW |
3105 | bool show_defaults) |
3106 | { | |
3107 | vty_out(vty, " isis fast-reroute remote-lfa maximum-metric %s %s\n", | |
3108 | yang_dnode_get_string(dnode, NULL), | |
3109 | dnode->parent->parent->schema->name); | |
3110 | } | |
3111 | ||
d20b14bc RW |
3112 | /* |
3113 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-{1,2}/ti-lfa/enable | |
ed5d7032 RW |
3114 | */ |
3115 | DEFPY(isis_ti_lfa, isis_ti_lfa_cmd, | |
ce4eccfa | 3116 | "[no] isis fast-reroute ti-lfa [level-1|level-2]$level [node-protection$node_protection [link-fallback$link_fallback]]", |
ed5d7032 RW |
3117 | NO_STR |
3118 | "IS-IS routing protocol\n" | |
3119 | "Interface IP Fast-reroute configuration\n" | |
3120 | "Enable TI-LFA computation\n" | |
3121 | "Enable TI-LFA computation for Level 1 only\n" | |
3122 | "Enable TI-LFA computation for Level 2 only\n" | |
ce4eccfa FR |
3123 | "Protect against node failures\n" |
3124 | "Enable link-protection fallback\n") | |
ed5d7032 RW |
3125 | { |
3126 | if (!level || strmatch(level, "level-1")) { | |
3127 | if (no) { | |
3128 | nb_cli_enqueue_change( | |
3129 | vty, | |
3130 | "./frr-isisd:isis/fast-reroute/level-1/ti-lfa/enable", | |
3131 | NB_OP_MODIFY, "false"); | |
3132 | nb_cli_enqueue_change( | |
3133 | vty, | |
3134 | "./frr-isisd:isis/fast-reroute/level-1/ti-lfa/node-protection", | |
3135 | NB_OP_MODIFY, "false"); | |
ce4eccfa FR |
3136 | nb_cli_enqueue_change( |
3137 | vty, | |
3138 | "./frr-isisd:isis/fast-reroute/level-1/ti-lfa/link-fallback", | |
3139 | NB_OP_MODIFY, "false"); | |
ed5d7032 RW |
3140 | } else { |
3141 | nb_cli_enqueue_change( | |
3142 | vty, | |
3143 | "./frr-isisd:isis/fast-reroute/level-1/ti-lfa/enable", | |
3144 | NB_OP_MODIFY, "true"); | |
3145 | nb_cli_enqueue_change( | |
3146 | vty, | |
3147 | "./frr-isisd:isis/fast-reroute/level-1/ti-lfa/node-protection", | |
3148 | NB_OP_MODIFY, | |
3149 | node_protection ? "true" : "false"); | |
ce4eccfa FR |
3150 | nb_cli_enqueue_change( |
3151 | vty, | |
3152 | "./frr-isisd:isis/fast-reroute/level-1/ti-lfa/link-fallback", | |
3153 | NB_OP_MODIFY, link_fallback ? "true" : "false"); | |
ed5d7032 RW |
3154 | } |
3155 | } | |
3156 | if (!level || strmatch(level, "level-2")) { | |
3157 | if (no) { | |
3158 | nb_cli_enqueue_change( | |
3159 | vty, | |
3160 | "./frr-isisd:isis/fast-reroute/level-2/ti-lfa/enable", | |
3161 | NB_OP_MODIFY, "false"); | |
3162 | nb_cli_enqueue_change( | |
3163 | vty, | |
3164 | "./frr-isisd:isis/fast-reroute/level-2/ti-lfa/node-protection", | |
3165 | NB_OP_MODIFY, "false"); | |
ce4eccfa FR |
3166 | nb_cli_enqueue_change( |
3167 | vty, | |
3168 | "./frr-isisd:isis/fast-reroute/level-2/ti-lfa/link-fallback", | |
3169 | NB_OP_MODIFY, "false"); | |
ed5d7032 RW |
3170 | } else { |
3171 | nb_cli_enqueue_change( | |
3172 | vty, | |
3173 | "./frr-isisd:isis/fast-reroute/level-2/ti-lfa/enable", | |
3174 | NB_OP_MODIFY, "true"); | |
3175 | nb_cli_enqueue_change( | |
3176 | vty, | |
3177 | "./frr-isisd:isis/fast-reroute/level-2/ti-lfa/node-protection", | |
3178 | NB_OP_MODIFY, | |
3179 | node_protection ? "true" : "false"); | |
ce4eccfa FR |
3180 | nb_cli_enqueue_change( |
3181 | vty, | |
3182 | "./frr-isisd:isis/fast-reroute/level-2/ti-lfa/link-fallback", | |
3183 | NB_OP_MODIFY, link_fallback ? "true" : "false"); | |
ed5d7032 RW |
3184 | } |
3185 | } | |
3186 | ||
3187 | return nb_cli_apply_changes(vty, NULL); | |
3188 | } | |
3189 | ||
2adf66ff EDP |
3190 | /* |
3191 | * XPath: /frr-isisd:isis/instance/log-adjacency-changes | |
3192 | */ | |
ca77b518 | 3193 | DEFPY_YANG(log_adj_changes, log_adj_changes_cmd, "[no] log-adjacency-changes", |
2adf66ff EDP |
3194 | NO_STR "Log changes in adjacency state\n") |
3195 | { | |
5f1e5e3f EDP |
3196 | nb_cli_enqueue_change(vty, "./log-adjacency-changes", NB_OP_MODIFY, |
3197 | no ? "false" : "true"); | |
2adf66ff EDP |
3198 | |
3199 | return nb_cli_apply_changes(vty, NULL); | |
3200 | } | |
3201 | ||
25605051 | 3202 | void cli_show_isis_log_adjacency(struct vty *vty, const struct lyd_node *dnode, |
2adf66ff EDP |
3203 | bool show_defaults) |
3204 | { | |
5f1e5e3f EDP |
3205 | if (!yang_dnode_get_bool(dnode, NULL)) |
3206 | vty_out(vty, " no"); | |
2adf66ff EDP |
3207 | vty_out(vty, " log-adjacency-changes\n"); |
3208 | } | |
3209 | ||
9ace83b9 IL |
3210 | /* |
3211 | * XPath: /frr-isisd:isis/instance/log-pdu-drops | |
3212 | */ | |
3213 | DEFPY_YANG(log_pdu_drops, log_pdu_drops_cmd, "[no] log-pdu-drops", | |
3214 | NO_STR "Log any dropped PDUs\n") | |
3215 | { | |
3216 | nb_cli_enqueue_change(vty, "./log-pdu-drops", NB_OP_MODIFY, | |
3217 | no ? "false" : "true"); | |
3218 | ||
3219 | return nb_cli_apply_changes(vty, NULL); | |
3220 | } | |
3221 | ||
3222 | void cli_show_isis_log_pdu_drops(struct vty *vty, const struct lyd_node *dnode, | |
3223 | bool show_defaults) | |
3224 | { | |
3225 | if (!yang_dnode_get_bool(dnode, NULL)) | |
3226 | vty_out(vty, " no"); | |
3227 | vty_out(vty, " log-pdu-drops\n"); | |
3228 | } | |
3229 | ||
1cbf96a8 | 3230 | /* |
3231 | * XPath: /frr-isisd:isis/instance/mpls/ldp-sync | |
3232 | */ | |
3233 | DEFPY(isis_mpls_ldp_sync, isis_mpls_ldp_sync_cmd, "mpls ldp-sync", | |
3234 | MPLS_STR MPLS_LDP_SYNC_STR) | |
3235 | { | |
3236 | nb_cli_enqueue_change(vty, "./mpls/ldp-sync", NB_OP_CREATE, NULL); | |
3237 | ||
3238 | return nb_cli_apply_changes(vty, NULL); | |
3239 | } | |
3240 | ||
3241 | DEFPY(no_isis_mpls_ldp_sync, no_isis_mpls_ldp_sync_cmd, "no mpls ldp-sync", | |
3242 | NO_STR MPLS_STR NO_MPLS_LDP_SYNC_STR) | |
3243 | { | |
3244 | nb_cli_enqueue_change(vty, "./mpls/ldp-sync", NB_OP_DESTROY, NULL); | |
3245 | ||
3246 | return nb_cli_apply_changes(vty, NULL); | |
3247 | } | |
3248 | ||
25605051 | 3249 | void cli_show_isis_mpls_ldp_sync(struct vty *vty, const struct lyd_node *dnode, |
1cbf96a8 | 3250 | bool show_defaults) |
3251 | { | |
3252 | vty_out(vty, " mpls ldp-sync\n"); | |
3253 | } | |
3254 | ||
3255 | DEFPY(isis_mpls_ldp_sync_holddown, isis_mpls_ldp_sync_holddown_cmd, | |
3256 | "mpls ldp-sync holddown (0-10000)", | |
3257 | MPLS_STR MPLS_LDP_SYNC_STR | |
3258 | "Time to wait for LDP-SYNC to occur before restoring interface metric\n" | |
3259 | "Time in seconds\n") | |
3260 | { | |
3261 | nb_cli_enqueue_change(vty, "./mpls/ldp-sync/holddown", NB_OP_MODIFY, | |
3262 | holddown_str); | |
3263 | ||
3264 | return nb_cli_apply_changes(vty, NULL); | |
3265 | } | |
3266 | ||
3267 | DEFPY(no_isis_mpls_ldp_sync_holddown, no_isis_mpls_ldp_sync_holddown_cmd, | |
3268 | "no mpls ldp-sync holddown [<(1-10000)>]", | |
31011d9c | 3269 | NO_STR MPLS_STR MPLS_LDP_SYNC_STR NO_MPLS_LDP_SYNC_HOLDDOWN_STR "Time in seconds\n") |
1cbf96a8 | 3270 | { |
3271 | nb_cli_enqueue_change(vty, "./mpls/ldp-sync/holddown", NB_OP_DESTROY, | |
3272 | NULL); | |
3273 | ||
3274 | return nb_cli_apply_changes(vty, NULL); | |
3275 | } | |
3276 | ||
3277 | void cli_show_isis_mpls_ldp_sync_holddown(struct vty *vty, | |
25605051 | 3278 | const struct lyd_node *dnode, |
1cbf96a8 | 3279 | bool show_defaults) |
3280 | { | |
3281 | vty_out(vty, " mpls ldp-sync holddown %s\n", | |
3282 | yang_dnode_get_string(dnode, NULL)); | |
3283 | } | |
3284 | ||
3285 | /* | |
3286 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/mpls/ldp-sync | |
3287 | */ | |
3288 | DEFPY(isis_mpls_if_ldp_sync, isis_mpls_if_ldp_sync_cmd, | |
3289 | "[no] isis mpls ldp-sync", | |
3290 | NO_STR "IS-IS routing protocol\n" MPLS_STR MPLS_LDP_SYNC_STR) | |
3291 | { | |
3292 | const struct lyd_node *dnode; | |
1cbf96a8 | 3293 | |
3bb513c3 CH |
3294 | dnode = yang_dnode_getf(vty->candidate_config->dnode, |
3295 | "%s/frr-isisd:isis", VTY_CURR_XPATH); | |
1cbf96a8 | 3296 | if (dnode == NULL) { |
3297 | vty_out(vty, "ISIS is not enabled on this circuit\n"); | |
3298 | return CMD_SUCCESS; | |
3299 | } | |
3300 | ||
1cbf96a8 | 3301 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/mpls/ldp-sync", |
3302 | NB_OP_MODIFY, no ? "false" : "true"); | |
3303 | ||
3304 | return nb_cli_apply_changes(vty, NULL); | |
3305 | } | |
3306 | ||
3307 | ||
25605051 IR |
3308 | void cli_show_isis_mpls_if_ldp_sync(struct vty *vty, |
3309 | const struct lyd_node *dnode, | |
1cbf96a8 | 3310 | bool show_defaults) |
3311 | { | |
3312 | if (!yang_dnode_get_bool(dnode, NULL)) | |
3313 | vty_out(vty, " no"); | |
3314 | ||
3315 | vty_out(vty, " isis mpls ldp-sync\n"); | |
3316 | } | |
3317 | ||
3318 | DEFPY(isis_mpls_if_ldp_sync_holddown, isis_mpls_if_ldp_sync_holddown_cmd, | |
3319 | "isis mpls ldp-sync holddown (0-10000)", | |
3320 | "IS-IS routing protocol\n" MPLS_STR MPLS_LDP_SYNC_STR | |
3321 | "Time to wait for LDP-SYNC to occur before restoring interface metric\n" | |
3322 | "Time in seconds\n") | |
3323 | { | |
3324 | const struct lyd_node *dnode; | |
1cbf96a8 | 3325 | |
3bb513c3 CH |
3326 | dnode = yang_dnode_getf(vty->candidate_config->dnode, |
3327 | "%s/frr-isisd:isis", VTY_CURR_XPATH); | |
1cbf96a8 | 3328 | if (dnode == NULL) { |
3329 | vty_out(vty, "ISIS is not enabled on this circuit\n"); | |
3330 | return CMD_SUCCESS; | |
3331 | } | |
3332 | ||
1cbf96a8 | 3333 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/mpls/holddown", |
3334 | NB_OP_MODIFY, holddown_str); | |
3335 | ||
3336 | return nb_cli_apply_changes(vty, NULL); | |
3337 | } | |
3338 | ||
3339 | DEFPY(no_isis_mpls_if_ldp_sync_holddown, no_isis_mpls_if_ldp_sync_holddown_cmd, | |
3340 | "no isis mpls ldp-sync holddown [<(1-10000)>]", | |
3341 | NO_STR "IS-IS routing protocol\n" MPLS_STR NO_MPLS_LDP_SYNC_STR | |
31011d9c | 3342 | NO_MPLS_LDP_SYNC_HOLDDOWN_STR "Time in seconds\n") |
1cbf96a8 | 3343 | { |
3344 | const struct lyd_node *dnode; | |
1cbf96a8 | 3345 | |
3bb513c3 CH |
3346 | dnode = yang_dnode_getf(vty->candidate_config->dnode, |
3347 | "%s/frr-isisd:isis", VTY_CURR_XPATH); | |
1cbf96a8 | 3348 | if (dnode == NULL) { |
3349 | vty_out(vty, "ISIS is not enabled on this circuit\n"); | |
3350 | return CMD_SUCCESS; | |
3351 | } | |
3352 | ||
1cbf96a8 | 3353 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/mpls/holddown", |
3354 | NB_OP_DESTROY, NULL); | |
3355 | ||
3356 | return nb_cli_apply_changes(vty, NULL); | |
3357 | } | |
3358 | ||
3359 | void cli_show_isis_mpls_if_ldp_sync_holddown(struct vty *vty, | |
25605051 | 3360 | const struct lyd_node *dnode, |
1cbf96a8 | 3361 | bool show_defaults) |
3362 | { | |
3363 | vty_out(vty, " isis mpls ldp-sync holddown %s\n", | |
3364 | yang_dnode_get_string(dnode, NULL)); | |
3365 | } | |
3366 | ||
46fb37cf HS |
3367 | DEFPY_YANG_NOSH(flex_algo, flex_algo_cmd, "flex-algo (128-255)$algorithm", |
3368 | "Flexible Algorithm\n" | |
3369 | "Flexible Algorithm Number\n") | |
3370 | { | |
f46e34f8 HS |
3371 | int ret; |
3372 | char xpath[XPATH_MAXLEN + 37]; | |
3373 | ||
3374 | snprintf(xpath, sizeof(xpath), | |
3375 | "%s/flex-algos/flex-algo[flex-algo='%ld']", VTY_CURR_XPATH, | |
3376 | algorithm); | |
3377 | ||
3378 | nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); | |
3379 | ||
3380 | ret = nb_cli_apply_changes( | |
3381 | vty, "./flex-algos/flex-algo[flex-algo='%ld']", algorithm); | |
3382 | if (ret == CMD_SUCCESS) | |
3383 | VTY_PUSH_XPATH(ISIS_FLEX_ALGO_NODE, xpath); | |
3384 | ||
3385 | return ret; | |
46fb37cf HS |
3386 | } |
3387 | ||
3388 | DEFPY_YANG(no_flex_algo, no_flex_algo_cmd, "no flex-algo (128-255)$algorithm", | |
3389 | NO_STR | |
3390 | "Flexible Algorithm\n" | |
3391 | "Flexible Algorithm Number\n") | |
3392 | { | |
f46e34f8 HS |
3393 | char xpath[XPATH_MAXLEN + 37]; |
3394 | ||
3395 | snprintf(xpath, sizeof(xpath), | |
3396 | "%s/flex-algos/flex-algo[flex-algo='%ld']", VTY_CURR_XPATH, | |
3397 | algorithm); | |
3398 | ||
3399 | if (!yang_dnode_exists(vty->candidate_config->dnode, xpath)) { | |
3400 | vty_out(vty, "ISIS flex-algo %ld isn't exist.\n", algorithm); | |
3401 | return CMD_ERR_NO_MATCH; | |
3402 | } | |
3403 | ||
3404 | nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); | |
3405 | return nb_cli_apply_changes_clear_pending( | |
3406 | vty, "./flex-algos/flex-algo[flex-algo='%ld']", algorithm); | |
46fb37cf HS |
3407 | } |
3408 | ||
3409 | DEFPY_YANG(advertise_definition, advertise_definition_cmd, | |
3410 | "[no] advertise-definition", | |
3411 | NO_STR "Advertise Local Flexible Algorithm\n") | |
3412 | { | |
f46e34f8 HS |
3413 | nb_cli_enqueue_change(vty, "./advertise-definition", |
3414 | no ? NB_OP_DESTROY : NB_OP_CREATE, | |
3415 | no ? NULL : "true"); | |
3416 | return nb_cli_apply_changes(vty, NULL); | |
46fb37cf HS |
3417 | } |
3418 | ||
3419 | DEFPY_YANG(affinity_include_any, affinity_include_any_cmd, | |
3420 | "[no] affinity include-any NAME...", | |
3421 | NO_STR | |
3422 | "Affinity configuration\n" | |
3423 | "Any Include with\n" | |
3424 | "Include NAME list\n") | |
3425 | { | |
f46e34f8 HS |
3426 | const char *xpath = "./affinity-include-anies/affinity-include-any"; |
3427 | ||
3428 | return ag_change(vty, argc, argv, xpath, no, no ? 3 : 2); | |
46fb37cf HS |
3429 | } |
3430 | ||
3431 | DEFPY_YANG(affinity_include_all, affinity_include_all_cmd, | |
3432 | "[no] affinity include-all NAME...", | |
3433 | NO_STR | |
3434 | "Affinity configuration\n" | |
3435 | "All Include with\n" | |
3436 | "Include NAME list\n") | |
3437 | { | |
f46e34f8 HS |
3438 | const char *xpath = "./affinity-include-alls/affinity-include-all"; |
3439 | ||
3440 | return ag_change(vty, argc, argv, xpath, no, no ? 3 : 2); | |
46fb37cf HS |
3441 | } |
3442 | ||
3443 | DEFPY_YANG(affinity_exclude_any, affinity_exclude_any_cmd, | |
3444 | "[no] affinity exclude-any NAME...", | |
3445 | NO_STR | |
3446 | "Affinity configuration\n" | |
3447 | "Any Exclude with\n" | |
3448 | "Exclude NAME list\n") | |
3449 | { | |
f46e34f8 HS |
3450 | const char *xpath = "./affinity-exclude-anies/affinity-exclude-any"; |
3451 | ||
3452 | return ag_change(vty, argc, argv, xpath, no, no ? 3 : 2); | |
46fb37cf HS |
3453 | } |
3454 | ||
3455 | DEFPY_YANG(prefix_metric, prefix_metric_cmd, "[no] prefix-metric", | |
3456 | NO_STR "Use Flex-Algo Prefix Metric\n") | |
3457 | { | |
f46e34f8 HS |
3458 | nb_cli_enqueue_change(vty, "./prefix-metric", |
3459 | no ? NB_OP_DESTROY : NB_OP_CREATE, NULL); | |
3460 | return nb_cli_apply_changes(vty, NULL); | |
3461 | } | |
3462 | ||
3463 | DEFPY_YANG(dplane_sr_mpls, dplane_sr_mpls_cmd, "[no] dataplane sr-mpls", | |
3464 | NO_STR | |
3465 | "Advertise and participate in the specified Data-Planes\n" | |
3466 | "Advertise and participate in SR-MPLS data-plane\n") | |
3467 | { | |
3468 | nb_cli_enqueue_change(vty, "./dplane-sr-mpls", | |
3469 | no ? NB_OP_DESTROY : NB_OP_CREATE, NULL); | |
3470 | return nb_cli_apply_changes(vty, NULL); | |
3471 | } | |
3472 | ||
3473 | DEFPY_HIDDEN(dplane_srv6, dplane_srv6_cmd, "[no] dataplane srv6", | |
3474 | NO_STR | |
3475 | "Advertise and participate in the specified Data-Planes\n" | |
3476 | "Advertise and participate in SRv6 data-plane\n") | |
3477 | { | |
3478 | ||
3479 | nb_cli_enqueue_change(vty, "./dplane-srv6", | |
3480 | no ? NB_OP_DESTROY : NB_OP_CREATE, NULL); | |
3481 | return nb_cli_apply_changes(vty, NULL); | |
3482 | } | |
3483 | ||
3484 | DEFPY_HIDDEN(dplane_ip, dplane_ip_cmd, "[no] dataplane ip", | |
3485 | NO_STR | |
3486 | "Advertise and participate in the specified Data-Planes\n" | |
3487 | "Advertise and participate in IP data-plane\n") | |
3488 | { | |
3489 | nb_cli_enqueue_change(vty, "./dplane-ip", | |
3490 | no ? NB_OP_DESTROY : NB_OP_CREATE, NULL); | |
3491 | return nb_cli_apply_changes(vty, NULL); | |
46fb37cf HS |
3492 | } |
3493 | ||
3494 | DEFPY_YANG(metric_type, metric_type_cmd, | |
3495 | "[no] metric-type [igp$igp|te$te|delay$delay]", | |
3496 | NO_STR | |
3497 | "Metric-type used by flex-algo calculation\n" | |
3498 | "Use IGP metric (default)\n" | |
3499 | "Use Delay as metric\n" | |
3500 | "Use Traffic Engineering metric\n") | |
3501 | { | |
f46e34f8 HS |
3502 | const char *type = NULL; |
3503 | ||
3504 | if (igp) { | |
3505 | type = "igp"; | |
3506 | } else if (te) { | |
3507 | type = "te-default"; | |
3508 | } else if (delay) { | |
3509 | type = "min-uni-link-delay"; | |
3510 | } else { | |
3511 | vty_out(vty, "Error: unknown metric type\n"); | |
3512 | return CMD_SUCCESS; | |
3513 | } | |
3514 | ||
3515 | if (!igp) | |
3516 | vty_out(vty, | |
3517 | "Warning: this version can advertise a Flex-Algorithm Definition (FAD) with the %s metric.\n" | |
3518 | "However, participation in a Flex-Algorithm with such a metric is not yet supported.\n", | |
3519 | type); | |
3520 | ||
3521 | nb_cli_enqueue_change(vty, "./metric-type", | |
3522 | no ? NB_OP_DESTROY : NB_OP_MODIFY, | |
3523 | no ? NULL : type); | |
3524 | return nb_cli_apply_changes(vty, NULL); | |
46fb37cf HS |
3525 | } |
3526 | ||
3527 | DEFPY_YANG(priority, priority_cmd, "[no] priority (0-255)$priority", | |
3528 | NO_STR | |
3529 | "Flex-Algo definition priority\n" | |
3530 | "Priority value\n") | |
3531 | { | |
f46e34f8 HS |
3532 | nb_cli_enqueue_change(vty, "./priority", |
3533 | no ? NB_OP_DESTROY : NB_OP_MODIFY, | |
3534 | no ? NULL : priority_str); | |
3535 | return nb_cli_apply_changes(vty, NULL); | |
46fb37cf HS |
3536 | } |
3537 | ||
3538 | void cli_show_isis_flex_algo(struct vty *vty, const struct lyd_node *dnode, | |
3539 | bool show_defaults) | |
3540 | { | |
f46e34f8 HS |
3541 | uint32_t algorithm; |
3542 | enum flex_algo_metric_type metric_type; | |
3543 | uint32_t priority; | |
3544 | char type_str[10]; | |
3545 | ||
3546 | algorithm = yang_dnode_get_uint32(dnode, "./flex-algo"); | |
3547 | vty_out(vty, " flex-algo %u\n", algorithm); | |
3548 | ||
3549 | if (yang_dnode_exists(dnode, "./advertise-definition")) | |
3550 | vty_out(vty, " advertise-definition\n"); | |
3551 | ||
3552 | if (yang_dnode_exists(dnode, "./dplane-sr-mpls")) | |
3553 | vty_out(vty, " dataplane sr-mpls\n"); | |
3554 | if (yang_dnode_exists(dnode, "./dplane-srv6")) | |
3555 | vty_out(vty, " dataplane srv6\n"); | |
3556 | if (yang_dnode_exists(dnode, "./dplane-ip")) | |
3557 | vty_out(vty, " dataplane ip\n"); | |
3558 | ||
3559 | if (yang_dnode_exists(dnode, "./prefix-metric")) | |
3560 | vty_out(vty, " prefix-metric\n"); | |
3561 | ||
3562 | if (yang_dnode_exists(dnode, "./metric-type")) { | |
3563 | metric_type = yang_dnode_get_enum(dnode, "./metric-type"); | |
3564 | if (metric_type != MT_IGP) { | |
3565 | flex_algo_metric_type_print(type_str, sizeof(type_str), | |
3566 | metric_type); | |
3567 | vty_out(vty, " metric-type %s\n", type_str); | |
3568 | } | |
3569 | } | |
3570 | ||
3571 | if (yang_dnode_exists(dnode, "./priority")) { | |
3572 | priority = yang_dnode_get_uint32(dnode, "./priority"); | |
3573 | if (priority != FLEX_ALGO_PRIO_DEFAULT) | |
3574 | vty_out(vty, " priority %u\n", priority); | |
3575 | } | |
3576 | ||
3577 | if (yang_dnode_exists(dnode, | |
3578 | "./affinity-include-alls/affinity-include-all")) { | |
3579 | vty_out(vty, " affinity include-all"); | |
3580 | yang_dnode_iterate( | |
3581 | ag_iter_cb, vty, dnode, | |
3582 | "./affinity-include-alls/affinity-include-all"); | |
3583 | vty_out(vty, "\n"); | |
3584 | } | |
3585 | ||
3586 | if (yang_dnode_exists( | |
3587 | dnode, "./affinity-include-anies/affinity-include-any")) { | |
3588 | vty_out(vty, " affinity include-any"); | |
3589 | yang_dnode_iterate( | |
3590 | ag_iter_cb, vty, dnode, | |
3591 | "./affinity-include-anies/affinity-include-any"); | |
3592 | vty_out(vty, "\n"); | |
3593 | } | |
3594 | ||
3595 | if (yang_dnode_exists( | |
3596 | dnode, "./affinity-exclude-anies/affinity-exclude-any")) { | |
3597 | vty_out(vty, " affinity exclude-any"); | |
3598 | yang_dnode_iterate( | |
3599 | ag_iter_cb, vty, dnode, | |
3600 | "./affinity-exclude-anies/affinity-exclude-any"); | |
3601 | vty_out(vty, "\n"); | |
3602 | } | |
46fb37cf HS |
3603 | } |
3604 | ||
3605 | void cli_show_isis_flex_algo_end(struct vty *vty, const struct lyd_node *dnode) | |
3606 | { | |
f46e34f8 | 3607 | vty_out(vty, " !\n"); |
46fb37cf HS |
3608 | } |
3609 | ||
f46e34f8 | 3610 | |
20bd27e2 EDP |
3611 | void isis_cli_init(void) |
3612 | { | |
aaf2fd21 EDP |
3613 | install_element(CONFIG_NODE, &router_isis_cmd); |
3614 | install_element(CONFIG_NODE, &no_router_isis_cmd); | |
3615 | ||
3616 | install_element(INTERFACE_NODE, &ip_router_isis_cmd); | |
1457b1d5 | 3617 | install_element(INTERFACE_NODE, &ip_router_isis_vrf_cmd); |
aaf2fd21 | 3618 | install_element(INTERFACE_NODE, &ip6_router_isis_cmd); |
1457b1d5 | 3619 | install_element(INTERFACE_NODE, &ip6_router_isis_vrf_cmd); |
aaf2fd21 | 3620 | install_element(INTERFACE_NODE, &no_ip_router_isis_cmd); |
1457b1d5 | 3621 | install_element(INTERFACE_NODE, &no_ip_router_isis_vrf_cmd); |
c3e6ac0b | 3622 | install_element(INTERFACE_NODE, &isis_bfd_cmd); |
4affdba7 | 3623 | install_element(INTERFACE_NODE, &isis_bfd_profile_cmd); |
f084ea55 EDP |
3624 | |
3625 | install_element(ISIS_NODE, &net_cmd); | |
e6bdae69 EDP |
3626 | |
3627 | install_element(ISIS_NODE, &is_type_cmd); | |
3628 | install_element(ISIS_NODE, &no_is_type_cmd); | |
6bb043cd EDP |
3629 | |
3630 | install_element(ISIS_NODE, &dynamic_hostname_cmd); | |
05a3f9f0 EDP |
3631 | |
3632 | install_element(ISIS_NODE, &set_overload_bit_cmd); | |
01ea9b03 IL |
3633 | install_element(ISIS_NODE, &set_overload_bit_on_startup_cmd); |
3634 | install_element(ISIS_NODE, &no_set_overload_bit_on_startup_cmd); | |
3635 | ||
f3abc412 | 3636 | install_element(ISIS_NODE, &attached_bit_send_cmd); |
3637 | install_element(ISIS_NODE, &attached_bit_receive_ignore_cmd); | |
e0df3206 EDP |
3638 | |
3639 | install_element(ISIS_NODE, &metric_style_cmd); | |
3640 | install_element(ISIS_NODE, &no_metric_style_cmd); | |
933536e3 | 3641 | |
d74f913c IL |
3642 | install_element(ISIS_NODE, &advertise_high_metrics_cmd); |
3643 | ||
933536e3 EDP |
3644 | install_element(ISIS_NODE, &area_passwd_cmd); |
3645 | install_element(ISIS_NODE, &domain_passwd_cmd); | |
3646 | install_element(ISIS_NODE, &no_area_passwd_cmd); | |
1d6fe72e EDP |
3647 | |
3648 | install_element(ISIS_NODE, &lsp_gen_interval_cmd); | |
3649 | install_element(ISIS_NODE, &no_lsp_gen_interval_cmd); | |
7e869004 EDP |
3650 | install_element(ISIS_NODE, &lsp_refresh_interval_cmd); |
3651 | install_element(ISIS_NODE, &no_lsp_refresh_interval_cmd); | |
ea120aa0 EDP |
3652 | install_element(ISIS_NODE, &max_lsp_lifetime_cmd); |
3653 | install_element(ISIS_NODE, &no_max_lsp_lifetime_cmd); | |
d2c970ff EDP |
3654 | install_element(ISIS_NODE, &lsp_timers_cmd); |
3655 | install_element(ISIS_NODE, &no_lsp_timers_cmd); | |
27a45d16 EDP |
3656 | install_element(ISIS_NODE, &area_lsp_mtu_cmd); |
3657 | install_element(ISIS_NODE, &no_area_lsp_mtu_cmd); | |
3f3608d8 | 3658 | install_element(ISIS_NODE, &advertise_passive_only_cmd); |
dcb1dcd6 EDP |
3659 | |
3660 | install_element(ISIS_NODE, &spf_interval_cmd); | |
3661 | install_element(ISIS_NODE, &no_spf_interval_cmd); | |
d20b14bc RW |
3662 | install_element(ISIS_NODE, &spf_prefix_priority_cmd); |
3663 | install_element(ISIS_NODE, &no_spf_prefix_priority_cmd); | |
5336ba30 EDP |
3664 | install_element(ISIS_NODE, &spf_delay_ietf_cmd); |
3665 | install_element(ISIS_NODE, &no_spf_delay_ietf_cmd); | |
66e45e10 EDP |
3666 | |
3667 | install_element(ISIS_NODE, &area_purge_originator_cmd); | |
d1a80ef6 | 3668 | |
46fb37cf HS |
3669 | install_element(ISIS_NODE, &isis_admin_group_send_zero_cmd); |
3670 | install_element(ISIS_NODE, &isis_asla_legacy_flag_cmd); | |
3671 | ||
d1a80ef6 EDP |
3672 | install_element(ISIS_NODE, &isis_mpls_te_on_cmd); |
3673 | install_element(ISIS_NODE, &no_isis_mpls_te_on_cmd); | |
3674 | install_element(ISIS_NODE, &isis_mpls_te_router_addr_cmd); | |
2e2a8b91 | 3675 | install_element(ISIS_NODE, &no_isis_mpls_te_router_addr_cmd); |
173f8887 OD |
3676 | install_element(ISIS_NODE, &isis_mpls_te_router_addr_v6_cmd); |
3677 | install_element(ISIS_NODE, &no_isis_mpls_te_router_addr_v6_cmd); | |
d1a80ef6 | 3678 | install_element(ISIS_NODE, &isis_mpls_te_inter_as_cmd); |
ed6189a9 OD |
3679 | install_element(ISIS_NODE, &isis_mpls_te_export_cmd); |
3680 | install_element(ISIS_NODE, &no_isis_mpls_te_export_cmd); | |
8b104c10 EDP |
3681 | |
3682 | install_element(ISIS_NODE, &isis_default_originate_cmd); | |
a041ac8e | 3683 | install_element(ISIS_NODE, &isis_redistribute_cmd); |
22af6a80 EDP |
3684 | |
3685 | install_element(ISIS_NODE, &isis_topology_cmd); | |
a6a36c41 | 3686 | |
8f6c8936 RW |
3687 | install_element(ISIS_NODE, &isis_sr_enable_cmd); |
3688 | install_element(ISIS_NODE, &no_isis_sr_enable_cmd); | |
3689 | install_element(ISIS_NODE, &isis_sr_global_block_label_range_cmd); | |
3690 | install_element(ISIS_NODE, &no_isis_sr_global_block_label_range_cmd); | |
3691 | install_element(ISIS_NODE, &isis_sr_node_msd_cmd); | |
3692 | install_element(ISIS_NODE, &no_isis_sr_node_msd_cmd); | |
3693 | install_element(ISIS_NODE, &isis_sr_prefix_sid_cmd); | |
3694 | install_element(ISIS_NODE, &no_isis_sr_prefix_sid_cmd); | |
67409447 HS |
3695 | #ifndef FABRICD |
3696 | install_element(ISIS_NODE, &isis_sr_prefix_sid_algorithm_cmd); | |
3697 | install_element(ISIS_NODE, &no_isis_sr_prefix_sid_algorithm_cmd); | |
3698 | #endif /* ifndef FABRICD */ | |
d20b14bc RW |
3699 | install_element(ISIS_NODE, &isis_frr_lfa_priority_limit_cmd); |
3700 | install_element(ISIS_NODE, &isis_frr_lfa_tiebreaker_cmd); | |
3701 | install_element(ISIS_NODE, &isis_frr_lfa_load_sharing_cmd); | |
381200be RW |
3702 | install_element(ISIS_NODE, &isis_frr_remote_lfa_plist_cmd); |
3703 | install_element(ISIS_NODE, &no_isis_frr_remote_lfa_plist_cmd); | |
8f6c8936 | 3704 | |
a6a36c41 | 3705 | install_element(INTERFACE_NODE, &isis_passive_cmd); |
3e20c83a EDP |
3706 | |
3707 | install_element(INTERFACE_NODE, &isis_passwd_cmd); | |
3708 | install_element(INTERFACE_NODE, &no_isis_passwd_cmd); | |
be49219c EDP |
3709 | |
3710 | install_element(INTERFACE_NODE, &isis_metric_cmd); | |
3711 | install_element(INTERFACE_NODE, &no_isis_metric_cmd); | |
356a2e3c EDP |
3712 | |
3713 | install_element(INTERFACE_NODE, &isis_hello_interval_cmd); | |
3714 | install_element(INTERFACE_NODE, &no_isis_hello_interval_cmd); | |
4e75a67d EDP |
3715 | |
3716 | install_element(INTERFACE_NODE, &isis_hello_multiplier_cmd); | |
3717 | install_element(INTERFACE_NODE, &no_isis_hello_multiplier_cmd); | |
5f2ce446 EDP |
3718 | |
3719 | install_element(INTERFACE_NODE, &isis_threeway_adj_cmd); | |
7b6b75e5 EDP |
3720 | |
3721 | install_element(INTERFACE_NODE, &isis_hello_padding_cmd); | |
9ce808b9 EDP |
3722 | |
3723 | install_element(INTERFACE_NODE, &csnp_interval_cmd); | |
3724 | install_element(INTERFACE_NODE, &no_csnp_interval_cmd); | |
3725 | ||
3726 | install_element(INTERFACE_NODE, &psnp_interval_cmd); | |
3727 | install_element(INTERFACE_NODE, &no_psnp_interval_cmd); | |
83d043f6 EDP |
3728 | |
3729 | install_element(INTERFACE_NODE, &circuit_topology_cmd); | |
9302fbb6 EDP |
3730 | |
3731 | install_element(INTERFACE_NODE, &isis_circuit_type_cmd); | |
3732 | install_element(INTERFACE_NODE, &no_isis_circuit_type_cmd); | |
d0820765 EDP |
3733 | |
3734 | install_element(INTERFACE_NODE, &isis_network_cmd); | |
d59c2d6b EDP |
3735 | |
3736 | install_element(INTERFACE_NODE, &isis_priority_cmd); | |
3737 | install_element(INTERFACE_NODE, &no_isis_priority_cmd); | |
2adf66ff | 3738 | |
d20b14bc RW |
3739 | install_element(INTERFACE_NODE, &isis_lfa_cmd); |
3740 | install_element(INTERFACE_NODE, &isis_lfa_exclude_interface_cmd); | |
381200be RW |
3741 | install_element(INTERFACE_NODE, &isis_remote_lfa_cmd); |
3742 | install_element(INTERFACE_NODE, &isis_remote_lfa_max_metric_cmd); | |
ed5d7032 RW |
3743 | install_element(INTERFACE_NODE, &isis_ti_lfa_cmd); |
3744 | ||
2adf66ff | 3745 | install_element(ISIS_NODE, &log_adj_changes_cmd); |
9ace83b9 | 3746 | install_element(ISIS_NODE, &log_pdu_drops_cmd); |
1cbf96a8 | 3747 | |
3748 | install_element(ISIS_NODE, &isis_mpls_ldp_sync_cmd); | |
3749 | install_element(ISIS_NODE, &no_isis_mpls_ldp_sync_cmd); | |
3750 | install_element(ISIS_NODE, &isis_mpls_ldp_sync_holddown_cmd); | |
3751 | install_element(ISIS_NODE, &no_isis_mpls_ldp_sync_holddown_cmd); | |
3752 | install_element(INTERFACE_NODE, &isis_mpls_if_ldp_sync_cmd); | |
3753 | install_element(INTERFACE_NODE, &isis_mpls_if_ldp_sync_holddown_cmd); | |
3754 | install_element(INTERFACE_NODE, &no_isis_mpls_if_ldp_sync_holddown_cmd); | |
46fb37cf HS |
3755 | |
3756 | install_element(ISIS_NODE, &flex_algo_cmd); | |
3757 | install_element(ISIS_NODE, &no_flex_algo_cmd); | |
3758 | install_element(ISIS_FLEX_ALGO_NODE, &advertise_definition_cmd); | |
3759 | install_element(ISIS_FLEX_ALGO_NODE, &affinity_include_any_cmd); | |
3760 | install_element(ISIS_FLEX_ALGO_NODE, &affinity_include_all_cmd); | |
3761 | install_element(ISIS_FLEX_ALGO_NODE, &affinity_exclude_any_cmd); | |
f46e34f8 HS |
3762 | install_element(ISIS_FLEX_ALGO_NODE, &dplane_sr_mpls_cmd); |
3763 | install_element(ISIS_FLEX_ALGO_NODE, &dplane_srv6_cmd); | |
3764 | install_element(ISIS_FLEX_ALGO_NODE, &dplane_ip_cmd); | |
46fb37cf HS |
3765 | install_element(ISIS_FLEX_ALGO_NODE, &prefix_metric_cmd); |
3766 | install_element(ISIS_FLEX_ALGO_NODE, &metric_type_cmd); | |
3767 | install_element(ISIS_FLEX_ALGO_NODE, &priority_cmd); | |
20bd27e2 EDP |
3768 | } |
3769 | ||
3770 | #endif /* ifndef FABRICD */ |