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