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 * XPath: /frr-isisd:isis/instance/area-address
117 int isis_instance_area_address_create(struct nb_cb_create_args
*args
)
119 struct isis_area
*area
;
120 struct area_addr addr
, *addrr
= NULL
, *addrp
= NULL
;
121 struct listnode
*node
;
123 const char *net_title
= yang_dnode_get_string(args
->dnode
, NULL
);
125 switch (args
->event
) {
127 area
= nb_running_get_entry(args
->dnode
, NULL
, false);
129 return NB_ERR_VALIDATION
;
130 addr
.addr_len
= dotformat2buff(buff
, net_title
);
131 memcpy(addr
.area_addr
, buff
, addr
.addr_len
);
132 if (addr
.area_addr
[addr
.addr_len
- 1] != 0) {
134 args
->errmsg
, args
->errmsg_len
,
135 "nsel byte (last byte) in area address must be 0");
136 return NB_ERR_VALIDATION
;
138 if (area
->isis
->sysid_set
) {
139 /* Check that the SystemID portions match */
140 if (memcmp(area
->isis
->sysid
, GETSYSID((&addr
)),
143 args
->errmsg
, args
->errmsg_len
,
144 "System ID must not change when defining additional area addresses");
145 return NB_ERR_VALIDATION
;
150 addrr
= XMALLOC(MTYPE_ISIS_AREA_ADDR
, sizeof(struct area_addr
));
151 addrr
->addr_len
= dotformat2buff(buff
, net_title
);
152 memcpy(addrr
->area_addr
, buff
, addrr
->addr_len
);
153 args
->resource
->ptr
= addrr
;
156 XFREE(MTYPE_ISIS_AREA_ADDR
, args
->resource
->ptr
);
159 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
160 addrr
= args
->resource
->ptr
;
163 if (area
->isis
->sysid_set
== 0) {
165 * First area address - get the SystemID for this router
167 memcpy(area
->isis
->sysid
, GETSYSID(addrr
),
169 area
->isis
->sysid_set
= 1;
171 /* check that we don't already have this address */
172 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
,
174 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
176 != (addrr
->addr_len
))
178 if (!memcmp(addrp
->area_addr
, addrr
->area_addr
,
180 XFREE(MTYPE_ISIS_AREA_ADDR
, addrr
);
181 return NB_OK
; /* silent fail */
186 /*Forget the systemID part of the address */
187 addrr
->addr_len
-= (ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
);
188 assert(area
->area_addrs
); /* to silence scan-build sillyness */
189 listnode_add(area
->area_addrs
, addrr
);
191 /* only now we can safely generate our LSPs for this area */
192 if (listcount(area
->area_addrs
) > 0) {
193 if (area
->is_type
& IS_LEVEL_1
)
194 lsp_generate(area
, IS_LEVEL_1
);
195 if (area
->is_type
& IS_LEVEL_2
)
196 lsp_generate(area
, IS_LEVEL_2
);
204 int isis_instance_area_address_destroy(struct nb_cb_destroy_args
*args
)
206 struct area_addr addr
, *addrp
= NULL
;
207 struct listnode
*node
;
209 struct isis_area
*area
;
210 const char *net_title
;
211 struct listnode
*cnode
;
212 struct isis_circuit
*circuit
;
215 if (args
->event
!= NB_EV_APPLY
)
218 net_title
= yang_dnode_get_string(args
->dnode
, NULL
);
219 addr
.addr_len
= dotformat2buff(buff
, net_title
);
220 memcpy(addr
.area_addr
, buff
, (int)addr
.addr_len
);
221 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
223 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
)) {
224 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ 1) == addr
.addr_len
225 && !memcmp(addrp
->area_addr
, addr
.area_addr
, addr
.addr_len
))
229 return NB_ERR_INCONSISTENCY
;
231 listnode_delete(area
->area_addrs
, addrp
);
232 XFREE(MTYPE_ISIS_AREA_ADDR
, addrp
);
234 * Last area address - reset the SystemID for this router
236 if (listcount(area
->area_addrs
) == 0) {
237 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
))
238 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
239 if (circuit
->u
.bc
.is_dr
[lvl
- 1])
240 isis_dr_resign(circuit
, lvl
);
242 memset(area
->isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
243 area
->isis
->sysid_set
= 0;
245 zlog_debug("Router has no SystemID");
252 * XPath: /frr-isisd:isis/instance/dynamic-hostname
254 int isis_instance_dynamic_hostname_modify(struct nb_cb_modify_args
*args
)
256 struct isis_area
*area
;
258 if (args
->event
!= NB_EV_APPLY
)
261 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
262 isis_area_dynhostname_set(area
, yang_dnode_get_bool(args
->dnode
, NULL
));
268 * XPath: /frr-isisd:isis/instance/attach-send
270 int isis_instance_attached_send_modify(struct nb_cb_modify_args
*args
)
272 struct isis_area
*area
;
275 if (args
->event
!= NB_EV_APPLY
)
278 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
279 attached
= yang_dnode_get_bool(args
->dnode
, NULL
);
280 isis_area_attached_bit_send_set(area
, attached
);
286 * XPath: /frr-isisd:isis/instance/attach-receive-ignore
288 int isis_instance_attached_receive_modify(struct nb_cb_modify_args
*args
)
290 struct isis_area
*area
;
293 if (args
->event
!= NB_EV_APPLY
)
296 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
297 attached
= yang_dnode_get_bool(args
->dnode
, NULL
);
298 isis_area_attached_bit_receive_set(area
, attached
);
304 * XPath: /frr-isisd:isis/instance/attached
306 int isis_instance_attached_modify(struct nb_cb_modify_args
*args
)
312 * XPath: /frr-isisd:isis/instance/overload
314 int isis_instance_overload_modify(struct nb_cb_modify_args
*args
)
316 struct isis_area
*area
;
319 if (args
->event
!= NB_EV_APPLY
)
322 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
323 overload
= yang_dnode_get_bool(args
->dnode
, NULL
);
324 isis_area_overload_bit_set(area
, overload
);
330 * XPath: /frr-isisd:isis/instance/metric-style
332 int isis_instance_metric_style_modify(struct nb_cb_modify_args
*args
)
334 struct isis_area
*area
;
335 bool old_metric
, new_metric
;
336 enum isis_metric_style metric_style
=
337 yang_dnode_get_enum(args
->dnode
, NULL
);
339 if (args
->event
!= NB_EV_APPLY
)
342 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
343 old_metric
= (metric_style
== ISIS_WIDE_METRIC
) ? false : true;
344 new_metric
= (metric_style
== ISIS_NARROW_METRIC
) ? false : true;
345 isis_area_metricstyle_set(area
, old_metric
, new_metric
);
351 * XPath: /frr-isisd:isis/instance/purge-originator
353 int isis_instance_purge_originator_modify(struct nb_cb_modify_args
*args
)
355 struct isis_area
*area
;
357 if (args
->event
!= NB_EV_APPLY
)
360 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
361 area
->purge_originator
= yang_dnode_get_bool(args
->dnode
, NULL
);
367 * XPath: /frr-isisd:isis/instance/lsp/mtu
369 int isis_instance_lsp_mtu_modify(struct nb_cb_modify_args
*args
)
371 struct listnode
*node
;
372 struct isis_circuit
*circuit
;
373 uint16_t lsp_mtu
= yang_dnode_get_uint16(args
->dnode
, NULL
);
374 struct isis_area
*area
;
376 switch (args
->event
) {
378 area
= nb_running_get_entry(args
->dnode
, NULL
, false);
381 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
)) {
382 if (circuit
->state
!= C_STATE_INIT
383 && circuit
->state
!= C_STATE_UP
)
385 if (lsp_mtu
> isis_circuit_pdu_size(circuit
)) {
387 args
->errmsg
, args
->errmsg_len
,
388 "ISIS area contains circuit %s, which has a maximum PDU size of %zu",
389 circuit
->interface
->name
,
390 isis_circuit_pdu_size(circuit
));
391 return NB_ERR_VALIDATION
;
399 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
400 isis_area_lsp_mtu_set(area
, lsp_mtu
);
408 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/refresh-interval
410 int isis_instance_lsp_refresh_interval_level_1_modify(
411 struct nb_cb_modify_args
*args
)
413 struct isis_area
*area
;
416 if (args
->event
!= NB_EV_APPLY
)
419 refr_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
420 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
421 isis_area_lsp_refresh_set(area
, IS_LEVEL_1
, refr_int
);
427 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/refresh-interval
429 int isis_instance_lsp_refresh_interval_level_2_modify(
430 struct nb_cb_modify_args
*args
)
432 struct isis_area
*area
;
435 if (args
->event
!= NB_EV_APPLY
)
438 refr_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
439 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
440 isis_area_lsp_refresh_set(area
, IS_LEVEL_2
, refr_int
);
446 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/maximum-lifetime
448 int isis_instance_lsp_maximum_lifetime_level_1_modify(
449 struct nb_cb_modify_args
*args
)
451 struct isis_area
*area
;
454 if (args
->event
!= NB_EV_APPLY
)
457 max_lt
= yang_dnode_get_uint16(args
->dnode
, NULL
);
458 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
459 isis_area_max_lsp_lifetime_set(area
, IS_LEVEL_1
, max_lt
);
465 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/maximum-lifetime
467 int isis_instance_lsp_maximum_lifetime_level_2_modify(
468 struct nb_cb_modify_args
*args
)
470 struct isis_area
*area
;
473 if (args
->event
!= NB_EV_APPLY
)
476 max_lt
= yang_dnode_get_uint16(args
->dnode
, NULL
);
477 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
478 isis_area_max_lsp_lifetime_set(area
, IS_LEVEL_2
, max_lt
);
484 * XPath: /frr-isisd:isis/instance/lsp/timers/level-1/generation-interval
486 int isis_instance_lsp_generation_interval_level_1_modify(
487 struct nb_cb_modify_args
*args
)
489 struct isis_area
*area
;
492 if (args
->event
!= NB_EV_APPLY
)
495 gen_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
496 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
497 area
->lsp_gen_interval
[0] = gen_int
;
503 * XPath: /frr-isisd:isis/instance/lsp/timers/level-2/generation-interval
505 int isis_instance_lsp_generation_interval_level_2_modify(
506 struct nb_cb_modify_args
*args
)
508 struct isis_area
*area
;
511 if (args
->event
!= NB_EV_APPLY
)
514 gen_int
= yang_dnode_get_uint16(args
->dnode
, NULL
);
515 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
516 area
->lsp_gen_interval
[1] = gen_int
;
522 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay
524 void ietf_backoff_delay_apply_finish(struct nb_cb_apply_finish_args
*args
)
526 long init_delay
= yang_dnode_get_uint16(args
->dnode
, "./init-delay");
527 long short_delay
= yang_dnode_get_uint16(args
->dnode
, "./short-delay");
528 long long_delay
= yang_dnode_get_uint16(args
->dnode
, "./long-delay");
529 long holddown
= yang_dnode_get_uint16(args
->dnode
, "./hold-down");
531 yang_dnode_get_uint16(args
->dnode
, "./time-to-learn");
532 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
533 size_t bufsiz
= strlen(area
->area_tag
) + sizeof("IS-IS Lx");
534 char *buf
= XCALLOC(MTYPE_TMP
, bufsiz
);
536 snprintf(buf
, bufsiz
, "IS-IS %s L1", area
->area_tag
);
537 spf_backoff_free(area
->spf_delay_ietf
[0]);
538 area
->spf_delay_ietf
[0] =
539 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
540 long_delay
, holddown
, timetolearn
);
542 snprintf(buf
, bufsiz
, "IS-IS %s L2", area
->area_tag
);
543 spf_backoff_free(area
->spf_delay_ietf
[1]);
544 area
->spf_delay_ietf
[1] =
545 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
546 long_delay
, holddown
, timetolearn
);
548 XFREE(MTYPE_TMP
, buf
);
551 int isis_instance_spf_ietf_backoff_delay_create(struct nb_cb_create_args
*args
)
553 /* All the work is done in the apply_finish */
557 int isis_instance_spf_ietf_backoff_delay_destroy(
558 struct nb_cb_destroy_args
*args
)
560 struct isis_area
*area
;
562 if (args
->event
!= NB_EV_APPLY
)
565 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
566 spf_backoff_free(area
->spf_delay_ietf
[0]);
567 spf_backoff_free(area
->spf_delay_ietf
[1]);
568 area
->spf_delay_ietf
[0] = NULL
;
569 area
->spf_delay_ietf
[1] = NULL
;
575 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/init-delay
577 int isis_instance_spf_ietf_backoff_delay_init_delay_modify(
578 struct nb_cb_modify_args
*args
)
580 /* All the work is done in the apply_finish */
585 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/short-delay
587 int isis_instance_spf_ietf_backoff_delay_short_delay_modify(
588 struct nb_cb_modify_args
*args
)
590 /* All the work is done in the apply_finish */
595 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/long-delay
597 int isis_instance_spf_ietf_backoff_delay_long_delay_modify(
598 struct nb_cb_modify_args
*args
)
600 /* All the work is done in the apply_finish */
605 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/hold-down
607 int isis_instance_spf_ietf_backoff_delay_hold_down_modify(
608 struct nb_cb_modify_args
*args
)
610 /* All the work is done in the apply_finish */
615 * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay/time-to-learn
617 int isis_instance_spf_ietf_backoff_delay_time_to_learn_modify(
618 struct nb_cb_modify_args
*args
)
620 /* All the work is done in the apply_finish */
625 * XPath: /frr-isisd:isis/instance/spf/minimum-interval/level-1
627 int isis_instance_spf_minimum_interval_level_1_modify(
628 struct nb_cb_modify_args
*args
)
630 struct isis_area
*area
;
632 if (args
->event
!= NB_EV_APPLY
)
635 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
636 area
->min_spf_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
642 * XPath: /frr-isisd:isis/instance/spf/minimum-interval/level-2
644 int isis_instance_spf_minimum_interval_level_2_modify(
645 struct nb_cb_modify_args
*args
)
647 struct isis_area
*area
;
649 if (args
->event
!= NB_EV_APPLY
)
652 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
653 area
->min_spf_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
660 * /frr-isisd:isis/instance/spf/prefix-priorities/critical/access-list-name
662 int isis_instance_spf_prefix_priorities_critical_access_list_name_modify(
663 struct nb_cb_modify_args
*args
)
665 struct isis_area
*area
;
666 const char *acl_name
;
667 struct spf_prefix_priority_acl
*ppa
;
669 if (args
->event
!= NB_EV_APPLY
)
672 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
673 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
675 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_CRITICAL
];
676 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
677 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
678 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
679 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
680 lsp_regenerate_schedule(area
, area
->is_type
, 0);
685 int isis_instance_spf_prefix_priorities_critical_access_list_name_destroy(
686 struct nb_cb_destroy_args
*args
)
688 struct isis_area
*area
;
689 struct spf_prefix_priority_acl
*ppa
;
691 if (args
->event
!= NB_EV_APPLY
)
694 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
696 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_CRITICAL
];
697 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
700 lsp_regenerate_schedule(area
, area
->is_type
, 0);
706 * XPath: /frr-isisd:isis/instance/spf/prefix-priorities/high/access-list-name
708 int isis_instance_spf_prefix_priorities_high_access_list_name_modify(
709 struct nb_cb_modify_args
*args
)
711 struct isis_area
*area
;
712 const char *acl_name
;
713 struct spf_prefix_priority_acl
*ppa
;
715 if (args
->event
!= NB_EV_APPLY
)
718 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
719 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
721 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_HIGH
];
722 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
723 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
724 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
725 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
726 lsp_regenerate_schedule(area
, area
->is_type
, 0);
731 int isis_instance_spf_prefix_priorities_high_access_list_name_destroy(
732 struct nb_cb_destroy_args
*args
)
734 struct isis_area
*area
;
735 struct spf_prefix_priority_acl
*ppa
;
737 if (args
->event
!= NB_EV_APPLY
)
740 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
742 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_HIGH
];
743 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
746 lsp_regenerate_schedule(area
, area
->is_type
, 0);
752 * XPath: /frr-isisd:isis/instance/spf/prefix-priorities/medium/access-list-name
754 int isis_instance_spf_prefix_priorities_medium_access_list_name_modify(
755 struct nb_cb_modify_args
*args
)
757 struct isis_area
*area
;
758 const char *acl_name
;
759 struct spf_prefix_priority_acl
*ppa
;
761 if (args
->event
!= NB_EV_APPLY
)
764 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
765 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
767 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_MEDIUM
];
768 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
769 ppa
->name
= XSTRDUP(MTYPE_ISIS_ACL_NAME
, acl_name
);
770 ppa
->list_v4
= access_list_lookup(AFI_IP
, acl_name
);
771 ppa
->list_v6
= access_list_lookup(AFI_IP6
, acl_name
);
772 lsp_regenerate_schedule(area
, area
->is_type
, 0);
777 int isis_instance_spf_prefix_priorities_medium_access_list_name_destroy(
778 struct nb_cb_destroy_args
*args
)
780 struct isis_area
*area
;
781 struct spf_prefix_priority_acl
*ppa
;
783 if (args
->event
!= NB_EV_APPLY
)
786 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
788 ppa
= &area
->spf_prefix_priorities
[SPF_PREFIX_PRIO_MEDIUM
];
789 XFREE(MTYPE_ISIS_ACL_NAME
, ppa
->name
);
792 lsp_regenerate_schedule(area
, area
->is_type
, 0);
798 * XPath: /frr-isisd:isis/instance/area-password
800 void area_password_apply_finish(struct nb_cb_apply_finish_args
*args
)
802 const char *password
= yang_dnode_get_string(args
->dnode
, "./password");
803 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
804 int pass_type
= yang_dnode_get_enum(args
->dnode
, "./password-type");
806 yang_dnode_get_enum(args
->dnode
, "./authenticate-snp");
809 case ISIS_PASSWD_TYPE_CLEARTXT
:
810 isis_area_passwd_cleartext_set(area
, IS_LEVEL_1
, password
,
813 case ISIS_PASSWD_TYPE_HMAC_MD5
:
814 isis_area_passwd_hmac_md5_set(area
, IS_LEVEL_1
, password
,
820 int isis_instance_area_password_create(struct nb_cb_create_args
*args
)
822 /* actual setting is done in apply_finish */
826 int isis_instance_area_password_destroy(struct nb_cb_destroy_args
*args
)
828 struct isis_area
*area
;
830 if (args
->event
!= NB_EV_APPLY
)
833 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
834 isis_area_passwd_unset(area
, IS_LEVEL_1
);
840 * XPath: /frr-isisd:isis/instance/area-password/password
842 int isis_instance_area_password_password_modify(struct nb_cb_modify_args
*args
)
844 /* actual setting is done in apply_finish */
849 * XPath: /frr-isisd:isis/instance/area-password/password-type
851 int isis_instance_area_password_password_type_modify(
852 struct nb_cb_modify_args
*args
)
854 /* actual setting is done in apply_finish */
859 * XPath: /frr-isisd:isis/instance/area-password/authenticate-snp
861 int isis_instance_area_password_authenticate_snp_modify(
862 struct nb_cb_modify_args
*args
)
864 /* actual setting is done in apply_finish */
869 * XPath: /frr-isisd:isis/instance/domain-password
871 void domain_password_apply_finish(struct nb_cb_apply_finish_args
*args
)
873 const char *password
= yang_dnode_get_string(args
->dnode
, "./password");
874 struct isis_area
*area
= nb_running_get_entry(args
->dnode
, NULL
, true);
875 int pass_type
= yang_dnode_get_enum(args
->dnode
, "./password-type");
877 yang_dnode_get_enum(args
->dnode
, "./authenticate-snp");
880 case ISIS_PASSWD_TYPE_CLEARTXT
:
881 isis_area_passwd_cleartext_set(area
, IS_LEVEL_2
, password
,
884 case ISIS_PASSWD_TYPE_HMAC_MD5
:
885 isis_area_passwd_hmac_md5_set(area
, IS_LEVEL_2
, password
,
891 int isis_instance_domain_password_create(struct nb_cb_create_args
*args
)
893 /* actual setting is done in apply_finish */
897 int isis_instance_domain_password_destroy(struct nb_cb_destroy_args
*args
)
899 struct isis_area
*area
;
901 if (args
->event
!= NB_EV_APPLY
)
904 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
905 isis_area_passwd_unset(area
, IS_LEVEL_2
);
911 * XPath: /frr-isisd:isis/instance/domain-password/password
913 int isis_instance_domain_password_password_modify(
914 struct nb_cb_modify_args
*args
)
916 /* actual setting is done in apply_finish */
921 * XPath: /frr-isisd:isis/instance/domain-password/password-type
923 int isis_instance_domain_password_password_type_modify(
924 struct nb_cb_modify_args
*args
)
926 /* actual setting is done in apply_finish */
931 * XPath: /frr-isisd:isis/instance/domain-password/authenticate-snp
933 int isis_instance_domain_password_authenticate_snp_modify(
934 struct nb_cb_modify_args
*args
)
936 /* actual setting is done in apply_finish */
941 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4
943 void default_info_origin_apply_finish(const struct lyd_node
*dnode
, int family
)
945 int originate_type
= DEFAULT_ORIGINATE
;
946 unsigned long metric
= 0;
947 const char *routemap
= NULL
;
948 struct isis_area
*area
= nb_running_get_entry(dnode
, NULL
, true);
949 int level
= yang_dnode_get_enum(dnode
, "./level");
951 if (yang_dnode_get_bool(dnode
, "./always")) {
952 originate_type
= DEFAULT_ORIGINATE_ALWAYS
;
953 } else if (family
== AF_INET6
) {
955 "%s: Zebra doesn't implement default-originate for IPv6 yet, so use with care or use default-originate always.",
959 if (yang_dnode_exists(dnode
, "./metric"))
960 metric
= yang_dnode_get_uint32(dnode
, "./metric");
961 if (yang_dnode_exists(dnode
, "./route-map"))
962 routemap
= yang_dnode_get_string(dnode
, "./route-map");
964 isis_redist_set(area
, level
, family
, DEFAULT_ROUTE
, metric
, routemap
,
968 void default_info_origin_ipv4_apply_finish(struct nb_cb_apply_finish_args
*args
)
970 default_info_origin_apply_finish(args
->dnode
, AF_INET
);
973 void default_info_origin_ipv6_apply_finish(struct nb_cb_apply_finish_args
*args
)
975 default_info_origin_apply_finish(args
->dnode
, AF_INET6
);
978 int isis_instance_default_information_originate_ipv4_create(
979 struct nb_cb_create_args
*args
)
981 /* It's all done by default_info_origin_apply_finish */
985 int isis_instance_default_information_originate_ipv4_destroy(
986 struct nb_cb_destroy_args
*args
)
988 struct isis_area
*area
;
991 if (args
->event
!= NB_EV_APPLY
)
994 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
995 level
= yang_dnode_get_enum(args
->dnode
, "./level");
996 isis_redist_unset(area
, level
, AF_INET
, DEFAULT_ROUTE
);
1002 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/always
1004 int isis_instance_default_information_originate_ipv4_always_modify(
1005 struct nb_cb_modify_args
*args
)
1007 /* It's all done by default_info_origin_apply_finish */
1012 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/route-map
1014 int isis_instance_default_information_originate_ipv4_route_map_modify(
1015 struct nb_cb_modify_args
*args
)
1017 /* It's all done by default_info_origin_apply_finish */
1021 int isis_instance_default_information_originate_ipv4_route_map_destroy(
1022 struct nb_cb_destroy_args
*args
)
1024 /* It's all done by default_info_origin_apply_finish */
1029 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv4/metric
1031 int isis_instance_default_information_originate_ipv4_metric_modify(
1032 struct nb_cb_modify_args
*args
)
1034 /* It's all done by default_info_origin_apply_finish */
1039 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6
1041 int isis_instance_default_information_originate_ipv6_create(
1042 struct nb_cb_create_args
*args
)
1044 /* It's all done by default_info_origin_apply_finish */
1048 int isis_instance_default_information_originate_ipv6_destroy(
1049 struct nb_cb_destroy_args
*args
)
1051 struct isis_area
*area
;
1054 if (args
->event
!= NB_EV_APPLY
)
1057 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1058 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1059 isis_redist_unset(area
, level
, AF_INET6
, DEFAULT_ROUTE
);
1065 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/always
1067 int isis_instance_default_information_originate_ipv6_always_modify(
1068 struct nb_cb_modify_args
*args
)
1070 /* It's all done by default_info_origin_apply_finish */
1075 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/route-map
1077 int isis_instance_default_information_originate_ipv6_route_map_modify(
1078 struct nb_cb_modify_args
*args
)
1080 /* It's all done by default_info_origin_apply_finish */
1084 int isis_instance_default_information_originate_ipv6_route_map_destroy(
1085 struct nb_cb_destroy_args
*args
)
1087 /* It's all done by default_info_origin_apply_finish */
1092 * XPath: /frr-isisd:isis/instance/default-information-originate/ipv6/metric
1094 int isis_instance_default_information_originate_ipv6_metric_modify(
1095 struct nb_cb_modify_args
*args
)
1097 /* It's all done by default_info_origin_apply_finish */
1102 * XPath: /frr-isisd:isis/instance/redistribute/ipv4
1104 void redistribute_apply_finish(const struct lyd_node
*dnode
, int family
)
1106 assert(family
== AF_INET
|| family
== AF_INET6
);
1108 unsigned long metric
= 0;
1109 const char *routemap
= NULL
;
1110 struct isis_area
*area
;
1112 type
= yang_dnode_get_enum(dnode
, "./protocol");
1113 level
= yang_dnode_get_enum(dnode
, "./level");
1114 area
= nb_running_get_entry(dnode
, NULL
, true);
1116 if (yang_dnode_exists(dnode
, "./metric"))
1117 metric
= yang_dnode_get_uint32(dnode
, "./metric");
1118 if (yang_dnode_exists(dnode
, "./route-map"))
1119 routemap
= yang_dnode_get_string(dnode
, "./route-map");
1121 isis_redist_set(area
, level
, family
, type
, metric
, routemap
, 0);
1124 void redistribute_ipv4_apply_finish(struct nb_cb_apply_finish_args
*args
)
1126 redistribute_apply_finish(args
->dnode
, AF_INET
);
1129 void redistribute_ipv6_apply_finish(struct nb_cb_apply_finish_args
*args
)
1131 redistribute_apply_finish(args
->dnode
, AF_INET6
);
1134 int isis_instance_redistribute_ipv4_create(struct nb_cb_create_args
*args
)
1136 /* It's all done by redistribute_apply_finish */
1140 int isis_instance_redistribute_ipv4_destroy(struct nb_cb_destroy_args
*args
)
1142 struct isis_area
*area
;
1145 if (args
->event
!= NB_EV_APPLY
)
1148 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1149 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1150 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
1151 isis_redist_unset(area
, level
, AF_INET
, type
);
1157 * XPath: /frr-isisd:isis/instance/redistribute/ipv4/route-map
1159 int isis_instance_redistribute_ipv4_route_map_modify(
1160 struct nb_cb_modify_args
*args
)
1162 /* It's all done by redistribute_apply_finish */
1166 int isis_instance_redistribute_ipv4_route_map_destroy(
1167 struct nb_cb_destroy_args
*args
)
1169 /* It's all done by redistribute_apply_finish */
1174 * XPath: /frr-isisd:isis/instance/redistribute/ipv4/metric
1176 int isis_instance_redistribute_ipv4_metric_modify(
1177 struct nb_cb_modify_args
*args
)
1179 /* It's all done by redistribute_apply_finish */
1184 * XPath: /frr-isisd:isis/instance/redistribute/ipv6
1186 int isis_instance_redistribute_ipv6_create(struct nb_cb_create_args
*args
)
1188 /* It's all done by redistribute_apply_finish */
1192 int isis_instance_redistribute_ipv6_destroy(struct nb_cb_destroy_args
*args
)
1194 struct isis_area
*area
;
1197 if (args
->event
!= NB_EV_APPLY
)
1200 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1201 level
= yang_dnode_get_enum(args
->dnode
, "./level");
1202 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
1203 isis_redist_unset(area
, level
, AF_INET6
, type
);
1209 * XPath: /frr-isisd:isis/instance/redistribute/ipv6/route-map
1211 int isis_instance_redistribute_ipv6_route_map_modify(
1212 struct nb_cb_modify_args
*args
)
1214 /* It's all done by redistribute_apply_finish */
1218 int isis_instance_redistribute_ipv6_route_map_destroy(
1219 struct nb_cb_destroy_args
*args
)
1221 /* It's all done by redistribute_apply_finish */
1226 * XPath: /frr-isisd:isis/instance/redistribute/ipv6/metric
1228 int isis_instance_redistribute_ipv6_metric_modify(
1229 struct nb_cb_modify_args
*args
)
1231 /* It's all done by redistribute_apply_finish */
1236 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-multicast
1238 static int isis_multi_topology_common(enum nb_event event
,
1239 const struct lyd_node
*dnode
,
1240 char *errmsg
, size_t errmsg_len
,
1241 const char *topology
, bool create
)
1243 struct isis_area
*area
;
1244 struct isis_area_mt_setting
*setting
;
1245 uint16_t mtid
= isis_str2mtid(topology
);
1248 case NB_EV_VALIDATE
:
1249 if (mtid
== (uint16_t)-1) {
1250 snprintf(errmsg
, errmsg_len
, "Unknown topology %s",
1252 return NB_ERR_VALIDATION
;
1259 area
= nb_running_get_entry(dnode
, NULL
, true);
1260 setting
= area_get_mt_setting(area
, mtid
);
1261 setting
->enabled
= create
;
1262 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1269 static int isis_multi_topology_overload_common(enum nb_event event
,
1270 const struct lyd_node
*dnode
,
1271 const char *topology
)
1273 struct isis_area
*area
;
1274 struct isis_area_mt_setting
*setting
;
1275 uint16_t mtid
= isis_str2mtid(topology
);
1277 /* validation is done in isis_multi_topology_common */
1278 if (event
!= NB_EV_APPLY
)
1281 area
= nb_running_get_entry(dnode
, NULL
, true);
1282 setting
= area_get_mt_setting(area
, mtid
);
1283 setting
->overload
= yang_dnode_get_bool(dnode
, NULL
);
1284 if (setting
->enabled
)
1285 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1290 int isis_instance_multi_topology_ipv4_multicast_create(
1291 struct nb_cb_create_args
*args
)
1293 return isis_multi_topology_common(args
->event
, args
->dnode
,
1294 args
->errmsg
, args
->errmsg_len
,
1295 "ipv4-multicast", true);
1298 int isis_instance_multi_topology_ipv4_multicast_destroy(
1299 struct nb_cb_destroy_args
*args
)
1301 return isis_multi_topology_common(args
->event
, args
->dnode
,
1302 args
->errmsg
, args
->errmsg_len
,
1303 "ipv4-multicast", false);
1307 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-multicast/overload
1309 int isis_instance_multi_topology_ipv4_multicast_overload_modify(
1310 struct nb_cb_modify_args
*args
)
1312 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1317 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-management
1319 int isis_instance_multi_topology_ipv4_management_create(
1320 struct nb_cb_create_args
*args
)
1322 return isis_multi_topology_common(args
->event
, args
->dnode
,
1323 args
->errmsg
, args
->errmsg_len
,
1327 int isis_instance_multi_topology_ipv4_management_destroy(
1328 struct nb_cb_destroy_args
*args
)
1330 return isis_multi_topology_common(args
->event
, args
->dnode
,
1331 args
->errmsg
, args
->errmsg_len
,
1332 "ipv4-mgmt", false);
1336 * XPath: /frr-isisd:isis/instance/multi-topology/ipv4-management/overload
1338 int isis_instance_multi_topology_ipv4_management_overload_modify(
1339 struct nb_cb_modify_args
*args
)
1341 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1346 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-unicast
1348 int isis_instance_multi_topology_ipv6_unicast_create(
1349 struct nb_cb_create_args
*args
)
1351 return isis_multi_topology_common(args
->event
, args
->dnode
,
1352 args
->errmsg
, args
->errmsg_len
,
1353 "ipv6-unicast", true);
1356 int isis_instance_multi_topology_ipv6_unicast_destroy(
1357 struct nb_cb_destroy_args
*args
)
1359 return isis_multi_topology_common(args
->event
, args
->dnode
,
1360 args
->errmsg
, args
->errmsg_len
,
1361 "ipv6-unicast", false);
1365 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-unicast/overload
1367 int isis_instance_multi_topology_ipv6_unicast_overload_modify(
1368 struct nb_cb_modify_args
*args
)
1370 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1375 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-multicast
1377 int isis_instance_multi_topology_ipv6_multicast_create(
1378 struct nb_cb_create_args
*args
)
1380 return isis_multi_topology_common(args
->event
, args
->dnode
,
1381 args
->errmsg
, args
->errmsg_len
,
1382 "ipv6-multicast", true);
1385 int isis_instance_multi_topology_ipv6_multicast_destroy(
1386 struct nb_cb_destroy_args
*args
)
1388 return isis_multi_topology_common(args
->event
, args
->dnode
,
1389 args
->errmsg
, args
->errmsg_len
,
1390 "ipv6-multicast", false);
1394 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-multicast/overload
1396 int isis_instance_multi_topology_ipv6_multicast_overload_modify(
1397 struct nb_cb_modify_args
*args
)
1399 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1404 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-management
1406 int isis_instance_multi_topology_ipv6_management_create(
1407 struct nb_cb_create_args
*args
)
1409 return isis_multi_topology_common(args
->event
, args
->dnode
,
1410 args
->errmsg
, args
->errmsg_len
,
1414 int isis_instance_multi_topology_ipv6_management_destroy(
1415 struct nb_cb_destroy_args
*args
)
1417 return isis_multi_topology_common(args
->event
, args
->dnode
,
1418 args
->errmsg
, args
->errmsg_len
,
1419 "ipv6-mgmt", false);
1423 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-management/overload
1425 int isis_instance_multi_topology_ipv6_management_overload_modify(
1426 struct nb_cb_modify_args
*args
)
1428 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1433 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-dstsrc
1435 int isis_instance_multi_topology_ipv6_dstsrc_create(
1436 struct nb_cb_create_args
*args
)
1438 return isis_multi_topology_common(args
->event
, args
->dnode
,
1439 args
->errmsg
, args
->errmsg_len
,
1440 "ipv6-dstsrc", true);
1443 int isis_instance_multi_topology_ipv6_dstsrc_destroy(
1444 struct nb_cb_destroy_args
*args
)
1446 return isis_multi_topology_common(args
->event
, args
->dnode
,
1447 args
->errmsg
, args
->errmsg_len
,
1448 "ipv6-dstsrc", false);
1452 * XPath: /frr-isisd:isis/instance/multi-topology/ipv6-dstsrc/overload
1454 int isis_instance_multi_topology_ipv6_dstsrc_overload_modify(
1455 struct nb_cb_modify_args
*args
)
1457 return isis_multi_topology_overload_common(args
->event
, args
->dnode
,
1462 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/load-sharing
1464 int isis_instance_fast_reroute_level_1_lfa_load_sharing_modify(
1465 struct nb_cb_modify_args
*args
)
1467 struct isis_area
*area
;
1469 if (args
->event
!= NB_EV_APPLY
)
1472 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1473 area
->lfa_load_sharing
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
1474 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1480 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/priority-limit
1482 int isis_instance_fast_reroute_level_1_lfa_priority_limit_modify(
1483 struct nb_cb_modify_args
*args
)
1485 struct isis_area
*area
;
1487 if (args
->event
!= NB_EV_APPLY
)
1490 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1491 area
->lfa_priority_limit
[0] = yang_dnode_get_enum(args
->dnode
, NULL
);
1492 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1497 int isis_instance_fast_reroute_level_1_lfa_priority_limit_destroy(
1498 struct nb_cb_destroy_args
*args
)
1500 struct isis_area
*area
;
1502 if (args
->event
!= NB_EV_APPLY
)
1505 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1506 area
->lfa_priority_limit
[0] = SPF_PREFIX_PRIO_LOW
;
1507 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1513 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/tiebreaker
1515 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_create(
1516 struct nb_cb_create_args
*args
)
1518 struct isis_area
*area
;
1520 enum lfa_tiebreaker_type type
;
1521 struct lfa_tiebreaker
*tie_b
;
1523 if (args
->event
!= NB_EV_APPLY
)
1526 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1527 index
= yang_dnode_get_uint8(args
->dnode
, "./index");
1528 type
= yang_dnode_get_enum(args
->dnode
, "./type");
1530 tie_b
= isis_lfa_tiebreaker_add(area
, ISIS_LEVEL1
, index
, type
);
1531 nb_running_set_entry(args
->dnode
, tie_b
);
1532 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1537 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_destroy(
1538 struct nb_cb_destroy_args
*args
)
1540 struct lfa_tiebreaker
*tie_b
;
1541 struct isis_area
*area
;
1543 if (args
->event
!= NB_EV_APPLY
)
1546 tie_b
= nb_running_unset_entry(args
->dnode
);
1548 isis_lfa_tiebreaker_delete(area
, ISIS_LEVEL1
, tie_b
);
1549 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1555 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/lfa/tiebreaker/type
1557 int isis_instance_fast_reroute_level_1_lfa_tiebreaker_type_modify(
1558 struct nb_cb_modify_args
*args
)
1560 struct lfa_tiebreaker
*tie_b
;
1561 struct isis_area
*area
;
1563 if (args
->event
!= NB_EV_APPLY
)
1566 tie_b
= nb_running_get_entry(args
->dnode
, NULL
, true);
1568 tie_b
->type
= yang_dnode_get_enum(args
->dnode
, NULL
);
1569 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1575 * XPath: /frr-isisd:isis/instance/fast-reroute/level-1/remote-lfa/prefix-list
1577 int isis_instance_fast_reroute_level_1_remote_lfa_prefix_list_modify(
1578 struct nb_cb_modify_args
*args
)
1580 struct isis_area
*area
;
1581 const char *plist_name
;
1583 if (args
->event
!= NB_EV_APPLY
)
1586 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1587 plist_name
= yang_dnode_get_string(args
->dnode
, NULL
);
1589 area
->rlfa_plist_name
[0] = XSTRDUP(MTYPE_ISIS_PLIST_NAME
, plist_name
);
1590 area
->rlfa_plist
[0] = prefix_list_lookup(AFI_IP
, plist_name
);
1591 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1596 int isis_instance_fast_reroute_level_1_remote_lfa_prefix_list_destroy(
1597 struct nb_cb_destroy_args
*args
)
1599 struct isis_area
*area
;
1601 if (args
->event
!= NB_EV_APPLY
)
1604 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1606 XFREE(MTYPE_ISIS_PLIST_NAME
, area
->rlfa_plist_name
[0]);
1607 area
->rlfa_plist
[0] = NULL
;
1608 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1614 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/load-sharing
1616 int isis_instance_fast_reroute_level_2_lfa_load_sharing_modify(
1617 struct nb_cb_modify_args
*args
)
1619 struct isis_area
*area
;
1621 if (args
->event
!= NB_EV_APPLY
)
1624 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1625 area
->lfa_load_sharing
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
1631 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/priority-limit
1633 int isis_instance_fast_reroute_level_2_lfa_priority_limit_modify(
1634 struct nb_cb_modify_args
*args
)
1636 struct isis_area
*area
;
1638 if (args
->event
!= NB_EV_APPLY
)
1641 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1642 area
->lfa_priority_limit
[1] = yang_dnode_get_enum(args
->dnode
, NULL
);
1647 int isis_instance_fast_reroute_level_2_lfa_priority_limit_destroy(
1648 struct nb_cb_destroy_args
*args
)
1650 struct isis_area
*area
;
1652 if (args
->event
!= NB_EV_APPLY
)
1655 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1656 area
->lfa_priority_limit
[1] = SPF_PREFIX_PRIO_LOW
;
1662 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/tiebreaker
1664 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_create(
1665 struct nb_cb_create_args
*args
)
1667 struct isis_area
*area
;
1669 enum lfa_tiebreaker_type type
;
1670 struct lfa_tiebreaker
*tie_b
;
1672 if (args
->event
!= NB_EV_APPLY
)
1675 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1676 index
= yang_dnode_get_uint8(args
->dnode
, "./index");
1677 type
= yang_dnode_get_enum(args
->dnode
, "./type");
1679 tie_b
= isis_lfa_tiebreaker_add(area
, ISIS_LEVEL2
, index
, type
);
1680 nb_running_set_entry(args
->dnode
, tie_b
);
1681 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1686 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_destroy(
1687 struct nb_cb_destroy_args
*args
)
1689 struct lfa_tiebreaker
*tie_b
;
1690 struct isis_area
*area
;
1692 if (args
->event
!= NB_EV_APPLY
)
1695 tie_b
= nb_running_unset_entry(args
->dnode
);
1697 isis_lfa_tiebreaker_delete(area
, ISIS_LEVEL2
, tie_b
);
1698 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1704 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/lfa/tiebreaker/type
1706 int isis_instance_fast_reroute_level_2_lfa_tiebreaker_type_modify(
1707 struct nb_cb_modify_args
*args
)
1709 struct lfa_tiebreaker
*tie_b
;
1710 struct isis_area
*area
;
1712 if (args
->event
!= NB_EV_APPLY
)
1715 tie_b
= nb_running_get_entry(args
->dnode
, NULL
, true);
1717 tie_b
->type
= yang_dnode_get_enum(args
->dnode
, NULL
);
1718 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1724 * XPath: /frr-isisd:isis/instance/fast-reroute/level-2/remote-lfa/prefix-list
1726 int isis_instance_fast_reroute_level_2_remote_lfa_prefix_list_modify(
1727 struct nb_cb_modify_args
*args
)
1729 struct isis_area
*area
;
1730 const char *plist_name
;
1732 if (args
->event
!= NB_EV_APPLY
)
1735 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1736 plist_name
= yang_dnode_get_string(args
->dnode
, NULL
);
1738 area
->rlfa_plist_name
[1] = XSTRDUP(MTYPE_ISIS_PLIST_NAME
, plist_name
);
1739 area
->rlfa_plist
[1] = prefix_list_lookup(AFI_IP
, plist_name
);
1740 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1745 int isis_instance_fast_reroute_level_2_remote_lfa_prefix_list_destroy(
1746 struct nb_cb_destroy_args
*args
)
1748 struct isis_area
*area
;
1750 if (args
->event
!= NB_EV_APPLY
)
1753 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1755 XFREE(MTYPE_ISIS_PLIST_NAME
, area
->rlfa_plist_name
[1]);
1756 area
->rlfa_plist
[1] = NULL
;
1757 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1763 * XPath: /frr-isisd:isis/instance/log-adjacency-changes
1765 int isis_instance_log_adjacency_changes_modify(struct nb_cb_modify_args
*args
)
1767 struct isis_area
*area
;
1768 bool log
= yang_dnode_get_bool(args
->dnode
, NULL
);
1770 if (args
->event
!= NB_EV_APPLY
)
1773 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1774 area
->log_adj_changes
= log
? 1 : 0;
1780 * XPath: /frr-isisd:isis/instance/mpls-te
1782 int isis_instance_mpls_te_create(struct nb_cb_create_args
*args
)
1784 struct listnode
*node
;
1785 struct isis_area
*area
;
1786 struct isis_circuit
*circuit
;
1788 if (args
->event
!= NB_EV_APPLY
)
1791 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1792 if (area
->mta
== NULL
) {
1794 struct mpls_te_area
*new;
1796 zlog_debug("ISIS-TE(%s): Initialize MPLS Traffic Engineering",
1799 new = XCALLOC(MTYPE_ISIS_MPLS_TE
, sizeof(struct mpls_te_area
));
1801 /* Initialize MPLS_TE structure */
1802 new->status
= enable
;
1804 new->inter_as
= off
;
1805 new->interas_areaid
.s_addr
= 0;
1806 new->router_id
.s_addr
= 0;
1810 area
->mta
->status
= enable
;
1813 /* Update Extended TLVs according to Interface link parameters */
1814 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
))
1815 isis_link_params_update(circuit
, circuit
->interface
);
1817 /* Reoriginate STD_TE & GMPLS circuits */
1818 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1823 int isis_instance_mpls_te_destroy(struct nb_cb_destroy_args
*args
)
1825 struct listnode
*node
;
1826 struct isis_area
*area
;
1827 struct isis_circuit
*circuit
;
1829 if (args
->event
!= NB_EV_APPLY
)
1832 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1833 if (IS_MPLS_TE(area
->mta
))
1834 area
->mta
->status
= disable
;
1838 /* Flush LSP if circuit engage */
1839 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
)) {
1840 if (!IS_EXT_TE(circuit
->ext
))
1843 /* disable MPLS_TE Circuit keeping SR one's */
1844 if (IS_SUBTLV(circuit
->ext
, EXT_ADJ_SID
))
1845 circuit
->ext
->status
= EXT_ADJ_SID
;
1846 else if (IS_SUBTLV(circuit
->ext
, EXT_LAN_ADJ_SID
))
1847 circuit
->ext
->status
= EXT_LAN_ADJ_SID
;
1849 circuit
->ext
->status
= 0;
1852 /* Reoriginate STD_TE & GMPLS circuits */
1853 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1855 zlog_debug("ISIS-TE(%s): Disabled MPLS Traffic Engineering",
1862 * XPath: /frr-isisd:isis/instance/mpls-te/router-address
1864 int isis_instance_mpls_te_router_address_modify(struct nb_cb_modify_args
*args
)
1866 struct in_addr value
;
1867 struct isis_area
*area
;
1869 if (args
->event
!= NB_EV_APPLY
)
1872 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1873 /* only proceed if MPLS-TE is enabled */
1874 if (!IS_MPLS_TE(area
->mta
))
1877 /* Update Area Router ID */
1878 yang_dnode_get_ipv4(&value
, args
->dnode
, NULL
);
1879 area
->mta
->router_id
.s_addr
= value
.s_addr
;
1881 /* And re-schedule LSP update */
1882 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1887 int isis_instance_mpls_te_router_address_destroy(
1888 struct nb_cb_destroy_args
*args
)
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 /* Reset Area Router ID */
1901 area
->mta
->router_id
.s_addr
= INADDR_ANY
;
1903 /* And re-schedule LSP update */
1904 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1910 * XPath: /frr-isisd:isis/instance/segment-routing/enabled
1912 int isis_instance_segment_routing_enabled_modify(
1913 struct nb_cb_modify_args
*args
)
1915 struct isis_area
*area
;
1917 if (args
->event
!= NB_EV_APPLY
)
1920 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1921 area
->srdb
.config
.enabled
= yang_dnode_get_bool(args
->dnode
, NULL
);
1923 if (area
->srdb
.config
.enabled
) {
1924 if (IS_DEBUG_EVENTS
)
1925 zlog_debug("SR: Segment Routing: OFF -> ON");
1927 isis_sr_start(area
);
1929 if (IS_DEBUG_EVENTS
)
1930 zlog_debug("SR: Segment Routing: ON -> OFF");
1939 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks
1941 int isis_instance_segment_routing_label_blocks_pre_validate(
1942 struct nb_cb_pre_validate_args
*args
)
1944 uint32_t srgb_lbound
;
1945 uint32_t srgb_ubound
;
1946 uint32_t srlb_lbound
;
1947 uint32_t srlb_ubound
;
1949 srgb_lbound
= yang_dnode_get_uint32(args
->dnode
, "./srgb/lower-bound");
1950 srgb_ubound
= yang_dnode_get_uint32(args
->dnode
, "./srgb/upper-bound");
1951 srlb_lbound
= yang_dnode_get_uint32(args
->dnode
, "./srlb/lower-bound");
1952 srlb_ubound
= yang_dnode_get_uint32(args
->dnode
, "./srlb/upper-bound");
1954 /* Check that the block size does not exceed 65535 */
1955 if ((srgb_ubound
- srgb_lbound
+ 1) > 65535) {
1957 args
->errmsg
, args
->errmsg_len
,
1958 "New SR Global Block (%u/%u) exceed the limit of 65535",
1959 srgb_lbound
, srgb_ubound
);
1960 return NB_ERR_VALIDATION
;
1962 if ((srlb_ubound
- srlb_lbound
+ 1) > 65535) {
1963 snprintf(args
->errmsg
, args
->errmsg_len
,
1964 "New SR Local Block (%u/%u) exceed the limit of 65535",
1965 srlb_lbound
, srlb_ubound
);
1966 return NB_ERR_VALIDATION
;
1969 /* Validate SRGB against SRLB */
1970 if (!((srgb_ubound
< srlb_lbound
) || (srgb_lbound
> srlb_ubound
))) {
1972 args
->errmsg
, args
->errmsg_len
,
1973 "SR Global Block (%u/%u) conflicts with Local Block (%u/%u)",
1974 srgb_lbound
, srgb_ubound
, srlb_lbound
, srlb_ubound
);
1975 return NB_ERR_VALIDATION
;
1982 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb
1985 void isis_instance_segment_routing_srgb_apply_finish(
1986 struct nb_cb_apply_finish_args
*args
)
1988 struct isis_area
*area
;
1989 uint32_t lower_bound
, upper_bound
;
1991 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
1992 lower_bound
= yang_dnode_get_uint32(args
->dnode
, "./lower-bound");
1993 upper_bound
= yang_dnode_get_uint32(args
->dnode
, "./upper-bound");
1995 isis_sr_cfg_srgb_update(area
, lower_bound
, upper_bound
);
1999 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb/lower-bound
2001 int isis_instance_segment_routing_srgb_lower_bound_modify(
2002 struct nb_cb_modify_args
*args
)
2004 uint32_t lower_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2006 switch (args
->event
) {
2007 case NB_EV_VALIDATE
:
2008 if (!IS_MPLS_UNRESERVED_LABEL(lower_bound
)) {
2009 snprintf(args
->errmsg
, args
->errmsg_len
,
2010 "Invalid SRGB lower bound: %u", lower_bound
);
2011 return NB_ERR_VALIDATION
;
2024 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srgb/upper-bound
2026 int isis_instance_segment_routing_srgb_upper_bound_modify(
2027 struct nb_cb_modify_args
*args
)
2029 uint32_t upper_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2031 switch (args
->event
) {
2032 case NB_EV_VALIDATE
:
2033 if (!IS_MPLS_UNRESERVED_LABEL(upper_bound
)) {
2034 snprintf(args
->errmsg
, args
->errmsg_len
,
2035 "Invalid SRGB upper bound: %u", upper_bound
);
2036 return NB_ERR_VALIDATION
;
2049 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb
2051 void isis_instance_segment_routing_srlb_apply_finish(
2052 struct nb_cb_apply_finish_args
*args
)
2054 struct isis_area
*area
;
2055 uint32_t lower_bound
, upper_bound
;
2057 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2058 lower_bound
= yang_dnode_get_uint32(args
->dnode
, "./lower-bound");
2059 upper_bound
= yang_dnode_get_uint32(args
->dnode
, "./upper-bound");
2061 isis_sr_cfg_srlb_update(area
, lower_bound
, upper_bound
);
2065 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb/lower-bound
2067 int isis_instance_segment_routing_srlb_lower_bound_modify(
2068 struct nb_cb_modify_args
*args
)
2070 uint32_t lower_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2072 switch (args
->event
) {
2073 case NB_EV_VALIDATE
:
2074 if (!IS_MPLS_UNRESERVED_LABEL(lower_bound
)) {
2075 snprintf(args
->errmsg
, args
->errmsg_len
,
2076 "Invalid SRLB lower bound: %u", lower_bound
);
2077 return NB_ERR_VALIDATION
;
2090 * XPath: /frr-isisd:isis/instance/segment-routing/label-blocks/srlb/upper-bound
2092 int isis_instance_segment_routing_srlb_upper_bound_modify(
2093 struct nb_cb_modify_args
*args
)
2095 uint32_t upper_bound
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2097 switch (args
->event
) {
2098 case NB_EV_VALIDATE
:
2099 if (!IS_MPLS_UNRESERVED_LABEL(upper_bound
)) {
2100 snprintf(args
->errmsg
, args
->errmsg_len
,
2101 "Invalid SRLB upper bound: %u", upper_bound
);
2102 return NB_ERR_VALIDATION
;
2115 * XPath: /frr-isisd:isis/instance/segment-routing/msd/node-msd
2117 int isis_instance_segment_routing_msd_node_msd_modify(
2118 struct nb_cb_modify_args
*args
)
2120 struct isis_area
*area
;
2122 if (args
->event
!= NB_EV_APPLY
)
2125 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2126 area
->srdb
.config
.msd
= yang_dnode_get_uint8(args
->dnode
, NULL
);
2128 /* Update and regenerate LSP */
2129 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2134 int isis_instance_segment_routing_msd_node_msd_destroy(
2135 struct nb_cb_destroy_args
*args
)
2137 struct isis_area
*area
;
2139 if (args
->event
!= NB_EV_APPLY
)
2142 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2143 area
->srdb
.config
.msd
= 0;
2145 /* Update and regenerate LSP */
2146 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2152 * XPath: /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid
2154 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_create(
2155 struct nb_cb_create_args
*args
)
2157 struct isis_area
*area
;
2158 struct prefix prefix
;
2159 struct sr_prefix_cfg
*pcfg
;
2161 if (args
->event
!= NB_EV_APPLY
)
2164 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2165 yang_dnode_get_prefix(&prefix
, args
->dnode
, "./prefix");
2167 pcfg
= isis_sr_cfg_prefix_add(area
, &prefix
);
2168 nb_running_set_entry(args
->dnode
, pcfg
);
2173 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_destroy(
2174 struct nb_cb_destroy_args
*args
)
2176 struct sr_prefix_cfg
*pcfg
;
2177 struct isis_area
*area
;
2179 if (args
->event
!= NB_EV_APPLY
)
2182 pcfg
= nb_running_unset_entry(args
->dnode
);
2184 isis_sr_cfg_prefix_del(pcfg
);
2185 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2190 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_pre_validate(
2191 struct nb_cb_pre_validate_args
*args
)
2193 const struct lyd_node
*area_dnode
;
2194 struct isis_area
*area
;
2195 struct prefix prefix
;
2196 uint32_t srgb_lbound
;
2197 uint32_t srgb_ubound
;
2198 uint32_t srgb_range
;
2200 enum sr_sid_value_type sid_type
;
2201 struct isis_prefix_sid psid
= {};
2203 yang_dnode_get_prefix(&prefix
, args
->dnode
, "./prefix");
2204 srgb_lbound
= yang_dnode_get_uint32(
2205 args
->dnode
, "../../label-blocks/srgb/lower-bound");
2206 srgb_ubound
= yang_dnode_get_uint32(
2207 args
->dnode
, "../../label-blocks/srgb/upper-bound");
2208 sid
= yang_dnode_get_uint32(args
->dnode
, "./sid-value");
2209 sid_type
= yang_dnode_get_enum(args
->dnode
, "./sid-value-type");
2211 /* Check for invalid indexes/labels. */
2212 srgb_range
= srgb_ubound
- srgb_lbound
+ 1;
2215 case SR_SID_VALUE_TYPE_INDEX
:
2216 if (sid
>= srgb_range
) {
2217 snprintf(args
->errmsg
, args
->errmsg_len
,
2218 "SID index %u falls outside local SRGB range",
2220 return NB_ERR_VALIDATION
;
2223 case SR_SID_VALUE_TYPE_ABSOLUTE
:
2224 if (!IS_MPLS_UNRESERVED_LABEL(sid
)) {
2225 snprintf(args
->errmsg
, args
->errmsg_len
,
2226 "Invalid absolute SID %u", sid
);
2227 return NB_ERR_VALIDATION
;
2229 SET_FLAG(psid
.flags
, ISIS_PREFIX_SID_VALUE
);
2230 SET_FLAG(psid
.flags
, ISIS_PREFIX_SID_LOCAL
);
2234 /* Check for Prefix-SID collisions. */
2235 area_dnode
= yang_dnode_get_parent(args
->dnode
, "instance");
2236 area
= nb_running_get_entry(area_dnode
, NULL
, false);
2238 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
2239 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVEL2
;
2241 struct isis_spftree
*spftree
;
2242 struct isis_vertex
*vertex_psid
;
2244 if (!(area
->is_type
& level
))
2246 spftree
= area
->spftree
[tree
][level
- 1];
2250 vertex_psid
= isis_spf_prefix_sid_lookup(
2253 && !prefix_same(&vertex_psid
->N
.ip
.p
.dest
,
2256 args
->errmsg
, args
->errmsg_len
,
2257 "Prefix-SID collision detected, SID %s %u is already in use by prefix %pFX (L%u)",
2260 ISIS_PREFIX_SID_VALUE
)
2264 &vertex_psid
->N
.ip
.p
.dest
,
2266 return NB_ERR_VALIDATION
;
2275 void isis_instance_segment_routing_prefix_sid_map_prefix_sid_apply_finish(
2276 struct nb_cb_apply_finish_args
*args
)
2278 struct sr_prefix_cfg
*pcfg
;
2279 struct isis_area
*area
;
2281 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2283 lsp_regenerate_schedule(area
, area
->is_type
, 0);
2288 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/sid-value-type
2290 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_sid_value_type_modify(
2291 struct nb_cb_modify_args
*args
)
2293 struct sr_prefix_cfg
*pcfg
;
2295 if (args
->event
!= NB_EV_APPLY
)
2298 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2299 pcfg
->sid_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2306 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/sid-value
2308 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_sid_value_modify(
2309 struct nb_cb_modify_args
*args
)
2311 struct sr_prefix_cfg
*pcfg
;
2313 if (args
->event
!= NB_EV_APPLY
)
2316 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2317 pcfg
->sid
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2324 * /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/last-hop-behavior
2326 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_last_hop_behavior_modify(
2327 struct nb_cb_modify_args
*args
)
2329 struct sr_prefix_cfg
*pcfg
;
2331 if (args
->event
!= NB_EV_APPLY
)
2334 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2335 pcfg
->last_hop_behavior
= yang_dnode_get_enum(args
->dnode
, NULL
);
2341 * XPath: /frr-isisd:isis/instance/segment-routing/prefix-sid-map/prefix-sid/n-flag-clear
2343 int isis_instance_segment_routing_prefix_sid_map_prefix_sid_n_flag_clear_modify(
2344 struct nb_cb_modify_args
*args
)
2346 struct sr_prefix_cfg
*pcfg
;
2348 if (args
->event
!= NB_EV_APPLY
)
2351 pcfg
= nb_running_get_entry(args
->dnode
, NULL
, true);
2352 pcfg
->n_flag_clear
= yang_dnode_get_bool(args
->dnode
, NULL
);
2358 * XPath: /frr-isisd:isis/instance/mpls/ldp-sync
2360 int isis_instance_mpls_ldp_sync_create(struct nb_cb_create_args
*args
)
2362 struct isis_area
*area
;
2364 switch (args
->event
) {
2365 case NB_EV_VALIDATE
:
2366 area
= nb_running_get_entry(args
->dnode
, NULL
, false);
2367 if (area
== NULL
|| area
->isis
== NULL
)
2368 return NB_ERR_VALIDATION
;
2370 if (area
->isis
->vrf_id
!= VRF_DEFAULT
) {
2371 snprintf(args
->errmsg
, args
->errmsg_len
,
2372 "LDP-Sync only runs on Default VRF");
2373 return NB_ERR_VALIDATION
;
2380 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2381 isis_area_ldp_sync_enable(area
);
2387 int isis_instance_mpls_ldp_sync_destroy(struct nb_cb_destroy_args
*args
)
2389 struct isis_area
*area
;
2391 if (args
->event
!= NB_EV_APPLY
)
2394 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2395 isis_area_ldp_sync_disable(area
);
2401 * XPath: /frr-isisd:isis/instance/mpls/ldp-sync/holddown
2403 int isis_instance_mpls_ldp_sync_holddown_modify(struct nb_cb_modify_args
*args
)
2405 struct isis_area
*area
;
2408 switch (args
->event
) {
2409 case NB_EV_VALIDATE
:
2410 area
= nb_running_get_entry(args
->dnode
, NULL
, false);
2411 if (area
== NULL
|| area
->isis
== NULL
)
2412 return NB_ERR_VALIDATION
;
2414 if (area
->isis
->vrf_id
!= VRF_DEFAULT
) {
2415 snprintf(args
->errmsg
, args
->errmsg_len
,
2416 "LDP-Sync only runs on Default VRF");
2417 return NB_ERR_VALIDATION
;
2424 area
= nb_running_get_entry(args
->dnode
, NULL
, true);
2425 holddown
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2426 isis_area_ldp_sync_set_holddown(area
, holddown
);
2433 * XPath: /frr-interface:lib/interface/frr-isisd:isis
2435 int lib_interface_isis_create(struct nb_cb_create_args
*args
)
2437 struct isis_area
*area
= NULL
;
2438 struct interface
*ifp
;
2439 struct isis_circuit
*circuit
= NULL
;
2440 const char *area_tag
= yang_dnode_get_string(args
->dnode
, "./area-tag");
2441 uint32_t min_mtu
, actual_mtu
;
2443 switch (args
->event
) {
2447 case NB_EV_VALIDATE
:
2448 /* check if interface mtu is sufficient. If the area has not
2449 * been created yet, assume default MTU for the area
2451 ifp
= nb_running_get_entry(args
->dnode
, NULL
, false);
2452 /* zebra might not know yet about the MTU - nothing we can do */
2453 if (!ifp
|| ifp
->mtu
== 0)
2456 if_is_broadcast(ifp
) ? ifp
->mtu
- LLC_LEN
: ifp
->mtu
;
2458 area
= isis_area_lookup(area_tag
, ifp
->vrf_id
);
2460 min_mtu
= area
->lsp_mtu
;
2463 min_mtu
= yang_get_default_uint16(
2464 "/frr-isisd:isis/instance/lsp/mtu");
2466 min_mtu
= DEFAULT_LSP_MTU
;
2467 #endif /* ifndef FABRICD */
2468 if (actual_mtu
< min_mtu
) {
2469 snprintf(args
->errmsg
, args
->errmsg_len
,
2470 "Interface %s has MTU %u, minimum MTU for the area is %u",
2471 ifp
->name
, actual_mtu
, min_mtu
);
2472 return NB_ERR_VALIDATION
;
2476 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
2477 circuit
= isis_circuit_new(ifp
, area_tag
);
2478 nb_running_set_entry(args
->dnode
, circuit
);
2485 int lib_interface_isis_destroy(struct nb_cb_destroy_args
*args
)
2487 struct isis_circuit
*circuit
;
2489 if (args
->event
!= NB_EV_APPLY
)
2492 circuit
= nb_running_unset_entry(args
->dnode
);
2494 isis_circuit_del(circuit
);
2500 * XPath: /frr-interface:lib/interface/frr-isisd:isis/area-tag
2502 int lib_interface_isis_area_tag_modify(struct nb_cb_modify_args
*args
)
2504 struct isis_circuit
*circuit
;
2505 struct interface
*ifp
;
2507 const char *area_tag
, *ifname
, *vrfname
;
2509 if (args
->event
== NB_EV_VALIDATE
) {
2510 /* libyang doesn't like relative paths across module boundaries
2512 ifname
= yang_dnode_get_string(
2513 lyd_parent(lyd_parent(args
->dnode
)), "./name");
2514 vrfname
= yang_dnode_get_string(
2515 lyd_parent(lyd_parent(args
->dnode
)), "./vrf");
2516 vrf
= vrf_lookup_by_name(vrfname
);
2518 ifp
= if_lookup_by_name(ifname
, vrf
->vrf_id
);
2523 circuit
= circuit_scan_by_ifp(ifp
);
2524 area_tag
= yang_dnode_get_string(args
->dnode
, NULL
);
2525 if (circuit
&& circuit
->area
&& circuit
->area
->area_tag
2526 && strcmp(circuit
->area
->area_tag
, area_tag
)) {
2527 snprintf(args
->errmsg
, args
->errmsg_len
,
2528 "ISIS circuit is already defined on %s",
2529 circuit
->area
->area_tag
);
2530 return NB_ERR_VALIDATION
;
2538 * XPath: /frr-interface:lib/interface/frr-isisd:isis/circuit-type
2540 int lib_interface_isis_circuit_type_modify(struct nb_cb_modify_args
*args
)
2542 int circ_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2543 struct isis_circuit
*circuit
;
2544 struct interface
*ifp
;
2546 const char *ifname
, *vrfname
;
2548 switch (args
->event
) {
2549 case NB_EV_VALIDATE
:
2550 /* libyang doesn't like relative paths across module boundaries
2552 ifname
= yang_dnode_get_string(
2553 lyd_parent(lyd_parent(args
->dnode
)), "./name");
2554 vrfname
= yang_dnode_get_string(
2555 lyd_parent(lyd_parent(args
->dnode
)), "./vrf");
2556 vrf
= vrf_lookup_by_name(vrfname
);
2558 ifp
= if_lookup_by_name(ifname
, vrf
->vrf_id
);
2562 circuit
= circuit_scan_by_ifp(ifp
);
2563 if (circuit
&& circuit
->state
== C_STATE_UP
2564 && circuit
->area
->is_type
!= IS_LEVEL_1_AND_2
2565 && circuit
->area
->is_type
!= circ_type
) {
2566 snprintf(args
->errmsg
, args
->errmsg_len
,
2567 "Invalid circuit level for area %s",
2568 circuit
->area
->area_tag
);
2569 return NB_ERR_VALIDATION
;
2576 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2577 isis_circuit_is_type_set(circuit
, circ_type
);
2585 * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv4-routing
2587 int lib_interface_isis_ipv4_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
, NULL
);
2597 ipv6
= yang_dnode_get_bool(args
->dnode
, "../ipv6-routing");
2598 isis_circuit_af_set(circuit
, ipv4
, ipv6
);
2604 * XPath: /frr-interface:lib/interface/frr-isisd:isis/ipv6-routing
2606 int lib_interface_isis_ipv6_routing_modify(struct nb_cb_modify_args
*args
)
2609 struct isis_circuit
*circuit
;
2611 if (args
->event
!= NB_EV_APPLY
)
2614 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2615 ipv4
= yang_dnode_get_bool(args
->dnode
, "../ipv4-routing");
2616 ipv6
= yang_dnode_get_bool(args
->dnode
, NULL
);
2617 isis_circuit_af_set(circuit
, ipv4
, ipv6
);
2623 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring
2625 void lib_interface_isis_bfd_monitoring_apply_finish(
2626 struct nb_cb_apply_finish_args
*args
)
2628 struct isis_circuit
*circuit
;
2630 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2631 isis_bfd_circuit_cmd(circuit
);
2635 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring/enabled
2637 int lib_interface_isis_bfd_monitoring_enabled_modify(
2638 struct nb_cb_modify_args
*args
)
2640 struct isis_circuit
*circuit
;
2642 if (args
->event
!= NB_EV_APPLY
)
2645 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2646 circuit
->bfd_config
.enabled
= yang_dnode_get_bool(args
->dnode
, NULL
);
2652 * XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring/profile
2654 int lib_interface_isis_bfd_monitoring_profile_modify(
2655 struct nb_cb_modify_args
*args
)
2657 struct isis_circuit
*circuit
;
2659 if (args
->event
!= NB_EV_APPLY
)
2662 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2663 XFREE(MTYPE_TMP
, circuit
->bfd_config
.profile
);
2664 circuit
->bfd_config
.profile
=
2665 XSTRDUP(MTYPE_TMP
, yang_dnode_get_string(args
->dnode
, NULL
));
2670 int lib_interface_isis_bfd_monitoring_profile_destroy(
2671 struct nb_cb_destroy_args
*args
)
2673 struct isis_circuit
*circuit
;
2675 if (args
->event
!= NB_EV_APPLY
)
2678 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2679 XFREE(MTYPE_TMP
, circuit
->bfd_config
.profile
);
2685 * XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-1
2687 int lib_interface_isis_csnp_interval_level_1_modify(
2688 struct nb_cb_modify_args
*args
)
2690 struct isis_circuit
*circuit
;
2692 if (args
->event
!= NB_EV_APPLY
)
2695 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2696 circuit
->csnp_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2702 * XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-2
2704 int lib_interface_isis_csnp_interval_level_2_modify(
2705 struct nb_cb_modify_args
*args
)
2707 struct isis_circuit
*circuit
;
2709 if (args
->event
!= NB_EV_APPLY
)
2712 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2713 circuit
->csnp_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2719 * XPath: /frr-interface:lib/interface/frr-isisd:isis/psnp-interval/level-1
2721 int lib_interface_isis_psnp_interval_level_1_modify(
2722 struct nb_cb_modify_args
*args
)
2724 struct isis_circuit
*circuit
;
2726 if (args
->event
!= NB_EV_APPLY
)
2729 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2730 circuit
->psnp_interval
[0] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2736 * XPath: /frr-interface:lib/interface/frr-isisd:isis/psnp-interval/level-2
2738 int lib_interface_isis_psnp_interval_level_2_modify(
2739 struct nb_cb_modify_args
*args
)
2741 struct isis_circuit
*circuit
;
2743 if (args
->event
!= NB_EV_APPLY
)
2746 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2747 circuit
->psnp_interval
[1] = yang_dnode_get_uint16(args
->dnode
, NULL
);
2753 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/padding
2755 int lib_interface_isis_hello_padding_modify(struct nb_cb_modify_args
*args
)
2757 struct isis_circuit
*circuit
;
2759 if (args
->event
!= NB_EV_APPLY
)
2762 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2763 circuit
->pad_hellos
= yang_dnode_get_bool(args
->dnode
, NULL
);
2769 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/interval/level-1
2771 int lib_interface_isis_hello_interval_level_1_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
[0] = interval
;
2788 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/interval/level-2
2790 int lib_interface_isis_hello_interval_level_2_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 interval
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2801 circuit
->hello_interval
[1] = interval
;
2807 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/multiplier/level-1
2809 int lib_interface_isis_hello_multiplier_level_1_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
[0] = multi
;
2826 * XPath: /frr-interface:lib/interface/frr-isisd:isis/hello/multiplier/level-2
2828 int lib_interface_isis_hello_multiplier_level_2_modify(
2829 struct nb_cb_modify_args
*args
)
2831 struct isis_circuit
*circuit
;
2834 if (args
->event
!= NB_EV_APPLY
)
2837 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2838 multi
= yang_dnode_get_uint16(args
->dnode
, NULL
);
2839 circuit
->hello_multiplier
[1] = multi
;
2845 * XPath: /frr-interface:lib/interface/frr-isisd:isis/metric/level-1
2847 int lib_interface_isis_metric_level_1_modify(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 met
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2857 isis_circuit_metric_set(circuit
, IS_LEVEL_1
, met
);
2863 * XPath: /frr-interface:lib/interface/frr-isisd:isis/metric/level-2
2865 int lib_interface_isis_metric_level_2_modify(struct nb_cb_modify_args
*args
)
2867 struct isis_circuit
*circuit
;
2870 if (args
->event
!= NB_EV_APPLY
)
2873 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2874 met
= yang_dnode_get_uint32(args
->dnode
, NULL
);
2875 isis_circuit_metric_set(circuit
, IS_LEVEL_2
, met
);
2881 * XPath: /frr-interface:lib/interface/frr-isisd:isis/priority/level-1
2883 int lib_interface_isis_priority_level_1_modify(struct nb_cb_modify_args
*args
)
2885 struct isis_circuit
*circuit
;
2887 if (args
->event
!= NB_EV_APPLY
)
2890 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2891 circuit
->priority
[0] = yang_dnode_get_uint8(args
->dnode
, NULL
);
2897 * XPath: /frr-interface:lib/interface/frr-isisd:isis/priority/level-2
2899 int lib_interface_isis_priority_level_2_modify(struct nb_cb_modify_args
*args
)
2901 struct isis_circuit
*circuit
;
2903 if (args
->event
!= NB_EV_APPLY
)
2906 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2907 circuit
->priority
[1] = yang_dnode_get_uint8(args
->dnode
, NULL
);
2913 * XPath: /frr-interface:lib/interface/frr-isisd:isis/network-type
2915 int lib_interface_isis_network_type_modify(struct nb_cb_modify_args
*args
)
2917 struct isis_circuit
*circuit
;
2918 int net_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
2920 switch (args
->event
) {
2921 case NB_EV_VALIDATE
:
2922 circuit
= nb_running_get_entry(args
->dnode
, NULL
, false);
2925 if (circuit
->circ_type
== CIRCUIT_T_LOOPBACK
) {
2927 args
->errmsg
, args
->errmsg_len
,
2928 "Cannot change network type on loopback interface");
2929 return NB_ERR_VALIDATION
;
2931 if (net_type
== CIRCUIT_T_BROADCAST
2932 && circuit
->state
== C_STATE_UP
2933 && !if_is_broadcast(circuit
->interface
)) {
2935 args
->errmsg
, args
->errmsg_len
,
2936 "Cannot configure non-broadcast interface for broadcast operation");
2937 return NB_ERR_VALIDATION
;
2944 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2945 isis_circuit_circ_type_set(circuit
, net_type
);
2953 * XPath: /frr-interface:lib/interface/frr-isisd:isis/passive
2955 int lib_interface_isis_passive_modify(struct nb_cb_modify_args
*args
)
2957 struct isis_circuit
*circuit
;
2958 struct interface
*ifp
;
2959 bool passive
= yang_dnode_get_bool(args
->dnode
, NULL
);
2961 /* validation only applies if we are setting passive to false */
2962 if (!passive
&& args
->event
== NB_EV_VALIDATE
) {
2963 circuit
= nb_running_get_entry(args
->dnode
, NULL
, false);
2966 ifp
= circuit
->interface
;
2969 if (if_is_loopback(ifp
)) {
2970 snprintf(args
->errmsg
, args
->errmsg_len
,
2971 "Loopback is always passive");
2972 return NB_ERR_VALIDATION
;
2976 if (args
->event
!= NB_EV_APPLY
)
2979 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
2980 isis_circuit_passive_set(circuit
, passive
);
2986 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password
2988 int lib_interface_isis_password_create(struct nb_cb_create_args
*args
)
2993 int lib_interface_isis_password_destroy(struct nb_cb_destroy_args
*args
)
2995 struct isis_circuit
*circuit
;
2997 if (args
->event
!= NB_EV_APPLY
)
3000 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3001 isis_circuit_passwd_unset(circuit
);
3007 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password/password
3009 int lib_interface_isis_password_password_modify(struct nb_cb_modify_args
*args
)
3011 struct isis_circuit
*circuit
;
3012 const char *password
;
3014 if (args
->event
!= NB_EV_APPLY
)
3017 password
= yang_dnode_get_string(args
->dnode
, NULL
);
3018 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3020 isis_circuit_passwd_set(circuit
, circuit
->passwd
.type
, password
);
3026 * XPath: /frr-interface:lib/interface/frr-isisd:isis/password/password-type
3028 int lib_interface_isis_password_password_type_modify(
3029 struct nb_cb_modify_args
*args
)
3031 struct isis_circuit
*circuit
;
3034 if (args
->event
!= NB_EV_APPLY
)
3037 pass_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
3038 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3039 circuit
->passwd
.type
= pass_type
;
3046 * /frr-interface:lib/interface/frr-isisd:isis/disable-three-way-handshake
3048 int lib_interface_isis_disable_three_way_handshake_modify(
3049 struct nb_cb_modify_args
*args
)
3051 struct isis_circuit
*circuit
;
3053 if (args
->event
!= NB_EV_APPLY
)
3056 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3057 circuit
->disable_threeway_adj
= yang_dnode_get_bool(args
->dnode
, NULL
);
3064 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-unicast
3066 static int lib_interface_isis_multi_topology_common(
3067 enum nb_event event
, const struct lyd_node
*dnode
, char *errmsg
,
3068 size_t errmsg_len
, uint16_t mtid
)
3070 struct isis_circuit
*circuit
;
3074 case NB_EV_VALIDATE
:
3075 circuit
= nb_running_get_entry(dnode
, NULL
, false);
3076 if (circuit
&& circuit
->area
&& circuit
->area
->oldmetric
) {
3079 "Multi topology IS-IS can only be used with wide metrics");
3080 return NB_ERR_VALIDATION
;
3087 circuit
= nb_running_get_entry(dnode
, NULL
, true);
3088 value
= yang_dnode_get_bool(dnode
, NULL
);
3089 isis_circuit_mt_enabled_set(circuit
, mtid
, value
);
3096 int lib_interface_isis_multi_topology_ipv4_unicast_modify(
3097 struct nb_cb_modify_args
*args
)
3099 return lib_interface_isis_multi_topology_common(
3100 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3101 ISIS_MT_IPV4_UNICAST
);
3106 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-multicast
3108 int lib_interface_isis_multi_topology_ipv4_multicast_modify(
3109 struct nb_cb_modify_args
*args
)
3111 return lib_interface_isis_multi_topology_common(
3112 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3113 ISIS_MT_IPV4_MULTICAST
);
3118 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-management
3120 int lib_interface_isis_multi_topology_ipv4_management_modify(
3121 struct nb_cb_modify_args
*args
)
3123 return lib_interface_isis_multi_topology_common(
3124 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3130 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-unicast
3132 int lib_interface_isis_multi_topology_ipv6_unicast_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_UNICAST
);
3142 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-multicast
3144 int lib_interface_isis_multi_topology_ipv6_multicast_modify(
3145 struct nb_cb_modify_args
*args
)
3147 return lib_interface_isis_multi_topology_common(
3148 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3149 ISIS_MT_IPV6_MULTICAST
);
3154 * /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-management
3156 int lib_interface_isis_multi_topology_ipv6_management_modify(
3157 struct nb_cb_modify_args
*args
)
3159 return lib_interface_isis_multi_topology_common(
3160 args
->event
, args
->dnode
, args
->errmsg
, args
->errmsg_len
,
3165 * XPath: /frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-dstsrc
3167 int lib_interface_isis_multi_topology_ipv6_dstsrc_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_IPV6_DSTSRC
);
3176 * XPath: /frr-interface:lib/interface/frr-isisd:isis/mpls/ldp-sync
3178 int lib_interface_isis_mpls_ldp_sync_modify(struct nb_cb_modify_args
*args
)
3180 struct isis_circuit
*circuit
;
3181 struct ldp_sync_info
*ldp_sync_info
;
3182 bool ldp_sync_enable
;
3183 struct interface
*ifp
;
3185 switch (args
->event
) {
3186 case NB_EV_VALIDATE
:
3187 ifp
= nb_running_get_entry(
3188 lyd_parent(lyd_parent(lyd_parent(args
->dnode
))), NULL
,
3191 return NB_ERR_VALIDATION
;
3192 if (if_is_loopback(ifp
)) {
3193 snprintf(args
->errmsg
, args
->errmsg_len
,
3194 "LDP-Sync does not run on loopback interface");
3195 return NB_ERR_VALIDATION
;
3198 circuit
= nb_running_get_entry(args
->dnode
, NULL
, false);
3199 if (circuit
== NULL
|| circuit
->area
== NULL
)
3202 if (circuit
->isis
->vrf_id
!= VRF_DEFAULT
) {
3203 snprintf(args
->errmsg
, args
->errmsg_len
,
3204 "LDP-Sync only runs on Default VRF");
3205 return NB_ERR_VALIDATION
;
3212 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3213 ldp_sync_enable
= yang_dnode_get_bool(args
->dnode
, NULL
);
3215 ldp_sync_info
= circuit
->ldp_sync_info
;
3217 SET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_IF_CONFIG
);
3218 ldp_sync_info
->enabled
= ldp_sync_enable
;
3220 if (circuit
->area
) {
3221 if (ldp_sync_enable
)
3222 isis_if_ldp_sync_enable(circuit
);
3224 isis_if_ldp_sync_disable(circuit
);
3232 * XPath: /frr-interface:lib/interface/frr-isisd:isis/mpls/holddown
3234 int lib_interface_isis_mpls_holddown_modify(struct nb_cb_modify_args
*args
)
3236 struct isis_circuit
*circuit
;
3237 struct ldp_sync_info
*ldp_sync_info
;
3239 struct interface
*ifp
;
3241 switch (args
->event
) {
3242 case NB_EV_VALIDATE
:
3244 ifp
= nb_running_get_entry(
3245 lyd_parent(lyd_parent(lyd_parent(args
->dnode
))), NULL
,
3248 return NB_ERR_VALIDATION
;
3249 if (if_is_loopback(ifp
)) {
3250 snprintf(args
->errmsg
, args
->errmsg_len
,
3251 "LDP-Sync does not run on loopback interface");
3252 return NB_ERR_VALIDATION
;
3255 circuit
= nb_running_get_entry(args
->dnode
, NULL
, false);
3256 if (circuit
== NULL
|| circuit
->area
== NULL
)
3259 if (circuit
->isis
->vrf_id
!= VRF_DEFAULT
) {
3260 snprintf(args
->errmsg
, args
->errmsg_len
,
3261 "LDP-Sync only runs on Default VRF");
3262 return NB_ERR_VALIDATION
;
3269 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3270 holddown
= yang_dnode_get_uint16(args
->dnode
, NULL
);
3272 ldp_sync_info
= circuit
->ldp_sync_info
;
3274 SET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_HOLDDOWN
);
3275 ldp_sync_info
->holddown
= holddown
;
3281 int lib_interface_isis_mpls_holddown_destroy(struct nb_cb_destroy_args
*args
)
3283 struct isis_circuit
*circuit
;
3284 struct ldp_sync_info
*ldp_sync_info
;
3285 struct interface
*ifp
;
3287 switch (args
->event
) {
3288 case NB_EV_VALIDATE
:
3289 ifp
= nb_running_get_entry(
3290 lyd_parent(lyd_parent(lyd_parent(args
->dnode
))), NULL
,
3293 return NB_ERR_VALIDATION
;
3294 if (if_is_loopback(ifp
)) {
3295 snprintf(args
->errmsg
, args
->errmsg_len
,
3296 "LDP-Sync does not run on loopback interface");
3297 return NB_ERR_VALIDATION
;
3300 circuit
= nb_running_get_entry(args
->dnode
, NULL
, false);
3301 if (circuit
== NULL
|| circuit
->area
== NULL
)
3304 if (circuit
->isis
->vrf_id
!= VRF_DEFAULT
) {
3305 snprintf(args
->errmsg
, args
->errmsg_len
,
3306 "LDP-Sync only runs on Default VRF");
3307 return NB_ERR_VALIDATION
;
3314 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3315 ldp_sync_info
= circuit
->ldp_sync_info
;
3317 UNSET_FLAG(ldp_sync_info
->flags
, LDP_SYNC_FLAG_HOLDDOWN
);
3320 isis_if_set_ldp_sync_holddown(circuit
);
3329 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/lfa/enable
3331 int lib_interface_isis_fast_reroute_level_1_lfa_enable_modify(
3332 struct nb_cb_modify_args
*args
)
3334 struct isis_area
*area
;
3335 struct isis_circuit
*circuit
;
3337 if (args
->event
!= NB_EV_APPLY
)
3340 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3341 circuit
->lfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3343 area
= circuit
->area
;
3345 if (circuit
->lfa_protection
[0])
3346 area
->lfa_protected_links
[0]++;
3348 assert(area
->lfa_protected_links
[0] > 0);
3349 area
->lfa_protected_links
[0]--;
3352 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3360 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/lfa/exclude-interface
3362 int lib_interface_isis_fast_reroute_level_1_lfa_exclude_interface_create(
3363 struct nb_cb_create_args
*args
)
3365 struct isis_area
*area
;
3366 struct isis_circuit
*circuit
;
3367 const char *exclude_ifname
;
3369 if (args
->event
!= NB_EV_APPLY
)
3372 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3373 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3375 isis_lfa_excluded_iface_add(circuit
, ISIS_LEVEL1
, exclude_ifname
);
3376 area
= circuit
->area
;
3378 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3383 int lib_interface_isis_fast_reroute_level_1_lfa_exclude_interface_destroy(
3384 struct nb_cb_destroy_args
*args
)
3386 struct isis_area
*area
;
3387 struct isis_circuit
*circuit
;
3388 const char *exclude_ifname
;
3390 if (args
->event
!= NB_EV_APPLY
)
3393 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3394 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3396 isis_lfa_excluded_iface_delete(circuit
, ISIS_LEVEL1
, exclude_ifname
);
3397 area
= circuit
->area
;
3399 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3406 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/remote-lfa/enable
3408 int lib_interface_isis_fast_reroute_level_1_remote_lfa_enable_modify(
3409 struct nb_cb_modify_args
*args
)
3411 struct isis_area
*area
;
3412 struct isis_circuit
*circuit
;
3414 if (args
->event
!= NB_EV_APPLY
)
3417 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3418 circuit
->rlfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3420 area
= circuit
->area
;
3422 if (circuit
->rlfa_protection
[0])
3423 area
->rlfa_protected_links
[0]++;
3425 assert(area
->rlfa_protected_links
[0] > 0);
3426 area
->rlfa_protected_links
[0]--;
3429 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3437 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/remote-lfa/maximum-metric
3439 int lib_interface_isis_fast_reroute_level_1_remote_lfa_maximum_metric_modify(
3440 struct nb_cb_modify_args
*args
)
3442 struct isis_area
*area
;
3443 struct isis_circuit
*circuit
;
3445 if (args
->event
!= NB_EV_APPLY
)
3448 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3449 circuit
->rlfa_max_metric
[0] = yang_dnode_get_uint32(args
->dnode
, NULL
);
3451 area
= circuit
->area
;
3453 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3458 int lib_interface_isis_fast_reroute_level_1_remote_lfa_maximum_metric_destroy(
3459 struct nb_cb_destroy_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
->rlfa_max_metric
[0] = 0;
3470 area
= circuit
->area
;
3472 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3479 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/enable
3481 int lib_interface_isis_fast_reroute_level_1_ti_lfa_enable_modify(
3482 struct nb_cb_modify_args
*args
)
3484 struct isis_area
*area
;
3485 struct isis_circuit
*circuit
;
3487 if (args
->event
!= NB_EV_APPLY
)
3490 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3491 circuit
->tilfa_protection
[0] = yang_dnode_get_bool(args
->dnode
, NULL
);
3493 area
= circuit
->area
;
3495 if (circuit
->tilfa_protection
[0])
3496 area
->tilfa_protected_links
[0]++;
3498 assert(area
->tilfa_protected_links
[0] > 0);
3499 area
->tilfa_protected_links
[0]--;
3502 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3510 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/node-protection
3512 int lib_interface_isis_fast_reroute_level_1_ti_lfa_node_protection_modify(
3513 struct nb_cb_modify_args
*args
)
3515 struct isis_area
*area
;
3516 struct isis_circuit
*circuit
;
3518 if (args
->event
!= NB_EV_APPLY
)
3521 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3522 circuit
->tilfa_node_protection
[0] =
3523 yang_dnode_get_bool(args
->dnode
, NULL
);
3525 area
= circuit
->area
;
3527 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3534 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-1/ti-lfa/link-fallback
3536 int lib_interface_isis_fast_reroute_level_1_ti_lfa_link_fallback_modify(
3537 struct nb_cb_modify_args
*args
)
3539 struct isis_area
*area
;
3540 struct isis_circuit
*circuit
;
3542 if (args
->event
!= NB_EV_APPLY
)
3545 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3546 circuit
->tilfa_link_fallback
[0] =
3547 yang_dnode_get_bool(args
->dnode
, NULL
);
3549 area
= circuit
->area
;
3551 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3558 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/lfa/enable
3560 int lib_interface_isis_fast_reroute_level_2_lfa_enable_modify(
3561 struct nb_cb_modify_args
*args
)
3563 struct isis_area
*area
;
3564 struct isis_circuit
*circuit
;
3566 if (args
->event
!= NB_EV_APPLY
)
3569 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3570 circuit
->lfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3572 area
= circuit
->area
;
3574 if (circuit
->lfa_protection
[1])
3575 area
->lfa_protected_links
[1]++;
3577 assert(area
->lfa_protected_links
[1] > 0);
3578 area
->lfa_protected_links
[1]--;
3581 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3589 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/lfa/exclude-interface
3591 int lib_interface_isis_fast_reroute_level_2_lfa_exclude_interface_create(
3592 struct nb_cb_create_args
*args
)
3594 struct isis_area
*area
;
3595 struct isis_circuit
*circuit
;
3596 const char *exclude_ifname
;
3598 if (args
->event
!= NB_EV_APPLY
)
3601 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3602 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3604 isis_lfa_excluded_iface_add(circuit
, ISIS_LEVEL2
, exclude_ifname
);
3605 area
= circuit
->area
;
3607 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3612 int lib_interface_isis_fast_reroute_level_2_lfa_exclude_interface_destroy(
3613 struct nb_cb_destroy_args
*args
)
3615 struct isis_area
*area
;
3616 struct isis_circuit
*circuit
;
3617 const char *exclude_ifname
;
3619 if (args
->event
!= NB_EV_APPLY
)
3622 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3623 exclude_ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
3625 isis_lfa_excluded_iface_delete(circuit
, ISIS_LEVEL2
, exclude_ifname
);
3626 area
= circuit
->area
;
3628 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3635 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/remote-lfa/enable
3637 int lib_interface_isis_fast_reroute_level_2_remote_lfa_enable_modify(
3638 struct nb_cb_modify_args
*args
)
3640 struct isis_area
*area
;
3641 struct isis_circuit
*circuit
;
3643 if (args
->event
!= NB_EV_APPLY
)
3646 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3647 circuit
->rlfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3649 area
= circuit
->area
;
3651 if (circuit
->rlfa_protection
[1])
3652 area
->rlfa_protected_links
[1]++;
3654 assert(area
->rlfa_protected_links
[1] > 0);
3655 area
->rlfa_protected_links
[1]--;
3658 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3666 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/remote-lfa/maximum-metric
3668 int lib_interface_isis_fast_reroute_level_2_remote_lfa_maximum_metric_modify(
3669 struct nb_cb_modify_args
*args
)
3671 struct isis_area
*area
;
3672 struct isis_circuit
*circuit
;
3674 if (args
->event
!= NB_EV_APPLY
)
3677 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3678 circuit
->rlfa_max_metric
[1] = yang_dnode_get_uint32(args
->dnode
, NULL
);
3680 area
= circuit
->area
;
3682 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3687 int lib_interface_isis_fast_reroute_level_2_remote_lfa_maximum_metric_destroy(
3688 struct nb_cb_destroy_args
*args
)
3690 struct isis_area
*area
;
3691 struct isis_circuit
*circuit
;
3693 if (args
->event
!= NB_EV_APPLY
)
3696 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3697 circuit
->rlfa_max_metric
[1] = 0;
3699 area
= circuit
->area
;
3701 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3708 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/enable
3710 int lib_interface_isis_fast_reroute_level_2_ti_lfa_enable_modify(
3711 struct nb_cb_modify_args
*args
)
3713 struct isis_area
*area
;
3714 struct isis_circuit
*circuit
;
3716 if (args
->event
!= NB_EV_APPLY
)
3719 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3720 circuit
->tilfa_protection
[1] = yang_dnode_get_bool(args
->dnode
, NULL
);
3722 area
= circuit
->area
;
3724 if (circuit
->tilfa_protection
[1])
3725 area
->tilfa_protected_links
[1]++;
3727 assert(area
->tilfa_protected_links
[1] > 0);
3728 area
->tilfa_protected_links
[1]--;
3731 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3739 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/node-protection
3741 int lib_interface_isis_fast_reroute_level_2_ti_lfa_node_protection_modify(
3742 struct nb_cb_modify_args
*args
)
3744 struct isis_area
*area
;
3745 struct isis_circuit
*circuit
;
3747 if (args
->event
!= NB_EV_APPLY
)
3750 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3751 circuit
->tilfa_node_protection
[1] =
3752 yang_dnode_get_bool(args
->dnode
, NULL
);
3754 area
= circuit
->area
;
3756 lsp_regenerate_schedule(area
, area
->is_type
, 0);
3763 * /frr-interface:lib/interface/frr-isisd:isis/fast-reroute/level-2/ti-lfa/link-fallback
3765 int lib_interface_isis_fast_reroute_level_2_ti_lfa_link_fallback_modify(
3766 struct nb_cb_modify_args
*args
)
3768 struct isis_area
*area
;
3769 struct isis_circuit
*circuit
;
3771 if (args
->event
!= NB_EV_APPLY
)
3774 circuit
= nb_running_get_entry(args
->dnode
, NULL
, true);
3775 circuit
->tilfa_link_fallback
[1] =
3776 yang_dnode_get_bool(args
->dnode
, NULL
);
3778 area
= circuit
->area
;
3780 lsp_regenerate_schedule(area
, area
->is_type
, 0);