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