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"
57 DEFINE_MTYPE_STATIC(ISISD
, ISIS_MPLS_TE
, "ISIS MPLS_TE parameters");
58 DEFINE_MTYPE_STATIC(ISISD
, ISIS_PLIST_NAME
, "ISIS prefix-list name");
61 * XPath: /frr-isisd:isis/instance
63 int isis_instance_create(struct nb_cb_create_args
*args
)
65 struct isis_area
*area
;
69 if (args
->event
!= NB_EV_APPLY
)
71 vrf_name
= yang_dnode_get_string(args
->dnode
, "./vrf");
72 area_tag
= yang_dnode_get_string(args
->dnode
, "./area-tag");
74 area
= isis_area_lookup_by_vrf(area_tag
, vrf_name
);
76 return NB_ERR_INCONSISTENCY
;
78 area
= isis_area_create(area_tag
, vrf_name
);
80 /* save area in dnode to avoid looking it up all the time */
81 nb_running_set_entry(args
->dnode
, area
);
86 int isis_instance_destroy(struct nb_cb_destroy_args
*args
)
88 struct isis_area
*area
;
90 if (args
->event
!= NB_EV_APPLY
)
92 area
= nb_running_unset_entry(args
->dnode
);
94 isis_area_destroy(area
);
99 * XPath: /frr-isisd:isis/instance/is-type
101 int isis_instance_is_type_modify(struct nb_cb_modify_args
*args
)
103 struct isis_area
*area
;
106 if (args
->event
!= NB_EV_APPLY
)
109 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
110 type
= yang_dnode_get_enum(args
->dnode
, NULL
);
111 isis_area_is_type_set(area
, type
);
117 struct area_addr
*addr
;
121 static int sysid_iter_cb(const struct lyd_node
*dnode
, void *arg
)
123 struct sysid_iter
*iter
= arg
;
124 struct area_addr addr
;
127 net
= yang_dnode_get_string(dnode
, NULL
);
128 addr
.addr_len
= dotformat2buff(addr
.area_addr
, net
);
130 if (memcmp(GETSYSID(iter
->addr
), GETSYSID((&addr
)), ISIS_SYS_ID_LEN
)) {
132 return YANG_ITER_STOP
;
135 return YANG_ITER_CONTINUE
;
139 * XPath: /frr-isisd:isis/instance/area-address
141 int isis_instance_area_address_create(struct nb_cb_create_args
*args
)
143 struct isis_area
*area
;
144 struct area_addr addr
, *addrr
= NULL
, *addrp
= NULL
;
145 struct listnode
*node
;
146 struct sysid_iter iter
;
148 const char *net_title
= yang_dnode_get_string(args
->dnode
, NULL
);
150 switch (args
->event
) {
152 addr
.addr_len
= dotformat2buff(buff
, net_title
);
153 memcpy(addr
.area_addr
, buff
, addr
.addr_len
);
154 if (addr
.area_addr
[addr
.addr_len
- 1] != 0) {
156 args
->errmsg
, args
->errmsg_len
,
157 "nsel byte (last byte) in area address must be 0");
158 return NB_ERR_VALIDATION
;
164 yang_dnode_iterate(sysid_iter_cb
, &iter
, args
->dnode
,
169 args
->errmsg
, args
->errmsg_len
,
170 "System ID must not change when defining additional area addresses");
171 return NB_ERR_VALIDATION
;
175 addrr
= XMALLOC(MTYPE_ISIS_AREA_ADDR
, sizeof(struct area_addr
));
176 addrr
->addr_len
= dotformat2buff(buff
, net_title
);
177 memcpy(addrr
->area_addr
, buff
, addrr
->addr_len
);
178 args
->resource
->ptr
= addrr
;
181 XFREE(MTYPE_ISIS_AREA_ADDR
, args
->resource
->ptr
);
184 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
185 addrr
= args
->resource
->ptr
;
188 if (area
->isis
->sysid_set
== 0) {
190 * First area address - get the SystemID for this router
192 memcpy(area
->isis
->sysid
, GETSYSID(addrr
),
194 area
->isis
->sysid_set
= 1;
196 /* check that we don't already have this address */
197 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
,
199 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
201 != (addrr
->addr_len
))
203 if (!memcmp(addrp
->area_addr
, addrr
->area_addr
,
205 XFREE(MTYPE_ISIS_AREA_ADDR
, addrr
);
206 return NB_OK
; /* silent fail */
211 /*Forget the systemID part of the address */
212 addrr
->addr_len
-= (ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
);
213 assert(area
->area_addrs
); /* to silence scan-build sillyness */
214 listnode_add(area
->area_addrs
, addrr
);
216 /* only now we can safely generate our LSPs for this area */
217 if (listcount(area
->area_addrs
) > 0) {
218 if (area
->is_type
& IS_LEVEL_1
)
219 lsp_generate(area
, IS_LEVEL_1
);
220 if (area
->is_type
& IS_LEVEL_2
)
221 lsp_generate(area
, IS_LEVEL_2
);
229 int isis_instance_area_address_destroy(struct nb_cb_destroy_args
*args
)
231 struct area_addr addr
, *addrp
= NULL
;
232 struct listnode
*node
;
234 struct isis_area
*area
;
235 const char *net_title
;
236 struct listnode
*cnode
;
237 struct isis_circuit
*circuit
;
240 if (args
->event
!= NB_EV_APPLY
)
243 net_title
= yang_dnode_get_string(args
->dnode
, NULL
);
244 addr
.addr_len
= dotformat2buff(buff
, net_title
);
245 memcpy(addr
.area_addr
, buff
, (int)addr
.addr_len
);
246 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
248 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
)) {
249 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ 1) == addr
.addr_len
250 && !memcmp(addrp
->area_addr
, addr
.area_addr
, addr
.addr_len
))
254 return NB_ERR_INCONSISTENCY
;
256 listnode_delete(area
->area_addrs
, addrp
);
257 XFREE(MTYPE_ISIS_AREA_ADDR
, addrp
);
259 * Last area address - reset the SystemID for this router
261 if (listcount(area
->area_addrs
) == 0) {
262 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
))
263 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
264 if (circuit
->u
.bc
.is_dr
[lvl
- 1])
265 isis_dr_resign(circuit
, lvl
);
267 memset(area
->isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
268 area
->isis
->sysid_set
= 0;
270 zlog_debug("Router has no SystemID");
277 * XPath: /frr-isisd:isis/instance/dynamic-hostname
279 int isis_instance_dynamic_hostname_modify(struct nb_cb_modify_args
*args
)
281 struct isis_area
*area
;
283 if (args
->event
!= NB_EV_APPLY
)
286 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
287 isis_area_dynhostname_set(area
, yang_dnode_get_bool(args
->dnode
, NULL
));
293 * XPath: /frr-isisd:isis/instance/attach-send
295 int isis_instance_attached_send_modify(struct nb_cb_modify_args
*args
)
297 struct isis_area
*area
;
300 if (args
->event
!= NB_EV_APPLY
)
303 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
304 attached
= yang_dnode_get_bool(args
->dnode
, NULL
);
305 isis_area_attached_bit_send_set(area
, attached
);
311 * XPath: /frr-isisd:isis/instance/attach-receive-ignore
313 int isis_instance_attached_receive_modify(struct nb_cb_modify_args
*args
)
315 struct isis_area
*area
;
318 if (args
->event
!= NB_EV_APPLY
)
321 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
322 attached
= yang_dnode_get_bool(args
->dnode
, NULL
);
323 isis_area_attached_bit_receive_set(area
, attached
);
329 * XPath: /frr-isisd:isis/instance/attached
331 int isis_instance_attached_modify(struct nb_cb_modify_args
*args
)
337 * XPath: /frr-isisd:isis/instance/overload
339 int isis_instance_overload_modify(struct nb_cb_modify_args
*args
)
341 struct isis_area
*area
;
344 if (args
->event
!= NB_EV_APPLY
)
347 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
348 overload
= yang_dnode_get_bool(args
->dnode
, NULL
);
349 isis_area_overload_bit_set(area
, overload
);
355 * XPath: /frr-isisd:isis/instance/metric-style
357 int isis_instance_metric_style_modify(struct nb_cb_modify_args
*args
)
359 struct isis_area
*area
;
360 bool old_metric
, new_metric
;
361 enum isis_metric_style metric_style
=
362 yang_dnode_get_enum(args
->dnode
, NULL
);
364 if (args
->event
!= NB_EV_APPLY
)
367 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
368 old_metric
= (metric_style
== ISIS_WIDE_METRIC
) ? false : true;
369 new_metric
= (metric_style
== ISIS_NARROW_METRIC
) ? false : true;
370 isis_area_metricstyle_set(area
, old_metric
, new_metric
);
376 * XPath: /frr-isisd:isis/instance/purge-originator
378 int isis_instance_purge_originator_modify(struct nb_cb_modify_args
*args
)
380 struct isis_area
*area
;
382 if (args
->event
!= NB_EV_APPLY
)
385 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
386 area
->purge_originator
= yang_dnode_get_bool(args
->dnode
, NULL
);
392 * XPath: /frr-isisd:isis/instance/lsp/mtu
394 int isis_instance_lsp_mtu_modify(struct nb_cb_modify_args
*args
)
396 uint16_t lsp_mtu
= yang_dnode_get_uint16(args
->dnode
, NULL
);
397 struct isis_area
*area
;
399 switch (args
->event
) {
405 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
406 isis_area_lsp_mtu_set(area
, lsp_mtu
);
414 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/refresh-interval
416 int isis_instance_lsp_refresh_interval_level_1_modify(
417 struct nb_cb_modify_args
*args
)
419 struct isis_area
*area
;
422 if (args
->event
!= NB_EV_APPLY
)
425 refr_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
426 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
427 isis_area_lsp_refresh_set(area
, IS_LEVEL_1
, refr_int
);
433 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/refresh-interval
435 int isis_instance_lsp_refresh_interval_level_2_modify(
436 struct nb_cb_modify_args
*args
)
438 struct isis_area
*area
;
441 if (args
->event
!= NB_EV_APPLY
)
444 refr_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
445 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
446 isis_area_lsp_refresh_set(area
, IS_LEVEL_2
, refr_int
);
452 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/maximum-lifetime
454 int isis_instance_lsp_maximum_lifetime_level_1_modify(
455 struct nb_cb_modify_args
*args
)
457 struct isis_area
*area
;
460 if (args
->event
!= NB_EV_APPLY
)
463 max_lt
= yang_dnode_get_uint16(args
->dnode
, NULL
);
464 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
465 isis_area_max_lsp_lifetime_set(area
, IS_LEVEL_1
, max_lt
);
471 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/maximum-lifetime
473 int isis_instance_lsp_maximum_lifetime_level_2_modify(
474 struct nb_cb_modify_args
*args
)
476 struct isis_area
*area
;
479 if (args
->event
!= NB_EV_APPLY
)
482 max_lt
= yang_dnode_get_uint16(args
->dnode
, NULL
);
483 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
484 isis_area_max_lsp_lifetime_set(area
, IS_LEVEL_2
, max_lt
);
490 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/generation-interval
492 int isis_instance_lsp_generation_interval_level_1_modify(
493 struct nb_cb_modify_args
*args
)
495 struct isis_area
*area
;
498 if (args
->event
!= NB_EV_APPLY
)
501 gen_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
502 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
503 area
->lsp_gen_interval
[0] = gen_int
;
509 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/generation-interval
511 int isis_instance_lsp_generation_interval_level_2_modify(
512 struct nb_cb_modify_args
*args
)
514 struct isis_area
*area
;
517 if (args
->event
!= NB_EV_APPLY
)
520 gen_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
521 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
522 area
->lsp_gen_interval
[1] = gen_int
;
528 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay
530 void ietf_backoff_delay_apply_finish(struct nb_cb_apply_finish_args
*args
)
532 long init_delay
= yang_dnode_get_uint16(args
->dnode
, "./init-delay");
533 long short_delay
= yang_dnode_get_uint16(args
->dnode
, "./short-delay");
534 long long_delay
= yang_dnode_get_uint16(args
->dnode
, "./long-delay");
535 long holddown
= yang_dnode_get_uint16(args
->dnode
, "./hold-down");
537 yang_dnode_get_uint16(args
->dnode
, "./time-to-learn");
538 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
539 size_t bufsiz
= strlen(area
->area_tag
) + sizeof("IS-IS Lx");
540 char *buf
= XCALLOC(MTYPE_TMP
, bufsiz
);
542 snprintf(buf
, bufsiz
, "IS-IS %s L1", area
->area_tag
);
543 spf_backoff_free(area
->spf_delay_ietf
[0]);
544 area
->spf_delay_ietf
[0] =
545 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
546 long_delay
, holddown
, timetolearn
);
548 snprintf(buf
, bufsiz
, "IS-IS %s L2", area
->area_tag
);
549 spf_backoff_free(area
->spf_delay_ietf
[1]);
550 area
->spf_delay_ietf
[1] =
551 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
552 long_delay
, holddown
, timetolearn
);
554 XFREE(MTYPE_TMP
, buf
);
557 int isis_instance_spf_ietf_backoff_delay_create(struct nb_cb_create_args
*args
)
559 /* All the work is done in the apply_finish */
563 int isis_instance_spf_ietf_backoff_delay_destroy(
564 struct nb_cb_destroy_args
*args
)
566 struct isis_area
*area
;
568 if (args
->event
!= NB_EV_APPLY
)
571 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
572 spf_backoff_free(area
->spf_delay_ietf
[0]);
573 spf_backoff_free(area
->spf_delay_ietf
[1]);
574 area
->spf_delay_ietf
[0] = NULL
;
575 area
->spf_delay_ietf
[1] = NULL
;
581 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/init-delay
583 int isis_instance_spf_ietf_backoff_delay_init_delay_modify(
584 struct nb_cb_modify_args
*args
)
586 /* All the work is done in the apply_finish */
591 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/short-delay
593 int isis_instance_spf_ietf_backoff_delay_short_delay_modify(
594 struct nb_cb_modify_args
*args
)
596 /* All the work is done in the apply_finish */
601 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/long-delay
603 int isis_instance_spf_ietf_backoff_delay_long_delay_modify(
604 struct nb_cb_modify_args
*args
)
606 /* All the work is done in the apply_finish */
611 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/hold-down
613 int isis_instance_spf_ietf_backoff_delay_hold_down_modify(
614 struct nb_cb_modify_args
*args
)
616 /* All the work is done in the apply_finish */
621 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/time-to-learn
623 int isis_instance_spf_ietf_backoff_delay_time_to_learn_modify(
624 struct nb_cb_modify_args
*args
)
626 /* All the work is done in the apply_finish */
631 * XPath: /frr-isisd:isis/instance/spf/minimum-interval/level-1
633 int isis_instance_spf_minimum_interval_level_1_modify(
634 struct nb_cb_modify_args
*args
)
636 struct isis_area
*area
;
638 if (args
->event
!= NB_EV_APPLY
)
641 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
642 area
->min_spf_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
648 * XPath: /frr-isisd:isis/instance/spf/minimum-interval/level-2
650 int isis_instance_spf_minimum_interval_level_2_modify(
651 struct nb_cb_modify_args
*args
)
653 struct isis_area
*area
;
655 if (args
->event
!= NB_EV_APPLY
)
658 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
659 area
->min_spf_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
666 * /frr-isisd:isis/instance/spf/prefix-priorities/critical/access-list-name
668 int isis_instance_spf_prefix_priorities_critical_access_list_name_modify(
669 struct nb_cb_modify_args
*args
)
671 struct isis_area
*area
;
672 const char *acl_name
;
673 struct spf_prefix_priority_acl
*ppa
;
675 if (args
->event
!= NB_EV_APPLY
)
678 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
679 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
681 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_CRITICAL
];
682 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
683 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
684 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
685 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
686 lsp_regenerate_schedule(area
, area
->is_type
, 0);
691 int isis_instance_spf_prefix_priorities_critical_access_list_name_destroy(
692 struct nb_cb_destroy_args
*args
)
694 struct isis_area
*area
;
695 struct spf_prefix_priority_acl
*ppa
;
697 if (args
->event
!= NB_EV_APPLY
)
700 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
702 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_CRITICAL
];
703 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
706 lsp_regenerate_schedule(area
, area
->is_type
, 0);
712 * XPath: /frr-isisd:isis/instance/spf/prefix-priorities/high/access-list-name
714 int isis_instance_spf_prefix_priorities_high_access_list_name_modify(
715 struct nb_cb_modify_args
*args
)
717 struct isis_area
*area
;
718 const char *acl_name
;
719 struct spf_prefix_priority_acl
*ppa
;
721 if (args
->event
!= NB_EV_APPLY
)
724 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
725 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
727 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_HIGH
];
728 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
729 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
730 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
731 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
732 lsp_regenerate_schedule(area
, area
->is_type
, 0);
737 int isis_instance_spf_prefix_priorities_high_access_list_name_destroy(
738 struct nb_cb_destroy_args
*args
)
740 struct isis_area
*area
;
741 struct spf_prefix_priority_acl
*ppa
;
743 if (args
->event
!= NB_EV_APPLY
)
746 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
748 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_HIGH
];
749 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
752 lsp_regenerate_schedule(area
, area
->is_type
, 0);
758 * XPath: /frr-isisd:isis/instance/spf/prefix-priorities/medium/access-list-name
760 int isis_instance_spf_prefix_priorities_medium_access_list_name_modify(
761 struct nb_cb_modify_args
*args
)
763 struct isis_area
*area
;
764 const char *acl_name
;
765 struct spf_prefix_priority_acl
*ppa
;
767 if (args
->event
!= NB_EV_APPLY
)
770 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
771 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
773 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_MEDIUM
];
774 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
775 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
776 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
777 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
778 lsp_regenerate_schedule(area
, area
->is_type
, 0);
783 int isis_instance_spf_prefix_priorities_medium_access_list_name_destroy(
784 struct nb_cb_destroy_args
*args
)
786 struct isis_area
*area
;
787 struct spf_prefix_priority_acl
*ppa
;
789 if (args
->event
!= NB_EV_APPLY
)
792 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
794 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_MEDIUM
];
795 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
798 lsp_regenerate_schedule(area
, area
->is_type
, 0);
804 * XPath: /frr-isisd:isis/instance/area-password
806 void area_password_apply_finish(struct nb_cb_apply_finish_args
*args
)
808 const char *password
= yang_dnode_get_string(args
->dnode
, "./password");
809 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
810 int pass_type
= yang_dnode_get_enum(args
->dnode
, "./password-type");
812 yang_dnode_get_enum(args
->dnode
, "./authenticate-snp");
815 case ISIS_PASSWD_TYPE_CLEARTXT
:
816 isis_area_passwd_cleartext_set(area
, IS_LEVEL_1
, password
,
819 case ISIS_PASSWD_TYPE_HMAC_MD5
:
820 isis_area_passwd_hmac_md5_set(area
, IS_LEVEL_1
, password
,
826 int isis_instance_area_password_create(struct nb_cb_create_args
*args
)
828 /* actual setting is done in apply_finish */
832 int isis_instance_area_password_destroy(struct nb_cb_destroy_args
*args
)
834 struct isis_area
*area
;
836 if (args
->event
!= NB_EV_APPLY
)
839 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
840 isis_area_passwd_unset(area
, IS_LEVEL_1
);
846 * XPath: /frr-isisd:isis/instance/area-password/password
848 int isis_instance_area_password_password_modify(struct nb_cb_modify_args
*args
)
850 /* actual setting is done in apply_finish */
855 * XPath: /frr-isisd:isis/instance/area-password/password-type
857 int isis_instance_area_password_password_type_modify(
858 struct nb_cb_modify_args
*args
)
860 /* actual setting is done in apply_finish */
865 * XPath: /frr-isisd:isis/instance/area-password/authenticate-snp
867 int isis_instance_area_password_authenticate_snp_modify(
868 struct nb_cb_modify_args
*args
)
870 /* actual setting is done in apply_finish */
875 * XPath: /frr-isisd:isis/instance/domain-password
877 void domain_password_apply_finish(struct nb_cb_apply_finish_args
*args
)
879 const char *password
= yang_dnode_get_string(args
->dnode
, "./password");
880 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
881 int pass_type
= yang_dnode_get_enum(args
->dnode
, "./password-type");
883 yang_dnode_get_enum(args
->dnode
, "./authenticate-snp");
886 case ISIS_PASSWD_TYPE_CLEARTXT
:
887 isis_area_passwd_cleartext_set(area
, IS_LEVEL_2
, password
,
890 case ISIS_PASSWD_TYPE_HMAC_MD5
:
891 isis_area_passwd_hmac_md5_set(area
, IS_LEVEL_2
, password
,
897 int isis_instance_domain_password_create(struct nb_cb_create_args
*args
)
899 /* actual setting is done in apply_finish */
903 int isis_instance_domain_password_destroy(struct nb_cb_destroy_args
*args
)
905 struct isis_area
*area
;
907 if (args
->event
!= NB_EV_APPLY
)
910 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
911 isis_area_passwd_unset(area
, IS_LEVEL_2
);
917 * XPath: /frr-isisd:isis/instance/domain-password/password
919 int isis_instance_domain_password_password_modify(
920 struct nb_cb_modify_args
*args
)
922 /* actual setting is done in apply_finish */
927 * XPath: /frr-isisd:isis/instance/domain-password/password-type
929 int isis_instance_domain_password_password_type_modify(
930 struct nb_cb_modify_args
*args
)
932 /* actual setting is done in apply_finish */
937 * XPath: /frr-isisd:isis/instance/domain-password/authenticate-snp
939 int isis_instance_domain_password_authenticate_snp_modify(
940 struct nb_cb_modify_args
*args
)
942 /* actual setting is done in apply_finish */
947 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4
949 void default_info_origin_apply_finish(const struct lyd_node
*dnode
, int family
)
951 int originate_type
= DEFAULT_ORIGINATE
;
952 unsigned long metric
= 0;
953 const char *routemap
= NULL
;
954 struct isis_area
*area
= nb_running_get_entry(dnode
, NULL
, true);
955 int level
= yang_dnode_get_enum(dnode
, "./level");
957 if (yang_dnode_get_bool(dnode
, "./always")) {
958 originate_type
= DEFAULT_ORIGINATE_ALWAYS
;
959 } else if (family
== AF_INET6
) {
961 "%s: Zebra doesn't implement default-originate for IPv6 yet, so use with care or use default-originate always.",
965 if (yang_dnode_exists(dnode
, "./metric"))
966 metric
= yang_dnode_get_uint32(dnode
, "./metric");
967 if (yang_dnode_exists(dnode
, "./route-map"))
968 routemap
= yang_dnode_get_string(dnode
, "./route-map");
970 isis_redist_set(area
, level
, family
, DEFAULT_ROUTE
, metric
, routemap
,
974 void default_info_origin_ipv4_apply_finish(struct nb_cb_apply_finish_args
*args
)
976 default_info_origin_apply_finish(args
->dnode
, AF_INET
);
979 void default_info_origin_ipv6_apply_finish(struct nb_cb_apply_finish_args
*args
)
981 default_info_origin_apply_finish(args
->dnode
, AF_INET6
);
984 int isis_instance_default_information_originate_ipv4_create(
985 struct nb_cb_create_args
*args
)
987 /* It's all done by default_info_origin_apply_finish */
991 int isis_instance_default_information_originate_ipv4_destroy(
992 struct nb_cb_destroy_args
*args
)
994 struct isis_area
*area
;
997 if (args
->event
!= NB_EV_APPLY
)
1000 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1001 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1002 isis_redist_unset(area
, level
, AF_INET
, DEFAULT_ROUTE
);
1008 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/always
1010 int isis_instance_default_information_originate_ipv4_always_modify(
1011 struct nb_cb_modify_args
*args
)
1013 /* It's all done by default_info_origin_apply_finish */
1018 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/route-map
1020 int isis_instance_default_information_originate_ipv4_route_map_modify(
1021 struct nb_cb_modify_args
*args
)
1023 /* It's all done by default_info_origin_apply_finish */
1027 int isis_instance_default_information_originate_ipv4_route_map_destroy(
1028 struct nb_cb_destroy_args
*args
)
1030 /* It's all done by default_info_origin_apply_finish */
1035 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/metric
1037 int isis_instance_default_information_originate_ipv4_metric_modify(
1038 struct nb_cb_modify_args
*args
)
1040 /* It's all done by default_info_origin_apply_finish */
1045 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6
1047 int isis_instance_default_information_originate_ipv6_create(
1048 struct nb_cb_create_args
*args
)
1050 /* It's all done by default_info_origin_apply_finish */
1054 int isis_instance_default_information_originate_ipv6_destroy(
1055 struct nb_cb_destroy_args
*args
)
1057 struct isis_area
*area
;
1060 if (args
->event
!= NB_EV_APPLY
)
1063 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1064 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1065 isis_redist_unset(area
, level
, AF_INET6
, DEFAULT_ROUTE
);
1071 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/always
1073 int isis_instance_default_information_originate_ipv6_always_modify(
1074 struct nb_cb_modify_args
*args
)
1076 /* It's all done by default_info_origin_apply_finish */
1081 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/route-map
1083 int isis_instance_default_information_originate_ipv6_route_map_modify(
1084 struct nb_cb_modify_args
*args
)
1086 /* It's all done by default_info_origin_apply_finish */
1090 int isis_instance_default_information_originate_ipv6_route_map_destroy(
1091 struct nb_cb_destroy_args
*args
)
1093 /* It's all done by default_info_origin_apply_finish */
1098 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/metric
1100 int isis_instance_default_information_originate_ipv6_metric_modify(
1101 struct nb_cb_modify_args
*args
)
1103 /* It's all done by default_info_origin_apply_finish */
1108 * XPath: /frr-isisd:isis/instance/redistribute/ipv4
1110 void redistribute_apply_finish(const struct lyd_node
*dnode
, int family
)
1112 assert(family
== AF_INET
|| family
== AF_INET6
);
1114 unsigned long metric
= 0;
1115 const char *routemap
= NULL
;
1116 struct isis_area
*area
;
1118 type
= yang_dnode_get_enum(dnode
, "./protocol");
1119 level
= yang_dnode_get_enum(dnode
, "./level");
1120 area
= nb_running_get_entry(dnode
, NULL
, true);
1122 if (yang_dnode_exists(dnode
, "./metric"))
1123 metric
= yang_dnode_get_uint32(dnode
, "./metric");
1124 if (yang_dnode_exists(dnode
, "./route-map"))
1125 routemap
= yang_dnode_get_string(dnode
, "./route-map");
1127 isis_redist_set(area
, level
, family
, type
, metric
, routemap
, 0);
1130 void redistribute_ipv4_apply_finish(struct nb_cb_apply_finish_args
*args
)
1132 redistribute_apply_finish(args
->dnode
, AF_INET
);
1135 void redistribute_ipv6_apply_finish(struct nb_cb_apply_finish_args
*args
)
1137 redistribute_apply_finish(args
->dnode
, AF_INET6
);
1140 int isis_instance_redistribute_ipv4_create(struct nb_cb_create_args
*args
)
1142 /* It's all done by redistribute_apply_finish */
1146 int isis_instance_redistribute_ipv4_destroy(struct nb_cb_destroy_args
*args
)
1148 struct isis_area
*area
;
1151 if (args
->event
!= NB_EV_APPLY
)
1154 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1155 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1156 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
1157 isis_redist_unset(area
, level
, AF_INET
, type
);
1163 * XPath: /frr-isisd:isis/instance/redistribute/ipv4/route-map
1165 int isis_instance_redistribute_ipv4_route_map_modify(
1166 struct nb_cb_modify_args
*args
)
1168 /* It's all done by redistribute_apply_finish */
1172 int isis_instance_redistribute_ipv4_route_map_destroy(
1173 struct nb_cb_destroy_args
*args
)
1175 /* It's all done by redistribute_apply_finish */
1180 * XPath: /frr-isisd:isis/instance/redistribute/ipv4/metric
1182 int isis_instance_redistribute_ipv4_metric_modify(
1183 struct nb_cb_modify_args
*args
)
1185 /* It's all done by redistribute_apply_finish */
1190 * XPath: /frr-isisd:isis/instance/redistribute/ipv6
1192 int isis_instance_redistribute_ipv6_create(struct nb_cb_create_args
*args
)
1194 /* It's all done by redistribute_apply_finish */
1198 int isis_instance_redistribute_ipv6_destroy(struct nb_cb_destroy_args
*args
)
1200 struct isis_area
*area
;
1203 if (args
->event
!= NB_EV_APPLY
)
1206 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1207 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1208 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
1209 isis_redist_unset(area
, level
, AF_INET6
, type
);
1215 * XPath: /frr-isisd:isis/instance/redistribute/ipv6/route-map
1217 int isis_instance_redistribute_ipv6_route_map_modify(
1218 struct nb_cb_modify_args
*args
)
1220 /* It's all done by redistribute_apply_finish */
1224 int isis_instance_redistribute_ipv6_route_map_destroy(
1225 struct nb_cb_destroy_args
*args
)
1227 /* It's all done by redistribute_apply_finish */
1232 * XPath: /frr-isisd:isis/instance/redistribute/ipv6/metric
1234 int isis_instance_redistribute_ipv6_metric_modify(
1235 struct nb_cb_modify_args
*args
)
1237 /* It's all done by redistribute_apply_finish */
1242 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-multicast
1244 static int isis_multi_topology_common(enum nb_event event
,
1245 const struct lyd_node
*dnode
,
1246 char *errmsg
, size_t errmsg_len
,
1247 const char *topology
, bool create
)
1249 struct isis_area
*area
;
1250 struct isis_area_mt_setting
*setting
;
1251 uint16_t mtid
= isis_str2mtid(topology
);
1254 case NB_EV_VALIDATE
:
1255 if (mtid
== (uint16_t)-1) {
1256 snprintf(errmsg
, errmsg_len
, "Unknown topology %s",
1258 return NB_ERR_VALIDATION
;
1265 area
= nb_running_get_entry(dnode
, NULL
, true);
1266 setting
= area_get_mt_setting(area
, mtid
);
1267 setting
->enabled
= create
;
1268 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1275 static int isis_multi_topology_overload_common(enum nb_event event
,
1276 const struct lyd_node
*dnode
,
1277 const char *topology
)
1279 struct isis_area
*area
;
1280 struct isis_area_mt_setting
*setting
;
1281 uint16_t mtid
= isis_str2mtid(topology
);
1283 /* validation is done in isis_multi_topology_common */
1284 if (event
!= NB_EV_APPLY
)
1287 area
= nb_running_get_entry(dnode
, NULL
, true);
1288 setting
= area_get_mt_setting(area
, mtid
);
1289 setting
->overload
= yang_dnode_get_bool(dnode
, NULL
);
1290 if (setting
->enabled
)
1291 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1296 int isis_instance_multi_topology_ipv4_multicast_create(
1297 struct nb_cb_create_args
*args
)
1299 return isis_multi_topology_common(args
->event
, args
->dnode
,
1300 args
->errmsg
, args
->errmsg_len
,
1301 "ipv4-multicast", true);
1304 int isis_instance_multi_topology_ipv4_multicast_destroy(
1305 struct nb_cb_destroy_args
*args
)
1307 return isis_multi_topology_common(args
->event
, args
->dnode
,
1308 args
->errmsg
, args
->errmsg_len
,
1309 "ipv4-multicast", false);
1313 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-multicast/overload
1315 int isis_instance_multi_topology_ipv4_multicast_overload_modify(
1316 struct nb_cb_modify_args
*args
)
1318 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1323 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-management
1325 int isis_instance_multi_topology_ipv4_management_create(
1326 struct nb_cb_create_args
*args
)
1328 return isis_multi_topology_common(args
->event
, args
->dnode
,
1329 args
->errmsg
, args
->errmsg_len
,
1333 int isis_instance_multi_topology_ipv4_management_destroy(
1334 struct nb_cb_destroy_args
*args
)
1336 return isis_multi_topology_common(args
->event
, args
->dnode
,
1337 args
->errmsg
, args
->errmsg_len
,
1338 "ipv4-mgmt", false);
1342 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-management/overload
1344 int isis_instance_multi_topology_ipv4_management_overload_modify(
1345 struct nb_cb_modify_args
*args
)
1347 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1352 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-unicast
1354 int isis_instance_multi_topology_ipv6_unicast_create(
1355 struct nb_cb_create_args
*args
)
1357 return isis_multi_topology_common(args
->event
, args
->dnode
,
1358 args
->errmsg
, args
->errmsg_len
,
1359 "ipv6-unicast", true);
1362 int isis_instance_multi_topology_ipv6_unicast_destroy(
1363 struct nb_cb_destroy_args
*args
)
1365 return isis_multi_topology_common(args
->event
, args
->dnode
,
1366 args
->errmsg
, args
->errmsg_len
,
1367 "ipv6-unicast", false);
1371 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-unicast/overload
1373 int isis_instance_multi_topology_ipv6_unicast_overload_modify(
1374 struct nb_cb_modify_args
*args
)
1376 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1381 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-multicast
1383 int isis_instance_multi_topology_ipv6_multicast_create(
1384 struct nb_cb_create_args
*args
)
1386 return isis_multi_topology_common(args
->event
, args
->dnode
,
1387 args
->errmsg
, args
->errmsg_len
,
1388 "ipv6-multicast", true);
1391 int isis_instance_multi_topology_ipv6_multicast_destroy(
1392 struct nb_cb_destroy_args
*args
)
1394 return isis_multi_topology_common(args
->event
, args
->dnode
,
1395 args
->errmsg
, args
->errmsg_len
,
1396 "ipv6-multicast", false);
1400 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-multicast/overload
1402 int isis_instance_multi_topology_ipv6_multicast_overload_modify(
1403 struct nb_cb_modify_args
*args
)
1405 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1410 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-management
1412 int isis_instance_multi_topology_ipv6_management_create(
1413 struct nb_cb_create_args
*args
)
1415 return isis_multi_topology_common(args
->event
, args
->dnode
,
1416 args
->errmsg
, args
->errmsg_len
,
1420 int isis_instance_multi_topology_ipv6_management_destroy(
1421 struct nb_cb_destroy_args
*args
)
1423 return isis_multi_topology_common(args
->event
, args
->dnode
,
1424 args
->errmsg
, args
->errmsg_len
,
1425 "ipv6-mgmt", false);
1429 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-management/overload
1431 int isis_instance_multi_topology_ipv6_management_overload_modify(
1432 struct nb_cb_modify_args
*args
)
1434 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1439 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-dstsrc
1441 int isis_instance_multi_topology_ipv6_dstsrc_create(
1442 struct nb_cb_create_args
*args
)
1444 return isis_multi_topology_common(args
->event
, args
->dnode
,
1445 args
->errmsg
, args
->errmsg_len
,
1446 "ipv6-dstsrc", true);
1449 int isis_instance_multi_topology_ipv6_dstsrc_destroy(
1450 struct nb_cb_destroy_args
*args
)
1452 return isis_multi_topology_common(args
->event
, args
->dnode
,
1453 args
->errmsg
, args
->errmsg_len
,
1454 "ipv6-dstsrc", false);
1458 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-dstsrc/overload
1460 int isis_instance_multi_topology_ipv6_dstsrc_overload_modify(
1461 struct nb_cb_modify_args
*args
)
1463 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1468 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/load-sharing
1470 int isis_instance_fast_reroute_level_1_lfa_load_sharing_modify(
1471 struct nb_cb_modify_args
*args
)
1473 struct isis_area
*area
;
1475 if (args
->event
!= NB_EV_APPLY
)
1478 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1479 area
->lfa_load_sharing
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
1480 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1486 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/priority-limit
1488 int isis_instance_fast_reroute_level_1_lfa_priority_limit_modify(
1489 struct nb_cb_modify_args
*args
)
1491 struct isis_area
*area
;
1493 if (args
->event
!= NB_EV_APPLY
)
1496 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1497 area
->lfa_priority_limit
[0] = yang_dnode_get_enum(args
->dnode
, NULL
);
1498 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1503 int isis_instance_fast_reroute_level_1_lfa_priority_limit_destroy(
1504 struct nb_cb_destroy_args
*args
)
1506 struct isis_area
*area
;
1508 if (args
->event
!= NB_EV_APPLY
)
1511 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1512 area
->lfa_priority_limit
[0] = SPF_PREFIX_PRIO_LOW
;
1513 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1519 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/tiebreaker
1521 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_create(
1522 struct nb_cb_create_args
*args
)
1524 struct isis_area
*area
;
1526 enum lfa_tiebreaker_type type
;
1527 struct lfa_tiebreaker
*tie_b
;
1529 if (args
->event
!= NB_EV_APPLY
)
1532 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1533 index
= yang_dnode_get_uint8(args
->dnode
, "./index");
1534 type
= yang_dnode_get_enum(args
->dnode
, "./type");
1536 tie_b
= isis_lfa_tiebreaker_add(area
, ISIS_LEVEL1
, index
, type
);
1537 nb_running_set_entry(args
->dnode
, tie_b
);
1538 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1543 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_destroy(
1544 struct nb_cb_destroy_args
*args
)
1546 struct lfa_tiebreaker
*tie_b
;
1547 struct isis_area
*area
;
1549 if (args
->event
!= NB_EV_APPLY
)
1552 tie_b
= nb_running_unset_entry(args
->dnode
);
1554 isis_lfa_tiebreaker_delete(area
, ISIS_LEVEL1
, tie_b
);
1555 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1561 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/tiebreaker/type
1563 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_type_modify(
1564 struct nb_cb_modify_args
*args
)
1566 struct lfa_tiebreaker
*tie_b
;
1567 struct isis_area
*area
;
1569 if (args
->event
!= NB_EV_APPLY
)
1572 tie_b
= nb_running_get_entry(args
->dnode
, NULL
, true);
1574 tie_b
->type
= yang_dnode_get_enum(args
->dnode
, NULL
);
1575 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1581 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/remote-lfa/prefix-list
1583 int isis_instance_fast_reroute_level_1_remote_lfa_prefix_list_modify(
1584 struct nb_cb_modify_args
*args
)
1586 struct isis_area
*area
;
1587 const char *plist_name
;
1589 if (args
->event
!= NB_EV_APPLY
)
1592 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1593 plist_name
= yang_dnode_get_string(args
->dnode
, NULL
);
1595 area
->rlfa_plist_name
[0] = XSTRDUP(MTYPE_ISIS_PLIST_NAME
, plist_name
);
1596 area
->rlfa_plist
[0] = prefix_list_lookup(AFI_IP
, plist_name
);
1597 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1602 int isis_instance_fast_reroute_level_1_remote_lfa_prefix_list_destroy(
1603 struct nb_cb_destroy_args
*args
)
1605 struct isis_area
*area
;
1607 if (args
->event
!= NB_EV_APPLY
)
1610 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1612 XFREE(MTYPE_ISIS_PLIST_NAME
, area
->rlfa_plist_name
[0]);
1613 area
->rlfa_plist
[0] = NULL
;
1614 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1620 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/load-sharing
1622 int isis_instance_fast_reroute_level_2_lfa_load_sharing_modify(
1623 struct nb_cb_modify_args
*args
)
1625 struct isis_area
*area
;
1627 if (args
->event
!= NB_EV_APPLY
)
1630 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1631 area
->lfa_load_sharing
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
1637 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/priority-limit
1639 int isis_instance_fast_reroute_level_2_lfa_priority_limit_modify(
1640 struct nb_cb_modify_args
*args
)
1642 struct isis_area
*area
;
1644 if (args
->event
!= NB_EV_APPLY
)
1647 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1648 area
->lfa_priority_limit
[1] = yang_dnode_get_enum(args
->dnode
, NULL
);
1653 int isis_instance_fast_reroute_level_2_lfa_priority_limit_destroy(
1654 struct nb_cb_destroy_args
*args
)
1656 struct isis_area
*area
;
1658 if (args
->event
!= NB_EV_APPLY
)
1661 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1662 area
->lfa_priority_limit
[1] = SPF_PREFIX_PRIO_LOW
;
1668 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/tiebreaker
1670 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_create(
1671 struct nb_cb_create_args
*args
)
1673 struct isis_area
*area
;
1675 enum lfa_tiebreaker_type type
;
1676 struct lfa_tiebreaker
*tie_b
;
1678 if (args
->event
!= NB_EV_APPLY
)
1681 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1682 index
= yang_dnode_get_uint8(args
->dnode
, "./index");
1683 type
= yang_dnode_get_enum(args
->dnode
, "./type");
1685 tie_b
= isis_lfa_tiebreaker_add(area
, ISIS_LEVEL2
, index
, type
);
1686 nb_running_set_entry(args
->dnode
, tie_b
);
1687 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1692 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_destroy(
1693 struct nb_cb_destroy_args
*args
)
1695 struct lfa_tiebreaker
*tie_b
;
1696 struct isis_area
*area
;
1698 if (args
->event
!= NB_EV_APPLY
)
1701 tie_b
= nb_running_unset_entry(args
->dnode
);
1703 isis_lfa_tiebreaker_delete(area
, ISIS_LEVEL2
, tie_b
);
1704 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1710 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/tiebreaker/type
1712 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_type_modify(
1713 struct nb_cb_modify_args
*args
)
1715 struct lfa_tiebreaker
*tie_b
;
1716 struct isis_area
*area
;
1718 if (args
->event
!= NB_EV_APPLY
)
1721 tie_b
= nb_running_get_entry(args
->dnode
, NULL
, true);
1723 tie_b
->type
= yang_dnode_get_enum(args
->dnode
, NULL
);
1724 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1730 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/remote-lfa/prefix-list
1732 int isis_instance_fast_reroute_level_2_remote_lfa_prefix_list_modify(
1733 struct nb_cb_modify_args
*args
)
1735 struct isis_area
*area
;
1736 const char *plist_name
;
1738 if (args
->event
!= NB_EV_APPLY
)
1741 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1742 plist_name
= yang_dnode_get_string(args
->dnode
, NULL
);
1744 area
->rlfa_plist_name
[1] = XSTRDUP(MTYPE_ISIS_PLIST_NAME
, plist_name
);
1745 area
->rlfa_plist
[1] = prefix_list_lookup(AFI_IP
, plist_name
);
1746 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1751 int isis_instance_fast_reroute_level_2_remote_lfa_prefix_list_destroy(
1752 struct nb_cb_destroy_args
*args
)
1754 struct isis_area
*area
;
1756 if (args
->event
!= NB_EV_APPLY
)
1759 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1761 XFREE(MTYPE_ISIS_PLIST_NAME
, area
->rlfa_plist_name
[1]);
1762 area
->rlfa_plist
[1] = NULL
;
1763 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1769 * XPath: /frr-isisd:isis/instance/log-adjacency-changes
1771 int isis_instance_log_adjacency_changes_modify(struct nb_cb_modify_args
*args
)
1773 struct isis_area
*area
;
1774 bool log
= yang_dnode_get_bool(args
->dnode
, NULL
);
1776 if (args
->event
!= NB_EV_APPLY
)
1779 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1780 area
->log_adj_changes
= log
? 1 : 0;
1786 * XPath: /frr-isisd:isis/instance/mpls-te
1788 int isis_instance_mpls_te_create(struct nb_cb_create_args
*args
)
1790 struct listnode
*node
;
1791 struct isis_area
*area
;
1792 struct isis_circuit
*circuit
;
1794 if (args
->event
!= NB_EV_APPLY
)
1797 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1798 if (area
->mta
== NULL
) {
1800 struct mpls_te_area
*new;
1802 zlog_debug("ISIS-TE(%s): Initialize MPLS Traffic Engineering",
1805 new = XCALLOC(MTYPE_ISIS_MPLS_TE
, sizeof(struct mpls_te_area
));
1807 /* Initialize MPLS_TE structure */
1808 new->status
= enable
;
1810 new->inter_as
= off
;
1811 new->interas_areaid
.s_addr
= 0;
1812 new->router_id
.s_addr
= 0;
1813 new->ted
= ls_ted_new(1, "ISIS", 0);
1815 zlog_warn("Unable to create Link State Data Base");
1819 area
->mta
->status
= enable
;
1822 /* Initialize Link State Database */
1824 isis_te_init_ted(area
);
1826 /* Update Extended TLVs according to Interface link parameters */
1827 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
))
1828 isis_link_params_update(circuit
, circuit
->interface
);
1830 /* Reoriginate STD_TE & GMPLS circuits */
1831 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1836 int isis_instance_mpls_te_destroy(struct nb_cb_destroy_args
*args
)
1838 struct listnode
*node
;
1839 struct isis_area
*area
;
1840 struct isis_circuit
*circuit
;
1842 if (args
->event
!= NB_EV_APPLY
)
1845 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1846 if (IS_MPLS_TE(area
->mta
))
1847 area
->mta
->status
= disable
;
1851 /* Remove Link State Database */
1852 ls_ted_del_all(&area
->mta
->ted
);
1854 /* Flush LSP if circuit engage */
1855 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
)) {
1856 if (!IS_EXT_TE(circuit
->ext
))
1859 /* disable MPLS_TE Circuit keeping SR one's */
1860 if (IS_SUBTLV(circuit
->ext
, EXT_ADJ_SID
))
1861 circuit
->ext
->status
= EXT_ADJ_SID
;
1862 else if (IS_SUBTLV(circuit
->ext
, EXT_LAN_ADJ_SID
))
1863 circuit
->ext
->status
= EXT_LAN_ADJ_SID
;
1865 circuit
->ext
->status
= 0;
1868 /* Reoriginate STD_TE & GMPLS circuits */
1869 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1871 zlog_debug("ISIS-TE(%s): Disabled MPLS Traffic Engineering",
1878 * XPath: /frr-isisd:isis/instance/mpls-te/router-address
1880 int isis_instance_mpls_te_router_address_modify(struct nb_cb_modify_args
*args
)
1882 struct in_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 /* Update Area Router ID */
1894 yang_dnode_get_ipv4(&value
, args
->dnode
, NULL
);
1895 area
->mta
->router_id
.s_addr
= value
.s_addr
;
1897 /* And re-schedule LSP update */
1898 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1903 int isis_instance_mpls_te_router_address_destroy(
1904 struct nb_cb_destroy_args
*args
)
1906 struct isis_area
*area
;
1908 if (args
->event
!= NB_EV_APPLY
)
1911 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1912 /* only proceed if MPLS-TE is enabled */
1913 if (!IS_MPLS_TE(area
->mta
))
1916 /* Reset Area Router ID */
1917 area
->mta
->router_id
.s_addr
= INADDR_ANY
;
1919 /* And re-schedule LSP update */
1920 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1926 * XPath: /frr-isisd:isis/instance/mpls-te/router-address-v6
1928 int isis_instance_mpls_te_router_address_ipv6_modify(
1929 struct nb_cb_modify_args
*args
)
1931 struct in6_addr value
;
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 yang_dnode_get_ipv6(&value
, args
->dnode
, NULL
);
1943 /* Update Area IPv6 Router ID if different */
1944 if (!IPV6_ADDR_SAME(&area
->mta
->router_id_ipv6
, &value
)) {
1945 IPV6_ADDR_COPY(&area
->mta
->router_id_ipv6
, &value
);
1947 /* And re-schedule LSP update */
1948 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1954 int isis_instance_mpls_te_router_address_ipv6_destroy(
1955 struct nb_cb_destroy_args
*args
)
1957 struct isis_area
*area
;
1959 if (args
->event
!= NB_EV_APPLY
)
1962 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1963 /* only proceed if MPLS-TE is enabled */
1964 if (!IS_MPLS_TE(area
->mta
))
1967 /* Reset Area Router ID */
1968 IPV6_ADDR_COPY(&area
->mta
->router_id_ipv6
, &in6addr_any
);
1970 /* And re-schedule LSP update */
1971 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1977 * XPath: /frr-isisd:isis/instance/mpls-te/export
1979 int isis_instance_mpls_te_export_modify(struct nb_cb_modify_args
*args
)
1981 struct isis_area
*area
;
1983 if (args
->event
!= NB_EV_APPLY
)
1986 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1987 /* only proceed if MPLS-TE is enabled */
1988 if (!IS_MPLS_TE(area
->mta
))
1991 area
->mta
->export
= yang_dnode_get_bool(args
->dnode
, NULL
);
1992 if (area
->mta
->export
) {
1993 if (IS_DEBUG_EVENTS
)
1994 zlog_debug("MPLS-TE: Enabled Link State export");
1995 if (isis_zebra_ls_register(true) != 0)
1996 zlog_warn("Unable to register Link State");
1998 if (IS_DEBUG_EVENTS
)
1999 zlog_debug("MPLS-TE: Disable Link State export");
2000 if (isis_zebra_ls_register(false) != 0)
2001 zlog_warn("Unable to register Link State");
2008 * XPath: /frr-isisd:isis/instance/segment-routing/enabled
2010 int isis_instance_segment_routing_enabled_modify(
2011 struct nb_cb_modify_args
*args
)
2013 struct isis_area
*area
;
2015 if (args
->event
!= NB_EV_APPLY
)
2018 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2019 area
->srdb
.config
.enabled
= yang_dnode_get_bool(args
->dnode
, NULL
);
2021 if (area
->srdb
.config
.enabled
) {
2022 if (IS_DEBUG_EVENTS
)
2023 zlog_debug("SR: Segment Routing: OFF -> ON");
2025 isis_sr_start(area
);
2027 if (IS_DEBUG_EVENTS
)
2028 zlog_debug("SR: Segment Routing: ON -> OFF");
2037 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks
2039 int isis_instance_segment_routing_label_blocks_pre_validate(
2040 struct nb_cb_pre_validate_args
*args
)
2042 uint32_t srgb_lbound
;
2043 uint32_t srgb_ubound
;
2044 uint32_t srlb_lbound
;
2045 uint32_t srlb_ubound
;
2047 srgb_lbound
= yang_dnode_get_uint32(args
->dnode
, "./srgb/lower-bound");
2048 srgb_ubound
= yang_dnode_get_uint32(args
->dnode
, "./srgb/upper-bound");
2049 srlb_lbound
= yang_dnode_get_uint32(args
->dnode
, "./srlb/lower-bound");
2050 srlb_ubound
= yang_dnode_get_uint32(args
->dnode
, "./srlb/upper-bound");
2052 /* Check that the block size does not exceed 65535 */
2053 if ((srgb_ubound
- srgb_lbound
+ 1) > 65535) {
2055 args
->errmsg
, args
->errmsg_len
,
2056 "New SR Global Block (%u/%u) exceed the limit of 65535",
2057 srgb_lbound
, srgb_ubound
);
2058 return NB_ERR_VALIDATION
;
2060 if ((srlb_ubound
- srlb_lbound
+ 1) > 65535) {
2061 snprintf(args
->errmsg
, args
->errmsg_len
,
2062 "New SR Local Block (%u/%u) exceed the limit of 65535",
2063 srlb_lbound
, srlb_ubound
);
2064 return NB_ERR_VALIDATION
;
2067 /* Validate SRGB against SRLB */
2068 if (!((srgb_ubound
< srlb_lbound
) || (srgb_lbound
> srlb_ubound
))) {
2070 args
->errmsg
, args
->errmsg_len
,
2071 "SR Global Block (%u/%u) conflicts with Local Block (%u/%u)",
2072 srgb_lbound
, srgb_ubound
, srlb_lbound
, srlb_ubound
);
2073 return NB_ERR_VALIDATION
;
2080 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb
2083 void isis_instance_segment_routing_srgb_apply_finish(
2084 struct nb_cb_apply_finish_args
*args
)
2086 struct isis_area
*area
;
2087 uint32_t lower_bound
, upper_bound
;
2089 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2090 lower_bound
= yang_dnode_get_uint32(args
->dnode
, "./lower-bound");
2091 upper_bound
= yang_dnode_get_uint32(args
->dnode
, "./upper-bound");
2093 isis_sr_cfg_srgb_update(area
, lower_bound
, upper_bound
);
2097 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb/lower-bound
2099 int isis_instance_segment_routing_srgb_lower_bound_modify(
2100 struct nb_cb_modify_args
*args
)
2102 uint32_t lower_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2104 switch (args
->event
) {
2105 case NB_EV_VALIDATE
:
2106 if (!IS_MPLS_UNRESERVED_LABEL(lower_bound
)) {
2107 snprintf(args
->errmsg
, args
->errmsg_len
,
2108 "Invalid SRGB lower bound: %u", lower_bound
);
2109 return NB_ERR_VALIDATION
;
2122 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb/upper-bound
2124 int isis_instance_segment_routing_srgb_upper_bound_modify(
2125 struct nb_cb_modify_args
*args
)
2127 uint32_t upper_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2129 switch (args
->event
) {
2130 case NB_EV_VALIDATE
:
2131 if (!IS_MPLS_UNRESERVED_LABEL(upper_bound
)) {
2132 snprintf(args
->errmsg
, args
->errmsg_len
,
2133 "Invalid SRGB upper bound: %u", upper_bound
);
2134 return NB_ERR_VALIDATION
;
2147 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb
2149 void isis_instance_segment_routing_srlb_apply_finish(
2150 struct nb_cb_apply_finish_args
*args
)
2152 struct isis_area
*area
;
2153 uint32_t lower_bound
, upper_bound
;
2155 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2156 lower_bound
= yang_dnode_get_uint32(args
->dnode
, "./lower-bound");
2157 upper_bound
= yang_dnode_get_uint32(args
->dnode
, "./upper-bound");
2159 isis_sr_cfg_srlb_update(area
, lower_bound
, upper_bound
);
2163 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb/lower-bound
2165 int isis_instance_segment_routing_srlb_lower_bound_modify(
2166 struct nb_cb_modify_args
*args
)
2168 uint32_t lower_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2170 switch (args
->event
) {
2171 case NB_EV_VALIDATE
:
2172 if (!IS_MPLS_UNRESERVED_LABEL(lower_bound
)) {
2173 snprintf(args
->errmsg
, args
->errmsg_len
,
2174 "Invalid SRLB lower bound: %u", lower_bound
);
2175 return NB_ERR_VALIDATION
;
2188 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb/upper-bound
2190 int isis_instance_segment_routing_srlb_upper_bound_modify(
2191 struct nb_cb_modify_args
*args
)
2193 uint32_t upper_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2195 switch (args
->event
) {
2196 case NB_EV_VALIDATE
:
2197 if (!IS_MPLS_UNRESERVED_LABEL(upper_bound
)) {
2198 snprintf(args
->errmsg
, args
->errmsg_len
,
2199 "Invalid SRLB upper bound: %u", upper_bound
);
2200 return NB_ERR_VALIDATION
;
2213 * XPath: /frr-isisd:isis/instance/segment-routing/msd/node-msd
2215 int isis_instance_segment_routing_msd_node_msd_modify(
2216 struct nb_cb_modify_args
*args
)
2218 struct isis_area
*area
;
2220 if (args
->event
!= NB_EV_APPLY
)
2223 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2224 area
->srdb
.config
.msd
= yang_dnode_get_uint8(args
->dnode
, NULL
);
2226 /* Update and regenerate LSP */
2227 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2232 int isis_instance_segment_routing_msd_node_msd_destroy(
2233 struct nb_cb_destroy_args
*args
)
2235 struct isis_area
*area
;
2237 if (args
->event
!= NB_EV_APPLY
)
2240 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2241 area
->srdb
.config
.msd
= 0;
2243 /* Update and regenerate LSP */
2244 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2250 * XPath: /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid
2252 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_create(
2253 struct nb_cb_create_args
*args
)
2255 struct isis_area
*area
;
2256 struct prefix prefix
;
2257 struct sr_prefix_cfg
*pcfg
;
2259 if (args
->event
!= NB_EV_APPLY
)
2262 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2263 yang_dnode_get_prefix(&prefix
, args
->dnode
, "./prefix");
2265 pcfg
= isis_sr_cfg_prefix_add(area
, &prefix
);
2266 nb_running_set_entry(args
->dnode
, pcfg
);
2271 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_destroy(
2272 struct nb_cb_destroy_args
*args
)
2274 struct sr_prefix_cfg
*pcfg
;
2275 struct isis_area
*area
;
2277 if (args
->event
!= NB_EV_APPLY
)
2280 pcfg
= nb_running_unset_entry(args
->dnode
);
2282 isis_sr_cfg_prefix_del(pcfg
);
2283 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2288 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_pre_validate(
2289 struct nb_cb_pre_validate_args
*args
)
2291 const struct lyd_node
*area_dnode
;
2292 struct isis_area
*area
;
2293 struct prefix prefix
;
2294 uint32_t srgb_lbound
;
2295 uint32_t srgb_ubound
;
2296 uint32_t srgb_range
;
2298 enum sr_sid_value_type sid_type
;
2299 struct isis_prefix_sid psid
= {};
2301 yang_dnode_get_prefix(&prefix
, args
->dnode
, "./prefix");
2302 srgb_lbound
= yang_dnode_get_uint32(
2303 args
->dnode
, "../../label-blocks/srgb/lower-bound");
2304 srgb_ubound
= yang_dnode_get_uint32(
2305 args
->dnode
, "../../label-blocks/srgb/upper-bound");
2306 sid
= yang_dnode_get_uint32(args
->dnode
, "./sid-value");
2307 sid_type
= yang_dnode_get_enum(args
->dnode
, "./sid-value-type");
2309 /* Check for invalid indexes/labels. */
2310 srgb_range
= srgb_ubound
- srgb_lbound
+ 1;
2313 case SR_SID_VALUE_TYPE_INDEX
:
2314 if (sid
>= srgb_range
) {
2315 snprintf(args
->errmsg
, args
->errmsg_len
,
2316 "SID index %u falls outside local SRGB range",
2318 return NB_ERR_VALIDATION
;
2321 case SR_SID_VALUE_TYPE_ABSOLUTE
:
2322 if (!IS_MPLS_UNRESERVED_LABEL(sid
)) {
2323 snprintf(args
->errmsg
, args
->errmsg_len
,
2324 "Invalid absolute SID %u", sid
);
2325 return NB_ERR_VALIDATION
;
2327 SET_FLAG(psid
.flags
, ISIS_PREFIX_SID_VALUE
);
2328 SET_FLAG(psid
.flags
, ISIS_PREFIX_SID_LOCAL
);
2332 /* Check for Prefix-SID collisions. */
2333 area_dnode
= yang_dnode_get_parent(args
->dnode
, "instance");
2334 area
= nb_running_get_entry(area_dnode
, NULL
, false);
2336 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
2337 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVEL2
;
2339 struct isis_spftree
*spftree
;
2340 struct isis_vertex
*vertex_psid
;
2342 if (!(area
->is_type
& level
))
2344 spftree
= area
->spftree
[tree
][level
- 1];
2348 vertex_psid
= isis_spf_prefix_sid_lookup(
2351 && !prefix_same(&vertex_psid
->N
.ip
.p
.dest
,
2354 args
->errmsg
, args
->errmsg_len
,
2355 "Prefix-SID collision detected, SID %s %u is already in use by prefix %pFX (L%u)",
2358 ISIS_PREFIX_SID_VALUE
)
2362 &vertex_psid
->N
.ip
.p
.dest
,
2364 return NB_ERR_VALIDATION
;
2373 void isis_instance_segment_routing_prefix_sid_map_prefix_sid_apply_finish(
2374 struct nb_cb_apply_finish_args
*args
)
2376 struct sr_prefix_cfg
*pcfg
;
2377 struct isis_area
*area
;
2379 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2381 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2386 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/sid-value-type
2388 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_sid_value_type_modify(
2389 struct nb_cb_modify_args
*args
)
2391 struct sr_prefix_cfg
*pcfg
;
2393 if (args
->event
!= NB_EV_APPLY
)
2396 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2397 pcfg
->sid_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2404 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/sid-value
2406 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_sid_value_modify(
2407 struct nb_cb_modify_args
*args
)
2409 struct sr_prefix_cfg
*pcfg
;
2411 if (args
->event
!= NB_EV_APPLY
)
2414 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2415 pcfg
->sid
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2422 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/last-hop-behavior
2424 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_last_hop_behavior_modify(
2425 struct nb_cb_modify_args
*args
)
2427 struct sr_prefix_cfg
*pcfg
;
2429 if (args
->event
!= NB_EV_APPLY
)
2432 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2433 pcfg
->last_hop_behavior
= yang_dnode_get_enum(args
->dnode
, NULL
);
2439 * XPath: /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/n-flag-clear
2441 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_n_flag_clear_modify(
2442 struct nb_cb_modify_args
*args
)
2444 struct sr_prefix_cfg
*pcfg
;
2446 if (args
->event
!= NB_EV_APPLY
)
2449 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2450 pcfg
->n_flag_clear
= yang_dnode_get_bool(args
->dnode
, NULL
);
2456 * XPath: /frr-isisd:isis/instance/mpls/ldp-sync
2458 int isis_instance_mpls_ldp_sync_create(struct nb_cb_create_args
*args
)
2460 struct isis_area
*area
;
2461 const char *vrfname
;
2463 switch (args
->event
) {
2464 case NB_EV_VALIDATE
:
2465 vrfname
= yang_dnode_get_string(
2466 lyd_parent(lyd_parent(args
->dnode
)), "./vrf");
2468 if (strcmp(vrfname
, VRF_DEFAULT_NAME
)) {
2469 snprintf(args
->errmsg
, args
->errmsg_len
,
2470 "LDP-Sync only runs on Default VRF");
2471 return NB_ERR_VALIDATION
;
2478 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2479 isis_area_ldp_sync_enable(area
);
2485 int isis_instance_mpls_ldp_sync_destroy(struct nb_cb_destroy_args
*args
)
2487 struct isis_area
*area
;
2489 if (args
->event
!= NB_EV_APPLY
)
2492 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2493 isis_area_ldp_sync_disable(area
);
2499 * XPath: /frr-isisd:isis/instance/mpls/ldp-sync/holddown
2501 int isis_instance_mpls_ldp_sync_holddown_modify(struct nb_cb_modify_args
*args
)
2503 struct isis_area
*area
;
2505 const char *vrfname
;
2507 switch (args
->event
) {
2508 case NB_EV_VALIDATE
:
2509 vrfname
= yang_dnode_get_string(
2510 lyd_parent(lyd_parent(lyd_parent(args
->dnode
))),
2513 if (strcmp(vrfname
, VRF_DEFAULT_NAME
)) {
2514 snprintf(args
->errmsg
, args
->errmsg_len
,
2515 "LDP-Sync only runs on Default VRF");
2516 return NB_ERR_VALIDATION
;
2523 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2524 holddown
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2525 isis_area_ldp_sync_set_holddown(area
, holddown
);
2532 * XPath: /frr-interface:lib/interface/frr-isisd:isis
2534 int lib_interface_isis_create(struct nb_cb_create_args
*args
)
2536 struct interface
*ifp
;
2537 struct isis_circuit
*circuit
= NULL
;
2538 const char *area_tag
= yang_dnode_get_string(args
->dnode
, "./area-tag");
2540 switch (args
->event
) {
2543 case NB_EV_VALIDATE
:
2546 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
2547 circuit
= isis_circuit_new(ifp
, area_tag
);
2548 nb_running_set_entry(args
->dnode
, circuit
);
2555 int lib_interface_isis_destroy(struct nb_cb_destroy_args
*args
)
2557 struct isis_circuit
*circuit
;
2559 if (args
->event
!= NB_EV_APPLY
)
2562 circuit
= nb_running_unset_entry(args
->dnode
);
2564 isis_circuit_del(circuit
);
2570 * XPath: /frr-interface:lib/interface/frr-isisd:isis/area-tag
2572 int lib_interface_isis_area_tag_modify(struct nb_cb_modify_args
*args
)
2574 struct isis_circuit
*circuit
;
2576 if (args
->event
== NB_EV_VALIDATE
) {
2577 circuit
= nb_running_get_entry_non_rec(lyd_parent(args
->dnode
), NULL
, false);
2579 snprintf(args
->errmsg
, args
->errmsg_len
,
2580 "Changing area tag is not allowed");
2581 return NB_ERR_VALIDATION
;
2589 * XPath: /frr-interface:lib/interface/frr-isisd:isis/circuit-type
2591 int lib_interface_isis_circuit_type_modify(struct nb_cb_modify_args
*args
)
2593 int circ_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2594 struct isis_circuit
*circuit
;
2596 switch (args
->event
) {
2597 case NB_EV_VALIDATE
:
2602 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2603 circuit
->is_type_config
= circ_type
;
2604 isis_circuit_is_type_set(circuit
, circ_type
);
2612 * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv4-routing
2614 int lib_interface_isis_ipv4_routing_modify(struct nb_cb_modify_args
*args
)
2617 struct isis_circuit
*circuit
;
2619 if (args
->event
!= NB_EV_APPLY
)
2622 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2623 ipv4
= yang_dnode_get_bool(args
->dnode
, NULL
);
2624 ipv6
= yang_dnode_get_bool(args
->dnode
, "../ipv6-routing");
2625 isis_circuit_af_set(circuit
, ipv4
, ipv6
);
2631 * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv6-routing
2633 int lib_interface_isis_ipv6_routing_modify(struct nb_cb_modify_args
*args
)
2636 struct isis_circuit
*circuit
;
2638 if (args
->event
!= NB_EV_APPLY
)
2641 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2642 ipv4
= yang_dnode_get_bool(args
->dnode
, "../ipv4-routing");
2643 ipv6
= yang_dnode_get_bool(args
->dnode
, NULL
);
2644 isis_circuit_af_set(circuit
, ipv4
, ipv6
);
2650 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring
2652 void lib_interface_isis_bfd_monitoring_apply_finish(
2653 struct nb_cb_apply_finish_args
*args
)
2655 struct isis_circuit
*circuit
;
2657 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2658 isis_bfd_circuit_cmd(circuit
);
2662 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring/enabled
2664 int lib_interface_isis_bfd_monitoring_enabled_modify(
2665 struct nb_cb_modify_args
*args
)
2667 struct isis_circuit
*circuit
;
2669 if (args
->event
!= NB_EV_APPLY
)
2672 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2673 circuit
->bfd_config
.enabled
= yang_dnode_get_bool(args
->dnode
, NULL
);
2679 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring/profile
2681 int lib_interface_isis_bfd_monitoring_profile_modify(
2682 struct nb_cb_modify_args
*args
)
2684 struct isis_circuit
*circuit
;
2686 if (args
->event
!= NB_EV_APPLY
)
2689 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2690 XFREE(MTYPE_TMP
, circuit
->bfd_config
.profile
);
2691 circuit
->bfd_config
.profile
=
2692 XSTRDUP(MTYPE_TMP
, yang_dnode_get_string(args
->dnode
, NULL
));
2697 int lib_interface_isis_bfd_monitoring_profile_destroy(
2698 struct nb_cb_destroy_args
*args
)
2700 struct isis_circuit
*circuit
;
2702 if (args
->event
!= NB_EV_APPLY
)
2705 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2706 XFREE(MTYPE_TMP
, circuit
->bfd_config
.profile
);
2712 * XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-1
2714 int lib_interface_isis_csnp_interval_level_1_modify(
2715 struct nb_cb_modify_args
*args
)
2717 struct isis_circuit
*circuit
;
2719 if (args
->event
!= NB_EV_APPLY
)
2722 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2723 circuit
->csnp_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2729 * XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-2
2731 int lib_interface_isis_csnp_interval_level_2_modify(
2732 struct nb_cb_modify_args
*args
)
2734 struct isis_circuit
*circuit
;
2736 if (args
->event
!= NB_EV_APPLY
)
2739 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2740 circuit
->csnp_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2746 * XPath: /frr-interface:lib/interface/frr-isisd:isis/psnp-interval/level-1
2748 int lib_interface_isis_psnp_interval_level_1_modify(
2749 struct nb_cb_modify_args
*args
)
2751 struct isis_circuit
*circuit
;
2753 if (args
->event
!= NB_EV_APPLY
)
2756 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2757 circuit
->psnp_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2763 * XPath: /frr-interface:lib/interface/frr-isisd:isis/psnp-interval/level-2
2765 int lib_interface_isis_psnp_interval_level_2_modify(
2766 struct nb_cb_modify_args
*args
)
2768 struct isis_circuit
*circuit
;
2770 if (args
->event
!= NB_EV_APPLY
)
2773 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2774 circuit
->psnp_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2780 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/padding
2782 int lib_interface_isis_hello_padding_modify(struct nb_cb_modify_args
*args
)
2784 struct isis_circuit
*circuit
;
2786 if (args
->event
!= NB_EV_APPLY
)
2789 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2790 circuit
->pad_hellos
= yang_dnode_get_bool(args
->dnode
, NULL
);
2796 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/interval/level-1
2798 int lib_interface_isis_hello_interval_level_1_modify(
2799 struct nb_cb_modify_args
*args
)
2801 struct isis_circuit
*circuit
;
2804 if (args
->event
!= NB_EV_APPLY
)
2807 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2808 interval
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2809 circuit
->hello_interval
[0] = interval
;
2815 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/interval/level-2
2817 int lib_interface_isis_hello_interval_level_2_modify(
2818 struct nb_cb_modify_args
*args
)
2820 struct isis_circuit
*circuit
;
2823 if (args
->event
!= NB_EV_APPLY
)
2826 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2827 interval
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2828 circuit
->hello_interval
[1] = interval
;
2834 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/multiplier/level-1
2836 int lib_interface_isis_hello_multiplier_level_1_modify(
2837 struct nb_cb_modify_args
*args
)
2839 struct isis_circuit
*circuit
;
2842 if (args
->event
!= NB_EV_APPLY
)
2845 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2846 multi
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2847 circuit
->hello_multiplier
[0] = multi
;
2853 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/multiplier/level-2
2855 int lib_interface_isis_hello_multiplier_level_2_modify(
2856 struct nb_cb_modify_args
*args
)
2858 struct isis_circuit
*circuit
;
2861 if (args
->event
!= NB_EV_APPLY
)
2864 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2865 multi
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2866 circuit
->hello_multiplier
[1] = multi
;
2872 * XPath: /frr-interface:lib/interface/frr-isisd:isis/metric/level-1
2874 int lib_interface_isis_metric_level_1_modify(struct nb_cb_modify_args
*args
)
2876 struct isis_circuit
*circuit
;
2879 if (args
->event
!= NB_EV_APPLY
)
2882 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2883 met
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2884 isis_circuit_metric_set(circuit
, IS_LEVEL_1
, met
);
2890 * XPath: /frr-interface:lib/interface/frr-isisd:isis/metric/level-2
2892 int lib_interface_isis_metric_level_2_modify(struct nb_cb_modify_args
*args
)
2894 struct isis_circuit
*circuit
;
2897 if (args
->event
!= NB_EV_APPLY
)
2900 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2901 met
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2902 isis_circuit_metric_set(circuit
, IS_LEVEL_2
, met
);
2908 * XPath: /frr-interface:lib/interface/frr-isisd:isis/priority/level-1
2910 int lib_interface_isis_priority_level_1_modify(struct nb_cb_modify_args
*args
)
2912 struct isis_circuit
*circuit
;
2914 if (args
->event
!= NB_EV_APPLY
)
2917 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2918 circuit
->priority
[0] = yang_dnode_get_uint8(args
->dnode
, NULL
);
2924 * XPath: /frr-interface:lib/interface/frr-isisd:isis/priority/level-2
2926 int lib_interface_isis_priority_level_2_modify(struct nb_cb_modify_args
*args
)
2928 struct isis_circuit
*circuit
;
2930 if (args
->event
!= NB_EV_APPLY
)
2933 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2934 circuit
->priority
[1] = yang_dnode_get_uint8(args
->dnode
, NULL
);
2940 * XPath: /frr-interface:lib/interface/frr-isisd:isis/network-type
2942 int lib_interface_isis_network_type_modify(struct nb_cb_modify_args
*args
)
2944 struct isis_circuit
*circuit
;
2945 int net_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2947 switch (args
->event
) {
2948 case NB_EV_VALIDATE
:
2949 circuit
= nb_running_get_entry(args
->dnode
, NULL
, false);
2952 if (circuit
->circ_type
== CIRCUIT_T_LOOPBACK
) {
2954 args
->errmsg
, args
->errmsg_len
,
2955 "Cannot change network type on loopback interface");
2956 return NB_ERR_VALIDATION
;
2958 if (net_type
== CIRCUIT_T_BROADCAST
2959 && circuit
->state
== C_STATE_UP
2960 && !if_is_broadcast(circuit
->interface
)) {
2962 args
->errmsg
, args
->errmsg_len
,
2963 "Cannot configure non-broadcast interface for broadcast operation");
2964 return NB_ERR_VALIDATION
;
2971 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2972 isis_circuit_circ_type_set(circuit
, net_type
);
2980 * XPath: /frr-interface:lib/interface/frr-isisd:isis/passive
2982 int lib_interface_isis_passive_modify(struct nb_cb_modify_args
*args
)
2984 struct isis_circuit
*circuit
;
2985 bool passive
= yang_dnode_get_bool(args
->dnode
, NULL
);
2987 if (args
->event
!= NB_EV_APPLY
)
2990 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2991 isis_circuit_passive_set(circuit
, passive
);
2997 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password
2999 int lib_interface_isis_password_create(struct nb_cb_create_args
*args
)
3004 int lib_interface_isis_password_destroy(struct nb_cb_destroy_args
*args
)
3006 struct isis_circuit
*circuit
;
3008 if (args
->event
!= NB_EV_APPLY
)
3011 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3012 isis_circuit_passwd_unset(circuit
);
3018 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password/password
3020 int lib_interface_isis_password_password_modify(struct nb_cb_modify_args
*args
)
3022 struct isis_circuit
*circuit
;
3023 const char *password
;
3025 if (args
->event
!= NB_EV_APPLY
)
3028 password
= yang_dnode_get_string(args
->dnode
, NULL
);
3029 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3031 isis_circuit_passwd_set(circuit
, circuit
->passwd
.type
, password
);
3037 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password/password-type
3039 int lib_interface_isis_password_password_type_modify(
3040 struct nb_cb_modify_args
*args
)
3042 struct isis_circuit
*circuit
;
3045 if (args
->event
!= NB_EV_APPLY
)
3048 pass_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
3049 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3050 circuit
->passwd
.type
= pass_type
;
3057 * /frr-interface:lib/interface/frr-isisd:isis/disable-three-way-handshake
3059 int lib_interface_isis_disable_three_way_handshake_modify(
3060 struct nb_cb_modify_args
*args
)
3062 struct isis_circuit
*circuit
;
3064 if (args
->event
!= NB_EV_APPLY
)
3067 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3068 circuit
->disable_threeway_adj
= yang_dnode_get_bool(args
->dnode
, NULL
);
3073 static int lib_interface_isis_multi_topology_common(
3074 enum nb_event event
, const struct lyd_node
*dnode
, char *errmsg
,
3075 size_t errmsg_len
, uint16_t mtid
)
3077 struct isis_circuit
*circuit
;
3081 case NB_EV_VALIDATE
:
3082 circuit
= nb_running_get_entry(dnode
, NULL
, false);
3083 if (circuit
&& circuit
->area
&& circuit
->area
->oldmetric
) {
3086 "Multi topology IS-IS can only be used with wide metrics");
3087 return NB_ERR_VALIDATION
;
3094 circuit
= nb_running_get_entry(dnode
, NULL
, true);
3095 value
= yang_dnode_get_bool(dnode
, NULL
);
3096 isis_circuit_mt_enabled_set(circuit
, mtid
, value
);
3105 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/standard
3107 int lib_interface_isis_multi_topology_standard_modify(
3108 struct nb_cb_modify_args
*args
)
3110 return lib_interface_isis_multi_topology_common(
3111 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3117 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-multicast
3119 int lib_interface_isis_multi_topology_ipv4_multicast_modify(
3120 struct nb_cb_modify_args
*args
)
3122 return lib_interface_isis_multi_topology_common(
3123 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3124 ISIS_MT_IPV4_MULTICAST
);
3129 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-management
3131 int lib_interface_isis_multi_topology_ipv4_management_modify(
3132 struct nb_cb_modify_args
*args
)
3134 return lib_interface_isis_multi_topology_common(
3135 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3141 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-unicast
3143 int lib_interface_isis_multi_topology_ipv6_unicast_modify(
3144 struct nb_cb_modify_args
*args
)
3146 return lib_interface_isis_multi_topology_common(
3147 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3148 ISIS_MT_IPV6_UNICAST
);
3153 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-multicast
3155 int lib_interface_isis_multi_topology_ipv6_multicast_modify(
3156 struct nb_cb_modify_args
*args
)
3158 return lib_interface_isis_multi_topology_common(
3159 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3160 ISIS_MT_IPV6_MULTICAST
);
3165 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-management
3167 int lib_interface_isis_multi_topology_ipv6_management_modify(
3168 struct nb_cb_modify_args
*args
)
3170 return lib_interface_isis_multi_topology_common(
3171 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3176 * XPath: /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-dstsrc
3178 int lib_interface_isis_multi_topology_ipv6_dstsrc_modify(
3179 struct nb_cb_modify_args
*args
)
3181 return lib_interface_isis_multi_topology_common(
3182 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3183 ISIS_MT_IPV6_DSTSRC
);
3187 * XPath: /frr-interface:lib/interface/frr-isisd:isis/mpls/ldp-sync
3189 int lib_interface_isis_mpls_ldp_sync_modify(struct nb_cb_modify_args
*args
)
3191 struct isis_circuit
*circuit
;
3192 struct ldp_sync_info
*ldp_sync_info
;
3193 bool ldp_sync_enable
;
3195 switch (args
->event
) {
3196 case NB_EV_VALIDATE
:
3201 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3202 ldp_sync_enable
= yang_dnode_get_bool(args
->dnode
, NULL
);
3204 ldp_sync_info
= circuit
->ldp_sync_info
;
3206 SET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_IF_CONFIG
);
3207 ldp_sync_info
->enabled
= ldp_sync_enable
;
3209 if (circuit
->area
) {
3210 if (ldp_sync_enable
)
3211 isis_if_ldp_sync_enable(circuit
);
3213 isis_if_ldp_sync_disable(circuit
);
3221 * XPath: /frr-interface:lib/interface/frr-isisd:isis/mpls/holddown
3223 int lib_interface_isis_mpls_holddown_modify(struct nb_cb_modify_args
*args
)
3225 struct isis_circuit
*circuit
;
3226 struct ldp_sync_info
*ldp_sync_info
;
3229 switch (args
->event
) {
3230 case NB_EV_VALIDATE
:
3235 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3236 holddown
= yang_dnode_get_uint16(args
->dnode
, NULL
);
3238 ldp_sync_info
= circuit
->ldp_sync_info
;
3240 SET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_HOLDDOWN
);
3241 ldp_sync_info
->holddown
= holddown
;
3247 int lib_interface_isis_mpls_holddown_destroy(struct nb_cb_destroy_args
*args
)
3249 struct isis_circuit
*circuit
;
3250 struct ldp_sync_info
*ldp_sync_info
;
3252 switch (args
->event
) {
3253 case NB_EV_VALIDATE
:
3258 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3259 ldp_sync_info
= circuit
->ldp_sync_info
;
3261 UNSET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_HOLDDOWN
);
3264 isis_if_set_ldp_sync_holddown(circuit
);
3273 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/lfa/enable
3275 int lib_interface_isis_fast_reroute_level_1_lfa_enable_modify(
3276 struct nb_cb_modify_args
*args
)
3278 struct isis_area
*area
;
3279 struct isis_circuit
*circuit
;
3281 if (args
->event
!= NB_EV_APPLY
)
3284 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3285 circuit
->lfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3287 area
= circuit
->area
;
3289 if (circuit
->lfa_protection
[0])
3290 area
->lfa_protected_links
[0]++;
3292 assert(area
->lfa_protected_links
[0] > 0);
3293 area
->lfa_protected_links
[0]--;
3296 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3304 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/lfa/exclude-interface
3306 int lib_interface_isis_fast_reroute_level_1_lfa_exclude_interface_create(
3307 struct nb_cb_create_args
*args
)
3309 struct isis_area
*area
;
3310 struct isis_circuit
*circuit
;
3311 const char *exclude_ifname
;
3313 if (args
->event
!= NB_EV_APPLY
)
3316 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3317 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3319 isis_lfa_excluded_iface_add(circuit
, ISIS_LEVEL1
, exclude_ifname
);
3320 area
= circuit
->area
;
3322 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3327 int lib_interface_isis_fast_reroute_level_1_lfa_exclude_interface_destroy(
3328 struct nb_cb_destroy_args
*args
)
3330 struct isis_area
*area
;
3331 struct isis_circuit
*circuit
;
3332 const char *exclude_ifname
;
3334 if (args
->event
!= NB_EV_APPLY
)
3337 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3338 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3340 isis_lfa_excluded_iface_delete(circuit
, ISIS_LEVEL1
, exclude_ifname
);
3341 area
= circuit
->area
;
3343 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3350 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/remote-lfa/enable
3352 int lib_interface_isis_fast_reroute_level_1_remote_lfa_enable_modify(
3353 struct nb_cb_modify_args
*args
)
3355 struct isis_area
*area
;
3356 struct isis_circuit
*circuit
;
3358 if (args
->event
!= NB_EV_APPLY
)
3361 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3362 circuit
->rlfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3364 area
= circuit
->area
;
3366 if (circuit
->rlfa_protection
[0])
3367 area
->rlfa_protected_links
[0]++;
3369 assert(area
->rlfa_protected_links
[0] > 0);
3370 area
->rlfa_protected_links
[0]--;
3373 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3381 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/remote-lfa/maximum-metric
3383 int lib_interface_isis_fast_reroute_level_1_remote_lfa_maximum_metric_modify(
3384 struct nb_cb_modify_args
*args
)
3386 struct isis_area
*area
;
3387 struct isis_circuit
*circuit
;
3389 if (args
->event
!= NB_EV_APPLY
)
3392 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3393 circuit
->rlfa_max_metric
[0] = yang_dnode_get_uint32(args
->dnode
, NULL
);
3395 area
= circuit
->area
;
3397 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3402 int lib_interface_isis_fast_reroute_level_1_remote_lfa_maximum_metric_destroy(
3403 struct nb_cb_destroy_args
*args
)
3405 struct isis_area
*area
;
3406 struct isis_circuit
*circuit
;
3408 if (args
->event
!= NB_EV_APPLY
)
3411 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3412 circuit
->rlfa_max_metric
[0] = 0;
3414 area
= circuit
->area
;
3416 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3423 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/enable
3425 int lib_interface_isis_fast_reroute_level_1_ti_lfa_enable_modify(
3426 struct nb_cb_modify_args
*args
)
3428 struct isis_area
*area
;
3429 struct isis_circuit
*circuit
;
3431 if (args
->event
!= NB_EV_APPLY
)
3434 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3435 circuit
->tilfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3437 area
= circuit
->area
;
3439 if (circuit
->tilfa_protection
[0])
3440 area
->tilfa_protected_links
[0]++;
3442 assert(area
->tilfa_protected_links
[0] > 0);
3443 area
->tilfa_protected_links
[0]--;
3446 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3454 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/node-protection
3456 int lib_interface_isis_fast_reroute_level_1_ti_lfa_node_protection_modify(
3457 struct nb_cb_modify_args
*args
)
3459 struct isis_area
*area
;
3460 struct isis_circuit
*circuit
;
3462 if (args
->event
!= NB_EV_APPLY
)
3465 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3466 circuit
->tilfa_node_protection
[0] =
3467 yang_dnode_get_bool(args
->dnode
, NULL
);
3469 area
= circuit
->area
;
3471 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3478 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/link-fallback
3480 int lib_interface_isis_fast_reroute_level_1_ti_lfa_link_fallback_modify(
3481 struct nb_cb_modify_args
*args
)
3483 struct isis_area
*area
;
3484 struct isis_circuit
*circuit
;
3486 if (args
->event
!= NB_EV_APPLY
)
3489 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3490 circuit
->tilfa_link_fallback
[0] =
3491 yang_dnode_get_bool(args
->dnode
, NULL
);
3493 area
= circuit
->area
;
3495 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3502 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/lfa/enable
3504 int lib_interface_isis_fast_reroute_level_2_lfa_enable_modify(
3505 struct nb_cb_modify_args
*args
)
3507 struct isis_area
*area
;
3508 struct isis_circuit
*circuit
;
3510 if (args
->event
!= NB_EV_APPLY
)
3513 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3514 circuit
->lfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3516 area
= circuit
->area
;
3518 if (circuit
->lfa_protection
[1])
3519 area
->lfa_protected_links
[1]++;
3521 assert(area
->lfa_protected_links
[1] > 0);
3522 area
->lfa_protected_links
[1]--;
3525 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3533 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/lfa/exclude-interface
3535 int lib_interface_isis_fast_reroute_level_2_lfa_exclude_interface_create(
3536 struct nb_cb_create_args
*args
)
3538 struct isis_area
*area
;
3539 struct isis_circuit
*circuit
;
3540 const char *exclude_ifname
;
3542 if (args
->event
!= NB_EV_APPLY
)
3545 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3546 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3548 isis_lfa_excluded_iface_add(circuit
, ISIS_LEVEL2
, exclude_ifname
);
3549 area
= circuit
->area
;
3551 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3556 int lib_interface_isis_fast_reroute_level_2_lfa_exclude_interface_destroy(
3557 struct nb_cb_destroy_args
*args
)
3559 struct isis_area
*area
;
3560 struct isis_circuit
*circuit
;
3561 const char *exclude_ifname
;
3563 if (args
->event
!= NB_EV_APPLY
)
3566 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3567 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3569 isis_lfa_excluded_iface_delete(circuit
, ISIS_LEVEL2
, exclude_ifname
);
3570 area
= circuit
->area
;
3572 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3579 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/remote-lfa/enable
3581 int lib_interface_isis_fast_reroute_level_2_remote_lfa_enable_modify(
3582 struct nb_cb_modify_args
*args
)
3584 struct isis_area
*area
;
3585 struct isis_circuit
*circuit
;
3587 if (args
->event
!= NB_EV_APPLY
)
3590 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3591 circuit
->rlfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3593 area
= circuit
->area
;
3595 if (circuit
->rlfa_protection
[1])
3596 area
->rlfa_protected_links
[1]++;
3598 assert(area
->rlfa_protected_links
[1] > 0);
3599 area
->rlfa_protected_links
[1]--;
3602 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3610 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/remote-lfa/maximum-metric
3612 int lib_interface_isis_fast_reroute_level_2_remote_lfa_maximum_metric_modify(
3613 struct nb_cb_modify_args
*args
)
3615 struct isis_area
*area
;
3616 struct isis_circuit
*circuit
;
3618 if (args
->event
!= NB_EV_APPLY
)
3621 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3622 circuit
->rlfa_max_metric
[1] = yang_dnode_get_uint32(args
->dnode
, NULL
);
3624 area
= circuit
->area
;
3626 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3631 int lib_interface_isis_fast_reroute_level_2_remote_lfa_maximum_metric_destroy(
3632 struct nb_cb_destroy_args
*args
)
3634 struct isis_area
*area
;
3635 struct isis_circuit
*circuit
;
3637 if (args
->event
!= NB_EV_APPLY
)
3640 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3641 circuit
->rlfa_max_metric
[1] = 0;
3643 area
= circuit
->area
;
3645 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3652 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/enable
3654 int lib_interface_isis_fast_reroute_level_2_ti_lfa_enable_modify(
3655 struct nb_cb_modify_args
*args
)
3657 struct isis_area
*area
;
3658 struct isis_circuit
*circuit
;
3660 if (args
->event
!= NB_EV_APPLY
)
3663 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3664 circuit
->tilfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3666 area
= circuit
->area
;
3668 if (circuit
->tilfa_protection
[1])
3669 area
->tilfa_protected_links
[1]++;
3671 assert(area
->tilfa_protected_links
[1] > 0);
3672 area
->tilfa_protected_links
[1]--;
3675 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3683 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/node-protection
3685 int lib_interface_isis_fast_reroute_level_2_ti_lfa_node_protection_modify(
3686 struct nb_cb_modify_args
*args
)
3688 struct isis_area
*area
;
3689 struct isis_circuit
*circuit
;
3691 if (args
->event
!= NB_EV_APPLY
)
3694 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3695 circuit
->tilfa_node_protection
[1] =
3696 yang_dnode_get_bool(args
->dnode
, NULL
);
3698 area
= circuit
->area
;
3700 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3707 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/link-fallback
3709 int lib_interface_isis_fast_reroute_level_2_ti_lfa_link_fallback_modify(
3710 struct nb_cb_modify_args
*args
)
3712 struct isis_area
*area
;
3713 struct isis_circuit
*circuit
;
3715 if (args
->event
!= NB_EV_APPLY
)
3718 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3719 circuit
->tilfa_link_fallback
[1] =
3720 yang_dnode_get_bool(args
->dnode
, NULL
);
3722 area
= circuit
->area
;
3724 lsp_regenerate_schedule(area
, area
->is_type
, 0);