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/enabled
341 int isis_instance_overload_enabled_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 area
->overload_configured
= overload
;
353 isis_area_overload_bit_set(area
, overload
);
359 * XPath: /frr-isisd:isis/instance/overload/on-startup
361 int isis_instance_overload_on_startup_modify(struct nb_cb_modify_args
*args
)
363 struct isis_area
*area
;
364 uint32_t overload_time
;
366 if (args
->event
!= NB_EV_APPLY
)
369 overload_time
= yang_dnode_get_uint32(args
->dnode
, NULL
);
370 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
371 isis_area_overload_on_startup_set(area
, overload_time
);
377 * XPath: /frr-isisd:isis/instance/metric-style
379 int isis_instance_metric_style_modify(struct nb_cb_modify_args
*args
)
381 struct isis_area
*area
;
382 bool old_metric
, new_metric
;
383 enum isis_metric_style metric_style
=
384 yang_dnode_get_enum(args
->dnode
, NULL
);
386 if (args
->event
!= NB_EV_APPLY
)
389 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
390 old_metric
= (metric_style
== ISIS_WIDE_METRIC
) ? false : true;
391 new_metric
= (metric_style
== ISIS_NARROW_METRIC
) ? false : true;
392 isis_area_metricstyle_set(area
, old_metric
, new_metric
);
398 * XPath: /frr-isisd:isis/instance/purge-originator
400 int isis_instance_purge_originator_modify(struct nb_cb_modify_args
*args
)
402 struct isis_area
*area
;
404 if (args
->event
!= NB_EV_APPLY
)
407 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
408 area
->purge_originator
= yang_dnode_get_bool(args
->dnode
, NULL
);
414 * XPath: /frr-isisd:isis/instance/lsp/mtu
416 int isis_instance_lsp_mtu_modify(struct nb_cb_modify_args
*args
)
418 uint16_t lsp_mtu
= yang_dnode_get_uint16(args
->dnode
, NULL
);
419 struct isis_area
*area
;
421 switch (args
->event
) {
427 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
428 isis_area_lsp_mtu_set(area
, lsp_mtu
);
436 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/refresh-interval
438 int isis_instance_lsp_refresh_interval_level_1_modify(
439 struct nb_cb_modify_args
*args
)
441 struct isis_area
*area
;
444 if (args
->event
!= NB_EV_APPLY
)
447 refr_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
448 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
449 isis_area_lsp_refresh_set(area
, IS_LEVEL_1
, refr_int
);
455 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/refresh-interval
457 int isis_instance_lsp_refresh_interval_level_2_modify(
458 struct nb_cb_modify_args
*args
)
460 struct isis_area
*area
;
463 if (args
->event
!= NB_EV_APPLY
)
466 refr_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
467 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
468 isis_area_lsp_refresh_set(area
, IS_LEVEL_2
, refr_int
);
474 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/maximum-lifetime
476 int isis_instance_lsp_maximum_lifetime_level_1_modify(
477 struct nb_cb_modify_args
*args
)
479 struct isis_area
*area
;
482 if (args
->event
!= NB_EV_APPLY
)
485 max_lt
= yang_dnode_get_uint16(args
->dnode
, NULL
);
486 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
487 isis_area_max_lsp_lifetime_set(area
, IS_LEVEL_1
, max_lt
);
493 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/maximum-lifetime
495 int isis_instance_lsp_maximum_lifetime_level_2_modify(
496 struct nb_cb_modify_args
*args
)
498 struct isis_area
*area
;
501 if (args
->event
!= NB_EV_APPLY
)
504 max_lt
= yang_dnode_get_uint16(args
->dnode
, NULL
);
505 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
506 isis_area_max_lsp_lifetime_set(area
, IS_LEVEL_2
, max_lt
);
512 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/generation-interval
514 int isis_instance_lsp_generation_interval_level_1_modify(
515 struct nb_cb_modify_args
*args
)
517 struct isis_area
*area
;
520 if (args
->event
!= NB_EV_APPLY
)
523 gen_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
524 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
525 area
->lsp_gen_interval
[0] = gen_int
;
531 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/generation-interval
533 int isis_instance_lsp_generation_interval_level_2_modify(
534 struct nb_cb_modify_args
*args
)
536 struct isis_area
*area
;
539 if (args
->event
!= NB_EV_APPLY
)
542 gen_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
543 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
544 area
->lsp_gen_interval
[1] = gen_int
;
550 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay
552 void ietf_backoff_delay_apply_finish(struct nb_cb_apply_finish_args
*args
)
554 long init_delay
= yang_dnode_get_uint16(args
->dnode
, "./init-delay");
555 long short_delay
= yang_dnode_get_uint16(args
->dnode
, "./short-delay");
556 long long_delay
= yang_dnode_get_uint16(args
->dnode
, "./long-delay");
557 long holddown
= yang_dnode_get_uint16(args
->dnode
, "./hold-down");
559 yang_dnode_get_uint16(args
->dnode
, "./time-to-learn");
560 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
561 size_t bufsiz
= strlen(area
->area_tag
) + sizeof("IS-IS Lx");
562 char *buf
= XCALLOC(MTYPE_TMP
, bufsiz
);
564 snprintf(buf
, bufsiz
, "IS-IS %s L1", area
->area_tag
);
565 spf_backoff_free(area
->spf_delay_ietf
[0]);
566 area
->spf_delay_ietf
[0] =
567 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
568 long_delay
, holddown
, timetolearn
);
570 snprintf(buf
, bufsiz
, "IS-IS %s L2", area
->area_tag
);
571 spf_backoff_free(area
->spf_delay_ietf
[1]);
572 area
->spf_delay_ietf
[1] =
573 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
574 long_delay
, holddown
, timetolearn
);
576 XFREE(MTYPE_TMP
, buf
);
579 int isis_instance_spf_ietf_backoff_delay_create(struct nb_cb_create_args
*args
)
581 /* All the work is done in the apply_finish */
585 int isis_instance_spf_ietf_backoff_delay_destroy(
586 struct nb_cb_destroy_args
*args
)
588 struct isis_area
*area
;
590 if (args
->event
!= NB_EV_APPLY
)
593 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
594 spf_backoff_free(area
->spf_delay_ietf
[0]);
595 spf_backoff_free(area
->spf_delay_ietf
[1]);
596 area
->spf_delay_ietf
[0] = NULL
;
597 area
->spf_delay_ietf
[1] = NULL
;
603 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/init-delay
605 int isis_instance_spf_ietf_backoff_delay_init_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/short-delay
615 int isis_instance_spf_ietf_backoff_delay_short_delay_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/long-delay
625 int isis_instance_spf_ietf_backoff_delay_long_delay_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/ietf-backoff-delay/hold-down
635 int isis_instance_spf_ietf_backoff_delay_hold_down_modify(
636 struct nb_cb_modify_args
*args
)
638 /* All the work is done in the apply_finish */
643 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/time-to-learn
645 int isis_instance_spf_ietf_backoff_delay_time_to_learn_modify(
646 struct nb_cb_modify_args
*args
)
648 /* All the work is done in the apply_finish */
653 * XPath: /frr-isisd:isis/instance/spf/minimum-interval/level-1
655 int isis_instance_spf_minimum_interval_level_1_modify(
656 struct nb_cb_modify_args
*args
)
658 struct isis_area
*area
;
660 if (args
->event
!= NB_EV_APPLY
)
663 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
664 area
->min_spf_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
670 * XPath: /frr-isisd:isis/instance/spf/minimum-interval/level-2
672 int isis_instance_spf_minimum_interval_level_2_modify(
673 struct nb_cb_modify_args
*args
)
675 struct isis_area
*area
;
677 if (args
->event
!= NB_EV_APPLY
)
680 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
681 area
->min_spf_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
688 * /frr-isisd:isis/instance/spf/prefix-priorities/critical/access-list-name
690 int isis_instance_spf_prefix_priorities_critical_access_list_name_modify(
691 struct nb_cb_modify_args
*args
)
693 struct isis_area
*area
;
694 const char *acl_name
;
695 struct spf_prefix_priority_acl
*ppa
;
697 if (args
->event
!= NB_EV_APPLY
)
700 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
701 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
703 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_CRITICAL
];
704 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
705 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
706 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
707 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
708 lsp_regenerate_schedule(area
, area
->is_type
, 0);
713 int isis_instance_spf_prefix_priorities_critical_access_list_name_destroy(
714 struct nb_cb_destroy_args
*args
)
716 struct isis_area
*area
;
717 struct spf_prefix_priority_acl
*ppa
;
719 if (args
->event
!= NB_EV_APPLY
)
722 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
724 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_CRITICAL
];
725 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
728 lsp_regenerate_schedule(area
, area
->is_type
, 0);
734 * XPath: /frr-isisd:isis/instance/spf/prefix-priorities/high/access-list-name
736 int isis_instance_spf_prefix_priorities_high_access_list_name_modify(
737 struct nb_cb_modify_args
*args
)
739 struct isis_area
*area
;
740 const char *acl_name
;
741 struct spf_prefix_priority_acl
*ppa
;
743 if (args
->event
!= NB_EV_APPLY
)
746 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
747 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
749 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_HIGH
];
750 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
751 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
752 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
753 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
754 lsp_regenerate_schedule(area
, area
->is_type
, 0);
759 int isis_instance_spf_prefix_priorities_high_access_list_name_destroy(
760 struct nb_cb_destroy_args
*args
)
762 struct isis_area
*area
;
763 struct spf_prefix_priority_acl
*ppa
;
765 if (args
->event
!= NB_EV_APPLY
)
768 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
770 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_HIGH
];
771 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
774 lsp_regenerate_schedule(area
, area
->is_type
, 0);
780 * XPath: /frr-isisd:isis/instance/spf/prefix-priorities/medium/access-list-name
782 int isis_instance_spf_prefix_priorities_medium_access_list_name_modify(
783 struct nb_cb_modify_args
*args
)
785 struct isis_area
*area
;
786 const char *acl_name
;
787 struct spf_prefix_priority_acl
*ppa
;
789 if (args
->event
!= NB_EV_APPLY
)
792 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
793 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
795 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_MEDIUM
];
796 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
797 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
798 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
799 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
800 lsp_regenerate_schedule(area
, area
->is_type
, 0);
805 int isis_instance_spf_prefix_priorities_medium_access_list_name_destroy(
806 struct nb_cb_destroy_args
*args
)
808 struct isis_area
*area
;
809 struct spf_prefix_priority_acl
*ppa
;
811 if (args
->event
!= NB_EV_APPLY
)
814 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
816 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_MEDIUM
];
817 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
820 lsp_regenerate_schedule(area
, area
->is_type
, 0);
826 * XPath: /frr-isisd:isis/instance/area-password
828 void area_password_apply_finish(struct nb_cb_apply_finish_args
*args
)
830 const char *password
= yang_dnode_get_string(args
->dnode
, "./password");
831 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
832 int pass_type
= yang_dnode_get_enum(args
->dnode
, "./password-type");
834 yang_dnode_get_enum(args
->dnode
, "./authenticate-snp");
837 case ISIS_PASSWD_TYPE_CLEARTXT
:
838 isis_area_passwd_cleartext_set(area
, IS_LEVEL_1
, password
,
841 case ISIS_PASSWD_TYPE_HMAC_MD5
:
842 isis_area_passwd_hmac_md5_set(area
, IS_LEVEL_1
, password
,
848 int isis_instance_area_password_create(struct nb_cb_create_args
*args
)
850 /* actual setting is done in apply_finish */
854 int isis_instance_area_password_destroy(struct nb_cb_destroy_args
*args
)
856 struct isis_area
*area
;
858 if (args
->event
!= NB_EV_APPLY
)
861 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
862 isis_area_passwd_unset(area
, IS_LEVEL_1
);
868 * XPath: /frr-isisd:isis/instance/area-password/password
870 int isis_instance_area_password_password_modify(struct nb_cb_modify_args
*args
)
872 /* actual setting is done in apply_finish */
877 * XPath: /frr-isisd:isis/instance/area-password/password-type
879 int isis_instance_area_password_password_type_modify(
880 struct nb_cb_modify_args
*args
)
882 /* actual setting is done in apply_finish */
887 * XPath: /frr-isisd:isis/instance/area-password/authenticate-snp
889 int isis_instance_area_password_authenticate_snp_modify(
890 struct nb_cb_modify_args
*args
)
892 /* actual setting is done in apply_finish */
897 * XPath: /frr-isisd:isis/instance/domain-password
899 void domain_password_apply_finish(struct nb_cb_apply_finish_args
*args
)
901 const char *password
= yang_dnode_get_string(args
->dnode
, "./password");
902 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
903 int pass_type
= yang_dnode_get_enum(args
->dnode
, "./password-type");
905 yang_dnode_get_enum(args
->dnode
, "./authenticate-snp");
908 case ISIS_PASSWD_TYPE_CLEARTXT
:
909 isis_area_passwd_cleartext_set(area
, IS_LEVEL_2
, password
,
912 case ISIS_PASSWD_TYPE_HMAC_MD5
:
913 isis_area_passwd_hmac_md5_set(area
, IS_LEVEL_2
, password
,
919 int isis_instance_domain_password_create(struct nb_cb_create_args
*args
)
921 /* actual setting is done in apply_finish */
925 int isis_instance_domain_password_destroy(struct nb_cb_destroy_args
*args
)
927 struct isis_area
*area
;
929 if (args
->event
!= NB_EV_APPLY
)
932 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
933 isis_area_passwd_unset(area
, IS_LEVEL_2
);
939 * XPath: /frr-isisd:isis/instance/domain-password/password
941 int isis_instance_domain_password_password_modify(
942 struct nb_cb_modify_args
*args
)
944 /* actual setting is done in apply_finish */
949 * XPath: /frr-isisd:isis/instance/domain-password/password-type
951 int isis_instance_domain_password_password_type_modify(
952 struct nb_cb_modify_args
*args
)
954 /* actual setting is done in apply_finish */
959 * XPath: /frr-isisd:isis/instance/domain-password/authenticate-snp
961 int isis_instance_domain_password_authenticate_snp_modify(
962 struct nb_cb_modify_args
*args
)
964 /* actual setting is done in apply_finish */
969 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4
971 void default_info_origin_apply_finish(const struct lyd_node
*dnode
, int family
)
973 int originate_type
= DEFAULT_ORIGINATE
;
974 unsigned long metric
= 0;
975 const char *routemap
= NULL
;
976 struct isis_area
*area
= nb_running_get_entry(dnode
, NULL
, true);
977 int level
= yang_dnode_get_enum(dnode
, "./level");
979 if (yang_dnode_get_bool(dnode
, "./always")) {
980 originate_type
= DEFAULT_ORIGINATE_ALWAYS
;
981 } else if (family
== AF_INET6
) {
983 "%s: Zebra doesn't implement default-originate for IPv6 yet, so use with care or use default-originate always.",
987 if (yang_dnode_exists(dnode
, "./metric"))
988 metric
= yang_dnode_get_uint32(dnode
, "./metric");
989 if (yang_dnode_exists(dnode
, "./route-map"))
990 routemap
= yang_dnode_get_string(dnode
, "./route-map");
992 isis_redist_set(area
, level
, family
, DEFAULT_ROUTE
, metric
, routemap
,
996 void default_info_origin_ipv4_apply_finish(struct nb_cb_apply_finish_args
*args
)
998 default_info_origin_apply_finish(args
->dnode
, AF_INET
);
1001 void default_info_origin_ipv6_apply_finish(struct nb_cb_apply_finish_args
*args
)
1003 default_info_origin_apply_finish(args
->dnode
, AF_INET6
);
1006 int isis_instance_default_information_originate_ipv4_create(
1007 struct nb_cb_create_args
*args
)
1009 /* It's all done by default_info_origin_apply_finish */
1013 int isis_instance_default_information_originate_ipv4_destroy(
1014 struct nb_cb_destroy_args
*args
)
1016 struct isis_area
*area
;
1019 if (args
->event
!= NB_EV_APPLY
)
1022 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1023 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1024 isis_redist_unset(area
, level
, AF_INET
, DEFAULT_ROUTE
);
1030 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/always
1032 int isis_instance_default_information_originate_ipv4_always_modify(
1033 struct nb_cb_modify_args
*args
)
1035 /* It's all done by default_info_origin_apply_finish */
1040 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/route-map
1042 int isis_instance_default_information_originate_ipv4_route_map_modify(
1043 struct nb_cb_modify_args
*args
)
1045 /* It's all done by default_info_origin_apply_finish */
1049 int isis_instance_default_information_originate_ipv4_route_map_destroy(
1050 struct nb_cb_destroy_args
*args
)
1052 /* It's all done by default_info_origin_apply_finish */
1057 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/metric
1059 int isis_instance_default_information_originate_ipv4_metric_modify(
1060 struct nb_cb_modify_args
*args
)
1062 /* It's all done by default_info_origin_apply_finish */
1067 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6
1069 int isis_instance_default_information_originate_ipv6_create(
1070 struct nb_cb_create_args
*args
)
1072 /* It's all done by default_info_origin_apply_finish */
1076 int isis_instance_default_information_originate_ipv6_destroy(
1077 struct nb_cb_destroy_args
*args
)
1079 struct isis_area
*area
;
1082 if (args
->event
!= NB_EV_APPLY
)
1085 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1086 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1087 isis_redist_unset(area
, level
, AF_INET6
, DEFAULT_ROUTE
);
1093 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/always
1095 int isis_instance_default_information_originate_ipv6_always_modify(
1096 struct nb_cb_modify_args
*args
)
1098 /* It's all done by default_info_origin_apply_finish */
1103 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/route-map
1105 int isis_instance_default_information_originate_ipv6_route_map_modify(
1106 struct nb_cb_modify_args
*args
)
1108 /* It's all done by default_info_origin_apply_finish */
1112 int isis_instance_default_information_originate_ipv6_route_map_destroy(
1113 struct nb_cb_destroy_args
*args
)
1115 /* It's all done by default_info_origin_apply_finish */
1120 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/metric
1122 int isis_instance_default_information_originate_ipv6_metric_modify(
1123 struct nb_cb_modify_args
*args
)
1125 /* It's all done by default_info_origin_apply_finish */
1130 * XPath: /frr-isisd:isis/instance/redistribute/ipv4
1132 void redistribute_apply_finish(const struct lyd_node
*dnode
, int family
)
1134 assert(family
== AF_INET
|| family
== AF_INET6
);
1136 unsigned long metric
= 0;
1137 const char *routemap
= NULL
;
1138 struct isis_area
*area
;
1140 type
= yang_dnode_get_enum(dnode
, "./protocol");
1141 level
= yang_dnode_get_enum(dnode
, "./level");
1142 area
= nb_running_get_entry(dnode
, NULL
, true);
1144 if (yang_dnode_exists(dnode
, "./metric"))
1145 metric
= yang_dnode_get_uint32(dnode
, "./metric");
1146 if (yang_dnode_exists(dnode
, "./route-map"))
1147 routemap
= yang_dnode_get_string(dnode
, "./route-map");
1149 isis_redist_set(area
, level
, family
, type
, metric
, routemap
, 0);
1152 void redistribute_ipv4_apply_finish(struct nb_cb_apply_finish_args
*args
)
1154 redistribute_apply_finish(args
->dnode
, AF_INET
);
1157 void redistribute_ipv6_apply_finish(struct nb_cb_apply_finish_args
*args
)
1159 redistribute_apply_finish(args
->dnode
, AF_INET6
);
1162 int isis_instance_redistribute_ipv4_create(struct nb_cb_create_args
*args
)
1164 /* It's all done by redistribute_apply_finish */
1168 int isis_instance_redistribute_ipv4_destroy(struct nb_cb_destroy_args
*args
)
1170 struct isis_area
*area
;
1173 if (args
->event
!= NB_EV_APPLY
)
1176 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1177 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1178 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
1179 isis_redist_unset(area
, level
, AF_INET
, type
);
1185 * XPath: /frr-isisd:isis/instance/redistribute/ipv4/route-map
1187 int isis_instance_redistribute_ipv4_route_map_modify(
1188 struct nb_cb_modify_args
*args
)
1190 /* It's all done by redistribute_apply_finish */
1194 int isis_instance_redistribute_ipv4_route_map_destroy(
1195 struct nb_cb_destroy_args
*args
)
1197 /* It's all done by redistribute_apply_finish */
1202 * XPath: /frr-isisd:isis/instance/redistribute/ipv4/metric
1204 int isis_instance_redistribute_ipv4_metric_modify(
1205 struct nb_cb_modify_args
*args
)
1207 /* It's all done by redistribute_apply_finish */
1212 * XPath: /frr-isisd:isis/instance/redistribute/ipv6
1214 int isis_instance_redistribute_ipv6_create(struct nb_cb_create_args
*args
)
1216 /* It's all done by redistribute_apply_finish */
1220 int isis_instance_redistribute_ipv6_destroy(struct nb_cb_destroy_args
*args
)
1222 struct isis_area
*area
;
1225 if (args
->event
!= NB_EV_APPLY
)
1228 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1229 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1230 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
1231 isis_redist_unset(area
, level
, AF_INET6
, type
);
1237 * XPath: /frr-isisd:isis/instance/redistribute/ipv6/route-map
1239 int isis_instance_redistribute_ipv6_route_map_modify(
1240 struct nb_cb_modify_args
*args
)
1242 /* It's all done by redistribute_apply_finish */
1246 int isis_instance_redistribute_ipv6_route_map_destroy(
1247 struct nb_cb_destroy_args
*args
)
1249 /* It's all done by redistribute_apply_finish */
1254 * XPath: /frr-isisd:isis/instance/redistribute/ipv6/metric
1256 int isis_instance_redistribute_ipv6_metric_modify(
1257 struct nb_cb_modify_args
*args
)
1259 /* It's all done by redistribute_apply_finish */
1264 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-multicast
1266 static int isis_multi_topology_common(enum nb_event event
,
1267 const struct lyd_node
*dnode
,
1268 char *errmsg
, size_t errmsg_len
,
1269 const char *topology
, bool create
)
1271 struct isis_area
*area
;
1272 struct isis_area_mt_setting
*setting
;
1273 uint16_t mtid
= isis_str2mtid(topology
);
1276 case NB_EV_VALIDATE
:
1277 if (mtid
== (uint16_t)-1) {
1278 snprintf(errmsg
, errmsg_len
, "Unknown topology %s",
1280 return NB_ERR_VALIDATION
;
1287 area
= nb_running_get_entry(dnode
, NULL
, true);
1288 setting
= area_get_mt_setting(area
, mtid
);
1289 setting
->enabled
= create
;
1290 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1297 static int isis_multi_topology_overload_common(enum nb_event event
,
1298 const struct lyd_node
*dnode
,
1299 const char *topology
)
1301 struct isis_area
*area
;
1302 struct isis_area_mt_setting
*setting
;
1303 uint16_t mtid
= isis_str2mtid(topology
);
1305 /* validation is done in isis_multi_topology_common */
1306 if (event
!= NB_EV_APPLY
)
1309 area
= nb_running_get_entry(dnode
, NULL
, true);
1310 setting
= area_get_mt_setting(area
, mtid
);
1311 setting
->overload
= yang_dnode_get_bool(dnode
, NULL
);
1312 if (setting
->enabled
)
1313 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1318 int isis_instance_multi_topology_ipv4_multicast_create(
1319 struct nb_cb_create_args
*args
)
1321 return isis_multi_topology_common(args
->event
, args
->dnode
,
1322 args
->errmsg
, args
->errmsg_len
,
1323 "ipv4-multicast", true);
1326 int isis_instance_multi_topology_ipv4_multicast_destroy(
1327 struct nb_cb_destroy_args
*args
)
1329 return isis_multi_topology_common(args
->event
, args
->dnode
,
1330 args
->errmsg
, args
->errmsg_len
,
1331 "ipv4-multicast", false);
1335 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-multicast/overload
1337 int isis_instance_multi_topology_ipv4_multicast_overload_modify(
1338 struct nb_cb_modify_args
*args
)
1340 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1345 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-management
1347 int isis_instance_multi_topology_ipv4_management_create(
1348 struct nb_cb_create_args
*args
)
1350 return isis_multi_topology_common(args
->event
, args
->dnode
,
1351 args
->errmsg
, args
->errmsg_len
,
1355 int isis_instance_multi_topology_ipv4_management_destroy(
1356 struct nb_cb_destroy_args
*args
)
1358 return isis_multi_topology_common(args
->event
, args
->dnode
,
1359 args
->errmsg
, args
->errmsg_len
,
1360 "ipv4-mgmt", false);
1364 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-management/overload
1366 int isis_instance_multi_topology_ipv4_management_overload_modify(
1367 struct nb_cb_modify_args
*args
)
1369 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1374 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-unicast
1376 int isis_instance_multi_topology_ipv6_unicast_create(
1377 struct nb_cb_create_args
*args
)
1379 return isis_multi_topology_common(args
->event
, args
->dnode
,
1380 args
->errmsg
, args
->errmsg_len
,
1381 "ipv6-unicast", true);
1384 int isis_instance_multi_topology_ipv6_unicast_destroy(
1385 struct nb_cb_destroy_args
*args
)
1387 return isis_multi_topology_common(args
->event
, args
->dnode
,
1388 args
->errmsg
, args
->errmsg_len
,
1389 "ipv6-unicast", false);
1393 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-unicast/overload
1395 int isis_instance_multi_topology_ipv6_unicast_overload_modify(
1396 struct nb_cb_modify_args
*args
)
1398 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1403 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-multicast
1405 int isis_instance_multi_topology_ipv6_multicast_create(
1406 struct nb_cb_create_args
*args
)
1408 return isis_multi_topology_common(args
->event
, args
->dnode
,
1409 args
->errmsg
, args
->errmsg_len
,
1410 "ipv6-multicast", true);
1413 int isis_instance_multi_topology_ipv6_multicast_destroy(
1414 struct nb_cb_destroy_args
*args
)
1416 return isis_multi_topology_common(args
->event
, args
->dnode
,
1417 args
->errmsg
, args
->errmsg_len
,
1418 "ipv6-multicast", false);
1422 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-multicast/overload
1424 int isis_instance_multi_topology_ipv6_multicast_overload_modify(
1425 struct nb_cb_modify_args
*args
)
1427 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1432 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-management
1434 int isis_instance_multi_topology_ipv6_management_create(
1435 struct nb_cb_create_args
*args
)
1437 return isis_multi_topology_common(args
->event
, args
->dnode
,
1438 args
->errmsg
, args
->errmsg_len
,
1442 int isis_instance_multi_topology_ipv6_management_destroy(
1443 struct nb_cb_destroy_args
*args
)
1445 return isis_multi_topology_common(args
->event
, args
->dnode
,
1446 args
->errmsg
, args
->errmsg_len
,
1447 "ipv6-mgmt", false);
1451 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-management/overload
1453 int isis_instance_multi_topology_ipv6_management_overload_modify(
1454 struct nb_cb_modify_args
*args
)
1456 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1461 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-dstsrc
1463 int isis_instance_multi_topology_ipv6_dstsrc_create(
1464 struct nb_cb_create_args
*args
)
1466 return isis_multi_topology_common(args
->event
, args
->dnode
,
1467 args
->errmsg
, args
->errmsg_len
,
1468 "ipv6-dstsrc", true);
1471 int isis_instance_multi_topology_ipv6_dstsrc_destroy(
1472 struct nb_cb_destroy_args
*args
)
1474 return isis_multi_topology_common(args
->event
, args
->dnode
,
1475 args
->errmsg
, args
->errmsg_len
,
1476 "ipv6-dstsrc", false);
1480 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-dstsrc/overload
1482 int isis_instance_multi_topology_ipv6_dstsrc_overload_modify(
1483 struct nb_cb_modify_args
*args
)
1485 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1490 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/load-sharing
1492 int isis_instance_fast_reroute_level_1_lfa_load_sharing_modify(
1493 struct nb_cb_modify_args
*args
)
1495 struct isis_area
*area
;
1497 if (args
->event
!= NB_EV_APPLY
)
1500 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1501 area
->lfa_load_sharing
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
1502 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1508 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/priority-limit
1510 int isis_instance_fast_reroute_level_1_lfa_priority_limit_modify(
1511 struct nb_cb_modify_args
*args
)
1513 struct isis_area
*area
;
1515 if (args
->event
!= NB_EV_APPLY
)
1518 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1519 area
->lfa_priority_limit
[0] = yang_dnode_get_enum(args
->dnode
, NULL
);
1520 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1525 int isis_instance_fast_reroute_level_1_lfa_priority_limit_destroy(
1526 struct nb_cb_destroy_args
*args
)
1528 struct isis_area
*area
;
1530 if (args
->event
!= NB_EV_APPLY
)
1533 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1534 area
->lfa_priority_limit
[0] = SPF_PREFIX_PRIO_LOW
;
1535 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1541 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/tiebreaker
1543 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_create(
1544 struct nb_cb_create_args
*args
)
1546 struct isis_area
*area
;
1548 enum lfa_tiebreaker_type type
;
1549 struct lfa_tiebreaker
*tie_b
;
1551 if (args
->event
!= NB_EV_APPLY
)
1554 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1555 index
= yang_dnode_get_uint8(args
->dnode
, "./index");
1556 type
= yang_dnode_get_enum(args
->dnode
, "./type");
1558 tie_b
= isis_lfa_tiebreaker_add(area
, ISIS_LEVEL1
, index
, type
);
1559 nb_running_set_entry(args
->dnode
, tie_b
);
1560 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1565 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_destroy(
1566 struct nb_cb_destroy_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_unset_entry(args
->dnode
);
1576 isis_lfa_tiebreaker_delete(area
, ISIS_LEVEL1
, tie_b
);
1577 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1583 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/tiebreaker/type
1585 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_type_modify(
1586 struct nb_cb_modify_args
*args
)
1588 struct lfa_tiebreaker
*tie_b
;
1589 struct isis_area
*area
;
1591 if (args
->event
!= NB_EV_APPLY
)
1594 tie_b
= nb_running_get_entry(args
->dnode
, NULL
, true);
1596 tie_b
->type
= yang_dnode_get_enum(args
->dnode
, NULL
);
1597 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1603 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/remote-lfa/prefix-list
1605 int isis_instance_fast_reroute_level_1_remote_lfa_prefix_list_modify(
1606 struct nb_cb_modify_args
*args
)
1608 struct isis_area
*area
;
1609 const char *plist_name
;
1611 if (args
->event
!= NB_EV_APPLY
)
1614 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1615 plist_name
= yang_dnode_get_string(args
->dnode
, NULL
);
1617 area
->rlfa_plist_name
[0] = XSTRDUP(MTYPE_ISIS_PLIST_NAME
, plist_name
);
1618 area
->rlfa_plist
[0] = prefix_list_lookup(AFI_IP
, plist_name
);
1619 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1624 int isis_instance_fast_reroute_level_1_remote_lfa_prefix_list_destroy(
1625 struct nb_cb_destroy_args
*args
)
1627 struct isis_area
*area
;
1629 if (args
->event
!= NB_EV_APPLY
)
1632 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1634 XFREE(MTYPE_ISIS_PLIST_NAME
, area
->rlfa_plist_name
[0]);
1635 area
->rlfa_plist
[0] = NULL
;
1636 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1642 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/load-sharing
1644 int isis_instance_fast_reroute_level_2_lfa_load_sharing_modify(
1645 struct nb_cb_modify_args
*args
)
1647 struct isis_area
*area
;
1649 if (args
->event
!= NB_EV_APPLY
)
1652 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1653 area
->lfa_load_sharing
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
1659 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/priority-limit
1661 int isis_instance_fast_reroute_level_2_lfa_priority_limit_modify(
1662 struct nb_cb_modify_args
*args
)
1664 struct isis_area
*area
;
1666 if (args
->event
!= NB_EV_APPLY
)
1669 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1670 area
->lfa_priority_limit
[1] = yang_dnode_get_enum(args
->dnode
, NULL
);
1675 int isis_instance_fast_reroute_level_2_lfa_priority_limit_destroy(
1676 struct nb_cb_destroy_args
*args
)
1678 struct isis_area
*area
;
1680 if (args
->event
!= NB_EV_APPLY
)
1683 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1684 area
->lfa_priority_limit
[1] = SPF_PREFIX_PRIO_LOW
;
1690 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/tiebreaker
1692 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_create(
1693 struct nb_cb_create_args
*args
)
1695 struct isis_area
*area
;
1697 enum lfa_tiebreaker_type type
;
1698 struct lfa_tiebreaker
*tie_b
;
1700 if (args
->event
!= NB_EV_APPLY
)
1703 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1704 index
= yang_dnode_get_uint8(args
->dnode
, "./index");
1705 type
= yang_dnode_get_enum(args
->dnode
, "./type");
1707 tie_b
= isis_lfa_tiebreaker_add(area
, ISIS_LEVEL2
, index
, type
);
1708 nb_running_set_entry(args
->dnode
, tie_b
);
1709 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1714 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_destroy(
1715 struct nb_cb_destroy_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_unset_entry(args
->dnode
);
1725 isis_lfa_tiebreaker_delete(area
, ISIS_LEVEL2
, tie_b
);
1726 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1732 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/tiebreaker/type
1734 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_type_modify(
1735 struct nb_cb_modify_args
*args
)
1737 struct lfa_tiebreaker
*tie_b
;
1738 struct isis_area
*area
;
1740 if (args
->event
!= NB_EV_APPLY
)
1743 tie_b
= nb_running_get_entry(args
->dnode
, NULL
, true);
1745 tie_b
->type
= yang_dnode_get_enum(args
->dnode
, NULL
);
1746 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1752 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/remote-lfa/prefix-list
1754 int isis_instance_fast_reroute_level_2_remote_lfa_prefix_list_modify(
1755 struct nb_cb_modify_args
*args
)
1757 struct isis_area
*area
;
1758 const char *plist_name
;
1760 if (args
->event
!= NB_EV_APPLY
)
1763 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1764 plist_name
= yang_dnode_get_string(args
->dnode
, NULL
);
1766 area
->rlfa_plist_name
[1] = XSTRDUP(MTYPE_ISIS_PLIST_NAME
, plist_name
);
1767 area
->rlfa_plist
[1] = prefix_list_lookup(AFI_IP
, plist_name
);
1768 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1773 int isis_instance_fast_reroute_level_2_remote_lfa_prefix_list_destroy(
1774 struct nb_cb_destroy_args
*args
)
1776 struct isis_area
*area
;
1778 if (args
->event
!= NB_EV_APPLY
)
1781 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1783 XFREE(MTYPE_ISIS_PLIST_NAME
, area
->rlfa_plist_name
[1]);
1784 area
->rlfa_plist
[1] = NULL
;
1785 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1791 * XPath: /frr-isisd:isis/instance/log-adjacency-changes
1793 int isis_instance_log_adjacency_changes_modify(struct nb_cb_modify_args
*args
)
1795 struct isis_area
*area
;
1796 bool log
= yang_dnode_get_bool(args
->dnode
, NULL
);
1798 if (args
->event
!= NB_EV_APPLY
)
1801 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1802 area
->log_adj_changes
= log
? 1 : 0;
1808 * XPath: /frr-isisd:isis/instance/mpls-te
1810 int isis_instance_mpls_te_create(struct nb_cb_create_args
*args
)
1812 struct isis_area
*area
;
1814 if (args
->event
!= NB_EV_APPLY
)
1817 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1818 isis_mpls_te_create(area
);
1820 /* Reoriginate STD_TE & GMPLS circuits */
1821 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1826 int isis_instance_mpls_te_destroy(struct nb_cb_destroy_args
*args
)
1828 struct isis_area
*area
;
1830 if (args
->event
!= NB_EV_APPLY
)
1833 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1834 if (!IS_MPLS_TE(area
->mta
))
1837 isis_mpls_te_disable(area
);
1839 /* Reoriginate STD_TE & GMPLS circuits */
1840 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1842 zlog_debug("ISIS-TE(%s): Disabled MPLS Traffic Engineering",
1849 * XPath: /frr-isisd:isis/instance/mpls-te/router-address
1851 int isis_instance_mpls_te_router_address_modify(struct nb_cb_modify_args
*args
)
1853 struct in_addr value
;
1854 struct isis_area
*area
;
1856 if (args
->event
!= NB_EV_APPLY
)
1859 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1860 /* only proceed if MPLS-TE is enabled */
1861 if (!IS_MPLS_TE(area
->mta
))
1864 /* Update Area Router ID */
1865 yang_dnode_get_ipv4(&value
, args
->dnode
, NULL
);
1866 area
->mta
->router_id
.s_addr
= value
.s_addr
;
1868 /* And re-schedule LSP update */
1869 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1874 int isis_instance_mpls_te_router_address_destroy(
1875 struct nb_cb_destroy_args
*args
)
1877 struct isis_area
*area
;
1879 if (args
->event
!= NB_EV_APPLY
)
1882 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1883 /* only proceed if MPLS-TE is enabled */
1884 if (!IS_MPLS_TE(area
->mta
))
1887 /* Reset Area Router ID */
1888 area
->mta
->router_id
.s_addr
= INADDR_ANY
;
1890 /* And re-schedule LSP update */
1891 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1897 * XPath: /frr-isisd:isis/instance/mpls-te/router-address-v6
1899 int isis_instance_mpls_te_router_address_ipv6_modify(
1900 struct nb_cb_modify_args
*args
)
1902 struct in6_addr value
;
1903 struct isis_area
*area
;
1905 if (args
->event
!= NB_EV_APPLY
)
1908 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1909 /* only proceed if MPLS-TE is enabled */
1910 if (!IS_MPLS_TE(area
->mta
))
1913 yang_dnode_get_ipv6(&value
, args
->dnode
, NULL
);
1914 /* Update Area IPv6 Router ID if different */
1915 if (!IPV6_ADDR_SAME(&area
->mta
->router_id_ipv6
, &value
)) {
1916 IPV6_ADDR_COPY(&area
->mta
->router_id_ipv6
, &value
);
1918 /* And re-schedule LSP update */
1919 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1925 int isis_instance_mpls_te_router_address_ipv6_destroy(
1926 struct nb_cb_destroy_args
*args
)
1928 struct isis_area
*area
;
1930 if (args
->event
!= NB_EV_APPLY
)
1933 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1934 /* only proceed if MPLS-TE is enabled */
1935 if (!IS_MPLS_TE(area
->mta
))
1938 /* Reset Area Router ID */
1939 IPV6_ADDR_COPY(&area
->mta
->router_id_ipv6
, &in6addr_any
);
1941 /* And re-schedule LSP update */
1942 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1948 * XPath: /frr-isisd:isis/instance/mpls-te/export
1950 int isis_instance_mpls_te_export_modify(struct nb_cb_modify_args
*args
)
1952 struct isis_area
*area
;
1954 if (args
->event
!= NB_EV_APPLY
)
1957 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1958 /* only proceed if MPLS-TE is enabled */
1959 if (!IS_MPLS_TE(area
->mta
))
1962 area
->mta
->export
= yang_dnode_get_bool(args
->dnode
, NULL
);
1963 if (area
->mta
->export
) {
1964 if (IS_DEBUG_EVENTS
)
1965 zlog_debug("MPLS-TE: Enabled Link State export");
1966 if (isis_zebra_ls_register(true) != 0)
1967 zlog_warn("Unable to register Link State");
1969 if (IS_DEBUG_EVENTS
)
1970 zlog_debug("MPLS-TE: Disable Link State export");
1971 if (isis_zebra_ls_register(false) != 0)
1972 zlog_warn("Unable to register Link State");
1979 * XPath: /frr-isisd:isis/instance/segment-routing/enabled
1981 int isis_instance_segment_routing_enabled_modify(
1982 struct nb_cb_modify_args
*args
)
1984 struct isis_area
*area
;
1986 if (args
->event
!= NB_EV_APPLY
)
1989 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1990 area
->srdb
.config
.enabled
= yang_dnode_get_bool(args
->dnode
, NULL
);
1992 if (area
->srdb
.config
.enabled
) {
1993 if (IS_DEBUG_EVENTS
)
1994 zlog_debug("SR: Segment Routing: OFF -> ON");
1996 isis_sr_start(area
);
1998 if (IS_DEBUG_EVENTS
)
1999 zlog_debug("SR: Segment Routing: ON -> OFF");
2008 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks
2010 int isis_instance_segment_routing_label_blocks_pre_validate(
2011 struct nb_cb_pre_validate_args
*args
)
2013 uint32_t srgb_lbound
;
2014 uint32_t srgb_ubound
;
2015 uint32_t srlb_lbound
;
2016 uint32_t srlb_ubound
;
2018 srgb_lbound
= yang_dnode_get_uint32(args
->dnode
, "./srgb/lower-bound");
2019 srgb_ubound
= yang_dnode_get_uint32(args
->dnode
, "./srgb/upper-bound");
2020 srlb_lbound
= yang_dnode_get_uint32(args
->dnode
, "./srlb/lower-bound");
2021 srlb_ubound
= yang_dnode_get_uint32(args
->dnode
, "./srlb/upper-bound");
2023 /* Check that the block size does not exceed 65535 */
2024 if ((srgb_ubound
- srgb_lbound
+ 1) > 65535) {
2026 args
->errmsg
, args
->errmsg_len
,
2027 "New SR Global Block (%u/%u) exceed the limit of 65535",
2028 srgb_lbound
, srgb_ubound
);
2029 return NB_ERR_VALIDATION
;
2031 if ((srlb_ubound
- srlb_lbound
+ 1) > 65535) {
2032 snprintf(args
->errmsg
, args
->errmsg_len
,
2033 "New SR Local Block (%u/%u) exceed the limit of 65535",
2034 srlb_lbound
, srlb_ubound
);
2035 return NB_ERR_VALIDATION
;
2038 /* Validate SRGB against SRLB */
2039 if (!((srgb_ubound
< srlb_lbound
) || (srgb_lbound
> srlb_ubound
))) {
2041 args
->errmsg
, args
->errmsg_len
,
2042 "SR Global Block (%u/%u) conflicts with Local Block (%u/%u)",
2043 srgb_lbound
, srgb_ubound
, srlb_lbound
, srlb_ubound
);
2044 return NB_ERR_VALIDATION
;
2051 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb
2054 void isis_instance_segment_routing_srgb_apply_finish(
2055 struct nb_cb_apply_finish_args
*args
)
2057 struct isis_area
*area
;
2058 uint32_t lower_bound
, upper_bound
;
2060 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2061 lower_bound
= yang_dnode_get_uint32(args
->dnode
, "./lower-bound");
2062 upper_bound
= yang_dnode_get_uint32(args
->dnode
, "./upper-bound");
2064 isis_sr_cfg_srgb_update(area
, lower_bound
, upper_bound
);
2068 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb/lower-bound
2070 int isis_instance_segment_routing_srgb_lower_bound_modify(
2071 struct nb_cb_modify_args
*args
)
2073 uint32_t lower_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2075 switch (args
->event
) {
2076 case NB_EV_VALIDATE
:
2077 if (!IS_MPLS_UNRESERVED_LABEL(lower_bound
)) {
2078 snprintf(args
->errmsg
, args
->errmsg_len
,
2079 "Invalid SRGB lower bound: %u", lower_bound
);
2080 return NB_ERR_VALIDATION
;
2093 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb/upper-bound
2095 int isis_instance_segment_routing_srgb_upper_bound_modify(
2096 struct nb_cb_modify_args
*args
)
2098 uint32_t upper_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2100 switch (args
->event
) {
2101 case NB_EV_VALIDATE
:
2102 if (!IS_MPLS_UNRESERVED_LABEL(upper_bound
)) {
2103 snprintf(args
->errmsg
, args
->errmsg_len
,
2104 "Invalid SRGB upper bound: %u", upper_bound
);
2105 return NB_ERR_VALIDATION
;
2118 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb
2120 void isis_instance_segment_routing_srlb_apply_finish(
2121 struct nb_cb_apply_finish_args
*args
)
2123 struct isis_area
*area
;
2124 uint32_t lower_bound
, upper_bound
;
2126 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2127 lower_bound
= yang_dnode_get_uint32(args
->dnode
, "./lower-bound");
2128 upper_bound
= yang_dnode_get_uint32(args
->dnode
, "./upper-bound");
2130 isis_sr_cfg_srlb_update(area
, lower_bound
, upper_bound
);
2134 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb/lower-bound
2136 int isis_instance_segment_routing_srlb_lower_bound_modify(
2137 struct nb_cb_modify_args
*args
)
2139 uint32_t lower_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2141 switch (args
->event
) {
2142 case NB_EV_VALIDATE
:
2143 if (!IS_MPLS_UNRESERVED_LABEL(lower_bound
)) {
2144 snprintf(args
->errmsg
, args
->errmsg_len
,
2145 "Invalid SRLB lower bound: %u", lower_bound
);
2146 return NB_ERR_VALIDATION
;
2159 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb/upper-bound
2161 int isis_instance_segment_routing_srlb_upper_bound_modify(
2162 struct nb_cb_modify_args
*args
)
2164 uint32_t upper_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2166 switch (args
->event
) {
2167 case NB_EV_VALIDATE
:
2168 if (!IS_MPLS_UNRESERVED_LABEL(upper_bound
)) {
2169 snprintf(args
->errmsg
, args
->errmsg_len
,
2170 "Invalid SRLB upper bound: %u", upper_bound
);
2171 return NB_ERR_VALIDATION
;
2184 * XPath: /frr-isisd:isis/instance/segment-routing/msd/node-msd
2186 int isis_instance_segment_routing_msd_node_msd_modify(
2187 struct nb_cb_modify_args
*args
)
2189 struct isis_area
*area
;
2191 if (args
->event
!= NB_EV_APPLY
)
2194 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2195 area
->srdb
.config
.msd
= yang_dnode_get_uint8(args
->dnode
, NULL
);
2197 /* Update and regenerate LSP */
2198 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2203 int isis_instance_segment_routing_msd_node_msd_destroy(
2204 struct nb_cb_destroy_args
*args
)
2206 struct isis_area
*area
;
2208 if (args
->event
!= NB_EV_APPLY
)
2211 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2212 area
->srdb
.config
.msd
= 0;
2214 /* Update and regenerate LSP */
2215 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2221 * XPath: /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid
2223 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_create(
2224 struct nb_cb_create_args
*args
)
2226 struct isis_area
*area
;
2227 struct prefix prefix
;
2228 struct sr_prefix_cfg
*pcfg
;
2230 if (args
->event
!= NB_EV_APPLY
)
2233 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2234 yang_dnode_get_prefix(&prefix
, args
->dnode
, "./prefix");
2236 pcfg
= isis_sr_cfg_prefix_add(area
, &prefix
);
2237 nb_running_set_entry(args
->dnode
, pcfg
);
2242 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_destroy(
2243 struct nb_cb_destroy_args
*args
)
2245 struct sr_prefix_cfg
*pcfg
;
2246 struct isis_area
*area
;
2248 if (args
->event
!= NB_EV_APPLY
)
2251 pcfg
= nb_running_unset_entry(args
->dnode
);
2253 isis_sr_cfg_prefix_del(pcfg
);
2254 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2259 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_pre_validate(
2260 struct nb_cb_pre_validate_args
*args
)
2262 const struct lyd_node
*area_dnode
;
2263 struct isis_area
*area
;
2264 struct prefix prefix
;
2265 uint32_t srgb_lbound
;
2266 uint32_t srgb_ubound
;
2267 uint32_t srgb_range
;
2269 enum sr_sid_value_type sid_type
;
2270 struct isis_prefix_sid psid
= {};
2272 yang_dnode_get_prefix(&prefix
, args
->dnode
, "./prefix");
2273 srgb_lbound
= yang_dnode_get_uint32(
2274 args
->dnode
, "../../label-blocks/srgb/lower-bound");
2275 srgb_ubound
= yang_dnode_get_uint32(
2276 args
->dnode
, "../../label-blocks/srgb/upper-bound");
2277 sid
= yang_dnode_get_uint32(args
->dnode
, "./sid-value");
2278 sid_type
= yang_dnode_get_enum(args
->dnode
, "./sid-value-type");
2280 /* Check for invalid indexes/labels. */
2281 srgb_range
= srgb_ubound
- srgb_lbound
+ 1;
2284 case SR_SID_VALUE_TYPE_INDEX
:
2285 if (sid
>= srgb_range
) {
2286 snprintf(args
->errmsg
, args
->errmsg_len
,
2287 "SID index %u falls outside local SRGB range",
2289 return NB_ERR_VALIDATION
;
2292 case SR_SID_VALUE_TYPE_ABSOLUTE
:
2293 if (!IS_MPLS_UNRESERVED_LABEL(sid
)) {
2294 snprintf(args
->errmsg
, args
->errmsg_len
,
2295 "Invalid absolute SID %u", sid
);
2296 return NB_ERR_VALIDATION
;
2298 SET_FLAG(psid
.flags
, ISIS_PREFIX_SID_VALUE
);
2299 SET_FLAG(psid
.flags
, ISIS_PREFIX_SID_LOCAL
);
2303 /* Check for Prefix-SID collisions. */
2304 area_dnode
= yang_dnode_get_parent(args
->dnode
, "instance");
2305 area
= nb_running_get_entry(area_dnode
, NULL
, false);
2307 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
2308 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVEL2
;
2310 struct isis_spftree
*spftree
;
2311 struct isis_vertex
*vertex_psid
;
2313 if (!(area
->is_type
& level
))
2315 spftree
= area
->spftree
[tree
][level
- 1];
2319 vertex_psid
= isis_spf_prefix_sid_lookup(
2322 && !prefix_same(&vertex_psid
->N
.ip
.p
.dest
,
2325 args
->errmsg
, args
->errmsg_len
,
2326 "Prefix-SID collision detected, SID %s %u is already in use by prefix %pFX (L%u)",
2329 ISIS_PREFIX_SID_VALUE
)
2333 &vertex_psid
->N
.ip
.p
.dest
,
2335 return NB_ERR_VALIDATION
;
2344 void isis_instance_segment_routing_prefix_sid_map_prefix_sid_apply_finish(
2345 struct nb_cb_apply_finish_args
*args
)
2347 struct sr_prefix_cfg
*pcfg
;
2348 struct isis_area
*area
;
2350 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2352 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2357 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/sid-value-type
2359 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_sid_value_type_modify(
2360 struct nb_cb_modify_args
*args
)
2362 struct sr_prefix_cfg
*pcfg
;
2364 if (args
->event
!= NB_EV_APPLY
)
2367 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2368 pcfg
->sid_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2375 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/sid-value
2377 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_sid_value_modify(
2378 struct nb_cb_modify_args
*args
)
2380 struct sr_prefix_cfg
*pcfg
;
2382 if (args
->event
!= NB_EV_APPLY
)
2385 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2386 pcfg
->sid
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2393 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/last-hop-behavior
2395 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_last_hop_behavior_modify(
2396 struct nb_cb_modify_args
*args
)
2398 struct sr_prefix_cfg
*pcfg
;
2400 if (args
->event
!= NB_EV_APPLY
)
2403 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2404 pcfg
->last_hop_behavior
= yang_dnode_get_enum(args
->dnode
, NULL
);
2410 * XPath: /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/n-flag-clear
2412 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_n_flag_clear_modify(
2413 struct nb_cb_modify_args
*args
)
2415 struct sr_prefix_cfg
*pcfg
;
2417 if (args
->event
!= NB_EV_APPLY
)
2420 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2421 pcfg
->n_flag_clear
= yang_dnode_get_bool(args
->dnode
, NULL
);
2427 * XPath: /frr-isisd:isis/instance/mpls/ldp-sync
2429 int isis_instance_mpls_ldp_sync_create(struct nb_cb_create_args
*args
)
2431 struct isis_area
*area
;
2432 const char *vrfname
;
2434 switch (args
->event
) {
2435 case NB_EV_VALIDATE
:
2436 vrfname
= yang_dnode_get_string(
2437 lyd_parent(lyd_parent(args
->dnode
)), "./vrf");
2439 if (strcmp(vrfname
, VRF_DEFAULT_NAME
)) {
2440 snprintf(args
->errmsg
, args
->errmsg_len
,
2441 "LDP-Sync only runs on Default VRF");
2442 return NB_ERR_VALIDATION
;
2449 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2450 isis_area_ldp_sync_enable(area
);
2456 int isis_instance_mpls_ldp_sync_destroy(struct nb_cb_destroy_args
*args
)
2458 struct isis_area
*area
;
2460 if (args
->event
!= NB_EV_APPLY
)
2463 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2464 isis_area_ldp_sync_disable(area
);
2470 * XPath: /frr-isisd:isis/instance/mpls/ldp-sync/holddown
2472 int isis_instance_mpls_ldp_sync_holddown_modify(struct nb_cb_modify_args
*args
)
2474 struct isis_area
*area
;
2476 const char *vrfname
;
2478 switch (args
->event
) {
2479 case NB_EV_VALIDATE
:
2480 vrfname
= yang_dnode_get_string(
2481 lyd_parent(lyd_parent(lyd_parent(args
->dnode
))),
2484 if (strcmp(vrfname
, VRF_DEFAULT_NAME
)) {
2485 snprintf(args
->errmsg
, args
->errmsg_len
,
2486 "LDP-Sync only runs on Default VRF");
2487 return NB_ERR_VALIDATION
;
2494 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2495 holddown
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2496 isis_area_ldp_sync_set_holddown(area
, holddown
);
2503 * XPath: /frr-interface:lib/interface/frr-isisd:isis
2505 int lib_interface_isis_create(struct nb_cb_create_args
*args
)
2507 struct interface
*ifp
;
2508 struct isis_circuit
*circuit
= NULL
;
2509 const char *area_tag
= yang_dnode_get_string(args
->dnode
, "./area-tag");
2511 switch (args
->event
) {
2514 case NB_EV_VALIDATE
:
2517 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
2518 circuit
= isis_circuit_new(ifp
, area_tag
);
2519 nb_running_set_entry(args
->dnode
, circuit
);
2526 int lib_interface_isis_destroy(struct nb_cb_destroy_args
*args
)
2528 struct isis_circuit
*circuit
;
2530 if (args
->event
!= NB_EV_APPLY
)
2533 circuit
= nb_running_unset_entry(args
->dnode
);
2535 isis_circuit_del(circuit
);
2541 * XPath: /frr-interface:lib/interface/frr-isisd:isis/area-tag
2543 int lib_interface_isis_area_tag_modify(struct nb_cb_modify_args
*args
)
2545 struct isis_circuit
*circuit
;
2547 if (args
->event
== NB_EV_VALIDATE
) {
2548 circuit
= nb_running_get_entry_non_rec(lyd_parent(args
->dnode
), NULL
, false);
2550 snprintf(args
->errmsg
, args
->errmsg_len
,
2551 "Changing area tag is not allowed");
2552 return NB_ERR_VALIDATION
;
2560 * XPath: /frr-interface:lib/interface/frr-isisd:isis/circuit-type
2562 int lib_interface_isis_circuit_type_modify(struct nb_cb_modify_args
*args
)
2564 int circ_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2565 struct isis_circuit
*circuit
;
2567 switch (args
->event
) {
2568 case NB_EV_VALIDATE
:
2573 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2574 circuit
->is_type_config
= circ_type
;
2575 isis_circuit_is_type_set(circuit
, circ_type
);
2583 * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv4-routing
2585 int lib_interface_isis_ipv4_routing_modify(struct nb_cb_modify_args
*args
)
2588 struct isis_circuit
*circuit
;
2590 if (args
->event
!= NB_EV_APPLY
)
2593 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2594 ipv4
= yang_dnode_get_bool(args
->dnode
, NULL
);
2595 ipv6
= yang_dnode_get_bool(args
->dnode
, "../ipv6-routing");
2596 isis_circuit_af_set(circuit
, ipv4
, ipv6
);
2602 * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv6-routing
2604 int lib_interface_isis_ipv6_routing_modify(struct nb_cb_modify_args
*args
)
2607 struct isis_circuit
*circuit
;
2609 if (args
->event
!= NB_EV_APPLY
)
2612 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2613 ipv4
= yang_dnode_get_bool(args
->dnode
, "../ipv4-routing");
2614 ipv6
= yang_dnode_get_bool(args
->dnode
, NULL
);
2615 isis_circuit_af_set(circuit
, ipv4
, ipv6
);
2621 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring
2623 void lib_interface_isis_bfd_monitoring_apply_finish(
2624 struct nb_cb_apply_finish_args
*args
)
2626 struct isis_circuit
*circuit
;
2628 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2629 isis_bfd_circuit_cmd(circuit
);
2633 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring/enabled
2635 int lib_interface_isis_bfd_monitoring_enabled_modify(
2636 struct nb_cb_modify_args
*args
)
2638 struct isis_circuit
*circuit
;
2640 if (args
->event
!= NB_EV_APPLY
)
2643 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2644 circuit
->bfd_config
.enabled
= yang_dnode_get_bool(args
->dnode
, NULL
);
2650 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring/profile
2652 int lib_interface_isis_bfd_monitoring_profile_modify(
2653 struct nb_cb_modify_args
*args
)
2655 struct isis_circuit
*circuit
;
2657 if (args
->event
!= NB_EV_APPLY
)
2660 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2661 XFREE(MTYPE_TMP
, circuit
->bfd_config
.profile
);
2662 circuit
->bfd_config
.profile
=
2663 XSTRDUP(MTYPE_TMP
, yang_dnode_get_string(args
->dnode
, NULL
));
2668 int lib_interface_isis_bfd_monitoring_profile_destroy(
2669 struct nb_cb_destroy_args
*args
)
2671 struct isis_circuit
*circuit
;
2673 if (args
->event
!= NB_EV_APPLY
)
2676 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2677 XFREE(MTYPE_TMP
, circuit
->bfd_config
.profile
);
2683 * XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-1
2685 int lib_interface_isis_csnp_interval_level_1_modify(
2686 struct nb_cb_modify_args
*args
)
2688 struct isis_circuit
*circuit
;
2690 if (args
->event
!= NB_EV_APPLY
)
2693 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2694 circuit
->csnp_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2700 * XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-2
2702 int lib_interface_isis_csnp_interval_level_2_modify(
2703 struct nb_cb_modify_args
*args
)
2705 struct isis_circuit
*circuit
;
2707 if (args
->event
!= NB_EV_APPLY
)
2710 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2711 circuit
->csnp_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2717 * XPath: /frr-interface:lib/interface/frr-isisd:isis/psnp-interval/level-1
2719 int lib_interface_isis_psnp_interval_level_1_modify(
2720 struct nb_cb_modify_args
*args
)
2722 struct isis_circuit
*circuit
;
2724 if (args
->event
!= NB_EV_APPLY
)
2727 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2728 circuit
->psnp_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2734 * XPath: /frr-interface:lib/interface/frr-isisd:isis/psnp-interval/level-2
2736 int lib_interface_isis_psnp_interval_level_2_modify(
2737 struct nb_cb_modify_args
*args
)
2739 struct isis_circuit
*circuit
;
2741 if (args
->event
!= NB_EV_APPLY
)
2744 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2745 circuit
->psnp_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2751 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/padding
2753 int lib_interface_isis_hello_padding_modify(struct nb_cb_modify_args
*args
)
2755 struct isis_circuit
*circuit
;
2757 if (args
->event
!= NB_EV_APPLY
)
2760 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2761 circuit
->pad_hellos
= yang_dnode_get_bool(args
->dnode
, NULL
);
2767 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/interval/level-1
2769 int lib_interface_isis_hello_interval_level_1_modify(
2770 struct nb_cb_modify_args
*args
)
2772 struct isis_circuit
*circuit
;
2775 if (args
->event
!= NB_EV_APPLY
)
2778 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2779 interval
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2780 circuit
->hello_interval
[0] = interval
;
2786 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/interval/level-2
2788 int lib_interface_isis_hello_interval_level_2_modify(
2789 struct nb_cb_modify_args
*args
)
2791 struct isis_circuit
*circuit
;
2794 if (args
->event
!= NB_EV_APPLY
)
2797 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2798 interval
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2799 circuit
->hello_interval
[1] = interval
;
2805 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/multiplier/level-1
2807 int lib_interface_isis_hello_multiplier_level_1_modify(
2808 struct nb_cb_modify_args
*args
)
2810 struct isis_circuit
*circuit
;
2813 if (args
->event
!= NB_EV_APPLY
)
2816 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2817 multi
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2818 circuit
->hello_multiplier
[0] = multi
;
2824 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/multiplier/level-2
2826 int lib_interface_isis_hello_multiplier_level_2_modify(
2827 struct nb_cb_modify_args
*args
)
2829 struct isis_circuit
*circuit
;
2832 if (args
->event
!= NB_EV_APPLY
)
2835 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2836 multi
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2837 circuit
->hello_multiplier
[1] = multi
;
2843 * XPath: /frr-interface:lib/interface/frr-isisd:isis/metric/level-1
2845 int lib_interface_isis_metric_level_1_modify(struct nb_cb_modify_args
*args
)
2847 struct isis_circuit
*circuit
;
2850 if (args
->event
!= NB_EV_APPLY
)
2853 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2854 met
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2855 isis_circuit_metric_set(circuit
, IS_LEVEL_1
, met
);
2861 * XPath: /frr-interface:lib/interface/frr-isisd:isis/metric/level-2
2863 int lib_interface_isis_metric_level_2_modify(struct nb_cb_modify_args
*args
)
2865 struct isis_circuit
*circuit
;
2868 if (args
->event
!= NB_EV_APPLY
)
2871 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2872 met
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2873 isis_circuit_metric_set(circuit
, IS_LEVEL_2
, met
);
2879 * XPath: /frr-interface:lib/interface/frr-isisd:isis/priority/level-1
2881 int lib_interface_isis_priority_level_1_modify(struct nb_cb_modify_args
*args
)
2883 struct isis_circuit
*circuit
;
2885 if (args
->event
!= NB_EV_APPLY
)
2888 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2889 circuit
->priority
[0] = yang_dnode_get_uint8(args
->dnode
, NULL
);
2895 * XPath: /frr-interface:lib/interface/frr-isisd:isis/priority/level-2
2897 int lib_interface_isis_priority_level_2_modify(struct nb_cb_modify_args
*args
)
2899 struct isis_circuit
*circuit
;
2901 if (args
->event
!= NB_EV_APPLY
)
2904 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2905 circuit
->priority
[1] = yang_dnode_get_uint8(args
->dnode
, NULL
);
2911 * XPath: /frr-interface:lib/interface/frr-isisd:isis/network-type
2913 int lib_interface_isis_network_type_modify(struct nb_cb_modify_args
*args
)
2915 struct isis_circuit
*circuit
;
2916 int net_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2918 switch (args
->event
) {
2919 case NB_EV_VALIDATE
:
2920 circuit
= nb_running_get_entry(args
->dnode
, NULL
, false);
2923 if (circuit
->circ_type
== CIRCUIT_T_LOOPBACK
) {
2925 args
->errmsg
, args
->errmsg_len
,
2926 "Cannot change network type on loopback interface");
2927 return NB_ERR_VALIDATION
;
2929 if (net_type
== CIRCUIT_T_BROADCAST
2930 && circuit
->state
== C_STATE_UP
2931 && !if_is_broadcast(circuit
->interface
)) {
2933 args
->errmsg
, args
->errmsg_len
,
2934 "Cannot configure non-broadcast interface for broadcast operation");
2935 return NB_ERR_VALIDATION
;
2942 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2943 isis_circuit_circ_type_set(circuit
, net_type
);
2951 * XPath: /frr-interface:lib/interface/frr-isisd:isis/passive
2953 int lib_interface_isis_passive_modify(struct nb_cb_modify_args
*args
)
2955 struct isis_circuit
*circuit
;
2956 bool passive
= yang_dnode_get_bool(args
->dnode
, NULL
);
2958 if (args
->event
!= NB_EV_APPLY
)
2961 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2962 isis_circuit_passive_set(circuit
, passive
);
2968 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password
2970 int lib_interface_isis_password_create(struct nb_cb_create_args
*args
)
2975 int lib_interface_isis_password_destroy(struct nb_cb_destroy_args
*args
)
2977 struct isis_circuit
*circuit
;
2979 if (args
->event
!= NB_EV_APPLY
)
2982 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2983 isis_circuit_passwd_unset(circuit
);
2989 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password/password
2991 int lib_interface_isis_password_password_modify(struct nb_cb_modify_args
*args
)
2993 struct isis_circuit
*circuit
;
2994 const char *password
;
2996 if (args
->event
!= NB_EV_APPLY
)
2999 password
= yang_dnode_get_string(args
->dnode
, NULL
);
3000 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3002 isis_circuit_passwd_set(circuit
, circuit
->passwd
.type
, password
);
3008 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password/password-type
3010 int lib_interface_isis_password_password_type_modify(
3011 struct nb_cb_modify_args
*args
)
3013 struct isis_circuit
*circuit
;
3016 if (args
->event
!= NB_EV_APPLY
)
3019 pass_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
3020 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3021 circuit
->passwd
.type
= pass_type
;
3028 * /frr-interface:lib/interface/frr-isisd:isis/disable-three-way-handshake
3030 int lib_interface_isis_disable_three_way_handshake_modify(
3031 struct nb_cb_modify_args
*args
)
3033 struct isis_circuit
*circuit
;
3035 if (args
->event
!= NB_EV_APPLY
)
3038 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3039 circuit
->disable_threeway_adj
= yang_dnode_get_bool(args
->dnode
, NULL
);
3044 static int lib_interface_isis_multi_topology_common(
3045 enum nb_event event
, const struct lyd_node
*dnode
, char *errmsg
,
3046 size_t errmsg_len
, uint16_t mtid
)
3048 struct isis_circuit
*circuit
;
3052 case NB_EV_VALIDATE
:
3053 circuit
= nb_running_get_entry(dnode
, NULL
, false);
3054 if (circuit
&& circuit
->area
&& circuit
->area
->oldmetric
) {
3057 "Multi topology IS-IS can only be used with wide metrics");
3058 return NB_ERR_VALIDATION
;
3065 circuit
= nb_running_get_entry(dnode
, NULL
, true);
3066 value
= yang_dnode_get_bool(dnode
, NULL
);
3067 isis_circuit_mt_enabled_set(circuit
, mtid
, value
);
3076 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/standard
3078 int lib_interface_isis_multi_topology_standard_modify(
3079 struct nb_cb_modify_args
*args
)
3081 return lib_interface_isis_multi_topology_common(
3082 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3088 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-multicast
3090 int lib_interface_isis_multi_topology_ipv4_multicast_modify(
3091 struct nb_cb_modify_args
*args
)
3093 return lib_interface_isis_multi_topology_common(
3094 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3095 ISIS_MT_IPV4_MULTICAST
);
3100 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-management
3102 int lib_interface_isis_multi_topology_ipv4_management_modify(
3103 struct nb_cb_modify_args
*args
)
3105 return lib_interface_isis_multi_topology_common(
3106 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3112 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-unicast
3114 int lib_interface_isis_multi_topology_ipv6_unicast_modify(
3115 struct nb_cb_modify_args
*args
)
3117 return lib_interface_isis_multi_topology_common(
3118 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3119 ISIS_MT_IPV6_UNICAST
);
3124 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-multicast
3126 int lib_interface_isis_multi_topology_ipv6_multicast_modify(
3127 struct nb_cb_modify_args
*args
)
3129 return lib_interface_isis_multi_topology_common(
3130 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3131 ISIS_MT_IPV6_MULTICAST
);
3136 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-management
3138 int lib_interface_isis_multi_topology_ipv6_management_modify(
3139 struct nb_cb_modify_args
*args
)
3141 return lib_interface_isis_multi_topology_common(
3142 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3147 * XPath: /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-dstsrc
3149 int lib_interface_isis_multi_topology_ipv6_dstsrc_modify(
3150 struct nb_cb_modify_args
*args
)
3152 return lib_interface_isis_multi_topology_common(
3153 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3154 ISIS_MT_IPV6_DSTSRC
);
3158 * XPath: /frr-interface:lib/interface/frr-isisd:isis/mpls/ldp-sync
3160 int lib_interface_isis_mpls_ldp_sync_modify(struct nb_cb_modify_args
*args
)
3162 struct isis_circuit
*circuit
;
3163 struct ldp_sync_info
*ldp_sync_info
;
3164 bool ldp_sync_enable
;
3166 switch (args
->event
) {
3167 case NB_EV_VALIDATE
:
3172 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3173 ldp_sync_enable
= yang_dnode_get_bool(args
->dnode
, NULL
);
3175 ldp_sync_info
= circuit
->ldp_sync_info
;
3177 SET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_IF_CONFIG
);
3178 ldp_sync_info
->enabled
= ldp_sync_enable
;
3180 if (circuit
->area
) {
3181 if (ldp_sync_enable
)
3182 isis_if_ldp_sync_enable(circuit
);
3184 isis_if_ldp_sync_disable(circuit
);
3192 * XPath: /frr-interface:lib/interface/frr-isisd:isis/mpls/holddown
3194 int lib_interface_isis_mpls_holddown_modify(struct nb_cb_modify_args
*args
)
3196 struct isis_circuit
*circuit
;
3197 struct ldp_sync_info
*ldp_sync_info
;
3200 switch (args
->event
) {
3201 case NB_EV_VALIDATE
:
3206 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3207 holddown
= yang_dnode_get_uint16(args
->dnode
, NULL
);
3209 ldp_sync_info
= circuit
->ldp_sync_info
;
3211 SET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_HOLDDOWN
);
3212 ldp_sync_info
->holddown
= holddown
;
3218 int lib_interface_isis_mpls_holddown_destroy(struct nb_cb_destroy_args
*args
)
3220 struct isis_circuit
*circuit
;
3221 struct ldp_sync_info
*ldp_sync_info
;
3223 switch (args
->event
) {
3224 case NB_EV_VALIDATE
:
3229 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3230 ldp_sync_info
= circuit
->ldp_sync_info
;
3232 UNSET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_HOLDDOWN
);
3235 isis_if_set_ldp_sync_holddown(circuit
);
3244 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/lfa/enable
3246 int lib_interface_isis_fast_reroute_level_1_lfa_enable_modify(
3247 struct nb_cb_modify_args
*args
)
3249 struct isis_area
*area
;
3250 struct isis_circuit
*circuit
;
3252 if (args
->event
!= NB_EV_APPLY
)
3255 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3256 circuit
->lfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3258 area
= circuit
->area
;
3260 if (circuit
->lfa_protection
[0])
3261 area
->lfa_protected_links
[0]++;
3263 assert(area
->lfa_protected_links
[0] > 0);
3264 area
->lfa_protected_links
[0]--;
3267 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3275 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/lfa/exclude-interface
3277 int lib_interface_isis_fast_reroute_level_1_lfa_exclude_interface_create(
3278 struct nb_cb_create_args
*args
)
3280 struct isis_area
*area
;
3281 struct isis_circuit
*circuit
;
3282 const char *exclude_ifname
;
3284 if (args
->event
!= NB_EV_APPLY
)
3287 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3288 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3290 isis_lfa_excluded_iface_add(circuit
, ISIS_LEVEL1
, exclude_ifname
);
3291 area
= circuit
->area
;
3293 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3298 int lib_interface_isis_fast_reroute_level_1_lfa_exclude_interface_destroy(
3299 struct nb_cb_destroy_args
*args
)
3301 struct isis_area
*area
;
3302 struct isis_circuit
*circuit
;
3303 const char *exclude_ifname
;
3305 if (args
->event
!= NB_EV_APPLY
)
3308 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3309 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3311 isis_lfa_excluded_iface_delete(circuit
, ISIS_LEVEL1
, exclude_ifname
);
3312 area
= circuit
->area
;
3314 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3321 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/remote-lfa/enable
3323 int lib_interface_isis_fast_reroute_level_1_remote_lfa_enable_modify(
3324 struct nb_cb_modify_args
*args
)
3326 struct isis_area
*area
;
3327 struct isis_circuit
*circuit
;
3329 if (args
->event
!= NB_EV_APPLY
)
3332 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3333 circuit
->rlfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3335 area
= circuit
->area
;
3337 if (circuit
->rlfa_protection
[0])
3338 area
->rlfa_protected_links
[0]++;
3340 assert(area
->rlfa_protected_links
[0] > 0);
3341 area
->rlfa_protected_links
[0]--;
3344 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3352 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/remote-lfa/maximum-metric
3354 int lib_interface_isis_fast_reroute_level_1_remote_lfa_maximum_metric_modify(
3355 struct nb_cb_modify_args
*args
)
3357 struct isis_area
*area
;
3358 struct isis_circuit
*circuit
;
3360 if (args
->event
!= NB_EV_APPLY
)
3363 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3364 circuit
->rlfa_max_metric
[0] = yang_dnode_get_uint32(args
->dnode
, NULL
);
3366 area
= circuit
->area
;
3368 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3373 int lib_interface_isis_fast_reroute_level_1_remote_lfa_maximum_metric_destroy(
3374 struct nb_cb_destroy_args
*args
)
3376 struct isis_area
*area
;
3377 struct isis_circuit
*circuit
;
3379 if (args
->event
!= NB_EV_APPLY
)
3382 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3383 circuit
->rlfa_max_metric
[0] = 0;
3385 area
= circuit
->area
;
3387 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3394 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/enable
3396 int lib_interface_isis_fast_reroute_level_1_ti_lfa_enable_modify(
3397 struct nb_cb_modify_args
*args
)
3399 struct isis_area
*area
;
3400 struct isis_circuit
*circuit
;
3402 if (args
->event
!= NB_EV_APPLY
)
3405 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3406 circuit
->tilfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3408 area
= circuit
->area
;
3410 if (circuit
->tilfa_protection
[0])
3411 area
->tilfa_protected_links
[0]++;
3413 assert(area
->tilfa_protected_links
[0] > 0);
3414 area
->tilfa_protected_links
[0]--;
3417 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3425 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/node-protection
3427 int lib_interface_isis_fast_reroute_level_1_ti_lfa_node_protection_modify(
3428 struct nb_cb_modify_args
*args
)
3430 struct isis_area
*area
;
3431 struct isis_circuit
*circuit
;
3433 if (args
->event
!= NB_EV_APPLY
)
3436 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3437 circuit
->tilfa_node_protection
[0] =
3438 yang_dnode_get_bool(args
->dnode
, NULL
);
3440 area
= circuit
->area
;
3442 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3449 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/link-fallback
3451 int lib_interface_isis_fast_reroute_level_1_ti_lfa_link_fallback_modify(
3452 struct nb_cb_modify_args
*args
)
3454 struct isis_area
*area
;
3455 struct isis_circuit
*circuit
;
3457 if (args
->event
!= NB_EV_APPLY
)
3460 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3461 circuit
->tilfa_link_fallback
[0] =
3462 yang_dnode_get_bool(args
->dnode
, NULL
);
3464 area
= circuit
->area
;
3466 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3473 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/lfa/enable
3475 int lib_interface_isis_fast_reroute_level_2_lfa_enable_modify(
3476 struct nb_cb_modify_args
*args
)
3478 struct isis_area
*area
;
3479 struct isis_circuit
*circuit
;
3481 if (args
->event
!= NB_EV_APPLY
)
3484 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3485 circuit
->lfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3487 area
= circuit
->area
;
3489 if (circuit
->lfa_protection
[1])
3490 area
->lfa_protected_links
[1]++;
3492 assert(area
->lfa_protected_links
[1] > 0);
3493 area
->lfa_protected_links
[1]--;
3496 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3504 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/lfa/exclude-interface
3506 int lib_interface_isis_fast_reroute_level_2_lfa_exclude_interface_create(
3507 struct nb_cb_create_args
*args
)
3509 struct isis_area
*area
;
3510 struct isis_circuit
*circuit
;
3511 const char *exclude_ifname
;
3513 if (args
->event
!= NB_EV_APPLY
)
3516 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3517 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3519 isis_lfa_excluded_iface_add(circuit
, ISIS_LEVEL2
, exclude_ifname
);
3520 area
= circuit
->area
;
3522 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3527 int lib_interface_isis_fast_reroute_level_2_lfa_exclude_interface_destroy(
3528 struct nb_cb_destroy_args
*args
)
3530 struct isis_area
*area
;
3531 struct isis_circuit
*circuit
;
3532 const char *exclude_ifname
;
3534 if (args
->event
!= NB_EV_APPLY
)
3537 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3538 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3540 isis_lfa_excluded_iface_delete(circuit
, ISIS_LEVEL2
, exclude_ifname
);
3541 area
= circuit
->area
;
3543 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3550 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/remote-lfa/enable
3552 int lib_interface_isis_fast_reroute_level_2_remote_lfa_enable_modify(
3553 struct nb_cb_modify_args
*args
)
3555 struct isis_area
*area
;
3556 struct isis_circuit
*circuit
;
3558 if (args
->event
!= NB_EV_APPLY
)
3561 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3562 circuit
->rlfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3564 area
= circuit
->area
;
3566 if (circuit
->rlfa_protection
[1])
3567 area
->rlfa_protected_links
[1]++;
3569 assert(area
->rlfa_protected_links
[1] > 0);
3570 area
->rlfa_protected_links
[1]--;
3573 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3581 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/remote-lfa/maximum-metric
3583 int lib_interface_isis_fast_reroute_level_2_remote_lfa_maximum_metric_modify(
3584 struct nb_cb_modify_args
*args
)
3586 struct isis_area
*area
;
3587 struct isis_circuit
*circuit
;
3589 if (args
->event
!= NB_EV_APPLY
)
3592 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3593 circuit
->rlfa_max_metric
[1] = yang_dnode_get_uint32(args
->dnode
, NULL
);
3595 area
= circuit
->area
;
3597 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3602 int lib_interface_isis_fast_reroute_level_2_remote_lfa_maximum_metric_destroy(
3603 struct nb_cb_destroy_args
*args
)
3605 struct isis_area
*area
;
3606 struct isis_circuit
*circuit
;
3608 if (args
->event
!= NB_EV_APPLY
)
3611 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3612 circuit
->rlfa_max_metric
[1] = 0;
3614 area
= circuit
->area
;
3616 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3623 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/enable
3625 int lib_interface_isis_fast_reroute_level_2_ti_lfa_enable_modify(
3626 struct nb_cb_modify_args
*args
)
3628 struct isis_area
*area
;
3629 struct isis_circuit
*circuit
;
3631 if (args
->event
!= NB_EV_APPLY
)
3634 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3635 circuit
->tilfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3637 area
= circuit
->area
;
3639 if (circuit
->tilfa_protection
[1])
3640 area
->tilfa_protected_links
[1]++;
3642 assert(area
->tilfa_protected_links
[1] > 0);
3643 area
->tilfa_protected_links
[1]--;
3646 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3654 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/node-protection
3656 int lib_interface_isis_fast_reroute_level_2_ti_lfa_node_protection_modify(
3657 struct nb_cb_modify_args
*args
)
3659 struct isis_area
*area
;
3660 struct isis_circuit
*circuit
;
3662 if (args
->event
!= NB_EV_APPLY
)
3665 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3666 circuit
->tilfa_node_protection
[1] =
3667 yang_dnode_get_bool(args
->dnode
, NULL
);
3669 area
= circuit
->area
;
3671 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3678 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/link-fallback
3680 int lib_interface_isis_fast_reroute_level_2_ti_lfa_link_fallback_modify(
3681 struct nb_cb_modify_args
*args
)
3683 struct isis_area
*area
;
3684 struct isis_circuit
*circuit
;
3686 if (args
->event
!= NB_EV_APPLY
)
3689 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3690 circuit
->tilfa_link_fallback
[1] =
3691 yang_dnode_get_bool(args
->dnode
, NULL
);
3693 area
= circuit
->area
;
3695 lsp_regenerate_schedule(area
, area
->is_type
, 0);