]> git.puffer.fish Git - mirror/frr.git/commitdiff
Revert "isisd: Add IS-IS-TE support per Area" 4185/head
authorRuss White <russ@riw.us>
Tue, 23 Apr 2019 13:24:18 +0000 (09:24 -0400)
committerGitHub <noreply@github.com>
Tue, 23 Apr 2019 13:24:18 +0000 (09:24 -0400)
isisd/isis_circuit.h
isisd/isis_cli.c
isisd/isis_lsp.c
isisd/isis_northbound.c
isisd/isis_pdu.c
isisd/isis_te.c
isisd/isis_te.h
isisd/isis_zebra.c
isisd/isisd.c
isisd/isisd.h
yang/frr-isisd.yang

index 2371c0b73a15c24444b05ef44de2fd847815ebd3..e0ea4f78b44fbc26019bdd2511644dc366fd1ab3 100644 (file)
@@ -121,7 +121,8 @@ struct isis_circuit {
        uint16_t psnp_interval[2];    /* psnp-interval in seconds */
        uint8_t metric[2];
        uint32_t te_metric[2];
-       struct mpls_te_circuit *mtc; /* MPLS-TE parameters */
+       struct mpls_te_circuit
+               *mtc;   /* Support for MPLS-TE parameters - see isis_te.[c,h] */
        int ip_router;  /* Route IP ? */
        int is_passive; /* Is Passive ? */
        struct list *mt_settings;   /* IS-IS MT Settings */
index 00948528259d56d158b297677134488c9bb7df98..5f7be160341a1f720744d7dddd516bd91e675124 100644 (file)
@@ -928,12 +928,12 @@ void cli_show_isis_purge_origin(struct vty *vty, struct lyd_node *dnode,
 }
 
 /*
- * XPath: /frr-isisd:isis/instance/mpls-te
+ * XPath: /frr-isisd:isis/mpls-te
  */
 DEFPY(isis_mpls_te_on, isis_mpls_te_on_cmd, "mpls-te on",
       MPLS_TE_STR "Enable the MPLS-TE functionality\n")
 {
-       nb_cli_enqueue_change(vty, "./mpls-te", NB_OP_CREATE,
+       nb_cli_enqueue_change(vty, "/frr-isisd:isis/mpls-te", NB_OP_CREATE,
                              NULL);
 
        return nb_cli_apply_changes(vty, NULL);
@@ -942,9 +942,9 @@ DEFPY(isis_mpls_te_on, isis_mpls_te_on_cmd, "mpls-te on",
 DEFPY(no_isis_mpls_te_on, no_isis_mpls_te_on_cmd, "no mpls-te [on]",
       NO_STR
       "Disable the MPLS-TE functionality\n"
-      "Disable the MPLS-TE functionality\n")
+      "Enable the MPLS-TE functionality\n")
 {
-       nb_cli_enqueue_change(vty, "./mpls-te", NB_OP_DESTROY,
+       nb_cli_enqueue_change(vty, "/frr-isisd:isis/mpls-te", NB_OP_DESTROY,
                              NULL);
 
        return nb_cli_apply_changes(vty, NULL);
@@ -957,7 +957,7 @@ void cli_show_isis_mpls_te(struct vty *vty, struct lyd_node *dnode,
 }
 
 /*
- * XPath: /frr-isisd:isis/instance/mpls-te/router-address
+ * XPath: /frr-isisd:isis/mpls-te/router-address
  */
 DEFPY(isis_mpls_te_router_addr, isis_mpls_te_router_addr_cmd,
       "mpls-te router-address A.B.C.D",
@@ -965,24 +965,12 @@ DEFPY(isis_mpls_te_router_addr, isis_mpls_te_router_addr_cmd,
       "Stable IP address of the advertising router\n"
       "MPLS-TE router address in IPv4 address format\n")
 {
-       nb_cli_enqueue_change(vty, "./mpls-te/router-address",
+       nb_cli_enqueue_change(vty, "/frr-isisd:isis/mpls-te/router-address",
                              NB_OP_MODIFY, router_address_str);
 
        return nb_cli_apply_changes(vty, NULL);
 }
 
-DEFPY(no_isis_mpls_te_router_addr, no_isis_mpls_te_router_addr_cmd,
-      "no mpls-te router-address [A.B.C.D]",
-      NO_STR MPLS_TE_STR
-      "Delete IP address of the advertising router\n"
-      "MPLS-TE router address in IPv4 address format\n")
-{
-       nb_cli_enqueue_change(vty, "./mpls-te/router-address",
-                             NB_OP_DESTROY, NULL);
-
-       return nb_cli_apply_changes(vty, NULL);
-}
-
 void cli_show_isis_mpls_te_router_addr(struct vty *vty, struct lyd_node *dnode,
                                       bool show_defaults)
 {
@@ -998,7 +986,7 @@ DEFPY(isis_mpls_te_inter_as, isis_mpls_te_inter_as_cmd,
       "AREA native mode self originate INTER-AS LSP with L1 and L2 flooding scope\n"
       "AS native mode self originate INTER-AS LSP with L2 only flooding scope\n")
 {
-       vty_out(vty, "MPLS-TE Inter-AS is not yet supported\n");
+       vty_out(vty, "MPLS-TE Inter-AS is not yet supported.");
        return CMD_SUCCESS;
 }
 
@@ -1979,7 +1967,6 @@ void isis_cli_init(void)
        install_element(ISIS_NODE, &isis_mpls_te_on_cmd);
        install_element(ISIS_NODE, &no_isis_mpls_te_on_cmd);
        install_element(ISIS_NODE, &isis_mpls_te_router_addr_cmd);
-       install_element(ISIS_NODE, &no_isis_mpls_te_router_addr_cmd);
        install_element(ISIS_NODE, &isis_mpls_te_inter_as_cmd);
 
        install_element(ISIS_NODE, &isis_default_originate_cmd);
index 0a9f13e6dc4d99a4c9de5267f08064611463d664..b56a56fa3ffd827f3a373ed4460185c692860f9c 100644 (file)
@@ -1070,7 +1070,7 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area)
                                                uint8_t subtlvs[256];
                                                uint8_t subtlv_len;
 
-                                               if (IS_MPLS_TE(area->mta)
+                                               if (IS_MPLS_TE(isisMplsTE)
                                                    && circuit->interface
                                                    && HAS_LINK_PARAMS(
                                                               circuit->interface))
@@ -1112,7 +1112,7 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area)
                                        uint8_t subtlvs[256];
                                        uint8_t subtlv_len;
 
-                                       if (IS_MPLS_TE(area->mta)
+                                       if (IS_MPLS_TE(isisMplsTE)
                                            && circuit->interface != NULL
                                            && HAS_LINK_PARAMS(
                                                       circuit->interface))
index f744758eb9097976a72bde7f859102a3065ee6eb..95595e37b9d904183ebb5d3a8467f912861e9274 100644 (file)
@@ -1365,40 +1365,19 @@ isis_instance_log_adjacency_changes_modify(enum nb_event event,
 }
 
 /*
- * XPath: /frr-isisd:isis/instance/mpls-te
+ * XPath: /frr-isisd:isis/mpls-te
  */
-static int isis_instance_mpls_te_create(enum nb_event event,
+static int isis_mpls_te_create(enum nb_event event,
                               const struct lyd_node *dnode,
                               union nb_resource *resource)
 {
        struct listnode *node;
-       struct isis_area *area;
        struct isis_circuit *circuit;
 
        if (event != NB_EV_APPLY)
                return NB_OK;
 
-       area = yang_dnode_get_entry(dnode, true);
-       if (area->mta == NULL) {
-
-               struct mpls_te_area *new;
-
-               zlog_debug("ISIS MPLS-TE: Initialize area %s",
-                       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;
-
-               area->mta = new;
-       } else {
-               area->mta->status = enable;
-       }
+       isisMplsTE.status = enable;
 
        /*
         * Following code is intended to handle two cases;
@@ -1408,11 +1387,11 @@ static int isis_instance_mpls_te_create(enum nb_event event,
         * MPLS_TE flag
         * 2) MPLS-TE was once enabled then disabled, and now enabled again.
         */
-       for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) {
+       for (ALL_LIST_ELEMENTS_RO(isisMplsTE.cir_list, node, circuit)) {
                if (circuit->mtc == NULL || IS_FLOOD_AS(circuit->mtc->type))
                        continue;
 
-               if (!IS_MPLS_TE(circuit->mtc)
+               if ((circuit->mtc->status == disable)
                    && HAS_LINK_PARAMS(circuit->interface))
                        circuit->mtc->status = enable;
                else
@@ -1427,24 +1406,19 @@ static int isis_instance_mpls_te_create(enum nb_event event,
        return NB_OK;
 }
 
-static int isis_instance_mpls_te_destroy(enum nb_event event,
+static int isis_mpls_te_destroy(enum nb_event event,
                               const struct lyd_node *dnode)
 {
        struct listnode *node;
-       struct isis_area *area;
        struct isis_circuit *circuit;
 
        if (event != NB_EV_APPLY)
                return NB_OK;
 
-       area = yang_dnode_get_entry(dnode, true);
-       if (IS_MPLS_TE(area->mta))
-               area->mta->status = disable;
-       else
-               return NB_OK;
+       isisMplsTE.status = disable;
 
        /* Flush LSP if circuit engage */
-       for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) {
+       for (ALL_LIST_ELEMENTS_RO(isisMplsTE.cir_list, node, circuit)) {
                if (circuit->mtc == NULL || (circuit->mtc->status == disable))
                        continue;
 
@@ -1461,53 +1435,55 @@ static int isis_instance_mpls_te_destroy(enum nb_event event,
 }
 
 /*
- * XPath: /frr-isisd:isis/instance/mpls-te/router-address
+ * XPath: /frr-isisd:isis/mpls-te/router-address
  */
-static int isis_instance_mpls_te_router_address_modify(enum nb_event event,
+static int isis_mpls_te_router_address_modify(enum nb_event event,
                                              const struct lyd_node *dnode,
                                              union nb_resource *resource)
 {
        struct in_addr value;
+       struct listnode *node;
        struct isis_area *area;
 
        if (event != NB_EV_APPLY)
                return NB_OK;
 
-       area = yang_dnode_get_entry(dnode, true);
+       yang_dnode_get_ipv4(&value, dnode, NULL);
+       isisMplsTE.router_id.s_addr = value.s_addr;
        /* only proceed if MPLS-TE is enabled */
-       if (!IS_MPLS_TE(area->mta))
+       if (isisMplsTE.status == disable)
                return NB_OK;
 
-       /* Update Area Router ID */
-       yang_dnode_get_ipv4(&value, dnode, NULL);
-       area->mta->router_id.s_addr = value.s_addr;
-
+       /* Update main Router ID in isis global structure */
+       isis->router_id = value.s_addr;
        /* And re-schedule LSP update */
-       if (listcount(area->area_addrs) > 0)
-               lsp_regenerate_schedule(area, area->is_type, 0);
+       for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area))
+               if (listcount(area->area_addrs) > 0)
+                       lsp_regenerate_schedule(area, area->is_type, 0);
 
        return NB_OK;
 }
 
-static int isis_instance_mpls_te_router_address_destroy(enum nb_event event,
+static int isis_mpls_te_router_address_destroy(enum nb_event event,
                                              const struct lyd_node *dnode)
 {
+       struct listnode *node;
        struct isis_area *area;
 
        if (event != NB_EV_APPLY)
                return NB_OK;
 
-       area = yang_dnode_get_entry(dnode, true);
+       isisMplsTE.router_id.s_addr = INADDR_ANY;
        /* only proceed if MPLS-TE is enabled */
-       if (!IS_MPLS_TE(area->mta))
+       if (isisMplsTE.status == disable)
                return NB_OK;
 
-       /* Reset Area Router ID */
-       area->mta->router_id.s_addr = INADDR_ANY;
-
+       /* Update main Router ID in isis global structure */
+       isis->router_id = 0;
        /* And re-schedule LSP update */
-       if (listcount(area->area_addrs) > 0)
-               lsp_regenerate_schedule(area, area->is_type, 0);
+       for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area))
+               if (listcount(area->area_addrs) > 0)
+                       lsp_regenerate_schedule(area, area->is_type, 0);
 
        return NB_OK;
 }
@@ -3039,15 +3015,15 @@ const struct frr_yang_module_info frr_isisd_info = {
                        .cbs.cli_show = cli_show_isis_log_adjacency,
                },
                {
-                       .xpath = "/frr-isisd:isis/instance/mpls-te",
-                       .cbs.create = isis_instance_mpls_te_create,
-                       .cbs.destroy = isis_instance_mpls_te_destroy,
+                       .xpath = "/frr-isisd:isis/mpls-te",
+                       .cbs.create = isis_mpls_te_create,
+                       .cbs.destroy = isis_mpls_te_destroy,
                        .cbs.cli_show = cli_show_isis_mpls_te,
                },
                {
-                       .xpath = "/frr-isisd:isis/instance/mpls-te/router-address",
-                       .cbs.modify = isis_instance_mpls_te_router_address_modify,
-                       .cbs.destroy = isis_instance_mpls_te_router_address_destroy,
+                       .xpath = "/frr-isisd:isis/mpls-te/router-address",
+                       .cbs.modify = isis_mpls_te_router_address_modify,
+                       .cbs.destroy = isis_mpls_te_router_address_destroy,
                        .cbs.cli_show = cli_show_isis_mpls_te_router_addr,
                },
                {
index 8fac3f98fa80075d281301f5e4bd68f4cddf493e..8e9302963dabdd6dd7c0d11d0c21adf893342474 100644 (file)
@@ -201,9 +201,8 @@ static int process_p2p_hello(struct iih_info *iih)
                                      adj);
 
        /* Update MPLS TE Remote IP address parameter if possible */
-       if (adj->ipv4_address_count && iih->circuit->area
-           && IS_MPLS_TE(iih->circuit->area->mta)
-           && IS_MPLS_TE(iih->circuit->mtc))
+       if (IS_MPLS_TE(isisMplsTE) && iih->circuit->mtc
+           && IS_CIRCUIT_TE(iih->circuit->mtc) && adj->ipv4_address_count)
                set_circuitparams_rmt_ipaddr(iih->circuit->mtc,
                                             adj->ipv4_addresses[0]);
 
index 2f18e0356daa8c995758b83b91e773c9c9db2f49..23a1f10a18adf3d20102a839a048ad11c4a914b6 100644 (file)
@@ -58,6 +58,9 @@
 #include "isisd/isis_spf.h"
 #include "isisd/isis_te.h"
 
+/* Global varial for MPLS TE management */
+struct isis_mpls_te isisMplsTE;
+
 const char *mode2text[] = {"Disable", "Area", "AS", "Emulate"};
 
 /*------------------------------------------------------------------------*
@@ -621,7 +624,7 @@ void isis_link_params_update(struct isis_circuit *circuit,
 
 /* Finally Update LSP */
 #if 0
-  if (circuit->area && IS_MPLS_TE(circuit->area->mta))
+  if (IS_MPLS_TE(isisMplsTE) && circuit->area)
        lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);
 #endif
        return;
@@ -643,7 +646,7 @@ void isis_mpls_te_update(struct interface *ifp)
        isis_link_params_update(circuit, ifp);
 
        /* ... and LSP */
-       if (circuit->area && IS_MPLS_TE(circuit->area->mta))
+       if (IS_MPLS_TE(isisMplsTE) && circuit->area)
                lsp_regenerate_schedule(circuit->area, circuit->is_type, 0);
 
        return;
@@ -1055,11 +1058,35 @@ void mpls_te_print_detail(struct sbuf *buf, int indent,
        return;
 }
 
+/* Specific MPLS TE router parameters write function */
+void isis_mpls_te_config_write_router(struct vty *vty)
+{
+       if (IS_MPLS_TE(isisMplsTE)) {
+               vty_out(vty, "  mpls-te on\n");
+               vty_out(vty, "  mpls-te router-address %s\n",
+                       inet_ntoa(isisMplsTE.router_id));
+       }
+
+       return;
+}
+
+
 /*------------------------------------------------------------------------*
  * Followings are vty command functions.
  *------------------------------------------------------------------------*/
 #ifndef FABRICD
 
+/* Search MPLS TE Circuit context from Interface */
+static struct mpls_te_circuit *lookup_mpls_params_by_ifp(struct interface *ifp)
+{
+       struct isis_circuit *circuit;
+
+       if ((circuit = circuit_scan_by_ifp(ifp)) == NULL)
+               return NULL;
+
+       return circuit->mtc;
+}
+
 DEFUN (show_isis_mpls_te_router,
        show_isis_mpls_te_router_cmd,
        "show " PROTO_NAME " mpls-te router",
@@ -1068,73 +1095,84 @@ DEFUN (show_isis_mpls_te_router,
        MPLS_TE_STR
        "Router information\n")
 {
+       if (IS_MPLS_TE(isisMplsTE)) {
+               vty_out(vty, "--- MPLS-TE router parameters ---\n");
 
-       struct listnode *anode;
-       struct isis_area *area;
-
-       if (!isis) {
-               vty_out(vty, "IS-IS Routing Process not enabled\n");
-               return CMD_SUCCESS;
-       }
-
-       for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) {
-
-               if (!IS_MPLS_TE(area->mta))
-                       continue;
-
-               vty_out(vty, "Area %s:\n", area->area_tag);
-               if (ntohs(area->mta->router_id.s_addr) != 0)
-                       vty_out(vty, "  MPLS-TE Router-Address: %s\n",
-                               inet_ntoa(area->mta->router_id));
+               if (ntohs(isisMplsTE.router_id.s_addr) != 0)
+                       vty_out(vty, "  Router-Address: %s\n",
+                               inet_ntoa(isisMplsTE.router_id));
                else
                        vty_out(vty, "  N/A\n");
-       }
+       } else
+               vty_out(vty, "  MPLS-TE is disable on this router\n");
 
        return CMD_SUCCESS;
 }
 
-static void show_mpls_te_sub(struct vty *vty, char *name,
-                            struct mpls_te_circuit *mtc)
+static void show_mpls_te_sub(struct vty *vty, struct interface *ifp)
 {
+       struct mpls_te_circuit *mtc;
        struct sbuf buf;
 
        sbuf_init(&buf, NULL, 0);
 
-       if (mtc->status != enable)
-               return;
+       if ((IS_MPLS_TE(isisMplsTE))
+           && ((mtc = lookup_mpls_params_by_ifp(ifp)) != NULL)) {
+               /* Continue only if interface is not passive or support Inter-AS
+                * TEv2 */
+               if (mtc->status != enable) {
+                       if (IS_INTER_AS(mtc->type)) {
+                               vty_out(vty,
+                                       "-- Inter-AS TEv2 link parameters for %s --\n",
+                                       ifp->name);
+                       } else {
+                               /* MPLS-TE is not activate on this interface */
+                               /* or this interface is passive and Inter-AS
+                                * TEv2 is not activate */
+                               vty_out(vty,
+                                       "  %s: MPLS-TE is disabled on this interface\n",
+                                       ifp->name);
+                               return;
+                       }
+               } else {
+                       vty_out(vty, "-- MPLS-TE link parameters for %s --\n",
+                               ifp->name);
+               }
 
-       vty_out(vty, "-- MPLS-TE link parameters for %s --\n", name);
+               sbuf_reset(&buf);
+               print_subtlv_admin_grp(&buf, 4, &mtc->admin_grp);
 
-       sbuf_reset(&buf);
-       print_subtlv_admin_grp(&buf, 4, &mtc->admin_grp);
+               if (SUBTLV_TYPE(mtc->local_ipaddr) != 0)
+                       print_subtlv_local_ipaddr(&buf, 4, &mtc->local_ipaddr);
+               if (SUBTLV_TYPE(mtc->rmt_ipaddr) != 0)
+                       print_subtlv_rmt_ipaddr(&buf, 4, &mtc->rmt_ipaddr);
 
-       if (SUBTLV_TYPE(mtc->local_ipaddr) != 0)
-               print_subtlv_local_ipaddr(&buf, 4, &mtc->local_ipaddr);
-       if (SUBTLV_TYPE(mtc->rmt_ipaddr) != 0)
-               print_subtlv_rmt_ipaddr(&buf, 4, &mtc->rmt_ipaddr);
-
-       print_subtlv_max_bw(&buf, 4, &mtc->max_bw);
-       print_subtlv_max_rsv_bw(&buf, 4, &mtc->max_rsv_bw);
-       print_subtlv_unrsv_bw(&buf, 4, &mtc->unrsv_bw);
-       print_subtlv_te_metric(&buf, 4, &mtc->te_metric);
-
-       if (IS_INTER_AS(mtc->type)) {
-               if (SUBTLV_TYPE(mtc->ras) != 0)
-                       print_subtlv_ras(&buf, 4, &mtc->ras);
-               if (SUBTLV_TYPE(mtc->rip) != 0)
-                       print_subtlv_rip(&buf, 4, &mtc->rip);
-       }
+               print_subtlv_max_bw(&buf, 4, &mtc->max_bw);
+               print_subtlv_max_rsv_bw(&buf, 4, &mtc->max_rsv_bw);
+               print_subtlv_unrsv_bw(&buf, 4, &mtc->unrsv_bw);
+               print_subtlv_te_metric(&buf, 4, &mtc->te_metric);
 
-       print_subtlv_av_delay(&buf, 4, &mtc->av_delay);
-       print_subtlv_mm_delay(&buf, 4, &mtc->mm_delay);
-       print_subtlv_delay_var(&buf, 4, &mtc->delay_var);
-       print_subtlv_pkt_loss(&buf, 4, &mtc->pkt_loss);
-       print_subtlv_res_bw(&buf, 4, &mtc->res_bw);
-       print_subtlv_ava_bw(&buf, 4, &mtc->ava_bw);
-       print_subtlv_use_bw(&buf, 4, &mtc->use_bw);
+               if (IS_INTER_AS(mtc->type)) {
+                       if (SUBTLV_TYPE(mtc->ras) != 0)
+                               print_subtlv_ras(&buf, 4, &mtc->ras);
+                       if (SUBTLV_TYPE(mtc->rip) != 0)
+                               print_subtlv_rip(&buf, 4, &mtc->rip);
+               }
+
+               print_subtlv_av_delay(&buf, 4, &mtc->av_delay);
+               print_subtlv_mm_delay(&buf, 4, &mtc->mm_delay);
+               print_subtlv_delay_var(&buf, 4, &mtc->delay_var);
+               print_subtlv_pkt_loss(&buf, 4, &mtc->pkt_loss);
+               print_subtlv_res_bw(&buf, 4, &mtc->res_bw);
+               print_subtlv_ava_bw(&buf, 4, &mtc->ava_bw);
+               print_subtlv_use_bw(&buf, 4, &mtc->use_bw);
 
-       vty_multiline(vty, "", "%s", sbuf_buf(&buf));
-       vty_out(vty, "---------------\n\n");
+               vty_multiline(vty, "", "%s", sbuf_buf(&buf));
+               vty_out(vty, "---------------\n\n");
+       } else {
+               vty_out(vty, "  %s: MPLS-TE is disabled on this interface\n",
+                       ifp->name);
+       }
 
        sbuf_free(&buf);
        return;
@@ -1149,45 +1187,23 @@ DEFUN (show_isis_mpls_te_interface,
        "Interface information\n"
        "Interface name\n")
 {
-       struct listnode *anode, *cnode;
-       struct isis_area *area;
-       struct isis_circuit *circuit;
-       struct interface *ifp;
+       struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
        int idx_interface = 4;
+       struct interface *ifp;
 
-       if (!isis) {
-               vty_out(vty, "IS-IS Routing Process not enabled\n");
-               return CMD_SUCCESS;
+       /* Show All Interfaces. */
+       if (argc == 4) {
+               FOR_ALL_INTERFACES (vrf, ifp)
+                       show_mpls_te_sub(vty, ifp);
        }
-
-       if (argc == idx_interface) {
-               /* Show All Interfaces. */
-               for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) {
-
-                       if (!IS_MPLS_TE(area->mta))
-                               continue;
-
-                       vty_out(vty, "Area %s:\n", area->area_tag);
-
-                       for (ALL_LIST_ELEMENTS_RO(area->circuit_list, cnode,
-                                                 circuit))
-                               show_mpls_te_sub(vty, circuit->interface->name,
-                                                circuit->mtc);
-               }
-       } else {
-               /* Interface name is specified. */
-               ifp = if_lookup_by_name(argv[idx_interface]->arg, VRF_DEFAULT);
-               if (ifp == NULL)
+       /* Interface name is specified. */
+       else {
+               if ((ifp = if_lookup_by_name(argv[idx_interface]->arg,
+                                            VRF_DEFAULT))
+                   == NULL)
                        vty_out(vty, "No such interface name\n");
-               else {
-                       circuit = circuit_scan_by_ifp(ifp);
-                       if (!circuit)
-                               vty_out(vty,
-                                       "ISIS is not enabled on circuit %s\n",
-                                       ifp->name);
-                       else
-                               show_mpls_te_sub(vty, ifp->name, circuit->mtc);
-               }
+               else
+                       show_mpls_te_sub(vty, ifp);
        }
 
        return CMD_SUCCESS;
@@ -1198,6 +1214,16 @@ DEFUN (show_isis_mpls_te_interface,
 void isis_mpls_te_init(void)
 {
 
+       zlog_debug("ISIS MPLS-TE: Initialize");
+
+       /* Initialize MPLS_TE structure */
+       isisMplsTE.status = disable;
+       isisMplsTE.level = 0;
+       isisMplsTE.inter_as = off;
+       isisMplsTE.interas_areaid.s_addr = 0;
+       isisMplsTE.cir_list = list_new();
+       isisMplsTE.router_id.s_addr = 0;
+
 #ifndef FABRICD
        /* Register new VTY commands */
        install_element(VIEW_NODE, &show_isis_mpls_te_router_cmd);
index beb0c1836ff9b58c74529b9204514bed853207d4..e9eff08cd138b8cba5d47f6dc8a44ca3d20f91ee 100644 (file)
@@ -244,10 +244,11 @@ typedef enum _status_t { disable, enable, learn } status_t;
 /* Mode for Inter-AS LSP */ /* TODO: Check how if LSP is flooded in RFC5316 */
 typedef enum _interas_mode_t { off, region, as, emulate } interas_mode_t;
 
-#define IS_MPLS_TE(m)    (m && m->status == enable)
+#define IS_MPLS_TE(m)    (m.status == enable)
+#define IS_CIRCUIT_TE(c) (c->status == enable)
 
-/* Per area MPLS-TE parameters */
-struct mpls_te_area {
+/* Following structure are internal use only. */
+struct isis_mpls_te {
        /* Status of MPLS-TE: enable or disable */
        status_t status;
 
@@ -258,11 +259,15 @@ struct mpls_te_area {
        interas_mode_t inter_as;
        struct in_addr interas_areaid;
 
+       /* Circuit list on which TE are enable */
+       struct list *cir_list;
+
        /* MPLS_TE router ID */
        struct in_addr router_id;
 };
 
-/* Per Circuit MPLS-TE parameters */
+extern struct isis_mpls_te isisMplsTE;
+
 struct mpls_te_circuit {
 
        /* Status of MPLS-TE on this interface */
@@ -313,5 +318,6 @@ uint8_t add_te_subtlvs(uint8_t *, struct mpls_te_circuit *);
 uint8_t build_te_subtlvs(uint8_t *, struct isis_circuit *);
 void isis_link_params_update(struct isis_circuit *, struct interface *);
 void isis_mpls_te_update(struct interface *);
+void isis_mpls_te_config_write_router(struct vty *);
 
 #endif /* _ZEBRA_ISIS_MPLS_TE_H */
index 451caed78e1ccfd1fd7860107a247671c0368834..79d79f8911647653be9c590c00fe21dc7235f15b 100644 (file)
@@ -61,6 +61,13 @@ static int isis_router_id_update_zebra(int command, struct zclient *zclient,
        struct listnode *node;
        struct prefix router_id;
 
+       /*
+        * If ISIS TE is enable, TE Router ID is set through specific command.
+        * See mpls_te_router_addr() command in isis_te.c
+        */
+       if (IS_MPLS_TE(isisMplsTE))
+               return 0;
+
        zebra_router_id_update_read(zclient->ibuf, &router_id);
        if (isis->router_id == router_id.u.prefix4.s_addr)
                return 0;
index e649b2bac1266d79cea1cb852b7321fe40d818ab..ad02220438f839576ac32c74cf4447a98e7a5c96 100644 (file)
@@ -95,6 +95,7 @@ void isis_new(unsigned long process_id)
         * uncomment the next line for full debugs
         */
        /* isis->debugs = 0xFFFF; */
+       isisMplsTE.status = disable; /* Only support TE metric */
 
        QOBJ_REG(isis, isis);
 }
@@ -257,10 +258,6 @@ int isis_area_destroy(const char *area_tag)
        if (fabricd)
                fabricd_finish(area->fabricd);
 
-       /* Disable MPLS if necessary before flooding LSP */
-       if (IS_MPLS_TE(area->mta))
-               area->mta->status = disable;
-
        if (area->circuit_list) {
                for (ALL_LIST_ELEMENTS(area->circuit_list, node, nnode,
                                       circuit)) {
@@ -2140,6 +2137,7 @@ int isis_config_write(struct vty *vty)
                        write += area_write_mt_settings(area, vty);
                        write += fabricd_write_settings(area, vty);
                }
+               isis_mpls_te_config_write_router(vty);
        }
 
        return write;
index 758bcb9ad19ab3f374eacc903a712e4560f30f6a..fb879395c1b70ec8cf9c51140933a858fcc9e698 100644 (file)
@@ -165,8 +165,6 @@ struct isis_area {
        uint8_t log_adj_changes;
        /* multi topology settings */
        struct list *mt_settings;
-       /* MPLS-TE settings */
-       struct mpls_te_area *mta;
        int ipv6_circuits;
        bool purge_originator;
        /* Counters */
index 7b132cb61ed929265433fbdf844a91110e18e8aa..d0d11c867636c36c2344e82ea007e782aadf1075 100644 (file)
@@ -707,16 +707,16 @@ module frr-isisd {
         description
           "Log changes to the IS-IS adjacencies in this area.";
       }
+    }
 
-      container mpls-te {
-        presence "Present if MPLS-TE is enabled.";
+    container mpls-te {
+      presence "Present if MPLS-TE is enabled.";
+      description
+        "Enable MPLS-TE functionality.";
+      leaf router-address {
+        type inet:ipv4-address;
         description
-          "Enable MPLS-TE functionality.";
-        leaf router-address {
-          type inet:ipv4-address;
-          description
-            "Stable IP address of the advertising router.";
-        }
+          "Stable IP address of the advertising router.";
       }
     }
   }