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"
37 #include "isisd/isisd.h"
38 #include "isisd/isis_nb.h"
39 #include "isisd/isis_common.h"
40 #include "isisd/isis_bfd.h"
41 #include "isisd/isis_circuit.h"
42 #include "isisd/isis_lsp.h"
43 #include "isisd/isis_dynhn.h"
44 #include "isisd/isis_misc.h"
45 #include "isisd/isis_csm.h"
46 #include "isisd/isis_adjacency.h"
47 #include "isisd/isis_spf.h"
48 #include "isisd/isis_spf_private.h"
49 #include "isisd/isis_te.h"
50 #include "isisd/isis_mt.h"
51 #include "isisd/isis_redist.h"
52 #include "isisd/isis_ldp_sync.h"
53 #include "isisd/isis_dr.h"
55 DEFINE_MTYPE_STATIC(ISISD
, ISIS_MPLS_TE
, "ISIS MPLS_TE parameters");
56 DEFINE_MTYPE_STATIC(ISISD
, ISIS_PLIST_NAME
, "ISIS prefix-list name");
59 * XPath: /frr-isisd:isis/instance
61 int isis_instance_create(struct nb_cb_create_args
*args
)
63 struct isis_area
*area
;
67 if (args
->event
!= NB_EV_APPLY
)
69 vrf_name
= yang_dnode_get_string(args
->dnode
, "./vrf");
70 area_tag
= yang_dnode_get_string(args
->dnode
, "./area-tag");
72 area
= isis_area_lookup_by_vrf(area_tag
, vrf_name
);
74 return NB_ERR_INCONSISTENCY
;
76 area
= isis_area_create(area_tag
, vrf_name
);
78 /* save area in dnode to avoid looking it up all the time */
79 nb_running_set_entry(args
->dnode
, area
);
84 int isis_instance_destroy(struct nb_cb_destroy_args
*args
)
86 struct isis_area
*area
;
88 if (args
->event
!= NB_EV_APPLY
)
90 area
= nb_running_unset_entry(args
->dnode
);
92 isis_area_destroy(area
);
97 * XPath: /frr-isisd:isis/instance/is-type
99 int isis_instance_is_type_modify(struct nb_cb_modify_args
*args
)
101 struct isis_area
*area
;
104 if (args
->event
!= NB_EV_APPLY
)
107 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
108 type
= yang_dnode_get_enum(args
->dnode
, NULL
);
109 isis_area_is_type_set(area
, type
);
115 struct area_addr
*addr
;
119 static int sysid_iter_cb(const struct lyd_node
*dnode
, void *arg
)
121 struct sysid_iter
*iter
= arg
;
122 struct area_addr addr
;
125 net
= yang_dnode_get_string(dnode
, NULL
);
126 addr
.addr_len
= dotformat2buff(addr
.area_addr
, net
);
128 if (memcmp(GETSYSID(iter
->addr
), GETSYSID((&addr
)), ISIS_SYS_ID_LEN
)) {
130 return YANG_ITER_STOP
;
133 return YANG_ITER_CONTINUE
;
137 * XPath: /frr-isisd:isis/instance/area-address
139 int isis_instance_area_address_create(struct nb_cb_create_args
*args
)
141 struct isis_area
*area
;
142 struct area_addr addr
, *addrr
= NULL
, *addrp
= NULL
;
143 struct listnode
*node
;
144 struct sysid_iter iter
;
146 const char *net_title
= yang_dnode_get_string(args
->dnode
, NULL
);
148 switch (args
->event
) {
150 addr
.addr_len
= dotformat2buff(buff
, net_title
);
151 memcpy(addr
.area_addr
, buff
, addr
.addr_len
);
152 if (addr
.area_addr
[addr
.addr_len
- 1] != 0) {
154 args
->errmsg
, args
->errmsg_len
,
155 "nsel byte (last byte) in area address must be 0");
156 return NB_ERR_VALIDATION
;
162 yang_dnode_iterate(sysid_iter_cb
, &iter
, args
->dnode
,
167 args
->errmsg
, args
->errmsg_len
,
168 "System ID must not change when defining additional area addresses");
169 return NB_ERR_VALIDATION
;
173 addrr
= XMALLOC(MTYPE_ISIS_AREA_ADDR
, sizeof(struct area_addr
));
174 addrr
->addr_len
= dotformat2buff(buff
, net_title
);
175 memcpy(addrr
->area_addr
, buff
, addrr
->addr_len
);
176 args
->resource
->ptr
= addrr
;
179 XFREE(MTYPE_ISIS_AREA_ADDR
, args
->resource
->ptr
);
182 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
183 addrr
= args
->resource
->ptr
;
186 if (area
->isis
->sysid_set
== 0) {
188 * First area address - get the SystemID for this router
190 memcpy(area
->isis
->sysid
, GETSYSID(addrr
),
192 area
->isis
->sysid_set
= 1;
194 /* check that we don't already have this address */
195 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
,
197 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
199 != (addrr
->addr_len
))
201 if (!memcmp(addrp
->area_addr
, addrr
->area_addr
,
203 XFREE(MTYPE_ISIS_AREA_ADDR
, addrr
);
204 return NB_OK
; /* silent fail */
209 /*Forget the systemID part of the address */
210 addrr
->addr_len
-= (ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
);
211 assert(area
->area_addrs
); /* to silence scan-build sillyness */
212 listnode_add(area
->area_addrs
, addrr
);
214 /* only now we can safely generate our LSPs for this area */
215 if (listcount(area
->area_addrs
) > 0) {
216 if (area
->is_type
& IS_LEVEL_1
)
217 lsp_generate(area
, IS_LEVEL_1
);
218 if (area
->is_type
& IS_LEVEL_2
)
219 lsp_generate(area
, IS_LEVEL_2
);
227 int isis_instance_area_address_destroy(struct nb_cb_destroy_args
*args
)
229 struct area_addr addr
, *addrp
= NULL
;
230 struct listnode
*node
;
232 struct isis_area
*area
;
233 const char *net_title
;
234 struct listnode
*cnode
;
235 struct isis_circuit
*circuit
;
238 if (args
->event
!= NB_EV_APPLY
)
241 net_title
= yang_dnode_get_string(args
->dnode
, NULL
);
242 addr
.addr_len
= dotformat2buff(buff
, net_title
);
243 memcpy(addr
.area_addr
, buff
, (int)addr
.addr_len
);
244 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
246 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
)) {
247 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ 1) == addr
.addr_len
248 && !memcmp(addrp
->area_addr
, addr
.area_addr
, addr
.addr_len
))
252 return NB_ERR_INCONSISTENCY
;
254 listnode_delete(area
->area_addrs
, addrp
);
255 XFREE(MTYPE_ISIS_AREA_ADDR
, addrp
);
257 * Last area address - reset the SystemID for this router
259 if (listcount(area
->area_addrs
) == 0) {
260 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
))
261 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
262 if (circuit
->u
.bc
.is_dr
[lvl
- 1])
263 isis_dr_resign(circuit
, lvl
);
265 memset(area
->isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
266 area
->isis
->sysid_set
= 0;
268 zlog_debug("Router has no SystemID");
275 * XPath: /frr-isisd:isis/instance/dynamic-hostname
277 int isis_instance_dynamic_hostname_modify(struct nb_cb_modify_args
*args
)
279 struct isis_area
*area
;
281 if (args
->event
!= NB_EV_APPLY
)
284 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
285 isis_area_dynhostname_set(area
, yang_dnode_get_bool(args
->dnode
, NULL
));
291 * XPath: /frr-isisd:isis/instance/attach-send
293 int isis_instance_attached_send_modify(struct nb_cb_modify_args
*args
)
295 struct isis_area
*area
;
298 if (args
->event
!= NB_EV_APPLY
)
301 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
302 attached
= yang_dnode_get_bool(args
->dnode
, NULL
);
303 isis_area_attached_bit_send_set(area
, attached
);
309 * XPath: /frr-isisd:isis/instance/attach-receive-ignore
311 int isis_instance_attached_receive_modify(struct nb_cb_modify_args
*args
)
313 struct isis_area
*area
;
316 if (args
->event
!= NB_EV_APPLY
)
319 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
320 attached
= yang_dnode_get_bool(args
->dnode
, NULL
);
321 isis_area_attached_bit_receive_set(area
, attached
);
327 * XPath: /frr-isisd:isis/instance/attached
329 int isis_instance_attached_modify(struct nb_cb_modify_args
*args
)
335 * XPath: /frr-isisd:isis/instance/overload
337 int isis_instance_overload_modify(struct nb_cb_modify_args
*args
)
339 struct isis_area
*area
;
342 if (args
->event
!= NB_EV_APPLY
)
345 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
346 overload
= yang_dnode_get_bool(args
->dnode
, NULL
);
347 isis_area_overload_bit_set(area
, overload
);
353 * XPath: /frr-isisd:isis/instance/metric-style
355 int isis_instance_metric_style_modify(struct nb_cb_modify_args
*args
)
357 struct isis_area
*area
;
358 bool old_metric
, new_metric
;
359 enum isis_metric_style metric_style
=
360 yang_dnode_get_enum(args
->dnode
, NULL
);
362 if (args
->event
!= NB_EV_APPLY
)
365 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
366 old_metric
= (metric_style
== ISIS_WIDE_METRIC
) ? false : true;
367 new_metric
= (metric_style
== ISIS_NARROW_METRIC
) ? false : true;
368 isis_area_metricstyle_set(area
, old_metric
, new_metric
);
374 * XPath: /frr-isisd:isis/instance/purge-originator
376 int isis_instance_purge_originator_modify(struct nb_cb_modify_args
*args
)
378 struct isis_area
*area
;
380 if (args
->event
!= NB_EV_APPLY
)
383 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
384 area
->purge_originator
= yang_dnode_get_bool(args
->dnode
, NULL
);
390 * XPath: /frr-isisd:isis/instance/lsp/mtu
392 int isis_instance_lsp_mtu_modify(struct nb_cb_modify_args
*args
)
394 struct listnode
*node
;
395 struct isis_circuit
*circuit
;
396 uint16_t lsp_mtu
= yang_dnode_get_uint16(args
->dnode
, NULL
);
397 struct isis_area
*area
;
399 switch (args
->event
) {
401 area
= nb_running_get_entry(args
->dnode
, NULL
, false);
404 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
)) {
405 if (circuit
->state
!= C_STATE_INIT
406 && circuit
->state
!= C_STATE_UP
)
408 if (lsp_mtu
> isis_circuit_pdu_size(circuit
)) {
410 args
->errmsg
, args
->errmsg_len
,
411 "ISIS area contains circuit %s, which has a maximum PDU size of %zu",
412 circuit
->interface
->name
,
413 isis_circuit_pdu_size(circuit
));
414 return NB_ERR_VALIDATION
;
422 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
423 isis_area_lsp_mtu_set(area
, lsp_mtu
);
431 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/refresh-interval
433 int isis_instance_lsp_refresh_interval_level_1_modify(
434 struct nb_cb_modify_args
*args
)
436 struct isis_area
*area
;
439 if (args
->event
!= NB_EV_APPLY
)
442 refr_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
443 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
444 isis_area_lsp_refresh_set(area
, IS_LEVEL_1
, refr_int
);
450 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/refresh-interval
452 int isis_instance_lsp_refresh_interval_level_2_modify(
453 struct nb_cb_modify_args
*args
)
455 struct isis_area
*area
;
458 if (args
->event
!= NB_EV_APPLY
)
461 refr_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
462 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
463 isis_area_lsp_refresh_set(area
, IS_LEVEL_2
, refr_int
);
469 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/maximum-lifetime
471 int isis_instance_lsp_maximum_lifetime_level_1_modify(
472 struct nb_cb_modify_args
*args
)
474 struct isis_area
*area
;
477 if (args
->event
!= NB_EV_APPLY
)
480 max_lt
= yang_dnode_get_uint16(args
->dnode
, NULL
);
481 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
482 isis_area_max_lsp_lifetime_set(area
, IS_LEVEL_1
, max_lt
);
488 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/maximum-lifetime
490 int isis_instance_lsp_maximum_lifetime_level_2_modify(
491 struct nb_cb_modify_args
*args
)
493 struct isis_area
*area
;
496 if (args
->event
!= NB_EV_APPLY
)
499 max_lt
= yang_dnode_get_uint16(args
->dnode
, NULL
);
500 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
501 isis_area_max_lsp_lifetime_set(area
, IS_LEVEL_2
, max_lt
);
507 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/generation-interval
509 int isis_instance_lsp_generation_interval_level_1_modify(
510 struct nb_cb_modify_args
*args
)
512 struct isis_area
*area
;
515 if (args
->event
!= NB_EV_APPLY
)
518 gen_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
519 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
520 area
->lsp_gen_interval
[0] = gen_int
;
526 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/generation-interval
528 int isis_instance_lsp_generation_interval_level_2_modify(
529 struct nb_cb_modify_args
*args
)
531 struct isis_area
*area
;
534 if (args
->event
!= NB_EV_APPLY
)
537 gen_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
538 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
539 area
->lsp_gen_interval
[1] = gen_int
;
545 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay
547 void ietf_backoff_delay_apply_finish(struct nb_cb_apply_finish_args
*args
)
549 long init_delay
= yang_dnode_get_uint16(args
->dnode
, "./init-delay");
550 long short_delay
= yang_dnode_get_uint16(args
->dnode
, "./short-delay");
551 long long_delay
= yang_dnode_get_uint16(args
->dnode
, "./long-delay");
552 long holddown
= yang_dnode_get_uint16(args
->dnode
, "./hold-down");
554 yang_dnode_get_uint16(args
->dnode
, "./time-to-learn");
555 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
556 size_t bufsiz
= strlen(area
->area_tag
) + sizeof("IS-IS Lx");
557 char *buf
= XCALLOC(MTYPE_TMP
, bufsiz
);
559 snprintf(buf
, bufsiz
, "IS-IS %s L1", area
->area_tag
);
560 spf_backoff_free(area
->spf_delay_ietf
[0]);
561 area
->spf_delay_ietf
[0] =
562 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
563 long_delay
, holddown
, timetolearn
);
565 snprintf(buf
, bufsiz
, "IS-IS %s L2", area
->area_tag
);
566 spf_backoff_free(area
->spf_delay_ietf
[1]);
567 area
->spf_delay_ietf
[1] =
568 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
569 long_delay
, holddown
, timetolearn
);
571 XFREE(MTYPE_TMP
, buf
);
574 int isis_instance_spf_ietf_backoff_delay_create(struct nb_cb_create_args
*args
)
576 /* All the work is done in the apply_finish */
580 int isis_instance_spf_ietf_backoff_delay_destroy(
581 struct nb_cb_destroy_args
*args
)
583 struct isis_area
*area
;
585 if (args
->event
!= NB_EV_APPLY
)
588 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
589 spf_backoff_free(area
->spf_delay_ietf
[0]);
590 spf_backoff_free(area
->spf_delay_ietf
[1]);
591 area
->spf_delay_ietf
[0] = NULL
;
592 area
->spf_delay_ietf
[1] = NULL
;
598 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/init-delay
600 int isis_instance_spf_ietf_backoff_delay_init_delay_modify(
601 struct nb_cb_modify_args
*args
)
603 /* All the work is done in the apply_finish */
608 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/short-delay
610 int isis_instance_spf_ietf_backoff_delay_short_delay_modify(
611 struct nb_cb_modify_args
*args
)
613 /* All the work is done in the apply_finish */
618 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/long-delay
620 int isis_instance_spf_ietf_backoff_delay_long_delay_modify(
621 struct nb_cb_modify_args
*args
)
623 /* All the work is done in the apply_finish */
628 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/hold-down
630 int isis_instance_spf_ietf_backoff_delay_hold_down_modify(
631 struct nb_cb_modify_args
*args
)
633 /* All the work is done in the apply_finish */
638 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/time-to-learn
640 int isis_instance_spf_ietf_backoff_delay_time_to_learn_modify(
641 struct nb_cb_modify_args
*args
)
643 /* All the work is done in the apply_finish */
648 * XPath: /frr-isisd:isis/instance/spf/minimum-interval/level-1
650 int isis_instance_spf_minimum_interval_level_1_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
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
665 * XPath: /frr-isisd:isis/instance/spf/minimum-interval/level-2
667 int isis_instance_spf_minimum_interval_level_2_modify(
668 struct nb_cb_modify_args
*args
)
670 struct isis_area
*area
;
672 if (args
->event
!= NB_EV_APPLY
)
675 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
676 area
->min_spf_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
683 * /frr-isisd:isis/instance/spf/prefix-priorities/critical/access-list-name
685 int isis_instance_spf_prefix_priorities_critical_access_list_name_modify(
686 struct nb_cb_modify_args
*args
)
688 struct isis_area
*area
;
689 const char *acl_name
;
690 struct spf_prefix_priority_acl
*ppa
;
692 if (args
->event
!= NB_EV_APPLY
)
695 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
696 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
698 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_CRITICAL
];
699 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
700 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
701 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
702 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
703 lsp_regenerate_schedule(area
, area
->is_type
, 0);
708 int isis_instance_spf_prefix_priorities_critical_access_list_name_destroy(
709 struct nb_cb_destroy_args
*args
)
711 struct isis_area
*area
;
712 struct spf_prefix_priority_acl
*ppa
;
714 if (args
->event
!= NB_EV_APPLY
)
717 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
719 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_CRITICAL
];
720 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
723 lsp_regenerate_schedule(area
, area
->is_type
, 0);
729 * XPath: /frr-isisd:isis/instance/spf/prefix-priorities/high/access-list-name
731 int isis_instance_spf_prefix_priorities_high_access_list_name_modify(
732 struct nb_cb_modify_args
*args
)
734 struct isis_area
*area
;
735 const char *acl_name
;
736 struct spf_prefix_priority_acl
*ppa
;
738 if (args
->event
!= NB_EV_APPLY
)
741 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
742 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
744 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_HIGH
];
745 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
746 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
747 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
748 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
749 lsp_regenerate_schedule(area
, area
->is_type
, 0);
754 int isis_instance_spf_prefix_priorities_high_access_list_name_destroy(
755 struct nb_cb_destroy_args
*args
)
757 struct isis_area
*area
;
758 struct spf_prefix_priority_acl
*ppa
;
760 if (args
->event
!= NB_EV_APPLY
)
763 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
765 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_HIGH
];
766 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
769 lsp_regenerate_schedule(area
, area
->is_type
, 0);
775 * XPath: /frr-isisd:isis/instance/spf/prefix-priorities/medium/access-list-name
777 int isis_instance_spf_prefix_priorities_medium_access_list_name_modify(
778 struct nb_cb_modify_args
*args
)
780 struct isis_area
*area
;
781 const char *acl_name
;
782 struct spf_prefix_priority_acl
*ppa
;
784 if (args
->event
!= NB_EV_APPLY
)
787 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
788 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
790 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_MEDIUM
];
791 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
792 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
793 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
794 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
795 lsp_regenerate_schedule(area
, area
->is_type
, 0);
800 int isis_instance_spf_prefix_priorities_medium_access_list_name_destroy(
801 struct nb_cb_destroy_args
*args
)
803 struct isis_area
*area
;
804 struct spf_prefix_priority_acl
*ppa
;
806 if (args
->event
!= NB_EV_APPLY
)
809 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
811 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_MEDIUM
];
812 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
815 lsp_regenerate_schedule(area
, area
->is_type
, 0);
821 * XPath: /frr-isisd:isis/instance/area-password
823 void area_password_apply_finish(struct nb_cb_apply_finish_args
*args
)
825 const char *password
= yang_dnode_get_string(args
->dnode
, "./password");
826 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
827 int pass_type
= yang_dnode_get_enum(args
->dnode
, "./password-type");
829 yang_dnode_get_enum(args
->dnode
, "./authenticate-snp");
832 case ISIS_PASSWD_TYPE_CLEARTXT
:
833 isis_area_passwd_cleartext_set(area
, IS_LEVEL_1
, password
,
836 case ISIS_PASSWD_TYPE_HMAC_MD5
:
837 isis_area_passwd_hmac_md5_set(area
, IS_LEVEL_1
, password
,
843 int isis_instance_area_password_create(struct nb_cb_create_args
*args
)
845 /* actual setting is done in apply_finish */
849 int isis_instance_area_password_destroy(struct nb_cb_destroy_args
*args
)
851 struct isis_area
*area
;
853 if (args
->event
!= NB_EV_APPLY
)
856 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
857 isis_area_passwd_unset(area
, IS_LEVEL_1
);
863 * XPath: /frr-isisd:isis/instance/area-password/password
865 int isis_instance_area_password_password_modify(struct nb_cb_modify_args
*args
)
867 /* actual setting is done in apply_finish */
872 * XPath: /frr-isisd:isis/instance/area-password/password-type
874 int isis_instance_area_password_password_type_modify(
875 struct nb_cb_modify_args
*args
)
877 /* actual setting is done in apply_finish */
882 * XPath: /frr-isisd:isis/instance/area-password/authenticate-snp
884 int isis_instance_area_password_authenticate_snp_modify(
885 struct nb_cb_modify_args
*args
)
887 /* actual setting is done in apply_finish */
892 * XPath: /frr-isisd:isis/instance/domain-password
894 void domain_password_apply_finish(struct nb_cb_apply_finish_args
*args
)
896 const char *password
= yang_dnode_get_string(args
->dnode
, "./password");
897 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
898 int pass_type
= yang_dnode_get_enum(args
->dnode
, "./password-type");
900 yang_dnode_get_enum(args
->dnode
, "./authenticate-snp");
903 case ISIS_PASSWD_TYPE_CLEARTXT
:
904 isis_area_passwd_cleartext_set(area
, IS_LEVEL_2
, password
,
907 case ISIS_PASSWD_TYPE_HMAC_MD5
:
908 isis_area_passwd_hmac_md5_set(area
, IS_LEVEL_2
, password
,
914 int isis_instance_domain_password_create(struct nb_cb_create_args
*args
)
916 /* actual setting is done in apply_finish */
920 int isis_instance_domain_password_destroy(struct nb_cb_destroy_args
*args
)
922 struct isis_area
*area
;
924 if (args
->event
!= NB_EV_APPLY
)
927 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
928 isis_area_passwd_unset(area
, IS_LEVEL_2
);
934 * XPath: /frr-isisd:isis/instance/domain-password/password
936 int isis_instance_domain_password_password_modify(
937 struct nb_cb_modify_args
*args
)
939 /* actual setting is done in apply_finish */
944 * XPath: /frr-isisd:isis/instance/domain-password/password-type
946 int isis_instance_domain_password_password_type_modify(
947 struct nb_cb_modify_args
*args
)
949 /* actual setting is done in apply_finish */
954 * XPath: /frr-isisd:isis/instance/domain-password/authenticate-snp
956 int isis_instance_domain_password_authenticate_snp_modify(
957 struct nb_cb_modify_args
*args
)
959 /* actual setting is done in apply_finish */
964 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4
966 void default_info_origin_apply_finish(const struct lyd_node
*dnode
, int family
)
968 int originate_type
= DEFAULT_ORIGINATE
;
969 unsigned long metric
= 0;
970 const char *routemap
= NULL
;
971 struct isis_area
*area
= nb_running_get_entry(dnode
, NULL
, true);
972 int level
= yang_dnode_get_enum(dnode
, "./level");
974 if (yang_dnode_get_bool(dnode
, "./always")) {
975 originate_type
= DEFAULT_ORIGINATE_ALWAYS
;
976 } else if (family
== AF_INET6
) {
978 "%s: Zebra doesn't implement default-originate for IPv6 yet, so use with care or use default-originate always.",
982 if (yang_dnode_exists(dnode
, "./metric"))
983 metric
= yang_dnode_get_uint32(dnode
, "./metric");
984 if (yang_dnode_exists(dnode
, "./route-map"))
985 routemap
= yang_dnode_get_string(dnode
, "./route-map");
987 isis_redist_set(area
, level
, family
, DEFAULT_ROUTE
, metric
, routemap
,
991 void default_info_origin_ipv4_apply_finish(struct nb_cb_apply_finish_args
*args
)
993 default_info_origin_apply_finish(args
->dnode
, AF_INET
);
996 void default_info_origin_ipv6_apply_finish(struct nb_cb_apply_finish_args
*args
)
998 default_info_origin_apply_finish(args
->dnode
, AF_INET6
);
1001 int isis_instance_default_information_originate_ipv4_create(
1002 struct nb_cb_create_args
*args
)
1004 /* It's all done by default_info_origin_apply_finish */
1008 int isis_instance_default_information_originate_ipv4_destroy(
1009 struct nb_cb_destroy_args
*args
)
1011 struct isis_area
*area
;
1014 if (args
->event
!= NB_EV_APPLY
)
1017 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1018 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1019 isis_redist_unset(area
, level
, AF_INET
, DEFAULT_ROUTE
);
1025 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/always
1027 int isis_instance_default_information_originate_ipv4_always_modify(
1028 struct nb_cb_modify_args
*args
)
1030 /* It's all done by default_info_origin_apply_finish */
1035 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/route-map
1037 int isis_instance_default_information_originate_ipv4_route_map_modify(
1038 struct nb_cb_modify_args
*args
)
1040 /* It's all done by default_info_origin_apply_finish */
1044 int isis_instance_default_information_originate_ipv4_route_map_destroy(
1045 struct nb_cb_destroy_args
*args
)
1047 /* It's all done by default_info_origin_apply_finish */
1052 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/metric
1054 int isis_instance_default_information_originate_ipv4_metric_modify(
1055 struct nb_cb_modify_args
*args
)
1057 /* It's all done by default_info_origin_apply_finish */
1062 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6
1064 int isis_instance_default_information_originate_ipv6_create(
1065 struct nb_cb_create_args
*args
)
1067 /* It's all done by default_info_origin_apply_finish */
1071 int isis_instance_default_information_originate_ipv6_destroy(
1072 struct nb_cb_destroy_args
*args
)
1074 struct isis_area
*area
;
1077 if (args
->event
!= NB_EV_APPLY
)
1080 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1081 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1082 isis_redist_unset(area
, level
, AF_INET6
, DEFAULT_ROUTE
);
1088 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/always
1090 int isis_instance_default_information_originate_ipv6_always_modify(
1091 struct nb_cb_modify_args
*args
)
1093 /* It's all done by default_info_origin_apply_finish */
1098 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/route-map
1100 int isis_instance_default_information_originate_ipv6_route_map_modify(
1101 struct nb_cb_modify_args
*args
)
1103 /* It's all done by default_info_origin_apply_finish */
1107 int isis_instance_default_information_originate_ipv6_route_map_destroy(
1108 struct nb_cb_destroy_args
*args
)
1110 /* It's all done by default_info_origin_apply_finish */
1115 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/metric
1117 int isis_instance_default_information_originate_ipv6_metric_modify(
1118 struct nb_cb_modify_args
*args
)
1120 /* It's all done by default_info_origin_apply_finish */
1125 * XPath: /frr-isisd:isis/instance/redistribute/ipv4
1127 void redistribute_apply_finish(const struct lyd_node
*dnode
, int family
)
1129 assert(family
== AF_INET
|| family
== AF_INET6
);
1131 unsigned long metric
= 0;
1132 const char *routemap
= NULL
;
1133 struct isis_area
*area
;
1135 type
= yang_dnode_get_enum(dnode
, "./protocol");
1136 level
= yang_dnode_get_enum(dnode
, "./level");
1137 area
= nb_running_get_entry(dnode
, NULL
, true);
1139 if (yang_dnode_exists(dnode
, "./metric"))
1140 metric
= yang_dnode_get_uint32(dnode
, "./metric");
1141 if (yang_dnode_exists(dnode
, "./route-map"))
1142 routemap
= yang_dnode_get_string(dnode
, "./route-map");
1144 isis_redist_set(area
, level
, family
, type
, metric
, routemap
, 0);
1147 void redistribute_ipv4_apply_finish(struct nb_cb_apply_finish_args
*args
)
1149 redistribute_apply_finish(args
->dnode
, AF_INET
);
1152 void redistribute_ipv6_apply_finish(struct nb_cb_apply_finish_args
*args
)
1154 redistribute_apply_finish(args
->dnode
, AF_INET6
);
1157 int isis_instance_redistribute_ipv4_create(struct nb_cb_create_args
*args
)
1159 /* It's all done by redistribute_apply_finish */
1163 int isis_instance_redistribute_ipv4_destroy(struct nb_cb_destroy_args
*args
)
1165 struct isis_area
*area
;
1168 if (args
->event
!= NB_EV_APPLY
)
1171 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1172 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1173 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
1174 isis_redist_unset(area
, level
, AF_INET
, type
);
1180 * XPath: /frr-isisd:isis/instance/redistribute/ipv4/route-map
1182 int isis_instance_redistribute_ipv4_route_map_modify(
1183 struct nb_cb_modify_args
*args
)
1185 /* It's all done by redistribute_apply_finish */
1189 int isis_instance_redistribute_ipv4_route_map_destroy(
1190 struct nb_cb_destroy_args
*args
)
1192 /* It's all done by redistribute_apply_finish */
1197 * XPath: /frr-isisd:isis/instance/redistribute/ipv4/metric
1199 int isis_instance_redistribute_ipv4_metric_modify(
1200 struct nb_cb_modify_args
*args
)
1202 /* It's all done by redistribute_apply_finish */
1207 * XPath: /frr-isisd:isis/instance/redistribute/ipv6
1209 int isis_instance_redistribute_ipv6_create(struct nb_cb_create_args
*args
)
1211 /* It's all done by redistribute_apply_finish */
1215 int isis_instance_redistribute_ipv6_destroy(struct nb_cb_destroy_args
*args
)
1217 struct isis_area
*area
;
1220 if (args
->event
!= NB_EV_APPLY
)
1223 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1224 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1225 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
1226 isis_redist_unset(area
, level
, AF_INET6
, type
);
1232 * XPath: /frr-isisd:isis/instance/redistribute/ipv6/route-map
1234 int isis_instance_redistribute_ipv6_route_map_modify(
1235 struct nb_cb_modify_args
*args
)
1237 /* It's all done by redistribute_apply_finish */
1241 int isis_instance_redistribute_ipv6_route_map_destroy(
1242 struct nb_cb_destroy_args
*args
)
1244 /* It's all done by redistribute_apply_finish */
1249 * XPath: /frr-isisd:isis/instance/redistribute/ipv6/metric
1251 int isis_instance_redistribute_ipv6_metric_modify(
1252 struct nb_cb_modify_args
*args
)
1254 /* It's all done by redistribute_apply_finish */
1259 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-multicast
1261 static int isis_multi_topology_common(enum nb_event event
,
1262 const struct lyd_node
*dnode
,
1263 char *errmsg
, size_t errmsg_len
,
1264 const char *topology
, bool create
)
1266 struct isis_area
*area
;
1267 struct isis_area_mt_setting
*setting
;
1268 uint16_t mtid
= isis_str2mtid(topology
);
1271 case NB_EV_VALIDATE
:
1272 if (mtid
== (uint16_t)-1) {
1273 snprintf(errmsg
, errmsg_len
, "Unknown topology %s",
1275 return NB_ERR_VALIDATION
;
1282 area
= nb_running_get_entry(dnode
, NULL
, true);
1283 setting
= area_get_mt_setting(area
, mtid
);
1284 setting
->enabled
= create
;
1285 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1292 static int isis_multi_topology_overload_common(enum nb_event event
,
1293 const struct lyd_node
*dnode
,
1294 const char *topology
)
1296 struct isis_area
*area
;
1297 struct isis_area_mt_setting
*setting
;
1298 uint16_t mtid
= isis_str2mtid(topology
);
1300 /* validation is done in isis_multi_topology_common */
1301 if (event
!= NB_EV_APPLY
)
1304 area
= nb_running_get_entry(dnode
, NULL
, true);
1305 setting
= area_get_mt_setting(area
, mtid
);
1306 setting
->overload
= yang_dnode_get_bool(dnode
, NULL
);
1307 if (setting
->enabled
)
1308 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1313 int isis_instance_multi_topology_ipv4_multicast_create(
1314 struct nb_cb_create_args
*args
)
1316 return isis_multi_topology_common(args
->event
, args
->dnode
,
1317 args
->errmsg
, args
->errmsg_len
,
1318 "ipv4-multicast", true);
1321 int isis_instance_multi_topology_ipv4_multicast_destroy(
1322 struct nb_cb_destroy_args
*args
)
1324 return isis_multi_topology_common(args
->event
, args
->dnode
,
1325 args
->errmsg
, args
->errmsg_len
,
1326 "ipv4-multicast", false);
1330 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-multicast/overload
1332 int isis_instance_multi_topology_ipv4_multicast_overload_modify(
1333 struct nb_cb_modify_args
*args
)
1335 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1340 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-management
1342 int isis_instance_multi_topology_ipv4_management_create(
1343 struct nb_cb_create_args
*args
)
1345 return isis_multi_topology_common(args
->event
, args
->dnode
,
1346 args
->errmsg
, args
->errmsg_len
,
1350 int isis_instance_multi_topology_ipv4_management_destroy(
1351 struct nb_cb_destroy_args
*args
)
1353 return isis_multi_topology_common(args
->event
, args
->dnode
,
1354 args
->errmsg
, args
->errmsg_len
,
1355 "ipv4-mgmt", false);
1359 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-management/overload
1361 int isis_instance_multi_topology_ipv4_management_overload_modify(
1362 struct nb_cb_modify_args
*args
)
1364 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1369 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-unicast
1371 int isis_instance_multi_topology_ipv6_unicast_create(
1372 struct nb_cb_create_args
*args
)
1374 return isis_multi_topology_common(args
->event
, args
->dnode
,
1375 args
->errmsg
, args
->errmsg_len
,
1376 "ipv6-unicast", true);
1379 int isis_instance_multi_topology_ipv6_unicast_destroy(
1380 struct nb_cb_destroy_args
*args
)
1382 return isis_multi_topology_common(args
->event
, args
->dnode
,
1383 args
->errmsg
, args
->errmsg_len
,
1384 "ipv6-unicast", false);
1388 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-unicast/overload
1390 int isis_instance_multi_topology_ipv6_unicast_overload_modify(
1391 struct nb_cb_modify_args
*args
)
1393 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1398 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-multicast
1400 int isis_instance_multi_topology_ipv6_multicast_create(
1401 struct nb_cb_create_args
*args
)
1403 return isis_multi_topology_common(args
->event
, args
->dnode
,
1404 args
->errmsg
, args
->errmsg_len
,
1405 "ipv6-multicast", true);
1408 int isis_instance_multi_topology_ipv6_multicast_destroy(
1409 struct nb_cb_destroy_args
*args
)
1411 return isis_multi_topology_common(args
->event
, args
->dnode
,
1412 args
->errmsg
, args
->errmsg_len
,
1413 "ipv6-multicast", false);
1417 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-multicast/overload
1419 int isis_instance_multi_topology_ipv6_multicast_overload_modify(
1420 struct nb_cb_modify_args
*args
)
1422 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1427 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-management
1429 int isis_instance_multi_topology_ipv6_management_create(
1430 struct nb_cb_create_args
*args
)
1432 return isis_multi_topology_common(args
->event
, args
->dnode
,
1433 args
->errmsg
, args
->errmsg_len
,
1437 int isis_instance_multi_topology_ipv6_management_destroy(
1438 struct nb_cb_destroy_args
*args
)
1440 return isis_multi_topology_common(args
->event
, args
->dnode
,
1441 args
->errmsg
, args
->errmsg_len
,
1442 "ipv6-mgmt", false);
1446 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-management/overload
1448 int isis_instance_multi_topology_ipv6_management_overload_modify(
1449 struct nb_cb_modify_args
*args
)
1451 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1456 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-dstsrc
1458 int isis_instance_multi_topology_ipv6_dstsrc_create(
1459 struct nb_cb_create_args
*args
)
1461 return isis_multi_topology_common(args
->event
, args
->dnode
,
1462 args
->errmsg
, args
->errmsg_len
,
1463 "ipv6-dstsrc", true);
1466 int isis_instance_multi_topology_ipv6_dstsrc_destroy(
1467 struct nb_cb_destroy_args
*args
)
1469 return isis_multi_topology_common(args
->event
, args
->dnode
,
1470 args
->errmsg
, args
->errmsg_len
,
1471 "ipv6-dstsrc", false);
1475 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-dstsrc/overload
1477 int isis_instance_multi_topology_ipv6_dstsrc_overload_modify(
1478 struct nb_cb_modify_args
*args
)
1480 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1485 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/load-sharing
1487 int isis_instance_fast_reroute_level_1_lfa_load_sharing_modify(
1488 struct nb_cb_modify_args
*args
)
1490 struct isis_area
*area
;
1492 if (args
->event
!= NB_EV_APPLY
)
1495 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1496 area
->lfa_load_sharing
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
1497 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1503 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/priority-limit
1505 int isis_instance_fast_reroute_level_1_lfa_priority_limit_modify(
1506 struct nb_cb_modify_args
*args
)
1508 struct isis_area
*area
;
1510 if (args
->event
!= NB_EV_APPLY
)
1513 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1514 area
->lfa_priority_limit
[0] = yang_dnode_get_enum(args
->dnode
, NULL
);
1515 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1520 int isis_instance_fast_reroute_level_1_lfa_priority_limit_destroy(
1521 struct nb_cb_destroy_args
*args
)
1523 struct isis_area
*area
;
1525 if (args
->event
!= NB_EV_APPLY
)
1528 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1529 area
->lfa_priority_limit
[0] = SPF_PREFIX_PRIO_LOW
;
1530 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1536 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/tiebreaker
1538 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_create(
1539 struct nb_cb_create_args
*args
)
1541 struct isis_area
*area
;
1543 enum lfa_tiebreaker_type type
;
1544 struct lfa_tiebreaker
*tie_b
;
1546 if (args
->event
!= NB_EV_APPLY
)
1549 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1550 index
= yang_dnode_get_uint8(args
->dnode
, "./index");
1551 type
= yang_dnode_get_enum(args
->dnode
, "./type");
1553 tie_b
= isis_lfa_tiebreaker_add(area
, ISIS_LEVEL1
, index
, type
);
1554 nb_running_set_entry(args
->dnode
, tie_b
);
1555 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1560 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_destroy(
1561 struct nb_cb_destroy_args
*args
)
1563 struct lfa_tiebreaker
*tie_b
;
1564 struct isis_area
*area
;
1566 if (args
->event
!= NB_EV_APPLY
)
1569 tie_b
= nb_running_unset_entry(args
->dnode
);
1571 isis_lfa_tiebreaker_delete(area
, ISIS_LEVEL1
, tie_b
);
1572 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1578 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/tiebreaker/type
1580 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_type_modify(
1581 struct nb_cb_modify_args
*args
)
1583 struct lfa_tiebreaker
*tie_b
;
1584 struct isis_area
*area
;
1586 if (args
->event
!= NB_EV_APPLY
)
1589 tie_b
= nb_running_get_entry(args
->dnode
, NULL
, true);
1591 tie_b
->type
= yang_dnode_get_enum(args
->dnode
, NULL
);
1592 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1598 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/remote-lfa/prefix-list
1600 int isis_instance_fast_reroute_level_1_remote_lfa_prefix_list_modify(
1601 struct nb_cb_modify_args
*args
)
1603 struct isis_area
*area
;
1604 const char *plist_name
;
1606 if (args
->event
!= NB_EV_APPLY
)
1609 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1610 plist_name
= yang_dnode_get_string(args
->dnode
, NULL
);
1612 area
->rlfa_plist_name
[0] = XSTRDUP(MTYPE_ISIS_PLIST_NAME
, plist_name
);
1613 area
->rlfa_plist
[0] = prefix_list_lookup(AFI_IP
, plist_name
);
1614 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1619 int isis_instance_fast_reroute_level_1_remote_lfa_prefix_list_destroy(
1620 struct nb_cb_destroy_args
*args
)
1622 struct isis_area
*area
;
1624 if (args
->event
!= NB_EV_APPLY
)
1627 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1629 XFREE(MTYPE_ISIS_PLIST_NAME
, area
->rlfa_plist_name
[0]);
1630 area
->rlfa_plist
[0] = NULL
;
1631 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1637 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/load-sharing
1639 int isis_instance_fast_reroute_level_2_lfa_load_sharing_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_load_sharing
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
1654 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/priority-limit
1656 int isis_instance_fast_reroute_level_2_lfa_priority_limit_modify(
1657 struct nb_cb_modify_args
*args
)
1659 struct isis_area
*area
;
1661 if (args
->event
!= NB_EV_APPLY
)
1664 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1665 area
->lfa_priority_limit
[1] = yang_dnode_get_enum(args
->dnode
, NULL
);
1670 int isis_instance_fast_reroute_level_2_lfa_priority_limit_destroy(
1671 struct nb_cb_destroy_args
*args
)
1673 struct isis_area
*area
;
1675 if (args
->event
!= NB_EV_APPLY
)
1678 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1679 area
->lfa_priority_limit
[1] = SPF_PREFIX_PRIO_LOW
;
1685 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/tiebreaker
1687 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_create(
1688 struct nb_cb_create_args
*args
)
1690 struct isis_area
*area
;
1692 enum lfa_tiebreaker_type type
;
1693 struct lfa_tiebreaker
*tie_b
;
1695 if (args
->event
!= NB_EV_APPLY
)
1698 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1699 index
= yang_dnode_get_uint8(args
->dnode
, "./index");
1700 type
= yang_dnode_get_enum(args
->dnode
, "./type");
1702 tie_b
= isis_lfa_tiebreaker_add(area
, ISIS_LEVEL2
, index
, type
);
1703 nb_running_set_entry(args
->dnode
, tie_b
);
1704 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1709 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_destroy(
1710 struct nb_cb_destroy_args
*args
)
1712 struct lfa_tiebreaker
*tie_b
;
1713 struct isis_area
*area
;
1715 if (args
->event
!= NB_EV_APPLY
)
1718 tie_b
= nb_running_unset_entry(args
->dnode
);
1720 isis_lfa_tiebreaker_delete(area
, ISIS_LEVEL2
, tie_b
);
1721 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1727 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/tiebreaker/type
1729 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_type_modify(
1730 struct nb_cb_modify_args
*args
)
1732 struct lfa_tiebreaker
*tie_b
;
1733 struct isis_area
*area
;
1735 if (args
->event
!= NB_EV_APPLY
)
1738 tie_b
= nb_running_get_entry(args
->dnode
, NULL
, true);
1740 tie_b
->type
= yang_dnode_get_enum(args
->dnode
, NULL
);
1741 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1747 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/remote-lfa/prefix-list
1749 int isis_instance_fast_reroute_level_2_remote_lfa_prefix_list_modify(
1750 struct nb_cb_modify_args
*args
)
1752 struct isis_area
*area
;
1753 const char *plist_name
;
1755 if (args
->event
!= NB_EV_APPLY
)
1758 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1759 plist_name
= yang_dnode_get_string(args
->dnode
, NULL
);
1761 area
->rlfa_plist_name
[1] = XSTRDUP(MTYPE_ISIS_PLIST_NAME
, plist_name
);
1762 area
->rlfa_plist
[1] = prefix_list_lookup(AFI_IP
, plist_name
);
1763 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1768 int isis_instance_fast_reroute_level_2_remote_lfa_prefix_list_destroy(
1769 struct nb_cb_destroy_args
*args
)
1771 struct isis_area
*area
;
1773 if (args
->event
!= NB_EV_APPLY
)
1776 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1778 XFREE(MTYPE_ISIS_PLIST_NAME
, area
->rlfa_plist_name
[1]);
1779 area
->rlfa_plist
[1] = NULL
;
1780 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1786 * XPath: /frr-isisd:isis/instance/log-adjacency-changes
1788 int isis_instance_log_adjacency_changes_modify(struct nb_cb_modify_args
*args
)
1790 struct isis_area
*area
;
1791 bool log
= yang_dnode_get_bool(args
->dnode
, NULL
);
1793 if (args
->event
!= NB_EV_APPLY
)
1796 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1797 area
->log_adj_changes
= log
? 1 : 0;
1803 * XPath: /frr-isisd:isis/instance/mpls-te
1805 int isis_instance_mpls_te_create(struct nb_cb_create_args
*args
)
1807 struct listnode
*node
;
1808 struct isis_area
*area
;
1809 struct isis_circuit
*circuit
;
1811 if (args
->event
!= NB_EV_APPLY
)
1814 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1815 if (area
->mta
== NULL
) {
1817 struct mpls_te_area
*new;
1819 zlog_debug("ISIS-TE(%s): Initialize MPLS Traffic Engineering",
1822 new = XCALLOC(MTYPE_ISIS_MPLS_TE
, sizeof(struct mpls_te_area
));
1824 /* Initialize MPLS_TE structure */
1825 new->status
= enable
;
1827 new->inter_as
= off
;
1828 new->interas_areaid
.s_addr
= 0;
1829 new->router_id
.s_addr
= 0;
1833 area
->mta
->status
= enable
;
1836 /* Update Extended TLVs according to Interface link parameters */
1837 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
))
1838 isis_link_params_update(circuit
, circuit
->interface
);
1840 /* Reoriginate STD_TE & GMPLS circuits */
1841 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1846 int isis_instance_mpls_te_destroy(struct nb_cb_destroy_args
*args
)
1848 struct listnode
*node
;
1849 struct isis_area
*area
;
1850 struct isis_circuit
*circuit
;
1852 if (args
->event
!= NB_EV_APPLY
)
1855 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1856 if (IS_MPLS_TE(area
->mta
))
1857 area
->mta
->status
= disable
;
1861 /* Flush LSP if circuit engage */
1862 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
)) {
1863 if (!IS_EXT_TE(circuit
->ext
))
1866 /* disable MPLS_TE Circuit keeping SR one's */
1867 if (IS_SUBTLV(circuit
->ext
, EXT_ADJ_SID
))
1868 circuit
->ext
->status
= EXT_ADJ_SID
;
1869 else if (IS_SUBTLV(circuit
->ext
, EXT_LAN_ADJ_SID
))
1870 circuit
->ext
->status
= EXT_LAN_ADJ_SID
;
1872 circuit
->ext
->status
= 0;
1875 /* Reoriginate STD_TE & GMPLS circuits */
1876 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1878 zlog_debug("ISIS-TE(%s): Disabled MPLS Traffic Engineering",
1885 * XPath: /frr-isisd:isis/instance/mpls-te/router-address
1887 int isis_instance_mpls_te_router_address_modify(struct nb_cb_modify_args
*args
)
1889 struct in_addr value
;
1890 struct isis_area
*area
;
1892 if (args
->event
!= NB_EV_APPLY
)
1895 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1896 /* only proceed if MPLS-TE is enabled */
1897 if (!IS_MPLS_TE(area
->mta
))
1900 /* Update Area Router ID */
1901 yang_dnode_get_ipv4(&value
, args
->dnode
, NULL
);
1902 area
->mta
->router_id
.s_addr
= value
.s_addr
;
1904 /* And re-schedule LSP update */
1905 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1910 int isis_instance_mpls_te_router_address_destroy(
1911 struct nb_cb_destroy_args
*args
)
1913 struct isis_area
*area
;
1915 if (args
->event
!= NB_EV_APPLY
)
1918 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1919 /* only proceed if MPLS-TE is enabled */
1920 if (!IS_MPLS_TE(area
->mta
))
1923 /* Reset Area Router ID */
1924 area
->mta
->router_id
.s_addr
= INADDR_ANY
;
1926 /* And re-schedule LSP update */
1927 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1933 * XPath: /frr-isisd:isis/instance/segment-routing/enabled
1935 int isis_instance_segment_routing_enabled_modify(
1936 struct nb_cb_modify_args
*args
)
1938 struct isis_area
*area
;
1940 if (args
->event
!= NB_EV_APPLY
)
1943 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1944 area
->srdb
.config
.enabled
= yang_dnode_get_bool(args
->dnode
, NULL
);
1946 if (area
->srdb
.config
.enabled
) {
1947 if (IS_DEBUG_EVENTS
)
1948 zlog_debug("SR: Segment Routing: OFF -> ON");
1950 isis_sr_start(area
);
1952 if (IS_DEBUG_EVENTS
)
1953 zlog_debug("SR: Segment Routing: ON -> OFF");
1962 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks
1964 int isis_instance_segment_routing_label_blocks_pre_validate(
1965 struct nb_cb_pre_validate_args
*args
)
1967 uint32_t srgb_lbound
;
1968 uint32_t srgb_ubound
;
1969 uint32_t srlb_lbound
;
1970 uint32_t srlb_ubound
;
1972 srgb_lbound
= yang_dnode_get_uint32(args
->dnode
, "./srgb/lower-bound");
1973 srgb_ubound
= yang_dnode_get_uint32(args
->dnode
, "./srgb/upper-bound");
1974 srlb_lbound
= yang_dnode_get_uint32(args
->dnode
, "./srlb/lower-bound");
1975 srlb_ubound
= yang_dnode_get_uint32(args
->dnode
, "./srlb/upper-bound");
1977 /* Check that the block size does not exceed 65535 */
1978 if ((srgb_ubound
- srgb_lbound
+ 1) > 65535) {
1980 args
->errmsg
, args
->errmsg_len
,
1981 "New SR Global Block (%u/%u) exceed the limit of 65535",
1982 srgb_lbound
, srgb_ubound
);
1983 return NB_ERR_VALIDATION
;
1985 if ((srlb_ubound
- srlb_lbound
+ 1) > 65535) {
1986 snprintf(args
->errmsg
, args
->errmsg_len
,
1987 "New SR Local Block (%u/%u) exceed the limit of 65535",
1988 srlb_lbound
, srlb_ubound
);
1989 return NB_ERR_VALIDATION
;
1992 /* Validate SRGB against SRLB */
1993 if (!((srgb_ubound
< srlb_lbound
) || (srgb_lbound
> srlb_ubound
))) {
1995 args
->errmsg
, args
->errmsg_len
,
1996 "SR Global Block (%u/%u) conflicts with Local Block (%u/%u)",
1997 srgb_lbound
, srgb_ubound
, srlb_lbound
, srlb_ubound
);
1998 return NB_ERR_VALIDATION
;
2005 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb
2008 void isis_instance_segment_routing_srgb_apply_finish(
2009 struct nb_cb_apply_finish_args
*args
)
2011 struct isis_area
*area
;
2012 uint32_t lower_bound
, upper_bound
;
2014 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2015 lower_bound
= yang_dnode_get_uint32(args
->dnode
, "./lower-bound");
2016 upper_bound
= yang_dnode_get_uint32(args
->dnode
, "./upper-bound");
2018 isis_sr_cfg_srgb_update(area
, lower_bound
, upper_bound
);
2022 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb/lower-bound
2024 int isis_instance_segment_routing_srgb_lower_bound_modify(
2025 struct nb_cb_modify_args
*args
)
2027 uint32_t lower_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2029 switch (args
->event
) {
2030 case NB_EV_VALIDATE
:
2031 if (!IS_MPLS_UNRESERVED_LABEL(lower_bound
)) {
2032 snprintf(args
->errmsg
, args
->errmsg_len
,
2033 "Invalid SRGB lower bound: %u", lower_bound
);
2034 return NB_ERR_VALIDATION
;
2047 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb/upper-bound
2049 int isis_instance_segment_routing_srgb_upper_bound_modify(
2050 struct nb_cb_modify_args
*args
)
2052 uint32_t upper_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2054 switch (args
->event
) {
2055 case NB_EV_VALIDATE
:
2056 if (!IS_MPLS_UNRESERVED_LABEL(upper_bound
)) {
2057 snprintf(args
->errmsg
, args
->errmsg_len
,
2058 "Invalid SRGB upper bound: %u", upper_bound
);
2059 return NB_ERR_VALIDATION
;
2072 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb
2074 void isis_instance_segment_routing_srlb_apply_finish(
2075 struct nb_cb_apply_finish_args
*args
)
2077 struct isis_area
*area
;
2078 uint32_t lower_bound
, upper_bound
;
2080 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2081 lower_bound
= yang_dnode_get_uint32(args
->dnode
, "./lower-bound");
2082 upper_bound
= yang_dnode_get_uint32(args
->dnode
, "./upper-bound");
2084 isis_sr_cfg_srlb_update(area
, lower_bound
, upper_bound
);
2088 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb/lower-bound
2090 int isis_instance_segment_routing_srlb_lower_bound_modify(
2091 struct nb_cb_modify_args
*args
)
2093 uint32_t lower_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2095 switch (args
->event
) {
2096 case NB_EV_VALIDATE
:
2097 if (!IS_MPLS_UNRESERVED_LABEL(lower_bound
)) {
2098 snprintf(args
->errmsg
, args
->errmsg_len
,
2099 "Invalid SRLB lower bound: %u", lower_bound
);
2100 return NB_ERR_VALIDATION
;
2113 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb/upper-bound
2115 int isis_instance_segment_routing_srlb_upper_bound_modify(
2116 struct nb_cb_modify_args
*args
)
2118 uint32_t upper_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2120 switch (args
->event
) {
2121 case NB_EV_VALIDATE
:
2122 if (!IS_MPLS_UNRESERVED_LABEL(upper_bound
)) {
2123 snprintf(args
->errmsg
, args
->errmsg_len
,
2124 "Invalid SRLB upper bound: %u", upper_bound
);
2125 return NB_ERR_VALIDATION
;
2138 * XPath: /frr-isisd:isis/instance/segment-routing/msd/node-msd
2140 int isis_instance_segment_routing_msd_node_msd_modify(
2141 struct nb_cb_modify_args
*args
)
2143 struct isis_area
*area
;
2145 if (args
->event
!= NB_EV_APPLY
)
2148 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2149 area
->srdb
.config
.msd
= yang_dnode_get_uint8(args
->dnode
, NULL
);
2151 /* Update and regenerate LSP */
2152 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2157 int isis_instance_segment_routing_msd_node_msd_destroy(
2158 struct nb_cb_destroy_args
*args
)
2160 struct isis_area
*area
;
2162 if (args
->event
!= NB_EV_APPLY
)
2165 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2166 area
->srdb
.config
.msd
= 0;
2168 /* Update and regenerate LSP */
2169 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2175 * XPath: /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid
2177 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_create(
2178 struct nb_cb_create_args
*args
)
2180 struct isis_area
*area
;
2181 struct prefix prefix
;
2182 struct sr_prefix_cfg
*pcfg
;
2184 if (args
->event
!= NB_EV_APPLY
)
2187 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2188 yang_dnode_get_prefix(&prefix
, args
->dnode
, "./prefix");
2190 pcfg
= isis_sr_cfg_prefix_add(area
, &prefix
);
2191 nb_running_set_entry(args
->dnode
, pcfg
);
2196 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_destroy(
2197 struct nb_cb_destroy_args
*args
)
2199 struct sr_prefix_cfg
*pcfg
;
2200 struct isis_area
*area
;
2202 if (args
->event
!= NB_EV_APPLY
)
2205 pcfg
= nb_running_unset_entry(args
->dnode
);
2207 isis_sr_cfg_prefix_del(pcfg
);
2208 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2213 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_pre_validate(
2214 struct nb_cb_pre_validate_args
*args
)
2216 const struct lyd_node
*area_dnode
;
2217 struct isis_area
*area
;
2218 struct prefix prefix
;
2219 uint32_t srgb_lbound
;
2220 uint32_t srgb_ubound
;
2221 uint32_t srgb_range
;
2223 enum sr_sid_value_type sid_type
;
2224 struct isis_prefix_sid psid
= {};
2226 yang_dnode_get_prefix(&prefix
, args
->dnode
, "./prefix");
2227 srgb_lbound
= yang_dnode_get_uint32(
2228 args
->dnode
, "../../label-blocks/srgb/lower-bound");
2229 srgb_ubound
= yang_dnode_get_uint32(
2230 args
->dnode
, "../../label-blocks/srgb/upper-bound");
2231 sid
= yang_dnode_get_uint32(args
->dnode
, "./sid-value");
2232 sid_type
= yang_dnode_get_enum(args
->dnode
, "./sid-value-type");
2234 /* Check for invalid indexes/labels. */
2235 srgb_range
= srgb_ubound
- srgb_lbound
+ 1;
2238 case SR_SID_VALUE_TYPE_INDEX
:
2239 if (sid
>= srgb_range
) {
2240 snprintf(args
->errmsg
, args
->errmsg_len
,
2241 "SID index %u falls outside local SRGB range",
2243 return NB_ERR_VALIDATION
;
2246 case SR_SID_VALUE_TYPE_ABSOLUTE
:
2247 if (!IS_MPLS_UNRESERVED_LABEL(sid
)) {
2248 snprintf(args
->errmsg
, args
->errmsg_len
,
2249 "Invalid absolute SID %u", sid
);
2250 return NB_ERR_VALIDATION
;
2252 SET_FLAG(psid
.flags
, ISIS_PREFIX_SID_VALUE
);
2253 SET_FLAG(psid
.flags
, ISIS_PREFIX_SID_LOCAL
);
2257 /* Check for Prefix-SID collisions. */
2258 area_dnode
= yang_dnode_get_parent(args
->dnode
, "instance");
2259 area
= nb_running_get_entry(area_dnode
, NULL
, false);
2261 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
2262 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVEL2
;
2264 struct isis_spftree
*spftree
;
2265 struct isis_vertex
*vertex_psid
;
2267 if (!(area
->is_type
& level
))
2269 spftree
= area
->spftree
[tree
][level
- 1];
2273 vertex_psid
= isis_spf_prefix_sid_lookup(
2276 && !prefix_same(&vertex_psid
->N
.ip
.p
.dest
,
2279 args
->errmsg
, args
->errmsg_len
,
2280 "Prefix-SID collision detected, SID %s %u is already in use by prefix %pFX (L%u)",
2283 ISIS_PREFIX_SID_VALUE
)
2287 &vertex_psid
->N
.ip
.p
.dest
,
2289 return NB_ERR_VALIDATION
;
2298 void isis_instance_segment_routing_prefix_sid_map_prefix_sid_apply_finish(
2299 struct nb_cb_apply_finish_args
*args
)
2301 struct sr_prefix_cfg
*pcfg
;
2302 struct isis_area
*area
;
2304 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2306 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2311 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/sid-value-type
2313 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_sid_value_type_modify(
2314 struct nb_cb_modify_args
*args
)
2316 struct sr_prefix_cfg
*pcfg
;
2318 if (args
->event
!= NB_EV_APPLY
)
2321 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2322 pcfg
->sid_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2329 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/sid-value
2331 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_sid_value_modify(
2332 struct nb_cb_modify_args
*args
)
2334 struct sr_prefix_cfg
*pcfg
;
2336 if (args
->event
!= NB_EV_APPLY
)
2339 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2340 pcfg
->sid
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2347 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/last-hop-behavior
2349 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_last_hop_behavior_modify(
2350 struct nb_cb_modify_args
*args
)
2352 struct sr_prefix_cfg
*pcfg
;
2354 if (args
->event
!= NB_EV_APPLY
)
2357 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2358 pcfg
->last_hop_behavior
= yang_dnode_get_enum(args
->dnode
, NULL
);
2364 * XPath: /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/n-flag-clear
2366 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_n_flag_clear_modify(
2367 struct nb_cb_modify_args
*args
)
2369 struct sr_prefix_cfg
*pcfg
;
2371 if (args
->event
!= NB_EV_APPLY
)
2374 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2375 pcfg
->n_flag_clear
= yang_dnode_get_bool(args
->dnode
, NULL
);
2381 * XPath: /frr-isisd:isis/instance/mpls/ldp-sync
2383 int isis_instance_mpls_ldp_sync_create(struct nb_cb_create_args
*args
)
2385 struct isis_area
*area
;
2386 const char *vrfname
;
2388 switch (args
->event
) {
2389 case NB_EV_VALIDATE
:
2390 vrfname
= yang_dnode_get_string(
2391 lyd_parent(lyd_parent(args
->dnode
)), "./vrf");
2393 if (strcmp(vrfname
, VRF_DEFAULT_NAME
)) {
2394 snprintf(args
->errmsg
, args
->errmsg_len
,
2395 "LDP-Sync only runs on Default VRF");
2396 return NB_ERR_VALIDATION
;
2403 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2404 isis_area_ldp_sync_enable(area
);
2410 int isis_instance_mpls_ldp_sync_destroy(struct nb_cb_destroy_args
*args
)
2412 struct isis_area
*area
;
2414 if (args
->event
!= NB_EV_APPLY
)
2417 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2418 isis_area_ldp_sync_disable(area
);
2424 * XPath: /frr-isisd:isis/instance/mpls/ldp-sync/holddown
2426 int isis_instance_mpls_ldp_sync_holddown_modify(struct nb_cb_modify_args
*args
)
2428 struct isis_area
*area
;
2430 const char *vrfname
;
2432 switch (args
->event
) {
2433 case NB_EV_VALIDATE
:
2434 vrfname
= yang_dnode_get_string(
2435 lyd_parent(lyd_parent(lyd_parent(args
->dnode
))),
2438 if (strcmp(vrfname
, VRF_DEFAULT_NAME
)) {
2439 snprintf(args
->errmsg
, args
->errmsg_len
,
2440 "LDP-Sync only runs on Default VRF");
2441 return NB_ERR_VALIDATION
;
2448 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2449 holddown
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2450 isis_area_ldp_sync_set_holddown(area
, holddown
);
2457 * XPath: /frr-interface:lib/interface/frr-isisd:isis
2459 int lib_interface_isis_create(struct nb_cb_create_args
*args
)
2461 struct isis_area
*area
= NULL
;
2462 struct interface
*ifp
;
2463 struct isis_circuit
*circuit
= NULL
;
2464 const char *area_tag
= yang_dnode_get_string(args
->dnode
, "./area-tag");
2465 uint32_t min_mtu
, actual_mtu
;
2467 switch (args
->event
) {
2471 case NB_EV_VALIDATE
:
2472 /* check if interface mtu is sufficient. If the area has not
2473 * been created yet, assume default MTU for the area
2475 ifp
= nb_running_get_entry(args
->dnode
, NULL
, false);
2476 /* zebra might not know yet about the MTU - nothing we can do */
2477 if (!ifp
|| ifp
->mtu
== 0)
2480 if_is_broadcast(ifp
) ? ifp
->mtu
- LLC_LEN
: ifp
->mtu
;
2482 area
= isis_area_lookup(area_tag
, ifp
->vrf_id
);
2484 min_mtu
= area
->lsp_mtu
;
2487 min_mtu
= yang_get_default_uint16(
2488 "/frr-isisd:isis/instance/lsp/mtu");
2490 min_mtu
= DEFAULT_LSP_MTU
;
2491 #endif /* ifndef FABRICD */
2492 if (actual_mtu
< min_mtu
) {
2493 snprintf(args
->errmsg
, args
->errmsg_len
,
2494 "Interface %s has MTU %u, minimum MTU for the area is %u",
2495 ifp
->name
, actual_mtu
, min_mtu
);
2496 return NB_ERR_VALIDATION
;
2500 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
2501 circuit
= isis_circuit_new(ifp
, area_tag
);
2502 nb_running_set_entry(args
->dnode
, circuit
);
2509 int lib_interface_isis_destroy(struct nb_cb_destroy_args
*args
)
2511 struct isis_circuit
*circuit
;
2513 if (args
->event
!= NB_EV_APPLY
)
2516 circuit
= nb_running_unset_entry(args
->dnode
);
2518 isis_circuit_del(circuit
);
2524 * XPath: /frr-interface:lib/interface/frr-isisd:isis/area-tag
2526 int lib_interface_isis_area_tag_modify(struct nb_cb_modify_args
*args
)
2528 struct isis_circuit
*circuit
;
2530 if (args
->event
== NB_EV_VALIDATE
) {
2531 circuit
= nb_running_get_entry_non_rec(lyd_parent(args
->dnode
), NULL
, false);
2533 snprintf(args
->errmsg
, args
->errmsg_len
,
2534 "Changing area tag is not allowed");
2535 return NB_ERR_VALIDATION
;
2543 * XPath: /frr-interface:lib/interface/frr-isisd:isis/circuit-type
2545 int lib_interface_isis_circuit_type_modify(struct nb_cb_modify_args
*args
)
2547 int circ_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2548 struct isis_circuit
*circuit
;
2550 switch (args
->event
) {
2551 case NB_EV_VALIDATE
:
2556 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2557 circuit
->is_type_config
= circ_type
;
2558 isis_circuit_is_type_set(circuit
, circ_type
);
2566 * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv4-routing
2568 int lib_interface_isis_ipv4_routing_modify(struct nb_cb_modify_args
*args
)
2571 struct isis_circuit
*circuit
;
2573 if (args
->event
!= NB_EV_APPLY
)
2576 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2577 ipv4
= yang_dnode_get_bool(args
->dnode
, NULL
);
2578 ipv6
= yang_dnode_get_bool(args
->dnode
, "../ipv6-routing");
2579 isis_circuit_af_set(circuit
, ipv4
, ipv6
);
2585 * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv6-routing
2587 int lib_interface_isis_ipv6_routing_modify(struct nb_cb_modify_args
*args
)
2590 struct isis_circuit
*circuit
;
2592 if (args
->event
!= NB_EV_APPLY
)
2595 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2596 ipv4
= yang_dnode_get_bool(args
->dnode
, "../ipv4-routing");
2597 ipv6
= yang_dnode_get_bool(args
->dnode
, NULL
);
2598 isis_circuit_af_set(circuit
, ipv4
, ipv6
);
2604 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring
2606 void lib_interface_isis_bfd_monitoring_apply_finish(
2607 struct nb_cb_apply_finish_args
*args
)
2609 struct isis_circuit
*circuit
;
2611 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2612 isis_bfd_circuit_cmd(circuit
);
2616 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring/enabled
2618 int lib_interface_isis_bfd_monitoring_enabled_modify(
2619 struct nb_cb_modify_args
*args
)
2621 struct isis_circuit
*circuit
;
2623 if (args
->event
!= NB_EV_APPLY
)
2626 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2627 circuit
->bfd_config
.enabled
= yang_dnode_get_bool(args
->dnode
, NULL
);
2633 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring/profile
2635 int lib_interface_isis_bfd_monitoring_profile_modify(
2636 struct nb_cb_modify_args
*args
)
2638 struct isis_circuit
*circuit
;
2640 if (args
->event
!= NB_EV_APPLY
)
2643 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2644 XFREE(MTYPE_TMP
, circuit
->bfd_config
.profile
);
2645 circuit
->bfd_config
.profile
=
2646 XSTRDUP(MTYPE_TMP
, yang_dnode_get_string(args
->dnode
, NULL
));
2651 int lib_interface_isis_bfd_monitoring_profile_destroy(
2652 struct nb_cb_destroy_args
*args
)
2654 struct isis_circuit
*circuit
;
2656 if (args
->event
!= NB_EV_APPLY
)
2659 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2660 XFREE(MTYPE_TMP
, circuit
->bfd_config
.profile
);
2666 * XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-1
2668 int lib_interface_isis_csnp_interval_level_1_modify(
2669 struct nb_cb_modify_args
*args
)
2671 struct isis_circuit
*circuit
;
2673 if (args
->event
!= NB_EV_APPLY
)
2676 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2677 circuit
->csnp_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2683 * XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-2
2685 int lib_interface_isis_csnp_interval_level_2_modify(
2686 struct nb_cb_modify_args
*args
)
2688 struct isis_circuit
*circuit
;
2690 if (args
->event
!= NB_EV_APPLY
)
2693 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2694 circuit
->csnp_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2700 * XPath: /frr-interface:lib/interface/frr-isisd:isis/psnp-interval/level-1
2702 int lib_interface_isis_psnp_interval_level_1_modify(
2703 struct nb_cb_modify_args
*args
)
2705 struct isis_circuit
*circuit
;
2707 if (args
->event
!= NB_EV_APPLY
)
2710 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2711 circuit
->psnp_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2717 * XPath: /frr-interface:lib/interface/frr-isisd:isis/psnp-interval/level-2
2719 int lib_interface_isis_psnp_interval_level_2_modify(
2720 struct nb_cb_modify_args
*args
)
2722 struct isis_circuit
*circuit
;
2724 if (args
->event
!= NB_EV_APPLY
)
2727 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2728 circuit
->psnp_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2734 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/padding
2736 int lib_interface_isis_hello_padding_modify(struct nb_cb_modify_args
*args
)
2738 struct isis_circuit
*circuit
;
2740 if (args
->event
!= NB_EV_APPLY
)
2743 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2744 circuit
->pad_hellos
= yang_dnode_get_bool(args
->dnode
, NULL
);
2750 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/interval/level-1
2752 int lib_interface_isis_hello_interval_level_1_modify(
2753 struct nb_cb_modify_args
*args
)
2755 struct isis_circuit
*circuit
;
2758 if (args
->event
!= NB_EV_APPLY
)
2761 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2762 interval
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2763 circuit
->hello_interval
[0] = interval
;
2769 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/interval/level-2
2771 int lib_interface_isis_hello_interval_level_2_modify(
2772 struct nb_cb_modify_args
*args
)
2774 struct isis_circuit
*circuit
;
2777 if (args
->event
!= NB_EV_APPLY
)
2780 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2781 interval
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2782 circuit
->hello_interval
[1] = interval
;
2788 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/multiplier/level-1
2790 int lib_interface_isis_hello_multiplier_level_1_modify(
2791 struct nb_cb_modify_args
*args
)
2793 struct isis_circuit
*circuit
;
2796 if (args
->event
!= NB_EV_APPLY
)
2799 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2800 multi
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2801 circuit
->hello_multiplier
[0] = multi
;
2807 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/multiplier/level-2
2809 int lib_interface_isis_hello_multiplier_level_2_modify(
2810 struct nb_cb_modify_args
*args
)
2812 struct isis_circuit
*circuit
;
2815 if (args
->event
!= NB_EV_APPLY
)
2818 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2819 multi
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2820 circuit
->hello_multiplier
[1] = multi
;
2826 * XPath: /frr-interface:lib/interface/frr-isisd:isis/metric/level-1
2828 int lib_interface_isis_metric_level_1_modify(struct nb_cb_modify_args
*args
)
2830 struct isis_circuit
*circuit
;
2833 if (args
->event
!= NB_EV_APPLY
)
2836 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2837 met
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2838 isis_circuit_metric_set(circuit
, IS_LEVEL_1
, met
);
2844 * XPath: /frr-interface:lib/interface/frr-isisd:isis/metric/level-2
2846 int lib_interface_isis_metric_level_2_modify(struct nb_cb_modify_args
*args
)
2848 struct isis_circuit
*circuit
;
2851 if (args
->event
!= NB_EV_APPLY
)
2854 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2855 met
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2856 isis_circuit_metric_set(circuit
, IS_LEVEL_2
, met
);
2862 * XPath: /frr-interface:lib/interface/frr-isisd:isis/priority/level-1
2864 int lib_interface_isis_priority_level_1_modify(struct nb_cb_modify_args
*args
)
2866 struct isis_circuit
*circuit
;
2868 if (args
->event
!= NB_EV_APPLY
)
2871 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2872 circuit
->priority
[0] = yang_dnode_get_uint8(args
->dnode
, NULL
);
2878 * XPath: /frr-interface:lib/interface/frr-isisd:isis/priority/level-2
2880 int lib_interface_isis_priority_level_2_modify(struct nb_cb_modify_args
*args
)
2882 struct isis_circuit
*circuit
;
2884 if (args
->event
!= NB_EV_APPLY
)
2887 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2888 circuit
->priority
[1] = yang_dnode_get_uint8(args
->dnode
, NULL
);
2894 * XPath: /frr-interface:lib/interface/frr-isisd:isis/network-type
2896 int lib_interface_isis_network_type_modify(struct nb_cb_modify_args
*args
)
2898 struct isis_circuit
*circuit
;
2899 int net_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2901 switch (args
->event
) {
2902 case NB_EV_VALIDATE
:
2903 circuit
= nb_running_get_entry(args
->dnode
, NULL
, false);
2906 if (circuit
->circ_type
== CIRCUIT_T_LOOPBACK
) {
2908 args
->errmsg
, args
->errmsg_len
,
2909 "Cannot change network type on loopback interface");
2910 return NB_ERR_VALIDATION
;
2912 if (net_type
== CIRCUIT_T_BROADCAST
2913 && circuit
->state
== C_STATE_UP
2914 && !if_is_broadcast(circuit
->interface
)) {
2916 args
->errmsg
, args
->errmsg_len
,
2917 "Cannot configure non-broadcast interface for broadcast operation");
2918 return NB_ERR_VALIDATION
;
2925 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2926 isis_circuit_circ_type_set(circuit
, net_type
);
2934 * XPath: /frr-interface:lib/interface/frr-isisd:isis/passive
2936 int lib_interface_isis_passive_modify(struct nb_cb_modify_args
*args
)
2938 struct isis_circuit
*circuit
;
2939 bool passive
= yang_dnode_get_bool(args
->dnode
, NULL
);
2941 if (args
->event
!= NB_EV_APPLY
)
2944 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2945 isis_circuit_passive_set(circuit
, passive
);
2951 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password
2953 int lib_interface_isis_password_create(struct nb_cb_create_args
*args
)
2958 int lib_interface_isis_password_destroy(struct nb_cb_destroy_args
*args
)
2960 struct isis_circuit
*circuit
;
2962 if (args
->event
!= NB_EV_APPLY
)
2965 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2966 isis_circuit_passwd_unset(circuit
);
2972 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password/password
2974 int lib_interface_isis_password_password_modify(struct nb_cb_modify_args
*args
)
2976 struct isis_circuit
*circuit
;
2977 const char *password
;
2979 if (args
->event
!= NB_EV_APPLY
)
2982 password
= yang_dnode_get_string(args
->dnode
, NULL
);
2983 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2985 isis_circuit_passwd_set(circuit
, circuit
->passwd
.type
, password
);
2991 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password/password-type
2993 int lib_interface_isis_password_password_type_modify(
2994 struct nb_cb_modify_args
*args
)
2996 struct isis_circuit
*circuit
;
2999 if (args
->event
!= NB_EV_APPLY
)
3002 pass_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
3003 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3004 circuit
->passwd
.type
= pass_type
;
3011 * /frr-interface:lib/interface/frr-isisd:isis/disable-three-way-handshake
3013 int lib_interface_isis_disable_three_way_handshake_modify(
3014 struct nb_cb_modify_args
*args
)
3016 struct isis_circuit
*circuit
;
3018 if (args
->event
!= NB_EV_APPLY
)
3021 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3022 circuit
->disable_threeway_adj
= yang_dnode_get_bool(args
->dnode
, NULL
);
3029 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-unicast
3031 static int lib_interface_isis_multi_topology_common(
3032 enum nb_event event
, const struct lyd_node
*dnode
, char *errmsg
,
3033 size_t errmsg_len
, uint16_t mtid
)
3035 struct isis_circuit
*circuit
;
3039 case NB_EV_VALIDATE
:
3040 circuit
= nb_running_get_entry(dnode
, NULL
, false);
3041 if (circuit
&& circuit
->area
&& circuit
->area
->oldmetric
) {
3044 "Multi topology IS-IS can only be used with wide metrics");
3045 return NB_ERR_VALIDATION
;
3052 circuit
= nb_running_get_entry(dnode
, NULL
, true);
3053 value
= yang_dnode_get_bool(dnode
, NULL
);
3054 isis_circuit_mt_enabled_set(circuit
, mtid
, value
);
3061 int lib_interface_isis_multi_topology_ipv4_unicast_modify(
3062 struct nb_cb_modify_args
*args
)
3064 return lib_interface_isis_multi_topology_common(
3065 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3066 ISIS_MT_IPV4_UNICAST
);
3071 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-multicast
3073 int lib_interface_isis_multi_topology_ipv4_multicast_modify(
3074 struct nb_cb_modify_args
*args
)
3076 return lib_interface_isis_multi_topology_common(
3077 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3078 ISIS_MT_IPV4_MULTICAST
);
3083 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-management
3085 int lib_interface_isis_multi_topology_ipv4_management_modify(
3086 struct nb_cb_modify_args
*args
)
3088 return lib_interface_isis_multi_topology_common(
3089 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3095 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-unicast
3097 int lib_interface_isis_multi_topology_ipv6_unicast_modify(
3098 struct nb_cb_modify_args
*args
)
3100 return lib_interface_isis_multi_topology_common(
3101 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3102 ISIS_MT_IPV6_UNICAST
);
3107 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-multicast
3109 int lib_interface_isis_multi_topology_ipv6_multicast_modify(
3110 struct nb_cb_modify_args
*args
)
3112 return lib_interface_isis_multi_topology_common(
3113 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3114 ISIS_MT_IPV6_MULTICAST
);
3119 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-management
3121 int lib_interface_isis_multi_topology_ipv6_management_modify(
3122 struct nb_cb_modify_args
*args
)
3124 return lib_interface_isis_multi_topology_common(
3125 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3130 * XPath: /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-dstsrc
3132 int lib_interface_isis_multi_topology_ipv6_dstsrc_modify(
3133 struct nb_cb_modify_args
*args
)
3135 return lib_interface_isis_multi_topology_common(
3136 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3137 ISIS_MT_IPV6_DSTSRC
);
3141 * XPath: /frr-interface:lib/interface/frr-isisd:isis/mpls/ldp-sync
3143 int lib_interface_isis_mpls_ldp_sync_modify(struct nb_cb_modify_args
*args
)
3145 struct isis_circuit
*circuit
;
3146 struct ldp_sync_info
*ldp_sync_info
;
3147 bool ldp_sync_enable
;
3149 switch (args
->event
) {
3150 case NB_EV_VALIDATE
:
3155 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3156 ldp_sync_enable
= yang_dnode_get_bool(args
->dnode
, NULL
);
3158 ldp_sync_info
= circuit
->ldp_sync_info
;
3160 SET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_IF_CONFIG
);
3161 ldp_sync_info
->enabled
= ldp_sync_enable
;
3163 if (circuit
->area
) {
3164 if (ldp_sync_enable
)
3165 isis_if_ldp_sync_enable(circuit
);
3167 isis_if_ldp_sync_disable(circuit
);
3175 * XPath: /frr-interface:lib/interface/frr-isisd:isis/mpls/holddown
3177 int lib_interface_isis_mpls_holddown_modify(struct nb_cb_modify_args
*args
)
3179 struct isis_circuit
*circuit
;
3180 struct ldp_sync_info
*ldp_sync_info
;
3183 switch (args
->event
) {
3184 case NB_EV_VALIDATE
:
3189 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3190 holddown
= yang_dnode_get_uint16(args
->dnode
, NULL
);
3192 ldp_sync_info
= circuit
->ldp_sync_info
;
3194 SET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_HOLDDOWN
);
3195 ldp_sync_info
->holddown
= holddown
;
3201 int lib_interface_isis_mpls_holddown_destroy(struct nb_cb_destroy_args
*args
)
3203 struct isis_circuit
*circuit
;
3204 struct ldp_sync_info
*ldp_sync_info
;
3206 switch (args
->event
) {
3207 case NB_EV_VALIDATE
:
3212 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3213 ldp_sync_info
= circuit
->ldp_sync_info
;
3215 UNSET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_HOLDDOWN
);
3218 isis_if_set_ldp_sync_holddown(circuit
);
3227 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/lfa/enable
3229 int lib_interface_isis_fast_reroute_level_1_lfa_enable_modify(
3230 struct nb_cb_modify_args
*args
)
3232 struct isis_area
*area
;
3233 struct isis_circuit
*circuit
;
3235 if (args
->event
!= NB_EV_APPLY
)
3238 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3239 circuit
->lfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3241 area
= circuit
->area
;
3243 if (circuit
->lfa_protection
[0])
3244 area
->lfa_protected_links
[0]++;
3246 assert(area
->lfa_protected_links
[0] > 0);
3247 area
->lfa_protected_links
[0]--;
3250 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3258 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/lfa/exclude-interface
3260 int lib_interface_isis_fast_reroute_level_1_lfa_exclude_interface_create(
3261 struct nb_cb_create_args
*args
)
3263 struct isis_area
*area
;
3264 struct isis_circuit
*circuit
;
3265 const char *exclude_ifname
;
3267 if (args
->event
!= NB_EV_APPLY
)
3270 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3271 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3273 isis_lfa_excluded_iface_add(circuit
, ISIS_LEVEL1
, exclude_ifname
);
3274 area
= circuit
->area
;
3276 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3281 int lib_interface_isis_fast_reroute_level_1_lfa_exclude_interface_destroy(
3282 struct nb_cb_destroy_args
*args
)
3284 struct isis_area
*area
;
3285 struct isis_circuit
*circuit
;
3286 const char *exclude_ifname
;
3288 if (args
->event
!= NB_EV_APPLY
)
3291 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3292 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3294 isis_lfa_excluded_iface_delete(circuit
, ISIS_LEVEL1
, exclude_ifname
);
3295 area
= circuit
->area
;
3297 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3304 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/remote-lfa/enable
3306 int lib_interface_isis_fast_reroute_level_1_remote_lfa_enable_modify(
3307 struct nb_cb_modify_args
*args
)
3309 struct isis_area
*area
;
3310 struct isis_circuit
*circuit
;
3312 if (args
->event
!= NB_EV_APPLY
)
3315 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3316 circuit
->rlfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3318 area
= circuit
->area
;
3320 if (circuit
->rlfa_protection
[0])
3321 area
->rlfa_protected_links
[0]++;
3323 assert(area
->rlfa_protected_links
[0] > 0);
3324 area
->rlfa_protected_links
[0]--;
3327 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3335 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/remote-lfa/maximum-metric
3337 int lib_interface_isis_fast_reroute_level_1_remote_lfa_maximum_metric_modify(
3338 struct nb_cb_modify_args
*args
)
3340 struct isis_area
*area
;
3341 struct isis_circuit
*circuit
;
3343 if (args
->event
!= NB_EV_APPLY
)
3346 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3347 circuit
->rlfa_max_metric
[0] = yang_dnode_get_uint32(args
->dnode
, NULL
);
3349 area
= circuit
->area
;
3351 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3356 int lib_interface_isis_fast_reroute_level_1_remote_lfa_maximum_metric_destroy(
3357 struct nb_cb_destroy_args
*args
)
3359 struct isis_area
*area
;
3360 struct isis_circuit
*circuit
;
3362 if (args
->event
!= NB_EV_APPLY
)
3365 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3366 circuit
->rlfa_max_metric
[0] = 0;
3368 area
= circuit
->area
;
3370 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3377 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/enable
3379 int lib_interface_isis_fast_reroute_level_1_ti_lfa_enable_modify(
3380 struct nb_cb_modify_args
*args
)
3382 struct isis_area
*area
;
3383 struct isis_circuit
*circuit
;
3385 if (args
->event
!= NB_EV_APPLY
)
3388 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3389 circuit
->tilfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3391 area
= circuit
->area
;
3393 if (circuit
->tilfa_protection
[0])
3394 area
->tilfa_protected_links
[0]++;
3396 assert(area
->tilfa_protected_links
[0] > 0);
3397 area
->tilfa_protected_links
[0]--;
3400 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3408 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/node-protection
3410 int lib_interface_isis_fast_reroute_level_1_ti_lfa_node_protection_modify(
3411 struct nb_cb_modify_args
*args
)
3413 struct isis_area
*area
;
3414 struct isis_circuit
*circuit
;
3416 if (args
->event
!= NB_EV_APPLY
)
3419 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3420 circuit
->tilfa_node_protection
[0] =
3421 yang_dnode_get_bool(args
->dnode
, NULL
);
3423 area
= circuit
->area
;
3425 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3432 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/link-fallback
3434 int lib_interface_isis_fast_reroute_level_1_ti_lfa_link_fallback_modify(
3435 struct nb_cb_modify_args
*args
)
3437 struct isis_area
*area
;
3438 struct isis_circuit
*circuit
;
3440 if (args
->event
!= NB_EV_APPLY
)
3443 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3444 circuit
->tilfa_link_fallback
[0] =
3445 yang_dnode_get_bool(args
->dnode
, NULL
);
3447 area
= circuit
->area
;
3449 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3456 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/lfa/enable
3458 int lib_interface_isis_fast_reroute_level_2_lfa_enable_modify(
3459 struct nb_cb_modify_args
*args
)
3461 struct isis_area
*area
;
3462 struct isis_circuit
*circuit
;
3464 if (args
->event
!= NB_EV_APPLY
)
3467 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3468 circuit
->lfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3470 area
= circuit
->area
;
3472 if (circuit
->lfa_protection
[1])
3473 area
->lfa_protected_links
[1]++;
3475 assert(area
->lfa_protected_links
[1] > 0);
3476 area
->lfa_protected_links
[1]--;
3479 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3487 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/lfa/exclude-interface
3489 int lib_interface_isis_fast_reroute_level_2_lfa_exclude_interface_create(
3490 struct nb_cb_create_args
*args
)
3492 struct isis_area
*area
;
3493 struct isis_circuit
*circuit
;
3494 const char *exclude_ifname
;
3496 if (args
->event
!= NB_EV_APPLY
)
3499 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3500 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3502 isis_lfa_excluded_iface_add(circuit
, ISIS_LEVEL2
, exclude_ifname
);
3503 area
= circuit
->area
;
3505 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3510 int lib_interface_isis_fast_reroute_level_2_lfa_exclude_interface_destroy(
3511 struct nb_cb_destroy_args
*args
)
3513 struct isis_area
*area
;
3514 struct isis_circuit
*circuit
;
3515 const char *exclude_ifname
;
3517 if (args
->event
!= NB_EV_APPLY
)
3520 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3521 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3523 isis_lfa_excluded_iface_delete(circuit
, ISIS_LEVEL2
, exclude_ifname
);
3524 area
= circuit
->area
;
3526 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3533 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/remote-lfa/enable
3535 int lib_interface_isis_fast_reroute_level_2_remote_lfa_enable_modify(
3536 struct nb_cb_modify_args
*args
)
3538 struct isis_area
*area
;
3539 struct isis_circuit
*circuit
;
3541 if (args
->event
!= NB_EV_APPLY
)
3544 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3545 circuit
->rlfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3547 area
= circuit
->area
;
3549 if (circuit
->rlfa_protection
[1])
3550 area
->rlfa_protected_links
[1]++;
3552 assert(area
->rlfa_protected_links
[1] > 0);
3553 area
->rlfa_protected_links
[1]--;
3556 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3564 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/remote-lfa/maximum-metric
3566 int lib_interface_isis_fast_reroute_level_2_remote_lfa_maximum_metric_modify(
3567 struct nb_cb_modify_args
*args
)
3569 struct isis_area
*area
;
3570 struct isis_circuit
*circuit
;
3572 if (args
->event
!= NB_EV_APPLY
)
3575 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3576 circuit
->rlfa_max_metric
[1] = yang_dnode_get_uint32(args
->dnode
, NULL
);
3578 area
= circuit
->area
;
3580 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3585 int lib_interface_isis_fast_reroute_level_2_remote_lfa_maximum_metric_destroy(
3586 struct nb_cb_destroy_args
*args
)
3588 struct isis_area
*area
;
3589 struct isis_circuit
*circuit
;
3591 if (args
->event
!= NB_EV_APPLY
)
3594 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3595 circuit
->rlfa_max_metric
[1] = 0;
3597 area
= circuit
->area
;
3599 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3606 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/enable
3608 int lib_interface_isis_fast_reroute_level_2_ti_lfa_enable_modify(
3609 struct nb_cb_modify_args
*args
)
3611 struct isis_area
*area
;
3612 struct isis_circuit
*circuit
;
3614 if (args
->event
!= NB_EV_APPLY
)
3617 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3618 circuit
->tilfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3620 area
= circuit
->area
;
3622 if (circuit
->tilfa_protection
[1])
3623 area
->tilfa_protected_links
[1]++;
3625 assert(area
->tilfa_protected_links
[1] > 0);
3626 area
->tilfa_protected_links
[1]--;
3629 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3637 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/node-protection
3639 int lib_interface_isis_fast_reroute_level_2_ti_lfa_node_protection_modify(
3640 struct nb_cb_modify_args
*args
)
3642 struct isis_area
*area
;
3643 struct isis_circuit
*circuit
;
3645 if (args
->event
!= NB_EV_APPLY
)
3648 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3649 circuit
->tilfa_node_protection
[1] =
3650 yang_dnode_get_bool(args
->dnode
, NULL
);
3652 area
= circuit
->area
;
3654 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3661 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/link-fallback
3663 int lib_interface_isis_fast_reroute_level_2_ti_lfa_link_fallback_modify(
3664 struct nb_cb_modify_args
*args
)
3666 struct isis_area
*area
;
3667 struct isis_circuit
*circuit
;
3669 if (args
->event
!= NB_EV_APPLY
)
3672 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3673 circuit
->tilfa_link_fallback
[1] =
3674 yang_dnode_get_bool(args
->dnode
, NULL
);
3676 area
= circuit
->area
;
3678 lsp_regenerate_schedule(area
, area
->is_type
, 0);