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