+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2001,2002 Sampo Saaristo
* Tampere University of Technology
* Institute of Communications Engineering
* Copyright (C) 2018 Volta Networks
* Emanuele Di Pascale
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
#include "isisd/isis_dr.h"
#include "isisd/isis_zebra.h"
-DEFINE_MTYPE_STATIC(ISISD, ISIS_MPLS_TE, "ISIS MPLS_TE parameters");
-DEFINE_MTYPE_STATIC(ISISD, ISIS_PLIST_NAME, "ISIS prefix-list name");
-
/*
* XPath: /frr-isisd:isis/instance
*/
int isis_instance_destroy(struct nb_cb_destroy_args *args)
{
struct isis_area *area;
+ struct isis *isis;
if (args->event != NB_EV_APPLY)
return NB_OK;
area = nb_running_unset_entry(args->dnode);
-
+ isis = area->isis;
isis_area_destroy(area);
+
+ if (listcount(isis->area_list) == 0)
+ isis_finish(isis);
+
return NB_OK;
}
}
/*
- * XPath: /frr-isisd:isis/instance/overload
+ * XPath: /frr-isisd:isis/instance/overload/enabled
*/
-int isis_instance_overload_modify(struct nb_cb_modify_args *args)
+int isis_instance_overload_enabled_modify(struct nb_cb_modify_args *args)
{
struct isis_area *area;
bool overload;
area = nb_running_get_entry(args->dnode, NULL, true);
overload = yang_dnode_get_bool(args->dnode, NULL);
+ area->overload_configured = overload;
+
isis_area_overload_bit_set(area, overload);
return NB_OK;
}
+/*
+ * XPath: /frr-isisd:isis/instance/overload/on-startup
+ */
+int isis_instance_overload_on_startup_modify(struct nb_cb_modify_args *args)
+{
+ struct isis_area *area;
+ uint32_t overload_time;
+
+ if (args->event != NB_EV_APPLY)
+ return NB_OK;
+
+ overload_time = yang_dnode_get_uint32(args->dnode, NULL);
+ area = nb_running_get_entry(args->dnode, NULL, true);
+ isis_area_overload_on_startup_set(area, overload_time);
+
+ return NB_OK;
+}
+
/*
* XPath: /frr-isisd:isis/instance/metric-style
*/
*/
int isis_instance_mpls_te_create(struct nb_cb_create_args *args)
{
- struct listnode *node;
struct isis_area *area;
- struct isis_circuit *circuit;
if (args->event != NB_EV_APPLY)
return NB_OK;
area = nb_running_get_entry(args->dnode, NULL, true);
- if (area->mta == NULL) {
-
- struct mpls_te_area *new;
-
- zlog_debug("ISIS-TE(%s): Initialize MPLS Traffic Engineering",
- area->area_tag);
-
- new = XCALLOC(MTYPE_ISIS_MPLS_TE, sizeof(struct mpls_te_area));
-
- /* Initialize MPLS_TE structure */
- new->status = enable;
- new->level = 0;
- new->inter_as = off;
- new->interas_areaid.s_addr = 0;
- new->router_id.s_addr = 0;
- new->ted = ls_ted_new(1, "ISIS", 0);
- if (!new->ted)
- zlog_warn("Unable to create Link State Data Base");
-
- area->mta = new;
- } else {
- area->mta->status = enable;
- }
-
- /* Initialize Link State Database */
- if (area->mta->ted)
- isis_te_init_ted(area);
-
- /* Update Extended TLVs according to Interface link parameters */
- for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit))
- isis_link_params_update(circuit, circuit->interface);
+ isis_mpls_te_create(area);
/* Reoriginate STD_TE & GMPLS circuits */
lsp_regenerate_schedule(area, area->is_type, 0);
int isis_instance_mpls_te_destroy(struct nb_cb_destroy_args *args)
{
- struct listnode *node;
struct isis_area *area;
- struct isis_circuit *circuit;
if (args->event != NB_EV_APPLY)
return NB_OK;
area = nb_running_get_entry(args->dnode, NULL, true);
- if (IS_MPLS_TE(area->mta))
- area->mta->status = disable;
- else
- return NB_OK;
-
- /* Remove Link State Database */
- ls_ted_del_all(&area->mta->ted);
-
- /* Flush LSP if circuit engage */
- for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) {
- if (!IS_EXT_TE(circuit->ext))
- continue;
-
- /* disable MPLS_TE Circuit keeping SR one's */
- if (IS_SUBTLV(circuit->ext, EXT_ADJ_SID))
- circuit->ext->status = EXT_ADJ_SID;
- else if (IS_SUBTLV(circuit->ext, EXT_LAN_ADJ_SID))
- circuit->ext->status = EXT_LAN_ADJ_SID;
- else
- circuit->ext->status = 0;
- }
+ if (!IS_MPLS_TE(area->mta))
+ return NB_OK;
+
+ isis_mpls_te_disable(area);
/* Reoriginate STD_TE & GMPLS circuits */
lsp_regenerate_schedule(area, area->is_type, 0);