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_PLIST_NAME
, "ISIS prefix-list name");
60 * XPath: /frr-isisd:isis/instance
62 int isis_instance_create(struct nb_cb_create_args
*args
)
64 struct isis_area
*area
;
68 if (args
->event
!= NB_EV_APPLY
)
70 vrf_name
= yang_dnode_get_string(args
->dnode
, "./vrf");
71 area_tag
= yang_dnode_get_string(args
->dnode
, "./area-tag");
73 area
= isis_area_lookup_by_vrf(area_tag
, vrf_name
);
75 return NB_ERR_INCONSISTENCY
;
77 area
= isis_area_create(area_tag
, vrf_name
);
79 /* save area in dnode to avoid looking it up all the time */
80 nb_running_set_entry(args
->dnode
, area
);
85 int isis_instance_destroy(struct nb_cb_destroy_args
*args
)
87 struct isis_area
*area
;
90 if (args
->event
!= NB_EV_APPLY
)
92 area
= nb_running_unset_entry(args
->dnode
);
94 isis_area_destroy(area
);
96 if (listcount(isis
->area_list
) == 0)
103 * XPath: /frr-isisd:isis/instance/is-type
105 int isis_instance_is_type_modify(struct nb_cb_modify_args
*args
)
107 struct isis_area
*area
;
110 if (args
->event
!= NB_EV_APPLY
)
113 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
114 type
= yang_dnode_get_enum(args
->dnode
, NULL
);
115 isis_area_is_type_set(area
, type
);
121 struct area_addr
*addr
;
125 static int sysid_iter_cb(const struct lyd_node
*dnode
, void *arg
)
127 struct sysid_iter
*iter
= arg
;
128 struct area_addr addr
;
131 net
= yang_dnode_get_string(dnode
, NULL
);
132 addr
.addr_len
= dotformat2buff(addr
.area_addr
, net
);
134 if (memcmp(GETSYSID(iter
->addr
), GETSYSID((&addr
)), ISIS_SYS_ID_LEN
)) {
136 return YANG_ITER_STOP
;
139 return YANG_ITER_CONTINUE
;
143 * XPath: /frr-isisd:isis/instance/area-address
145 int isis_instance_area_address_create(struct nb_cb_create_args
*args
)
147 struct isis_area
*area
;
148 struct area_addr addr
, *addrr
= NULL
, *addrp
= NULL
;
149 struct listnode
*node
;
150 struct sysid_iter iter
;
152 const char *net_title
= yang_dnode_get_string(args
->dnode
, NULL
);
154 switch (args
->event
) {
156 addr
.addr_len
= dotformat2buff(buff
, net_title
);
157 memcpy(addr
.area_addr
, buff
, addr
.addr_len
);
158 if (addr
.area_addr
[addr
.addr_len
- 1] != 0) {
160 args
->errmsg
, args
->errmsg_len
,
161 "nsel byte (last byte) in area address must be 0");
162 return NB_ERR_VALIDATION
;
168 yang_dnode_iterate(sysid_iter_cb
, &iter
, args
->dnode
,
173 args
->errmsg
, args
->errmsg_len
,
174 "System ID must not change when defining additional area addresses");
175 return NB_ERR_VALIDATION
;
179 addrr
= XMALLOC(MTYPE_ISIS_AREA_ADDR
, sizeof(struct area_addr
));
180 addrr
->addr_len
= dotformat2buff(buff
, net_title
);
181 memcpy(addrr
->area_addr
, buff
, addrr
->addr_len
);
182 args
->resource
->ptr
= addrr
;
185 XFREE(MTYPE_ISIS_AREA_ADDR
, args
->resource
->ptr
);
188 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
189 addrr
= args
->resource
->ptr
;
192 if (area
->isis
->sysid_set
== 0) {
194 * First area address - get the SystemID for this router
196 memcpy(area
->isis
->sysid
, GETSYSID(addrr
),
198 area
->isis
->sysid_set
= 1;
200 /* check that we don't already have this address */
201 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
,
203 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
205 != (addrr
->addr_len
))
207 if (!memcmp(addrp
->area_addr
, addrr
->area_addr
,
209 XFREE(MTYPE_ISIS_AREA_ADDR
, addrr
);
210 return NB_OK
; /* silent fail */
215 /*Forget the systemID part of the address */
216 addrr
->addr_len
-= (ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
);
217 assert(area
->area_addrs
); /* to silence scan-build sillyness */
218 listnode_add(area
->area_addrs
, addrr
);
220 /* only now we can safely generate our LSPs for this area */
221 if (listcount(area
->area_addrs
) > 0) {
222 if (area
->is_type
& IS_LEVEL_1
)
223 lsp_generate(area
, IS_LEVEL_1
);
224 if (area
->is_type
& IS_LEVEL_2
)
225 lsp_generate(area
, IS_LEVEL_2
);
233 int isis_instance_area_address_destroy(struct nb_cb_destroy_args
*args
)
235 struct area_addr addr
, *addrp
= NULL
;
236 struct listnode
*node
;
238 struct isis_area
*area
;
239 const char *net_title
;
240 struct listnode
*cnode
;
241 struct isis_circuit
*circuit
;
244 if (args
->event
!= NB_EV_APPLY
)
247 net_title
= yang_dnode_get_string(args
->dnode
, NULL
);
248 addr
.addr_len
= dotformat2buff(buff
, net_title
);
249 memcpy(addr
.area_addr
, buff
, (int)addr
.addr_len
);
250 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
252 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
)) {
253 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ 1) == addr
.addr_len
254 && !memcmp(addrp
->area_addr
, addr
.area_addr
, addr
.addr_len
))
258 return NB_ERR_INCONSISTENCY
;
260 listnode_delete(area
->area_addrs
, addrp
);
261 XFREE(MTYPE_ISIS_AREA_ADDR
, addrp
);
263 * Last area address - reset the SystemID for this router
265 if (listcount(area
->area_addrs
) == 0) {
266 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
))
267 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
268 if (circuit
->u
.bc
.is_dr
[lvl
- 1])
269 isis_dr_resign(circuit
, lvl
);
271 memset(area
->isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
272 area
->isis
->sysid_set
= 0;
274 zlog_debug("Router has no SystemID");
281 * XPath: /frr-isisd:isis/instance/dynamic-hostname
283 int isis_instance_dynamic_hostname_modify(struct nb_cb_modify_args
*args
)
285 struct isis_area
*area
;
287 if (args
->event
!= NB_EV_APPLY
)
290 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
291 isis_area_dynhostname_set(area
, yang_dnode_get_bool(args
->dnode
, NULL
));
297 * XPath: /frr-isisd:isis/instance/attach-send
299 int isis_instance_attached_send_modify(struct nb_cb_modify_args
*args
)
301 struct isis_area
*area
;
304 if (args
->event
!= NB_EV_APPLY
)
307 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
308 attached
= yang_dnode_get_bool(args
->dnode
, NULL
);
309 isis_area_attached_bit_send_set(area
, attached
);
315 * XPath: /frr-isisd:isis/instance/attach-receive-ignore
317 int isis_instance_attached_receive_modify(struct nb_cb_modify_args
*args
)
319 struct isis_area
*area
;
322 if (args
->event
!= NB_EV_APPLY
)
325 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
326 attached
= yang_dnode_get_bool(args
->dnode
, NULL
);
327 isis_area_attached_bit_receive_set(area
, attached
);
333 * XPath: /frr-isisd:isis/instance/attached
335 int isis_instance_attached_modify(struct nb_cb_modify_args
*args
)
341 * XPath: /frr-isisd:isis/instance/overload
343 int isis_instance_overload_modify(struct nb_cb_modify_args
*args
)
345 struct isis_area
*area
;
348 if (args
->event
!= NB_EV_APPLY
)
351 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
352 overload
= yang_dnode_get_bool(args
->dnode
, NULL
);
353 isis_area_overload_bit_set(area
, overload
);
359 * XPath: /frr-isisd:isis/instance/metric-style
361 int isis_instance_metric_style_modify(struct nb_cb_modify_args
*args
)
363 struct isis_area
*area
;
364 bool old_metric
, new_metric
;
365 enum isis_metric_style metric_style
=
366 yang_dnode_get_enum(args
->dnode
, NULL
);
368 if (args
->event
!= NB_EV_APPLY
)
371 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
372 old_metric
= (metric_style
== ISIS_WIDE_METRIC
) ? false : true;
373 new_metric
= (metric_style
== ISIS_NARROW_METRIC
) ? false : true;
374 isis_area_metricstyle_set(area
, old_metric
, new_metric
);
380 * XPath: /frr-isisd:isis/instance/purge-originator
382 int isis_instance_purge_originator_modify(struct nb_cb_modify_args
*args
)
384 struct isis_area
*area
;
386 if (args
->event
!= NB_EV_APPLY
)
389 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
390 area
->purge_originator
= yang_dnode_get_bool(args
->dnode
, NULL
);
396 * XPath: /frr-isisd:isis/instance/lsp/mtu
398 int isis_instance_lsp_mtu_modify(struct nb_cb_modify_args
*args
)
400 uint16_t lsp_mtu
= yang_dnode_get_uint16(args
->dnode
, NULL
);
401 struct isis_area
*area
;
403 switch (args
->event
) {
409 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
410 isis_area_lsp_mtu_set(area
, lsp_mtu
);
418 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/refresh-interval
420 int isis_instance_lsp_refresh_interval_level_1_modify(
421 struct nb_cb_modify_args
*args
)
423 struct isis_area
*area
;
426 if (args
->event
!= NB_EV_APPLY
)
429 refr_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
430 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
431 isis_area_lsp_refresh_set(area
, IS_LEVEL_1
, refr_int
);
437 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/refresh-interval
439 int isis_instance_lsp_refresh_interval_level_2_modify(
440 struct nb_cb_modify_args
*args
)
442 struct isis_area
*area
;
445 if (args
->event
!= NB_EV_APPLY
)
448 refr_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
449 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
450 isis_area_lsp_refresh_set(area
, IS_LEVEL_2
, refr_int
);
456 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/maximum-lifetime
458 int isis_instance_lsp_maximum_lifetime_level_1_modify(
459 struct nb_cb_modify_args
*args
)
461 struct isis_area
*area
;
464 if (args
->event
!= NB_EV_APPLY
)
467 max_lt
= yang_dnode_get_uint16(args
->dnode
, NULL
);
468 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
469 isis_area_max_lsp_lifetime_set(area
, IS_LEVEL_1
, max_lt
);
475 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/maximum-lifetime
477 int isis_instance_lsp_maximum_lifetime_level_2_modify(
478 struct nb_cb_modify_args
*args
)
480 struct isis_area
*area
;
483 if (args
->event
!= NB_EV_APPLY
)
486 max_lt
= yang_dnode_get_uint16(args
->dnode
, NULL
);
487 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
488 isis_area_max_lsp_lifetime_set(area
, IS_LEVEL_2
, max_lt
);
494 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/generation-interval
496 int isis_instance_lsp_generation_interval_level_1_modify(
497 struct nb_cb_modify_args
*args
)
499 struct isis_area
*area
;
502 if (args
->event
!= NB_EV_APPLY
)
505 gen_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
506 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
507 area
->lsp_gen_interval
[0] = gen_int
;
513 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/generation-interval
515 int isis_instance_lsp_generation_interval_level_2_modify(
516 struct nb_cb_modify_args
*args
)
518 struct isis_area
*area
;
521 if (args
->event
!= NB_EV_APPLY
)
524 gen_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
525 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
526 area
->lsp_gen_interval
[1] = gen_int
;
532 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay
534 void ietf_backoff_delay_apply_finish(struct nb_cb_apply_finish_args
*args
)
536 long init_delay
= yang_dnode_get_uint16(args
->dnode
, "./init-delay");
537 long short_delay
= yang_dnode_get_uint16(args
->dnode
, "./short-delay");
538 long long_delay
= yang_dnode_get_uint16(args
->dnode
, "./long-delay");
539 long holddown
= yang_dnode_get_uint16(args
->dnode
, "./hold-down");
541 yang_dnode_get_uint16(args
->dnode
, "./time-to-learn");
542 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
543 size_t bufsiz
= strlen(area
->area_tag
) + sizeof("IS-IS Lx");
544 char *buf
= XCALLOC(MTYPE_TMP
, bufsiz
);
546 snprintf(buf
, bufsiz
, "IS-IS %s L1", area
->area_tag
);
547 spf_backoff_free(area
->spf_delay_ietf
[0]);
548 area
->spf_delay_ietf
[0] =
549 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
550 long_delay
, holddown
, timetolearn
);
552 snprintf(buf
, bufsiz
, "IS-IS %s L2", area
->area_tag
);
553 spf_backoff_free(area
->spf_delay_ietf
[1]);
554 area
->spf_delay_ietf
[1] =
555 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
556 long_delay
, holddown
, timetolearn
);
558 XFREE(MTYPE_TMP
, buf
);
561 int isis_instance_spf_ietf_backoff_delay_create(struct nb_cb_create_args
*args
)
563 /* All the work is done in the apply_finish */
567 int isis_instance_spf_ietf_backoff_delay_destroy(
568 struct nb_cb_destroy_args
*args
)
570 struct isis_area
*area
;
572 if (args
->event
!= NB_EV_APPLY
)
575 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
576 spf_backoff_free(area
->spf_delay_ietf
[0]);
577 spf_backoff_free(area
->spf_delay_ietf
[1]);
578 area
->spf_delay_ietf
[0] = NULL
;
579 area
->spf_delay_ietf
[1] = NULL
;
585 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/init-delay
587 int isis_instance_spf_ietf_backoff_delay_init_delay_modify(
588 struct nb_cb_modify_args
*args
)
590 /* All the work is done in the apply_finish */
595 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/short-delay
597 int isis_instance_spf_ietf_backoff_delay_short_delay_modify(
598 struct nb_cb_modify_args
*args
)
600 /* All the work is done in the apply_finish */
605 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/long-delay
607 int isis_instance_spf_ietf_backoff_delay_long_delay_modify(
608 struct nb_cb_modify_args
*args
)
610 /* All the work is done in the apply_finish */
615 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/hold-down
617 int isis_instance_spf_ietf_backoff_delay_hold_down_modify(
618 struct nb_cb_modify_args
*args
)
620 /* All the work is done in the apply_finish */
625 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/time-to-learn
627 int isis_instance_spf_ietf_backoff_delay_time_to_learn_modify(
628 struct nb_cb_modify_args
*args
)
630 /* All the work is done in the apply_finish */
635 * XPath: /frr-isisd:isis/instance/spf/minimum-interval/level-1
637 int isis_instance_spf_minimum_interval_level_1_modify(
638 struct nb_cb_modify_args
*args
)
640 struct isis_area
*area
;
642 if (args
->event
!= NB_EV_APPLY
)
645 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
646 area
->min_spf_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
652 * XPath: /frr-isisd:isis/instance/spf/minimum-interval/level-2
654 int isis_instance_spf_minimum_interval_level_2_modify(
655 struct nb_cb_modify_args
*args
)
657 struct isis_area
*area
;
659 if (args
->event
!= NB_EV_APPLY
)
662 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
663 area
->min_spf_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
670 * /frr-isisd:isis/instance/spf/prefix-priorities/critical/access-list-name
672 int isis_instance_spf_prefix_priorities_critical_access_list_name_modify(
673 struct nb_cb_modify_args
*args
)
675 struct isis_area
*area
;
676 const char *acl_name
;
677 struct spf_prefix_priority_acl
*ppa
;
679 if (args
->event
!= NB_EV_APPLY
)
682 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
683 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
685 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_CRITICAL
];
686 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
687 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
688 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
689 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
690 lsp_regenerate_schedule(area
, area
->is_type
, 0);
695 int isis_instance_spf_prefix_priorities_critical_access_list_name_destroy(
696 struct nb_cb_destroy_args
*args
)
698 struct isis_area
*area
;
699 struct spf_prefix_priority_acl
*ppa
;
701 if (args
->event
!= NB_EV_APPLY
)
704 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
706 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_CRITICAL
];
707 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
710 lsp_regenerate_schedule(area
, area
->is_type
, 0);
716 * XPath: /frr-isisd:isis/instance/spf/prefix-priorities/high/access-list-name
718 int isis_instance_spf_prefix_priorities_high_access_list_name_modify(
719 struct nb_cb_modify_args
*args
)
721 struct isis_area
*area
;
722 const char *acl_name
;
723 struct spf_prefix_priority_acl
*ppa
;
725 if (args
->event
!= NB_EV_APPLY
)
728 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
729 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
731 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_HIGH
];
732 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
733 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
734 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
735 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
736 lsp_regenerate_schedule(area
, area
->is_type
, 0);
741 int isis_instance_spf_prefix_priorities_high_access_list_name_destroy(
742 struct nb_cb_destroy_args
*args
)
744 struct isis_area
*area
;
745 struct spf_prefix_priority_acl
*ppa
;
747 if (args
->event
!= NB_EV_APPLY
)
750 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
752 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_HIGH
];
753 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
756 lsp_regenerate_schedule(area
, area
->is_type
, 0);
762 * XPath: /frr-isisd:isis/instance/spf/prefix-priorities/medium/access-list-name
764 int isis_instance_spf_prefix_priorities_medium_access_list_name_modify(
765 struct nb_cb_modify_args
*args
)
767 struct isis_area
*area
;
768 const char *acl_name
;
769 struct spf_prefix_priority_acl
*ppa
;
771 if (args
->event
!= NB_EV_APPLY
)
774 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
775 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
777 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_MEDIUM
];
778 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
779 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
780 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
781 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
782 lsp_regenerate_schedule(area
, area
->is_type
, 0);
787 int isis_instance_spf_prefix_priorities_medium_access_list_name_destroy(
788 struct nb_cb_destroy_args
*args
)
790 struct isis_area
*area
;
791 struct spf_prefix_priority_acl
*ppa
;
793 if (args
->event
!= NB_EV_APPLY
)
796 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
798 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_MEDIUM
];
799 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
802 lsp_regenerate_schedule(area
, area
->is_type
, 0);
808 * XPath: /frr-isisd:isis/instance/area-password
810 void area_password_apply_finish(struct nb_cb_apply_finish_args
*args
)
812 const char *password
= yang_dnode_get_string(args
->dnode
, "./password");
813 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
814 int pass_type
= yang_dnode_get_enum(args
->dnode
, "./password-type");
816 yang_dnode_get_enum(args
->dnode
, "./authenticate-snp");
819 case ISIS_PASSWD_TYPE_CLEARTXT
:
820 isis_area_passwd_cleartext_set(area
, IS_LEVEL_1
, password
,
823 case ISIS_PASSWD_TYPE_HMAC_MD5
:
824 isis_area_passwd_hmac_md5_set(area
, IS_LEVEL_1
, password
,
830 int isis_instance_area_password_create(struct nb_cb_create_args
*args
)
832 /* actual setting is done in apply_finish */
836 int isis_instance_area_password_destroy(struct nb_cb_destroy_args
*args
)
838 struct isis_area
*area
;
840 if (args
->event
!= NB_EV_APPLY
)
843 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
844 isis_area_passwd_unset(area
, IS_LEVEL_1
);
850 * XPath: /frr-isisd:isis/instance/area-password/password
852 int isis_instance_area_password_password_modify(struct nb_cb_modify_args
*args
)
854 /* actual setting is done in apply_finish */
859 * XPath: /frr-isisd:isis/instance/area-password/password-type
861 int isis_instance_area_password_password_type_modify(
862 struct nb_cb_modify_args
*args
)
864 /* actual setting is done in apply_finish */
869 * XPath: /frr-isisd:isis/instance/area-password/authenticate-snp
871 int isis_instance_area_password_authenticate_snp_modify(
872 struct nb_cb_modify_args
*args
)
874 /* actual setting is done in apply_finish */
879 * XPath: /frr-isisd:isis/instance/domain-password
881 void domain_password_apply_finish(struct nb_cb_apply_finish_args
*args
)
883 const char *password
= yang_dnode_get_string(args
->dnode
, "./password");
884 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
885 int pass_type
= yang_dnode_get_enum(args
->dnode
, "./password-type");
887 yang_dnode_get_enum(args
->dnode
, "./authenticate-snp");
890 case ISIS_PASSWD_TYPE_CLEARTXT
:
891 isis_area_passwd_cleartext_set(area
, IS_LEVEL_2
, password
,
894 case ISIS_PASSWD_TYPE_HMAC_MD5
:
895 isis_area_passwd_hmac_md5_set(area
, IS_LEVEL_2
, password
,
901 int isis_instance_domain_password_create(struct nb_cb_create_args
*args
)
903 /* actual setting is done in apply_finish */
907 int isis_instance_domain_password_destroy(struct nb_cb_destroy_args
*args
)
909 struct isis_area
*area
;
911 if (args
->event
!= NB_EV_APPLY
)
914 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
915 isis_area_passwd_unset(area
, IS_LEVEL_2
);
921 * XPath: /frr-isisd:isis/instance/domain-password/password
923 int isis_instance_domain_password_password_modify(
924 struct nb_cb_modify_args
*args
)
926 /* actual setting is done in apply_finish */
931 * XPath: /frr-isisd:isis/instance/domain-password/password-type
933 int isis_instance_domain_password_password_type_modify(
934 struct nb_cb_modify_args
*args
)
936 /* actual setting is done in apply_finish */
941 * XPath: /frr-isisd:isis/instance/domain-password/authenticate-snp
943 int isis_instance_domain_password_authenticate_snp_modify(
944 struct nb_cb_modify_args
*args
)
946 /* actual setting is done in apply_finish */
951 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4
953 void default_info_origin_apply_finish(const struct lyd_node
*dnode
, int family
)
955 int originate_type
= DEFAULT_ORIGINATE
;
956 unsigned long metric
= 0;
957 const char *routemap
= NULL
;
958 struct isis_area
*area
= nb_running_get_entry(dnode
, NULL
, true);
959 int level
= yang_dnode_get_enum(dnode
, "./level");
961 if (yang_dnode_get_bool(dnode
, "./always")) {
962 originate_type
= DEFAULT_ORIGINATE_ALWAYS
;
963 } else if (family
== AF_INET6
) {
965 "%s: Zebra doesn't implement default-originate for IPv6 yet, so use with care or use default-originate always.",
969 if (yang_dnode_exists(dnode
, "./metric"))
970 metric
= yang_dnode_get_uint32(dnode
, "./metric");
971 if (yang_dnode_exists(dnode
, "./route-map"))
972 routemap
= yang_dnode_get_string(dnode
, "./route-map");
974 isis_redist_set(area
, level
, family
, DEFAULT_ROUTE
, metric
, routemap
,
978 void default_info_origin_ipv4_apply_finish(struct nb_cb_apply_finish_args
*args
)
980 default_info_origin_apply_finish(args
->dnode
, AF_INET
);
983 void default_info_origin_ipv6_apply_finish(struct nb_cb_apply_finish_args
*args
)
985 default_info_origin_apply_finish(args
->dnode
, AF_INET6
);
988 int isis_instance_default_information_originate_ipv4_create(
989 struct nb_cb_create_args
*args
)
991 /* It's all done by default_info_origin_apply_finish */
995 int isis_instance_default_information_originate_ipv4_destroy(
996 struct nb_cb_destroy_args
*args
)
998 struct isis_area
*area
;
1001 if (args
->event
!= NB_EV_APPLY
)
1004 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1005 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1006 isis_redist_unset(area
, level
, AF_INET
, DEFAULT_ROUTE
);
1012 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/always
1014 int isis_instance_default_information_originate_ipv4_always_modify(
1015 struct nb_cb_modify_args
*args
)
1017 /* It's all done by default_info_origin_apply_finish */
1022 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/route-map
1024 int isis_instance_default_information_originate_ipv4_route_map_modify(
1025 struct nb_cb_modify_args
*args
)
1027 /* It's all done by default_info_origin_apply_finish */
1031 int isis_instance_default_information_originate_ipv4_route_map_destroy(
1032 struct nb_cb_destroy_args
*args
)
1034 /* It's all done by default_info_origin_apply_finish */
1039 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/metric
1041 int isis_instance_default_information_originate_ipv4_metric_modify(
1042 struct nb_cb_modify_args
*args
)
1044 /* It's all done by default_info_origin_apply_finish */
1049 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6
1051 int isis_instance_default_information_originate_ipv6_create(
1052 struct nb_cb_create_args
*args
)
1054 /* It's all done by default_info_origin_apply_finish */
1058 int isis_instance_default_information_originate_ipv6_destroy(
1059 struct nb_cb_destroy_args
*args
)
1061 struct isis_area
*area
;
1064 if (args
->event
!= NB_EV_APPLY
)
1067 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1068 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1069 isis_redist_unset(area
, level
, AF_INET6
, DEFAULT_ROUTE
);
1075 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/always
1077 int isis_instance_default_information_originate_ipv6_always_modify(
1078 struct nb_cb_modify_args
*args
)
1080 /* It's all done by default_info_origin_apply_finish */
1085 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/route-map
1087 int isis_instance_default_information_originate_ipv6_route_map_modify(
1088 struct nb_cb_modify_args
*args
)
1090 /* It's all done by default_info_origin_apply_finish */
1094 int isis_instance_default_information_originate_ipv6_route_map_destroy(
1095 struct nb_cb_destroy_args
*args
)
1097 /* It's all done by default_info_origin_apply_finish */
1102 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/metric
1104 int isis_instance_default_information_originate_ipv6_metric_modify(
1105 struct nb_cb_modify_args
*args
)
1107 /* It's all done by default_info_origin_apply_finish */
1112 * XPath: /frr-isisd:isis/instance/redistribute/ipv4
1114 void redistribute_apply_finish(const struct lyd_node
*dnode
, int family
)
1116 assert(family
== AF_INET
|| family
== AF_INET6
);
1118 unsigned long metric
= 0;
1119 const char *routemap
= NULL
;
1120 struct isis_area
*area
;
1122 type
= yang_dnode_get_enum(dnode
, "./protocol");
1123 level
= yang_dnode_get_enum(dnode
, "./level");
1124 area
= nb_running_get_entry(dnode
, NULL
, true);
1126 if (yang_dnode_exists(dnode
, "./metric"))
1127 metric
= yang_dnode_get_uint32(dnode
, "./metric");
1128 if (yang_dnode_exists(dnode
, "./route-map"))
1129 routemap
= yang_dnode_get_string(dnode
, "./route-map");
1131 isis_redist_set(area
, level
, family
, type
, metric
, routemap
, 0);
1134 void redistribute_ipv4_apply_finish(struct nb_cb_apply_finish_args
*args
)
1136 redistribute_apply_finish(args
->dnode
, AF_INET
);
1139 void redistribute_ipv6_apply_finish(struct nb_cb_apply_finish_args
*args
)
1141 redistribute_apply_finish(args
->dnode
, AF_INET6
);
1144 int isis_instance_redistribute_ipv4_create(struct nb_cb_create_args
*args
)
1146 /* It's all done by redistribute_apply_finish */
1150 int isis_instance_redistribute_ipv4_destroy(struct nb_cb_destroy_args
*args
)
1152 struct isis_area
*area
;
1155 if (args
->event
!= NB_EV_APPLY
)
1158 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1159 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1160 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
1161 isis_redist_unset(area
, level
, AF_INET
, type
);
1167 * XPath: /frr-isisd:isis/instance/redistribute/ipv4/route-map
1169 int isis_instance_redistribute_ipv4_route_map_modify(
1170 struct nb_cb_modify_args
*args
)
1172 /* It's all done by redistribute_apply_finish */
1176 int isis_instance_redistribute_ipv4_route_map_destroy(
1177 struct nb_cb_destroy_args
*args
)
1179 /* It's all done by redistribute_apply_finish */
1184 * XPath: /frr-isisd:isis/instance/redistribute/ipv4/metric
1186 int isis_instance_redistribute_ipv4_metric_modify(
1187 struct nb_cb_modify_args
*args
)
1189 /* It's all done by redistribute_apply_finish */
1194 * XPath: /frr-isisd:isis/instance/redistribute/ipv6
1196 int isis_instance_redistribute_ipv6_create(struct nb_cb_create_args
*args
)
1198 /* It's all done by redistribute_apply_finish */
1202 int isis_instance_redistribute_ipv6_destroy(struct nb_cb_destroy_args
*args
)
1204 struct isis_area
*area
;
1207 if (args
->event
!= NB_EV_APPLY
)
1210 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1211 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1212 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
1213 isis_redist_unset(area
, level
, AF_INET6
, type
);
1219 * XPath: /frr-isisd:isis/instance/redistribute/ipv6/route-map
1221 int isis_instance_redistribute_ipv6_route_map_modify(
1222 struct nb_cb_modify_args
*args
)
1224 /* It's all done by redistribute_apply_finish */
1228 int isis_instance_redistribute_ipv6_route_map_destroy(
1229 struct nb_cb_destroy_args
*args
)
1231 /* It's all done by redistribute_apply_finish */
1236 * XPath: /frr-isisd:isis/instance/redistribute/ipv6/metric
1238 int isis_instance_redistribute_ipv6_metric_modify(
1239 struct nb_cb_modify_args
*args
)
1241 /* It's all done by redistribute_apply_finish */
1246 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-multicast
1248 static int isis_multi_topology_common(enum nb_event event
,
1249 const struct lyd_node
*dnode
,
1250 char *errmsg
, size_t errmsg_len
,
1251 const char *topology
, bool create
)
1253 struct isis_area
*area
;
1254 struct isis_area_mt_setting
*setting
;
1255 uint16_t mtid
= isis_str2mtid(topology
);
1258 case NB_EV_VALIDATE
:
1259 if (mtid
== (uint16_t)-1) {
1260 snprintf(errmsg
, errmsg_len
, "Unknown topology %s",
1262 return NB_ERR_VALIDATION
;
1269 area
= nb_running_get_entry(dnode
, NULL
, true);
1270 setting
= area_get_mt_setting(area
, mtid
);
1271 setting
->enabled
= create
;
1272 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1279 static int isis_multi_topology_overload_common(enum nb_event event
,
1280 const struct lyd_node
*dnode
,
1281 const char *topology
)
1283 struct isis_area
*area
;
1284 struct isis_area_mt_setting
*setting
;
1285 uint16_t mtid
= isis_str2mtid(topology
);
1287 /* validation is done in isis_multi_topology_common */
1288 if (event
!= NB_EV_APPLY
)
1291 area
= nb_running_get_entry(dnode
, NULL
, true);
1292 setting
= area_get_mt_setting(area
, mtid
);
1293 setting
->overload
= yang_dnode_get_bool(dnode
, NULL
);
1294 if (setting
->enabled
)
1295 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1300 int isis_instance_multi_topology_ipv4_multicast_create(
1301 struct nb_cb_create_args
*args
)
1303 return isis_multi_topology_common(args
->event
, args
->dnode
,
1304 args
->errmsg
, args
->errmsg_len
,
1305 "ipv4-multicast", true);
1308 int isis_instance_multi_topology_ipv4_multicast_destroy(
1309 struct nb_cb_destroy_args
*args
)
1311 return isis_multi_topology_common(args
->event
, args
->dnode
,
1312 args
->errmsg
, args
->errmsg_len
,
1313 "ipv4-multicast", false);
1317 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-multicast/overload
1319 int isis_instance_multi_topology_ipv4_multicast_overload_modify(
1320 struct nb_cb_modify_args
*args
)
1322 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1327 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-management
1329 int isis_instance_multi_topology_ipv4_management_create(
1330 struct nb_cb_create_args
*args
)
1332 return isis_multi_topology_common(args
->event
, args
->dnode
,
1333 args
->errmsg
, args
->errmsg_len
,
1337 int isis_instance_multi_topology_ipv4_management_destroy(
1338 struct nb_cb_destroy_args
*args
)
1340 return isis_multi_topology_common(args
->event
, args
->dnode
,
1341 args
->errmsg
, args
->errmsg_len
,
1342 "ipv4-mgmt", false);
1346 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-management/overload
1348 int isis_instance_multi_topology_ipv4_management_overload_modify(
1349 struct nb_cb_modify_args
*args
)
1351 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1356 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-unicast
1358 int isis_instance_multi_topology_ipv6_unicast_create(
1359 struct nb_cb_create_args
*args
)
1361 return isis_multi_topology_common(args
->event
, args
->dnode
,
1362 args
->errmsg
, args
->errmsg_len
,
1363 "ipv6-unicast", true);
1366 int isis_instance_multi_topology_ipv6_unicast_destroy(
1367 struct nb_cb_destroy_args
*args
)
1369 return isis_multi_topology_common(args
->event
, args
->dnode
,
1370 args
->errmsg
, args
->errmsg_len
,
1371 "ipv6-unicast", false);
1375 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-unicast/overload
1377 int isis_instance_multi_topology_ipv6_unicast_overload_modify(
1378 struct nb_cb_modify_args
*args
)
1380 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1385 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-multicast
1387 int isis_instance_multi_topology_ipv6_multicast_create(
1388 struct nb_cb_create_args
*args
)
1390 return isis_multi_topology_common(args
->event
, args
->dnode
,
1391 args
->errmsg
, args
->errmsg_len
,
1392 "ipv6-multicast", true);
1395 int isis_instance_multi_topology_ipv6_multicast_destroy(
1396 struct nb_cb_destroy_args
*args
)
1398 return isis_multi_topology_common(args
->event
, args
->dnode
,
1399 args
->errmsg
, args
->errmsg_len
,
1400 "ipv6-multicast", false);
1404 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-multicast/overload
1406 int isis_instance_multi_topology_ipv6_multicast_overload_modify(
1407 struct nb_cb_modify_args
*args
)
1409 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1414 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-management
1416 int isis_instance_multi_topology_ipv6_management_create(
1417 struct nb_cb_create_args
*args
)
1419 return isis_multi_topology_common(args
->event
, args
->dnode
,
1420 args
->errmsg
, args
->errmsg_len
,
1424 int isis_instance_multi_topology_ipv6_management_destroy(
1425 struct nb_cb_destroy_args
*args
)
1427 return isis_multi_topology_common(args
->event
, args
->dnode
,
1428 args
->errmsg
, args
->errmsg_len
,
1429 "ipv6-mgmt", false);
1433 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-management/overload
1435 int isis_instance_multi_topology_ipv6_management_overload_modify(
1436 struct nb_cb_modify_args
*args
)
1438 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1443 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-dstsrc
1445 int isis_instance_multi_topology_ipv6_dstsrc_create(
1446 struct nb_cb_create_args
*args
)
1448 return isis_multi_topology_common(args
->event
, args
->dnode
,
1449 args
->errmsg
, args
->errmsg_len
,
1450 "ipv6-dstsrc", true);
1453 int isis_instance_multi_topology_ipv6_dstsrc_destroy(
1454 struct nb_cb_destroy_args
*args
)
1456 return isis_multi_topology_common(args
->event
, args
->dnode
,
1457 args
->errmsg
, args
->errmsg_len
,
1458 "ipv6-dstsrc", false);
1462 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-dstsrc/overload
1464 int isis_instance_multi_topology_ipv6_dstsrc_overload_modify(
1465 struct nb_cb_modify_args
*args
)
1467 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1472 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/load-sharing
1474 int isis_instance_fast_reroute_level_1_lfa_load_sharing_modify(
1475 struct nb_cb_modify_args
*args
)
1477 struct isis_area
*area
;
1479 if (args
->event
!= NB_EV_APPLY
)
1482 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1483 area
->lfa_load_sharing
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
1484 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1490 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/priority-limit
1492 int isis_instance_fast_reroute_level_1_lfa_priority_limit_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_priority_limit
[0] = yang_dnode_get_enum(args
->dnode
, NULL
);
1502 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1507 int isis_instance_fast_reroute_level_1_lfa_priority_limit_destroy(
1508 struct nb_cb_destroy_args
*args
)
1510 struct isis_area
*area
;
1512 if (args
->event
!= NB_EV_APPLY
)
1515 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1516 area
->lfa_priority_limit
[0] = SPF_PREFIX_PRIO_LOW
;
1517 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1523 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/tiebreaker
1525 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_create(
1526 struct nb_cb_create_args
*args
)
1528 struct isis_area
*area
;
1530 enum lfa_tiebreaker_type type
;
1531 struct lfa_tiebreaker
*tie_b
;
1533 if (args
->event
!= NB_EV_APPLY
)
1536 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1537 index
= yang_dnode_get_uint8(args
->dnode
, "./index");
1538 type
= yang_dnode_get_enum(args
->dnode
, "./type");
1540 tie_b
= isis_lfa_tiebreaker_add(area
, ISIS_LEVEL1
, index
, type
);
1541 nb_running_set_entry(args
->dnode
, tie_b
);
1542 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1547 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_destroy(
1548 struct nb_cb_destroy_args
*args
)
1550 struct lfa_tiebreaker
*tie_b
;
1551 struct isis_area
*area
;
1553 if (args
->event
!= NB_EV_APPLY
)
1556 tie_b
= nb_running_unset_entry(args
->dnode
);
1558 isis_lfa_tiebreaker_delete(area
, ISIS_LEVEL1
, tie_b
);
1559 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1565 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/tiebreaker/type
1567 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_type_modify(
1568 struct nb_cb_modify_args
*args
)
1570 struct lfa_tiebreaker
*tie_b
;
1571 struct isis_area
*area
;
1573 if (args
->event
!= NB_EV_APPLY
)
1576 tie_b
= nb_running_get_entry(args
->dnode
, NULL
, true);
1578 tie_b
->type
= yang_dnode_get_enum(args
->dnode
, NULL
);
1579 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1585 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/remote-lfa/prefix-list
1587 int isis_instance_fast_reroute_level_1_remote_lfa_prefix_list_modify(
1588 struct nb_cb_modify_args
*args
)
1590 struct isis_area
*area
;
1591 const char *plist_name
;
1593 if (args
->event
!= NB_EV_APPLY
)
1596 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1597 plist_name
= yang_dnode_get_string(args
->dnode
, NULL
);
1599 area
->rlfa_plist_name
[0] = XSTRDUP(MTYPE_ISIS_PLIST_NAME
, plist_name
);
1600 area
->rlfa_plist
[0] = prefix_list_lookup(AFI_IP
, plist_name
);
1601 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1606 int isis_instance_fast_reroute_level_1_remote_lfa_prefix_list_destroy(
1607 struct nb_cb_destroy_args
*args
)
1609 struct isis_area
*area
;
1611 if (args
->event
!= NB_EV_APPLY
)
1614 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1616 XFREE(MTYPE_ISIS_PLIST_NAME
, area
->rlfa_plist_name
[0]);
1617 area
->rlfa_plist
[0] = NULL
;
1618 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1624 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/load-sharing
1626 int isis_instance_fast_reroute_level_2_lfa_load_sharing_modify(
1627 struct nb_cb_modify_args
*args
)
1629 struct isis_area
*area
;
1631 if (args
->event
!= NB_EV_APPLY
)
1634 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1635 area
->lfa_load_sharing
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
1641 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/priority-limit
1643 int isis_instance_fast_reroute_level_2_lfa_priority_limit_modify(
1644 struct nb_cb_modify_args
*args
)
1646 struct isis_area
*area
;
1648 if (args
->event
!= NB_EV_APPLY
)
1651 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1652 area
->lfa_priority_limit
[1] = yang_dnode_get_enum(args
->dnode
, NULL
);
1657 int isis_instance_fast_reroute_level_2_lfa_priority_limit_destroy(
1658 struct nb_cb_destroy_args
*args
)
1660 struct isis_area
*area
;
1662 if (args
->event
!= NB_EV_APPLY
)
1665 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1666 area
->lfa_priority_limit
[1] = SPF_PREFIX_PRIO_LOW
;
1672 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/tiebreaker
1674 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_create(
1675 struct nb_cb_create_args
*args
)
1677 struct isis_area
*area
;
1679 enum lfa_tiebreaker_type type
;
1680 struct lfa_tiebreaker
*tie_b
;
1682 if (args
->event
!= NB_EV_APPLY
)
1685 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1686 index
= yang_dnode_get_uint8(args
->dnode
, "./index");
1687 type
= yang_dnode_get_enum(args
->dnode
, "./type");
1689 tie_b
= isis_lfa_tiebreaker_add(area
, ISIS_LEVEL2
, index
, type
);
1690 nb_running_set_entry(args
->dnode
, tie_b
);
1691 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1696 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_destroy(
1697 struct nb_cb_destroy_args
*args
)
1699 struct lfa_tiebreaker
*tie_b
;
1700 struct isis_area
*area
;
1702 if (args
->event
!= NB_EV_APPLY
)
1705 tie_b
= nb_running_unset_entry(args
->dnode
);
1707 isis_lfa_tiebreaker_delete(area
, ISIS_LEVEL2
, tie_b
);
1708 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1714 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/tiebreaker/type
1716 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_type_modify(
1717 struct nb_cb_modify_args
*args
)
1719 struct lfa_tiebreaker
*tie_b
;
1720 struct isis_area
*area
;
1722 if (args
->event
!= NB_EV_APPLY
)
1725 tie_b
= nb_running_get_entry(args
->dnode
, NULL
, true);
1727 tie_b
->type
= yang_dnode_get_enum(args
->dnode
, NULL
);
1728 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1734 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/remote-lfa/prefix-list
1736 int isis_instance_fast_reroute_level_2_remote_lfa_prefix_list_modify(
1737 struct nb_cb_modify_args
*args
)
1739 struct isis_area
*area
;
1740 const char *plist_name
;
1742 if (args
->event
!= NB_EV_APPLY
)
1745 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1746 plist_name
= yang_dnode_get_string(args
->dnode
, NULL
);
1748 area
->rlfa_plist_name
[1] = XSTRDUP(MTYPE_ISIS_PLIST_NAME
, plist_name
);
1749 area
->rlfa_plist
[1] = prefix_list_lookup(AFI_IP
, plist_name
);
1750 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1755 int isis_instance_fast_reroute_level_2_remote_lfa_prefix_list_destroy(
1756 struct nb_cb_destroy_args
*args
)
1758 struct isis_area
*area
;
1760 if (args
->event
!= NB_EV_APPLY
)
1763 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1765 XFREE(MTYPE_ISIS_PLIST_NAME
, area
->rlfa_plist_name
[1]);
1766 area
->rlfa_plist
[1] = NULL
;
1767 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1773 * XPath: /frr-isisd:isis/instance/log-adjacency-changes
1775 int isis_instance_log_adjacency_changes_modify(struct nb_cb_modify_args
*args
)
1777 struct isis_area
*area
;
1778 bool log
= yang_dnode_get_bool(args
->dnode
, NULL
);
1780 if (args
->event
!= NB_EV_APPLY
)
1783 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1784 area
->log_adj_changes
= log
? 1 : 0;
1790 * XPath: /frr-isisd:isis/instance/mpls-te
1792 int isis_instance_mpls_te_create(struct nb_cb_create_args
*args
)
1794 struct isis_area
*area
;
1796 if (args
->event
!= NB_EV_APPLY
)
1799 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1800 isis_mpls_te_create(area
);
1802 /* Reoriginate STD_TE & GMPLS circuits */
1803 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1808 int isis_instance_mpls_te_destroy(struct nb_cb_destroy_args
*args
)
1810 struct isis_area
*area
;
1812 if (args
->event
!= NB_EV_APPLY
)
1815 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1816 if (!IS_MPLS_TE(area
->mta
))
1819 isis_mpls_te_disable(area
);
1821 /* Reoriginate STD_TE & GMPLS circuits */
1822 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1824 zlog_debug("ISIS-TE(%s): Disabled MPLS Traffic Engineering",
1831 * XPath: /frr-isisd:isis/instance/mpls-te/router-address
1833 int isis_instance_mpls_te_router_address_modify(struct nb_cb_modify_args
*args
)
1835 struct in_addr value
;
1836 struct isis_area
*area
;
1838 if (args
->event
!= NB_EV_APPLY
)
1841 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1842 /* only proceed if MPLS-TE is enabled */
1843 if (!IS_MPLS_TE(area
->mta
))
1846 /* Update Area Router ID */
1847 yang_dnode_get_ipv4(&value
, args
->dnode
, NULL
);
1848 area
->mta
->router_id
.s_addr
= value
.s_addr
;
1850 /* And re-schedule LSP update */
1851 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1856 int isis_instance_mpls_te_router_address_destroy(
1857 struct nb_cb_destroy_args
*args
)
1859 struct isis_area
*area
;
1861 if (args
->event
!= NB_EV_APPLY
)
1864 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1865 /* only proceed if MPLS-TE is enabled */
1866 if (!IS_MPLS_TE(area
->mta
))
1869 /* Reset Area Router ID */
1870 area
->mta
->router_id
.s_addr
= INADDR_ANY
;
1872 /* And re-schedule LSP update */
1873 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1879 * XPath: /frr-isisd:isis/instance/mpls-te/router-address-v6
1881 int isis_instance_mpls_te_router_address_ipv6_modify(
1882 struct nb_cb_modify_args
*args
)
1884 struct in6_addr value
;
1885 struct isis_area
*area
;
1887 if (args
->event
!= NB_EV_APPLY
)
1890 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1891 /* only proceed if MPLS-TE is enabled */
1892 if (!IS_MPLS_TE(area
->mta
))
1895 yang_dnode_get_ipv6(&value
, args
->dnode
, NULL
);
1896 /* Update Area IPv6 Router ID if different */
1897 if (!IPV6_ADDR_SAME(&area
->mta
->router_id_ipv6
, &value
)) {
1898 IPV6_ADDR_COPY(&area
->mta
->router_id_ipv6
, &value
);
1900 /* And re-schedule LSP update */
1901 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1907 int isis_instance_mpls_te_router_address_ipv6_destroy(
1908 struct nb_cb_destroy_args
*args
)
1910 struct isis_area
*area
;
1912 if (args
->event
!= NB_EV_APPLY
)
1915 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1916 /* only proceed if MPLS-TE is enabled */
1917 if (!IS_MPLS_TE(area
->mta
))
1920 /* Reset Area Router ID */
1921 IPV6_ADDR_COPY(&area
->mta
->router_id_ipv6
, &in6addr_any
);
1923 /* And re-schedule LSP update */
1924 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1930 * XPath: /frr-isisd:isis/instance/mpls-te/export
1932 int isis_instance_mpls_te_export_modify(struct nb_cb_modify_args
*args
)
1934 struct isis_area
*area
;
1936 if (args
->event
!= NB_EV_APPLY
)
1939 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1940 /* only proceed if MPLS-TE is enabled */
1941 if (!IS_MPLS_TE(area
->mta
))
1944 area
->mta
->export
= yang_dnode_get_bool(args
->dnode
, NULL
);
1945 if (area
->mta
->export
) {
1946 if (IS_DEBUG_EVENTS
)
1947 zlog_debug("MPLS-TE: Enabled Link State export");
1948 if (isis_zebra_ls_register(true) != 0)
1949 zlog_warn("Unable to register Link State");
1951 if (IS_DEBUG_EVENTS
)
1952 zlog_debug("MPLS-TE: Disable Link State export");
1953 if (isis_zebra_ls_register(false) != 0)
1954 zlog_warn("Unable to register Link State");
1961 * XPath: /frr-isisd:isis/instance/segment-routing/enabled
1963 int isis_instance_segment_routing_enabled_modify(
1964 struct nb_cb_modify_args
*args
)
1966 struct isis_area
*area
;
1968 if (args
->event
!= NB_EV_APPLY
)
1971 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1972 area
->srdb
.config
.enabled
= yang_dnode_get_bool(args
->dnode
, NULL
);
1974 if (area
->srdb
.config
.enabled
) {
1975 if (IS_DEBUG_EVENTS
)
1976 zlog_debug("SR: Segment Routing: OFF -> ON");
1978 isis_sr_start(area
);
1980 if (IS_DEBUG_EVENTS
)
1981 zlog_debug("SR: Segment Routing: ON -> OFF");
1990 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks
1992 int isis_instance_segment_routing_label_blocks_pre_validate(
1993 struct nb_cb_pre_validate_args
*args
)
1995 uint32_t srgb_lbound
;
1996 uint32_t srgb_ubound
;
1997 uint32_t srlb_lbound
;
1998 uint32_t srlb_ubound
;
2000 srgb_lbound
= yang_dnode_get_uint32(args
->dnode
, "./srgb/lower-bound");
2001 srgb_ubound
= yang_dnode_get_uint32(args
->dnode
, "./srgb/upper-bound");
2002 srlb_lbound
= yang_dnode_get_uint32(args
->dnode
, "./srlb/lower-bound");
2003 srlb_ubound
= yang_dnode_get_uint32(args
->dnode
, "./srlb/upper-bound");
2005 /* Check that the block size does not exceed 65535 */
2006 if ((srgb_ubound
- srgb_lbound
+ 1) > 65535) {
2008 args
->errmsg
, args
->errmsg_len
,
2009 "New SR Global Block (%u/%u) exceed the limit of 65535",
2010 srgb_lbound
, srgb_ubound
);
2011 return NB_ERR_VALIDATION
;
2013 if ((srlb_ubound
- srlb_lbound
+ 1) > 65535) {
2014 snprintf(args
->errmsg
, args
->errmsg_len
,
2015 "New SR Local Block (%u/%u) exceed the limit of 65535",
2016 srlb_lbound
, srlb_ubound
);
2017 return NB_ERR_VALIDATION
;
2020 /* Validate SRGB against SRLB */
2021 if (!((srgb_ubound
< srlb_lbound
) || (srgb_lbound
> srlb_ubound
))) {
2023 args
->errmsg
, args
->errmsg_len
,
2024 "SR Global Block (%u/%u) conflicts with Local Block (%u/%u)",
2025 srgb_lbound
, srgb_ubound
, srlb_lbound
, srlb_ubound
);
2026 return NB_ERR_VALIDATION
;
2033 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb
2036 void isis_instance_segment_routing_srgb_apply_finish(
2037 struct nb_cb_apply_finish_args
*args
)
2039 struct isis_area
*area
;
2040 uint32_t lower_bound
, upper_bound
;
2042 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2043 lower_bound
= yang_dnode_get_uint32(args
->dnode
, "./lower-bound");
2044 upper_bound
= yang_dnode_get_uint32(args
->dnode
, "./upper-bound");
2046 isis_sr_cfg_srgb_update(area
, lower_bound
, upper_bound
);
2050 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb/lower-bound
2052 int isis_instance_segment_routing_srgb_lower_bound_modify(
2053 struct nb_cb_modify_args
*args
)
2055 uint32_t lower_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2057 switch (args
->event
) {
2058 case NB_EV_VALIDATE
:
2059 if (!IS_MPLS_UNRESERVED_LABEL(lower_bound
)) {
2060 snprintf(args
->errmsg
, args
->errmsg_len
,
2061 "Invalid SRGB lower bound: %u", lower_bound
);
2062 return NB_ERR_VALIDATION
;
2075 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb/upper-bound
2077 int isis_instance_segment_routing_srgb_upper_bound_modify(
2078 struct nb_cb_modify_args
*args
)
2080 uint32_t upper_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2082 switch (args
->event
) {
2083 case NB_EV_VALIDATE
:
2084 if (!IS_MPLS_UNRESERVED_LABEL(upper_bound
)) {
2085 snprintf(args
->errmsg
, args
->errmsg_len
,
2086 "Invalid SRGB upper bound: %u", upper_bound
);
2087 return NB_ERR_VALIDATION
;
2100 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb
2102 void isis_instance_segment_routing_srlb_apply_finish(
2103 struct nb_cb_apply_finish_args
*args
)
2105 struct isis_area
*area
;
2106 uint32_t lower_bound
, upper_bound
;
2108 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2109 lower_bound
= yang_dnode_get_uint32(args
->dnode
, "./lower-bound");
2110 upper_bound
= yang_dnode_get_uint32(args
->dnode
, "./upper-bound");
2112 isis_sr_cfg_srlb_update(area
, lower_bound
, upper_bound
);
2116 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb/lower-bound
2118 int isis_instance_segment_routing_srlb_lower_bound_modify(
2119 struct nb_cb_modify_args
*args
)
2121 uint32_t lower_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2123 switch (args
->event
) {
2124 case NB_EV_VALIDATE
:
2125 if (!IS_MPLS_UNRESERVED_LABEL(lower_bound
)) {
2126 snprintf(args
->errmsg
, args
->errmsg_len
,
2127 "Invalid SRLB lower bound: %u", lower_bound
);
2128 return NB_ERR_VALIDATION
;
2141 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb/upper-bound
2143 int isis_instance_segment_routing_srlb_upper_bound_modify(
2144 struct nb_cb_modify_args
*args
)
2146 uint32_t upper_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2148 switch (args
->event
) {
2149 case NB_EV_VALIDATE
:
2150 if (!IS_MPLS_UNRESERVED_LABEL(upper_bound
)) {
2151 snprintf(args
->errmsg
, args
->errmsg_len
,
2152 "Invalid SRLB upper bound: %u", upper_bound
);
2153 return NB_ERR_VALIDATION
;
2166 * XPath: /frr-isisd:isis/instance/segment-routing/msd/node-msd
2168 int isis_instance_segment_routing_msd_node_msd_modify(
2169 struct nb_cb_modify_args
*args
)
2171 struct isis_area
*area
;
2173 if (args
->event
!= NB_EV_APPLY
)
2176 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2177 area
->srdb
.config
.msd
= yang_dnode_get_uint8(args
->dnode
, NULL
);
2179 /* Update and regenerate LSP */
2180 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2185 int isis_instance_segment_routing_msd_node_msd_destroy(
2186 struct nb_cb_destroy_args
*args
)
2188 struct isis_area
*area
;
2190 if (args
->event
!= NB_EV_APPLY
)
2193 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2194 area
->srdb
.config
.msd
= 0;
2196 /* Update and regenerate LSP */
2197 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2203 * XPath: /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid
2205 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_create(
2206 struct nb_cb_create_args
*args
)
2208 struct isis_area
*area
;
2209 struct prefix prefix
;
2210 struct sr_prefix_cfg
*pcfg
;
2212 if (args
->event
!= NB_EV_APPLY
)
2215 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2216 yang_dnode_get_prefix(&prefix
, args
->dnode
, "./prefix");
2218 pcfg
= isis_sr_cfg_prefix_add(area
, &prefix
);
2219 nb_running_set_entry(args
->dnode
, pcfg
);
2224 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_destroy(
2225 struct nb_cb_destroy_args
*args
)
2227 struct sr_prefix_cfg
*pcfg
;
2228 struct isis_area
*area
;
2230 if (args
->event
!= NB_EV_APPLY
)
2233 pcfg
= nb_running_unset_entry(args
->dnode
);
2235 isis_sr_cfg_prefix_del(pcfg
);
2236 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2241 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_pre_validate(
2242 struct nb_cb_pre_validate_args
*args
)
2244 const struct lyd_node
*area_dnode
;
2245 struct isis_area
*area
;
2246 struct prefix prefix
;
2247 uint32_t srgb_lbound
;
2248 uint32_t srgb_ubound
;
2249 uint32_t srgb_range
;
2251 enum sr_sid_value_type sid_type
;
2252 struct isis_prefix_sid psid
= {};
2254 yang_dnode_get_prefix(&prefix
, args
->dnode
, "./prefix");
2255 srgb_lbound
= yang_dnode_get_uint32(
2256 args
->dnode
, "../../label-blocks/srgb/lower-bound");
2257 srgb_ubound
= yang_dnode_get_uint32(
2258 args
->dnode
, "../../label-blocks/srgb/upper-bound");
2259 sid
= yang_dnode_get_uint32(args
->dnode
, "./sid-value");
2260 sid_type
= yang_dnode_get_enum(args
->dnode
, "./sid-value-type");
2262 /* Check for invalid indexes/labels. */
2263 srgb_range
= srgb_ubound
- srgb_lbound
+ 1;
2266 case SR_SID_VALUE_TYPE_INDEX
:
2267 if (sid
>= srgb_range
) {
2268 snprintf(args
->errmsg
, args
->errmsg_len
,
2269 "SID index %u falls outside local SRGB range",
2271 return NB_ERR_VALIDATION
;
2274 case SR_SID_VALUE_TYPE_ABSOLUTE
:
2275 if (!IS_MPLS_UNRESERVED_LABEL(sid
)) {
2276 snprintf(args
->errmsg
, args
->errmsg_len
,
2277 "Invalid absolute SID %u", sid
);
2278 return NB_ERR_VALIDATION
;
2280 SET_FLAG(psid
.flags
, ISIS_PREFIX_SID_VALUE
);
2281 SET_FLAG(psid
.flags
, ISIS_PREFIX_SID_LOCAL
);
2285 /* Check for Prefix-SID collisions. */
2286 area_dnode
= yang_dnode_get_parent(args
->dnode
, "instance");
2287 area
= nb_running_get_entry(area_dnode
, NULL
, false);
2289 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
2290 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVEL2
;
2292 struct isis_spftree
*spftree
;
2293 struct isis_vertex
*vertex_psid
;
2295 if (!(area
->is_type
& level
))
2297 spftree
= area
->spftree
[tree
][level
- 1];
2301 vertex_psid
= isis_spf_prefix_sid_lookup(
2304 && !prefix_same(&vertex_psid
->N
.ip
.p
.dest
,
2307 args
->errmsg
, args
->errmsg_len
,
2308 "Prefix-SID collision detected, SID %s %u is already in use by prefix %pFX (L%u)",
2311 ISIS_PREFIX_SID_VALUE
)
2315 &vertex_psid
->N
.ip
.p
.dest
,
2317 return NB_ERR_VALIDATION
;
2326 void isis_instance_segment_routing_prefix_sid_map_prefix_sid_apply_finish(
2327 struct nb_cb_apply_finish_args
*args
)
2329 struct sr_prefix_cfg
*pcfg
;
2330 struct isis_area
*area
;
2332 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2334 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2339 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/sid-value-type
2341 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_sid_value_type_modify(
2342 struct nb_cb_modify_args
*args
)
2344 struct sr_prefix_cfg
*pcfg
;
2346 if (args
->event
!= NB_EV_APPLY
)
2349 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2350 pcfg
->sid_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2357 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/sid-value
2359 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_sid_value_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
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2375 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/last-hop-behavior
2377 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_last_hop_behavior_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
->last_hop_behavior
= yang_dnode_get_enum(args
->dnode
, NULL
);
2392 * XPath: /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/n-flag-clear
2394 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_n_flag_clear_modify(
2395 struct nb_cb_modify_args
*args
)
2397 struct sr_prefix_cfg
*pcfg
;
2399 if (args
->event
!= NB_EV_APPLY
)
2402 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2403 pcfg
->n_flag_clear
= yang_dnode_get_bool(args
->dnode
, NULL
);
2409 * XPath: /frr-isisd:isis/instance/mpls/ldp-sync
2411 int isis_instance_mpls_ldp_sync_create(struct nb_cb_create_args
*args
)
2413 struct isis_area
*area
;
2414 const char *vrfname
;
2416 switch (args
->event
) {
2417 case NB_EV_VALIDATE
:
2418 vrfname
= yang_dnode_get_string(
2419 lyd_parent(lyd_parent(args
->dnode
)), "./vrf");
2421 if (strcmp(vrfname
, VRF_DEFAULT_NAME
)) {
2422 snprintf(args
->errmsg
, args
->errmsg_len
,
2423 "LDP-Sync only runs on Default VRF");
2424 return NB_ERR_VALIDATION
;
2431 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2432 isis_area_ldp_sync_enable(area
);
2438 int isis_instance_mpls_ldp_sync_destroy(struct nb_cb_destroy_args
*args
)
2440 struct isis_area
*area
;
2442 if (args
->event
!= NB_EV_APPLY
)
2445 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2446 isis_area_ldp_sync_disable(area
);
2452 * XPath: /frr-isisd:isis/instance/mpls/ldp-sync/holddown
2454 int isis_instance_mpls_ldp_sync_holddown_modify(struct nb_cb_modify_args
*args
)
2456 struct isis_area
*area
;
2458 const char *vrfname
;
2460 switch (args
->event
) {
2461 case NB_EV_VALIDATE
:
2462 vrfname
= yang_dnode_get_string(
2463 lyd_parent(lyd_parent(lyd_parent(args
->dnode
))),
2466 if (strcmp(vrfname
, VRF_DEFAULT_NAME
)) {
2467 snprintf(args
->errmsg
, args
->errmsg_len
,
2468 "LDP-Sync only runs on Default VRF");
2469 return NB_ERR_VALIDATION
;
2476 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2477 holddown
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2478 isis_area_ldp_sync_set_holddown(area
, holddown
);
2485 * XPath: /frr-interface:lib/interface/frr-isisd:isis
2487 int lib_interface_isis_create(struct nb_cb_create_args
*args
)
2489 struct interface
*ifp
;
2490 struct isis_circuit
*circuit
= NULL
;
2491 const char *area_tag
= yang_dnode_get_string(args
->dnode
, "./area-tag");
2493 switch (args
->event
) {
2496 case NB_EV_VALIDATE
:
2499 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
2500 circuit
= isis_circuit_new(ifp
, area_tag
);
2501 nb_running_set_entry(args
->dnode
, circuit
);
2508 int lib_interface_isis_destroy(struct nb_cb_destroy_args
*args
)
2510 struct isis_circuit
*circuit
;
2512 if (args
->event
!= NB_EV_APPLY
)
2515 circuit
= nb_running_unset_entry(args
->dnode
);
2517 isis_circuit_del(circuit
);
2523 * XPath: /frr-interface:lib/interface/frr-isisd:isis/area-tag
2525 int lib_interface_isis_area_tag_modify(struct nb_cb_modify_args
*args
)
2527 struct isis_circuit
*circuit
;
2529 if (args
->event
== NB_EV_VALIDATE
) {
2530 circuit
= nb_running_get_entry_non_rec(lyd_parent(args
->dnode
), NULL
, false);
2532 snprintf(args
->errmsg
, args
->errmsg_len
,
2533 "Changing area tag is not allowed");
2534 return NB_ERR_VALIDATION
;
2542 * XPath: /frr-interface:lib/interface/frr-isisd:isis/circuit-type
2544 int lib_interface_isis_circuit_type_modify(struct nb_cb_modify_args
*args
)
2546 int circ_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2547 struct isis_circuit
*circuit
;
2549 switch (args
->event
) {
2550 case NB_EV_VALIDATE
:
2555 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2556 circuit
->is_type_config
= circ_type
;
2557 isis_circuit_is_type_set(circuit
, circ_type
);
2565 * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv4-routing
2567 int lib_interface_isis_ipv4_routing_modify(struct nb_cb_modify_args
*args
)
2570 struct isis_circuit
*circuit
;
2572 if (args
->event
!= NB_EV_APPLY
)
2575 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2576 ipv4
= yang_dnode_get_bool(args
->dnode
, NULL
);
2577 ipv6
= yang_dnode_get_bool(args
->dnode
, "../ipv6-routing");
2578 isis_circuit_af_set(circuit
, ipv4
, ipv6
);
2584 * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv6-routing
2586 int lib_interface_isis_ipv6_routing_modify(struct nb_cb_modify_args
*args
)
2589 struct isis_circuit
*circuit
;
2591 if (args
->event
!= NB_EV_APPLY
)
2594 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2595 ipv4
= yang_dnode_get_bool(args
->dnode
, "../ipv4-routing");
2596 ipv6
= yang_dnode_get_bool(args
->dnode
, NULL
);
2597 isis_circuit_af_set(circuit
, ipv4
, ipv6
);
2603 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring
2605 void lib_interface_isis_bfd_monitoring_apply_finish(
2606 struct nb_cb_apply_finish_args
*args
)
2608 struct isis_circuit
*circuit
;
2610 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2611 isis_bfd_circuit_cmd(circuit
);
2615 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring/enabled
2617 int lib_interface_isis_bfd_monitoring_enabled_modify(
2618 struct nb_cb_modify_args
*args
)
2620 struct isis_circuit
*circuit
;
2622 if (args
->event
!= NB_EV_APPLY
)
2625 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2626 circuit
->bfd_config
.enabled
= yang_dnode_get_bool(args
->dnode
, NULL
);
2632 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring/profile
2634 int lib_interface_isis_bfd_monitoring_profile_modify(
2635 struct nb_cb_modify_args
*args
)
2637 struct isis_circuit
*circuit
;
2639 if (args
->event
!= NB_EV_APPLY
)
2642 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2643 XFREE(MTYPE_TMP
, circuit
->bfd_config
.profile
);
2644 circuit
->bfd_config
.profile
=
2645 XSTRDUP(MTYPE_TMP
, yang_dnode_get_string(args
->dnode
, NULL
));
2650 int lib_interface_isis_bfd_monitoring_profile_destroy(
2651 struct nb_cb_destroy_args
*args
)
2653 struct isis_circuit
*circuit
;
2655 if (args
->event
!= NB_EV_APPLY
)
2658 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2659 XFREE(MTYPE_TMP
, circuit
->bfd_config
.profile
);
2665 * XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-1
2667 int lib_interface_isis_csnp_interval_level_1_modify(
2668 struct nb_cb_modify_args
*args
)
2670 struct isis_circuit
*circuit
;
2672 if (args
->event
!= NB_EV_APPLY
)
2675 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2676 circuit
->csnp_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2682 * XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-2
2684 int lib_interface_isis_csnp_interval_level_2_modify(
2685 struct nb_cb_modify_args
*args
)
2687 struct isis_circuit
*circuit
;
2689 if (args
->event
!= NB_EV_APPLY
)
2692 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2693 circuit
->csnp_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2699 * XPath: /frr-interface:lib/interface/frr-isisd:isis/psnp-interval/level-1
2701 int lib_interface_isis_psnp_interval_level_1_modify(
2702 struct nb_cb_modify_args
*args
)
2704 struct isis_circuit
*circuit
;
2706 if (args
->event
!= NB_EV_APPLY
)
2709 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2710 circuit
->psnp_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2716 * XPath: /frr-interface:lib/interface/frr-isisd:isis/psnp-interval/level-2
2718 int lib_interface_isis_psnp_interval_level_2_modify(
2719 struct nb_cb_modify_args
*args
)
2721 struct isis_circuit
*circuit
;
2723 if (args
->event
!= NB_EV_APPLY
)
2726 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2727 circuit
->psnp_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2733 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/padding
2735 int lib_interface_isis_hello_padding_modify(struct nb_cb_modify_args
*args
)
2737 struct isis_circuit
*circuit
;
2739 if (args
->event
!= NB_EV_APPLY
)
2742 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2743 circuit
->pad_hellos
= yang_dnode_get_bool(args
->dnode
, NULL
);
2749 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/interval/level-1
2751 int lib_interface_isis_hello_interval_level_1_modify(
2752 struct nb_cb_modify_args
*args
)
2754 struct isis_circuit
*circuit
;
2757 if (args
->event
!= NB_EV_APPLY
)
2760 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2761 interval
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2762 circuit
->hello_interval
[0] = interval
;
2768 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/interval/level-2
2770 int lib_interface_isis_hello_interval_level_2_modify(
2771 struct nb_cb_modify_args
*args
)
2773 struct isis_circuit
*circuit
;
2776 if (args
->event
!= NB_EV_APPLY
)
2779 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2780 interval
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2781 circuit
->hello_interval
[1] = interval
;
2787 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/multiplier/level-1
2789 int lib_interface_isis_hello_multiplier_level_1_modify(
2790 struct nb_cb_modify_args
*args
)
2792 struct isis_circuit
*circuit
;
2795 if (args
->event
!= NB_EV_APPLY
)
2798 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2799 multi
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2800 circuit
->hello_multiplier
[0] = multi
;
2806 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/multiplier/level-2
2808 int lib_interface_isis_hello_multiplier_level_2_modify(
2809 struct nb_cb_modify_args
*args
)
2811 struct isis_circuit
*circuit
;
2814 if (args
->event
!= NB_EV_APPLY
)
2817 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2818 multi
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2819 circuit
->hello_multiplier
[1] = multi
;
2825 * XPath: /frr-interface:lib/interface/frr-isisd:isis/metric/level-1
2827 int lib_interface_isis_metric_level_1_modify(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 met
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2837 isis_circuit_metric_set(circuit
, IS_LEVEL_1
, met
);
2843 * XPath: /frr-interface:lib/interface/frr-isisd:isis/metric/level-2
2845 int lib_interface_isis_metric_level_2_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_2
, met
);
2861 * XPath: /frr-interface:lib/interface/frr-isisd:isis/priority/level-1
2863 int lib_interface_isis_priority_level_1_modify(struct nb_cb_modify_args
*args
)
2865 struct isis_circuit
*circuit
;
2867 if (args
->event
!= NB_EV_APPLY
)
2870 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2871 circuit
->priority
[0] = yang_dnode_get_uint8(args
->dnode
, NULL
);
2877 * XPath: /frr-interface:lib/interface/frr-isisd:isis/priority/level-2
2879 int lib_interface_isis_priority_level_2_modify(struct nb_cb_modify_args
*args
)
2881 struct isis_circuit
*circuit
;
2883 if (args
->event
!= NB_EV_APPLY
)
2886 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2887 circuit
->priority
[1] = yang_dnode_get_uint8(args
->dnode
, NULL
);
2893 * XPath: /frr-interface:lib/interface/frr-isisd:isis/network-type
2895 int lib_interface_isis_network_type_modify(struct nb_cb_modify_args
*args
)
2897 struct isis_circuit
*circuit
;
2898 int net_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2900 switch (args
->event
) {
2901 case NB_EV_VALIDATE
:
2902 circuit
= nb_running_get_entry(args
->dnode
, NULL
, false);
2905 if (circuit
->circ_type
== CIRCUIT_T_LOOPBACK
) {
2907 args
->errmsg
, args
->errmsg_len
,
2908 "Cannot change network type on loopback interface");
2909 return NB_ERR_VALIDATION
;
2911 if (net_type
== CIRCUIT_T_BROADCAST
2912 && circuit
->state
== C_STATE_UP
2913 && !if_is_broadcast(circuit
->interface
)) {
2915 args
->errmsg
, args
->errmsg_len
,
2916 "Cannot configure non-broadcast interface for broadcast operation");
2917 return NB_ERR_VALIDATION
;
2924 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2925 isis_circuit_circ_type_set(circuit
, net_type
);
2933 * XPath: /frr-interface:lib/interface/frr-isisd:isis/passive
2935 int lib_interface_isis_passive_modify(struct nb_cb_modify_args
*args
)
2937 struct isis_circuit
*circuit
;
2938 bool passive
= yang_dnode_get_bool(args
->dnode
, NULL
);
2940 if (args
->event
!= NB_EV_APPLY
)
2943 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2944 isis_circuit_passive_set(circuit
, passive
);
2950 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password
2952 int lib_interface_isis_password_create(struct nb_cb_create_args
*args
)
2957 int lib_interface_isis_password_destroy(struct nb_cb_destroy_args
*args
)
2959 struct isis_circuit
*circuit
;
2961 if (args
->event
!= NB_EV_APPLY
)
2964 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2965 isis_circuit_passwd_unset(circuit
);
2971 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password/password
2973 int lib_interface_isis_password_password_modify(struct nb_cb_modify_args
*args
)
2975 struct isis_circuit
*circuit
;
2976 const char *password
;
2978 if (args
->event
!= NB_EV_APPLY
)
2981 password
= yang_dnode_get_string(args
->dnode
, NULL
);
2982 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2984 isis_circuit_passwd_set(circuit
, circuit
->passwd
.type
, password
);
2990 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password/password-type
2992 int lib_interface_isis_password_password_type_modify(
2993 struct nb_cb_modify_args
*args
)
2995 struct isis_circuit
*circuit
;
2998 if (args
->event
!= NB_EV_APPLY
)
3001 pass_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
3002 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3003 circuit
->passwd
.type
= pass_type
;
3010 * /frr-interface:lib/interface/frr-isisd:isis/disable-three-way-handshake
3012 int lib_interface_isis_disable_three_way_handshake_modify(
3013 struct nb_cb_modify_args
*args
)
3015 struct isis_circuit
*circuit
;
3017 if (args
->event
!= NB_EV_APPLY
)
3020 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3021 circuit
->disable_threeway_adj
= yang_dnode_get_bool(args
->dnode
, NULL
);
3026 static int lib_interface_isis_multi_topology_common(
3027 enum nb_event event
, const struct lyd_node
*dnode
, char *errmsg
,
3028 size_t errmsg_len
, uint16_t mtid
)
3030 struct isis_circuit
*circuit
;
3034 case NB_EV_VALIDATE
:
3035 circuit
= nb_running_get_entry(dnode
, NULL
, false);
3036 if (circuit
&& circuit
->area
&& circuit
->area
->oldmetric
) {
3039 "Multi topology IS-IS can only be used with wide metrics");
3040 return NB_ERR_VALIDATION
;
3047 circuit
= nb_running_get_entry(dnode
, NULL
, true);
3048 value
= yang_dnode_get_bool(dnode
, NULL
);
3049 isis_circuit_mt_enabled_set(circuit
, mtid
, value
);
3058 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/standard
3060 int lib_interface_isis_multi_topology_standard_modify(
3061 struct nb_cb_modify_args
*args
)
3063 return lib_interface_isis_multi_topology_common(
3064 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3070 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-multicast
3072 int lib_interface_isis_multi_topology_ipv4_multicast_modify(
3073 struct nb_cb_modify_args
*args
)
3075 return lib_interface_isis_multi_topology_common(
3076 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3077 ISIS_MT_IPV4_MULTICAST
);
3082 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-management
3084 int lib_interface_isis_multi_topology_ipv4_management_modify(
3085 struct nb_cb_modify_args
*args
)
3087 return lib_interface_isis_multi_topology_common(
3088 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3094 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-unicast
3096 int lib_interface_isis_multi_topology_ipv6_unicast_modify(
3097 struct nb_cb_modify_args
*args
)
3099 return lib_interface_isis_multi_topology_common(
3100 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3101 ISIS_MT_IPV6_UNICAST
);
3106 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-multicast
3108 int lib_interface_isis_multi_topology_ipv6_multicast_modify(
3109 struct nb_cb_modify_args
*args
)
3111 return lib_interface_isis_multi_topology_common(
3112 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3113 ISIS_MT_IPV6_MULTICAST
);
3118 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-management
3120 int lib_interface_isis_multi_topology_ipv6_management_modify(
3121 struct nb_cb_modify_args
*args
)
3123 return lib_interface_isis_multi_topology_common(
3124 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3129 * XPath: /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-dstsrc
3131 int lib_interface_isis_multi_topology_ipv6_dstsrc_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
,
3136 ISIS_MT_IPV6_DSTSRC
);
3140 * XPath: /frr-interface:lib/interface/frr-isisd:isis/mpls/ldp-sync
3142 int lib_interface_isis_mpls_ldp_sync_modify(struct nb_cb_modify_args
*args
)
3144 struct isis_circuit
*circuit
;
3145 struct ldp_sync_info
*ldp_sync_info
;
3146 bool ldp_sync_enable
;
3148 switch (args
->event
) {
3149 case NB_EV_VALIDATE
:
3154 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3155 ldp_sync_enable
= yang_dnode_get_bool(args
->dnode
, NULL
);
3157 ldp_sync_info
= circuit
->ldp_sync_info
;
3159 SET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_IF_CONFIG
);
3160 ldp_sync_info
->enabled
= ldp_sync_enable
;
3162 if (circuit
->area
) {
3163 if (ldp_sync_enable
)
3164 isis_if_ldp_sync_enable(circuit
);
3166 isis_if_ldp_sync_disable(circuit
);
3174 * XPath: /frr-interface:lib/interface/frr-isisd:isis/mpls/holddown
3176 int lib_interface_isis_mpls_holddown_modify(struct nb_cb_modify_args
*args
)
3178 struct isis_circuit
*circuit
;
3179 struct ldp_sync_info
*ldp_sync_info
;
3182 switch (args
->event
) {
3183 case NB_EV_VALIDATE
:
3188 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3189 holddown
= yang_dnode_get_uint16(args
->dnode
, NULL
);
3191 ldp_sync_info
= circuit
->ldp_sync_info
;
3193 SET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_HOLDDOWN
);
3194 ldp_sync_info
->holddown
= holddown
;
3200 int lib_interface_isis_mpls_holddown_destroy(struct nb_cb_destroy_args
*args
)
3202 struct isis_circuit
*circuit
;
3203 struct ldp_sync_info
*ldp_sync_info
;
3205 switch (args
->event
) {
3206 case NB_EV_VALIDATE
:
3211 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3212 ldp_sync_info
= circuit
->ldp_sync_info
;
3214 UNSET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_HOLDDOWN
);
3217 isis_if_set_ldp_sync_holddown(circuit
);
3226 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/lfa/enable
3228 int lib_interface_isis_fast_reroute_level_1_lfa_enable_modify(
3229 struct nb_cb_modify_args
*args
)
3231 struct isis_area
*area
;
3232 struct isis_circuit
*circuit
;
3234 if (args
->event
!= NB_EV_APPLY
)
3237 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3238 circuit
->lfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3240 area
= circuit
->area
;
3242 if (circuit
->lfa_protection
[0])
3243 area
->lfa_protected_links
[0]++;
3245 assert(area
->lfa_protected_links
[0] > 0);
3246 area
->lfa_protected_links
[0]--;
3249 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3257 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/lfa/exclude-interface
3259 int lib_interface_isis_fast_reroute_level_1_lfa_exclude_interface_create(
3260 struct nb_cb_create_args
*args
)
3262 struct isis_area
*area
;
3263 struct isis_circuit
*circuit
;
3264 const char *exclude_ifname
;
3266 if (args
->event
!= NB_EV_APPLY
)
3269 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3270 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3272 isis_lfa_excluded_iface_add(circuit
, ISIS_LEVEL1
, exclude_ifname
);
3273 area
= circuit
->area
;
3275 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3280 int lib_interface_isis_fast_reroute_level_1_lfa_exclude_interface_destroy(
3281 struct nb_cb_destroy_args
*args
)
3283 struct isis_area
*area
;
3284 struct isis_circuit
*circuit
;
3285 const char *exclude_ifname
;
3287 if (args
->event
!= NB_EV_APPLY
)
3290 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3291 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3293 isis_lfa_excluded_iface_delete(circuit
, ISIS_LEVEL1
, exclude_ifname
);
3294 area
= circuit
->area
;
3296 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3303 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/remote-lfa/enable
3305 int lib_interface_isis_fast_reroute_level_1_remote_lfa_enable_modify(
3306 struct nb_cb_modify_args
*args
)
3308 struct isis_area
*area
;
3309 struct isis_circuit
*circuit
;
3311 if (args
->event
!= NB_EV_APPLY
)
3314 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3315 circuit
->rlfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3317 area
= circuit
->area
;
3319 if (circuit
->rlfa_protection
[0])
3320 area
->rlfa_protected_links
[0]++;
3322 assert(area
->rlfa_protected_links
[0] > 0);
3323 area
->rlfa_protected_links
[0]--;
3326 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3334 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/remote-lfa/maximum-metric
3336 int lib_interface_isis_fast_reroute_level_1_remote_lfa_maximum_metric_modify(
3337 struct nb_cb_modify_args
*args
)
3339 struct isis_area
*area
;
3340 struct isis_circuit
*circuit
;
3342 if (args
->event
!= NB_EV_APPLY
)
3345 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3346 circuit
->rlfa_max_metric
[0] = yang_dnode_get_uint32(args
->dnode
, NULL
);
3348 area
= circuit
->area
;
3350 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3355 int lib_interface_isis_fast_reroute_level_1_remote_lfa_maximum_metric_destroy(
3356 struct nb_cb_destroy_args
*args
)
3358 struct isis_area
*area
;
3359 struct isis_circuit
*circuit
;
3361 if (args
->event
!= NB_EV_APPLY
)
3364 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3365 circuit
->rlfa_max_metric
[0] = 0;
3367 area
= circuit
->area
;
3369 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3376 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/enable
3378 int lib_interface_isis_fast_reroute_level_1_ti_lfa_enable_modify(
3379 struct nb_cb_modify_args
*args
)
3381 struct isis_area
*area
;
3382 struct isis_circuit
*circuit
;
3384 if (args
->event
!= NB_EV_APPLY
)
3387 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3388 circuit
->tilfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3390 area
= circuit
->area
;
3392 if (circuit
->tilfa_protection
[0])
3393 area
->tilfa_protected_links
[0]++;
3395 assert(area
->tilfa_protected_links
[0] > 0);
3396 area
->tilfa_protected_links
[0]--;
3399 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3407 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/node-protection
3409 int lib_interface_isis_fast_reroute_level_1_ti_lfa_node_protection_modify(
3410 struct nb_cb_modify_args
*args
)
3412 struct isis_area
*area
;
3413 struct isis_circuit
*circuit
;
3415 if (args
->event
!= NB_EV_APPLY
)
3418 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3419 circuit
->tilfa_node_protection
[0] =
3420 yang_dnode_get_bool(args
->dnode
, NULL
);
3422 area
= circuit
->area
;
3424 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3431 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/link-fallback
3433 int lib_interface_isis_fast_reroute_level_1_ti_lfa_link_fallback_modify(
3434 struct nb_cb_modify_args
*args
)
3436 struct isis_area
*area
;
3437 struct isis_circuit
*circuit
;
3439 if (args
->event
!= NB_EV_APPLY
)
3442 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3443 circuit
->tilfa_link_fallback
[0] =
3444 yang_dnode_get_bool(args
->dnode
, NULL
);
3446 area
= circuit
->area
;
3448 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3455 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/lfa/enable
3457 int lib_interface_isis_fast_reroute_level_2_lfa_enable_modify(
3458 struct nb_cb_modify_args
*args
)
3460 struct isis_area
*area
;
3461 struct isis_circuit
*circuit
;
3463 if (args
->event
!= NB_EV_APPLY
)
3466 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3467 circuit
->lfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3469 area
= circuit
->area
;
3471 if (circuit
->lfa_protection
[1])
3472 area
->lfa_protected_links
[1]++;
3474 assert(area
->lfa_protected_links
[1] > 0);
3475 area
->lfa_protected_links
[1]--;
3478 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3486 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/lfa/exclude-interface
3488 int lib_interface_isis_fast_reroute_level_2_lfa_exclude_interface_create(
3489 struct nb_cb_create_args
*args
)
3491 struct isis_area
*area
;
3492 struct isis_circuit
*circuit
;
3493 const char *exclude_ifname
;
3495 if (args
->event
!= NB_EV_APPLY
)
3498 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3499 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3501 isis_lfa_excluded_iface_add(circuit
, ISIS_LEVEL2
, exclude_ifname
);
3502 area
= circuit
->area
;
3504 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3509 int lib_interface_isis_fast_reroute_level_2_lfa_exclude_interface_destroy(
3510 struct nb_cb_destroy_args
*args
)
3512 struct isis_area
*area
;
3513 struct isis_circuit
*circuit
;
3514 const char *exclude_ifname
;
3516 if (args
->event
!= NB_EV_APPLY
)
3519 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3520 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3522 isis_lfa_excluded_iface_delete(circuit
, ISIS_LEVEL2
, exclude_ifname
);
3523 area
= circuit
->area
;
3525 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3532 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/remote-lfa/enable
3534 int lib_interface_isis_fast_reroute_level_2_remote_lfa_enable_modify(
3535 struct nb_cb_modify_args
*args
)
3537 struct isis_area
*area
;
3538 struct isis_circuit
*circuit
;
3540 if (args
->event
!= NB_EV_APPLY
)
3543 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3544 circuit
->rlfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3546 area
= circuit
->area
;
3548 if (circuit
->rlfa_protection
[1])
3549 area
->rlfa_protected_links
[1]++;
3551 assert(area
->rlfa_protected_links
[1] > 0);
3552 area
->rlfa_protected_links
[1]--;
3555 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3563 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/remote-lfa/maximum-metric
3565 int lib_interface_isis_fast_reroute_level_2_remote_lfa_maximum_metric_modify(
3566 struct nb_cb_modify_args
*args
)
3568 struct isis_area
*area
;
3569 struct isis_circuit
*circuit
;
3571 if (args
->event
!= NB_EV_APPLY
)
3574 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3575 circuit
->rlfa_max_metric
[1] = yang_dnode_get_uint32(args
->dnode
, NULL
);
3577 area
= circuit
->area
;
3579 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3584 int lib_interface_isis_fast_reroute_level_2_remote_lfa_maximum_metric_destroy(
3585 struct nb_cb_destroy_args
*args
)
3587 struct isis_area
*area
;
3588 struct isis_circuit
*circuit
;
3590 if (args
->event
!= NB_EV_APPLY
)
3593 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3594 circuit
->rlfa_max_metric
[1] = 0;
3596 area
= circuit
->area
;
3598 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3605 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/enable
3607 int lib_interface_isis_fast_reroute_level_2_ti_lfa_enable_modify(
3608 struct nb_cb_modify_args
*args
)
3610 struct isis_area
*area
;
3611 struct isis_circuit
*circuit
;
3613 if (args
->event
!= NB_EV_APPLY
)
3616 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3617 circuit
->tilfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3619 area
= circuit
->area
;
3621 if (circuit
->tilfa_protection
[1])
3622 area
->tilfa_protected_links
[1]++;
3624 assert(area
->tilfa_protected_links
[1] > 0);
3625 area
->tilfa_protected_links
[1]--;
3628 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3636 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/node-protection
3638 int lib_interface_isis_fast_reroute_level_2_ti_lfa_node_protection_modify(
3639 struct nb_cb_modify_args
*args
)
3641 struct isis_area
*area
;
3642 struct isis_circuit
*circuit
;
3644 if (args
->event
!= NB_EV_APPLY
)
3647 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3648 circuit
->tilfa_node_protection
[1] =
3649 yang_dnode_get_bool(args
->dnode
, NULL
);
3651 area
= circuit
->area
;
3653 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3660 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/link-fallback
3662 int lib_interface_isis_fast_reroute_level_2_ti_lfa_link_fallback_modify(
3663 struct nb_cb_modify_args
*args
)
3665 struct isis_area
*area
;
3666 struct isis_circuit
*circuit
;
3668 if (args
->event
!= NB_EV_APPLY
)
3671 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3672 circuit
->tilfa_link_fallback
[1] =
3673 yang_dnode_get_bool(args
->dnode
, NULL
);
3675 area
= circuit
->area
;
3677 lsp_regenerate_schedule(area
, area
->is_type
, 0);