]>
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" | |
35 | #include "isisd/isis_cli.h" | |
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 | */ | |
49 | DEFPY_NOSH(router_isis, router_isis_cmd, "router isis WORD$tag", | |
50 | ROUTER_STR | |
51 | "ISO IS-IS\n" | |
52 | "ISO Routing area tag\n") | |
53 | { | |
54 | int ret; | |
55 | char base_xpath[XPATH_MAXLEN]; | |
56 | ||
57 | snprintf(base_xpath, XPATH_MAXLEN, | |
58 | "/frr-isisd:isis/instance[area-tag='%s']", tag); | |
59 | nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); | |
60 | /* default value in yang for is-type is level-1, but in FRR | |
61 | * the first instance is assigned is-type level-1-2. We | |
62 | * need to make sure to set it in the yang model so that it | |
63 | * is consistent with what FRR sees. | |
64 | */ | |
65 | if (listcount(isis->area_list) == 0) | |
66 | nb_cli_enqueue_change(vty, "./is-type", NB_OP_MODIFY, | |
67 | "level-1-2"); | |
68 | ret = nb_cli_apply_changes(vty, base_xpath); | |
69 | if (ret == CMD_SUCCESS) | |
70 | VTY_PUSH_XPATH(ISIS_NODE, base_xpath); | |
71 | ||
72 | return ret; | |
73 | } | |
74 | ||
75 | DEFPY(no_router_isis, no_router_isis_cmd, "no router isis WORD$tag", | |
76 | NO_STR ROUTER_STR | |
77 | "ISO IS-IS\n" | |
78 | "ISO Routing area tag\n") | |
79 | { | |
80 | char temp_xpath[XPATH_MAXLEN]; | |
81 | struct listnode *node, *nnode; | |
82 | struct isis_circuit *circuit = NULL; | |
83 | struct isis_area *area = NULL; | |
84 | ||
4ecc4b46 EDP |
85 | if (!yang_dnode_exists(vty->candidate_config->dnode, |
86 | "/frr-isisd:isis/instance[area-tag='%s']", | |
87 | tag)) { | |
aaf2fd21 EDP |
88 | vty_out(vty, "ISIS area %s not found.\n", tag); |
89 | return CMD_ERR_NOTHING_TODO; | |
90 | } | |
91 | ||
95ce849b | 92 | nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); |
4ecc4b46 EDP |
93 | area = isis_area_lookup(tag); |
94 | if (area && area->circuit_list && listcount(area->circuit_list)) { | |
aaf2fd21 EDP |
95 | for (ALL_LIST_ELEMENTS(area->circuit_list, node, nnode, |
96 | circuit)) { | |
97 | /* add callbacks to delete each of the circuits listed | |
98 | */ | |
99 | const char *vrf_name = | |
a41c4e1b | 100 | circuit->interface->vrf->name; |
aaf2fd21 EDP |
101 | snprintf( |
102 | temp_xpath, XPATH_MAXLEN, | |
103 | "/frr-interface:lib/interface[name='%s'][vrf='%s']/frr-isisd:isis", | |
104 | circuit->interface->name, vrf_name); | |
95ce849b | 105 | nb_cli_enqueue_change(vty, temp_xpath, NB_OP_DESTROY, |
aaf2fd21 EDP |
106 | NULL); |
107 | } | |
108 | } | |
109 | ||
110 | return nb_cli_apply_changes( | |
111 | vty, "/frr-isisd:isis/instance[area-tag='%s']", tag); | |
112 | } | |
113 | ||
114 | void cli_show_router_isis(struct vty *vty, struct lyd_node *dnode, | |
115 | bool show_defaults) | |
116 | { | |
117 | vty_out(vty, "!\n"); | |
118 | vty_out(vty, "router isis %s\n", | |
119 | yang_dnode_get_string(dnode, "./area-tag")); | |
120 | } | |
121 | ||
122 | /* | |
123 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/ | |
124 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv4-routing | |
125 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv6-routing | |
126 | * XPath: /frr-isisd:isis/instance | |
127 | */ | |
128 | DEFPY(ip_router_isis, ip_router_isis_cmd, "ip router isis WORD$tag", | |
129 | "Interface Internet Protocol config commands\n" | |
130 | "IP router interface commands\n" | |
131 | "IS-IS routing protocol\n" | |
132 | "Routing process tag\n") | |
133 | { | |
134 | char temp_xpath[XPATH_MAXLEN]; | |
135 | const char *circ_type; | |
136 | struct isis_area *area; | |
5f1e5e3f | 137 | struct interface *ifp; |
aaf2fd21 EDP |
138 | |
139 | /* area will be created if it is not present. make sure the yang model | |
140 | * is synced with FRR and call the appropriate NB cb. | |
141 | */ | |
142 | area = isis_area_lookup(tag); | |
143 | if (!area) { | |
144 | snprintf(temp_xpath, XPATH_MAXLEN, | |
145 | "/frr-isisd:isis/instance[area-tag='%s']", tag); | |
146 | nb_cli_enqueue_change(vty, temp_xpath, NB_OP_CREATE, tag); | |
147 | snprintf(temp_xpath, XPATH_MAXLEN, | |
148 | "/frr-isisd:isis/instance[area-tag='%s']/is-type", | |
149 | tag); | |
150 | nb_cli_enqueue_change( | |
151 | vty, temp_xpath, NB_OP_MODIFY, | |
152 | listcount(isis->area_list) == 0 ? "level-1-2" : NULL); | |
153 | nb_cli_enqueue_change(vty, "./frr-isisd:isis", NB_OP_CREATE, | |
154 | NULL); | |
155 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag", | |
156 | NB_OP_MODIFY, tag); | |
157 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv4-routing", | |
5f1e5e3f | 158 | NB_OP_MODIFY, "true"); |
aaf2fd21 EDP |
159 | nb_cli_enqueue_change( |
160 | vty, "./frr-isisd:isis/circuit-type", NB_OP_MODIFY, | |
161 | listcount(isis->area_list) == 0 ? "level-1-2" | |
162 | : "level-1"); | |
163 | } else { | |
164 | /* area exists, circuit type defaults to its area's is_type */ | |
165 | switch (area->is_type) { | |
166 | case IS_LEVEL_1: | |
167 | circ_type = "level-1"; | |
168 | break; | |
169 | case IS_LEVEL_2: | |
170 | circ_type = "level-2"; | |
171 | break; | |
172 | case IS_LEVEL_1_AND_2: | |
173 | circ_type = "level-1-2"; | |
174 | break; | |
8a5b2e10 EDP |
175 | default: |
176 | /* just to silence compiler warnings */ | |
177 | return CMD_WARNING_CONFIG_FAILED; | |
aaf2fd21 EDP |
178 | } |
179 | nb_cli_enqueue_change(vty, "./frr-isisd:isis", NB_OP_CREATE, | |
180 | NULL); | |
181 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag", | |
182 | NB_OP_MODIFY, tag); | |
183 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv4-routing", | |
5f1e5e3f | 184 | NB_OP_MODIFY, "true"); |
aaf2fd21 EDP |
185 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/circuit-type", |
186 | NB_OP_MODIFY, circ_type); | |
187 | } | |
188 | ||
5f1e5e3f | 189 | /* check if the interface is a loopback and if so set it as passive */ |
83981138 RW |
190 | pthread_rwlock_rdlock(&running_config->lock); |
191 | { | |
192 | ifp = nb_running_get_entry(NULL, VTY_CURR_XPATH, false); | |
193 | if (ifp && if_is_loopback(ifp)) | |
194 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive", | |
195 | NB_OP_MODIFY, "true"); | |
196 | } | |
197 | pthread_rwlock_unlock(&running_config->lock); | |
5f1e5e3f | 198 | |
aaf2fd21 EDP |
199 | return nb_cli_apply_changes(vty, NULL); |
200 | } | |
201 | ||
202 | DEFPY(ip6_router_isis, ip6_router_isis_cmd, "ipv6 router isis WORD$tag", | |
203 | "Interface Internet Protocol config commands\n" | |
204 | "IP router interface commands\n" | |
205 | "IS-IS routing protocol\n" | |
206 | "Routing process tag\n") | |
207 | { | |
208 | char temp_xpath[XPATH_MAXLEN]; | |
209 | const char *circ_type; | |
210 | struct isis_area *area; | |
5f1e5e3f | 211 | struct interface *ifp; |
aaf2fd21 EDP |
212 | |
213 | /* area will be created if it is not present. make sure the yang model | |
214 | * is synced with FRR and call the appropriate NB cb. | |
215 | */ | |
216 | area = isis_area_lookup(tag); | |
217 | if (!area) { | |
218 | snprintf(temp_xpath, XPATH_MAXLEN, | |
219 | "/frr-isisd:isis/instance[area-tag='%s']", tag); | |
220 | nb_cli_enqueue_change(vty, temp_xpath, NB_OP_CREATE, tag); | |
221 | snprintf(temp_xpath, XPATH_MAXLEN, | |
222 | "/frr-isisd:isis/instance[area-tag='%s']/is-type", | |
223 | tag); | |
224 | nb_cli_enqueue_change( | |
225 | vty, temp_xpath, NB_OP_MODIFY, | |
226 | listcount(isis->area_list) == 0 ? "level-1-2" : NULL); | |
227 | nb_cli_enqueue_change(vty, "./frr-isisd:isis", NB_OP_CREATE, | |
228 | NULL); | |
229 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag", | |
230 | NB_OP_MODIFY, tag); | |
231 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv6-routing", | |
5f1e5e3f | 232 | NB_OP_MODIFY, "true"); |
aaf2fd21 EDP |
233 | nb_cli_enqueue_change( |
234 | vty, "./frr-isisd:isis/circuit-type", NB_OP_MODIFY, | |
235 | listcount(isis->area_list) == 0 ? "level-1-2" | |
236 | : "level-1"); | |
237 | } else { | |
238 | /* area exists, circuit type defaults to its area's is_type */ | |
239 | switch (area->is_type) { | |
240 | case IS_LEVEL_1: | |
241 | circ_type = "level-1"; | |
242 | break; | |
243 | case IS_LEVEL_2: | |
244 | circ_type = "level-2"; | |
245 | break; | |
246 | case IS_LEVEL_1_AND_2: | |
247 | circ_type = "level-1-2"; | |
248 | break; | |
8a5b2e10 EDP |
249 | default: |
250 | /* just to silence compiler warnings */ | |
251 | return CMD_WARNING_CONFIG_FAILED; | |
aaf2fd21 EDP |
252 | } |
253 | nb_cli_enqueue_change(vty, "./frr-isisd:isis", NB_OP_CREATE, | |
254 | NULL); | |
255 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/area-tag", | |
256 | NB_OP_MODIFY, tag); | |
257 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/ipv6-routing", | |
5f1e5e3f | 258 | NB_OP_MODIFY, "true"); |
aaf2fd21 EDP |
259 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/circuit-type", |
260 | NB_OP_MODIFY, circ_type); | |
261 | } | |
262 | ||
5f1e5e3f | 263 | /* check if the interface is a loopback and if so set it as passive */ |
83981138 RW |
264 | pthread_rwlock_rdlock(&running_config->lock); |
265 | { | |
266 | ifp = nb_running_get_entry(NULL, VTY_CURR_XPATH, false); | |
267 | if (ifp && if_is_loopback(ifp)) | |
268 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive", | |
269 | NB_OP_MODIFY, "true"); | |
270 | } | |
271 | pthread_rwlock_unlock(&running_config->lock); | |
5f1e5e3f | 272 | |
aaf2fd21 EDP |
273 | return nb_cli_apply_changes(vty, NULL); |
274 | } | |
275 | ||
276 | DEFPY(no_ip_router_isis, no_ip_router_isis_cmd, | |
277 | "no <ip|ipv6>$ip router isis [WORD]$tag", | |
278 | NO_STR | |
279 | "Interface Internet Protocol config commands\n" | |
280 | "IP router interface commands\n" | |
281 | "IP router interface commands\n" | |
282 | "IS-IS routing protocol\n" | |
283 | "Routing process tag\n") | |
284 | { | |
472c3dae | 285 | const struct lyd_node *dnode; |
aaf2fd21 | 286 | |
472c3dae RW |
287 | dnode = yang_dnode_get(vty->candidate_config->dnode, |
288 | "%s/frr-isisd:isis", VTY_CURR_XPATH); | |
289 | if (!dnode) | |
290 | return CMD_SUCCESS; | |
291 | ||
292 | /* | |
293 | * If both ipv4 and ipv6 are off delete the interface isis container. | |
aaf2fd21 | 294 | */ |
472c3dae RW |
295 | if (strmatch(ip, "ipv6")) { |
296 | if (!yang_dnode_get_bool(dnode, "./ipv4-routing")) | |
aaf2fd21 | 297 | nb_cli_enqueue_change(vty, "./frr-isisd:isis", |
95ce849b | 298 | NB_OP_DESTROY, NULL); |
aaf2fd21 EDP |
299 | else |
300 | nb_cli_enqueue_change(vty, | |
301 | "./frr-isisd:isis/ipv6-routing", | |
5f1e5e3f | 302 | NB_OP_MODIFY, "false"); |
472c3dae RW |
303 | } else { |
304 | if (!yang_dnode_get_bool(dnode, "./ipv6-routing")) | |
aaf2fd21 | 305 | nb_cli_enqueue_change(vty, "./frr-isisd:isis", |
95ce849b | 306 | NB_OP_DESTROY, NULL); |
aaf2fd21 EDP |
307 | else |
308 | nb_cli_enqueue_change(vty, | |
309 | "./frr-isisd:isis/ipv4-routing", | |
5f1e5e3f | 310 | NB_OP_MODIFY, "false"); |
aaf2fd21 EDP |
311 | } |
312 | ||
313 | return nb_cli_apply_changes(vty, NULL); | |
314 | } | |
315 | ||
316 | void cli_show_ip_isis_ipv4(struct vty *vty, struct lyd_node *dnode, | |
317 | bool show_defaults) | |
318 | { | |
5f1e5e3f EDP |
319 | if (!yang_dnode_get_bool(dnode, NULL)) |
320 | vty_out(vty, " no"); | |
aaf2fd21 EDP |
321 | vty_out(vty, " ip router isis %s\n", |
322 | yang_dnode_get_string(dnode, "../area-tag")); | |
323 | } | |
324 | ||
325 | void cli_show_ip_isis_ipv6(struct vty *vty, struct lyd_node *dnode, | |
326 | bool show_defaults) | |
327 | { | |
5f1e5e3f EDP |
328 | if (!yang_dnode_get_bool(dnode, NULL)) |
329 | vty_out(vty, " no"); | |
aaf2fd21 EDP |
330 | vty_out(vty, " ipv6 router isis %s\n", |
331 | yang_dnode_get_string(dnode, "../area-tag")); | |
332 | } | |
333 | ||
f084ea55 EDP |
334 | /* |
335 | * XPath: /frr-isisd:isis/instance/area-address | |
336 | */ | |
337 | DEFPY(net, net_cmd, "[no] net WORD", | |
338 | "Remove an existing Network Entity Title for this process\n" | |
339 | "A Network Entity Title for this process (OSI only)\n" | |
340 | "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") | |
341 | { | |
342 | nb_cli_enqueue_change(vty, "./area-address", | |
95ce849b | 343 | no ? NB_OP_DESTROY : NB_OP_CREATE, net); |
f084ea55 EDP |
344 | |
345 | return nb_cli_apply_changes(vty, NULL); | |
346 | } | |
347 | ||
348 | void cli_show_isis_area_address(struct vty *vty, struct lyd_node *dnode, | |
349 | bool show_defaults) | |
350 | { | |
351 | vty_out(vty, " net %s\n", yang_dnode_get_string(dnode, NULL)); | |
352 | } | |
353 | ||
e6bdae69 EDP |
354 | /* |
355 | * XPath: /frr-isisd:isis/instance/is-type | |
356 | */ | |
357 | DEFPY(is_type, is_type_cmd, "is-type <level-1|level-1-2|level-2-only>$level", | |
358 | "IS Level for this routing process (OSI only)\n" | |
359 | "Act as a station router only\n" | |
360 | "Act as both a station router and an area router\n" | |
361 | "Act as an area router only\n") | |
362 | { | |
363 | nb_cli_enqueue_change(vty, "./is-type", NB_OP_MODIFY, | |
364 | strmatch(level, "level-2-only") ? "level-2" | |
365 | : level); | |
366 | ||
367 | return nb_cli_apply_changes(vty, NULL); | |
368 | } | |
369 | ||
370 | DEFPY(no_is_type, no_is_type_cmd, | |
371 | "no is-type [<level-1|level-1-2|level-2-only>]", | |
372 | NO_STR | |
373 | "IS Level for this routing process (OSI only)\n" | |
374 | "Act as a station router only\n" | |
375 | "Act as both a station router and an area router\n" | |
376 | "Act as an area router only\n") | |
377 | { | |
83981138 | 378 | const char *value; |
ccd43ada | 379 | |
83981138 RW |
380 | pthread_rwlock_rdlock(&running_config->lock); |
381 | { | |
382 | struct isis_area *area; | |
383 | ||
384 | area = nb_running_get_entry(NULL, VTY_CURR_XPATH, false); | |
385 | ||
386 | /* | |
387 | * Put the is-type back to defaults: | |
388 | * - level-1-2 on first area | |
389 | * - level-1 for the rest | |
390 | */ | |
391 | if (area && listgetdata(listhead(isis->area_list)) == area) | |
392 | value = "level-1-2"; | |
393 | else | |
394 | value = NULL; | |
395 | } | |
396 | pthread_rwlock_unlock(&running_config->lock); | |
e6bdae69 | 397 | |
e6bdae69 EDP |
398 | nb_cli_enqueue_change(vty, "./is-type", NB_OP_MODIFY, value); |
399 | ||
400 | return nb_cli_apply_changes(vty, NULL); | |
401 | } | |
402 | ||
403 | void cli_show_isis_is_type(struct vty *vty, struct lyd_node *dnode, | |
404 | bool show_defaults) | |
405 | { | |
406 | int is_type = yang_dnode_get_enum(dnode, NULL); | |
407 | ||
408 | switch (is_type) { | |
409 | case IS_LEVEL_1: | |
410 | vty_out(vty, " is-type level-1\n"); | |
411 | break; | |
412 | case IS_LEVEL_2: | |
413 | vty_out(vty, " is-type level-2-only\n"); | |
414 | break; | |
415 | case IS_LEVEL_1_AND_2: | |
416 | vty_out(vty, " is-type level-1-2\n"); | |
417 | break; | |
418 | } | |
419 | } | |
420 | ||
6bb043cd EDP |
421 | /* |
422 | * XPath: /frr-isisd:isis/instance/dynamic-hostname | |
423 | */ | |
424 | DEFPY(dynamic_hostname, dynamic_hostname_cmd, "[no] hostname dynamic", | |
425 | NO_STR | |
426 | "Dynamic hostname for IS-IS\n" | |
427 | "Dynamic hostname\n") | |
428 | { | |
429 | nb_cli_enqueue_change(vty, "./dynamic-hostname", NB_OP_MODIFY, | |
430 | no ? "false" : "true"); | |
431 | ||
432 | return nb_cli_apply_changes(vty, NULL); | |
433 | } | |
434 | ||
435 | void cli_show_isis_dynamic_hostname(struct vty *vty, struct lyd_node *dnode, | |
436 | bool show_defaults) | |
437 | { | |
438 | if (!yang_dnode_get_bool(dnode, NULL)) | |
439 | vty_out(vty, " no"); | |
440 | ||
441 | vty_out(vty, " hostname dynamic\n"); | |
442 | } | |
443 | ||
05a3f9f0 EDP |
444 | /* |
445 | * XPath: /frr-isisd:isis/instance/overload | |
446 | */ | |
447 | DEFPY(set_overload_bit, set_overload_bit_cmd, "[no] set-overload-bit", | |
448 | "Reset overload bit to accept transit traffic\n" | |
449 | "Set overload bit to avoid any transit traffic\n") | |
450 | { | |
5f1e5e3f EDP |
451 | nb_cli_enqueue_change(vty, "./overload", NB_OP_MODIFY, |
452 | no ? "false" : "true"); | |
05a3f9f0 EDP |
453 | |
454 | return nb_cli_apply_changes(vty, NULL); | |
455 | } | |
456 | ||
457 | void cli_show_isis_overload(struct vty *vty, struct lyd_node *dnode, | |
458 | bool show_defaults) | |
459 | { | |
5f1e5e3f EDP |
460 | if (!yang_dnode_get_bool(dnode, NULL)) |
461 | vty_out(vty, " no"); | |
05a3f9f0 EDP |
462 | vty_out(vty, " set-overload-bit\n"); |
463 | } | |
464 | ||
465 | /* | |
466 | * XPath: /frr-isisd:isis/instance/attached | |
467 | */ | |
468 | DEFPY(set_attached_bit, set_attached_bit_cmd, "[no] set-attached-bit", | |
469 | "Reset attached bit\n" | |
470 | "Set attached bit to identify as L1/L2 router for inter-area traffic\n") | |
471 | { | |
5f1e5e3f EDP |
472 | nb_cli_enqueue_change(vty, "./attached", NB_OP_MODIFY, |
473 | no ? "false" : "true"); | |
05a3f9f0 EDP |
474 | |
475 | return nb_cli_apply_changes(vty, NULL); | |
476 | } | |
477 | ||
478 | void cli_show_isis_attached(struct vty *vty, struct lyd_node *dnode, | |
479 | bool show_defaults) | |
480 | { | |
5f1e5e3f EDP |
481 | if (!yang_dnode_get_bool(dnode, NULL)) |
482 | vty_out(vty, " no"); | |
05a3f9f0 EDP |
483 | vty_out(vty, " set-attached-bit\n"); |
484 | } | |
485 | ||
e0df3206 EDP |
486 | /* |
487 | * XPath: /frr-isisd:isis/instance/metric-style | |
488 | */ | |
489 | DEFPY(metric_style, metric_style_cmd, | |
f34ab52d | 490 | "metric-style <narrow|transition|wide>$style", |
e0df3206 EDP |
491 | "Use old-style (ISO 10589) or new-style packet formats\n" |
492 | "Use old style of TLVs with narrow metric\n" | |
493 | "Send and accept both styles of TLVs during transition\n" | |
494 | "Use new style of TLVs to carry wider metric\n") | |
495 | { | |
496 | nb_cli_enqueue_change(vty, "./metric-style", NB_OP_MODIFY, style); | |
497 | ||
498 | return nb_cli_apply_changes(vty, NULL); | |
499 | } | |
500 | ||
501 | DEFPY(no_metric_style, no_metric_style_cmd, | |
f34ab52d EDP |
502 | "no metric-style [narrow|transition|wide]", |
503 | NO_STR | |
504 | "Use old-style (ISO 10589) or new-style packet formats\n" | |
e0df3206 EDP |
505 | "Use old style of TLVs with narrow metric\n" |
506 | "Send and accept both styles of TLVs during transition\n" | |
507 | "Use new style of TLVs to carry wider metric\n") | |
508 | { | |
509 | nb_cli_enqueue_change(vty, "./metric-style", NB_OP_MODIFY, "narrow"); | |
510 | ||
511 | return nb_cli_apply_changes(vty, NULL); | |
512 | } | |
513 | ||
514 | void cli_show_isis_metric_style(struct vty *vty, struct lyd_node *dnode, | |
515 | bool show_defaults) | |
516 | { | |
517 | int metric = yang_dnode_get_enum(dnode, NULL); | |
518 | ||
519 | switch (metric) { | |
520 | case ISIS_NARROW_METRIC: | |
521 | vty_out(vty, " metric-style narrow\n"); | |
522 | break; | |
523 | case ISIS_WIDE_METRIC: | |
524 | vty_out(vty, " metric-style wide\n"); | |
525 | break; | |
526 | case ISIS_TRANSITION_METRIC: | |
527 | vty_out(vty, " metric-style transition\n"); | |
528 | break; | |
529 | } | |
530 | } | |
531 | ||
933536e3 EDP |
532 | /* |
533 | * XPath: /frr-isisd:isis/instance/area-password | |
534 | */ | |
535 | DEFPY(area_passwd, area_passwd_cmd, | |
536 | "area-password <clear|md5>$pwd_type WORD$pwd [authenticate snp <send-only|validate>$snp]", | |
537 | "Configure the authentication password for an area\n" | |
538 | "Clear-text authentication type\n" | |
539 | "MD5 authentication type\n" | |
540 | "Level-wide password\n" | |
541 | "Authentication\n" | |
542 | "SNP PDUs\n" | |
543 | "Send but do not check PDUs on receiving\n" | |
544 | "Send and check PDUs on receiving\n") | |
545 | { | |
546 | nb_cli_enqueue_change(vty, "./area-password", NB_OP_CREATE, NULL); | |
547 | nb_cli_enqueue_change(vty, "./area-password/password", NB_OP_MODIFY, | |
548 | pwd); | |
549 | nb_cli_enqueue_change(vty, "./area-password/password-type", | |
550 | NB_OP_MODIFY, pwd_type); | |
551 | nb_cli_enqueue_change(vty, "./area-password/authenticate-snp", | |
552 | NB_OP_MODIFY, snp ? snp : "none"); | |
553 | ||
554 | return nb_cli_apply_changes(vty, NULL); | |
555 | } | |
556 | ||
557 | void cli_show_isis_area_pwd(struct vty *vty, struct lyd_node *dnode, | |
558 | bool show_defaults) | |
559 | { | |
560 | const char *snp; | |
561 | ||
562 | vty_out(vty, " area-password %s %s", | |
563 | yang_dnode_get_string(dnode, "./password-type"), | |
564 | yang_dnode_get_string(dnode, "./password")); | |
565 | snp = yang_dnode_get_string(dnode, "./authenticate-snp"); | |
566 | if (!strmatch("none", snp)) | |
567 | vty_out(vty, " authenticate snp %s", snp); | |
568 | vty_out(vty, "\n"); | |
569 | } | |
570 | ||
571 | /* | |
572 | * XPath: /frr-isisd:isis/instance/domain-password | |
573 | */ | |
574 | DEFPY(domain_passwd, domain_passwd_cmd, | |
575 | "domain-password <clear|md5>$pwd_type WORD$pwd [authenticate snp <send-only|validate>$snp]", | |
576 | "Set the authentication password for a routing domain\n" | |
577 | "Clear-text authentication type\n" | |
578 | "MD5 authentication type\n" | |
579 | "Level-wide password\n" | |
580 | "Authentication\n" | |
581 | "SNP PDUs\n" | |
582 | "Send but do not check PDUs on receiving\n" | |
583 | "Send and check PDUs on receiving\n") | |
584 | { | |
585 | nb_cli_enqueue_change(vty, "./domain-password", NB_OP_CREATE, NULL); | |
586 | nb_cli_enqueue_change(vty, "./domain-password/password", NB_OP_MODIFY, | |
587 | pwd); | |
588 | nb_cli_enqueue_change(vty, "./domain-password/password-type", | |
589 | NB_OP_MODIFY, pwd_type); | |
590 | nb_cli_enqueue_change(vty, "./domain-password/authenticate-snp", | |
591 | NB_OP_MODIFY, snp ? snp : "none"); | |
592 | ||
593 | return nb_cli_apply_changes(vty, NULL); | |
594 | } | |
595 | ||
596 | DEFPY(no_area_passwd, no_area_passwd_cmd, | |
597 | "no <area-password|domain-password>$cmd", | |
598 | NO_STR | |
599 | "Configure the authentication password for an area\n" | |
600 | "Set the authentication password for a routing domain\n") | |
601 | { | |
95ce849b | 602 | nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); |
933536e3 EDP |
603 | |
604 | return nb_cli_apply_changes(vty, "./%s", cmd); | |
605 | } | |
606 | ||
607 | void cli_show_isis_domain_pwd(struct vty *vty, struct lyd_node *dnode, | |
608 | bool show_defaults) | |
609 | { | |
610 | const char *snp; | |
611 | ||
612 | vty_out(vty, " domain-password %s %s", | |
613 | yang_dnode_get_string(dnode, "./password-type"), | |
614 | yang_dnode_get_string(dnode, "./password")); | |
615 | snp = yang_dnode_get_string(dnode, "./authenticate-snp"); | |
616 | if (!strmatch("none", snp)) | |
617 | vty_out(vty, " authenticate snp %s", snp); | |
618 | vty_out(vty, "\n"); | |
619 | } | |
620 | ||
1d6fe72e EDP |
621 | /* |
622 | * XPath: /frr-isisd:isis/instance/lsp/generation-interval | |
623 | */ | |
624 | DEFPY(lsp_gen_interval, lsp_gen_interval_cmd, | |
625 | "lsp-gen-interval [level-1|level-2]$level (1-120)$val", | |
626 | "Minimum interval between regenerating same LSP\n" | |
627 | "Set interval for level 1 only\n" | |
628 | "Set interval for level 2 only\n" | |
629 | "Minimum interval in seconds\n") | |
630 | { | |
631 | if (!level || strmatch(level, "level-1")) | |
632 | nb_cli_enqueue_change(vty, "./lsp/generation-interval/level-1", | |
633 | NB_OP_MODIFY, val_str); | |
634 | if (!level || strmatch(level, "level-2")) | |
635 | nb_cli_enqueue_change(vty, "./lsp/generation-interval/level-2", | |
636 | NB_OP_MODIFY, val_str); | |
637 | ||
638 | return nb_cli_apply_changes(vty, NULL); | |
639 | } | |
640 | ||
641 | DEFPY(no_lsp_gen_interval, no_lsp_gen_interval_cmd, | |
642 | "no lsp-gen-interval [level-1|level-2]$level [(1-120)]", | |
643 | NO_STR | |
644 | "Minimum interval between regenerating same LSP\n" | |
645 | "Set interval for level 1 only\n" | |
646 | "Set interval for level 2 only\n" | |
647 | "Minimum interval in seconds\n") | |
648 | { | |
649 | if (!level || strmatch(level, "level-1")) | |
650 | nb_cli_enqueue_change(vty, "./lsp/generation-interval/level-1", | |
651 | NB_OP_MODIFY, NULL); | |
652 | if (!level || strmatch(level, "level-2")) | |
653 | nb_cli_enqueue_change(vty, "./lsp/generation-interval/level-2", | |
654 | NB_OP_MODIFY, NULL); | |
655 | ||
656 | return nb_cli_apply_changes(vty, NULL); | |
657 | } | |
658 | ||
659 | void cli_show_isis_lsp_gen_interval(struct vty *vty, struct lyd_node *dnode, | |
660 | bool show_defaults) | |
661 | { | |
662 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
663 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
664 | ||
665 | if (strmatch(l1, l2)) | |
666 | vty_out(vty, " lsp-gen-interval %s\n", l1); | |
667 | else { | |
668 | vty_out(vty, " lsp-gen-interval level-1 %s\n", l1); | |
669 | vty_out(vty, " lsp-gen-interval level-2 %s\n", l2); | |
670 | } | |
671 | } | |
672 | ||
7e869004 EDP |
673 | /* |
674 | * XPath: /frr-isisd:isis/instance/lsp/refresh-interval | |
675 | */ | |
676 | DEFPY(lsp_refresh_interval, lsp_refresh_interval_cmd, | |
677 | "lsp-refresh-interval [level-1|level-2]$level (1-65235)$val", | |
678 | "LSP refresh interval\n" | |
679 | "LSP refresh interval for Level 1 only\n" | |
680 | "LSP refresh interval for Level 2 only\n" | |
681 | "LSP refresh interval in seconds\n") | |
682 | { | |
683 | if (!level || strmatch(level, "level-1")) | |
684 | nb_cli_enqueue_change(vty, "./lsp/refresh-interval/level-1", | |
685 | NB_OP_MODIFY, val_str); | |
686 | if (!level || strmatch(level, "level-2")) | |
687 | nb_cli_enqueue_change(vty, "./lsp/refresh-interval/level-2", | |
688 | NB_OP_MODIFY, val_str); | |
689 | ||
690 | return nb_cli_apply_changes(vty, NULL); | |
691 | } | |
692 | ||
693 | DEFPY(no_lsp_refresh_interval, no_lsp_refresh_interval_cmd, | |
694 | "no lsp-refresh-interval [level-1|level-2]$level [(1-65235)]", | |
695 | NO_STR | |
696 | "LSP refresh interval\n" | |
697 | "LSP refresh interval for Level 1 only\n" | |
698 | "LSP refresh interval for Level 2 only\n" | |
699 | "LSP refresh interval in seconds\n") | |
700 | { | |
701 | if (!level || strmatch(level, "level-1")) | |
702 | nb_cli_enqueue_change(vty, "./lsp/refresh-interval/level-1", | |
703 | NB_OP_MODIFY, NULL); | |
704 | if (!level || strmatch(level, "level-2")) | |
705 | nb_cli_enqueue_change(vty, "./lsp/refresh-interval/level-2", | |
706 | NB_OP_MODIFY, NULL); | |
707 | ||
708 | return nb_cli_apply_changes(vty, NULL); | |
709 | } | |
710 | ||
711 | void cli_show_isis_lsp_ref_interval(struct vty *vty, struct lyd_node *dnode, | |
712 | bool show_defaults) | |
713 | { | |
714 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
715 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
716 | ||
717 | if (strmatch(l1, l2)) | |
718 | vty_out(vty, " lsp-refresh-interval %s\n", l1); | |
719 | else { | |
720 | vty_out(vty, " lsp-refresh-interval level-1 %s\n", l1); | |
721 | vty_out(vty, " lsp-refresh-interval level-2 %s\n", l2); | |
722 | } | |
723 | } | |
724 | ||
ea120aa0 EDP |
725 | /* |
726 | * XPath: /frr-isisd:isis/instance/lsp/maximum-lifetime | |
727 | */ | |
728 | DEFPY(max_lsp_lifetime, max_lsp_lifetime_cmd, | |
729 | "max-lsp-lifetime [level-1|level-2]$level (350-65535)$val", | |
730 | "Maximum LSP lifetime\n" | |
731 | "Maximum LSP lifetime for Level 1 only\n" | |
732 | "Maximum LSP lifetime for Level 2 only\n" | |
733 | "LSP lifetime in seconds\n") | |
734 | { | |
735 | if (!level || strmatch(level, "level-1")) | |
736 | nb_cli_enqueue_change(vty, "./lsp/maximum-lifetime/level-1", | |
737 | NB_OP_MODIFY, val_str); | |
738 | if (!level || strmatch(level, "level-2")) | |
739 | nb_cli_enqueue_change(vty, "./lsp/maximum-lifetime/level-2", | |
740 | NB_OP_MODIFY, val_str); | |
741 | ||
742 | return nb_cli_apply_changes(vty, NULL); | |
743 | } | |
744 | ||
745 | DEFPY(no_max_lsp_lifetime, no_max_lsp_lifetime_cmd, | |
746 | "no max-lsp-lifetime [level-1|level-2]$level [(350-65535)]", | |
747 | NO_STR | |
748 | "Maximum LSP lifetime\n" | |
749 | "Maximum LSP lifetime for Level 1 only\n" | |
750 | "Maximum LSP lifetime for Level 2 only\n" | |
751 | "LSP lifetime in seconds\n") | |
752 | { | |
753 | if (!level || strmatch(level, "level-1")) | |
754 | nb_cli_enqueue_change(vty, "./lsp/maximum-lifetime/level-1", | |
755 | NB_OP_MODIFY, NULL); | |
756 | if (!level || strmatch(level, "level-2")) | |
757 | nb_cli_enqueue_change(vty, "./lsp/maximum-lifetime/level-2", | |
758 | NB_OP_MODIFY, NULL); | |
759 | ||
760 | return nb_cli_apply_changes(vty, NULL); | |
761 | } | |
762 | ||
763 | void cli_show_isis_lsp_max_lifetime(struct vty *vty, struct lyd_node *dnode, | |
764 | bool show_defaults) | |
765 | { | |
766 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
767 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
768 | ||
769 | if (strmatch(l1, l2)) | |
770 | vty_out(vty, " max-lsp-lifetime %s\n", l1); | |
771 | else { | |
772 | vty_out(vty, " max-lsp-lifetime level-1 %s\n", l1); | |
773 | vty_out(vty, " max-lsp-lifetime level-2 %s\n", l2); | |
774 | } | |
775 | } | |
776 | ||
27a45d16 EDP |
777 | /* |
778 | * XPath: /frr-isisd:isis/instance/lsp/mtu | |
779 | */ | |
780 | DEFPY(area_lsp_mtu, area_lsp_mtu_cmd, "lsp-mtu (128-4352)$val", | |
781 | "Configure the maximum size of generated LSPs\n" | |
782 | "Maximum size of generated LSPs\n") | |
783 | { | |
784 | nb_cli_enqueue_change(vty, "./lsp/mtu", NB_OP_MODIFY, val_str); | |
785 | ||
786 | return nb_cli_apply_changes(vty, NULL); | |
787 | } | |
788 | ||
789 | DEFPY(no_area_lsp_mtu, no_area_lsp_mtu_cmd, "no lsp-mtu [(128-4352)]", | |
790 | NO_STR | |
791 | "Configure the maximum size of generated LSPs\n" | |
792 | "Maximum size of generated LSPs\n") | |
793 | { | |
794 | nb_cli_enqueue_change(vty, "./lsp/mtu", NB_OP_MODIFY, NULL); | |
795 | ||
796 | return nb_cli_apply_changes(vty, NULL); | |
797 | } | |
798 | ||
799 | void cli_show_isis_lsp_mtu(struct vty *vty, struct lyd_node *dnode, | |
800 | bool show_defaults) | |
801 | { | |
802 | vty_out(vty, " lsp-mtu %s\n", yang_dnode_get_string(dnode, NULL)); | |
803 | } | |
804 | ||
dcb1dcd6 EDP |
805 | /* |
806 | * XPath: /frr-isisd:isis/instance/spf/minimum-interval | |
807 | */ | |
808 | DEFPY(spf_interval, spf_interval_cmd, | |
809 | "spf-interval [level-1|level-2]$level (1-120)$val", | |
810 | "Minimum interval between SPF calculations\n" | |
811 | "Set interval for level 1 only\n" | |
812 | "Set interval for level 2 only\n" | |
813 | "Minimum interval between consecutive SPFs in seconds\n") | |
814 | { | |
815 | if (!level || strmatch(level, "level-1")) | |
816 | nb_cli_enqueue_change(vty, "./spf/minimum-interval/level-1", | |
817 | NB_OP_MODIFY, val_str); | |
818 | if (!level || strmatch(level, "level-2")) | |
819 | nb_cli_enqueue_change(vty, "./spf/minimum-interval/level-2", | |
820 | NB_OP_MODIFY, val_str); | |
821 | ||
822 | return nb_cli_apply_changes(vty, NULL); | |
823 | } | |
824 | ||
825 | DEFPY(no_spf_interval, no_spf_interval_cmd, | |
826 | "no spf-interval [level-1|level-2]$level [(1-120)]", | |
827 | NO_STR | |
828 | "Minimum interval between SPF calculations\n" | |
829 | "Set interval for level 1 only\n" | |
830 | "Set interval for level 2 only\n" | |
831 | "Minimum interval between consecutive SPFs in seconds\n") | |
832 | { | |
833 | if (!level || strmatch(level, "level-1")) | |
834 | nb_cli_enqueue_change(vty, "./spf/minimum-interval/level-1", | |
835 | NB_OP_MODIFY, NULL); | |
836 | if (!level || strmatch(level, "level-2")) | |
837 | nb_cli_enqueue_change(vty, "./spf/minimum-interval/level-2", | |
838 | NB_OP_MODIFY, NULL); | |
839 | ||
840 | return nb_cli_apply_changes(vty, NULL); | |
841 | } | |
842 | ||
843 | void cli_show_isis_spf_min_interval(struct vty *vty, struct lyd_node *dnode, | |
844 | bool show_defaults) | |
845 | { | |
846 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
847 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
848 | ||
849 | if (strmatch(l1, l2)) | |
850 | vty_out(vty, " spf-interval %s\n", l1); | |
851 | else { | |
852 | vty_out(vty, " spf-interval level-1 %s\n", l1); | |
853 | vty_out(vty, " spf-interval level-2 %s\n", l2); | |
854 | } | |
855 | } | |
856 | ||
5336ba30 EDP |
857 | /* |
858 | * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay | |
859 | */ | |
860 | DEFPY(spf_delay_ietf, spf_delay_ietf_cmd, | |
861 | "spf-delay-ietf init-delay (0-60000) short-delay (0-60000) long-delay (0-60000) holddown (0-60000) time-to-learn (0-60000)", | |
862 | "IETF SPF delay algorithm\n" | |
863 | "Delay used while in QUIET state\n" | |
864 | "Delay used while in QUIET state in milliseconds\n" | |
865 | "Delay used while in SHORT_WAIT state\n" | |
866 | "Delay used while in SHORT_WAIT state in milliseconds\n" | |
867 | "Delay used while in LONG_WAIT\n" | |
868 | "Delay used while in LONG_WAIT state in milliseconds\n" | |
869 | "Time with no received IGP events before considering IGP stable\n" | |
870 | "Time with no received IGP events before considering IGP stable (in milliseconds)\n" | |
871 | "Maximum duration needed to learn all the events related to a single failure\n" | |
872 | "Maximum duration needed to learn all the events related to a single failure (in milliseconds)\n") | |
873 | { | |
874 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay", NB_OP_CREATE, | |
875 | NULL); | |
876 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/init-delay", | |
877 | NB_OP_MODIFY, init_delay_str); | |
878 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/short-delay", | |
879 | NB_OP_MODIFY, short_delay_str); | |
880 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/long-delay", | |
881 | NB_OP_MODIFY, long_delay_str); | |
882 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/hold-down", | |
883 | NB_OP_MODIFY, holddown_str); | |
884 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/time-to-learn", | |
885 | NB_OP_MODIFY, time_to_learn_str); | |
886 | ||
887 | return nb_cli_apply_changes(vty, NULL); | |
888 | } | |
889 | ||
890 | DEFPY(no_spf_delay_ietf, no_spf_delay_ietf_cmd, | |
891 | "no spf-delay-ietf [init-delay (0-60000) short-delay (0-60000) long-delay (0-60000) holddown (0-60000) time-to-learn (0-60000)]", | |
892 | NO_STR | |
f34ab52d | 893 | "IETF SPF delay algorithm\n" |
5336ba30 EDP |
894 | "Delay used while in QUIET state\n" |
895 | "Delay used while in QUIET state in milliseconds\n" | |
896 | "Delay used while in SHORT_WAIT state\n" | |
897 | "Delay used while in SHORT_WAIT state in milliseconds\n" | |
898 | "Delay used while in LONG_WAIT\n" | |
899 | "Delay used while in LONG_WAIT state in milliseconds\n" | |
900 | "Time with no received IGP events before considering IGP stable\n" | |
901 | "Time with no received IGP events before considering IGP stable (in milliseconds)\n" | |
902 | "Maximum duration needed to learn all the events related to a single failure\n" | |
903 | "Maximum duration needed to learn all the events related to a single failure (in milliseconds)\n") | |
904 | { | |
95ce849b | 905 | nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay", NB_OP_DESTROY, |
5336ba30 EDP |
906 | NULL); |
907 | ||
908 | return nb_cli_apply_changes(vty, NULL); | |
909 | } | |
910 | ||
911 | void cli_show_isis_spf_ietf_backoff(struct vty *vty, struct lyd_node *dnode, | |
912 | bool show_defaults) | |
913 | { | |
914 | vty_out(vty, | |
915 | " spf-delay-ietf init-delay %s short-delay %s long-delay %s holddown %s time-to-learn %s\n", | |
916 | yang_dnode_get_string(dnode, "./init-delay"), | |
917 | yang_dnode_get_string(dnode, "./short-delay"), | |
918 | yang_dnode_get_string(dnode, "./long-delay"), | |
919 | yang_dnode_get_string(dnode, "./hold-down"), | |
920 | yang_dnode_get_string(dnode, "./time-to-learn")); | |
921 | } | |
922 | ||
66e45e10 EDP |
923 | /* |
924 | * XPath: /frr-isisd:isis/instance/purge-originator | |
925 | */ | |
926 | DEFPY(area_purge_originator, area_purge_originator_cmd, "[no] purge-originator", | |
927 | NO_STR "Use the RFC 6232 purge-originator\n") | |
928 | { | |
5f1e5e3f EDP |
929 | nb_cli_enqueue_change(vty, "./purge-originator", NB_OP_MODIFY, |
930 | no ? "false" : "true"); | |
66e45e10 EDP |
931 | |
932 | return nb_cli_apply_changes(vty, NULL); | |
933 | } | |
934 | ||
935 | void cli_show_isis_purge_origin(struct vty *vty, struct lyd_node *dnode, | |
936 | bool show_defaults) | |
937 | { | |
5f1e5e3f EDP |
938 | if (!yang_dnode_get_bool(dnode, NULL)) |
939 | vty_out(vty, " no"); | |
66e45e10 EDP |
940 | vty_out(vty, " purge-originator\n"); |
941 | } | |
942 | ||
d1a80ef6 | 943 | /* |
2e2a8b91 | 944 | * XPath: /frr-isisd:isis/instance/mpls-te |
d1a80ef6 EDP |
945 | */ |
946 | DEFPY(isis_mpls_te_on, isis_mpls_te_on_cmd, "mpls-te on", | |
947 | MPLS_TE_STR "Enable the MPLS-TE functionality\n") | |
948 | { | |
2e2a8b91 | 949 | nb_cli_enqueue_change(vty, "./mpls-te", NB_OP_CREATE, |
d1a80ef6 EDP |
950 | NULL); |
951 | ||
952 | return nb_cli_apply_changes(vty, NULL); | |
953 | } | |
954 | ||
955 | DEFPY(no_isis_mpls_te_on, no_isis_mpls_te_on_cmd, "no mpls-te [on]", | |
956 | NO_STR | |
957 | "Disable the MPLS-TE functionality\n" | |
2e2a8b91 | 958 | "Disable the MPLS-TE functionality\n") |
d1a80ef6 | 959 | { |
2e2a8b91 | 960 | nb_cli_enqueue_change(vty, "./mpls-te", NB_OP_DESTROY, |
d1a80ef6 EDP |
961 | NULL); |
962 | ||
963 | return nb_cli_apply_changes(vty, NULL); | |
964 | } | |
965 | ||
966 | void cli_show_isis_mpls_te(struct vty *vty, struct lyd_node *dnode, | |
967 | bool show_defaults) | |
968 | { | |
969 | vty_out(vty, " mpls-te on\n"); | |
970 | } | |
971 | ||
972 | /* | |
2e2a8b91 | 973 | * XPath: /frr-isisd:isis/instance/mpls-te/router-address |
d1a80ef6 EDP |
974 | */ |
975 | DEFPY(isis_mpls_te_router_addr, isis_mpls_te_router_addr_cmd, | |
976 | "mpls-te router-address A.B.C.D", | |
977 | MPLS_TE_STR | |
978 | "Stable IP address of the advertising router\n" | |
979 | "MPLS-TE router address in IPv4 address format\n") | |
980 | { | |
2e2a8b91 | 981 | nb_cli_enqueue_change(vty, "./mpls-te/router-address", |
d1a80ef6 EDP |
982 | NB_OP_MODIFY, router_address_str); |
983 | ||
984 | return nb_cli_apply_changes(vty, NULL); | |
985 | } | |
986 | ||
2e2a8b91 OD |
987 | DEFPY(no_isis_mpls_te_router_addr, no_isis_mpls_te_router_addr_cmd, |
988 | "no mpls-te router-address [A.B.C.D]", | |
989 | NO_STR MPLS_TE_STR | |
990 | "Delete IP address of the advertising router\n" | |
991 | "MPLS-TE router address in IPv4 address format\n") | |
992 | { | |
993 | nb_cli_enqueue_change(vty, "./mpls-te/router-address", | |
994 | NB_OP_DESTROY, NULL); | |
995 | ||
996 | return nb_cli_apply_changes(vty, NULL); | |
997 | } | |
998 | ||
d1a80ef6 EDP |
999 | void cli_show_isis_mpls_te_router_addr(struct vty *vty, struct lyd_node *dnode, |
1000 | bool show_defaults) | |
1001 | { | |
1002 | vty_out(vty, " mpls-te router-address %s\n", | |
1003 | yang_dnode_get_string(dnode, NULL)); | |
1004 | } | |
1005 | ||
1006 | DEFPY(isis_mpls_te_inter_as, isis_mpls_te_inter_as_cmd, | |
1007 | "[no] mpls-te inter-as [level-1|level-1-2|level-2-only]", | |
1008 | NO_STR MPLS_TE_STR | |
1009 | "Configure MPLS-TE Inter-AS support\n" | |
1010 | "AREA native mode self originate INTER-AS LSP with L1 only flooding scope\n" | |
1011 | "AREA native mode self originate INTER-AS LSP with L1 and L2 flooding scope\n" | |
1012 | "AS native mode self originate INTER-AS LSP with L2 only flooding scope\n") | |
1013 | { | |
2e2a8b91 | 1014 | vty_out(vty, "MPLS-TE Inter-AS is not yet supported\n"); |
d1a80ef6 EDP |
1015 | return CMD_SUCCESS; |
1016 | } | |
1017 | ||
8b104c10 EDP |
1018 | /* |
1019 | * XPath: /frr-isisd:isis/instance/default-information-originate | |
1020 | */ | |
1021 | DEFPY(isis_default_originate, isis_default_originate_cmd, | |
1022 | "[no] default-information originate <ipv4|ipv6>$ip" | |
1023 | " <level-1|level-2>$level [always]$always" | |
82c25998 | 1024 | " [{metric (0-16777215)$metric|route-map WORD$rmap}]", |
8b104c10 EDP |
1025 | NO_STR |
1026 | "Control distribution of default information\n" | |
1027 | "Distribute a default route\n" | |
1028 | "Distribute default route for IPv4\n" | |
1029 | "Distribute default route for IPv6\n" | |
1030 | "Distribute default route into level-1\n" | |
1031 | "Distribute default route into level-2\n" | |
1032 | "Always advertise default route\n" | |
1033 | "Metric for default route\n" | |
1034 | "ISIS default metric\n" | |
1035 | "Route map reference\n" | |
1036 | "Pointer to route-map entries\n") | |
1037 | { | |
1038 | if (no) | |
95ce849b | 1039 | nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); |
8b104c10 EDP |
1040 | else { |
1041 | nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); | |
5f1e5e3f EDP |
1042 | nb_cli_enqueue_change(vty, "./always", NB_OP_MODIFY, |
1043 | always ? "true" : "false"); | |
8b104c10 | 1044 | nb_cli_enqueue_change(vty, "./route-map", |
95ce849b | 1045 | rmap ? NB_OP_MODIFY : NB_OP_DESTROY, |
8b104c10 | 1046 | rmap ? rmap : NULL); |
82c25998 DT |
1047 | nb_cli_enqueue_change(vty, "./metric", NB_OP_MODIFY, |
1048 | metric_str ? metric_str : NULL); | |
8b104c10 EDP |
1049 | if (strmatch(ip, "ipv6") && !always) { |
1050 | vty_out(vty, | |
1051 | "Zebra doesn't implement default-originate for IPv6 yet\n"); | |
1052 | vty_out(vty, | |
1053 | "so use with care or use default-originate always.\n"); | |
1054 | } | |
1055 | } | |
1056 | ||
1057 | return nb_cli_apply_changes( | |
1058 | vty, "./default-information-originate/%s[level='%s']", ip, | |
1059 | level); | |
1060 | } | |
1061 | ||
1062 | static void vty_print_def_origin(struct vty *vty, struct lyd_node *dnode, | |
f34ab52d EDP |
1063 | const char *family, const char *level, |
1064 | bool show_defaults) | |
8b104c10 | 1065 | { |
8b104c10 | 1066 | vty_out(vty, " default-information originate %s %s", family, level); |
5f1e5e3f | 1067 | if (yang_dnode_get_bool(dnode, "./always")) |
8b104c10 EDP |
1068 | vty_out(vty, " always"); |
1069 | ||
1070 | if (yang_dnode_exists(dnode, "./route-map")) | |
1071 | vty_out(vty, " route-map %s", | |
1072 | yang_dnode_get_string(dnode, "./route-map")); | |
82c25998 DT |
1073 | if (show_defaults || !yang_dnode_is_default(dnode, "./metric")) |
1074 | vty_out(vty, " metric %s", | |
1075 | yang_dnode_get_string(dnode, "./metric")); | |
1076 | ||
8b104c10 EDP |
1077 | vty_out(vty, "\n"); |
1078 | } | |
1079 | ||
1080 | void cli_show_isis_def_origin_ipv4(struct vty *vty, struct lyd_node *dnode, | |
1081 | bool show_defaults) | |
1082 | { | |
1083 | const char *level = yang_dnode_get_string(dnode, "./level"); | |
1084 | ||
1085 | vty_print_def_origin(vty, dnode, "ipv4", level, show_defaults); | |
1086 | } | |
1087 | ||
1088 | void cli_show_isis_def_origin_ipv6(struct vty *vty, struct lyd_node *dnode, | |
1089 | bool show_defaults) | |
1090 | { | |
1091 | const char *level = yang_dnode_get_string(dnode, "./level"); | |
1092 | ||
1093 | vty_print_def_origin(vty, dnode, "ipv6", level, show_defaults); | |
1094 | } | |
1095 | ||
a041ac8e EDP |
1096 | /* |
1097 | * XPath: /frr-isisd:isis/instance/redistribute | |
1098 | */ | |
1099 | DEFPY(isis_redistribute, isis_redistribute_cmd, | |
1100 | "[no] redistribute <ipv4|ipv6>$ip " PROTO_REDIST_STR | |
1101 | "$proto" | |
1102 | " <level-1|level-2>$level" | |
82c25998 | 1103 | " [{metric (0-16777215)|route-map WORD}]", |
a041ac8e EDP |
1104 | NO_STR REDIST_STR |
1105 | "Redistribute IPv4 routes\n" | |
1106 | "Redistribute IPv6 routes\n" PROTO_REDIST_HELP | |
1107 | "Redistribute into level-1\n" | |
1108 | "Redistribute into level-2\n" | |
1109 | "Metric for redistributed routes\n" | |
1110 | "ISIS default metric\n" | |
1111 | "Route map reference\n" | |
1112 | "Pointer to route-map entries\n") | |
1113 | { | |
1114 | if (no) | |
95ce849b | 1115 | nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); |
a041ac8e EDP |
1116 | else { |
1117 | nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); | |
1118 | nb_cli_enqueue_change(vty, "./route-map", | |
95ce849b | 1119 | route_map ? NB_OP_MODIFY : NB_OP_DESTROY, |
a041ac8e | 1120 | route_map ? route_map : NULL); |
82c25998 DT |
1121 | nb_cli_enqueue_change(vty, "./metric", NB_OP_MODIFY, |
1122 | metric_str ? metric_str : NULL); | |
a041ac8e EDP |
1123 | } |
1124 | ||
1125 | return nb_cli_apply_changes( | |
1126 | vty, "./redistribute/%s[protocol='%s'][level='%s']", ip, proto, | |
1127 | level); | |
1128 | } | |
1129 | ||
1130 | static void vty_print_redistribute(struct vty *vty, struct lyd_node *dnode, | |
82c25998 | 1131 | bool show_defaults, const char *family) |
a041ac8e EDP |
1132 | { |
1133 | const char *level = yang_dnode_get_string(dnode, "./level"); | |
1134 | const char *protocol = yang_dnode_get_string(dnode, "./protocol"); | |
1135 | ||
1136 | vty_out(vty, " redistribute %s %s %s", family, protocol, level); | |
82c25998 | 1137 | if (show_defaults || !yang_dnode_is_default(dnode, "./metric")) |
a041ac8e EDP |
1138 | vty_out(vty, " metric %s", |
1139 | yang_dnode_get_string(dnode, "./metric")); | |
82c25998 | 1140 | if (yang_dnode_exists(dnode, "./route-map")) |
a041ac8e EDP |
1141 | vty_out(vty, " route-map %s", |
1142 | yang_dnode_get_string(dnode, "./route-map")); | |
1143 | vty_out(vty, "\n"); | |
1144 | } | |
1145 | ||
1146 | void cli_show_isis_redistribute_ipv4(struct vty *vty, struct lyd_node *dnode, | |
1147 | bool show_defaults) | |
1148 | { | |
82c25998 | 1149 | vty_print_redistribute(vty, dnode, show_defaults, "ipv4"); |
a041ac8e EDP |
1150 | } |
1151 | void cli_show_isis_redistribute_ipv6(struct vty *vty, struct lyd_node *dnode, | |
1152 | bool show_defaults) | |
1153 | { | |
82c25998 | 1154 | vty_print_redistribute(vty, dnode, show_defaults, "ipv6"); |
a041ac8e EDP |
1155 | } |
1156 | ||
22af6a80 EDP |
1157 | /* |
1158 | * XPath: /frr-isisd:isis/instance/multi-topology | |
1159 | */ | |
1160 | DEFPY(isis_topology, isis_topology_cmd, | |
1161 | "[no] topology " | |
1162 | "<ipv4-unicast" | |
1163 | "|ipv4-mgmt" | |
1164 | "|ipv6-unicast" | |
1165 | "|ipv4-multicast" | |
1166 | "|ipv6-multicast" | |
1167 | "|ipv6-mgmt" | |
1168 | "|ipv6-dstsrc>$topology " | |
1169 | "[overload]$overload", | |
1170 | NO_STR | |
1171 | "Configure IS-IS topologies\n" | |
1172 | "IPv4 unicast topology\n" | |
1173 | "IPv4 management topology\n" | |
1174 | "IPv6 unicast topology\n" | |
1175 | "IPv4 multicast topology\n" | |
1176 | "IPv6 multicast topology\n" | |
1177 | "IPv6 management topology\n" | |
1178 | "IPv6 dst-src topology\n" | |
1179 | "Set overload bit for topology\n") | |
1180 | { | |
1181 | char base_xpath[XPATH_MAXLEN]; | |
1182 | ||
1183 | /* Since IPv4-unicast is not configurable it is not present in the | |
1184 | * YANG model, so we need to validate it here | |
1185 | */ | |
1186 | if (strmatch(topology, "ipv4-unicast")) { | |
1187 | vty_out(vty, "Cannot configure IPv4 unicast topology\n"); | |
1188 | return CMD_WARNING_CONFIG_FAILED; | |
1189 | } | |
1190 | ||
1191 | if (strmatch(topology, "ipv4-mgmt")) | |
1192 | snprintf(base_xpath, XPATH_MAXLEN, | |
1193 | "./multi-topology/ipv4-management"); | |
1194 | else if (strmatch(topology, "ipv6-mgmt")) | |
1195 | snprintf(base_xpath, XPATH_MAXLEN, | |
1196 | "./multi-topology/ipv6-management"); | |
1197 | else | |
1198 | snprintf(base_xpath, XPATH_MAXLEN, "./multi-topology/%s", | |
1199 | topology); | |
1200 | ||
1201 | if (no) | |
95ce849b | 1202 | nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); |
22af6a80 EDP |
1203 | else { |
1204 | nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); | |
5f1e5e3f EDP |
1205 | nb_cli_enqueue_change(vty, "./overload", NB_OP_MODIFY, |
1206 | overload ? "true" : "false"); | |
22af6a80 EDP |
1207 | } |
1208 | ||
1209 | return nb_cli_apply_changes(vty, base_xpath); | |
1210 | } | |
1211 | ||
1212 | void cli_show_isis_mt_ipv4_multicast(struct vty *vty, struct lyd_node *dnode, | |
1213 | bool show_defaults) | |
1214 | { | |
1215 | vty_out(vty, " topology ipv4-multicast"); | |
5f1e5e3f | 1216 | if (yang_dnode_get_bool(dnode, "./overload")) |
22af6a80 EDP |
1217 | vty_out(vty, " overload"); |
1218 | vty_out(vty, "\n"); | |
1219 | } | |
1220 | ||
1221 | void cli_show_isis_mt_ipv4_mgmt(struct vty *vty, struct lyd_node *dnode, | |
1222 | bool show_defaults) | |
1223 | { | |
1224 | vty_out(vty, " topology ipv4-mgmt"); | |
5f1e5e3f | 1225 | if (yang_dnode_get_bool(dnode, "./overload")) |
22af6a80 EDP |
1226 | vty_out(vty, " overload"); |
1227 | vty_out(vty, "\n"); | |
1228 | } | |
1229 | ||
1230 | void cli_show_isis_mt_ipv6_unicast(struct vty *vty, struct lyd_node *dnode, | |
1231 | bool show_defaults) | |
1232 | { | |
1233 | vty_out(vty, " topology ipv6-unicast"); | |
5f1e5e3f | 1234 | if (yang_dnode_get_bool(dnode, "./overload")) |
22af6a80 EDP |
1235 | vty_out(vty, " overload"); |
1236 | vty_out(vty, "\n"); | |
1237 | } | |
1238 | ||
1239 | void cli_show_isis_mt_ipv6_multicast(struct vty *vty, struct lyd_node *dnode, | |
1240 | bool show_defaults) | |
1241 | { | |
1242 | vty_out(vty, " topology ipv6-multicast"); | |
5f1e5e3f | 1243 | if (yang_dnode_get_bool(dnode, "./overload")) |
22af6a80 EDP |
1244 | vty_out(vty, " overload"); |
1245 | vty_out(vty, "\n"); | |
1246 | } | |
1247 | ||
1248 | void cli_show_isis_mt_ipv6_mgmt(struct vty *vty, struct lyd_node *dnode, | |
1249 | bool show_defaults) | |
1250 | { | |
1251 | vty_out(vty, " topology ipv6-mgmt"); | |
5f1e5e3f | 1252 | if (yang_dnode_get_bool(dnode, "./overload")) |
22af6a80 EDP |
1253 | vty_out(vty, " overload"); |
1254 | vty_out(vty, "\n"); | |
1255 | } | |
1256 | ||
1257 | void cli_show_isis_mt_ipv6_dstsrc(struct vty *vty, struct lyd_node *dnode, | |
1258 | bool show_defaults) | |
1259 | { | |
1260 | vty_out(vty, " topology ipv6-dstsrc"); | |
5f1e5e3f | 1261 | if (yang_dnode_get_bool(dnode, "./overload")) |
22af6a80 EDP |
1262 | vty_out(vty, " overload"); |
1263 | vty_out(vty, "\n"); | |
1264 | } | |
1265 | ||
a6a36c41 EDP |
1266 | /* |
1267 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/passive | |
1268 | */ | |
1269 | DEFPY(isis_passive, isis_passive_cmd, "[no] isis passive", | |
1270 | NO_STR | |
1271 | "IS-IS routing protocol\n" | |
1272 | "Configure the passive mode for interface\n") | |
1273 | { | |
5f1e5e3f EDP |
1274 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive", NB_OP_MODIFY, |
1275 | no ? "false" : "true"); | |
a6a36c41 EDP |
1276 | |
1277 | return nb_cli_apply_changes(vty, NULL); | |
1278 | } | |
1279 | ||
1280 | void cli_show_ip_isis_passive(struct vty *vty, struct lyd_node *dnode, | |
1281 | bool show_defaults) | |
1282 | { | |
5f1e5e3f EDP |
1283 | if (!yang_dnode_get_bool(dnode, NULL)) |
1284 | vty_out(vty, " no"); | |
a6a36c41 EDP |
1285 | vty_out(vty, " isis passive\n"); |
1286 | } | |
1287 | ||
3e20c83a EDP |
1288 | /* |
1289 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/password | |
1290 | */ | |
1291 | ||
1292 | DEFPY(isis_passwd, isis_passwd_cmd, "isis password <md5|clear>$type WORD$pwd", | |
1293 | "IS-IS routing protocol\n" | |
1294 | "Configure the authentication password for a circuit\n" | |
1295 | "HMAC-MD5 authentication\n" | |
1296 | "Cleartext password\n" | |
1297 | "Circuit password\n") | |
1298 | { | |
1299 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/password", NB_OP_CREATE, | |
1300 | NULL); | |
1301 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/password/password", | |
1302 | NB_OP_MODIFY, pwd); | |
1303 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/password/password-type", | |
1304 | NB_OP_MODIFY, type); | |
1305 | ||
1306 | return nb_cli_apply_changes(vty, NULL); | |
1307 | } | |
1308 | ||
1309 | DEFPY(no_isis_passwd, no_isis_passwd_cmd, "no isis password [<md5|clear> WORD]", | |
1310 | NO_STR | |
1311 | "IS-IS routing protocol\n" | |
1312 | "Configure the authentication password for a circuit\n" | |
1313 | "HMAC-MD5 authentication\n" | |
1314 | "Cleartext password\n" | |
1315 | "Circuit password\n") | |
1316 | { | |
95ce849b | 1317 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/password", NB_OP_DESTROY, |
3e20c83a EDP |
1318 | NULL); |
1319 | ||
1320 | return nb_cli_apply_changes(vty, NULL); | |
1321 | } | |
1322 | ||
1323 | void cli_show_ip_isis_password(struct vty *vty, struct lyd_node *dnode, | |
1324 | bool show_defaults) | |
1325 | { | |
1326 | vty_out(vty, " isis password %s %s\n", | |
1327 | yang_dnode_get_string(dnode, "./password-type"), | |
1328 | yang_dnode_get_string(dnode, "./password")); | |
1329 | } | |
1330 | ||
be49219c EDP |
1331 | /* |
1332 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/metric | |
1333 | */ | |
1334 | DEFPY(isis_metric, isis_metric_cmd, | |
1335 | "isis metric [level-1|level-2]$level (0-16777215)$met", | |
1336 | "IS-IS routing protocol\n" | |
1337 | "Set default metric for circuit\n" | |
1338 | "Specify metric for level-1 routing\n" | |
1339 | "Specify metric for level-2 routing\n" | |
1340 | "Default metric value\n") | |
1341 | { | |
1342 | if (!level || strmatch(level, "level-1")) | |
1343 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/metric/level-1", | |
1344 | NB_OP_MODIFY, met_str); | |
1345 | if (!level || strmatch(level, "level-2")) | |
1346 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/metric/level-2", | |
1347 | NB_OP_MODIFY, met_str); | |
1348 | ||
1349 | return nb_cli_apply_changes(vty, NULL); | |
1350 | } | |
1351 | ||
1352 | DEFPY(no_isis_metric, no_isis_metric_cmd, | |
1353 | "no isis metric [level-1|level-2]$level [(0-16777215)]", | |
1354 | NO_STR | |
1355 | "IS-IS routing protocol\n" | |
1356 | "Set default metric for circuit\n" | |
1357 | "Specify metric for level-1 routing\n" | |
1358 | "Specify metric for level-2 routing\n" | |
1359 | "Default metric value\n") | |
1360 | { | |
1361 | if (!level || strmatch(level, "level-1")) | |
1362 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/metric/level-1", | |
1363 | NB_OP_MODIFY, NULL); | |
1364 | if (!level || strmatch(level, "level-2")) | |
1365 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/metric/level-2", | |
1366 | NB_OP_MODIFY, NULL); | |
1367 | ||
1368 | return nb_cli_apply_changes(vty, NULL); | |
1369 | } | |
1370 | ||
1371 | void cli_show_ip_isis_metric(struct vty *vty, struct lyd_node *dnode, | |
1372 | bool show_defaults) | |
1373 | { | |
1374 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
1375 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
1376 | ||
1377 | if (strmatch(l1, l2)) | |
1378 | vty_out(vty, " isis metric %s\n", l1); | |
1379 | else { | |
1380 | vty_out(vty, " isis metric %s level-1\n", l1); | |
1381 | vty_out(vty, " isis metric %s level-2\n", l2); | |
1382 | } | |
1383 | } | |
1384 | ||
356a2e3c EDP |
1385 | /* |
1386 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/interval | |
1387 | */ | |
1388 | DEFPY(isis_hello_interval, isis_hello_interval_cmd, | |
1389 | "isis hello-interval [level-1|level-2]$level (1-600)$intv", | |
1390 | "IS-IS routing protocol\n" | |
1391 | "Set Hello interval\n" | |
1392 | "Specify hello-interval for level-1 IIHs\n" | |
1393 | "Specify hello-interval for level-2 IIHs\n" | |
1394 | "Holdtime 1 seconds, interval depends on multiplier\n") | |
1395 | { | |
1396 | if (!level || strmatch(level, "level-1")) | |
1397 | nb_cli_enqueue_change(vty, | |
1398 | "./frr-isisd:isis/hello/interval/level-1", | |
1399 | NB_OP_MODIFY, intv_str); | |
1400 | if (!level || strmatch(level, "level-2")) | |
1401 | nb_cli_enqueue_change(vty, | |
1402 | "./frr-isisd:isis/hello/interval/level-2", | |
1403 | NB_OP_MODIFY, intv_str); | |
1404 | ||
1405 | return nb_cli_apply_changes(vty, NULL); | |
1406 | } | |
1407 | ||
1408 | DEFPY(no_isis_hello_interval, no_isis_hello_interval_cmd, | |
1409 | "no isis hello-interval [level-1|level-2]$level [(1-600)]", | |
1410 | NO_STR | |
1411 | "IS-IS routing protocol\n" | |
1412 | "Set Hello interval\n" | |
1413 | "Specify hello-interval for level-1 IIHs\n" | |
1414 | "Specify hello-interval for level-2 IIHs\n" | |
1415 | "Holdtime 1 second, interval depends on multiplier\n") | |
1416 | { | |
1417 | if (!level || strmatch(level, "level-1")) | |
1418 | nb_cli_enqueue_change(vty, | |
1419 | "./frr-isisd:isis/hello/interval/level-1", | |
1420 | NB_OP_MODIFY, NULL); | |
1421 | if (!level || strmatch(level, "level-2")) | |
1422 | nb_cli_enqueue_change(vty, | |
1423 | "./frr-isisd:isis/hello/interval/level-2", | |
1424 | NB_OP_MODIFY, NULL); | |
1425 | ||
1426 | return nb_cli_apply_changes(vty, NULL); | |
1427 | } | |
1428 | ||
1429 | void cli_show_ip_isis_hello_interval(struct vty *vty, struct lyd_node *dnode, | |
1430 | bool show_defaults) | |
1431 | { | |
1432 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
1433 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
1434 | ||
1435 | if (strmatch(l1, l2)) | |
1436 | vty_out(vty, " isis hello-interval %s\n", l1); | |
1437 | else { | |
1438 | vty_out(vty, " isis hello-interval %s level-1\n", l1); | |
1439 | vty_out(vty, " isis hello-interval %s level-2\n", l2); | |
1440 | } | |
1441 | } | |
1442 | ||
4e75a67d EDP |
1443 | /* |
1444 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/multiplier | |
1445 | */ | |
1446 | DEFPY(isis_hello_multiplier, isis_hello_multiplier_cmd, | |
1447 | "isis hello-multiplier [level-1|level-2]$level (2-100)$mult", | |
1448 | "IS-IS routing protocol\n" | |
1449 | "Set multiplier for Hello holding time\n" | |
1450 | "Specify hello multiplier for level-1 IIHs\n" | |
1451 | "Specify hello multiplier for level-2 IIHs\n" | |
1452 | "Hello multiplier value\n") | |
1453 | { | |
1454 | if (!level || strmatch(level, "level-1")) | |
1455 | nb_cli_enqueue_change( | |
1456 | vty, "./frr-isisd:isis/hello/multiplier/level-1", | |
1457 | NB_OP_MODIFY, mult_str); | |
1458 | if (!level || strmatch(level, "level-2")) | |
1459 | nb_cli_enqueue_change( | |
1460 | vty, "./frr-isisd:isis/hello/multiplier/level-2", | |
1461 | NB_OP_MODIFY, mult_str); | |
1462 | ||
1463 | return nb_cli_apply_changes(vty, NULL); | |
1464 | } | |
1465 | ||
1466 | DEFPY(no_isis_hello_multiplier, no_isis_hello_multiplier_cmd, | |
1467 | "no isis hello-multiplier [level-1|level-2]$level [(2-100)]", | |
1468 | NO_STR | |
1469 | "IS-IS routing protocol\n" | |
1470 | "Set multiplier for Hello holding time\n" | |
1471 | "Specify hello multiplier for level-1 IIHs\n" | |
1472 | "Specify hello multiplier for level-2 IIHs\n" | |
1473 | "Hello multiplier value\n") | |
1474 | { | |
1475 | if (!level || strmatch(level, "level-1")) | |
1476 | nb_cli_enqueue_change( | |
1477 | vty, "./frr-isisd:isis/hello/multiplier/level-1", | |
1478 | NB_OP_MODIFY, NULL); | |
1479 | if (!level || strmatch(level, "level-2")) | |
1480 | nb_cli_enqueue_change( | |
1481 | vty, "./frr-isisd:isis/hello/multiplier/level-2", | |
1482 | NB_OP_MODIFY, NULL); | |
1483 | ||
1484 | return nb_cli_apply_changes(vty, NULL); | |
1485 | } | |
1486 | ||
1487 | void cli_show_ip_isis_hello_multi(struct vty *vty, struct lyd_node *dnode, | |
1488 | bool show_defaults) | |
1489 | { | |
1490 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
1491 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
1492 | ||
1493 | if (strmatch(l1, l2)) | |
1494 | vty_out(vty, " isis hello-multiplier %s\n", l1); | |
1495 | else { | |
1496 | vty_out(vty, " isis hello-multiplier %s level-1\n", l1); | |
1497 | vty_out(vty, " isis hello-multiplier %s level-2\n", l2); | |
1498 | } | |
1499 | } | |
1500 | ||
5f2ce446 EDP |
1501 | /* |
1502 | * XPath: | |
1503 | * /frr-interface:lib/interface/frr-isisd:isis/disable-three-way-handshake | |
1504 | */ | |
1505 | DEFPY(isis_threeway_adj, isis_threeway_adj_cmd, "[no] isis three-way-handshake", | |
1506 | NO_STR | |
1507 | "IS-IS commands\n" | |
1508 | "Enable/Disable three-way handshake\n") | |
1509 | { | |
1510 | nb_cli_enqueue_change(vty, | |
1511 | "./frr-isisd:isis/disable-three-way-handshake", | |
5f1e5e3f | 1512 | NB_OP_MODIFY, no ? "true" : "false"); |
5f2ce446 EDP |
1513 | |
1514 | return nb_cli_apply_changes(vty, NULL); | |
1515 | } | |
1516 | ||
1517 | void cli_show_ip_isis_threeway_shake(struct vty *vty, struct lyd_node *dnode, | |
1518 | bool show_defaults) | |
1519 | { | |
5f1e5e3f EDP |
1520 | if (yang_dnode_get_bool(dnode, NULL)) |
1521 | vty_out(vty, " no"); | |
1522 | vty_out(vty, " isis three-way-handshake\n"); | |
5f2ce446 EDP |
1523 | } |
1524 | ||
7b6b75e5 EDP |
1525 | /* |
1526 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/padding | |
1527 | */ | |
1528 | DEFPY(isis_hello_padding, isis_hello_padding_cmd, "[no] isis hello padding", | |
1529 | NO_STR | |
1530 | "IS-IS routing protocol\n" | |
1531 | "Add padding to IS-IS hello packets\n" | |
1532 | "Pad hello packets\n") | |
1533 | { | |
1534 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/hello/padding", | |
1535 | NB_OP_MODIFY, no ? "false" : "true"); | |
1536 | ||
1537 | return nb_cli_apply_changes(vty, NULL); | |
1538 | } | |
1539 | ||
1540 | void cli_show_ip_isis_hello_padding(struct vty *vty, struct lyd_node *dnode, | |
1541 | bool show_defaults) | |
1542 | { | |
1543 | if (!yang_dnode_get_bool(dnode, NULL)) | |
1544 | vty_out(vty, " no"); | |
1545 | ||
1546 | vty_out(vty, " isis hello padding\n"); | |
1547 | } | |
1548 | ||
9ce808b9 EDP |
1549 | /* |
1550 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval | |
1551 | */ | |
1552 | DEFPY(csnp_interval, csnp_interval_cmd, | |
1553 | "isis csnp-interval (1-600)$intv [level-1|level-2]$level", | |
1554 | "IS-IS routing protocol\n" | |
1555 | "Set CSNP interval in seconds\n" | |
1556 | "CSNP interval value\n" | |
1557 | "Specify interval for level-1 CSNPs\n" | |
1558 | "Specify interval for level-2 CSNPs\n") | |
1559 | { | |
1560 | if (!level || strmatch(level, "level-1")) | |
1561 | nb_cli_enqueue_change(vty, | |
1562 | "./frr-isisd:isis/csnp-interval/level-1", | |
1563 | NB_OP_MODIFY, intv_str); | |
1564 | if (!level || strmatch(level, "level-2")) | |
1565 | nb_cli_enqueue_change(vty, | |
1566 | "./frr-isisd:isis/csnp-interval/level-2", | |
1567 | NB_OP_MODIFY, intv_str); | |
1568 | ||
1569 | return nb_cli_apply_changes(vty, NULL); | |
1570 | } | |
1571 | ||
1572 | DEFPY(no_csnp_interval, no_csnp_interval_cmd, | |
1573 | "no isis csnp-interval [(1-600)] [level-1|level-2]$level", | |
1574 | NO_STR | |
1575 | "IS-IS routing protocol\n" | |
1576 | "Set CSNP interval in seconds\n" | |
1577 | "CSNP interval value\n" | |
1578 | "Specify interval for level-1 CSNPs\n" | |
1579 | "Specify interval for level-2 CSNPs\n") | |
1580 | { | |
1581 | if (!level || strmatch(level, "level-1")) | |
1582 | nb_cli_enqueue_change(vty, | |
1583 | "./frr-isisd:isis/csnp-interval/level-1", | |
1584 | NB_OP_MODIFY, NULL); | |
1585 | if (!level || strmatch(level, "level-2")) | |
1586 | nb_cli_enqueue_change(vty, | |
1587 | "./frr-isisd:isis/csnp-interval/level-2", | |
1588 | NB_OP_MODIFY, NULL); | |
1589 | ||
1590 | return nb_cli_apply_changes(vty, NULL); | |
1591 | } | |
1592 | ||
1593 | void cli_show_ip_isis_csnp_interval(struct vty *vty, struct lyd_node *dnode, | |
1594 | bool show_defaults) | |
1595 | { | |
1596 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
1597 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
1598 | ||
1599 | if (strmatch(l1, l2)) | |
1600 | vty_out(vty, " isis csnp-interval %s\n", l1); | |
1601 | else { | |
1602 | vty_out(vty, " isis csnp-interval %s level-1\n", l1); | |
1603 | vty_out(vty, " isis csnp-interval %s level-2\n", l2); | |
1604 | } | |
1605 | } | |
1606 | ||
1607 | /* | |
1608 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/psnp-interval | |
1609 | */ | |
1610 | DEFPY(psnp_interval, psnp_interval_cmd, | |
1611 | "isis psnp-interval (1-120)$intv [level-1|level-2]$level", | |
1612 | "IS-IS routing protocol\n" | |
1613 | "Set PSNP interval in seconds\n" | |
1614 | "PSNP interval value\n" | |
1615 | "Specify interval for level-1 PSNPs\n" | |
1616 | "Specify interval for level-2 PSNPs\n") | |
1617 | { | |
1618 | if (!level || strmatch(level, "level-1")) | |
1619 | nb_cli_enqueue_change(vty, | |
1620 | "./frr-isisd:isis/psnp-interval/level-1", | |
1621 | NB_OP_MODIFY, intv_str); | |
1622 | if (!level || strmatch(level, "level-2")) | |
1623 | nb_cli_enqueue_change(vty, | |
1624 | "./frr-isisd:isis/psnp-interval/level-2", | |
1625 | NB_OP_MODIFY, intv_str); | |
1626 | ||
1627 | return nb_cli_apply_changes(vty, NULL); | |
1628 | } | |
1629 | ||
1630 | DEFPY(no_psnp_interval, no_psnp_interval_cmd, | |
1631 | "no isis psnp-interval [(1-120)] [level-1|level-2]$level", | |
1632 | NO_STR | |
1633 | "IS-IS routing protocol\n" | |
1634 | "Set PSNP interval in seconds\n" | |
1635 | "PSNP interval value\n" | |
1636 | "Specify interval for level-1 PSNPs\n" | |
1637 | "Specify interval for level-2 PSNPs\n") | |
1638 | { | |
1639 | if (!level || strmatch(level, "level-1")) | |
1640 | nb_cli_enqueue_change(vty, | |
1641 | "./frr-isisd:isis/psnp-interval/level-1", | |
1642 | NB_OP_MODIFY, NULL); | |
1643 | if (!level || strmatch(level, "level-2")) | |
1644 | nb_cli_enqueue_change(vty, | |
1645 | "./frr-isisd:isis/psnp-interval/level-2", | |
1646 | NB_OP_MODIFY, NULL); | |
1647 | ||
1648 | return nb_cli_apply_changes(vty, NULL); | |
1649 | } | |
1650 | ||
1651 | void cli_show_ip_isis_psnp_interval(struct vty *vty, struct lyd_node *dnode, | |
1652 | bool show_defaults) | |
1653 | { | |
1654 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
1655 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
1656 | ||
1657 | if (strmatch(l1, l2)) | |
1658 | vty_out(vty, " isis psnp-interval %s\n", l1); | |
1659 | else { | |
1660 | vty_out(vty, " isis psnp-interval %s level-1\n", l1); | |
1661 | vty_out(vty, " isis psnp-interval %s level-2\n", l2); | |
1662 | } | |
1663 | } | |
1664 | ||
83d043f6 EDP |
1665 | /* |
1666 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/multi-topology | |
1667 | */ | |
1668 | DEFPY(circuit_topology, circuit_topology_cmd, | |
1669 | "[no] isis topology" | |
1670 | "<ipv4-unicast" | |
1671 | "|ipv4-mgmt" | |
1672 | "|ipv6-unicast" | |
1673 | "|ipv4-multicast" | |
1674 | "|ipv6-multicast" | |
1675 | "|ipv6-mgmt" | |
1676 | "|ipv6-dstsrc" | |
1677 | ">$topology", | |
1678 | NO_STR | |
1679 | "IS-IS routing protocol\n" | |
1680 | "Configure interface IS-IS topologies\n" | |
1681 | "IPv4 unicast topology\n" | |
1682 | "IPv4 management topology\n" | |
1683 | "IPv6 unicast topology\n" | |
1684 | "IPv4 multicast topology\n" | |
1685 | "IPv6 multicast topology\n" | |
1686 | "IPv6 management topology\n" | |
1687 | "IPv6 dst-src topology\n") | |
1688 | { | |
1689 | nb_cli_enqueue_change(vty, ".", NB_OP_MODIFY, no ? "false" : "true"); | |
1690 | ||
1691 | if (strmatch(topology, "ipv4-mgmt")) | |
1692 | return nb_cli_apply_changes( | |
1693 | vty, "./frr-isisd:isis/multi-topology/ipv4-management"); | |
1694 | else if (strmatch(topology, "ipv6-mgmt")) | |
1695 | return nb_cli_apply_changes( | |
1696 | vty, "./frr-isisd:isis/multi-topology/ipv6-management"); | |
1697 | else | |
1698 | return nb_cli_apply_changes( | |
1699 | vty, "./frr-isisd:isis/multi-topology/%s", topology); | |
1700 | } | |
1701 | ||
1702 | void cli_show_ip_isis_mt_ipv4_unicast(struct vty *vty, struct lyd_node *dnode, | |
1703 | bool show_defaults) | |
1704 | { | |
1705 | if (!yang_dnode_get_bool(dnode, NULL)) | |
1706 | vty_out(vty, " no"); | |
1707 | vty_out(vty, " isis topology ipv4-unicast\n"); | |
1708 | } | |
1709 | ||
1710 | void cli_show_ip_isis_mt_ipv4_multicast(struct vty *vty, struct lyd_node *dnode, | |
1711 | bool show_defaults) | |
1712 | { | |
1713 | if (!yang_dnode_get_bool(dnode, NULL)) | |
1714 | vty_out(vty, " no"); | |
1715 | vty_out(vty, " isis topology ipv4-multicast\n"); | |
1716 | } | |
1717 | ||
1718 | void cli_show_ip_isis_mt_ipv4_mgmt(struct vty *vty, struct lyd_node *dnode, | |
1719 | bool show_defaults) | |
1720 | { | |
1721 | if (!yang_dnode_get_bool(dnode, NULL)) | |
1722 | vty_out(vty, " no"); | |
1723 | vty_out(vty, " isis topology ipv4-mgmt\n"); | |
1724 | } | |
1725 | ||
1726 | void cli_show_ip_isis_mt_ipv6_unicast(struct vty *vty, struct lyd_node *dnode, | |
1727 | bool show_defaults) | |
1728 | { | |
1729 | if (!yang_dnode_get_bool(dnode, NULL)) | |
1730 | vty_out(vty, " no"); | |
1731 | vty_out(vty, " isis topology ipv6-unicast\n"); | |
1732 | } | |
1733 | ||
1734 | void cli_show_ip_isis_mt_ipv6_multicast(struct vty *vty, struct lyd_node *dnode, | |
1735 | bool show_defaults) | |
1736 | { | |
1737 | if (!yang_dnode_get_bool(dnode, NULL)) | |
1738 | vty_out(vty, " no"); | |
1739 | vty_out(vty, " isis topology ipv6-multicast\n"); | |
1740 | } | |
1741 | ||
1742 | void cli_show_ip_isis_mt_ipv6_mgmt(struct vty *vty, struct lyd_node *dnode, | |
1743 | bool show_defaults) | |
1744 | { | |
1745 | if (!yang_dnode_get_bool(dnode, NULL)) | |
1746 | vty_out(vty, " no"); | |
1747 | vty_out(vty, " isis topology ipv6-mgmt\n"); | |
1748 | } | |
1749 | ||
1750 | void cli_show_ip_isis_mt_ipv6_dstsrc(struct vty *vty, struct lyd_node *dnode, | |
1751 | bool show_defaults) | |
1752 | { | |
1753 | if (!yang_dnode_get_bool(dnode, NULL)) | |
1754 | vty_out(vty, " no"); | |
1755 | vty_out(vty, " isis topology ipv6-dstsrc\n"); | |
1756 | } | |
1757 | ||
9302fbb6 EDP |
1758 | /* |
1759 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/circuit-type | |
1760 | */ | |
1761 | DEFPY(isis_circuit_type, isis_circuit_type_cmd, | |
1762 | "isis circuit-type <level-1|level-1-2|level-2-only>$type", | |
1763 | "IS-IS routing protocol\n" | |
1764 | "Configure circuit type for interface\n" | |
1765 | "Level-1 only adjacencies are formed\n" | |
1766 | "Level-1-2 adjacencies are formed\n" | |
1767 | "Level-2 only adjacencies are formed\n") | |
1768 | { | |
1769 | nb_cli_enqueue_change( | |
1770 | vty, "./frr-isisd:isis/circuit-type", NB_OP_MODIFY, | |
1771 | strmatch(type, "level-2-only") ? "level-2" : type); | |
1772 | ||
1773 | return nb_cli_apply_changes(vty, NULL); | |
1774 | } | |
1775 | ||
1776 | DEFPY(no_isis_circuit_type, no_isis_circuit_type_cmd, | |
1777 | "no isis circuit-type [level-1|level-1-2|level-2-only]", | |
1778 | NO_STR | |
1779 | "IS-IS routing protocol\n" | |
1780 | "Configure circuit type for interface\n" | |
1781 | "Level-1 only adjacencies are formed\n" | |
1782 | "Level-1-2 adjacencies are formed\n" | |
1783 | "Level-2 only adjacencies are formed\n") | |
1784 | { | |
83981138 | 1785 | const char *circ_type = NULL; |
9302fbb6 EDP |
1786 | |
1787 | /* | |
1788 | * Default value depends on whether the circuit is part of an area, | |
1789 | * and the is-type of the area if there is one. So we need to do this | |
1790 | * here. | |
1791 | */ | |
83981138 RW |
1792 | pthread_rwlock_rdlock(&running_config->lock); |
1793 | { | |
1794 | struct interface *ifp; | |
1795 | struct isis_circuit *circuit; | |
9302fbb6 | 1796 | |
83981138 RW |
1797 | ifp = nb_running_get_entry(NULL, VTY_CURR_XPATH, false); |
1798 | if (!ifp) | |
1799 | goto unlock; | |
9302fbb6 | 1800 | |
83981138 RW |
1801 | circuit = circuit_scan_by_ifp(ifp); |
1802 | if (!circuit || circuit->state != C_STATE_UP) | |
1803 | goto unlock; | |
9302fbb6 | 1804 | |
83981138 RW |
1805 | switch (circuit->area->is_type) { |
1806 | case IS_LEVEL_1: | |
1807 | circ_type = "level-1"; | |
1808 | break; | |
1809 | case IS_LEVEL_2: | |
1810 | circ_type = "level-2"; | |
1811 | break; | |
1812 | case IS_LEVEL_1_AND_2: | |
1813 | circ_type = "level-1-2"; | |
1814 | break; | |
1815 | } | |
9302fbb6 | 1816 | } |
83981138 RW |
1817 | unlock: |
1818 | pthread_rwlock_unlock(&running_config->lock); | |
9302fbb6 | 1819 | |
9302fbb6 | 1820 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/circuit-type", |
83981138 | 1821 | NB_OP_MODIFY, circ_type); |
9302fbb6 EDP |
1822 | |
1823 | return nb_cli_apply_changes(vty, NULL); | |
1824 | } | |
1825 | ||
1826 | void cli_show_ip_isis_circ_type(struct vty *vty, struct lyd_node *dnode, | |
1827 | bool show_defaults) | |
1828 | { | |
1829 | int level = yang_dnode_get_enum(dnode, NULL); | |
1830 | ||
1831 | switch (level) { | |
1832 | case IS_LEVEL_1: | |
1833 | vty_out(vty, " isis circuit-type level-1\n"); | |
1834 | break; | |
1835 | case IS_LEVEL_2: | |
1836 | vty_out(vty, " isis circuit-type level-2-only\n"); | |
1837 | break; | |
1838 | case IS_LEVEL_1_AND_2: | |
1839 | vty_out(vty, " isis circuit-type level-1-2\n"); | |
1840 | break; | |
1841 | } | |
1842 | } | |
1843 | ||
d0820765 EDP |
1844 | /* |
1845 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/network-type | |
1846 | */ | |
1847 | DEFPY(isis_network, isis_network_cmd, "[no] isis network point-to-point", | |
1848 | NO_STR | |
1849 | "IS-IS routing protocol\n" | |
1850 | "Set network type\n" | |
1851 | "point-to-point network type\n") | |
1852 | { | |
1853 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/network-type", | |
1854 | NB_OP_MODIFY, | |
1855 | no ? "broadcast" : "point-to-point"); | |
1856 | ||
1857 | return nb_cli_apply_changes(vty, NULL); | |
1858 | } | |
1859 | ||
1860 | void cli_show_ip_isis_network_type(struct vty *vty, struct lyd_node *dnode, | |
1861 | bool show_defaults) | |
1862 | { | |
1863 | if (yang_dnode_get_enum(dnode, NULL) != CIRCUIT_T_P2P) | |
1864 | vty_out(vty, " no"); | |
1865 | ||
1866 | vty_out(vty, " isis network point-to-point\n"); | |
1867 | } | |
1868 | ||
d59c2d6b EDP |
1869 | /* |
1870 | * XPath: /frr-interface:lib/interface/frr-isisd:isis/priority | |
1871 | */ | |
1872 | DEFPY(isis_priority, isis_priority_cmd, | |
1873 | "isis priority (0-127)$prio [level-1|level-2]$level", | |
1874 | "IS-IS routing protocol\n" | |
1875 | "Set priority for Designated Router election\n" | |
1876 | "Priority value\n" | |
1877 | "Specify priority for level-1 routing\n" | |
1878 | "Specify priority for level-2 routing\n") | |
1879 | { | |
1880 | if (!level || strmatch(level, "level-1")) | |
1881 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-1", | |
1882 | NB_OP_MODIFY, prio_str); | |
1883 | if (!level || strmatch(level, "level-2")) | |
1884 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-2", | |
1885 | NB_OP_MODIFY, prio_str); | |
1886 | ||
1887 | return nb_cli_apply_changes(vty, NULL); | |
1888 | } | |
1889 | ||
1890 | DEFPY(no_isis_priority, no_isis_priority_cmd, | |
1891 | "no isis priority [(0-127)] [level-1|level-2]$level", | |
1892 | NO_STR | |
1893 | "IS-IS routing protocol\n" | |
1894 | "Set priority for Designated Router election\n" | |
1895 | "Priority value\n" | |
1896 | "Specify priority for level-1 routing\n" | |
1897 | "Specify priority for level-2 routing\n") | |
1898 | { | |
1899 | if (!level || strmatch(level, "level-1")) | |
1900 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-1", | |
1901 | NB_OP_MODIFY, NULL); | |
1902 | if (!level || strmatch(level, "level-2")) | |
1903 | nb_cli_enqueue_change(vty, "./frr-isisd:isis/priority/level-2", | |
1904 | NB_OP_MODIFY, NULL); | |
1905 | ||
1906 | return nb_cli_apply_changes(vty, NULL); | |
1907 | } | |
1908 | ||
1909 | void cli_show_ip_isis_priority(struct vty *vty, struct lyd_node *dnode, | |
1910 | bool show_defaults) | |
1911 | { | |
1912 | const char *l1 = yang_dnode_get_string(dnode, "./level-1"); | |
1913 | const char *l2 = yang_dnode_get_string(dnode, "./level-2"); | |
1914 | ||
1915 | if (strmatch(l1, l2)) | |
1916 | vty_out(vty, " isis priority %s\n", l1); | |
1917 | else { | |
1918 | vty_out(vty, " isis priority %s level-1\n", l1); | |
1919 | vty_out(vty, " isis priority %s level-2\n", l2); | |
1920 | } | |
1921 | } | |
1922 | ||
2adf66ff EDP |
1923 | /* |
1924 | * XPath: /frr-isisd:isis/instance/log-adjacency-changes | |
1925 | */ | |
1926 | DEFPY(log_adj_changes, log_adj_changes_cmd, "[no] log-adjacency-changes", | |
1927 | NO_STR "Log changes in adjacency state\n") | |
1928 | { | |
5f1e5e3f EDP |
1929 | nb_cli_enqueue_change(vty, "./log-adjacency-changes", NB_OP_MODIFY, |
1930 | no ? "false" : "true"); | |
2adf66ff EDP |
1931 | |
1932 | return nb_cli_apply_changes(vty, NULL); | |
1933 | } | |
1934 | ||
1935 | void cli_show_isis_log_adjacency(struct vty *vty, struct lyd_node *dnode, | |
1936 | bool show_defaults) | |
1937 | { | |
5f1e5e3f EDP |
1938 | if (!yang_dnode_get_bool(dnode, NULL)) |
1939 | vty_out(vty, " no"); | |
2adf66ff EDP |
1940 | vty_out(vty, " log-adjacency-changes\n"); |
1941 | } | |
1942 | ||
20bd27e2 EDP |
1943 | void isis_cli_init(void) |
1944 | { | |
aaf2fd21 EDP |
1945 | install_element(CONFIG_NODE, &router_isis_cmd); |
1946 | install_element(CONFIG_NODE, &no_router_isis_cmd); | |
1947 | ||
1948 | install_element(INTERFACE_NODE, &ip_router_isis_cmd); | |
1949 | install_element(INTERFACE_NODE, &ip6_router_isis_cmd); | |
1950 | install_element(INTERFACE_NODE, &no_ip_router_isis_cmd); | |
f084ea55 EDP |
1951 | |
1952 | install_element(ISIS_NODE, &net_cmd); | |
e6bdae69 EDP |
1953 | |
1954 | install_element(ISIS_NODE, &is_type_cmd); | |
1955 | install_element(ISIS_NODE, &no_is_type_cmd); | |
6bb043cd EDP |
1956 | |
1957 | install_element(ISIS_NODE, &dynamic_hostname_cmd); | |
05a3f9f0 EDP |
1958 | |
1959 | install_element(ISIS_NODE, &set_overload_bit_cmd); | |
1960 | install_element(ISIS_NODE, &set_attached_bit_cmd); | |
e0df3206 EDP |
1961 | |
1962 | install_element(ISIS_NODE, &metric_style_cmd); | |
1963 | install_element(ISIS_NODE, &no_metric_style_cmd); | |
933536e3 EDP |
1964 | |
1965 | install_element(ISIS_NODE, &area_passwd_cmd); | |
1966 | install_element(ISIS_NODE, &domain_passwd_cmd); | |
1967 | install_element(ISIS_NODE, &no_area_passwd_cmd); | |
1d6fe72e EDP |
1968 | |
1969 | install_element(ISIS_NODE, &lsp_gen_interval_cmd); | |
1970 | install_element(ISIS_NODE, &no_lsp_gen_interval_cmd); | |
7e869004 EDP |
1971 | install_element(ISIS_NODE, &lsp_refresh_interval_cmd); |
1972 | install_element(ISIS_NODE, &no_lsp_refresh_interval_cmd); | |
ea120aa0 EDP |
1973 | install_element(ISIS_NODE, &max_lsp_lifetime_cmd); |
1974 | install_element(ISIS_NODE, &no_max_lsp_lifetime_cmd); | |
27a45d16 EDP |
1975 | install_element(ISIS_NODE, &area_lsp_mtu_cmd); |
1976 | install_element(ISIS_NODE, &no_area_lsp_mtu_cmd); | |
dcb1dcd6 EDP |
1977 | |
1978 | install_element(ISIS_NODE, &spf_interval_cmd); | |
1979 | install_element(ISIS_NODE, &no_spf_interval_cmd); | |
5336ba30 EDP |
1980 | install_element(ISIS_NODE, &spf_delay_ietf_cmd); |
1981 | install_element(ISIS_NODE, &no_spf_delay_ietf_cmd); | |
66e45e10 EDP |
1982 | |
1983 | install_element(ISIS_NODE, &area_purge_originator_cmd); | |
d1a80ef6 EDP |
1984 | |
1985 | install_element(ISIS_NODE, &isis_mpls_te_on_cmd); | |
1986 | install_element(ISIS_NODE, &no_isis_mpls_te_on_cmd); | |
1987 | install_element(ISIS_NODE, &isis_mpls_te_router_addr_cmd); | |
2e2a8b91 | 1988 | install_element(ISIS_NODE, &no_isis_mpls_te_router_addr_cmd); |
d1a80ef6 | 1989 | install_element(ISIS_NODE, &isis_mpls_te_inter_as_cmd); |
8b104c10 EDP |
1990 | |
1991 | install_element(ISIS_NODE, &isis_default_originate_cmd); | |
a041ac8e | 1992 | install_element(ISIS_NODE, &isis_redistribute_cmd); |
22af6a80 EDP |
1993 | |
1994 | install_element(ISIS_NODE, &isis_topology_cmd); | |
a6a36c41 EDP |
1995 | |
1996 | install_element(INTERFACE_NODE, &isis_passive_cmd); | |
3e20c83a EDP |
1997 | |
1998 | install_element(INTERFACE_NODE, &isis_passwd_cmd); | |
1999 | install_element(INTERFACE_NODE, &no_isis_passwd_cmd); | |
be49219c EDP |
2000 | |
2001 | install_element(INTERFACE_NODE, &isis_metric_cmd); | |
2002 | install_element(INTERFACE_NODE, &no_isis_metric_cmd); | |
356a2e3c EDP |
2003 | |
2004 | install_element(INTERFACE_NODE, &isis_hello_interval_cmd); | |
2005 | install_element(INTERFACE_NODE, &no_isis_hello_interval_cmd); | |
4e75a67d EDP |
2006 | |
2007 | install_element(INTERFACE_NODE, &isis_hello_multiplier_cmd); | |
2008 | install_element(INTERFACE_NODE, &no_isis_hello_multiplier_cmd); | |
5f2ce446 EDP |
2009 | |
2010 | install_element(INTERFACE_NODE, &isis_threeway_adj_cmd); | |
7b6b75e5 EDP |
2011 | |
2012 | install_element(INTERFACE_NODE, &isis_hello_padding_cmd); | |
9ce808b9 EDP |
2013 | |
2014 | install_element(INTERFACE_NODE, &csnp_interval_cmd); | |
2015 | install_element(INTERFACE_NODE, &no_csnp_interval_cmd); | |
2016 | ||
2017 | install_element(INTERFACE_NODE, &psnp_interval_cmd); | |
2018 | install_element(INTERFACE_NODE, &no_psnp_interval_cmd); | |
83d043f6 EDP |
2019 | |
2020 | install_element(INTERFACE_NODE, &circuit_topology_cmd); | |
9302fbb6 EDP |
2021 | |
2022 | install_element(INTERFACE_NODE, &isis_circuit_type_cmd); | |
2023 | install_element(INTERFACE_NODE, &no_isis_circuit_type_cmd); | |
d0820765 EDP |
2024 | |
2025 | install_element(INTERFACE_NODE, &isis_network_cmd); | |
d59c2d6b EDP |
2026 | |
2027 | install_element(INTERFACE_NODE, &isis_priority_cmd); | |
2028 | install_element(INTERFACE_NODE, &no_isis_priority_cmd); | |
2adf66ff EDP |
2029 | |
2030 | install_element(ISIS_NODE, &log_adj_changes_cmd); | |
20bd27e2 EDP |
2031 | } |
2032 | ||
2033 | #endif /* ifndef FABRICD */ |