2 * Copyright (C) 2001,2002 Sampo Saaristo
3 * Tampere University of Technology
4 * Institute of Communications Engineering
5 * Copyright (C) 2018 Volta Networks
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)
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
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
26 #include "northbound.h"
32 #include "spf_backoff.h"
33 #include "lib_errors.h"
36 #include "link_state.h"
38 #include "isisd/isisd.h"
39 #include "isisd/isis_nb.h"
40 #include "isisd/isis_common.h"
41 #include "isisd/isis_bfd.h"
42 #include "isisd/isis_circuit.h"
43 #include "isisd/isis_lsp.h"
44 #include "isisd/isis_dynhn.h"
45 #include "isisd/isis_misc.h"
46 #include "isisd/isis_csm.h"
47 #include "isisd/isis_adjacency.h"
48 #include "isisd/isis_spf.h"
49 #include "isisd/isis_spf_private.h"
50 #include "isisd/isis_te.h"
51 #include "isisd/isis_mt.h"
52 #include "isisd/isis_redist.h"
53 #include "isisd/isis_ldp_sync.h"
54 #include "isisd/isis_dr.h"
55 #include "isisd/isis_zebra.h"
58 * XPath: /frr-isisd:isis/instance
60 int isis_instance_create(struct nb_cb_create_args
*args
)
62 struct isis_area
*area
;
66 if (args
->event
!= NB_EV_APPLY
)
68 vrf_name
= yang_dnode_get_string(args
->dnode
, "./vrf");
69 area_tag
= yang_dnode_get_string(args
->dnode
, "./area-tag");
71 area
= isis_area_lookup_by_vrf(area_tag
, vrf_name
);
73 return NB_ERR_INCONSISTENCY
;
75 area
= isis_area_create(area_tag
, vrf_name
);
77 /* save area in dnode to avoid looking it up all the time */
78 nb_running_set_entry(args
->dnode
, area
);
83 int isis_instance_destroy(struct nb_cb_destroy_args
*args
)
85 struct isis_area
*area
;
88 if (args
->event
!= NB_EV_APPLY
)
90 area
= nb_running_unset_entry(args
->dnode
);
92 isis_area_destroy(area
);
94 if (listcount(isis
->area_list
) == 0)
101 * XPath: /frr-isisd:isis/instance/is-type
103 int isis_instance_is_type_modify(struct nb_cb_modify_args
*args
)
105 struct isis_area
*area
;
108 if (args
->event
!= NB_EV_APPLY
)
111 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
112 type
= yang_dnode_get_enum(args
->dnode
, NULL
);
113 isis_area_is_type_set(area
, type
);
119 struct area_addr
*addr
;
123 static int sysid_iter_cb(const struct lyd_node
*dnode
, void *arg
)
125 struct sysid_iter
*iter
= arg
;
126 struct area_addr addr
;
129 net
= yang_dnode_get_string(dnode
, NULL
);
130 addr
.addr_len
= dotformat2buff(addr
.area_addr
, net
);
132 if (memcmp(GETSYSID(iter
->addr
), GETSYSID((&addr
)), ISIS_SYS_ID_LEN
)) {
134 return YANG_ITER_STOP
;
137 return YANG_ITER_CONTINUE
;
141 * XPath: /frr-isisd:isis/instance/area-address
143 int isis_instance_area_address_create(struct nb_cb_create_args
*args
)
145 struct isis_area
*area
;
146 struct area_addr addr
, *addrr
= NULL
, *addrp
= NULL
;
147 struct listnode
*node
;
148 struct sysid_iter iter
;
150 const char *net_title
= yang_dnode_get_string(args
->dnode
, NULL
);
152 switch (args
->event
) {
154 addr
.addr_len
= dotformat2buff(buff
, net_title
);
155 memcpy(addr
.area_addr
, buff
, addr
.addr_len
);
156 if (addr
.area_addr
[addr
.addr_len
- 1] != 0) {
158 args
->errmsg
, args
->errmsg_len
,
159 "nsel byte (last byte) in area address must be 0");
160 return NB_ERR_VALIDATION
;
166 yang_dnode_iterate(sysid_iter_cb
, &iter
, args
->dnode
,
171 args
->errmsg
, args
->errmsg_len
,
172 "System ID must not change when defining additional area addresses");
173 return NB_ERR_VALIDATION
;
177 addrr
= XMALLOC(MTYPE_ISIS_AREA_ADDR
, sizeof(struct area_addr
));
178 addrr
->addr_len
= dotformat2buff(buff
, net_title
);
179 memcpy(addrr
->area_addr
, buff
, addrr
->addr_len
);
180 args
->resource
->ptr
= addrr
;
183 XFREE(MTYPE_ISIS_AREA_ADDR
, args
->resource
->ptr
);
186 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
187 addrr
= args
->resource
->ptr
;
190 if (area
->isis
->sysid_set
== 0) {
192 * First area address - get the SystemID for this router
194 memcpy(area
->isis
->sysid
, GETSYSID(addrr
),
196 area
->isis
->sysid_set
= 1;
198 /* check that we don't already have this address */
199 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
,
201 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
203 != (addrr
->addr_len
))
205 if (!memcmp(addrp
->area_addr
, addrr
->area_addr
,
207 XFREE(MTYPE_ISIS_AREA_ADDR
, addrr
);
208 return NB_OK
; /* silent fail */
213 /*Forget the systemID part of the address */
214 addrr
->addr_len
-= (ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
);
215 assert(area
->area_addrs
); /* to silence scan-build sillyness */
216 listnode_add(area
->area_addrs
, addrr
);
218 /* only now we can safely generate our LSPs for this area */
219 if (listcount(area
->area_addrs
) > 0) {
220 if (area
->is_type
& IS_LEVEL_1
)
221 lsp_generate(area
, IS_LEVEL_1
);
222 if (area
->is_type
& IS_LEVEL_2
)
223 lsp_generate(area
, IS_LEVEL_2
);
231 int isis_instance_area_address_destroy(struct nb_cb_destroy_args
*args
)
233 struct area_addr addr
, *addrp
= NULL
;
234 struct listnode
*node
;
236 struct isis_area
*area
;
237 const char *net_title
;
238 struct listnode
*cnode
;
239 struct isis_circuit
*circuit
;
242 if (args
->event
!= NB_EV_APPLY
)
245 net_title
= yang_dnode_get_string(args
->dnode
, NULL
);
246 addr
.addr_len
= dotformat2buff(buff
, net_title
);
247 memcpy(addr
.area_addr
, buff
, (int)addr
.addr_len
);
248 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
250 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
)) {
251 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ 1) == addr
.addr_len
252 && !memcmp(addrp
->area_addr
, addr
.area_addr
, addr
.addr_len
))
256 return NB_ERR_INCONSISTENCY
;
258 listnode_delete(area
->area_addrs
, addrp
);
259 XFREE(MTYPE_ISIS_AREA_ADDR
, addrp
);
261 * Last area address - reset the SystemID for this router
263 if (listcount(area
->area_addrs
) == 0) {
264 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
))
265 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
266 if (circuit
->u
.bc
.is_dr
[lvl
- 1])
267 isis_dr_resign(circuit
, lvl
);
269 memset(area
->isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
270 area
->isis
->sysid_set
= 0;
272 zlog_debug("Router has no SystemID");
279 * XPath: /frr-isisd:isis/instance/dynamic-hostname
281 int isis_instance_dynamic_hostname_modify(struct nb_cb_modify_args
*args
)
283 struct isis_area
*area
;
285 if (args
->event
!= NB_EV_APPLY
)
288 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
289 isis_area_dynhostname_set(area
, yang_dnode_get_bool(args
->dnode
, NULL
));
295 * XPath: /frr-isisd:isis/instance/attach-send
297 int isis_instance_attached_send_modify(struct nb_cb_modify_args
*args
)
299 struct isis_area
*area
;
302 if (args
->event
!= NB_EV_APPLY
)
305 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
306 attached
= yang_dnode_get_bool(args
->dnode
, NULL
);
307 isis_area_attached_bit_send_set(area
, attached
);
313 * XPath: /frr-isisd:isis/instance/attach-receive-ignore
315 int isis_instance_attached_receive_modify(struct nb_cb_modify_args
*args
)
317 struct isis_area
*area
;
320 if (args
->event
!= NB_EV_APPLY
)
323 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
324 attached
= yang_dnode_get_bool(args
->dnode
, NULL
);
325 isis_area_attached_bit_receive_set(area
, attached
);
331 * XPath: /frr-isisd:isis/instance/attached
333 int isis_instance_attached_modify(struct nb_cb_modify_args
*args
)
339 * XPath: /frr-isisd:isis/instance/overload
341 int isis_instance_overload_modify(struct nb_cb_modify_args
*args
)
343 struct isis_area
*area
;
346 if (args
->event
!= NB_EV_APPLY
)
349 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
350 overload
= yang_dnode_get_bool(args
->dnode
, NULL
);
351 isis_area_overload_bit_set(area
, overload
);
357 * XPath: /frr-isisd:isis/instance/metric-style
359 int isis_instance_metric_style_modify(struct nb_cb_modify_args
*args
)
361 struct isis_area
*area
;
362 bool old_metric
, new_metric
;
363 enum isis_metric_style metric_style
=
364 yang_dnode_get_enum(args
->dnode
, NULL
);
366 if (args
->event
!= NB_EV_APPLY
)
369 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
370 old_metric
= (metric_style
== ISIS_WIDE_METRIC
) ? false : true;
371 new_metric
= (metric_style
== ISIS_NARROW_METRIC
) ? false : true;
372 isis_area_metricstyle_set(area
, old_metric
, new_metric
);
378 * XPath: /frr-isisd:isis/instance/purge-originator
380 int isis_instance_purge_originator_modify(struct nb_cb_modify_args
*args
)
382 struct isis_area
*area
;
384 if (args
->event
!= NB_EV_APPLY
)
387 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
388 area
->purge_originator
= yang_dnode_get_bool(args
->dnode
, NULL
);
394 * XPath: /frr-isisd:isis/instance/lsp/mtu
396 int isis_instance_lsp_mtu_modify(struct nb_cb_modify_args
*args
)
398 uint16_t lsp_mtu
= yang_dnode_get_uint16(args
->dnode
, NULL
);
399 struct isis_area
*area
;
401 switch (args
->event
) {
407 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
408 isis_area_lsp_mtu_set(area
, lsp_mtu
);
416 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/refresh-interval
418 int isis_instance_lsp_refresh_interval_level_1_modify(
419 struct nb_cb_modify_args
*args
)
421 struct isis_area
*area
;
424 if (args
->event
!= NB_EV_APPLY
)
427 refr_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
428 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
429 isis_area_lsp_refresh_set(area
, IS_LEVEL_1
, refr_int
);
435 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/refresh-interval
437 int isis_instance_lsp_refresh_interval_level_2_modify(
438 struct nb_cb_modify_args
*args
)
440 struct isis_area
*area
;
443 if (args
->event
!= NB_EV_APPLY
)
446 refr_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
447 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
448 isis_area_lsp_refresh_set(area
, IS_LEVEL_2
, refr_int
);
454 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/maximum-lifetime
456 int isis_instance_lsp_maximum_lifetime_level_1_modify(
457 struct nb_cb_modify_args
*args
)
459 struct isis_area
*area
;
462 if (args
->event
!= NB_EV_APPLY
)
465 max_lt
= yang_dnode_get_uint16(args
->dnode
, NULL
);
466 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
467 isis_area_max_lsp_lifetime_set(area
, IS_LEVEL_1
, max_lt
);
473 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/maximum-lifetime
475 int isis_instance_lsp_maximum_lifetime_level_2_modify(
476 struct nb_cb_modify_args
*args
)
478 struct isis_area
*area
;
481 if (args
->event
!= NB_EV_APPLY
)
484 max_lt
= yang_dnode_get_uint16(args
->dnode
, NULL
);
485 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
486 isis_area_max_lsp_lifetime_set(area
, IS_LEVEL_2
, max_lt
);
492 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/generation-interval
494 int isis_instance_lsp_generation_interval_level_1_modify(
495 struct nb_cb_modify_args
*args
)
497 struct isis_area
*area
;
500 if (args
->event
!= NB_EV_APPLY
)
503 gen_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
504 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
505 area
->lsp_gen_interval
[0] = gen_int
;
511 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/generation-interval
513 int isis_instance_lsp_generation_interval_level_2_modify(
514 struct nb_cb_modify_args
*args
)
516 struct isis_area
*area
;
519 if (args
->event
!= NB_EV_APPLY
)
522 gen_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
523 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
524 area
->lsp_gen_interval
[1] = gen_int
;
530 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay
532 void ietf_backoff_delay_apply_finish(struct nb_cb_apply_finish_args
*args
)
534 long init_delay
= yang_dnode_get_uint16(args
->dnode
, "./init-delay");
535 long short_delay
= yang_dnode_get_uint16(args
->dnode
, "./short-delay");
536 long long_delay
= yang_dnode_get_uint16(args
->dnode
, "./long-delay");
537 long holddown
= yang_dnode_get_uint16(args
->dnode
, "./hold-down");
539 yang_dnode_get_uint16(args
->dnode
, "./time-to-learn");
540 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
541 size_t bufsiz
= strlen(area
->area_tag
) + sizeof("IS-IS Lx");
542 char *buf
= XCALLOC(MTYPE_TMP
, bufsiz
);
544 snprintf(buf
, bufsiz
, "IS-IS %s L1", area
->area_tag
);
545 spf_backoff_free(area
->spf_delay_ietf
[0]);
546 area
->spf_delay_ietf
[0] =
547 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
548 long_delay
, holddown
, timetolearn
);
550 snprintf(buf
, bufsiz
, "IS-IS %s L2", area
->area_tag
);
551 spf_backoff_free(area
->spf_delay_ietf
[1]);
552 area
->spf_delay_ietf
[1] =
553 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
554 long_delay
, holddown
, timetolearn
);
556 XFREE(MTYPE_TMP
, buf
);
559 int isis_instance_spf_ietf_backoff_delay_create(struct nb_cb_create_args
*args
)
561 /* All the work is done in the apply_finish */
565 int isis_instance_spf_ietf_backoff_delay_destroy(
566 struct nb_cb_destroy_args
*args
)
568 struct isis_area
*area
;
570 if (args
->event
!= NB_EV_APPLY
)
573 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
574 spf_backoff_free(area
->spf_delay_ietf
[0]);
575 spf_backoff_free(area
->spf_delay_ietf
[1]);
576 area
->spf_delay_ietf
[0] = NULL
;
577 area
->spf_delay_ietf
[1] = NULL
;
583 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/init-delay
585 int isis_instance_spf_ietf_backoff_delay_init_delay_modify(
586 struct nb_cb_modify_args
*args
)
588 /* All the work is done in the apply_finish */
593 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/short-delay
595 int isis_instance_spf_ietf_backoff_delay_short_delay_modify(
596 struct nb_cb_modify_args
*args
)
598 /* All the work is done in the apply_finish */
603 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/long-delay
605 int isis_instance_spf_ietf_backoff_delay_long_delay_modify(
606 struct nb_cb_modify_args
*args
)
608 /* All the work is done in the apply_finish */
613 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/hold-down
615 int isis_instance_spf_ietf_backoff_delay_hold_down_modify(
616 struct nb_cb_modify_args
*args
)
618 /* All the work is done in the apply_finish */
623 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/time-to-learn
625 int isis_instance_spf_ietf_backoff_delay_time_to_learn_modify(
626 struct nb_cb_modify_args
*args
)
628 /* All the work is done in the apply_finish */
633 * XPath: /frr-isisd:isis/instance/spf/minimum-interval/level-1
635 int isis_instance_spf_minimum_interval_level_1_modify(
636 struct nb_cb_modify_args
*args
)
638 struct isis_area
*area
;
640 if (args
->event
!= NB_EV_APPLY
)
643 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
644 area
->min_spf_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
650 * XPath: /frr-isisd:isis/instance/spf/minimum-interval/level-2
652 int isis_instance_spf_minimum_interval_level_2_modify(
653 struct nb_cb_modify_args
*args
)
655 struct isis_area
*area
;
657 if (args
->event
!= NB_EV_APPLY
)
660 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
661 area
->min_spf_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
668 * /frr-isisd:isis/instance/spf/prefix-priorities/critical/access-list-name
670 int isis_instance_spf_prefix_priorities_critical_access_list_name_modify(
671 struct nb_cb_modify_args
*args
)
673 struct isis_area
*area
;
674 const char *acl_name
;
675 struct spf_prefix_priority_acl
*ppa
;
677 if (args
->event
!= NB_EV_APPLY
)
680 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
681 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
683 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_CRITICAL
];
684 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
685 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
686 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
687 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
688 lsp_regenerate_schedule(area
, area
->is_type
, 0);
693 int isis_instance_spf_prefix_priorities_critical_access_list_name_destroy(
694 struct nb_cb_destroy_args
*args
)
696 struct isis_area
*area
;
697 struct spf_prefix_priority_acl
*ppa
;
699 if (args
->event
!= NB_EV_APPLY
)
702 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
704 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_CRITICAL
];
705 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
708 lsp_regenerate_schedule(area
, area
->is_type
, 0);
714 * XPath: /frr-isisd:isis/instance/spf/prefix-priorities/high/access-list-name
716 int isis_instance_spf_prefix_priorities_high_access_list_name_modify(
717 struct nb_cb_modify_args
*args
)
719 struct isis_area
*area
;
720 const char *acl_name
;
721 struct spf_prefix_priority_acl
*ppa
;
723 if (args
->event
!= NB_EV_APPLY
)
726 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
727 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
729 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_HIGH
];
730 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
731 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
732 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
733 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
734 lsp_regenerate_schedule(area
, area
->is_type
, 0);
739 int isis_instance_spf_prefix_priorities_high_access_list_name_destroy(
740 struct nb_cb_destroy_args
*args
)
742 struct isis_area
*area
;
743 struct spf_prefix_priority_acl
*ppa
;
745 if (args
->event
!= NB_EV_APPLY
)
748 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
750 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_HIGH
];
751 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
754 lsp_regenerate_schedule(area
, area
->is_type
, 0);
760 * XPath: /frr-isisd:isis/instance/spf/prefix-priorities/medium/access-list-name
762 int isis_instance_spf_prefix_priorities_medium_access_list_name_modify(
763 struct nb_cb_modify_args
*args
)
765 struct isis_area
*area
;
766 const char *acl_name
;
767 struct spf_prefix_priority_acl
*ppa
;
769 if (args
->event
!= NB_EV_APPLY
)
772 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
773 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
775 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_MEDIUM
];
776 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
777 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
778 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
779 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
780 lsp_regenerate_schedule(area
, area
->is_type
, 0);
785 int isis_instance_spf_prefix_priorities_medium_access_list_name_destroy(
786 struct nb_cb_destroy_args
*args
)
788 struct isis_area
*area
;
789 struct spf_prefix_priority_acl
*ppa
;
791 if (args
->event
!= NB_EV_APPLY
)
794 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
796 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_MEDIUM
];
797 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
800 lsp_regenerate_schedule(area
, area
->is_type
, 0);
806 * XPath: /frr-isisd:isis/instance/area-password
808 void area_password_apply_finish(struct nb_cb_apply_finish_args
*args
)
810 const char *password
= yang_dnode_get_string(args
->dnode
, "./password");
811 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
812 int pass_type
= yang_dnode_get_enum(args
->dnode
, "./password-type");
814 yang_dnode_get_enum(args
->dnode
, "./authenticate-snp");
817 case ISIS_PASSWD_TYPE_CLEARTXT
:
818 isis_area_passwd_cleartext_set(area
, IS_LEVEL_1
, password
,
821 case ISIS_PASSWD_TYPE_HMAC_MD5
:
822 isis_area_passwd_hmac_md5_set(area
, IS_LEVEL_1
, password
,
828 int isis_instance_area_password_create(struct nb_cb_create_args
*args
)
830 /* actual setting is done in apply_finish */
834 int isis_instance_area_password_destroy(struct nb_cb_destroy_args
*args
)
836 struct isis_area
*area
;
838 if (args
->event
!= NB_EV_APPLY
)
841 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
842 isis_area_passwd_unset(area
, IS_LEVEL_1
);
848 * XPath: /frr-isisd:isis/instance/area-password/password
850 int isis_instance_area_password_password_modify(struct nb_cb_modify_args
*args
)
852 /* actual setting is done in apply_finish */
857 * XPath: /frr-isisd:isis/instance/area-password/password-type
859 int isis_instance_area_password_password_type_modify(
860 struct nb_cb_modify_args
*args
)
862 /* actual setting is done in apply_finish */
867 * XPath: /frr-isisd:isis/instance/area-password/authenticate-snp
869 int isis_instance_area_password_authenticate_snp_modify(
870 struct nb_cb_modify_args
*args
)
872 /* actual setting is done in apply_finish */
877 * XPath: /frr-isisd:isis/instance/domain-password
879 void domain_password_apply_finish(struct nb_cb_apply_finish_args
*args
)
881 const char *password
= yang_dnode_get_string(args
->dnode
, "./password");
882 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
883 int pass_type
= yang_dnode_get_enum(args
->dnode
, "./password-type");
885 yang_dnode_get_enum(args
->dnode
, "./authenticate-snp");
888 case ISIS_PASSWD_TYPE_CLEARTXT
:
889 isis_area_passwd_cleartext_set(area
, IS_LEVEL_2
, password
,
892 case ISIS_PASSWD_TYPE_HMAC_MD5
:
893 isis_area_passwd_hmac_md5_set(area
, IS_LEVEL_2
, password
,
899 int isis_instance_domain_password_create(struct nb_cb_create_args
*args
)
901 /* actual setting is done in apply_finish */
905 int isis_instance_domain_password_destroy(struct nb_cb_destroy_args
*args
)
907 struct isis_area
*area
;
909 if (args
->event
!= NB_EV_APPLY
)
912 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
913 isis_area_passwd_unset(area
, IS_LEVEL_2
);
919 * XPath: /frr-isisd:isis/instance/domain-password/password
921 int isis_instance_domain_password_password_modify(
922 struct nb_cb_modify_args
*args
)
924 /* actual setting is done in apply_finish */
929 * XPath: /frr-isisd:isis/instance/domain-password/password-type
931 int isis_instance_domain_password_password_type_modify(
932 struct nb_cb_modify_args
*args
)
934 /* actual setting is done in apply_finish */
939 * XPath: /frr-isisd:isis/instance/domain-password/authenticate-snp
941 int isis_instance_domain_password_authenticate_snp_modify(
942 struct nb_cb_modify_args
*args
)
944 /* actual setting is done in apply_finish */
949 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4
951 void default_info_origin_apply_finish(const struct lyd_node
*dnode
, int family
)
953 int originate_type
= DEFAULT_ORIGINATE
;
954 unsigned long metric
= 0;
955 const char *routemap
= NULL
;
956 struct isis_area
*area
= nb_running_get_entry(dnode
, NULL
, true);
957 int level
= yang_dnode_get_enum(dnode
, "./level");
959 if (yang_dnode_get_bool(dnode
, "./always")) {
960 originate_type
= DEFAULT_ORIGINATE_ALWAYS
;
961 } else if (family
== AF_INET6
) {
963 "%s: Zebra doesn't implement default-originate for IPv6 yet, so use with care or use default-originate always.",
967 if (yang_dnode_exists(dnode
, "./metric"))
968 metric
= yang_dnode_get_uint32(dnode
, "./metric");
969 if (yang_dnode_exists(dnode
, "./route-map"))
970 routemap
= yang_dnode_get_string(dnode
, "./route-map");
972 isis_redist_set(area
, level
, family
, DEFAULT_ROUTE
, metric
, routemap
,
976 void default_info_origin_ipv4_apply_finish(struct nb_cb_apply_finish_args
*args
)
978 default_info_origin_apply_finish(args
->dnode
, AF_INET
);
981 void default_info_origin_ipv6_apply_finish(struct nb_cb_apply_finish_args
*args
)
983 default_info_origin_apply_finish(args
->dnode
, AF_INET6
);
986 int isis_instance_default_information_originate_ipv4_create(
987 struct nb_cb_create_args
*args
)
989 /* It's all done by default_info_origin_apply_finish */
993 int isis_instance_default_information_originate_ipv4_destroy(
994 struct nb_cb_destroy_args
*args
)
996 struct isis_area
*area
;
999 if (args
->event
!= NB_EV_APPLY
)
1002 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1003 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1004 isis_redist_unset(area
, level
, AF_INET
, DEFAULT_ROUTE
);
1010 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/always
1012 int isis_instance_default_information_originate_ipv4_always_modify(
1013 struct nb_cb_modify_args
*args
)
1015 /* It's all done by default_info_origin_apply_finish */
1020 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/route-map
1022 int isis_instance_default_information_originate_ipv4_route_map_modify(
1023 struct nb_cb_modify_args
*args
)
1025 /* It's all done by default_info_origin_apply_finish */
1029 int isis_instance_default_information_originate_ipv4_route_map_destroy(
1030 struct nb_cb_destroy_args
*args
)
1032 /* It's all done by default_info_origin_apply_finish */
1037 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/metric
1039 int isis_instance_default_information_originate_ipv4_metric_modify(
1040 struct nb_cb_modify_args
*args
)
1042 /* It's all done by default_info_origin_apply_finish */
1047 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6
1049 int isis_instance_default_information_originate_ipv6_create(
1050 struct nb_cb_create_args
*args
)
1052 /* It's all done by default_info_origin_apply_finish */
1056 int isis_instance_default_information_originate_ipv6_destroy(
1057 struct nb_cb_destroy_args
*args
)
1059 struct isis_area
*area
;
1062 if (args
->event
!= NB_EV_APPLY
)
1065 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1066 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1067 isis_redist_unset(area
, level
, AF_INET6
, DEFAULT_ROUTE
);
1073 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/always
1075 int isis_instance_default_information_originate_ipv6_always_modify(
1076 struct nb_cb_modify_args
*args
)
1078 /* It's all done by default_info_origin_apply_finish */
1083 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/route-map
1085 int isis_instance_default_information_originate_ipv6_route_map_modify(
1086 struct nb_cb_modify_args
*args
)
1088 /* It's all done by default_info_origin_apply_finish */
1092 int isis_instance_default_information_originate_ipv6_route_map_destroy(
1093 struct nb_cb_destroy_args
*args
)
1095 /* It's all done by default_info_origin_apply_finish */
1100 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/metric
1102 int isis_instance_default_information_originate_ipv6_metric_modify(
1103 struct nb_cb_modify_args
*args
)
1105 /* It's all done by default_info_origin_apply_finish */
1110 * XPath: /frr-isisd:isis/instance/redistribute/ipv4
1112 void redistribute_apply_finish(const struct lyd_node
*dnode
, int family
)
1114 assert(family
== AF_INET
|| family
== AF_INET6
);
1116 unsigned long metric
= 0;
1117 const char *routemap
= NULL
;
1118 struct isis_area
*area
;
1120 type
= yang_dnode_get_enum(dnode
, "./protocol");
1121 level
= yang_dnode_get_enum(dnode
, "./level");
1122 area
= nb_running_get_entry(dnode
, NULL
, true);
1124 if (yang_dnode_exists(dnode
, "./metric"))
1125 metric
= yang_dnode_get_uint32(dnode
, "./metric");
1126 if (yang_dnode_exists(dnode
, "./route-map"))
1127 routemap
= yang_dnode_get_string(dnode
, "./route-map");
1129 isis_redist_set(area
, level
, family
, type
, metric
, routemap
, 0);
1132 void redistribute_ipv4_apply_finish(struct nb_cb_apply_finish_args
*args
)
1134 redistribute_apply_finish(args
->dnode
, AF_INET
);
1137 void redistribute_ipv6_apply_finish(struct nb_cb_apply_finish_args
*args
)
1139 redistribute_apply_finish(args
->dnode
, AF_INET6
);
1142 int isis_instance_redistribute_ipv4_create(struct nb_cb_create_args
*args
)
1144 /* It's all done by redistribute_apply_finish */
1148 int isis_instance_redistribute_ipv4_destroy(struct nb_cb_destroy_args
*args
)
1150 struct isis_area
*area
;
1153 if (args
->event
!= NB_EV_APPLY
)
1156 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1157 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1158 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
1159 isis_redist_unset(area
, level
, AF_INET
, type
);
1165 * XPath: /frr-isisd:isis/instance/redistribute/ipv4/route-map
1167 int isis_instance_redistribute_ipv4_route_map_modify(
1168 struct nb_cb_modify_args
*args
)
1170 /* It's all done by redistribute_apply_finish */
1174 int isis_instance_redistribute_ipv4_route_map_destroy(
1175 struct nb_cb_destroy_args
*args
)
1177 /* It's all done by redistribute_apply_finish */
1182 * XPath: /frr-isisd:isis/instance/redistribute/ipv4/metric
1184 int isis_instance_redistribute_ipv4_metric_modify(
1185 struct nb_cb_modify_args
*args
)
1187 /* It's all done by redistribute_apply_finish */
1192 * XPath: /frr-isisd:isis/instance/redistribute/ipv6
1194 int isis_instance_redistribute_ipv6_create(struct nb_cb_create_args
*args
)
1196 /* It's all done by redistribute_apply_finish */
1200 int isis_instance_redistribute_ipv6_destroy(struct nb_cb_destroy_args
*args
)
1202 struct isis_area
*area
;
1205 if (args
->event
!= NB_EV_APPLY
)
1208 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1209 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1210 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
1211 isis_redist_unset(area
, level
, AF_INET6
, type
);
1217 * XPath: /frr-isisd:isis/instance/redistribute/ipv6/route-map
1219 int isis_instance_redistribute_ipv6_route_map_modify(
1220 struct nb_cb_modify_args
*args
)
1222 /* It's all done by redistribute_apply_finish */
1226 int isis_instance_redistribute_ipv6_route_map_destroy(
1227 struct nb_cb_destroy_args
*args
)
1229 /* It's all done by redistribute_apply_finish */
1234 * XPath: /frr-isisd:isis/instance/redistribute/ipv6/metric
1236 int isis_instance_redistribute_ipv6_metric_modify(
1237 struct nb_cb_modify_args
*args
)
1239 /* It's all done by redistribute_apply_finish */
1244 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-multicast
1246 static int isis_multi_topology_common(enum nb_event event
,
1247 const struct lyd_node
*dnode
,
1248 char *errmsg
, size_t errmsg_len
,
1249 const char *topology
, bool create
)
1251 struct isis_area
*area
;
1252 struct isis_area_mt_setting
*setting
;
1253 uint16_t mtid
= isis_str2mtid(topology
);
1256 case NB_EV_VALIDATE
:
1257 if (mtid
== (uint16_t)-1) {
1258 snprintf(errmsg
, errmsg_len
, "Unknown topology %s",
1260 return NB_ERR_VALIDATION
;
1267 area
= nb_running_get_entry(dnode
, NULL
, true);
1268 setting
= area_get_mt_setting(area
, mtid
);
1269 setting
->enabled
= create
;
1270 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1277 static int isis_multi_topology_overload_common(enum nb_event event
,
1278 const struct lyd_node
*dnode
,
1279 const char *topology
)
1281 struct isis_area
*area
;
1282 struct isis_area_mt_setting
*setting
;
1283 uint16_t mtid
= isis_str2mtid(topology
);
1285 /* validation is done in isis_multi_topology_common */
1286 if (event
!= NB_EV_APPLY
)
1289 area
= nb_running_get_entry(dnode
, NULL
, true);
1290 setting
= area_get_mt_setting(area
, mtid
);
1291 setting
->overload
= yang_dnode_get_bool(dnode
, NULL
);
1292 if (setting
->enabled
)
1293 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1298 int isis_instance_multi_topology_ipv4_multicast_create(
1299 struct nb_cb_create_args
*args
)
1301 return isis_multi_topology_common(args
->event
, args
->dnode
,
1302 args
->errmsg
, args
->errmsg_len
,
1303 "ipv4-multicast", true);
1306 int isis_instance_multi_topology_ipv4_multicast_destroy(
1307 struct nb_cb_destroy_args
*args
)
1309 return isis_multi_topology_common(args
->event
, args
->dnode
,
1310 args
->errmsg
, args
->errmsg_len
,
1311 "ipv4-multicast", false);
1315 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-multicast/overload
1317 int isis_instance_multi_topology_ipv4_multicast_overload_modify(
1318 struct nb_cb_modify_args
*args
)
1320 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1325 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-management
1327 int isis_instance_multi_topology_ipv4_management_create(
1328 struct nb_cb_create_args
*args
)
1330 return isis_multi_topology_common(args
->event
, args
->dnode
,
1331 args
->errmsg
, args
->errmsg_len
,
1335 int isis_instance_multi_topology_ipv4_management_destroy(
1336 struct nb_cb_destroy_args
*args
)
1338 return isis_multi_topology_common(args
->event
, args
->dnode
,
1339 args
->errmsg
, args
->errmsg_len
,
1340 "ipv4-mgmt", false);
1344 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-management/overload
1346 int isis_instance_multi_topology_ipv4_management_overload_modify(
1347 struct nb_cb_modify_args
*args
)
1349 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1354 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-unicast
1356 int isis_instance_multi_topology_ipv6_unicast_create(
1357 struct nb_cb_create_args
*args
)
1359 return isis_multi_topology_common(args
->event
, args
->dnode
,
1360 args
->errmsg
, args
->errmsg_len
,
1361 "ipv6-unicast", true);
1364 int isis_instance_multi_topology_ipv6_unicast_destroy(
1365 struct nb_cb_destroy_args
*args
)
1367 return isis_multi_topology_common(args
->event
, args
->dnode
,
1368 args
->errmsg
, args
->errmsg_len
,
1369 "ipv6-unicast", false);
1373 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-unicast/overload
1375 int isis_instance_multi_topology_ipv6_unicast_overload_modify(
1376 struct nb_cb_modify_args
*args
)
1378 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1383 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-multicast
1385 int isis_instance_multi_topology_ipv6_multicast_create(
1386 struct nb_cb_create_args
*args
)
1388 return isis_multi_topology_common(args
->event
, args
->dnode
,
1389 args
->errmsg
, args
->errmsg_len
,
1390 "ipv6-multicast", true);
1393 int isis_instance_multi_topology_ipv6_multicast_destroy(
1394 struct nb_cb_destroy_args
*args
)
1396 return isis_multi_topology_common(args
->event
, args
->dnode
,
1397 args
->errmsg
, args
->errmsg_len
,
1398 "ipv6-multicast", false);
1402 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-multicast/overload
1404 int isis_instance_multi_topology_ipv6_multicast_overload_modify(
1405 struct nb_cb_modify_args
*args
)
1407 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1412 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-management
1414 int isis_instance_multi_topology_ipv6_management_create(
1415 struct nb_cb_create_args
*args
)
1417 return isis_multi_topology_common(args
->event
, args
->dnode
,
1418 args
->errmsg
, args
->errmsg_len
,
1422 int isis_instance_multi_topology_ipv6_management_destroy(
1423 struct nb_cb_destroy_args
*args
)
1425 return isis_multi_topology_common(args
->event
, args
->dnode
,
1426 args
->errmsg
, args
->errmsg_len
,
1427 "ipv6-mgmt", false);
1431 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-management/overload
1433 int isis_instance_multi_topology_ipv6_management_overload_modify(
1434 struct nb_cb_modify_args
*args
)
1436 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1441 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-dstsrc
1443 int isis_instance_multi_topology_ipv6_dstsrc_create(
1444 struct nb_cb_create_args
*args
)
1446 return isis_multi_topology_common(args
->event
, args
->dnode
,
1447 args
->errmsg
, args
->errmsg_len
,
1448 "ipv6-dstsrc", true);
1451 int isis_instance_multi_topology_ipv6_dstsrc_destroy(
1452 struct nb_cb_destroy_args
*args
)
1454 return isis_multi_topology_common(args
->event
, args
->dnode
,
1455 args
->errmsg
, args
->errmsg_len
,
1456 "ipv6-dstsrc", false);
1460 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-dstsrc/overload
1462 int isis_instance_multi_topology_ipv6_dstsrc_overload_modify(
1463 struct nb_cb_modify_args
*args
)
1465 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1470 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/load-sharing
1472 int isis_instance_fast_reroute_level_1_lfa_load_sharing_modify(
1473 struct nb_cb_modify_args
*args
)
1475 struct isis_area
*area
;
1477 if (args
->event
!= NB_EV_APPLY
)
1480 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1481 area
->lfa_load_sharing
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
1482 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1488 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/priority-limit
1490 int isis_instance_fast_reroute_level_1_lfa_priority_limit_modify(
1491 struct nb_cb_modify_args
*args
)
1493 struct isis_area
*area
;
1495 if (args
->event
!= NB_EV_APPLY
)
1498 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1499 area
->lfa_priority_limit
[0] = yang_dnode_get_enum(args
->dnode
, NULL
);
1500 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1505 int isis_instance_fast_reroute_level_1_lfa_priority_limit_destroy(
1506 struct nb_cb_destroy_args
*args
)
1508 struct isis_area
*area
;
1510 if (args
->event
!= NB_EV_APPLY
)
1513 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1514 area
->lfa_priority_limit
[0] = SPF_PREFIX_PRIO_LOW
;
1515 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1521 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/tiebreaker
1523 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_create(
1524 struct nb_cb_create_args
*args
)
1526 struct isis_area
*area
;
1528 enum lfa_tiebreaker_type type
;
1529 struct lfa_tiebreaker
*tie_b
;
1531 if (args
->event
!= NB_EV_APPLY
)
1534 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1535 index
= yang_dnode_get_uint8(args
->dnode
, "./index");
1536 type
= yang_dnode_get_enum(args
->dnode
, "./type");
1538 tie_b
= isis_lfa_tiebreaker_add(area
, ISIS_LEVEL1
, index
, type
);
1539 nb_running_set_entry(args
->dnode
, tie_b
);
1540 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1545 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_destroy(
1546 struct nb_cb_destroy_args
*args
)
1548 struct lfa_tiebreaker
*tie_b
;
1549 struct isis_area
*area
;
1551 if (args
->event
!= NB_EV_APPLY
)
1554 tie_b
= nb_running_unset_entry(args
->dnode
);
1556 isis_lfa_tiebreaker_delete(area
, ISIS_LEVEL1
, tie_b
);
1557 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1563 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/tiebreaker/type
1565 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_type_modify(
1566 struct nb_cb_modify_args
*args
)
1568 struct lfa_tiebreaker
*tie_b
;
1569 struct isis_area
*area
;
1571 if (args
->event
!= NB_EV_APPLY
)
1574 tie_b
= nb_running_get_entry(args
->dnode
, NULL
, true);
1576 tie_b
->type
= yang_dnode_get_enum(args
->dnode
, NULL
);
1577 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1583 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/remote-lfa/prefix-list
1585 int isis_instance_fast_reroute_level_1_remote_lfa_prefix_list_modify(
1586 struct nb_cb_modify_args
*args
)
1588 struct isis_area
*area
;
1589 const char *plist_name
;
1591 if (args
->event
!= NB_EV_APPLY
)
1594 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1595 plist_name
= yang_dnode_get_string(args
->dnode
, NULL
);
1597 area
->rlfa_plist_name
[0] = XSTRDUP(MTYPE_ISIS_PLIST_NAME
, plist_name
);
1598 area
->rlfa_plist
[0] = prefix_list_lookup(AFI_IP
, plist_name
);
1599 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1604 int isis_instance_fast_reroute_level_1_remote_lfa_prefix_list_destroy(
1605 struct nb_cb_destroy_args
*args
)
1607 struct isis_area
*area
;
1609 if (args
->event
!= NB_EV_APPLY
)
1612 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1614 XFREE(MTYPE_ISIS_PLIST_NAME
, area
->rlfa_plist_name
[0]);
1615 area
->rlfa_plist
[0] = NULL
;
1616 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1622 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/load-sharing
1624 int isis_instance_fast_reroute_level_2_lfa_load_sharing_modify(
1625 struct nb_cb_modify_args
*args
)
1627 struct isis_area
*area
;
1629 if (args
->event
!= NB_EV_APPLY
)
1632 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1633 area
->lfa_load_sharing
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
1639 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/priority-limit
1641 int isis_instance_fast_reroute_level_2_lfa_priority_limit_modify(
1642 struct nb_cb_modify_args
*args
)
1644 struct isis_area
*area
;
1646 if (args
->event
!= NB_EV_APPLY
)
1649 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1650 area
->lfa_priority_limit
[1] = yang_dnode_get_enum(args
->dnode
, NULL
);
1655 int isis_instance_fast_reroute_level_2_lfa_priority_limit_destroy(
1656 struct nb_cb_destroy_args
*args
)
1658 struct isis_area
*area
;
1660 if (args
->event
!= NB_EV_APPLY
)
1663 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1664 area
->lfa_priority_limit
[1] = SPF_PREFIX_PRIO_LOW
;
1670 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/tiebreaker
1672 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_create(
1673 struct nb_cb_create_args
*args
)
1675 struct isis_area
*area
;
1677 enum lfa_tiebreaker_type type
;
1678 struct lfa_tiebreaker
*tie_b
;
1680 if (args
->event
!= NB_EV_APPLY
)
1683 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1684 index
= yang_dnode_get_uint8(args
->dnode
, "./index");
1685 type
= yang_dnode_get_enum(args
->dnode
, "./type");
1687 tie_b
= isis_lfa_tiebreaker_add(area
, ISIS_LEVEL2
, index
, type
);
1688 nb_running_set_entry(args
->dnode
, tie_b
);
1689 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1694 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_destroy(
1695 struct nb_cb_destroy_args
*args
)
1697 struct lfa_tiebreaker
*tie_b
;
1698 struct isis_area
*area
;
1700 if (args
->event
!= NB_EV_APPLY
)
1703 tie_b
= nb_running_unset_entry(args
->dnode
);
1705 isis_lfa_tiebreaker_delete(area
, ISIS_LEVEL2
, tie_b
);
1706 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1712 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/tiebreaker/type
1714 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_type_modify(
1715 struct nb_cb_modify_args
*args
)
1717 struct lfa_tiebreaker
*tie_b
;
1718 struct isis_area
*area
;
1720 if (args
->event
!= NB_EV_APPLY
)
1723 tie_b
= nb_running_get_entry(args
->dnode
, NULL
, true);
1725 tie_b
->type
= yang_dnode_get_enum(args
->dnode
, NULL
);
1726 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1732 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/remote-lfa/prefix-list
1734 int isis_instance_fast_reroute_level_2_remote_lfa_prefix_list_modify(
1735 struct nb_cb_modify_args
*args
)
1737 struct isis_area
*area
;
1738 const char *plist_name
;
1740 if (args
->event
!= NB_EV_APPLY
)
1743 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1744 plist_name
= yang_dnode_get_string(args
->dnode
, NULL
);
1746 area
->rlfa_plist_name
[1] = XSTRDUP(MTYPE_ISIS_PLIST_NAME
, plist_name
);
1747 area
->rlfa_plist
[1] = prefix_list_lookup(AFI_IP
, plist_name
);
1748 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1753 int isis_instance_fast_reroute_level_2_remote_lfa_prefix_list_destroy(
1754 struct nb_cb_destroy_args
*args
)
1756 struct isis_area
*area
;
1758 if (args
->event
!= NB_EV_APPLY
)
1761 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1763 XFREE(MTYPE_ISIS_PLIST_NAME
, area
->rlfa_plist_name
[1]);
1764 area
->rlfa_plist
[1] = NULL
;
1765 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1771 * XPath: /frr-isisd:isis/instance/log-adjacency-changes
1773 int isis_instance_log_adjacency_changes_modify(struct nb_cb_modify_args
*args
)
1775 struct isis_area
*area
;
1776 bool log
= yang_dnode_get_bool(args
->dnode
, NULL
);
1778 if (args
->event
!= NB_EV_APPLY
)
1781 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1782 area
->log_adj_changes
= log
? 1 : 0;
1788 * XPath: /frr-isisd:isis/instance/mpls-te
1790 int isis_instance_mpls_te_create(struct nb_cb_create_args
*args
)
1792 struct isis_area
*area
;
1794 if (args
->event
!= NB_EV_APPLY
)
1797 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1798 isis_mpls_te_create(area
);
1800 /* Reoriginate STD_TE & GMPLS circuits */
1801 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1806 int isis_instance_mpls_te_destroy(struct nb_cb_destroy_args
*args
)
1808 struct isis_area
*area
;
1810 if (args
->event
!= NB_EV_APPLY
)
1813 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1814 if (!IS_MPLS_TE(area
->mta
))
1817 isis_mpls_te_disable(area
);
1819 /* Reoriginate STD_TE & GMPLS circuits */
1820 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1822 zlog_debug("ISIS-TE(%s): Disabled MPLS Traffic Engineering",
1829 * XPath: /frr-isisd:isis/instance/mpls-te/router-address
1831 int isis_instance_mpls_te_router_address_modify(struct nb_cb_modify_args
*args
)
1833 struct in_addr value
;
1834 struct isis_area
*area
;
1836 if (args
->event
!= NB_EV_APPLY
)
1839 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1840 /* only proceed if MPLS-TE is enabled */
1841 if (!IS_MPLS_TE(area
->mta
))
1844 /* Update Area Router ID */
1845 yang_dnode_get_ipv4(&value
, args
->dnode
, NULL
);
1846 area
->mta
->router_id
.s_addr
= value
.s_addr
;
1848 /* And re-schedule LSP update */
1849 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1854 int isis_instance_mpls_te_router_address_destroy(
1855 struct nb_cb_destroy_args
*args
)
1857 struct isis_area
*area
;
1859 if (args
->event
!= NB_EV_APPLY
)
1862 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1863 /* only proceed if MPLS-TE is enabled */
1864 if (!IS_MPLS_TE(area
->mta
))
1867 /* Reset Area Router ID */
1868 area
->mta
->router_id
.s_addr
= INADDR_ANY
;
1870 /* And re-schedule LSP update */
1871 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1877 * XPath: /frr-isisd:isis/instance/mpls-te/router-address-v6
1879 int isis_instance_mpls_te_router_address_ipv6_modify(
1880 struct nb_cb_modify_args
*args
)
1882 struct in6_addr value
;
1883 struct isis_area
*area
;
1885 if (args
->event
!= NB_EV_APPLY
)
1888 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1889 /* only proceed if MPLS-TE is enabled */
1890 if (!IS_MPLS_TE(area
->mta
))
1893 yang_dnode_get_ipv6(&value
, args
->dnode
, NULL
);
1894 /* Update Area IPv6 Router ID if different */
1895 if (!IPV6_ADDR_SAME(&area
->mta
->router_id_ipv6
, &value
)) {
1896 IPV6_ADDR_COPY(&area
->mta
->router_id_ipv6
, &value
);
1898 /* And re-schedule LSP update */
1899 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1905 int isis_instance_mpls_te_router_address_ipv6_destroy(
1906 struct nb_cb_destroy_args
*args
)
1908 struct isis_area
*area
;
1910 if (args
->event
!= NB_EV_APPLY
)
1913 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1914 /* only proceed if MPLS-TE is enabled */
1915 if (!IS_MPLS_TE(area
->mta
))
1918 /* Reset Area Router ID */
1919 IPV6_ADDR_COPY(&area
->mta
->router_id_ipv6
, &in6addr_any
);
1921 /* And re-schedule LSP update */
1922 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1928 * XPath: /frr-isisd:isis/instance/mpls-te/export
1930 int isis_instance_mpls_te_export_modify(struct nb_cb_modify_args
*args
)
1932 struct isis_area
*area
;
1934 if (args
->event
!= NB_EV_APPLY
)
1937 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1938 /* only proceed if MPLS-TE is enabled */
1939 if (!IS_MPLS_TE(area
->mta
))
1942 area
->mta
->export
= yang_dnode_get_bool(args
->dnode
, NULL
);
1943 if (area
->mta
->export
) {
1944 if (IS_DEBUG_EVENTS
)
1945 zlog_debug("MPLS-TE: Enabled Link State export");
1946 if (isis_zebra_ls_register(true) != 0)
1947 zlog_warn("Unable to register Link State");
1949 if (IS_DEBUG_EVENTS
)
1950 zlog_debug("MPLS-TE: Disable Link State export");
1951 if (isis_zebra_ls_register(false) != 0)
1952 zlog_warn("Unable to register Link State");
1959 * XPath: /frr-isisd:isis/instance/segment-routing/enabled
1961 int isis_instance_segment_routing_enabled_modify(
1962 struct nb_cb_modify_args
*args
)
1964 struct isis_area
*area
;
1966 if (args
->event
!= NB_EV_APPLY
)
1969 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1970 area
->srdb
.config
.enabled
= yang_dnode_get_bool(args
->dnode
, NULL
);
1972 if (area
->srdb
.config
.enabled
) {
1973 if (IS_DEBUG_EVENTS
)
1974 zlog_debug("SR: Segment Routing: OFF -> ON");
1976 isis_sr_start(area
);
1978 if (IS_DEBUG_EVENTS
)
1979 zlog_debug("SR: Segment Routing: ON -> OFF");
1988 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks
1990 int isis_instance_segment_routing_label_blocks_pre_validate(
1991 struct nb_cb_pre_validate_args
*args
)
1993 uint32_t srgb_lbound
;
1994 uint32_t srgb_ubound
;
1995 uint32_t srlb_lbound
;
1996 uint32_t srlb_ubound
;
1998 srgb_lbound
= yang_dnode_get_uint32(args
->dnode
, "./srgb/lower-bound");
1999 srgb_ubound
= yang_dnode_get_uint32(args
->dnode
, "./srgb/upper-bound");
2000 srlb_lbound
= yang_dnode_get_uint32(args
->dnode
, "./srlb/lower-bound");
2001 srlb_ubound
= yang_dnode_get_uint32(args
->dnode
, "./srlb/upper-bound");
2003 /* Check that the block size does not exceed 65535 */
2004 if ((srgb_ubound
- srgb_lbound
+ 1) > 65535) {
2006 args
->errmsg
, args
->errmsg_len
,
2007 "New SR Global Block (%u/%u) exceed the limit of 65535",
2008 srgb_lbound
, srgb_ubound
);
2009 return NB_ERR_VALIDATION
;
2011 if ((srlb_ubound
- srlb_lbound
+ 1) > 65535) {
2012 snprintf(args
->errmsg
, args
->errmsg_len
,
2013 "New SR Local Block (%u/%u) exceed the limit of 65535",
2014 srlb_lbound
, srlb_ubound
);
2015 return NB_ERR_VALIDATION
;
2018 /* Validate SRGB against SRLB */
2019 if (!((srgb_ubound
< srlb_lbound
) || (srgb_lbound
> srlb_ubound
))) {
2021 args
->errmsg
, args
->errmsg_len
,
2022 "SR Global Block (%u/%u) conflicts with Local Block (%u/%u)",
2023 srgb_lbound
, srgb_ubound
, srlb_lbound
, srlb_ubound
);
2024 return NB_ERR_VALIDATION
;
2031 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb
2034 void isis_instance_segment_routing_srgb_apply_finish(
2035 struct nb_cb_apply_finish_args
*args
)
2037 struct isis_area
*area
;
2038 uint32_t lower_bound
, upper_bound
;
2040 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2041 lower_bound
= yang_dnode_get_uint32(args
->dnode
, "./lower-bound");
2042 upper_bound
= yang_dnode_get_uint32(args
->dnode
, "./upper-bound");
2044 isis_sr_cfg_srgb_update(area
, lower_bound
, upper_bound
);
2048 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb/lower-bound
2050 int isis_instance_segment_routing_srgb_lower_bound_modify(
2051 struct nb_cb_modify_args
*args
)
2053 uint32_t lower_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2055 switch (args
->event
) {
2056 case NB_EV_VALIDATE
:
2057 if (!IS_MPLS_UNRESERVED_LABEL(lower_bound
)) {
2058 snprintf(args
->errmsg
, args
->errmsg_len
,
2059 "Invalid SRGB lower bound: %u", lower_bound
);
2060 return NB_ERR_VALIDATION
;
2073 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb/upper-bound
2075 int isis_instance_segment_routing_srgb_upper_bound_modify(
2076 struct nb_cb_modify_args
*args
)
2078 uint32_t upper_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2080 switch (args
->event
) {
2081 case NB_EV_VALIDATE
:
2082 if (!IS_MPLS_UNRESERVED_LABEL(upper_bound
)) {
2083 snprintf(args
->errmsg
, args
->errmsg_len
,
2084 "Invalid SRGB upper bound: %u", upper_bound
);
2085 return NB_ERR_VALIDATION
;
2098 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb
2100 void isis_instance_segment_routing_srlb_apply_finish(
2101 struct nb_cb_apply_finish_args
*args
)
2103 struct isis_area
*area
;
2104 uint32_t lower_bound
, upper_bound
;
2106 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2107 lower_bound
= yang_dnode_get_uint32(args
->dnode
, "./lower-bound");
2108 upper_bound
= yang_dnode_get_uint32(args
->dnode
, "./upper-bound");
2110 isis_sr_cfg_srlb_update(area
, lower_bound
, upper_bound
);
2114 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb/lower-bound
2116 int isis_instance_segment_routing_srlb_lower_bound_modify(
2117 struct nb_cb_modify_args
*args
)
2119 uint32_t lower_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2121 switch (args
->event
) {
2122 case NB_EV_VALIDATE
:
2123 if (!IS_MPLS_UNRESERVED_LABEL(lower_bound
)) {
2124 snprintf(args
->errmsg
, args
->errmsg_len
,
2125 "Invalid SRLB lower bound: %u", lower_bound
);
2126 return NB_ERR_VALIDATION
;
2139 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb/upper-bound
2141 int isis_instance_segment_routing_srlb_upper_bound_modify(
2142 struct nb_cb_modify_args
*args
)
2144 uint32_t upper_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2146 switch (args
->event
) {
2147 case NB_EV_VALIDATE
:
2148 if (!IS_MPLS_UNRESERVED_LABEL(upper_bound
)) {
2149 snprintf(args
->errmsg
, args
->errmsg_len
,
2150 "Invalid SRLB upper bound: %u", upper_bound
);
2151 return NB_ERR_VALIDATION
;
2164 * XPath: /frr-isisd:isis/instance/segment-routing/msd/node-msd
2166 int isis_instance_segment_routing_msd_node_msd_modify(
2167 struct nb_cb_modify_args
*args
)
2169 struct isis_area
*area
;
2171 if (args
->event
!= NB_EV_APPLY
)
2174 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2175 area
->srdb
.config
.msd
= yang_dnode_get_uint8(args
->dnode
, NULL
);
2177 /* Update and regenerate LSP */
2178 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2183 int isis_instance_segment_routing_msd_node_msd_destroy(
2184 struct nb_cb_destroy_args
*args
)
2186 struct isis_area
*area
;
2188 if (args
->event
!= NB_EV_APPLY
)
2191 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2192 area
->srdb
.config
.msd
= 0;
2194 /* Update and regenerate LSP */
2195 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2201 * XPath: /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid
2203 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_create(
2204 struct nb_cb_create_args
*args
)
2206 struct isis_area
*area
;
2207 struct prefix prefix
;
2208 struct sr_prefix_cfg
*pcfg
;
2210 if (args
->event
!= NB_EV_APPLY
)
2213 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2214 yang_dnode_get_prefix(&prefix
, args
->dnode
, "./prefix");
2216 pcfg
= isis_sr_cfg_prefix_add(area
, &prefix
);
2217 nb_running_set_entry(args
->dnode
, pcfg
);
2222 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_destroy(
2223 struct nb_cb_destroy_args
*args
)
2225 struct sr_prefix_cfg
*pcfg
;
2226 struct isis_area
*area
;
2228 if (args
->event
!= NB_EV_APPLY
)
2231 pcfg
= nb_running_unset_entry(args
->dnode
);
2233 isis_sr_cfg_prefix_del(pcfg
);
2234 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2239 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_pre_validate(
2240 struct nb_cb_pre_validate_args
*args
)
2242 const struct lyd_node
*area_dnode
;
2243 struct isis_area
*area
;
2244 struct prefix prefix
;
2245 uint32_t srgb_lbound
;
2246 uint32_t srgb_ubound
;
2247 uint32_t srgb_range
;
2249 enum sr_sid_value_type sid_type
;
2250 struct isis_prefix_sid psid
= {};
2252 yang_dnode_get_prefix(&prefix
, args
->dnode
, "./prefix");
2253 srgb_lbound
= yang_dnode_get_uint32(
2254 args
->dnode
, "../../label-blocks/srgb/lower-bound");
2255 srgb_ubound
= yang_dnode_get_uint32(
2256 args
->dnode
, "../../label-blocks/srgb/upper-bound");
2257 sid
= yang_dnode_get_uint32(args
->dnode
, "./sid-value");
2258 sid_type
= yang_dnode_get_enum(args
->dnode
, "./sid-value-type");
2260 /* Check for invalid indexes/labels. */
2261 srgb_range
= srgb_ubound
- srgb_lbound
+ 1;
2264 case SR_SID_VALUE_TYPE_INDEX
:
2265 if (sid
>= srgb_range
) {
2266 snprintf(args
->errmsg
, args
->errmsg_len
,
2267 "SID index %u falls outside local SRGB range",
2269 return NB_ERR_VALIDATION
;
2272 case SR_SID_VALUE_TYPE_ABSOLUTE
:
2273 if (!IS_MPLS_UNRESERVED_LABEL(sid
)) {
2274 snprintf(args
->errmsg
, args
->errmsg_len
,
2275 "Invalid absolute SID %u", sid
);
2276 return NB_ERR_VALIDATION
;
2278 SET_FLAG(psid
.flags
, ISIS_PREFIX_SID_VALUE
);
2279 SET_FLAG(psid
.flags
, ISIS_PREFIX_SID_LOCAL
);
2283 /* Check for Prefix-SID collisions. */
2284 area_dnode
= yang_dnode_get_parent(args
->dnode
, "instance");
2285 area
= nb_running_get_entry(area_dnode
, NULL
, false);
2287 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
2288 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVEL2
;
2290 struct isis_spftree
*spftree
;
2291 struct isis_vertex
*vertex_psid
;
2293 if (!(area
->is_type
& level
))
2295 spftree
= area
->spftree
[tree
][level
- 1];
2299 vertex_psid
= isis_spf_prefix_sid_lookup(
2302 && !prefix_same(&vertex_psid
->N
.ip
.p
.dest
,
2305 args
->errmsg
, args
->errmsg_len
,
2306 "Prefix-SID collision detected, SID %s %u is already in use by prefix %pFX (L%u)",
2309 ISIS_PREFIX_SID_VALUE
)
2313 &vertex_psid
->N
.ip
.p
.dest
,
2315 return NB_ERR_VALIDATION
;
2324 void isis_instance_segment_routing_prefix_sid_map_prefix_sid_apply_finish(
2325 struct nb_cb_apply_finish_args
*args
)
2327 struct sr_prefix_cfg
*pcfg
;
2328 struct isis_area
*area
;
2330 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2332 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2337 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/sid-value-type
2339 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_sid_value_type_modify(
2340 struct nb_cb_modify_args
*args
)
2342 struct sr_prefix_cfg
*pcfg
;
2344 if (args
->event
!= NB_EV_APPLY
)
2347 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2348 pcfg
->sid_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2355 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/sid-value
2357 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_sid_value_modify(
2358 struct nb_cb_modify_args
*args
)
2360 struct sr_prefix_cfg
*pcfg
;
2362 if (args
->event
!= NB_EV_APPLY
)
2365 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2366 pcfg
->sid
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2373 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/last-hop-behavior
2375 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_last_hop_behavior_modify(
2376 struct nb_cb_modify_args
*args
)
2378 struct sr_prefix_cfg
*pcfg
;
2380 if (args
->event
!= NB_EV_APPLY
)
2383 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2384 pcfg
->last_hop_behavior
= yang_dnode_get_enum(args
->dnode
, NULL
);
2390 * XPath: /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/n-flag-clear
2392 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_n_flag_clear_modify(
2393 struct nb_cb_modify_args
*args
)
2395 struct sr_prefix_cfg
*pcfg
;
2397 if (args
->event
!= NB_EV_APPLY
)
2400 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2401 pcfg
->n_flag_clear
= yang_dnode_get_bool(args
->dnode
, NULL
);
2407 * XPath: /frr-isisd:isis/instance/mpls/ldp-sync
2409 int isis_instance_mpls_ldp_sync_create(struct nb_cb_create_args
*args
)
2411 struct isis_area
*area
;
2412 const char *vrfname
;
2414 switch (args
->event
) {
2415 case NB_EV_VALIDATE
:
2416 vrfname
= yang_dnode_get_string(
2417 lyd_parent(lyd_parent(args
->dnode
)), "./vrf");
2419 if (strcmp(vrfname
, VRF_DEFAULT_NAME
)) {
2420 snprintf(args
->errmsg
, args
->errmsg_len
,
2421 "LDP-Sync only runs on Default VRF");
2422 return NB_ERR_VALIDATION
;
2429 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2430 isis_area_ldp_sync_enable(area
);
2436 int isis_instance_mpls_ldp_sync_destroy(struct nb_cb_destroy_args
*args
)
2438 struct isis_area
*area
;
2440 if (args
->event
!= NB_EV_APPLY
)
2443 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2444 isis_area_ldp_sync_disable(area
);
2450 * XPath: /frr-isisd:isis/instance/mpls/ldp-sync/holddown
2452 int isis_instance_mpls_ldp_sync_holddown_modify(struct nb_cb_modify_args
*args
)
2454 struct isis_area
*area
;
2456 const char *vrfname
;
2458 switch (args
->event
) {
2459 case NB_EV_VALIDATE
:
2460 vrfname
= yang_dnode_get_string(
2461 lyd_parent(lyd_parent(lyd_parent(args
->dnode
))),
2464 if (strcmp(vrfname
, VRF_DEFAULT_NAME
)) {
2465 snprintf(args
->errmsg
, args
->errmsg_len
,
2466 "LDP-Sync only runs on Default VRF");
2467 return NB_ERR_VALIDATION
;
2474 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2475 holddown
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2476 isis_area_ldp_sync_set_holddown(area
, holddown
);
2483 * XPath: /frr-interface:lib/interface/frr-isisd:isis
2485 int lib_interface_isis_create(struct nb_cb_create_args
*args
)
2487 struct interface
*ifp
;
2488 struct isis_circuit
*circuit
= NULL
;
2489 const char *area_tag
= yang_dnode_get_string(args
->dnode
, "./area-tag");
2491 switch (args
->event
) {
2494 case NB_EV_VALIDATE
:
2497 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
2498 circuit
= isis_circuit_new(ifp
, area_tag
);
2499 nb_running_set_entry(args
->dnode
, circuit
);
2506 int lib_interface_isis_destroy(struct nb_cb_destroy_args
*args
)
2508 struct isis_circuit
*circuit
;
2510 if (args
->event
!= NB_EV_APPLY
)
2513 circuit
= nb_running_unset_entry(args
->dnode
);
2515 isis_circuit_del(circuit
);
2521 * XPath: /frr-interface:lib/interface/frr-isisd:isis/area-tag
2523 int lib_interface_isis_area_tag_modify(struct nb_cb_modify_args
*args
)
2525 struct isis_circuit
*circuit
;
2527 if (args
->event
== NB_EV_VALIDATE
) {
2528 circuit
= nb_running_get_entry_non_rec(lyd_parent(args
->dnode
), NULL
, false);
2530 snprintf(args
->errmsg
, args
->errmsg_len
,
2531 "Changing area tag is not allowed");
2532 return NB_ERR_VALIDATION
;
2540 * XPath: /frr-interface:lib/interface/frr-isisd:isis/circuit-type
2542 int lib_interface_isis_circuit_type_modify(struct nb_cb_modify_args
*args
)
2544 int circ_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2545 struct isis_circuit
*circuit
;
2547 switch (args
->event
) {
2548 case NB_EV_VALIDATE
:
2553 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2554 circuit
->is_type_config
= circ_type
;
2555 isis_circuit_is_type_set(circuit
, circ_type
);
2563 * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv4-routing
2565 int lib_interface_isis_ipv4_routing_modify(struct nb_cb_modify_args
*args
)
2568 struct isis_circuit
*circuit
;
2570 if (args
->event
!= NB_EV_APPLY
)
2573 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2574 ipv4
= yang_dnode_get_bool(args
->dnode
, NULL
);
2575 ipv6
= yang_dnode_get_bool(args
->dnode
, "../ipv6-routing");
2576 isis_circuit_af_set(circuit
, ipv4
, ipv6
);
2582 * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv6-routing
2584 int lib_interface_isis_ipv6_routing_modify(struct nb_cb_modify_args
*args
)
2587 struct isis_circuit
*circuit
;
2589 if (args
->event
!= NB_EV_APPLY
)
2592 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2593 ipv4
= yang_dnode_get_bool(args
->dnode
, "../ipv4-routing");
2594 ipv6
= yang_dnode_get_bool(args
->dnode
, NULL
);
2595 isis_circuit_af_set(circuit
, ipv4
, ipv6
);
2601 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring
2603 void lib_interface_isis_bfd_monitoring_apply_finish(
2604 struct nb_cb_apply_finish_args
*args
)
2606 struct isis_circuit
*circuit
;
2608 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2609 isis_bfd_circuit_cmd(circuit
);
2613 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring/enabled
2615 int lib_interface_isis_bfd_monitoring_enabled_modify(
2616 struct nb_cb_modify_args
*args
)
2618 struct isis_circuit
*circuit
;
2620 if (args
->event
!= NB_EV_APPLY
)
2623 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2624 circuit
->bfd_config
.enabled
= yang_dnode_get_bool(args
->dnode
, NULL
);
2630 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring/profile
2632 int lib_interface_isis_bfd_monitoring_profile_modify(
2633 struct nb_cb_modify_args
*args
)
2635 struct isis_circuit
*circuit
;
2637 if (args
->event
!= NB_EV_APPLY
)
2640 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2641 XFREE(MTYPE_TMP
, circuit
->bfd_config
.profile
);
2642 circuit
->bfd_config
.profile
=
2643 XSTRDUP(MTYPE_TMP
, yang_dnode_get_string(args
->dnode
, NULL
));
2648 int lib_interface_isis_bfd_monitoring_profile_destroy(
2649 struct nb_cb_destroy_args
*args
)
2651 struct isis_circuit
*circuit
;
2653 if (args
->event
!= NB_EV_APPLY
)
2656 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2657 XFREE(MTYPE_TMP
, circuit
->bfd_config
.profile
);
2663 * XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-1
2665 int lib_interface_isis_csnp_interval_level_1_modify(
2666 struct nb_cb_modify_args
*args
)
2668 struct isis_circuit
*circuit
;
2670 if (args
->event
!= NB_EV_APPLY
)
2673 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2674 circuit
->csnp_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2680 * XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-2
2682 int lib_interface_isis_csnp_interval_level_2_modify(
2683 struct nb_cb_modify_args
*args
)
2685 struct isis_circuit
*circuit
;
2687 if (args
->event
!= NB_EV_APPLY
)
2690 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2691 circuit
->csnp_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2697 * XPath: /frr-interface:lib/interface/frr-isisd:isis/psnp-interval/level-1
2699 int lib_interface_isis_psnp_interval_level_1_modify(
2700 struct nb_cb_modify_args
*args
)
2702 struct isis_circuit
*circuit
;
2704 if (args
->event
!= NB_EV_APPLY
)
2707 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2708 circuit
->psnp_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2714 * XPath: /frr-interface:lib/interface/frr-isisd:isis/psnp-interval/level-2
2716 int lib_interface_isis_psnp_interval_level_2_modify(
2717 struct nb_cb_modify_args
*args
)
2719 struct isis_circuit
*circuit
;
2721 if (args
->event
!= NB_EV_APPLY
)
2724 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2725 circuit
->psnp_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2731 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/padding
2733 int lib_interface_isis_hello_padding_modify(struct nb_cb_modify_args
*args
)
2735 struct isis_circuit
*circuit
;
2737 if (args
->event
!= NB_EV_APPLY
)
2740 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2741 circuit
->pad_hellos
= yang_dnode_get_bool(args
->dnode
, NULL
);
2747 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/interval/level-1
2749 int lib_interface_isis_hello_interval_level_1_modify(
2750 struct nb_cb_modify_args
*args
)
2752 struct isis_circuit
*circuit
;
2755 if (args
->event
!= NB_EV_APPLY
)
2758 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2759 interval
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2760 circuit
->hello_interval
[0] = interval
;
2766 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/interval/level-2
2768 int lib_interface_isis_hello_interval_level_2_modify(
2769 struct nb_cb_modify_args
*args
)
2771 struct isis_circuit
*circuit
;
2774 if (args
->event
!= NB_EV_APPLY
)
2777 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2778 interval
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2779 circuit
->hello_interval
[1] = interval
;
2785 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/multiplier/level-1
2787 int lib_interface_isis_hello_multiplier_level_1_modify(
2788 struct nb_cb_modify_args
*args
)
2790 struct isis_circuit
*circuit
;
2793 if (args
->event
!= NB_EV_APPLY
)
2796 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2797 multi
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2798 circuit
->hello_multiplier
[0] = multi
;
2804 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/multiplier/level-2
2806 int lib_interface_isis_hello_multiplier_level_2_modify(
2807 struct nb_cb_modify_args
*args
)
2809 struct isis_circuit
*circuit
;
2812 if (args
->event
!= NB_EV_APPLY
)
2815 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2816 multi
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2817 circuit
->hello_multiplier
[1] = multi
;
2823 * XPath: /frr-interface:lib/interface/frr-isisd:isis/metric/level-1
2825 int lib_interface_isis_metric_level_1_modify(struct nb_cb_modify_args
*args
)
2827 struct isis_circuit
*circuit
;
2830 if (args
->event
!= NB_EV_APPLY
)
2833 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2834 met
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2835 isis_circuit_metric_set(circuit
, IS_LEVEL_1
, met
);
2841 * XPath: /frr-interface:lib/interface/frr-isisd:isis/metric/level-2
2843 int lib_interface_isis_metric_level_2_modify(struct nb_cb_modify_args
*args
)
2845 struct isis_circuit
*circuit
;
2848 if (args
->event
!= NB_EV_APPLY
)
2851 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2852 met
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2853 isis_circuit_metric_set(circuit
, IS_LEVEL_2
, met
);
2859 * XPath: /frr-interface:lib/interface/frr-isisd:isis/priority/level-1
2861 int lib_interface_isis_priority_level_1_modify(struct nb_cb_modify_args
*args
)
2863 struct isis_circuit
*circuit
;
2865 if (args
->event
!= NB_EV_APPLY
)
2868 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2869 circuit
->priority
[0] = yang_dnode_get_uint8(args
->dnode
, NULL
);
2875 * XPath: /frr-interface:lib/interface/frr-isisd:isis/priority/level-2
2877 int lib_interface_isis_priority_level_2_modify(struct nb_cb_modify_args
*args
)
2879 struct isis_circuit
*circuit
;
2881 if (args
->event
!= NB_EV_APPLY
)
2884 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2885 circuit
->priority
[1] = yang_dnode_get_uint8(args
->dnode
, NULL
);
2891 * XPath: /frr-interface:lib/interface/frr-isisd:isis/network-type
2893 int lib_interface_isis_network_type_modify(struct nb_cb_modify_args
*args
)
2895 struct isis_circuit
*circuit
;
2896 int net_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2898 switch (args
->event
) {
2899 case NB_EV_VALIDATE
:
2900 circuit
= nb_running_get_entry(args
->dnode
, NULL
, false);
2903 if (circuit
->circ_type
== CIRCUIT_T_LOOPBACK
) {
2905 args
->errmsg
, args
->errmsg_len
,
2906 "Cannot change network type on loopback interface");
2907 return NB_ERR_VALIDATION
;
2909 if (net_type
== CIRCUIT_T_BROADCAST
2910 && circuit
->state
== C_STATE_UP
2911 && !if_is_broadcast(circuit
->interface
)) {
2913 args
->errmsg
, args
->errmsg_len
,
2914 "Cannot configure non-broadcast interface for broadcast operation");
2915 return NB_ERR_VALIDATION
;
2922 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2923 isis_circuit_circ_type_set(circuit
, net_type
);
2931 * XPath: /frr-interface:lib/interface/frr-isisd:isis/passive
2933 int lib_interface_isis_passive_modify(struct nb_cb_modify_args
*args
)
2935 struct isis_circuit
*circuit
;
2936 bool passive
= yang_dnode_get_bool(args
->dnode
, NULL
);
2938 if (args
->event
!= NB_EV_APPLY
)
2941 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2942 isis_circuit_passive_set(circuit
, passive
);
2948 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password
2950 int lib_interface_isis_password_create(struct nb_cb_create_args
*args
)
2955 int lib_interface_isis_password_destroy(struct nb_cb_destroy_args
*args
)
2957 struct isis_circuit
*circuit
;
2959 if (args
->event
!= NB_EV_APPLY
)
2962 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2963 isis_circuit_passwd_unset(circuit
);
2969 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password/password
2971 int lib_interface_isis_password_password_modify(struct nb_cb_modify_args
*args
)
2973 struct isis_circuit
*circuit
;
2974 const char *password
;
2976 if (args
->event
!= NB_EV_APPLY
)
2979 password
= yang_dnode_get_string(args
->dnode
, NULL
);
2980 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2982 isis_circuit_passwd_set(circuit
, circuit
->passwd
.type
, password
);
2988 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password/password-type
2990 int lib_interface_isis_password_password_type_modify(
2991 struct nb_cb_modify_args
*args
)
2993 struct isis_circuit
*circuit
;
2996 if (args
->event
!= NB_EV_APPLY
)
2999 pass_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
3000 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3001 circuit
->passwd
.type
= pass_type
;
3008 * /frr-interface:lib/interface/frr-isisd:isis/disable-three-way-handshake
3010 int lib_interface_isis_disable_three_way_handshake_modify(
3011 struct nb_cb_modify_args
*args
)
3013 struct isis_circuit
*circuit
;
3015 if (args
->event
!= NB_EV_APPLY
)
3018 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3019 circuit
->disable_threeway_adj
= yang_dnode_get_bool(args
->dnode
, NULL
);
3024 static int lib_interface_isis_multi_topology_common(
3025 enum nb_event event
, const struct lyd_node
*dnode
, char *errmsg
,
3026 size_t errmsg_len
, uint16_t mtid
)
3028 struct isis_circuit
*circuit
;
3032 case NB_EV_VALIDATE
:
3033 circuit
= nb_running_get_entry(dnode
, NULL
, false);
3034 if (circuit
&& circuit
->area
&& circuit
->area
->oldmetric
) {
3037 "Multi topology IS-IS can only be used with wide metrics");
3038 return NB_ERR_VALIDATION
;
3045 circuit
= nb_running_get_entry(dnode
, NULL
, true);
3046 value
= yang_dnode_get_bool(dnode
, NULL
);
3047 isis_circuit_mt_enabled_set(circuit
, mtid
, value
);
3056 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/standard
3058 int lib_interface_isis_multi_topology_standard_modify(
3059 struct nb_cb_modify_args
*args
)
3061 return lib_interface_isis_multi_topology_common(
3062 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3068 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-multicast
3070 int lib_interface_isis_multi_topology_ipv4_multicast_modify(
3071 struct nb_cb_modify_args
*args
)
3073 return lib_interface_isis_multi_topology_common(
3074 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3075 ISIS_MT_IPV4_MULTICAST
);
3080 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-management
3082 int lib_interface_isis_multi_topology_ipv4_management_modify(
3083 struct nb_cb_modify_args
*args
)
3085 return lib_interface_isis_multi_topology_common(
3086 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3092 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-unicast
3094 int lib_interface_isis_multi_topology_ipv6_unicast_modify(
3095 struct nb_cb_modify_args
*args
)
3097 return lib_interface_isis_multi_topology_common(
3098 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3099 ISIS_MT_IPV6_UNICAST
);
3104 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-multicast
3106 int lib_interface_isis_multi_topology_ipv6_multicast_modify(
3107 struct nb_cb_modify_args
*args
)
3109 return lib_interface_isis_multi_topology_common(
3110 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3111 ISIS_MT_IPV6_MULTICAST
);
3116 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-management
3118 int lib_interface_isis_multi_topology_ipv6_management_modify(
3119 struct nb_cb_modify_args
*args
)
3121 return lib_interface_isis_multi_topology_common(
3122 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3127 * XPath: /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-dstsrc
3129 int lib_interface_isis_multi_topology_ipv6_dstsrc_modify(
3130 struct nb_cb_modify_args
*args
)
3132 return lib_interface_isis_multi_topology_common(
3133 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3134 ISIS_MT_IPV6_DSTSRC
);
3138 * XPath: /frr-interface:lib/interface/frr-isisd:isis/mpls/ldp-sync
3140 int lib_interface_isis_mpls_ldp_sync_modify(struct nb_cb_modify_args
*args
)
3142 struct isis_circuit
*circuit
;
3143 struct ldp_sync_info
*ldp_sync_info
;
3144 bool ldp_sync_enable
;
3146 switch (args
->event
) {
3147 case NB_EV_VALIDATE
:
3152 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3153 ldp_sync_enable
= yang_dnode_get_bool(args
->dnode
, NULL
);
3155 ldp_sync_info
= circuit
->ldp_sync_info
;
3157 SET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_IF_CONFIG
);
3158 ldp_sync_info
->enabled
= ldp_sync_enable
;
3160 if (circuit
->area
) {
3161 if (ldp_sync_enable
)
3162 isis_if_ldp_sync_enable(circuit
);
3164 isis_if_ldp_sync_disable(circuit
);
3172 * XPath: /frr-interface:lib/interface/frr-isisd:isis/mpls/holddown
3174 int lib_interface_isis_mpls_holddown_modify(struct nb_cb_modify_args
*args
)
3176 struct isis_circuit
*circuit
;
3177 struct ldp_sync_info
*ldp_sync_info
;
3180 switch (args
->event
) {
3181 case NB_EV_VALIDATE
:
3186 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3187 holddown
= yang_dnode_get_uint16(args
->dnode
, NULL
);
3189 ldp_sync_info
= circuit
->ldp_sync_info
;
3191 SET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_HOLDDOWN
);
3192 ldp_sync_info
->holddown
= holddown
;
3198 int lib_interface_isis_mpls_holddown_destroy(struct nb_cb_destroy_args
*args
)
3200 struct isis_circuit
*circuit
;
3201 struct ldp_sync_info
*ldp_sync_info
;
3203 switch (args
->event
) {
3204 case NB_EV_VALIDATE
:
3209 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3210 ldp_sync_info
= circuit
->ldp_sync_info
;
3212 UNSET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_HOLDDOWN
);
3215 isis_if_set_ldp_sync_holddown(circuit
);
3224 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/lfa/enable
3226 int lib_interface_isis_fast_reroute_level_1_lfa_enable_modify(
3227 struct nb_cb_modify_args
*args
)
3229 struct isis_area
*area
;
3230 struct isis_circuit
*circuit
;
3232 if (args
->event
!= NB_EV_APPLY
)
3235 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3236 circuit
->lfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3238 area
= circuit
->area
;
3240 if (circuit
->lfa_protection
[0])
3241 area
->lfa_protected_links
[0]++;
3243 assert(area
->lfa_protected_links
[0] > 0);
3244 area
->lfa_protected_links
[0]--;
3247 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3255 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/lfa/exclude-interface
3257 int lib_interface_isis_fast_reroute_level_1_lfa_exclude_interface_create(
3258 struct nb_cb_create_args
*args
)
3260 struct isis_area
*area
;
3261 struct isis_circuit
*circuit
;
3262 const char *exclude_ifname
;
3264 if (args
->event
!= NB_EV_APPLY
)
3267 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3268 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3270 isis_lfa_excluded_iface_add(circuit
, ISIS_LEVEL1
, exclude_ifname
);
3271 area
= circuit
->area
;
3273 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3278 int lib_interface_isis_fast_reroute_level_1_lfa_exclude_interface_destroy(
3279 struct nb_cb_destroy_args
*args
)
3281 struct isis_area
*area
;
3282 struct isis_circuit
*circuit
;
3283 const char *exclude_ifname
;
3285 if (args
->event
!= NB_EV_APPLY
)
3288 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3289 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3291 isis_lfa_excluded_iface_delete(circuit
, ISIS_LEVEL1
, exclude_ifname
);
3292 area
= circuit
->area
;
3294 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3301 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/remote-lfa/enable
3303 int lib_interface_isis_fast_reroute_level_1_remote_lfa_enable_modify(
3304 struct nb_cb_modify_args
*args
)
3306 struct isis_area
*area
;
3307 struct isis_circuit
*circuit
;
3309 if (args
->event
!= NB_EV_APPLY
)
3312 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3313 circuit
->rlfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3315 area
= circuit
->area
;
3317 if (circuit
->rlfa_protection
[0])
3318 area
->rlfa_protected_links
[0]++;
3320 assert(area
->rlfa_protected_links
[0] > 0);
3321 area
->rlfa_protected_links
[0]--;
3324 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3332 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/remote-lfa/maximum-metric
3334 int lib_interface_isis_fast_reroute_level_1_remote_lfa_maximum_metric_modify(
3335 struct nb_cb_modify_args
*args
)
3337 struct isis_area
*area
;
3338 struct isis_circuit
*circuit
;
3340 if (args
->event
!= NB_EV_APPLY
)
3343 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3344 circuit
->rlfa_max_metric
[0] = yang_dnode_get_uint32(args
->dnode
, NULL
);
3346 area
= circuit
->area
;
3348 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3353 int lib_interface_isis_fast_reroute_level_1_remote_lfa_maximum_metric_destroy(
3354 struct nb_cb_destroy_args
*args
)
3356 struct isis_area
*area
;
3357 struct isis_circuit
*circuit
;
3359 if (args
->event
!= NB_EV_APPLY
)
3362 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3363 circuit
->rlfa_max_metric
[0] = 0;
3365 area
= circuit
->area
;
3367 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3374 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/enable
3376 int lib_interface_isis_fast_reroute_level_1_ti_lfa_enable_modify(
3377 struct nb_cb_modify_args
*args
)
3379 struct isis_area
*area
;
3380 struct isis_circuit
*circuit
;
3382 if (args
->event
!= NB_EV_APPLY
)
3385 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3386 circuit
->tilfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3388 area
= circuit
->area
;
3390 if (circuit
->tilfa_protection
[0])
3391 area
->tilfa_protected_links
[0]++;
3393 assert(area
->tilfa_protected_links
[0] > 0);
3394 area
->tilfa_protected_links
[0]--;
3397 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3405 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/node-protection
3407 int lib_interface_isis_fast_reroute_level_1_ti_lfa_node_protection_modify(
3408 struct nb_cb_modify_args
*args
)
3410 struct isis_area
*area
;
3411 struct isis_circuit
*circuit
;
3413 if (args
->event
!= NB_EV_APPLY
)
3416 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3417 circuit
->tilfa_node_protection
[0] =
3418 yang_dnode_get_bool(args
->dnode
, NULL
);
3420 area
= circuit
->area
;
3422 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3429 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/link-fallback
3431 int lib_interface_isis_fast_reroute_level_1_ti_lfa_link_fallback_modify(
3432 struct nb_cb_modify_args
*args
)
3434 struct isis_area
*area
;
3435 struct isis_circuit
*circuit
;
3437 if (args
->event
!= NB_EV_APPLY
)
3440 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3441 circuit
->tilfa_link_fallback
[0] =
3442 yang_dnode_get_bool(args
->dnode
, NULL
);
3444 area
= circuit
->area
;
3446 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3453 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/lfa/enable
3455 int lib_interface_isis_fast_reroute_level_2_lfa_enable_modify(
3456 struct nb_cb_modify_args
*args
)
3458 struct isis_area
*area
;
3459 struct isis_circuit
*circuit
;
3461 if (args
->event
!= NB_EV_APPLY
)
3464 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3465 circuit
->lfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3467 area
= circuit
->area
;
3469 if (circuit
->lfa_protection
[1])
3470 area
->lfa_protected_links
[1]++;
3472 assert(area
->lfa_protected_links
[1] > 0);
3473 area
->lfa_protected_links
[1]--;
3476 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3484 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/lfa/exclude-interface
3486 int lib_interface_isis_fast_reroute_level_2_lfa_exclude_interface_create(
3487 struct nb_cb_create_args
*args
)
3489 struct isis_area
*area
;
3490 struct isis_circuit
*circuit
;
3491 const char *exclude_ifname
;
3493 if (args
->event
!= NB_EV_APPLY
)
3496 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3497 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3499 isis_lfa_excluded_iface_add(circuit
, ISIS_LEVEL2
, exclude_ifname
);
3500 area
= circuit
->area
;
3502 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3507 int lib_interface_isis_fast_reroute_level_2_lfa_exclude_interface_destroy(
3508 struct nb_cb_destroy_args
*args
)
3510 struct isis_area
*area
;
3511 struct isis_circuit
*circuit
;
3512 const char *exclude_ifname
;
3514 if (args
->event
!= NB_EV_APPLY
)
3517 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3518 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3520 isis_lfa_excluded_iface_delete(circuit
, ISIS_LEVEL2
, exclude_ifname
);
3521 area
= circuit
->area
;
3523 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3530 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/remote-lfa/enable
3532 int lib_interface_isis_fast_reroute_level_2_remote_lfa_enable_modify(
3533 struct nb_cb_modify_args
*args
)
3535 struct isis_area
*area
;
3536 struct isis_circuit
*circuit
;
3538 if (args
->event
!= NB_EV_APPLY
)
3541 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3542 circuit
->rlfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3544 area
= circuit
->area
;
3546 if (circuit
->rlfa_protection
[1])
3547 area
->rlfa_protected_links
[1]++;
3549 assert(area
->rlfa_protected_links
[1] > 0);
3550 area
->rlfa_protected_links
[1]--;
3553 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3561 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/remote-lfa/maximum-metric
3563 int lib_interface_isis_fast_reroute_level_2_remote_lfa_maximum_metric_modify(
3564 struct nb_cb_modify_args
*args
)
3566 struct isis_area
*area
;
3567 struct isis_circuit
*circuit
;
3569 if (args
->event
!= NB_EV_APPLY
)
3572 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3573 circuit
->rlfa_max_metric
[1] = yang_dnode_get_uint32(args
->dnode
, NULL
);
3575 area
= circuit
->area
;
3577 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3582 int lib_interface_isis_fast_reroute_level_2_remote_lfa_maximum_metric_destroy(
3583 struct nb_cb_destroy_args
*args
)
3585 struct isis_area
*area
;
3586 struct isis_circuit
*circuit
;
3588 if (args
->event
!= NB_EV_APPLY
)
3591 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3592 circuit
->rlfa_max_metric
[1] = 0;
3594 area
= circuit
->area
;
3596 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3603 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/enable
3605 int lib_interface_isis_fast_reroute_level_2_ti_lfa_enable_modify(
3606 struct nb_cb_modify_args
*args
)
3608 struct isis_area
*area
;
3609 struct isis_circuit
*circuit
;
3611 if (args
->event
!= NB_EV_APPLY
)
3614 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3615 circuit
->tilfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3617 area
= circuit
->area
;
3619 if (circuit
->tilfa_protection
[1])
3620 area
->tilfa_protected_links
[1]++;
3622 assert(area
->tilfa_protected_links
[1] > 0);
3623 area
->tilfa_protected_links
[1]--;
3626 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3634 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/node-protection
3636 int lib_interface_isis_fast_reroute_level_2_ti_lfa_node_protection_modify(
3637 struct nb_cb_modify_args
*args
)
3639 struct isis_area
*area
;
3640 struct isis_circuit
*circuit
;
3642 if (args
->event
!= NB_EV_APPLY
)
3645 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3646 circuit
->tilfa_node_protection
[1] =
3647 yang_dnode_get_bool(args
->dnode
, NULL
);
3649 area
= circuit
->area
;
3651 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3658 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/link-fallback
3660 int lib_interface_isis_fast_reroute_level_2_ti_lfa_link_fallback_modify(
3661 struct nb_cb_modify_args
*args
)
3663 struct isis_area
*area
;
3664 struct isis_circuit
*circuit
;
3666 if (args
->event
!= NB_EV_APPLY
)
3669 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3670 circuit
->tilfa_link_fallback
[1] =
3671 yang_dnode_get_bool(args
->dnode
, NULL
);
3673 area
= circuit
->area
;
3675 lsp_regenerate_schedule(area
, area
->is_type
, 0);