2 * Copyright (C) 2001,2002 Sampo Saaristo
3 * Tampere University of Technology
4 * Institute of Communications Engineering
5 * Copyright (C) 2018 Volta Networks
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * You should have received a copy of the GNU General Public License along
19 * with this program; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 #include "northbound.h"
32 #include "spf_backoff.h"
33 #include "lib_errors.h"
36 #include "link_state.h"
38 #include "isisd/isisd.h"
39 #include "isisd/isis_nb.h"
40 #include "isisd/isis_common.h"
41 #include "isisd/isis_bfd.h"
42 #include "isisd/isis_circuit.h"
43 #include "isisd/isis_lsp.h"
44 #include "isisd/isis_dynhn.h"
45 #include "isisd/isis_misc.h"
46 #include "isisd/isis_csm.h"
47 #include "isisd/isis_adjacency.h"
48 #include "isisd/isis_spf.h"
49 #include "isisd/isis_spf_private.h"
50 #include "isisd/isis_te.h"
51 #include "isisd/isis_mt.h"
52 #include "isisd/isis_redist.h"
53 #include "isisd/isis_ldp_sync.h"
54 #include "isisd/isis_dr.h"
55 #include "isisd/isis_zebra.h"
57 DEFINE_MTYPE_STATIC(ISISD
, ISIS_MPLS_TE
, "ISIS MPLS_TE parameters");
58 DEFINE_MTYPE_STATIC(ISISD
, ISIS_PLIST_NAME
, "ISIS prefix-list name");
61 * XPath: /frr-isisd:isis/instance
63 int isis_instance_create(struct nb_cb_create_args
*args
)
65 struct isis_area
*area
;
69 if (args
->event
!= NB_EV_APPLY
)
71 vrf_name
= yang_dnode_get_string(args
->dnode
, "./vrf");
72 area_tag
= yang_dnode_get_string(args
->dnode
, "./area-tag");
74 area
= isis_area_lookup_by_vrf(area_tag
, vrf_name
);
76 return NB_ERR_INCONSISTENCY
;
78 area
= isis_area_create(area_tag
, vrf_name
);
80 /* save area in dnode to avoid looking it up all the time */
81 nb_running_set_entry(args
->dnode
, area
);
86 int isis_instance_destroy(struct nb_cb_destroy_args
*args
)
88 struct isis_area
*area
;
90 if (args
->event
!= NB_EV_APPLY
)
92 area
= nb_running_unset_entry(args
->dnode
);
94 isis_area_destroy(area
);
99 * XPath: /frr-isisd:isis/instance/is-type
101 int isis_instance_is_type_modify(struct nb_cb_modify_args
*args
)
103 struct isis_area
*area
;
106 if (args
->event
!= NB_EV_APPLY
)
109 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
110 type
= yang_dnode_get_enum(args
->dnode
, NULL
);
111 isis_area_is_type_set(area
, type
);
117 struct area_addr
*addr
;
121 static int sysid_iter_cb(const struct lyd_node
*dnode
, void *arg
)
123 struct sysid_iter
*iter
= arg
;
124 struct area_addr addr
;
127 net
= yang_dnode_get_string(dnode
, NULL
);
128 addr
.addr_len
= dotformat2buff(addr
.area_addr
, net
);
130 if (memcmp(GETSYSID(iter
->addr
), GETSYSID((&addr
)), ISIS_SYS_ID_LEN
)) {
132 return YANG_ITER_STOP
;
135 return YANG_ITER_CONTINUE
;
139 * XPath: /frr-isisd:isis/instance/area-address
141 int isis_instance_area_address_create(struct nb_cb_create_args
*args
)
143 struct isis_area
*area
;
144 struct area_addr addr
, *addrr
= NULL
, *addrp
= NULL
;
145 struct listnode
*node
;
146 struct sysid_iter iter
;
148 const char *net_title
= yang_dnode_get_string(args
->dnode
, NULL
);
150 switch (args
->event
) {
152 addr
.addr_len
= dotformat2buff(buff
, net_title
);
153 memcpy(addr
.area_addr
, buff
, addr
.addr_len
);
154 if (addr
.area_addr
[addr
.addr_len
- 1] != 0) {
156 args
->errmsg
, args
->errmsg_len
,
157 "nsel byte (last byte) in area address must be 0");
158 return NB_ERR_VALIDATION
;
164 yang_dnode_iterate(sysid_iter_cb
, &iter
, args
->dnode
,
169 args
->errmsg
, args
->errmsg_len
,
170 "System ID must not change when defining additional area addresses");
171 return NB_ERR_VALIDATION
;
175 addrr
= XMALLOC(MTYPE_ISIS_AREA_ADDR
, sizeof(struct area_addr
));
176 addrr
->addr_len
= dotformat2buff(buff
, net_title
);
177 memcpy(addrr
->area_addr
, buff
, addrr
->addr_len
);
178 args
->resource
->ptr
= addrr
;
181 XFREE(MTYPE_ISIS_AREA_ADDR
, args
->resource
->ptr
);
184 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
185 addrr
= args
->resource
->ptr
;
188 if (area
->isis
->sysid_set
== 0) {
190 * First area address - get the SystemID for this router
192 memcpy(area
->isis
->sysid
, GETSYSID(addrr
),
194 area
->isis
->sysid_set
= 1;
196 /* check that we don't already have this address */
197 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
,
199 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
201 != (addrr
->addr_len
))
203 if (!memcmp(addrp
->area_addr
, addrr
->area_addr
,
205 XFREE(MTYPE_ISIS_AREA_ADDR
, addrr
);
206 return NB_OK
; /* silent fail */
211 /*Forget the systemID part of the address */
212 addrr
->addr_len
-= (ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
);
213 assert(area
->area_addrs
); /* to silence scan-build sillyness */
214 listnode_add(area
->area_addrs
, addrr
);
216 /* only now we can safely generate our LSPs for this area */
217 if (listcount(area
->area_addrs
) > 0) {
218 if (area
->is_type
& IS_LEVEL_1
)
219 lsp_generate(area
, IS_LEVEL_1
);
220 if (area
->is_type
& IS_LEVEL_2
)
221 lsp_generate(area
, IS_LEVEL_2
);
229 int isis_instance_area_address_destroy(struct nb_cb_destroy_args
*args
)
231 struct area_addr addr
, *addrp
= NULL
;
232 struct listnode
*node
;
234 struct isis_area
*area
;
235 const char *net_title
;
236 struct listnode
*cnode
;
237 struct isis_circuit
*circuit
;
240 if (args
->event
!= NB_EV_APPLY
)
243 net_title
= yang_dnode_get_string(args
->dnode
, NULL
);
244 addr
.addr_len
= dotformat2buff(buff
, net_title
);
245 memcpy(addr
.area_addr
, buff
, (int)addr
.addr_len
);
246 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
248 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
)) {
249 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ 1) == addr
.addr_len
250 && !memcmp(addrp
->area_addr
, addr
.area_addr
, addr
.addr_len
))
254 return NB_ERR_INCONSISTENCY
;
256 listnode_delete(area
->area_addrs
, addrp
);
257 XFREE(MTYPE_ISIS_AREA_ADDR
, addrp
);
259 * Last area address - reset the SystemID for this router
261 if (listcount(area
->area_addrs
) == 0) {
262 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
))
263 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
264 if (circuit
->u
.bc
.is_dr
[lvl
- 1])
265 isis_dr_resign(circuit
, lvl
);
267 memset(area
->isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
268 area
->isis
->sysid_set
= 0;
270 zlog_debug("Router has no SystemID");
277 * XPath: /frr-isisd:isis/instance/dynamic-hostname
279 int isis_instance_dynamic_hostname_modify(struct nb_cb_modify_args
*args
)
281 struct isis_area
*area
;
283 if (args
->event
!= NB_EV_APPLY
)
286 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
287 isis_area_dynhostname_set(area
, yang_dnode_get_bool(args
->dnode
, NULL
));
293 * XPath: /frr-isisd:isis/instance/attach-send
295 int isis_instance_attached_send_modify(struct nb_cb_modify_args
*args
)
297 struct isis_area
*area
;
300 if (args
->event
!= NB_EV_APPLY
)
303 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
304 attached
= yang_dnode_get_bool(args
->dnode
, NULL
);
305 isis_area_attached_bit_send_set(area
, attached
);
311 * XPath: /frr-isisd:isis/instance/attach-receive-ignore
313 int isis_instance_attached_receive_modify(struct nb_cb_modify_args
*args
)
315 struct isis_area
*area
;
318 if (args
->event
!= NB_EV_APPLY
)
321 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
322 attached
= yang_dnode_get_bool(args
->dnode
, NULL
);
323 isis_area_attached_bit_receive_set(area
, attached
);
329 * XPath: /frr-isisd:isis/instance/attached
331 int isis_instance_attached_modify(struct nb_cb_modify_args
*args
)
337 * XPath: /frr-isisd:isis/instance/overload
339 int isis_instance_overload_modify(struct nb_cb_modify_args
*args
)
341 struct isis_area
*area
;
344 if (args
->event
!= NB_EV_APPLY
)
347 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
348 overload
= yang_dnode_get_bool(args
->dnode
, NULL
);
349 isis_area_overload_bit_set(area
, overload
);
355 * XPath: /frr-isisd:isis/instance/metric-style
357 int isis_instance_metric_style_modify(struct nb_cb_modify_args
*args
)
359 struct isis_area
*area
;
360 bool old_metric
, new_metric
;
361 enum isis_metric_style metric_style
=
362 yang_dnode_get_enum(args
->dnode
, NULL
);
364 if (args
->event
!= NB_EV_APPLY
)
367 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
368 old_metric
= (metric_style
== ISIS_WIDE_METRIC
) ? false : true;
369 new_metric
= (metric_style
== ISIS_NARROW_METRIC
) ? false : true;
370 isis_area_metricstyle_set(area
, old_metric
, new_metric
);
376 * XPath: /frr-isisd:isis/instance/purge-originator
378 int isis_instance_purge_originator_modify(struct nb_cb_modify_args
*args
)
380 struct isis_area
*area
;
382 if (args
->event
!= NB_EV_APPLY
)
385 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
386 area
->purge_originator
= yang_dnode_get_bool(args
->dnode
, NULL
);
392 * XPath: /frr-isisd:isis/instance/lsp/mtu
394 int isis_instance_lsp_mtu_modify(struct nb_cb_modify_args
*args
)
396 struct listnode
*node
;
397 struct isis_circuit
*circuit
;
398 uint16_t lsp_mtu
= yang_dnode_get_uint16(args
->dnode
, NULL
);
399 struct isis_area
*area
;
401 switch (args
->event
) {
403 area
= nb_running_get_entry(args
->dnode
, NULL
, false);
406 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
)) {
407 if (circuit
->state
!= C_STATE_INIT
408 && circuit
->state
!= C_STATE_UP
)
410 if (lsp_mtu
> isis_circuit_pdu_size(circuit
)) {
412 args
->errmsg
, args
->errmsg_len
,
413 "ISIS area contains circuit %s, which has a maximum PDU size of %zu",
414 circuit
->interface
->name
,
415 isis_circuit_pdu_size(circuit
));
416 return NB_ERR_VALIDATION
;
424 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
425 isis_area_lsp_mtu_set(area
, lsp_mtu
);
433 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/refresh-interval
435 int isis_instance_lsp_refresh_interval_level_1_modify(
436 struct nb_cb_modify_args
*args
)
438 struct isis_area
*area
;
441 if (args
->event
!= NB_EV_APPLY
)
444 refr_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
445 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
446 isis_area_lsp_refresh_set(area
, IS_LEVEL_1
, refr_int
);
452 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/refresh-interval
454 int isis_instance_lsp_refresh_interval_level_2_modify(
455 struct nb_cb_modify_args
*args
)
457 struct isis_area
*area
;
460 if (args
->event
!= NB_EV_APPLY
)
463 refr_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
464 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
465 isis_area_lsp_refresh_set(area
, IS_LEVEL_2
, refr_int
);
471 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/maximum-lifetime
473 int isis_instance_lsp_maximum_lifetime_level_1_modify(
474 struct nb_cb_modify_args
*args
)
476 struct isis_area
*area
;
479 if (args
->event
!= NB_EV_APPLY
)
482 max_lt
= yang_dnode_get_uint16(args
->dnode
, NULL
);
483 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
484 isis_area_max_lsp_lifetime_set(area
, IS_LEVEL_1
, max_lt
);
490 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/maximum-lifetime
492 int isis_instance_lsp_maximum_lifetime_level_2_modify(
493 struct nb_cb_modify_args
*args
)
495 struct isis_area
*area
;
498 if (args
->event
!= NB_EV_APPLY
)
501 max_lt
= yang_dnode_get_uint16(args
->dnode
, NULL
);
502 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
503 isis_area_max_lsp_lifetime_set(area
, IS_LEVEL_2
, max_lt
);
509 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/generation-interval
511 int isis_instance_lsp_generation_interval_level_1_modify(
512 struct nb_cb_modify_args
*args
)
514 struct isis_area
*area
;
517 if (args
->event
!= NB_EV_APPLY
)
520 gen_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
521 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
522 area
->lsp_gen_interval
[0] = gen_int
;
528 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/generation-interval
530 int isis_instance_lsp_generation_interval_level_2_modify(
531 struct nb_cb_modify_args
*args
)
533 struct isis_area
*area
;
536 if (args
->event
!= NB_EV_APPLY
)
539 gen_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
540 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
541 area
->lsp_gen_interval
[1] = gen_int
;
547 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay
549 void ietf_backoff_delay_apply_finish(struct nb_cb_apply_finish_args
*args
)
551 long init_delay
= yang_dnode_get_uint16(args
->dnode
, "./init-delay");
552 long short_delay
= yang_dnode_get_uint16(args
->dnode
, "./short-delay");
553 long long_delay
= yang_dnode_get_uint16(args
->dnode
, "./long-delay");
554 long holddown
= yang_dnode_get_uint16(args
->dnode
, "./hold-down");
556 yang_dnode_get_uint16(args
->dnode
, "./time-to-learn");
557 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
558 size_t bufsiz
= strlen(area
->area_tag
) + sizeof("IS-IS Lx");
559 char *buf
= XCALLOC(MTYPE_TMP
, bufsiz
);
561 snprintf(buf
, bufsiz
, "IS-IS %s L1", area
->area_tag
);
562 spf_backoff_free(area
->spf_delay_ietf
[0]);
563 area
->spf_delay_ietf
[0] =
564 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
565 long_delay
, holddown
, timetolearn
);
567 snprintf(buf
, bufsiz
, "IS-IS %s L2", area
->area_tag
);
568 spf_backoff_free(area
->spf_delay_ietf
[1]);
569 area
->spf_delay_ietf
[1] =
570 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
571 long_delay
, holddown
, timetolearn
);
573 XFREE(MTYPE_TMP
, buf
);
576 int isis_instance_spf_ietf_backoff_delay_create(struct nb_cb_create_args
*args
)
578 /* All the work is done in the apply_finish */
582 int isis_instance_spf_ietf_backoff_delay_destroy(
583 struct nb_cb_destroy_args
*args
)
585 struct isis_area
*area
;
587 if (args
->event
!= NB_EV_APPLY
)
590 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
591 spf_backoff_free(area
->spf_delay_ietf
[0]);
592 spf_backoff_free(area
->spf_delay_ietf
[1]);
593 area
->spf_delay_ietf
[0] = NULL
;
594 area
->spf_delay_ietf
[1] = NULL
;
600 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/init-delay
602 int isis_instance_spf_ietf_backoff_delay_init_delay_modify(
603 struct nb_cb_modify_args
*args
)
605 /* All the work is done in the apply_finish */
610 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/short-delay
612 int isis_instance_spf_ietf_backoff_delay_short_delay_modify(
613 struct nb_cb_modify_args
*args
)
615 /* All the work is done in the apply_finish */
620 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/long-delay
622 int isis_instance_spf_ietf_backoff_delay_long_delay_modify(
623 struct nb_cb_modify_args
*args
)
625 /* All the work is done in the apply_finish */
630 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/hold-down
632 int isis_instance_spf_ietf_backoff_delay_hold_down_modify(
633 struct nb_cb_modify_args
*args
)
635 /* All the work is done in the apply_finish */
640 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/time-to-learn
642 int isis_instance_spf_ietf_backoff_delay_time_to_learn_modify(
643 struct nb_cb_modify_args
*args
)
645 /* All the work is done in the apply_finish */
650 * XPath: /frr-isisd:isis/instance/spf/minimum-interval/level-1
652 int isis_instance_spf_minimum_interval_level_1_modify(
653 struct nb_cb_modify_args
*args
)
655 struct isis_area
*area
;
657 if (args
->event
!= NB_EV_APPLY
)
660 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
661 area
->min_spf_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
667 * XPath: /frr-isisd:isis/instance/spf/minimum-interval/level-2
669 int isis_instance_spf_minimum_interval_level_2_modify(
670 struct nb_cb_modify_args
*args
)
672 struct isis_area
*area
;
674 if (args
->event
!= NB_EV_APPLY
)
677 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
678 area
->min_spf_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
685 * /frr-isisd:isis/instance/spf/prefix-priorities/critical/access-list-name
687 int isis_instance_spf_prefix_priorities_critical_access_list_name_modify(
688 struct nb_cb_modify_args
*args
)
690 struct isis_area
*area
;
691 const char *acl_name
;
692 struct spf_prefix_priority_acl
*ppa
;
694 if (args
->event
!= NB_EV_APPLY
)
697 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
698 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
700 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_CRITICAL
];
701 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
702 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
703 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
704 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
705 lsp_regenerate_schedule(area
, area
->is_type
, 0);
710 int isis_instance_spf_prefix_priorities_critical_access_list_name_destroy(
711 struct nb_cb_destroy_args
*args
)
713 struct isis_area
*area
;
714 struct spf_prefix_priority_acl
*ppa
;
716 if (args
->event
!= NB_EV_APPLY
)
719 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
721 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_CRITICAL
];
722 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
725 lsp_regenerate_schedule(area
, area
->is_type
, 0);
731 * XPath: /frr-isisd:isis/instance/spf/prefix-priorities/high/access-list-name
733 int isis_instance_spf_prefix_priorities_high_access_list_name_modify(
734 struct nb_cb_modify_args
*args
)
736 struct isis_area
*area
;
737 const char *acl_name
;
738 struct spf_prefix_priority_acl
*ppa
;
740 if (args
->event
!= NB_EV_APPLY
)
743 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
744 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
746 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_HIGH
];
747 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
748 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
749 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
750 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
751 lsp_regenerate_schedule(area
, area
->is_type
, 0);
756 int isis_instance_spf_prefix_priorities_high_access_list_name_destroy(
757 struct nb_cb_destroy_args
*args
)
759 struct isis_area
*area
;
760 struct spf_prefix_priority_acl
*ppa
;
762 if (args
->event
!= NB_EV_APPLY
)
765 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
767 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_HIGH
];
768 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
771 lsp_regenerate_schedule(area
, area
->is_type
, 0);
777 * XPath: /frr-isisd:isis/instance/spf/prefix-priorities/medium/access-list-name
779 int isis_instance_spf_prefix_priorities_medium_access_list_name_modify(
780 struct nb_cb_modify_args
*args
)
782 struct isis_area
*area
;
783 const char *acl_name
;
784 struct spf_prefix_priority_acl
*ppa
;
786 if (args
->event
!= NB_EV_APPLY
)
789 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
790 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
792 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_MEDIUM
];
793 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
794 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
795 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
796 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
797 lsp_regenerate_schedule(area
, area
->is_type
, 0);
802 int isis_instance_spf_prefix_priorities_medium_access_list_name_destroy(
803 struct nb_cb_destroy_args
*args
)
805 struct isis_area
*area
;
806 struct spf_prefix_priority_acl
*ppa
;
808 if (args
->event
!= NB_EV_APPLY
)
811 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
813 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_MEDIUM
];
814 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
817 lsp_regenerate_schedule(area
, area
->is_type
, 0);
823 * XPath: /frr-isisd:isis/instance/area-password
825 void area_password_apply_finish(struct nb_cb_apply_finish_args
*args
)
827 const char *password
= yang_dnode_get_string(args
->dnode
, "./password");
828 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
829 int pass_type
= yang_dnode_get_enum(args
->dnode
, "./password-type");
831 yang_dnode_get_enum(args
->dnode
, "./authenticate-snp");
834 case ISIS_PASSWD_TYPE_CLEARTXT
:
835 isis_area_passwd_cleartext_set(area
, IS_LEVEL_1
, password
,
838 case ISIS_PASSWD_TYPE_HMAC_MD5
:
839 isis_area_passwd_hmac_md5_set(area
, IS_LEVEL_1
, password
,
845 int isis_instance_area_password_create(struct nb_cb_create_args
*args
)
847 /* actual setting is done in apply_finish */
851 int isis_instance_area_password_destroy(struct nb_cb_destroy_args
*args
)
853 struct isis_area
*area
;
855 if (args
->event
!= NB_EV_APPLY
)
858 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
859 isis_area_passwd_unset(area
, IS_LEVEL_1
);
865 * XPath: /frr-isisd:isis/instance/area-password/password
867 int isis_instance_area_password_password_modify(struct nb_cb_modify_args
*args
)
869 /* actual setting is done in apply_finish */
874 * XPath: /frr-isisd:isis/instance/area-password/password-type
876 int isis_instance_area_password_password_type_modify(
877 struct nb_cb_modify_args
*args
)
879 /* actual setting is done in apply_finish */
884 * XPath: /frr-isisd:isis/instance/area-password/authenticate-snp
886 int isis_instance_area_password_authenticate_snp_modify(
887 struct nb_cb_modify_args
*args
)
889 /* actual setting is done in apply_finish */
894 * XPath: /frr-isisd:isis/instance/domain-password
896 void domain_password_apply_finish(struct nb_cb_apply_finish_args
*args
)
898 const char *password
= yang_dnode_get_string(args
->dnode
, "./password");
899 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
900 int pass_type
= yang_dnode_get_enum(args
->dnode
, "./password-type");
902 yang_dnode_get_enum(args
->dnode
, "./authenticate-snp");
905 case ISIS_PASSWD_TYPE_CLEARTXT
:
906 isis_area_passwd_cleartext_set(area
, IS_LEVEL_2
, password
,
909 case ISIS_PASSWD_TYPE_HMAC_MD5
:
910 isis_area_passwd_hmac_md5_set(area
, IS_LEVEL_2
, password
,
916 int isis_instance_domain_password_create(struct nb_cb_create_args
*args
)
918 /* actual setting is done in apply_finish */
922 int isis_instance_domain_password_destroy(struct nb_cb_destroy_args
*args
)
924 struct isis_area
*area
;
926 if (args
->event
!= NB_EV_APPLY
)
929 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
930 isis_area_passwd_unset(area
, IS_LEVEL_2
);
936 * XPath: /frr-isisd:isis/instance/domain-password/password
938 int isis_instance_domain_password_password_modify(
939 struct nb_cb_modify_args
*args
)
941 /* actual setting is done in apply_finish */
946 * XPath: /frr-isisd:isis/instance/domain-password/password-type
948 int isis_instance_domain_password_password_type_modify(
949 struct nb_cb_modify_args
*args
)
951 /* actual setting is done in apply_finish */
956 * XPath: /frr-isisd:isis/instance/domain-password/authenticate-snp
958 int isis_instance_domain_password_authenticate_snp_modify(
959 struct nb_cb_modify_args
*args
)
961 /* actual setting is done in apply_finish */
966 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4
968 void default_info_origin_apply_finish(const struct lyd_node
*dnode
, int family
)
970 int originate_type
= DEFAULT_ORIGINATE
;
971 unsigned long metric
= 0;
972 const char *routemap
= NULL
;
973 struct isis_area
*area
= nb_running_get_entry(dnode
, NULL
, true);
974 int level
= yang_dnode_get_enum(dnode
, "./level");
976 if (yang_dnode_get_bool(dnode
, "./always")) {
977 originate_type
= DEFAULT_ORIGINATE_ALWAYS
;
978 } else if (family
== AF_INET6
) {
980 "%s: Zebra doesn't implement default-originate for IPv6 yet, so use with care or use default-originate always.",
984 if (yang_dnode_exists(dnode
, "./metric"))
985 metric
= yang_dnode_get_uint32(dnode
, "./metric");
986 if (yang_dnode_exists(dnode
, "./route-map"))
987 routemap
= yang_dnode_get_string(dnode
, "./route-map");
989 isis_redist_set(area
, level
, family
, DEFAULT_ROUTE
, metric
, routemap
,
993 void default_info_origin_ipv4_apply_finish(struct nb_cb_apply_finish_args
*args
)
995 default_info_origin_apply_finish(args
->dnode
, AF_INET
);
998 void default_info_origin_ipv6_apply_finish(struct nb_cb_apply_finish_args
*args
)
1000 default_info_origin_apply_finish(args
->dnode
, AF_INET6
);
1003 int isis_instance_default_information_originate_ipv4_create(
1004 struct nb_cb_create_args
*args
)
1006 /* It's all done by default_info_origin_apply_finish */
1010 int isis_instance_default_information_originate_ipv4_destroy(
1011 struct nb_cb_destroy_args
*args
)
1013 struct isis_area
*area
;
1016 if (args
->event
!= NB_EV_APPLY
)
1019 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1020 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1021 isis_redist_unset(area
, level
, AF_INET
, DEFAULT_ROUTE
);
1027 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/always
1029 int isis_instance_default_information_originate_ipv4_always_modify(
1030 struct nb_cb_modify_args
*args
)
1032 /* It's all done by default_info_origin_apply_finish */
1037 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/route-map
1039 int isis_instance_default_information_originate_ipv4_route_map_modify(
1040 struct nb_cb_modify_args
*args
)
1042 /* It's all done by default_info_origin_apply_finish */
1046 int isis_instance_default_information_originate_ipv4_route_map_destroy(
1047 struct nb_cb_destroy_args
*args
)
1049 /* It's all done by default_info_origin_apply_finish */
1054 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/metric
1056 int isis_instance_default_information_originate_ipv4_metric_modify(
1057 struct nb_cb_modify_args
*args
)
1059 /* It's all done by default_info_origin_apply_finish */
1064 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6
1066 int isis_instance_default_information_originate_ipv6_create(
1067 struct nb_cb_create_args
*args
)
1069 /* It's all done by default_info_origin_apply_finish */
1073 int isis_instance_default_information_originate_ipv6_destroy(
1074 struct nb_cb_destroy_args
*args
)
1076 struct isis_area
*area
;
1079 if (args
->event
!= NB_EV_APPLY
)
1082 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1083 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1084 isis_redist_unset(area
, level
, AF_INET6
, DEFAULT_ROUTE
);
1090 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/always
1092 int isis_instance_default_information_originate_ipv6_always_modify(
1093 struct nb_cb_modify_args
*args
)
1095 /* It's all done by default_info_origin_apply_finish */
1100 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/route-map
1102 int isis_instance_default_information_originate_ipv6_route_map_modify(
1103 struct nb_cb_modify_args
*args
)
1105 /* It's all done by default_info_origin_apply_finish */
1109 int isis_instance_default_information_originate_ipv6_route_map_destroy(
1110 struct nb_cb_destroy_args
*args
)
1112 /* It's all done by default_info_origin_apply_finish */
1117 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/metric
1119 int isis_instance_default_information_originate_ipv6_metric_modify(
1120 struct nb_cb_modify_args
*args
)
1122 /* It's all done by default_info_origin_apply_finish */
1127 * XPath: /frr-isisd:isis/instance/redistribute/ipv4
1129 void redistribute_apply_finish(const struct lyd_node
*dnode
, int family
)
1131 assert(family
== AF_INET
|| family
== AF_INET6
);
1133 unsigned long metric
= 0;
1134 const char *routemap
= NULL
;
1135 struct isis_area
*area
;
1137 type
= yang_dnode_get_enum(dnode
, "./protocol");
1138 level
= yang_dnode_get_enum(dnode
, "./level");
1139 area
= nb_running_get_entry(dnode
, NULL
, true);
1141 if (yang_dnode_exists(dnode
, "./metric"))
1142 metric
= yang_dnode_get_uint32(dnode
, "./metric");
1143 if (yang_dnode_exists(dnode
, "./route-map"))
1144 routemap
= yang_dnode_get_string(dnode
, "./route-map");
1146 isis_redist_set(area
, level
, family
, type
, metric
, routemap
, 0);
1149 void redistribute_ipv4_apply_finish(struct nb_cb_apply_finish_args
*args
)
1151 redistribute_apply_finish(args
->dnode
, AF_INET
);
1154 void redistribute_ipv6_apply_finish(struct nb_cb_apply_finish_args
*args
)
1156 redistribute_apply_finish(args
->dnode
, AF_INET6
);
1159 int isis_instance_redistribute_ipv4_create(struct nb_cb_create_args
*args
)
1161 /* It's all done by redistribute_apply_finish */
1165 int isis_instance_redistribute_ipv4_destroy(struct nb_cb_destroy_args
*args
)
1167 struct isis_area
*area
;
1170 if (args
->event
!= NB_EV_APPLY
)
1173 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1174 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1175 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
1176 isis_redist_unset(area
, level
, AF_INET
, type
);
1182 * XPath: /frr-isisd:isis/instance/redistribute/ipv4/route-map
1184 int isis_instance_redistribute_ipv4_route_map_modify(
1185 struct nb_cb_modify_args
*args
)
1187 /* It's all done by redistribute_apply_finish */
1191 int isis_instance_redistribute_ipv4_route_map_destroy(
1192 struct nb_cb_destroy_args
*args
)
1194 /* It's all done by redistribute_apply_finish */
1199 * XPath: /frr-isisd:isis/instance/redistribute/ipv4/metric
1201 int isis_instance_redistribute_ipv4_metric_modify(
1202 struct nb_cb_modify_args
*args
)
1204 /* It's all done by redistribute_apply_finish */
1209 * XPath: /frr-isisd:isis/instance/redistribute/ipv6
1211 int isis_instance_redistribute_ipv6_create(struct nb_cb_create_args
*args
)
1213 /* It's all done by redistribute_apply_finish */
1217 int isis_instance_redistribute_ipv6_destroy(struct nb_cb_destroy_args
*args
)
1219 struct isis_area
*area
;
1222 if (args
->event
!= NB_EV_APPLY
)
1225 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1226 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1227 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
1228 isis_redist_unset(area
, level
, AF_INET6
, type
);
1234 * XPath: /frr-isisd:isis/instance/redistribute/ipv6/route-map
1236 int isis_instance_redistribute_ipv6_route_map_modify(
1237 struct nb_cb_modify_args
*args
)
1239 /* It's all done by redistribute_apply_finish */
1243 int isis_instance_redistribute_ipv6_route_map_destroy(
1244 struct nb_cb_destroy_args
*args
)
1246 /* It's all done by redistribute_apply_finish */
1251 * XPath: /frr-isisd:isis/instance/redistribute/ipv6/metric
1253 int isis_instance_redistribute_ipv6_metric_modify(
1254 struct nb_cb_modify_args
*args
)
1256 /* It's all done by redistribute_apply_finish */
1261 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-multicast
1263 static int isis_multi_topology_common(enum nb_event event
,
1264 const struct lyd_node
*dnode
,
1265 char *errmsg
, size_t errmsg_len
,
1266 const char *topology
, bool create
)
1268 struct isis_area
*area
;
1269 struct isis_area_mt_setting
*setting
;
1270 uint16_t mtid
= isis_str2mtid(topology
);
1273 case NB_EV_VALIDATE
:
1274 if (mtid
== (uint16_t)-1) {
1275 snprintf(errmsg
, errmsg_len
, "Unknown topology %s",
1277 return NB_ERR_VALIDATION
;
1284 area
= nb_running_get_entry(dnode
, NULL
, true);
1285 setting
= area_get_mt_setting(area
, mtid
);
1286 setting
->enabled
= create
;
1287 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1294 static int isis_multi_topology_overload_common(enum nb_event event
,
1295 const struct lyd_node
*dnode
,
1296 const char *topology
)
1298 struct isis_area
*area
;
1299 struct isis_area_mt_setting
*setting
;
1300 uint16_t mtid
= isis_str2mtid(topology
);
1302 /* validation is done in isis_multi_topology_common */
1303 if (event
!= NB_EV_APPLY
)
1306 area
= nb_running_get_entry(dnode
, NULL
, true);
1307 setting
= area_get_mt_setting(area
, mtid
);
1308 setting
->overload
= yang_dnode_get_bool(dnode
, NULL
);
1309 if (setting
->enabled
)
1310 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1315 int isis_instance_multi_topology_ipv4_multicast_create(
1316 struct nb_cb_create_args
*args
)
1318 return isis_multi_topology_common(args
->event
, args
->dnode
,
1319 args
->errmsg
, args
->errmsg_len
,
1320 "ipv4-multicast", true);
1323 int isis_instance_multi_topology_ipv4_multicast_destroy(
1324 struct nb_cb_destroy_args
*args
)
1326 return isis_multi_topology_common(args
->event
, args
->dnode
,
1327 args
->errmsg
, args
->errmsg_len
,
1328 "ipv4-multicast", false);
1332 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-multicast/overload
1334 int isis_instance_multi_topology_ipv4_multicast_overload_modify(
1335 struct nb_cb_modify_args
*args
)
1337 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1342 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-management
1344 int isis_instance_multi_topology_ipv4_management_create(
1345 struct nb_cb_create_args
*args
)
1347 return isis_multi_topology_common(args
->event
, args
->dnode
,
1348 args
->errmsg
, args
->errmsg_len
,
1352 int isis_instance_multi_topology_ipv4_management_destroy(
1353 struct nb_cb_destroy_args
*args
)
1355 return isis_multi_topology_common(args
->event
, args
->dnode
,
1356 args
->errmsg
, args
->errmsg_len
,
1357 "ipv4-mgmt", false);
1361 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-management/overload
1363 int isis_instance_multi_topology_ipv4_management_overload_modify(
1364 struct nb_cb_modify_args
*args
)
1366 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1371 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-unicast
1373 int isis_instance_multi_topology_ipv6_unicast_create(
1374 struct nb_cb_create_args
*args
)
1376 return isis_multi_topology_common(args
->event
, args
->dnode
,
1377 args
->errmsg
, args
->errmsg_len
,
1378 "ipv6-unicast", true);
1381 int isis_instance_multi_topology_ipv6_unicast_destroy(
1382 struct nb_cb_destroy_args
*args
)
1384 return isis_multi_topology_common(args
->event
, args
->dnode
,
1385 args
->errmsg
, args
->errmsg_len
,
1386 "ipv6-unicast", false);
1390 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-unicast/overload
1392 int isis_instance_multi_topology_ipv6_unicast_overload_modify(
1393 struct nb_cb_modify_args
*args
)
1395 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1400 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-multicast
1402 int isis_instance_multi_topology_ipv6_multicast_create(
1403 struct nb_cb_create_args
*args
)
1405 return isis_multi_topology_common(args
->event
, args
->dnode
,
1406 args
->errmsg
, args
->errmsg_len
,
1407 "ipv6-multicast", true);
1410 int isis_instance_multi_topology_ipv6_multicast_destroy(
1411 struct nb_cb_destroy_args
*args
)
1413 return isis_multi_topology_common(args
->event
, args
->dnode
,
1414 args
->errmsg
, args
->errmsg_len
,
1415 "ipv6-multicast", false);
1419 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-multicast/overload
1421 int isis_instance_multi_topology_ipv6_multicast_overload_modify(
1422 struct nb_cb_modify_args
*args
)
1424 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1429 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-management
1431 int isis_instance_multi_topology_ipv6_management_create(
1432 struct nb_cb_create_args
*args
)
1434 return isis_multi_topology_common(args
->event
, args
->dnode
,
1435 args
->errmsg
, args
->errmsg_len
,
1439 int isis_instance_multi_topology_ipv6_management_destroy(
1440 struct nb_cb_destroy_args
*args
)
1442 return isis_multi_topology_common(args
->event
, args
->dnode
,
1443 args
->errmsg
, args
->errmsg_len
,
1444 "ipv6-mgmt", false);
1448 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-management/overload
1450 int isis_instance_multi_topology_ipv6_management_overload_modify(
1451 struct nb_cb_modify_args
*args
)
1453 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1458 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-dstsrc
1460 int isis_instance_multi_topology_ipv6_dstsrc_create(
1461 struct nb_cb_create_args
*args
)
1463 return isis_multi_topology_common(args
->event
, args
->dnode
,
1464 args
->errmsg
, args
->errmsg_len
,
1465 "ipv6-dstsrc", true);
1468 int isis_instance_multi_topology_ipv6_dstsrc_destroy(
1469 struct nb_cb_destroy_args
*args
)
1471 return isis_multi_topology_common(args
->event
, args
->dnode
,
1472 args
->errmsg
, args
->errmsg_len
,
1473 "ipv6-dstsrc", false);
1477 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-dstsrc/overload
1479 int isis_instance_multi_topology_ipv6_dstsrc_overload_modify(
1480 struct nb_cb_modify_args
*args
)
1482 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1487 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/load-sharing
1489 int isis_instance_fast_reroute_level_1_lfa_load_sharing_modify(
1490 struct nb_cb_modify_args
*args
)
1492 struct isis_area
*area
;
1494 if (args
->event
!= NB_EV_APPLY
)
1497 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1498 area
->lfa_load_sharing
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
1499 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1505 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/priority-limit
1507 int isis_instance_fast_reroute_level_1_lfa_priority_limit_modify(
1508 struct nb_cb_modify_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] = yang_dnode_get_enum(args
->dnode
, NULL
);
1517 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1522 int isis_instance_fast_reroute_level_1_lfa_priority_limit_destroy(
1523 struct nb_cb_destroy_args
*args
)
1525 struct isis_area
*area
;
1527 if (args
->event
!= NB_EV_APPLY
)
1530 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1531 area
->lfa_priority_limit
[0] = SPF_PREFIX_PRIO_LOW
;
1532 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1538 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/tiebreaker
1540 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_create(
1541 struct nb_cb_create_args
*args
)
1543 struct isis_area
*area
;
1545 enum lfa_tiebreaker_type type
;
1546 struct lfa_tiebreaker
*tie_b
;
1548 if (args
->event
!= NB_EV_APPLY
)
1551 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1552 index
= yang_dnode_get_uint8(args
->dnode
, "./index");
1553 type
= yang_dnode_get_enum(args
->dnode
, "./type");
1555 tie_b
= isis_lfa_tiebreaker_add(area
, ISIS_LEVEL1
, index
, type
);
1556 nb_running_set_entry(args
->dnode
, tie_b
);
1557 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1562 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_destroy(
1563 struct nb_cb_destroy_args
*args
)
1565 struct lfa_tiebreaker
*tie_b
;
1566 struct isis_area
*area
;
1568 if (args
->event
!= NB_EV_APPLY
)
1571 tie_b
= nb_running_unset_entry(args
->dnode
);
1573 isis_lfa_tiebreaker_delete(area
, ISIS_LEVEL1
, tie_b
);
1574 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1580 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/tiebreaker/type
1582 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_type_modify(
1583 struct nb_cb_modify_args
*args
)
1585 struct lfa_tiebreaker
*tie_b
;
1586 struct isis_area
*area
;
1588 if (args
->event
!= NB_EV_APPLY
)
1591 tie_b
= nb_running_get_entry(args
->dnode
, NULL
, true);
1593 tie_b
->type
= yang_dnode_get_enum(args
->dnode
, NULL
);
1594 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1600 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/remote-lfa/prefix-list
1602 int isis_instance_fast_reroute_level_1_remote_lfa_prefix_list_modify(
1603 struct nb_cb_modify_args
*args
)
1605 struct isis_area
*area
;
1606 const char *plist_name
;
1608 if (args
->event
!= NB_EV_APPLY
)
1611 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1612 plist_name
= yang_dnode_get_string(args
->dnode
, NULL
);
1614 area
->rlfa_plist_name
[0] = XSTRDUP(MTYPE_ISIS_PLIST_NAME
, plist_name
);
1615 area
->rlfa_plist
[0] = prefix_list_lookup(AFI_IP
, plist_name
);
1616 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1621 int isis_instance_fast_reroute_level_1_remote_lfa_prefix_list_destroy(
1622 struct nb_cb_destroy_args
*args
)
1624 struct isis_area
*area
;
1626 if (args
->event
!= NB_EV_APPLY
)
1629 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1631 XFREE(MTYPE_ISIS_PLIST_NAME
, area
->rlfa_plist_name
[0]);
1632 area
->rlfa_plist
[0] = NULL
;
1633 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1639 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/load-sharing
1641 int isis_instance_fast_reroute_level_2_lfa_load_sharing_modify(
1642 struct nb_cb_modify_args
*args
)
1644 struct isis_area
*area
;
1646 if (args
->event
!= NB_EV_APPLY
)
1649 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1650 area
->lfa_load_sharing
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
1656 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/priority-limit
1658 int isis_instance_fast_reroute_level_2_lfa_priority_limit_modify(
1659 struct nb_cb_modify_args
*args
)
1661 struct isis_area
*area
;
1663 if (args
->event
!= NB_EV_APPLY
)
1666 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1667 area
->lfa_priority_limit
[1] = yang_dnode_get_enum(args
->dnode
, NULL
);
1672 int isis_instance_fast_reroute_level_2_lfa_priority_limit_destroy(
1673 struct nb_cb_destroy_args
*args
)
1675 struct isis_area
*area
;
1677 if (args
->event
!= NB_EV_APPLY
)
1680 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1681 area
->lfa_priority_limit
[1] = SPF_PREFIX_PRIO_LOW
;
1687 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/tiebreaker
1689 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_create(
1690 struct nb_cb_create_args
*args
)
1692 struct isis_area
*area
;
1694 enum lfa_tiebreaker_type type
;
1695 struct lfa_tiebreaker
*tie_b
;
1697 if (args
->event
!= NB_EV_APPLY
)
1700 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1701 index
= yang_dnode_get_uint8(args
->dnode
, "./index");
1702 type
= yang_dnode_get_enum(args
->dnode
, "./type");
1704 tie_b
= isis_lfa_tiebreaker_add(area
, ISIS_LEVEL2
, index
, type
);
1705 nb_running_set_entry(args
->dnode
, tie_b
);
1706 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1711 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_destroy(
1712 struct nb_cb_destroy_args
*args
)
1714 struct lfa_tiebreaker
*tie_b
;
1715 struct isis_area
*area
;
1717 if (args
->event
!= NB_EV_APPLY
)
1720 tie_b
= nb_running_unset_entry(args
->dnode
);
1722 isis_lfa_tiebreaker_delete(area
, ISIS_LEVEL2
, tie_b
);
1723 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1729 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/tiebreaker/type
1731 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_type_modify(
1732 struct nb_cb_modify_args
*args
)
1734 struct lfa_tiebreaker
*tie_b
;
1735 struct isis_area
*area
;
1737 if (args
->event
!= NB_EV_APPLY
)
1740 tie_b
= nb_running_get_entry(args
->dnode
, NULL
, true);
1742 tie_b
->type
= yang_dnode_get_enum(args
->dnode
, NULL
);
1743 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1749 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/remote-lfa/prefix-list
1751 int isis_instance_fast_reroute_level_2_remote_lfa_prefix_list_modify(
1752 struct nb_cb_modify_args
*args
)
1754 struct isis_area
*area
;
1755 const char *plist_name
;
1757 if (args
->event
!= NB_EV_APPLY
)
1760 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1761 plist_name
= yang_dnode_get_string(args
->dnode
, NULL
);
1763 area
->rlfa_plist_name
[1] = XSTRDUP(MTYPE_ISIS_PLIST_NAME
, plist_name
);
1764 area
->rlfa_plist
[1] = prefix_list_lookup(AFI_IP
, plist_name
);
1765 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1770 int isis_instance_fast_reroute_level_2_remote_lfa_prefix_list_destroy(
1771 struct nb_cb_destroy_args
*args
)
1773 struct isis_area
*area
;
1775 if (args
->event
!= NB_EV_APPLY
)
1778 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1780 XFREE(MTYPE_ISIS_PLIST_NAME
, area
->rlfa_plist_name
[1]);
1781 area
->rlfa_plist
[1] = NULL
;
1782 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1788 * XPath: /frr-isisd:isis/instance/log-adjacency-changes
1790 int isis_instance_log_adjacency_changes_modify(struct nb_cb_modify_args
*args
)
1792 struct isis_area
*area
;
1793 bool log
= yang_dnode_get_bool(args
->dnode
, NULL
);
1795 if (args
->event
!= NB_EV_APPLY
)
1798 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1799 area
->log_adj_changes
= log
? 1 : 0;
1805 * XPath: /frr-isisd:isis/instance/mpls-te
1807 int isis_instance_mpls_te_create(struct nb_cb_create_args
*args
)
1809 struct listnode
*node
;
1810 struct isis_area
*area
;
1811 struct isis_circuit
*circuit
;
1813 if (args
->event
!= NB_EV_APPLY
)
1816 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1817 if (area
->mta
== NULL
) {
1819 struct mpls_te_area
*new;
1821 zlog_debug("ISIS-TE(%s): Initialize MPLS Traffic Engineering",
1824 new = XCALLOC(MTYPE_ISIS_MPLS_TE
, sizeof(struct mpls_te_area
));
1826 /* Initialize MPLS_TE structure */
1827 new->status
= enable
;
1829 new->inter_as
= off
;
1830 new->interas_areaid
.s_addr
= 0;
1831 new->router_id
.s_addr
= 0;
1832 new->ted
= ls_ted_new(1, "ISIS", 0);
1834 zlog_warn("Unable to create Link State Data Base");
1838 area
->mta
->status
= enable
;
1841 /* Initialize Link State Database */
1843 isis_te_init_ted(area
);
1845 /* Update Extended TLVs according to Interface link parameters */
1846 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
))
1847 isis_link_params_update(circuit
, circuit
->interface
);
1849 /* Reoriginate STD_TE & GMPLS circuits */
1850 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1855 int isis_instance_mpls_te_destroy(struct nb_cb_destroy_args
*args
)
1857 struct listnode
*node
;
1858 struct isis_area
*area
;
1859 struct isis_circuit
*circuit
;
1861 if (args
->event
!= NB_EV_APPLY
)
1864 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1865 if (IS_MPLS_TE(area
->mta
))
1866 area
->mta
->status
= disable
;
1870 /* Remove Link State Database */
1871 ls_ted_del_all(area
->mta
->ted
);
1873 /* Flush LSP if circuit engage */
1874 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
)) {
1875 if (!IS_EXT_TE(circuit
->ext
))
1878 /* disable MPLS_TE Circuit keeping SR one's */
1879 if (IS_SUBTLV(circuit
->ext
, EXT_ADJ_SID
))
1880 circuit
->ext
->status
= EXT_ADJ_SID
;
1881 else if (IS_SUBTLV(circuit
->ext
, EXT_LAN_ADJ_SID
))
1882 circuit
->ext
->status
= EXT_LAN_ADJ_SID
;
1884 circuit
->ext
->status
= 0;
1887 /* Reoriginate STD_TE & GMPLS circuits */
1888 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1890 zlog_debug("ISIS-TE(%s): Disabled MPLS Traffic Engineering",
1897 * XPath: /frr-isisd:isis/instance/mpls-te/router-address
1899 int isis_instance_mpls_te_router_address_modify(struct nb_cb_modify_args
*args
)
1901 struct in_addr value
;
1902 struct isis_area
*area
;
1904 if (args
->event
!= NB_EV_APPLY
)
1907 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1908 /* only proceed if MPLS-TE is enabled */
1909 if (!IS_MPLS_TE(area
->mta
))
1912 /* Update Area Router ID */
1913 yang_dnode_get_ipv4(&value
, args
->dnode
, NULL
);
1914 area
->mta
->router_id
.s_addr
= value
.s_addr
;
1916 /* And re-schedule LSP update */
1917 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1922 int isis_instance_mpls_te_router_address_destroy(
1923 struct nb_cb_destroy_args
*args
)
1925 struct isis_area
*area
;
1927 if (args
->event
!= NB_EV_APPLY
)
1930 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1931 /* only proceed if MPLS-TE is enabled */
1932 if (!IS_MPLS_TE(area
->mta
))
1935 /* Reset Area Router ID */
1936 area
->mta
->router_id
.s_addr
= INADDR_ANY
;
1938 /* And re-schedule LSP update */
1939 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1945 * XPath: /frr-isisd:isis/instance/mpls-te/router-address-v6
1947 int isis_instance_mpls_te_router_address_ipv6_modify(
1948 struct nb_cb_modify_args
*args
)
1950 struct in6_addr value
;
1951 struct isis_area
*area
;
1953 if (args
->event
!= NB_EV_APPLY
)
1956 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1957 /* only proceed if MPLS-TE is enabled */
1958 if (!IS_MPLS_TE(area
->mta
))
1961 yang_dnode_get_ipv6(&value
, args
->dnode
, NULL
);
1962 /* Update Area IPv6 Router ID if different */
1963 if (!IPV6_ADDR_SAME(&area
->mta
->router_id_ipv6
, &value
)) {
1964 IPV6_ADDR_COPY(&area
->mta
->router_id_ipv6
, &value
);
1966 /* And re-schedule LSP update */
1967 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1973 int isis_instance_mpls_te_router_address_ipv6_destroy(
1974 struct nb_cb_destroy_args
*args
)
1976 struct isis_area
*area
;
1978 if (args
->event
!= NB_EV_APPLY
)
1981 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1982 /* only proceed if MPLS-TE is enabled */
1983 if (!IS_MPLS_TE(area
->mta
))
1986 /* Reset Area Router ID */
1987 IPV6_ADDR_COPY(&area
->mta
->router_id_ipv6
, &in6addr_any
);
1989 /* And re-schedule LSP update */
1990 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1996 * XPath: /frr-isisd:isis/instance/mpls-te/export
1998 int isis_instance_mpls_te_export_modify(struct nb_cb_modify_args
*args
)
2000 struct isis_area
*area
;
2002 if (args
->event
!= NB_EV_APPLY
)
2005 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2006 /* only proceed if MPLS-TE is enabled */
2007 if (!IS_MPLS_TE(area
->mta
))
2010 area
->mta
->export
= yang_dnode_get_bool(args
->dnode
, NULL
);
2011 if (area
->mta
->export
) {
2012 if (IS_DEBUG_EVENTS
)
2013 zlog_debug("MPLS-TE: Enabled Link State export");
2014 if (isis_zebra_ls_register(true) != 0)
2015 zlog_warn("Unable to register Link State\n");
2017 if (IS_DEBUG_EVENTS
)
2018 zlog_debug("MPLS-TE: Disable Link State export");
2019 if (isis_zebra_ls_register(false) != 0)
2020 zlog_warn("Unable to register Link State\n");
2027 * XPath: /frr-isisd:isis/instance/segment-routing/enabled
2029 int isis_instance_segment_routing_enabled_modify(
2030 struct nb_cb_modify_args
*args
)
2032 struct isis_area
*area
;
2034 if (args
->event
!= NB_EV_APPLY
)
2037 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2038 area
->srdb
.config
.enabled
= yang_dnode_get_bool(args
->dnode
, NULL
);
2040 if (area
->srdb
.config
.enabled
) {
2041 if (IS_DEBUG_EVENTS
)
2042 zlog_debug("SR: Segment Routing: OFF -> ON");
2044 isis_sr_start(area
);
2046 if (IS_DEBUG_EVENTS
)
2047 zlog_debug("SR: Segment Routing: ON -> OFF");
2056 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks
2058 int isis_instance_segment_routing_label_blocks_pre_validate(
2059 struct nb_cb_pre_validate_args
*args
)
2061 uint32_t srgb_lbound
;
2062 uint32_t srgb_ubound
;
2063 uint32_t srlb_lbound
;
2064 uint32_t srlb_ubound
;
2066 srgb_lbound
= yang_dnode_get_uint32(args
->dnode
, "./srgb/lower-bound");
2067 srgb_ubound
= yang_dnode_get_uint32(args
->dnode
, "./srgb/upper-bound");
2068 srlb_lbound
= yang_dnode_get_uint32(args
->dnode
, "./srlb/lower-bound");
2069 srlb_ubound
= yang_dnode_get_uint32(args
->dnode
, "./srlb/upper-bound");
2071 /* Check that the block size does not exceed 65535 */
2072 if ((srgb_ubound
- srgb_lbound
+ 1) > 65535) {
2074 args
->errmsg
, args
->errmsg_len
,
2075 "New SR Global Block (%u/%u) exceed the limit of 65535",
2076 srgb_lbound
, srgb_ubound
);
2077 return NB_ERR_VALIDATION
;
2079 if ((srlb_ubound
- srlb_lbound
+ 1) > 65535) {
2080 snprintf(args
->errmsg
, args
->errmsg_len
,
2081 "New SR Local Block (%u/%u) exceed the limit of 65535",
2082 srlb_lbound
, srlb_ubound
);
2083 return NB_ERR_VALIDATION
;
2086 /* Validate SRGB against SRLB */
2087 if (!((srgb_ubound
< srlb_lbound
) || (srgb_lbound
> srlb_ubound
))) {
2089 args
->errmsg
, args
->errmsg_len
,
2090 "SR Global Block (%u/%u) conflicts with Local Block (%u/%u)",
2091 srgb_lbound
, srgb_ubound
, srlb_lbound
, srlb_ubound
);
2092 return NB_ERR_VALIDATION
;
2099 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb
2102 void isis_instance_segment_routing_srgb_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_srgb_update(area
, lower_bound
, upper_bound
);
2116 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb/lower-bound
2118 int isis_instance_segment_routing_srgb_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 SRGB lower bound: %u", lower_bound
);
2128 return NB_ERR_VALIDATION
;
2141 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb/upper-bound
2143 int isis_instance_segment_routing_srgb_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 SRGB upper bound: %u", upper_bound
);
2153 return NB_ERR_VALIDATION
;
2166 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb
2168 void isis_instance_segment_routing_srlb_apply_finish(
2169 struct nb_cb_apply_finish_args
*args
)
2171 struct isis_area
*area
;
2172 uint32_t lower_bound
, upper_bound
;
2174 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2175 lower_bound
= yang_dnode_get_uint32(args
->dnode
, "./lower-bound");
2176 upper_bound
= yang_dnode_get_uint32(args
->dnode
, "./upper-bound");
2178 isis_sr_cfg_srlb_update(area
, lower_bound
, upper_bound
);
2182 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb/lower-bound
2184 int isis_instance_segment_routing_srlb_lower_bound_modify(
2185 struct nb_cb_modify_args
*args
)
2187 uint32_t lower_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2189 switch (args
->event
) {
2190 case NB_EV_VALIDATE
:
2191 if (!IS_MPLS_UNRESERVED_LABEL(lower_bound
)) {
2192 snprintf(args
->errmsg
, args
->errmsg_len
,
2193 "Invalid SRLB lower bound: %u", lower_bound
);
2194 return NB_ERR_VALIDATION
;
2207 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb/upper-bound
2209 int isis_instance_segment_routing_srlb_upper_bound_modify(
2210 struct nb_cb_modify_args
*args
)
2212 uint32_t upper_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2214 switch (args
->event
) {
2215 case NB_EV_VALIDATE
:
2216 if (!IS_MPLS_UNRESERVED_LABEL(upper_bound
)) {
2217 snprintf(args
->errmsg
, args
->errmsg_len
,
2218 "Invalid SRLB upper bound: %u", upper_bound
);
2219 return NB_ERR_VALIDATION
;
2232 * XPath: /frr-isisd:isis/instance/segment-routing/msd/node-msd
2234 int isis_instance_segment_routing_msd_node_msd_modify(
2235 struct nb_cb_modify_args
*args
)
2237 struct isis_area
*area
;
2239 if (args
->event
!= NB_EV_APPLY
)
2242 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2243 area
->srdb
.config
.msd
= yang_dnode_get_uint8(args
->dnode
, NULL
);
2245 /* Update and regenerate LSP */
2246 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2251 int isis_instance_segment_routing_msd_node_msd_destroy(
2252 struct nb_cb_destroy_args
*args
)
2254 struct isis_area
*area
;
2256 if (args
->event
!= NB_EV_APPLY
)
2259 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2260 area
->srdb
.config
.msd
= 0;
2262 /* Update and regenerate LSP */
2263 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2269 * XPath: /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid
2271 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_create(
2272 struct nb_cb_create_args
*args
)
2274 struct isis_area
*area
;
2275 struct prefix prefix
;
2276 struct sr_prefix_cfg
*pcfg
;
2278 if (args
->event
!= NB_EV_APPLY
)
2281 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2282 yang_dnode_get_prefix(&prefix
, args
->dnode
, "./prefix");
2284 pcfg
= isis_sr_cfg_prefix_add(area
, &prefix
);
2285 nb_running_set_entry(args
->dnode
, pcfg
);
2290 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_destroy(
2291 struct nb_cb_destroy_args
*args
)
2293 struct sr_prefix_cfg
*pcfg
;
2294 struct isis_area
*area
;
2296 if (args
->event
!= NB_EV_APPLY
)
2299 pcfg
= nb_running_unset_entry(args
->dnode
);
2301 isis_sr_cfg_prefix_del(pcfg
);
2302 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2307 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_pre_validate(
2308 struct nb_cb_pre_validate_args
*args
)
2310 const struct lyd_node
*area_dnode
;
2311 struct isis_area
*area
;
2312 struct prefix prefix
;
2313 uint32_t srgb_lbound
;
2314 uint32_t srgb_ubound
;
2315 uint32_t srgb_range
;
2317 enum sr_sid_value_type sid_type
;
2318 struct isis_prefix_sid psid
= {};
2320 yang_dnode_get_prefix(&prefix
, args
->dnode
, "./prefix");
2321 srgb_lbound
= yang_dnode_get_uint32(
2322 args
->dnode
, "../../label-blocks/srgb/lower-bound");
2323 srgb_ubound
= yang_dnode_get_uint32(
2324 args
->dnode
, "../../label-blocks/srgb/upper-bound");
2325 sid
= yang_dnode_get_uint32(args
->dnode
, "./sid-value");
2326 sid_type
= yang_dnode_get_enum(args
->dnode
, "./sid-value-type");
2328 /* Check for invalid indexes/labels. */
2329 srgb_range
= srgb_ubound
- srgb_lbound
+ 1;
2332 case SR_SID_VALUE_TYPE_INDEX
:
2333 if (sid
>= srgb_range
) {
2334 snprintf(args
->errmsg
, args
->errmsg_len
,
2335 "SID index %u falls outside local SRGB range",
2337 return NB_ERR_VALIDATION
;
2340 case SR_SID_VALUE_TYPE_ABSOLUTE
:
2341 if (!IS_MPLS_UNRESERVED_LABEL(sid
)) {
2342 snprintf(args
->errmsg
, args
->errmsg_len
,
2343 "Invalid absolute SID %u", sid
);
2344 return NB_ERR_VALIDATION
;
2346 SET_FLAG(psid
.flags
, ISIS_PREFIX_SID_VALUE
);
2347 SET_FLAG(psid
.flags
, ISIS_PREFIX_SID_LOCAL
);
2351 /* Check for Prefix-SID collisions. */
2352 area_dnode
= yang_dnode_get_parent(args
->dnode
, "instance");
2353 area
= nb_running_get_entry(area_dnode
, NULL
, false);
2355 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
2356 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVEL2
;
2358 struct isis_spftree
*spftree
;
2359 struct isis_vertex
*vertex_psid
;
2361 if (!(area
->is_type
& level
))
2363 spftree
= area
->spftree
[tree
][level
- 1];
2367 vertex_psid
= isis_spf_prefix_sid_lookup(
2370 && !prefix_same(&vertex_psid
->N
.ip
.p
.dest
,
2373 args
->errmsg
, args
->errmsg_len
,
2374 "Prefix-SID collision detected, SID %s %u is already in use by prefix %pFX (L%u)",
2377 ISIS_PREFIX_SID_VALUE
)
2381 &vertex_psid
->N
.ip
.p
.dest
,
2383 return NB_ERR_VALIDATION
;
2392 void isis_instance_segment_routing_prefix_sid_map_prefix_sid_apply_finish(
2393 struct nb_cb_apply_finish_args
*args
)
2395 struct sr_prefix_cfg
*pcfg
;
2396 struct isis_area
*area
;
2398 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2400 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2405 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/sid-value-type
2407 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_sid_value_type_modify(
2408 struct nb_cb_modify_args
*args
)
2410 struct sr_prefix_cfg
*pcfg
;
2412 if (args
->event
!= NB_EV_APPLY
)
2415 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2416 pcfg
->sid_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2423 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/sid-value
2425 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_sid_value_modify(
2426 struct nb_cb_modify_args
*args
)
2428 struct sr_prefix_cfg
*pcfg
;
2430 if (args
->event
!= NB_EV_APPLY
)
2433 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2434 pcfg
->sid
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2441 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/last-hop-behavior
2443 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_last_hop_behavior_modify(
2444 struct nb_cb_modify_args
*args
)
2446 struct sr_prefix_cfg
*pcfg
;
2448 if (args
->event
!= NB_EV_APPLY
)
2451 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2452 pcfg
->last_hop_behavior
= yang_dnode_get_enum(args
->dnode
, NULL
);
2458 * XPath: /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/n-flag-clear
2460 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_n_flag_clear_modify(
2461 struct nb_cb_modify_args
*args
)
2463 struct sr_prefix_cfg
*pcfg
;
2465 if (args
->event
!= NB_EV_APPLY
)
2468 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2469 pcfg
->n_flag_clear
= yang_dnode_get_bool(args
->dnode
, NULL
);
2475 * XPath: /frr-isisd:isis/instance/mpls/ldp-sync
2477 int isis_instance_mpls_ldp_sync_create(struct nb_cb_create_args
*args
)
2479 struct isis_area
*area
;
2480 const char *vrfname
;
2482 switch (args
->event
) {
2483 case NB_EV_VALIDATE
:
2484 vrfname
= yang_dnode_get_string(
2485 lyd_parent(lyd_parent(args
->dnode
)), "./vrf");
2487 if (strcmp(vrfname
, VRF_DEFAULT_NAME
)) {
2488 snprintf(args
->errmsg
, args
->errmsg_len
,
2489 "LDP-Sync only runs on Default VRF");
2490 return NB_ERR_VALIDATION
;
2497 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2498 isis_area_ldp_sync_enable(area
);
2504 int isis_instance_mpls_ldp_sync_destroy(struct nb_cb_destroy_args
*args
)
2506 struct isis_area
*area
;
2508 if (args
->event
!= NB_EV_APPLY
)
2511 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2512 isis_area_ldp_sync_disable(area
);
2518 * XPath: /frr-isisd:isis/instance/mpls/ldp-sync/holddown
2520 int isis_instance_mpls_ldp_sync_holddown_modify(struct nb_cb_modify_args
*args
)
2522 struct isis_area
*area
;
2524 const char *vrfname
;
2526 switch (args
->event
) {
2527 case NB_EV_VALIDATE
:
2528 vrfname
= yang_dnode_get_string(
2529 lyd_parent(lyd_parent(lyd_parent(args
->dnode
))),
2532 if (strcmp(vrfname
, VRF_DEFAULT_NAME
)) {
2533 snprintf(args
->errmsg
, args
->errmsg_len
,
2534 "LDP-Sync only runs on Default VRF");
2535 return NB_ERR_VALIDATION
;
2542 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2543 holddown
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2544 isis_area_ldp_sync_set_holddown(area
, holddown
);
2551 * XPath: /frr-interface:lib/interface/frr-isisd:isis
2553 int lib_interface_isis_create(struct nb_cb_create_args
*args
)
2555 struct isis_area
*area
= NULL
;
2556 struct interface
*ifp
;
2557 struct isis_circuit
*circuit
= NULL
;
2558 const char *area_tag
= yang_dnode_get_string(args
->dnode
, "./area-tag");
2559 uint32_t min_mtu
, actual_mtu
;
2561 switch (args
->event
) {
2565 case NB_EV_VALIDATE
:
2566 /* check if interface mtu is sufficient. If the area has not
2567 * been created yet, assume default MTU for the area
2569 ifp
= nb_running_get_entry(args
->dnode
, NULL
, false);
2570 /* zebra might not know yet about the MTU - nothing we can do */
2571 if (!ifp
|| ifp
->mtu
== 0)
2574 if_is_broadcast(ifp
) ? ifp
->mtu
- LLC_LEN
: ifp
->mtu
;
2576 area
= isis_area_lookup(area_tag
, ifp
->vrf
->vrf_id
);
2578 min_mtu
= area
->lsp_mtu
;
2581 min_mtu
= yang_get_default_uint16(
2582 "/frr-isisd:isis/instance/lsp/mtu");
2584 min_mtu
= DEFAULT_LSP_MTU
;
2585 #endif /* ifndef FABRICD */
2586 if (actual_mtu
< min_mtu
) {
2587 snprintf(args
->errmsg
, args
->errmsg_len
,
2588 "Interface %s has MTU %u, minimum MTU for the area is %u",
2589 ifp
->name
, actual_mtu
, min_mtu
);
2590 return NB_ERR_VALIDATION
;
2594 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
2595 circuit
= isis_circuit_new(ifp
, area_tag
);
2596 nb_running_set_entry(args
->dnode
, circuit
);
2603 int lib_interface_isis_destroy(struct nb_cb_destroy_args
*args
)
2605 struct isis_circuit
*circuit
;
2607 if (args
->event
!= NB_EV_APPLY
)
2610 circuit
= nb_running_unset_entry(args
->dnode
);
2612 isis_circuit_del(circuit
);
2618 * XPath: /frr-interface:lib/interface/frr-isisd:isis/area-tag
2620 int lib_interface_isis_area_tag_modify(struct nb_cb_modify_args
*args
)
2622 struct isis_circuit
*circuit
;
2624 if (args
->event
== NB_EV_VALIDATE
) {
2625 circuit
= nb_running_get_entry_non_rec(lyd_parent(args
->dnode
), NULL
, false);
2627 snprintf(args
->errmsg
, args
->errmsg_len
,
2628 "Changing area tag is not allowed");
2629 return NB_ERR_VALIDATION
;
2637 * XPath: /frr-interface:lib/interface/frr-isisd:isis/circuit-type
2639 int lib_interface_isis_circuit_type_modify(struct nb_cb_modify_args
*args
)
2641 int circ_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2642 struct isis_circuit
*circuit
;
2644 switch (args
->event
) {
2645 case NB_EV_VALIDATE
:
2650 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2651 circuit
->is_type_config
= circ_type
;
2652 isis_circuit_is_type_set(circuit
, circ_type
);
2660 * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv4-routing
2662 int lib_interface_isis_ipv4_routing_modify(struct nb_cb_modify_args
*args
)
2665 struct isis_circuit
*circuit
;
2667 if (args
->event
!= NB_EV_APPLY
)
2670 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2671 ipv4
= yang_dnode_get_bool(args
->dnode
, NULL
);
2672 ipv6
= yang_dnode_get_bool(args
->dnode
, "../ipv6-routing");
2673 isis_circuit_af_set(circuit
, ipv4
, ipv6
);
2679 * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv6-routing
2681 int lib_interface_isis_ipv6_routing_modify(struct nb_cb_modify_args
*args
)
2684 struct isis_circuit
*circuit
;
2686 if (args
->event
!= NB_EV_APPLY
)
2689 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2690 ipv4
= yang_dnode_get_bool(args
->dnode
, "../ipv4-routing");
2691 ipv6
= yang_dnode_get_bool(args
->dnode
, NULL
);
2692 isis_circuit_af_set(circuit
, ipv4
, ipv6
);
2698 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring
2700 void lib_interface_isis_bfd_monitoring_apply_finish(
2701 struct nb_cb_apply_finish_args
*args
)
2703 struct isis_circuit
*circuit
;
2705 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2706 isis_bfd_circuit_cmd(circuit
);
2710 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring/enabled
2712 int lib_interface_isis_bfd_monitoring_enabled_modify(
2713 struct nb_cb_modify_args
*args
)
2715 struct isis_circuit
*circuit
;
2717 if (args
->event
!= NB_EV_APPLY
)
2720 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2721 circuit
->bfd_config
.enabled
= yang_dnode_get_bool(args
->dnode
, NULL
);
2727 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring/profile
2729 int lib_interface_isis_bfd_monitoring_profile_modify(
2730 struct nb_cb_modify_args
*args
)
2732 struct isis_circuit
*circuit
;
2734 if (args
->event
!= NB_EV_APPLY
)
2737 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2738 XFREE(MTYPE_TMP
, circuit
->bfd_config
.profile
);
2739 circuit
->bfd_config
.profile
=
2740 XSTRDUP(MTYPE_TMP
, yang_dnode_get_string(args
->dnode
, NULL
));
2745 int lib_interface_isis_bfd_monitoring_profile_destroy(
2746 struct nb_cb_destroy_args
*args
)
2748 struct isis_circuit
*circuit
;
2750 if (args
->event
!= NB_EV_APPLY
)
2753 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2754 XFREE(MTYPE_TMP
, circuit
->bfd_config
.profile
);
2760 * XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-1
2762 int lib_interface_isis_csnp_interval_level_1_modify(
2763 struct nb_cb_modify_args
*args
)
2765 struct isis_circuit
*circuit
;
2767 if (args
->event
!= NB_EV_APPLY
)
2770 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2771 circuit
->csnp_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2777 * XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-2
2779 int lib_interface_isis_csnp_interval_level_2_modify(
2780 struct nb_cb_modify_args
*args
)
2782 struct isis_circuit
*circuit
;
2784 if (args
->event
!= NB_EV_APPLY
)
2787 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2788 circuit
->csnp_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2794 * XPath: /frr-interface:lib/interface/frr-isisd:isis/psnp-interval/level-1
2796 int lib_interface_isis_psnp_interval_level_1_modify(
2797 struct nb_cb_modify_args
*args
)
2799 struct isis_circuit
*circuit
;
2801 if (args
->event
!= NB_EV_APPLY
)
2804 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2805 circuit
->psnp_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2811 * XPath: /frr-interface:lib/interface/frr-isisd:isis/psnp-interval/level-2
2813 int lib_interface_isis_psnp_interval_level_2_modify(
2814 struct nb_cb_modify_args
*args
)
2816 struct isis_circuit
*circuit
;
2818 if (args
->event
!= NB_EV_APPLY
)
2821 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2822 circuit
->psnp_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2828 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/padding
2830 int lib_interface_isis_hello_padding_modify(struct nb_cb_modify_args
*args
)
2832 struct isis_circuit
*circuit
;
2834 if (args
->event
!= NB_EV_APPLY
)
2837 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2838 circuit
->pad_hellos
= yang_dnode_get_bool(args
->dnode
, NULL
);
2844 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/interval/level-1
2846 int lib_interface_isis_hello_interval_level_1_modify(
2847 struct nb_cb_modify_args
*args
)
2849 struct isis_circuit
*circuit
;
2852 if (args
->event
!= NB_EV_APPLY
)
2855 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2856 interval
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2857 circuit
->hello_interval
[0] = interval
;
2863 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/interval/level-2
2865 int lib_interface_isis_hello_interval_level_2_modify(
2866 struct nb_cb_modify_args
*args
)
2868 struct isis_circuit
*circuit
;
2871 if (args
->event
!= NB_EV_APPLY
)
2874 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2875 interval
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2876 circuit
->hello_interval
[1] = interval
;
2882 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/multiplier/level-1
2884 int lib_interface_isis_hello_multiplier_level_1_modify(
2885 struct nb_cb_modify_args
*args
)
2887 struct isis_circuit
*circuit
;
2890 if (args
->event
!= NB_EV_APPLY
)
2893 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2894 multi
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2895 circuit
->hello_multiplier
[0] = multi
;
2901 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/multiplier/level-2
2903 int lib_interface_isis_hello_multiplier_level_2_modify(
2904 struct nb_cb_modify_args
*args
)
2906 struct isis_circuit
*circuit
;
2909 if (args
->event
!= NB_EV_APPLY
)
2912 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2913 multi
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2914 circuit
->hello_multiplier
[1] = multi
;
2920 * XPath: /frr-interface:lib/interface/frr-isisd:isis/metric/level-1
2922 int lib_interface_isis_metric_level_1_modify(struct nb_cb_modify_args
*args
)
2924 struct isis_circuit
*circuit
;
2927 if (args
->event
!= NB_EV_APPLY
)
2930 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2931 met
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2932 isis_circuit_metric_set(circuit
, IS_LEVEL_1
, met
);
2938 * XPath: /frr-interface:lib/interface/frr-isisd:isis/metric/level-2
2940 int lib_interface_isis_metric_level_2_modify(struct nb_cb_modify_args
*args
)
2942 struct isis_circuit
*circuit
;
2945 if (args
->event
!= NB_EV_APPLY
)
2948 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2949 met
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2950 isis_circuit_metric_set(circuit
, IS_LEVEL_2
, met
);
2956 * XPath: /frr-interface:lib/interface/frr-isisd:isis/priority/level-1
2958 int lib_interface_isis_priority_level_1_modify(struct nb_cb_modify_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 circuit
->priority
[0] = yang_dnode_get_uint8(args
->dnode
, NULL
);
2972 * XPath: /frr-interface:lib/interface/frr-isisd:isis/priority/level-2
2974 int lib_interface_isis_priority_level_2_modify(struct nb_cb_modify_args
*args
)
2976 struct isis_circuit
*circuit
;
2978 if (args
->event
!= NB_EV_APPLY
)
2981 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2982 circuit
->priority
[1] = yang_dnode_get_uint8(args
->dnode
, NULL
);
2988 * XPath: /frr-interface:lib/interface/frr-isisd:isis/network-type
2990 int lib_interface_isis_network_type_modify(struct nb_cb_modify_args
*args
)
2992 struct isis_circuit
*circuit
;
2993 int net_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2995 switch (args
->event
) {
2996 case NB_EV_VALIDATE
:
2997 circuit
= nb_running_get_entry(args
->dnode
, NULL
, false);
3000 if (circuit
->circ_type
== CIRCUIT_T_LOOPBACK
) {
3002 args
->errmsg
, args
->errmsg_len
,
3003 "Cannot change network type on loopback interface");
3004 return NB_ERR_VALIDATION
;
3006 if (net_type
== CIRCUIT_T_BROADCAST
3007 && circuit
->state
== C_STATE_UP
3008 && !if_is_broadcast(circuit
->interface
)) {
3010 args
->errmsg
, args
->errmsg_len
,
3011 "Cannot configure non-broadcast interface for broadcast operation");
3012 return NB_ERR_VALIDATION
;
3019 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3020 isis_circuit_circ_type_set(circuit
, net_type
);
3028 * XPath: /frr-interface:lib/interface/frr-isisd:isis/passive
3030 int lib_interface_isis_passive_modify(struct nb_cb_modify_args
*args
)
3032 struct isis_circuit
*circuit
;
3033 bool passive
= yang_dnode_get_bool(args
->dnode
, NULL
);
3035 if (args
->event
!= NB_EV_APPLY
)
3038 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3039 isis_circuit_passive_set(circuit
, passive
);
3045 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password
3047 int lib_interface_isis_password_create(struct nb_cb_create_args
*args
)
3052 int lib_interface_isis_password_destroy(struct nb_cb_destroy_args
*args
)
3054 struct isis_circuit
*circuit
;
3056 if (args
->event
!= NB_EV_APPLY
)
3059 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3060 isis_circuit_passwd_unset(circuit
);
3066 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password/password
3068 int lib_interface_isis_password_password_modify(struct nb_cb_modify_args
*args
)
3070 struct isis_circuit
*circuit
;
3071 const char *password
;
3073 if (args
->event
!= NB_EV_APPLY
)
3076 password
= yang_dnode_get_string(args
->dnode
, NULL
);
3077 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3079 isis_circuit_passwd_set(circuit
, circuit
->passwd
.type
, password
);
3085 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password/password-type
3087 int lib_interface_isis_password_password_type_modify(
3088 struct nb_cb_modify_args
*args
)
3090 struct isis_circuit
*circuit
;
3093 if (args
->event
!= NB_EV_APPLY
)
3096 pass_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
3097 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3098 circuit
->passwd
.type
= pass_type
;
3105 * /frr-interface:lib/interface/frr-isisd:isis/disable-three-way-handshake
3107 int lib_interface_isis_disable_three_way_handshake_modify(
3108 struct nb_cb_modify_args
*args
)
3110 struct isis_circuit
*circuit
;
3112 if (args
->event
!= NB_EV_APPLY
)
3115 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3116 circuit
->disable_threeway_adj
= yang_dnode_get_bool(args
->dnode
, NULL
);
3123 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-unicast
3125 static int lib_interface_isis_multi_topology_common(
3126 enum nb_event event
, const struct lyd_node
*dnode
, char *errmsg
,
3127 size_t errmsg_len
, uint16_t mtid
)
3129 struct isis_circuit
*circuit
;
3133 case NB_EV_VALIDATE
:
3134 circuit
= nb_running_get_entry(dnode
, NULL
, false);
3135 if (circuit
&& circuit
->area
&& circuit
->area
->oldmetric
) {
3138 "Multi topology IS-IS can only be used with wide metrics");
3139 return NB_ERR_VALIDATION
;
3146 circuit
= nb_running_get_entry(dnode
, NULL
, true);
3147 value
= yang_dnode_get_bool(dnode
, NULL
);
3148 isis_circuit_mt_enabled_set(circuit
, mtid
, value
);
3155 int lib_interface_isis_multi_topology_ipv4_unicast_modify(
3156 struct nb_cb_modify_args
*args
)
3158 return lib_interface_isis_multi_topology_common(
3159 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3160 ISIS_MT_IPV4_UNICAST
);
3165 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-multicast
3167 int lib_interface_isis_multi_topology_ipv4_multicast_modify(
3168 struct nb_cb_modify_args
*args
)
3170 return lib_interface_isis_multi_topology_common(
3171 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3172 ISIS_MT_IPV4_MULTICAST
);
3177 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-management
3179 int lib_interface_isis_multi_topology_ipv4_management_modify(
3180 struct nb_cb_modify_args
*args
)
3182 return lib_interface_isis_multi_topology_common(
3183 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3189 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-unicast
3191 int lib_interface_isis_multi_topology_ipv6_unicast_modify(
3192 struct nb_cb_modify_args
*args
)
3194 return lib_interface_isis_multi_topology_common(
3195 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3196 ISIS_MT_IPV6_UNICAST
);
3201 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-multicast
3203 int lib_interface_isis_multi_topology_ipv6_multicast_modify(
3204 struct nb_cb_modify_args
*args
)
3206 return lib_interface_isis_multi_topology_common(
3207 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3208 ISIS_MT_IPV6_MULTICAST
);
3213 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-management
3215 int lib_interface_isis_multi_topology_ipv6_management_modify(
3216 struct nb_cb_modify_args
*args
)
3218 return lib_interface_isis_multi_topology_common(
3219 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3224 * XPath: /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-dstsrc
3226 int lib_interface_isis_multi_topology_ipv6_dstsrc_modify(
3227 struct nb_cb_modify_args
*args
)
3229 return lib_interface_isis_multi_topology_common(
3230 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3231 ISIS_MT_IPV6_DSTSRC
);
3235 * XPath: /frr-interface:lib/interface/frr-isisd:isis/mpls/ldp-sync
3237 int lib_interface_isis_mpls_ldp_sync_modify(struct nb_cb_modify_args
*args
)
3239 struct isis_circuit
*circuit
;
3240 struct ldp_sync_info
*ldp_sync_info
;
3241 bool ldp_sync_enable
;
3243 switch (args
->event
) {
3244 case NB_EV_VALIDATE
:
3249 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3250 ldp_sync_enable
= yang_dnode_get_bool(args
->dnode
, NULL
);
3252 ldp_sync_info
= circuit
->ldp_sync_info
;
3254 SET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_IF_CONFIG
);
3255 ldp_sync_info
->enabled
= ldp_sync_enable
;
3257 if (circuit
->area
) {
3258 if (ldp_sync_enable
)
3259 isis_if_ldp_sync_enable(circuit
);
3261 isis_if_ldp_sync_disable(circuit
);
3269 * XPath: /frr-interface:lib/interface/frr-isisd:isis/mpls/holddown
3271 int lib_interface_isis_mpls_holddown_modify(struct nb_cb_modify_args
*args
)
3273 struct isis_circuit
*circuit
;
3274 struct ldp_sync_info
*ldp_sync_info
;
3277 switch (args
->event
) {
3278 case NB_EV_VALIDATE
:
3283 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3284 holddown
= yang_dnode_get_uint16(args
->dnode
, NULL
);
3286 ldp_sync_info
= circuit
->ldp_sync_info
;
3288 SET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_HOLDDOWN
);
3289 ldp_sync_info
->holddown
= holddown
;
3295 int lib_interface_isis_mpls_holddown_destroy(struct nb_cb_destroy_args
*args
)
3297 struct isis_circuit
*circuit
;
3298 struct ldp_sync_info
*ldp_sync_info
;
3300 switch (args
->event
) {
3301 case NB_EV_VALIDATE
:
3306 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3307 ldp_sync_info
= circuit
->ldp_sync_info
;
3309 UNSET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_HOLDDOWN
);
3312 isis_if_set_ldp_sync_holddown(circuit
);
3321 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/lfa/enable
3323 int lib_interface_isis_fast_reroute_level_1_lfa_enable_modify(
3324 struct nb_cb_modify_args
*args
)
3326 struct isis_area
*area
;
3327 struct isis_circuit
*circuit
;
3329 if (args
->event
!= NB_EV_APPLY
)
3332 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3333 circuit
->lfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3335 area
= circuit
->area
;
3337 if (circuit
->lfa_protection
[0])
3338 area
->lfa_protected_links
[0]++;
3340 assert(area
->lfa_protected_links
[0] > 0);
3341 area
->lfa_protected_links
[0]--;
3344 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3352 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/lfa/exclude-interface
3354 int lib_interface_isis_fast_reroute_level_1_lfa_exclude_interface_create(
3355 struct nb_cb_create_args
*args
)
3357 struct isis_area
*area
;
3358 struct isis_circuit
*circuit
;
3359 const char *exclude_ifname
;
3361 if (args
->event
!= NB_EV_APPLY
)
3364 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3365 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3367 isis_lfa_excluded_iface_add(circuit
, ISIS_LEVEL1
, exclude_ifname
);
3368 area
= circuit
->area
;
3370 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3375 int lib_interface_isis_fast_reroute_level_1_lfa_exclude_interface_destroy(
3376 struct nb_cb_destroy_args
*args
)
3378 struct isis_area
*area
;
3379 struct isis_circuit
*circuit
;
3380 const char *exclude_ifname
;
3382 if (args
->event
!= NB_EV_APPLY
)
3385 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3386 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3388 isis_lfa_excluded_iface_delete(circuit
, ISIS_LEVEL1
, exclude_ifname
);
3389 area
= circuit
->area
;
3391 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3398 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/remote-lfa/enable
3400 int lib_interface_isis_fast_reroute_level_1_remote_lfa_enable_modify(
3401 struct nb_cb_modify_args
*args
)
3403 struct isis_area
*area
;
3404 struct isis_circuit
*circuit
;
3406 if (args
->event
!= NB_EV_APPLY
)
3409 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3410 circuit
->rlfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3412 area
= circuit
->area
;
3414 if (circuit
->rlfa_protection
[0])
3415 area
->rlfa_protected_links
[0]++;
3417 assert(area
->rlfa_protected_links
[0] > 0);
3418 area
->rlfa_protected_links
[0]--;
3421 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3429 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/remote-lfa/maximum-metric
3431 int lib_interface_isis_fast_reroute_level_1_remote_lfa_maximum_metric_modify(
3432 struct nb_cb_modify_args
*args
)
3434 struct isis_area
*area
;
3435 struct isis_circuit
*circuit
;
3437 if (args
->event
!= NB_EV_APPLY
)
3440 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3441 circuit
->rlfa_max_metric
[0] = yang_dnode_get_uint32(args
->dnode
, NULL
);
3443 area
= circuit
->area
;
3445 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3450 int lib_interface_isis_fast_reroute_level_1_remote_lfa_maximum_metric_destroy(
3451 struct nb_cb_destroy_args
*args
)
3453 struct isis_area
*area
;
3454 struct isis_circuit
*circuit
;
3456 if (args
->event
!= NB_EV_APPLY
)
3459 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3460 circuit
->rlfa_max_metric
[0] = 0;
3462 area
= circuit
->area
;
3464 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3471 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/enable
3473 int lib_interface_isis_fast_reroute_level_1_ti_lfa_enable_modify(
3474 struct nb_cb_modify_args
*args
)
3476 struct isis_area
*area
;
3477 struct isis_circuit
*circuit
;
3479 if (args
->event
!= NB_EV_APPLY
)
3482 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3483 circuit
->tilfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3485 area
= circuit
->area
;
3487 if (circuit
->tilfa_protection
[0])
3488 area
->tilfa_protected_links
[0]++;
3490 assert(area
->tilfa_protected_links
[0] > 0);
3491 area
->tilfa_protected_links
[0]--;
3494 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3502 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/node-protection
3504 int lib_interface_isis_fast_reroute_level_1_ti_lfa_node_protection_modify(
3505 struct nb_cb_modify_args
*args
)
3507 struct isis_area
*area
;
3508 struct isis_circuit
*circuit
;
3510 if (args
->event
!= NB_EV_APPLY
)
3513 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3514 circuit
->tilfa_node_protection
[0] =
3515 yang_dnode_get_bool(args
->dnode
, NULL
);
3517 area
= circuit
->area
;
3519 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3526 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/link-fallback
3528 int lib_interface_isis_fast_reroute_level_1_ti_lfa_link_fallback_modify(
3529 struct nb_cb_modify_args
*args
)
3531 struct isis_area
*area
;
3532 struct isis_circuit
*circuit
;
3534 if (args
->event
!= NB_EV_APPLY
)
3537 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3538 circuit
->tilfa_link_fallback
[0] =
3539 yang_dnode_get_bool(args
->dnode
, NULL
);
3541 area
= circuit
->area
;
3543 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3550 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/lfa/enable
3552 int lib_interface_isis_fast_reroute_level_2_lfa_enable_modify(
3553 struct nb_cb_modify_args
*args
)
3555 struct isis_area
*area
;
3556 struct isis_circuit
*circuit
;
3558 if (args
->event
!= NB_EV_APPLY
)
3561 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3562 circuit
->lfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3564 area
= circuit
->area
;
3566 if (circuit
->lfa_protection
[1])
3567 area
->lfa_protected_links
[1]++;
3569 assert(area
->lfa_protected_links
[1] > 0);
3570 area
->lfa_protected_links
[1]--;
3573 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3581 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/lfa/exclude-interface
3583 int lib_interface_isis_fast_reroute_level_2_lfa_exclude_interface_create(
3584 struct nb_cb_create_args
*args
)
3586 struct isis_area
*area
;
3587 struct isis_circuit
*circuit
;
3588 const char *exclude_ifname
;
3590 if (args
->event
!= NB_EV_APPLY
)
3593 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3594 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3596 isis_lfa_excluded_iface_add(circuit
, ISIS_LEVEL2
, exclude_ifname
);
3597 area
= circuit
->area
;
3599 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3604 int lib_interface_isis_fast_reroute_level_2_lfa_exclude_interface_destroy(
3605 struct nb_cb_destroy_args
*args
)
3607 struct isis_area
*area
;
3608 struct isis_circuit
*circuit
;
3609 const char *exclude_ifname
;
3611 if (args
->event
!= NB_EV_APPLY
)
3614 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3615 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3617 isis_lfa_excluded_iface_delete(circuit
, ISIS_LEVEL2
, exclude_ifname
);
3618 area
= circuit
->area
;
3620 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3627 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/remote-lfa/enable
3629 int lib_interface_isis_fast_reroute_level_2_remote_lfa_enable_modify(
3630 struct nb_cb_modify_args
*args
)
3632 struct isis_area
*area
;
3633 struct isis_circuit
*circuit
;
3635 if (args
->event
!= NB_EV_APPLY
)
3638 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3639 circuit
->rlfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3641 area
= circuit
->area
;
3643 if (circuit
->rlfa_protection
[1])
3644 area
->rlfa_protected_links
[1]++;
3646 assert(area
->rlfa_protected_links
[1] > 0);
3647 area
->rlfa_protected_links
[1]--;
3650 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3658 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/remote-lfa/maximum-metric
3660 int lib_interface_isis_fast_reroute_level_2_remote_lfa_maximum_metric_modify(
3661 struct nb_cb_modify_args
*args
)
3663 struct isis_area
*area
;
3664 struct isis_circuit
*circuit
;
3666 if (args
->event
!= NB_EV_APPLY
)
3669 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3670 circuit
->rlfa_max_metric
[1] = yang_dnode_get_uint32(args
->dnode
, NULL
);
3672 area
= circuit
->area
;
3674 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3679 int lib_interface_isis_fast_reroute_level_2_remote_lfa_maximum_metric_destroy(
3680 struct nb_cb_destroy_args
*args
)
3682 struct isis_area
*area
;
3683 struct isis_circuit
*circuit
;
3685 if (args
->event
!= NB_EV_APPLY
)
3688 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3689 circuit
->rlfa_max_metric
[1] = 0;
3691 area
= circuit
->area
;
3693 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3700 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/enable
3702 int lib_interface_isis_fast_reroute_level_2_ti_lfa_enable_modify(
3703 struct nb_cb_modify_args
*args
)
3705 struct isis_area
*area
;
3706 struct isis_circuit
*circuit
;
3708 if (args
->event
!= NB_EV_APPLY
)
3711 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3712 circuit
->tilfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3714 area
= circuit
->area
;
3716 if (circuit
->tilfa_protection
[1])
3717 area
->tilfa_protected_links
[1]++;
3719 assert(area
->tilfa_protected_links
[1] > 0);
3720 area
->tilfa_protected_links
[1]--;
3723 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3731 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/node-protection
3733 int lib_interface_isis_fast_reroute_level_2_ti_lfa_node_protection_modify(
3734 struct nb_cb_modify_args
*args
)
3736 struct isis_area
*area
;
3737 struct isis_circuit
*circuit
;
3739 if (args
->event
!= NB_EV_APPLY
)
3742 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3743 circuit
->tilfa_node_protection
[1] =
3744 yang_dnode_get_bool(args
->dnode
, NULL
);
3746 area
= circuit
->area
;
3748 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3755 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/link-fallback
3757 int lib_interface_isis_fast_reroute_level_2_ti_lfa_link_fallback_modify(
3758 struct nb_cb_modify_args
*args
)
3760 struct isis_area
*area
;
3761 struct isis_circuit
*circuit
;
3763 if (args
->event
!= NB_EV_APPLY
)
3766 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3767 circuit
->tilfa_link_fallback
[1] =
3768 yang_dnode_get_bool(args
->dnode
, NULL
);
3770 area
= circuit
->area
;
3772 lsp_regenerate_schedule(area
, area
->is_type
, 0);