2 * IS-IS Rout(e)ing protocol - isis_te.c
4 * This is an implementation of RFC5305 & RFC 7810
6 * Copyright (C) 2014 Orange Labs
7 * http://www.orange.com
9 * This file is part of GNU Zebra.
11 * GNU Zebra is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2, or (at your option) any
16 * GNU Zebra is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program; see the file COPYING; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
42 #include "sockunion.h"
46 #include "isisd/dict.h"
47 #include "isisd/isis_constants.h"
48 #include "isisd/isis_common.h"
49 #include "isisd/isis_flags.h"
50 #include "isisd/isis_circuit.h"
51 #include "isisd/isisd.h"
52 #include "isisd/isis_lsp.h"
53 #include "isisd/isis_pdu.h"
54 #include "isisd/isis_dynhn.h"
55 #include "isisd/isis_misc.h"
56 #include "isisd/isis_csm.h"
57 #include "isisd/isis_adjacency.h"
58 #include "isisd/isis_spf.h"
59 #include "isisd/isis_te.h"
61 /* Global varial for MPLS TE management */
62 struct isis_mpls_te isisMplsTE
;
64 const char *mode2text
[] = {"Disable", "Area", "AS", "Emulate"};
66 /*------------------------------------------------------------------------*
67 * Followings are control functions for MPLS-TE parameters management.
68 *------------------------------------------------------------------------*/
70 /* Search MPLS TE Circuit context from Interface */
71 static struct mpls_te_circuit
*lookup_mpls_params_by_ifp(struct interface
*ifp
)
73 struct isis_circuit
*circuit
;
75 if ((circuit
= circuit_scan_by_ifp(ifp
)) == NULL
)
81 /* Create new MPLS TE Circuit context */
82 struct mpls_te_circuit
*mpls_te_circuit_new()
84 struct mpls_te_circuit
*mtc
;
86 zlog_debug("ISIS MPLS-TE: Create new MPLS TE Circuit context");
88 mtc
= XCALLOC(MTYPE_ISIS_MPLS_TE
, sizeof(struct mpls_te_circuit
));
93 mtc
->status
= disable
;
100 /* Copy SUB TLVs parameters into a buffer - No space verification are performed
102 /* Caller must verify before that there is enough free space in the buffer */
103 uint8_t add_te_subtlvs(uint8_t *buf
, struct mpls_te_circuit
*mtc
)
105 uint8_t size
, *tlvs
= buf
;
107 zlog_debug("ISIS MPLS-TE: Add TE Sub TLVs to buffer");
111 "ISIS MPLS-TE: Abort! No MPLS TE Circuit available has been specified");
115 /* Create buffer if not provided */
117 zlog_debug("ISIS MPLS-TE: Abort! No Buffer has been specified");
121 /* TE_SUBTLV_ADMIN_GRP */
122 if (SUBTLV_TYPE(mtc
->admin_grp
) != 0) {
123 size
= SUBTLV_SIZE(&(mtc
->admin_grp
.header
));
124 memcpy(tlvs
, &(mtc
->admin_grp
), size
);
129 if (SUBTLV_TYPE(mtc
->llri
) != 0) {
130 size
= SUBTLV_SIZE(&(mtc
->llri
.header
));
131 memcpy(tlvs
, &(mtc
->llri
), size
);
135 /* TE_SUBTLV_LCLIF_IPADDR */
136 if (SUBTLV_TYPE(mtc
->local_ipaddr
) != 0) {
137 size
= SUBTLV_SIZE(&(mtc
->local_ipaddr
.header
));
138 memcpy(tlvs
, &(mtc
->local_ipaddr
), size
);
142 /* TE_SUBTLV_RMTIF_IPADDR */
143 if (SUBTLV_TYPE(mtc
->rmt_ipaddr
) != 0) {
144 size
= SUBTLV_SIZE(&(mtc
->rmt_ipaddr
.header
));
145 memcpy(tlvs
, &(mtc
->rmt_ipaddr
), size
);
149 /* TE_SUBTLV_MAX_BW */
150 if (SUBTLV_TYPE(mtc
->max_bw
) != 0) {
151 size
= SUBTLV_SIZE(&(mtc
->max_bw
.header
));
152 memcpy(tlvs
, &(mtc
->max_bw
), size
);
156 /* TE_SUBTLV_MAX_RSV_BW */
157 if (SUBTLV_TYPE(mtc
->max_rsv_bw
) != 0) {
158 size
= SUBTLV_SIZE(&(mtc
->max_rsv_bw
.header
));
159 memcpy(tlvs
, &(mtc
->max_rsv_bw
), size
);
163 /* TE_SUBTLV_UNRSV_BW */
164 if (SUBTLV_TYPE(mtc
->unrsv_bw
) != 0) {
165 size
= SUBTLV_SIZE(&(mtc
->unrsv_bw
.header
));
166 memcpy(tlvs
, &(mtc
->unrsv_bw
), size
);
170 /* TE_SUBTLV_TE_METRIC */
171 if (SUBTLV_TYPE(mtc
->te_metric
) != 0) {
172 size
= SUBTLV_SIZE(&(mtc
->te_metric
.header
));
173 memcpy(tlvs
, &(mtc
->te_metric
), size
);
177 /* TE_SUBTLV_AV_DELAY */
178 if (SUBTLV_TYPE(mtc
->av_delay
) != 0) {
179 size
= SUBTLV_SIZE(&(mtc
->av_delay
.header
));
180 memcpy(tlvs
, &(mtc
->av_delay
), size
);
184 /* TE_SUBTLV_MM_DELAY */
185 if (SUBTLV_TYPE(mtc
->mm_delay
) != 0) {
186 size
= SUBTLV_SIZE(&(mtc
->mm_delay
.header
));
187 memcpy(tlvs
, &(mtc
->mm_delay
), size
);
191 /* TE_SUBTLV_DELAY_VAR */
192 if (SUBTLV_TYPE(mtc
->delay_var
) != 0) {
193 size
= SUBTLV_SIZE(&(mtc
->delay_var
.header
));
194 memcpy(tlvs
, &(mtc
->delay_var
), size
);
198 /* TE_SUBTLV_PKT_LOSS */
199 if (SUBTLV_TYPE(mtc
->pkt_loss
) != 0) {
200 size
= SUBTLV_SIZE(&(mtc
->pkt_loss
.header
));
201 memcpy(tlvs
, &(mtc
->pkt_loss
), size
);
205 /* TE_SUBTLV_RES_BW */
206 if (SUBTLV_TYPE(mtc
->res_bw
) != 0) {
207 size
= SUBTLV_SIZE(&(mtc
->res_bw
.header
));
208 memcpy(tlvs
, &(mtc
->res_bw
), size
);
212 /* TE_SUBTLV_AVA_BW */
213 if (SUBTLV_TYPE(mtc
->ava_bw
) != 0) {
214 size
= SUBTLV_SIZE(&(mtc
->ava_bw
.header
));
215 memcpy(tlvs
, &(mtc
->ava_bw
), size
);
219 /* TE_SUBTLV_USE_BW */
220 if (SUBTLV_TYPE(mtc
->use_bw
) != 0) {
221 size
= SUBTLV_SIZE(&(mtc
->use_bw
.header
));
222 memcpy(tlvs
, &(mtc
->use_bw
), size
);
226 /* Add before this line any other parsing of TLV */
229 /* Update SubTLVs length */
230 mtc
->length
= subtlvs_len(mtc
);
232 zlog_debug("ISIS MPLS-TE: Add %d bytes length SubTLVs", mtc
->length
);
237 /* Compute total Sub-TLVs size */
238 uint8_t subtlvs_len(struct mpls_te_circuit
*mtc
)
246 /* TE_SUBTLV_ADMIN_GRP */
247 if (SUBTLV_TYPE(mtc
->admin_grp
) != 0)
248 length
+= SUBTLV_SIZE(&(mtc
->admin_grp
.header
));
251 if (SUBTLV_TYPE(mtc
->llri
) != 0)
252 length
+= SUBTLV_SIZE(&mtc
->llri
.header
);
254 /* TE_SUBTLV_LCLIF_IPADDR */
255 if (SUBTLV_TYPE(mtc
->local_ipaddr
) != 0)
256 length
+= SUBTLV_SIZE(&mtc
->local_ipaddr
.header
);
258 /* TE_SUBTLV_RMTIF_IPADDR */
259 if (SUBTLV_TYPE(mtc
->rmt_ipaddr
) != 0)
260 length
+= SUBTLV_SIZE(&mtc
->rmt_ipaddr
.header
);
262 /* TE_SUBTLV_MAX_BW */
263 if (SUBTLV_TYPE(mtc
->max_bw
) != 0)
264 length
+= SUBTLV_SIZE(&mtc
->max_bw
.header
);
266 /* TE_SUBTLV_MAX_RSV_BW */
267 if (SUBTLV_TYPE(mtc
->max_rsv_bw
) != 0)
268 length
+= SUBTLV_SIZE(&mtc
->max_rsv_bw
.header
);
270 /* TE_SUBTLV_UNRSV_BW */
271 if (SUBTLV_TYPE(mtc
->unrsv_bw
) != 0)
272 length
+= SUBTLV_SIZE(&mtc
->unrsv_bw
.header
);
274 /* TE_SUBTLV_TE_METRIC */
275 if (SUBTLV_TYPE(mtc
->te_metric
) != 0)
276 length
+= SUBTLV_SIZE(&mtc
->te_metric
.header
);
278 /* TE_SUBTLV_AV_DELAY */
279 if (SUBTLV_TYPE(mtc
->av_delay
) != 0)
280 length
+= SUBTLV_SIZE(&mtc
->av_delay
.header
);
282 /* TE_SUBTLV_MM_DELAY */
283 if (SUBTLV_TYPE(mtc
->mm_delay
) != 0)
284 length
+= SUBTLV_SIZE(&mtc
->mm_delay
.header
);
286 /* TE_SUBTLV_DELAY_VAR */
287 if (SUBTLV_TYPE(mtc
->delay_var
) != 0)
288 length
+= SUBTLV_SIZE(&mtc
->delay_var
.header
);
290 /* TE_SUBTLV_PKT_LOSS */
291 if (SUBTLV_TYPE(mtc
->pkt_loss
) != 0)
292 length
+= SUBTLV_SIZE(&mtc
->pkt_loss
.header
);
294 /* TE_SUBTLV_RES_BW */
295 if (SUBTLV_TYPE(mtc
->res_bw
) != 0)
296 length
+= SUBTLV_SIZE(&mtc
->res_bw
.header
);
298 /* TE_SUBTLV_AVA_BW */
299 if (SUBTLV_TYPE(mtc
->ava_bw
) != 0)
300 length
+= SUBTLV_SIZE(&mtc
->ava_bw
.header
);
302 /* TE_SUBTLV_USE_BW */
303 if (SUBTLV_TYPE(mtc
->use_bw
) != 0)
304 length
+= SUBTLV_SIZE(&mtc
->use_bw
.header
);
306 /* Check that length is lower than the MAXIMUM SUBTLV size i.e. 256 */
307 if (length
> MAX_SUBTLV_SIZE
) {
312 mtc
->length
= (uint8_t)length
;
317 /* Following are various functions to set MPLS TE parameters */
318 static void set_circuitparams_admin_grp(struct mpls_te_circuit
*mtc
,
321 SUBTLV_TYPE(mtc
->admin_grp
) = TE_SUBTLV_ADMIN_GRP
;
322 SUBTLV_LEN(mtc
->admin_grp
) = SUBTLV_DEF_SIZE
;
323 mtc
->admin_grp
.value
= htonl(admingrp
);
327 static void __attribute__((unused
))
328 set_circuitparams_llri(struct mpls_te_circuit
*mtc
, uint32_t local
,
331 SUBTLV_TYPE(mtc
->llri
) = TE_SUBTLV_LLRI
;
332 SUBTLV_LEN(mtc
->llri
) = TE_SUBTLV_LLRI_SIZE
;
333 mtc
->llri
.local
= htonl(local
);
334 mtc
->llri
.remote
= htonl(remote
);
337 void set_circuitparams_local_ipaddr(struct mpls_te_circuit
*mtc
,
341 SUBTLV_TYPE(mtc
->local_ipaddr
) = TE_SUBTLV_LOCAL_IPADDR
;
342 SUBTLV_LEN(mtc
->local_ipaddr
) = SUBTLV_DEF_SIZE
;
343 mtc
->local_ipaddr
.value
.s_addr
= addr
.s_addr
;
347 void set_circuitparams_rmt_ipaddr(struct mpls_te_circuit
*mtc
,
351 SUBTLV_TYPE(mtc
->rmt_ipaddr
) = TE_SUBTLV_RMT_IPADDR
;
352 SUBTLV_LEN(mtc
->rmt_ipaddr
) = SUBTLV_DEF_SIZE
;
353 mtc
->rmt_ipaddr
.value
.s_addr
= addr
.s_addr
;
357 static void set_circuitparams_max_bw(struct mpls_te_circuit
*mtc
, float fp
)
359 SUBTLV_TYPE(mtc
->max_bw
) = TE_SUBTLV_MAX_BW
;
360 SUBTLV_LEN(mtc
->max_bw
) = SUBTLV_DEF_SIZE
;
361 mtc
->max_bw
.value
= htonf(fp
);
365 static void set_circuitparams_max_rsv_bw(struct mpls_te_circuit
*mtc
, float fp
)
367 SUBTLV_TYPE(mtc
->max_rsv_bw
) = TE_SUBTLV_MAX_RSV_BW
;
368 SUBTLV_LEN(mtc
->max_rsv_bw
) = SUBTLV_DEF_SIZE
;
369 mtc
->max_rsv_bw
.value
= htonf(fp
);
373 static void set_circuitparams_unrsv_bw(struct mpls_te_circuit
*mtc
,
374 int priority
, float fp
)
376 /* Note that TLV-length field is the size of array. */
377 SUBTLV_TYPE(mtc
->unrsv_bw
) = TE_SUBTLV_UNRSV_BW
;
378 SUBTLV_LEN(mtc
->unrsv_bw
) = TE_SUBTLV_UNRSV_SIZE
;
379 mtc
->unrsv_bw
.value
[priority
] = htonf(fp
);
383 static void set_circuitparams_te_metric(struct mpls_te_circuit
*mtc
,
386 SUBTLV_TYPE(mtc
->te_metric
) = TE_SUBTLV_TE_METRIC
;
387 SUBTLV_LEN(mtc
->te_metric
) = TE_SUBTLV_TE_METRIC_SIZE
;
388 mtc
->te_metric
.value
[0] = (te_metric
>> 16) & 0xFF;
389 mtc
->te_metric
.value
[1] = (te_metric
>> 8) & 0xFF;
390 mtc
->te_metric
.value
[2] = te_metric
& 0xFF;
394 static void set_circuitparams_inter_as(struct mpls_te_circuit
*mtc
,
395 struct in_addr addr
, uint32_t as
)
398 /* Set the Remote ASBR IP address and then the associated AS number */
399 SUBTLV_TYPE(mtc
->rip
) = TE_SUBTLV_RIP
;
400 SUBTLV_LEN(mtc
->rip
) = SUBTLV_DEF_SIZE
;
401 mtc
->rip
.value
.s_addr
= addr
.s_addr
;
403 SUBTLV_TYPE(mtc
->ras
) = TE_SUBTLV_RAS
;
404 SUBTLV_LEN(mtc
->ras
) = SUBTLV_DEF_SIZE
;
405 mtc
->ras
.value
= htonl(as
);
408 static void unset_circuitparams_inter_as(struct mpls_te_circuit
*mtc
)
411 /* Reset the Remote ASBR IP address and then the associated AS number */
412 SUBTLV_TYPE(mtc
->rip
) = 0;
413 SUBTLV_LEN(mtc
->rip
) = 0;
414 mtc
->rip
.value
.s_addr
= 0;
416 SUBTLV_TYPE(mtc
->ras
) = 0;
417 SUBTLV_LEN(mtc
->ras
) = 0;
421 static void set_circuitparams_av_delay(struct mpls_te_circuit
*mtc
,
422 uint32_t delay
, uint8_t anormal
)
425 /* Note that TLV-length field is the size of array. */
426 SUBTLV_TYPE(mtc
->av_delay
) = TE_SUBTLV_AV_DELAY
;
427 SUBTLV_LEN(mtc
->av_delay
) = SUBTLV_DEF_SIZE
;
428 tmp
= delay
& TE_EXT_MASK
;
430 tmp
|= TE_EXT_ANORMAL
;
431 mtc
->av_delay
.value
= htonl(tmp
);
435 static void set_circuitparams_mm_delay(struct mpls_te_circuit
*mtc
,
436 uint32_t low
, uint32_t high
,
440 /* Note that TLV-length field is the size of array. */
441 SUBTLV_TYPE(mtc
->mm_delay
) = TE_SUBTLV_MM_DELAY
;
442 SUBTLV_LEN(mtc
->mm_delay
) = TE_SUBTLV_MM_DELAY_SIZE
;
443 tmp
= low
& TE_EXT_MASK
;
445 tmp
|= TE_EXT_ANORMAL
;
446 mtc
->mm_delay
.low
= htonl(tmp
);
447 mtc
->mm_delay
.high
= htonl(high
);
451 static void set_circuitparams_delay_var(struct mpls_te_circuit
*mtc
,
454 /* Note that TLV-length field is the size of array. */
455 SUBTLV_TYPE(mtc
->delay_var
) = TE_SUBTLV_DELAY_VAR
;
456 SUBTLV_LEN(mtc
->delay_var
) = SUBTLV_DEF_SIZE
;
457 mtc
->delay_var
.value
= htonl(jitter
& TE_EXT_MASK
);
461 static void set_circuitparams_pkt_loss(struct mpls_te_circuit
*mtc
,
462 uint32_t loss
, uint8_t anormal
)
465 /* Note that TLV-length field is the size of array. */
466 SUBTLV_TYPE(mtc
->pkt_loss
) = TE_SUBTLV_PKT_LOSS
;
467 SUBTLV_LEN(mtc
->pkt_loss
) = SUBTLV_DEF_SIZE
;
468 tmp
= loss
& TE_EXT_MASK
;
470 tmp
|= TE_EXT_ANORMAL
;
471 mtc
->pkt_loss
.value
= htonl(tmp
);
475 static void set_circuitparams_res_bw(struct mpls_te_circuit
*mtc
, float fp
)
477 /* Note that TLV-length field is the size of array. */
478 SUBTLV_TYPE(mtc
->res_bw
) = TE_SUBTLV_RES_BW
;
479 SUBTLV_LEN(mtc
->res_bw
) = SUBTLV_DEF_SIZE
;
480 mtc
->res_bw
.value
= htonf(fp
);
484 static void set_circuitparams_ava_bw(struct mpls_te_circuit
*mtc
, float fp
)
486 /* Note that TLV-length field is the size of array. */
487 SUBTLV_TYPE(mtc
->ava_bw
) = TE_SUBTLV_AVA_BW
;
488 SUBTLV_LEN(mtc
->ava_bw
) = SUBTLV_DEF_SIZE
;
489 mtc
->ava_bw
.value
= htonf(fp
);
493 static void set_circuitparams_use_bw(struct mpls_te_circuit
*mtc
, float fp
)
495 /* Note that TLV-length field is the size of array. */
496 SUBTLV_TYPE(mtc
->use_bw
) = TE_SUBTLV_USE_BW
;
497 SUBTLV_LEN(mtc
->use_bw
) = SUBTLV_DEF_SIZE
;
498 mtc
->use_bw
.value
= htonf(fp
);
502 /* Main initialization / update function of the MPLS TE Circuit context */
503 /* Call when interface TE Link parameters are modified */
504 void isis_link_params_update(struct isis_circuit
*circuit
,
505 struct interface
*ifp
)
508 struct prefix_ipv4
*addr
;
509 struct mpls_te_circuit
*mtc
;
512 if ((circuit
== NULL
) || (ifp
== NULL
))
515 zlog_info("MPLS-TE: Initialize circuit parameters for interface %s",
518 /* Check if MPLS TE Circuit context has not been already created */
519 if (circuit
->mtc
== NULL
)
520 circuit
->mtc
= mpls_te_circuit_new();
524 /* Fulfil MTC TLV from ifp TE Link parameters */
525 if (HAS_LINK_PARAMS(ifp
)) {
526 mtc
->status
= enable
;
528 if (IS_PARAM_SET(ifp
->link_params
, LP_ADM_GRP
))
529 set_circuitparams_admin_grp(
530 mtc
, ifp
->link_params
->admin_grp
);
532 SUBTLV_TYPE(mtc
->admin_grp
) = 0;
534 /* If not already set, register local IP addr from ip_addr list
536 if (SUBTLV_TYPE(mtc
->local_ipaddr
) == 0) {
537 if (circuit
->ip_addrs
!= NULL
538 && listcount(circuit
->ip_addrs
) != 0) {
539 addr
= (struct prefix_ipv4
*)listgetdata(
540 (struct listnode
*)listhead(
542 set_circuitparams_local_ipaddr(mtc
,
547 /* If not already set, try to determine Remote IP addr if
549 if ((SUBTLV_TYPE(mtc
->rmt_ipaddr
) == 0)
550 && (circuit
->circ_type
== CIRCUIT_T_P2P
)) {
551 struct isis_adjacency
*adj
= circuit
->u
.p2p
.neighbor
;
552 if (adj
&& adj
->adj_state
== ISIS_ADJ_UP
553 && adj
->ipv4_address_count
) {
554 set_circuitparams_rmt_ipaddr(
555 mtc
, adj
->ipv4_addresses
[0]);
559 if (IS_PARAM_SET(ifp
->link_params
, LP_MAX_BW
))
560 set_circuitparams_max_bw(mtc
, ifp
->link_params
->max_bw
);
562 SUBTLV_TYPE(mtc
->max_bw
) = 0;
564 if (IS_PARAM_SET(ifp
->link_params
, LP_MAX_RSV_BW
))
565 set_circuitparams_max_rsv_bw(
566 mtc
, ifp
->link_params
->max_rsv_bw
);
568 SUBTLV_TYPE(mtc
->max_rsv_bw
) = 0;
570 if (IS_PARAM_SET(ifp
->link_params
, LP_UNRSV_BW
))
571 for (i
= 0; i
< MAX_CLASS_TYPE
; i
++)
572 set_circuitparams_unrsv_bw(
573 mtc
, i
, ifp
->link_params
->unrsv_bw
[i
]);
575 SUBTLV_TYPE(mtc
->unrsv_bw
) = 0;
577 if (IS_PARAM_SET(ifp
->link_params
, LP_TE_METRIC
))
578 set_circuitparams_te_metric(
579 mtc
, ifp
->link_params
->te_metric
);
581 SUBTLV_TYPE(mtc
->te_metric
) = 0;
583 /* TE metric Extensions */
584 if (IS_PARAM_SET(ifp
->link_params
, LP_DELAY
))
585 set_circuitparams_av_delay(
586 mtc
, ifp
->link_params
->av_delay
, 0);
588 SUBTLV_TYPE(mtc
->av_delay
) = 0;
590 if (IS_PARAM_SET(ifp
->link_params
, LP_MM_DELAY
))
591 set_circuitparams_mm_delay(
592 mtc
, ifp
->link_params
->min_delay
,
593 ifp
->link_params
->max_delay
, 0);
595 SUBTLV_TYPE(mtc
->mm_delay
) = 0;
597 if (IS_PARAM_SET(ifp
->link_params
, LP_DELAY_VAR
))
598 set_circuitparams_delay_var(
599 mtc
, ifp
->link_params
->delay_var
);
601 SUBTLV_TYPE(mtc
->delay_var
) = 0;
603 if (IS_PARAM_SET(ifp
->link_params
, LP_PKT_LOSS
))
604 set_circuitparams_pkt_loss(
605 mtc
, ifp
->link_params
->pkt_loss
, 0);
607 SUBTLV_TYPE(mtc
->pkt_loss
) = 0;
609 if (IS_PARAM_SET(ifp
->link_params
, LP_RES_BW
))
610 set_circuitparams_res_bw(mtc
, ifp
->link_params
->res_bw
);
612 SUBTLV_TYPE(mtc
->res_bw
) = 0;
614 if (IS_PARAM_SET(ifp
->link_params
, LP_AVA_BW
))
615 set_circuitparams_ava_bw(mtc
, ifp
->link_params
->ava_bw
);
617 SUBTLV_TYPE(mtc
->ava_bw
) = 0;
619 if (IS_PARAM_SET(ifp
->link_params
, LP_USE_BW
))
620 set_circuitparams_use_bw(mtc
, ifp
->link_params
->use_bw
);
622 SUBTLV_TYPE(mtc
->use_bw
) = 0;
625 if (IS_PARAM_SET(ifp
->link_params
, LP_RMT_AS
))
626 set_circuitparams_inter_as(mtc
,
627 ifp
->link_params
->rmt_ip
,
628 ifp
->link_params
->rmt_as
);
630 /* reset inter-as TE params */
631 unset_circuitparams_inter_as(mtc
);
633 /* Compute total length of SUB TLVs */
634 mtc
->length
= subtlvs_len(mtc
);
637 mtc
->status
= disable
;
639 /* Finally Update LSP */
641 if (IS_MPLS_TE(isisMplsTE
) && circuit
->area
)
642 lsp_regenerate_schedule (circuit
->area
, circuit
->is_type
, 0);
647 void isis_mpls_te_update(struct interface
*ifp
)
649 struct isis_circuit
*circuit
;
655 /* Get circuit context from interface */
656 if ((circuit
= circuit_scan_by_ifp(ifp
)) == NULL
)
659 /* Update TE TLVs ... */
660 isis_link_params_update(circuit
, ifp
);
663 if (IS_MPLS_TE(isisMplsTE
) && circuit
->area
)
664 lsp_regenerate_schedule(circuit
->area
, circuit
->is_type
, 0);
669 /*------------------------------------------------------------------------*
670 * Followings are vty session control functions.
671 *------------------------------------------------------------------------*/
673 static uint8_t print_subtlv_admin_grp(struct sbuf
*buf
, int indent
,
674 struct te_subtlv_admin_grp
*tlv
)
676 sbuf_push(buf
, indent
, "Administrative Group: 0x%" PRIx32
"\n",
678 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
681 static uint8_t print_subtlv_llri(struct sbuf
*buf
, int indent
,
682 struct te_subtlv_llri
*tlv
)
684 sbuf_push(buf
, indent
, "Link Local ID: %" PRIu32
"\n",
686 sbuf_push(buf
, indent
, "Link Remote ID: %" PRIu32
"\n",
689 return (SUBTLV_HDR_SIZE
+ TE_SUBTLV_LLRI_SIZE
);
692 static uint8_t print_subtlv_local_ipaddr(struct sbuf
*buf
, int indent
,
693 struct te_subtlv_local_ipaddr
*tlv
)
695 sbuf_push(buf
, indent
, "Local Interface IP Address(es): %s\n",
696 inet_ntoa(tlv
->value
));
698 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
701 static uint8_t print_subtlv_rmt_ipaddr(struct sbuf
*buf
, int indent
,
702 struct te_subtlv_rmt_ipaddr
*tlv
)
704 sbuf_push(buf
, indent
, "Remote Interface IP Address(es): %s\n",
705 inet_ntoa(tlv
->value
));
707 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
710 static uint8_t print_subtlv_max_bw(struct sbuf
*buf
, int indent
,
711 struct te_subtlv_max_bw
*tlv
)
715 fval
= ntohf(tlv
->value
);
717 sbuf_push(buf
, indent
, "Maximum Bandwidth: %g (Bytes/sec)\n", fval
);
719 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
722 static uint8_t print_subtlv_max_rsv_bw(struct sbuf
*buf
, int indent
,
723 struct te_subtlv_max_rsv_bw
*tlv
)
727 fval
= ntohf(tlv
->value
);
729 sbuf_push(buf
, indent
, "Maximum Reservable Bandwidth: %g (Bytes/sec)\n",
732 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
735 static uint8_t print_subtlv_unrsv_bw(struct sbuf
*buf
, int indent
,
736 struct te_subtlv_unrsv_bw
*tlv
)
741 sbuf_push(buf
, indent
, "Unreserved Bandwidth:\n");
743 for (i
= 0; i
< MAX_CLASS_TYPE
; i
+= 2) {
744 fval1
= ntohf(tlv
->value
[i
]);
745 fval2
= ntohf(tlv
->value
[i
+ 1]);
746 sbuf_push(buf
, indent
+ 2,
747 "[%d]: %g (Bytes/sec),\t[%d]: %g (Bytes/sec)\n", i
,
748 fval1
, i
+ 1, fval2
);
751 return (SUBTLV_HDR_SIZE
+ TE_SUBTLV_UNRSV_SIZE
);
754 static uint8_t print_subtlv_te_metric(struct sbuf
*buf
, int indent
,
755 struct te_subtlv_te_metric
*tlv
)
759 te_metric
= tlv
->value
[2] | tlv
->value
[1] << 8 | tlv
->value
[0] << 16;
760 sbuf_push(buf
, indent
, "Traffic Engineering Metric: %u\n", te_metric
);
762 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
765 static uint8_t print_subtlv_ras(struct sbuf
*buf
, int indent
,
766 struct te_subtlv_ras
*tlv
)
768 sbuf_push(buf
, indent
, "Inter-AS TE Remote AS number: %" PRIu32
"\n",
771 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
774 static uint8_t print_subtlv_rip(struct sbuf
*buf
, int indent
,
775 struct te_subtlv_rip
*tlv
)
777 sbuf_push(buf
, indent
, "Inter-AS TE Remote ASBR IP address: %s\n",
778 inet_ntoa(tlv
->value
));
780 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
783 static uint8_t print_subtlv_av_delay(struct sbuf
*buf
, int indent
,
784 struct te_subtlv_av_delay
*tlv
)
789 delay
= (uint32_t)ntohl(tlv
->value
) & TE_EXT_MASK
;
790 A
= (uint32_t)ntohl(tlv
->value
) & TE_EXT_ANORMAL
;
792 sbuf_push(buf
, indent
,
793 "%s Average Link Delay: %" PRIu32
" (micro-sec)\n",
794 A
? "Anomalous" : "Normal", delay
);
796 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
799 static uint8_t print_subtlv_mm_delay(struct sbuf
*buf
, int indent
,
800 struct te_subtlv_mm_delay
*tlv
)
805 low
= (uint32_t)ntohl(tlv
->low
) & TE_EXT_MASK
;
806 A
= (uint32_t)ntohl(tlv
->low
) & TE_EXT_ANORMAL
;
807 high
= (uint32_t)ntohl(tlv
->high
) & TE_EXT_MASK
;
809 sbuf_push(buf
, indent
, "%s Min/Max Link Delay: %" PRIu32
" / %" PRIu32
" (micro-sec)\n",
810 A
? "Anomalous" : "Normal", low
, high
);
812 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
815 static uint8_t print_subtlv_delay_var(struct sbuf
*buf
, int indent
,
816 struct te_subtlv_delay_var
*tlv
)
820 jitter
= (uint32_t)ntohl(tlv
->value
) & TE_EXT_MASK
;
822 sbuf_push(buf
, indent
, "Delay Variation: %" PRIu32
" (micro-sec)\n",
825 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
828 static uint8_t print_subtlv_pkt_loss(struct sbuf
*buf
, int indent
,
829 struct te_subtlv_pkt_loss
*tlv
)
835 loss
= (uint32_t)ntohl(tlv
->value
) & TE_EXT_MASK
;
836 fval
= (float)(loss
* LOSS_PRECISION
);
837 A
= (uint32_t)ntohl(tlv
->value
) & TE_EXT_ANORMAL
;
839 sbuf_push(buf
, indent
, "%s Link Packet Loss: %g (%%)\n",
840 A
? "Anomalous" : "Normal", fval
);
842 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
845 static uint8_t print_subtlv_res_bw(struct sbuf
*buf
, int indent
,
846 struct te_subtlv_res_bw
*tlv
)
850 fval
= ntohf(tlv
->value
);
852 sbuf_push(buf
, indent
,
853 "Unidirectional Residual Bandwidth: %g (Bytes/sec)\n", fval
);
855 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
858 static uint8_t print_subtlv_ava_bw(struct sbuf
*buf
, int indent
,
859 struct te_subtlv_ava_bw
*tlv
)
863 fval
= ntohf(tlv
->value
);
865 sbuf_push(buf
, indent
,
866 "Unidirectional Available Bandwidth: %g (Bytes/sec)\n", fval
);
868 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
871 static uint8_t print_subtlv_use_bw(struct sbuf
*buf
, int indent
,
872 struct te_subtlv_use_bw
*tlv
)
876 fval
= ntohf(tlv
->value
);
878 sbuf_push(buf
, indent
,
879 "Unidirectional Utilized Bandwidth: %g (Bytes/sec)\n", fval
);
881 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
884 static uint8_t print_unknown_tlv(struct sbuf
*buf
, int indent
,
885 struct subtlv_header
*tlvh
)
888 uint8_t *v
= (uint8_t *)tlvh
;
890 if (tlvh
->length
!= 0) {
891 sbuf_push(buf
, indent
,
892 "Unknown TLV: [type(%#.2x), length(%#.2x)]\n",
893 tlvh
->type
, tlvh
->length
);
894 sbuf_push(buf
, indent
+ 2, "Dump: [00]");
895 rtn
= 1; /* initialize end of line counter */
896 for (i
= 0; i
< tlvh
->length
; i
++) {
897 sbuf_push(buf
, 0, " %#.2x", v
[i
]);
899 sbuf_push(buf
, 0, "\n");
900 sbuf_push(buf
, indent
+ 8, "[%.2x]", i
+ 1);
905 sbuf_push(buf
, 0, "\n");
907 sbuf_push(buf
, indent
,
908 "Unknown TLV: [type(%#.2x), length(%#.2x)]\n",
909 tlvh
->type
, tlvh
->length
);
912 return SUBTLV_SIZE(tlvh
);
915 /* Main Show function */
916 void mpls_te_print_detail(struct sbuf
*buf
, int indent
,
917 uint8_t *subtlvs
, uint8_t subtlv_len
)
919 struct subtlv_header
*tlvh
= (struct subtlv_header
*)subtlvs
;
922 for (; sum
< subtlv_len
;
923 tlvh
= (struct subtlv_header
*)(subtlvs
+ sum
)) {
924 if (subtlv_len
- sum
< SUBTLV_SIZE(tlvh
)) {
925 sbuf_push(buf
, indent
, "Available data %" PRIu8
" is less than TLV size %u!\n",
926 subtlv_len
- sum
, SUBTLV_SIZE(tlvh
));
930 switch (tlvh
->type
) {
931 case TE_SUBTLV_ADMIN_GRP
:
932 if (tlvh
->length
!= SUBTLV_DEF_SIZE
) {
933 sbuf_push(buf
, indent
, "TLV size does not match expected size for Administrative Group!\n");
936 sum
+= print_subtlv_admin_grp(buf
, indent
,
937 (struct te_subtlv_admin_grp
*)tlvh
);
940 if (tlvh
->length
!= TE_SUBTLV_LLRI_SIZE
) {
941 sbuf_push(buf
, indent
, "TLV size does not match expected size for Link ID!\n");
944 sum
+= print_subtlv_llri(buf
, indent
,
945 (struct te_subtlv_llri
*)tlvh
);
947 case TE_SUBTLV_LOCAL_IPADDR
:
948 if (tlvh
->length
!= SUBTLV_DEF_SIZE
) {
949 sbuf_push(buf
, indent
, "TLV size does not match expected size for Local IP address!\n");
952 sum
+= print_subtlv_local_ipaddr(buf
, indent
,
953 (struct te_subtlv_local_ipaddr
*)tlvh
);
955 case TE_SUBTLV_RMT_IPADDR
:
956 if (tlvh
->length
!= SUBTLV_DEF_SIZE
) {
957 sbuf_push(buf
, indent
, "TLV size does not match expected size for Remote Interface address!\n");
960 sum
+= print_subtlv_rmt_ipaddr(buf
, indent
,
961 (struct te_subtlv_rmt_ipaddr
*)tlvh
);
963 case TE_SUBTLV_MAX_BW
:
964 if (tlvh
->length
!= SUBTLV_DEF_SIZE
) {
965 sbuf_push(buf
, indent
, "TLV size does not match expected size for Maximum Bandwidth!\n");
968 sum
+= print_subtlv_max_bw(buf
, indent
,
969 (struct te_subtlv_max_bw
*)tlvh
);
971 case TE_SUBTLV_MAX_RSV_BW
:
972 if (tlvh
->length
!= SUBTLV_DEF_SIZE
) {
973 sbuf_push(buf
, indent
, "TLV size does not match expected size for Maximum Reservable Bandwidth!\n");
976 sum
+= print_subtlv_max_rsv_bw(buf
, indent
,
977 (struct te_subtlv_max_rsv_bw
*)tlvh
);
979 case TE_SUBTLV_UNRSV_BW
:
980 if (tlvh
->length
!= TE_SUBTLV_UNRSV_SIZE
) {
981 sbuf_push(buf
, indent
, "TLV size does not match expected size for Unreserved Bandwidth!\n");
984 sum
+= print_subtlv_unrsv_bw(buf
, indent
,
985 (struct te_subtlv_unrsv_bw
*)tlvh
);
987 case TE_SUBTLV_TE_METRIC
:
988 if (tlvh
->length
!= SUBTLV_DEF_SIZE
) {
989 sbuf_push(buf
, indent
, "TLV size does not match expected size for Traffic Engineering Metric!\n");
992 sum
+= print_subtlv_te_metric(buf
, indent
,
993 (struct te_subtlv_te_metric
*)tlvh
);
996 if (tlvh
->length
!= SUBTLV_DEF_SIZE
) {
997 sbuf_push(buf
, indent
, "TLV size does not match expected size for Remote AS number!\n");
1000 sum
+= print_subtlv_ras(buf
, indent
,
1001 (struct te_subtlv_ras
*)tlvh
);
1004 if (tlvh
->length
!= SUBTLV_DEF_SIZE
) {
1005 sbuf_push(buf
, indent
, "TLV size does not match expected size for Remote ASBR IP Address!\n");
1008 sum
+= print_subtlv_rip(buf
, indent
,
1009 (struct te_subtlv_rip
*)tlvh
);
1011 case TE_SUBTLV_AV_DELAY
:
1012 if (tlvh
->length
!= SUBTLV_DEF_SIZE
) {
1013 sbuf_push(buf
, indent
, "TLV size does not match expected size for Average Link Delay!\n");
1016 sum
+= print_subtlv_av_delay(buf
, indent
,
1017 (struct te_subtlv_av_delay
*)tlvh
);
1019 case TE_SUBTLV_MM_DELAY
:
1020 if (tlvh
->length
!= SUBTLV_DEF_SIZE
) {
1021 sbuf_push(buf
, indent
, "TLV size does not match expected size for Min/Max Link Delay!\n");
1024 sum
+= print_subtlv_mm_delay(buf
, indent
,
1025 (struct te_subtlv_mm_delay
*)tlvh
);
1027 case TE_SUBTLV_DELAY_VAR
:
1028 if (tlvh
->length
!= SUBTLV_DEF_SIZE
) {
1029 sbuf_push(buf
, indent
, "TLV size does not match expected size for Delay Variation!\n");
1032 sum
+= print_subtlv_delay_var(buf
, indent
,
1033 (struct te_subtlv_delay_var
*)tlvh
);
1035 case TE_SUBTLV_PKT_LOSS
:
1036 if (tlvh
->length
!= SUBTLV_DEF_SIZE
) {
1037 sbuf_push(buf
, indent
, "TLV size does not match expected size for Link Packet Loss!\n");
1040 sum
+= print_subtlv_pkt_loss(buf
, indent
,
1041 (struct te_subtlv_pkt_loss
*)tlvh
);
1043 case TE_SUBTLV_RES_BW
:
1044 if (tlvh
->length
!= SUBTLV_DEF_SIZE
) {
1045 sbuf_push(buf
, indent
, "TLV size does not match expected size for Unidirectional Residual Bandwidth!\n");
1048 sum
+= print_subtlv_res_bw(buf
, indent
,
1049 (struct te_subtlv_res_bw
*)tlvh
);
1051 case TE_SUBTLV_AVA_BW
:
1052 if (tlvh
->length
!= SUBTLV_DEF_SIZE
) {
1053 sbuf_push(buf
, indent
, "TLV size does not match expected size for Unidirectional Available Bandwidth!\n");
1056 sum
+= print_subtlv_ava_bw(buf
, indent
,
1057 (struct te_subtlv_ava_bw
*)tlvh
);
1059 case TE_SUBTLV_USE_BW
:
1060 if (tlvh
->length
!= SUBTLV_DEF_SIZE
) {
1061 sbuf_push(buf
, indent
, "TLV size does not match expected size for Unidirectional Utilized Bandwidth!\n");
1064 sum
+= print_subtlv_use_bw(buf
, indent
,
1065 (struct te_subtlv_use_bw
*)tlvh
);
1068 sum
+= print_unknown_tlv(buf
, indent
, tlvh
);
1075 /* Specific MPLS TE router parameters write function */
1076 void isis_mpls_te_config_write_router(struct vty
*vty
)
1078 if (IS_MPLS_TE(isisMplsTE
)) {
1079 vty_out(vty
, " mpls-te on\n");
1080 vty_out(vty
, " mpls-te router-address %s\n",
1081 inet_ntoa(isisMplsTE
.router_id
));
1088 /*------------------------------------------------------------------------*
1089 * Followings are vty command functions.
1090 *------------------------------------------------------------------------*/
1092 DEFUN (isis_mpls_te_on
,
1093 isis_mpls_te_on_cmd
,
1096 "Enable MPLS-TE functionality\n")
1098 struct listnode
*node
;
1099 struct isis_circuit
*circuit
;
1101 if (IS_MPLS_TE(isisMplsTE
))
1104 if (IS_DEBUG_ISIS(DEBUG_TE
))
1105 zlog_debug("ISIS MPLS-TE: OFF -> ON");
1107 isisMplsTE
.status
= enable
;
1110 * Following code is intended to handle two cases;
1112 * 1) MPLS-TE was disabled at startup time, but now become enabled.
1113 * In this case, we must enable MPLS-TE Circuit regarding interface
1115 * 2) MPLS-TE was once enabled then disabled, and now enabled again.
1117 for (ALL_LIST_ELEMENTS_RO(isisMplsTE
.cir_list
, node
, circuit
)) {
1118 if (circuit
->mtc
== NULL
|| IS_FLOOD_AS(circuit
->mtc
->type
))
1121 if ((circuit
->mtc
->status
== disable
)
1122 && HAS_LINK_PARAMS(circuit
->interface
))
1123 circuit
->mtc
->status
= enable
;
1127 /* Reoriginate STD_TE & GMPLS circuits */
1129 lsp_regenerate_schedule(circuit
->area
, circuit
->is_type
,
1136 DEFUN (no_isis_mpls_te_on
,
1137 no_isis_mpls_te_on_cmd
,
1140 "Disable the MPLS-TE functionality\n")
1142 struct listnode
*node
;
1143 struct isis_circuit
*circuit
;
1145 if (isisMplsTE
.status
== disable
)
1148 if (IS_DEBUG_ISIS(DEBUG_TE
))
1149 zlog_debug("ISIS MPLS-TE: ON -> OFF");
1151 isisMplsTE
.status
= disable
;
1153 /* Flush LSP if circuit engage */
1154 for (ALL_LIST_ELEMENTS_RO(isisMplsTE
.cir_list
, node
, circuit
)) {
1155 if (circuit
->mtc
== NULL
|| (circuit
->mtc
->status
== disable
))
1158 /* disable MPLS_TE Circuit */
1159 circuit
->mtc
->status
= disable
;
1161 /* Re-originate circuit without STD_TE & GMPLS parameters */
1163 lsp_regenerate_schedule(circuit
->area
, circuit
->is_type
,
1170 DEFUN (isis_mpls_te_router_addr
,
1171 isis_mpls_te_router_addr_cmd
,
1172 "mpls-te router-address A.B.C.D",
1174 "Stable IP address of the advertising router\n"
1175 "MPLS-TE router address in IPv4 address format\n")
1178 struct in_addr value
;
1179 struct listnode
*node
;
1180 struct isis_area
*area
;
1182 if (!inet_aton(argv
[idx_ipv4
]->arg
, &value
)) {
1183 vty_out(vty
, "Please specify Router-Addr by A.B.C.D\n");
1184 return CMD_WARNING_CONFIG_FAILED
;
1187 isisMplsTE
.router_id
.s_addr
= value
.s_addr
;
1189 if (isisMplsTE
.status
== disable
)
1192 /* Update main Router ID in isis global structure */
1193 isis
->router_id
= value
.s_addr
;
1194 /* And re-schedule LSP update */
1195 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
))
1196 if (listcount(area
->area_addrs
) > 0)
1197 lsp_regenerate_schedule(area
, area
->is_type
, 0);
1202 DEFUN (isis_mpls_te_inter_as
,
1203 isis_mpls_te_inter_as_cmd
,
1204 "mpls-te inter-as <level-1|level-1-2|level-2-only>",
1206 "Configure MPLS-TE Inter-AS support\n"
1207 "AREA native mode self originate INTER-AS LSP with L1 only flooding scope)\n"
1208 "AREA native mode self originate INTER-AS LSP with L1 and L2 flooding scope)\n"
1209 "AS native mode self originate INTER-AS LSP with L2 only flooding scope\n")
1211 vty_out(vty
, "Not yet supported\n");
1215 DEFUN (no_isis_mpls_te_inter_as
,
1216 no_isis_mpls_te_inter_as_cmd
,
1217 "no mpls-te inter-as",
1219 "Disable the MPLS-TE functionality\n"
1220 "Disable MPLS-TE Inter-AS support\n")
1223 vty_out(vty
, "Not yet supported\n");
1227 DEFUN (show_isis_mpls_te_router
,
1228 show_isis_mpls_te_router_cmd
,
1229 "show isis mpls-te router",
1233 "Router information\n")
1235 if (IS_MPLS_TE(isisMplsTE
)) {
1236 vty_out(vty
, "--- MPLS-TE router parameters ---\n");
1238 if (ntohs(isisMplsTE
.router_id
.s_addr
) != 0)
1239 vty_out(vty
, " Router-Address: %s\n",
1240 inet_ntoa(isisMplsTE
.router_id
));
1242 vty_out(vty
, " N/A\n");
1244 vty_out(vty
, " MPLS-TE is disable on this router\n");
1249 static void show_mpls_te_sub(struct vty
*vty
, struct interface
*ifp
)
1251 struct mpls_te_circuit
*mtc
;
1254 sbuf_init(&buf
, NULL
, 0);
1256 if ((IS_MPLS_TE(isisMplsTE
))
1257 && ((mtc
= lookup_mpls_params_by_ifp(ifp
)) != NULL
)) {
1258 /* Continue only if interface is not passive or support Inter-AS
1260 if (mtc
->status
!= enable
) {
1261 if (IS_INTER_AS(mtc
->type
)) {
1263 "-- Inter-AS TEv2 link parameters for %s --\n",
1266 /* MPLS-TE is not activate on this interface */
1267 /* or this interface is passive and Inter-AS
1268 * TEv2 is not activate */
1270 " %s: MPLS-TE is disabled on this interface\n",
1275 vty_out(vty
, "-- MPLS-TE link parameters for %s --\n",
1280 print_subtlv_admin_grp(&buf
, 4, &mtc
->admin_grp
);
1282 if (SUBTLV_TYPE(mtc
->local_ipaddr
) != 0)
1283 print_subtlv_local_ipaddr(&buf
, 4, &mtc
->local_ipaddr
);
1284 if (SUBTLV_TYPE(mtc
->rmt_ipaddr
) != 0)
1285 print_subtlv_rmt_ipaddr(&buf
, 4, &mtc
->rmt_ipaddr
);
1287 print_subtlv_max_bw(&buf
, 4, &mtc
->max_bw
);
1288 print_subtlv_max_rsv_bw(&buf
, 4, &mtc
->max_rsv_bw
);
1289 print_subtlv_unrsv_bw(&buf
, 4, &mtc
->unrsv_bw
);
1290 print_subtlv_te_metric(&buf
, 4, &mtc
->te_metric
);
1292 if (IS_INTER_AS(mtc
->type
)) {
1293 if (SUBTLV_TYPE(mtc
->ras
) != 0)
1294 print_subtlv_ras(&buf
, 4, &mtc
->ras
);
1295 if (SUBTLV_TYPE(mtc
->rip
) != 0)
1296 print_subtlv_rip(&buf
, 4, &mtc
->rip
);
1299 print_subtlv_av_delay(&buf
, 4, &mtc
->av_delay
);
1300 print_subtlv_mm_delay(&buf
, 4, &mtc
->mm_delay
);
1301 print_subtlv_delay_var(&buf
, 4, &mtc
->delay_var
);
1302 print_subtlv_pkt_loss(&buf
, 4, &mtc
->pkt_loss
);
1303 print_subtlv_res_bw(&buf
, 4, &mtc
->res_bw
);
1304 print_subtlv_ava_bw(&buf
, 4, &mtc
->ava_bw
);
1305 print_subtlv_use_bw(&buf
, 4, &mtc
->use_bw
);
1307 vty_multiline(vty
, "", "%s", sbuf_buf(&buf
));
1308 vty_out(vty
, "---------------\n\n");
1310 vty_out(vty
, " %s: MPLS-TE is disabled on this interface\n",
1318 DEFUN (show_isis_mpls_te_interface
,
1319 show_isis_mpls_te_interface_cmd
,
1320 "show isis mpls-te interface [INTERFACE]",
1324 "Interface information\n"
1327 struct vrf
*vrf
= vrf_lookup_by_id(VRF_DEFAULT
);
1328 int idx_interface
= 4;
1329 struct interface
*ifp
;
1331 /* Show All Interfaces. */
1333 FOR_ALL_INTERFACES (vrf
, ifp
)
1334 show_mpls_te_sub(vty
, ifp
);
1336 /* Interface name is specified. */
1338 if ((ifp
= if_lookup_by_name(argv
[idx_interface
]->arg
,
1341 vty_out(vty
, "No such interface name\n");
1343 show_mpls_te_sub(vty
, ifp
);
1349 /* Initialize MPLS_TE */
1350 void isis_mpls_te_init(void)
1353 zlog_debug("ISIS MPLS-TE: Initialize");
1355 /* Initialize MPLS_TE structure */
1356 isisMplsTE
.status
= disable
;
1357 isisMplsTE
.level
= 0;
1358 isisMplsTE
.inter_as
= off
;
1359 isisMplsTE
.interas_areaid
.s_addr
= 0;
1360 isisMplsTE
.cir_list
= list_new();
1361 isisMplsTE
.router_id
.s_addr
= 0;
1363 /* Register new VTY commands */
1364 install_element(VIEW_NODE
, &show_isis_mpls_te_router_cmd
);
1365 install_element(VIEW_NODE
, &show_isis_mpls_te_interface_cmd
);
1367 install_element(ISIS_NODE
, &isis_mpls_te_on_cmd
);
1368 install_element(ISIS_NODE
, &no_isis_mpls_te_on_cmd
);
1369 install_element(ISIS_NODE
, &isis_mpls_te_router_addr_cmd
);
1370 install_element(ISIS_NODE
, &isis_mpls_te_inter_as_cmd
);
1371 install_element(ISIS_NODE
, &no_isis_mpls_te_inter_as_cmd
);