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
22 * along with GNU Zebra; see the file COPYING. If not, write to the Free
23 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
43 #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_tlv.h"
53 #include "isisd/isis_lsp.h"
54 #include "isisd/isis_pdu.h"
55 #include "isisd/isis_dynhn.h"
56 #include "isisd/isis_misc.h"
57 #include "isisd/isis_csm.h"
58 #include "isisd/isis_adjacency.h"
59 #include "isisd/isis_spf.h"
60 #include "isisd/isis_te.h"
62 /* Global varial for MPLS TE management */
63 struct isis_mpls_te isisMplsTE
;
65 const char *mode2text
[] = { "Disable", "Area", "AS", "Emulate" };
67 /*------------------------------------------------------------------------*
68 * Followings are control functions for MPLS-TE parameters management.
69 *------------------------------------------------------------------------*/
71 /* Search MPLS TE Circuit context from Interface */
72 static struct mpls_te_circuit
*
73 lookup_mpls_params_by_ifp (struct interface
*ifp
)
75 struct isis_circuit
*circuit
;
77 if ((circuit
= circuit_scan_by_ifp (ifp
)) == NULL
)
83 /* Create new MPLS TE Circuit context */
84 struct mpls_te_circuit
*
87 struct mpls_te_circuit
*mtc
;
89 zlog_debug ("ISIS MPLS-TE: Create new MPLS TE Circuit context");
91 mtc
= XCALLOC(MTYPE_ISIS_MPLS_TE
, sizeof (struct mpls_te_circuit
));
96 mtc
->status
= disable
;
104 /* Copy SUB TLVs parameters into a buffer - No space verification are performed */
105 /* Caller must verify before that there is enough free space in the buffer */
107 add_te_subtlvs(u_char
*buf
, struct mpls_te_circuit
*mtc
)
109 u_char size
, *tlvs
= buf
;
111 zlog_debug ("ISIS MPLS-TE: Add TE Sub TLVs to buffer");
115 zlog_debug("ISIS MPLS-TE: Abort! No MPLS TE Circuit available has been specified");
119 /* Create buffer if not provided */
122 zlog_debug("ISIS MPLS-TE: Abort! No Buffer has been specified");
126 /* TE_SUBTLV_ADMIN_GRP */
127 if (SUBTLV_TYPE(mtc
->admin_grp
) != 0)
129 size
= SUBTLV_SIZE (&(mtc
->admin_grp
.header
));
130 memcpy(tlvs
, &(mtc
->admin_grp
), size
);
135 if (SUBTLV_TYPE(mtc
->llri
) != 0)
137 size
= SUBTLV_SIZE (&(mtc
->llri
.header
));
138 memcpy(tlvs
, &(mtc
->llri
), size
);
142 /* TE_SUBTLV_LCLIF_IPADDR */
143 if (SUBTLV_TYPE(mtc
->local_ipaddr
) != 0)
145 size
= SUBTLV_SIZE (&(mtc
->local_ipaddr
.header
));
146 memcpy(tlvs
, &(mtc
->local_ipaddr
), size
);
150 /* TE_SUBTLV_RMTIF_IPADDR */
151 if (SUBTLV_TYPE(mtc
->rmt_ipaddr
) != 0)
153 size
= SUBTLV_SIZE (&(mtc
->rmt_ipaddr
.header
));
154 memcpy(tlvs
, &(mtc
->rmt_ipaddr
), size
);
158 /* TE_SUBTLV_MAX_BW */
159 if (SUBTLV_TYPE(mtc
->max_bw
) != 0)
161 size
= SUBTLV_SIZE (&(mtc
->max_bw
.header
));
162 memcpy(tlvs
, &(mtc
->max_bw
), size
);
166 /* TE_SUBTLV_MAX_RSV_BW */
167 if (SUBTLV_TYPE(mtc
->max_rsv_bw
) != 0)
169 size
= SUBTLV_SIZE (&(mtc
->max_rsv_bw
.header
));
170 memcpy(tlvs
, &(mtc
->max_rsv_bw
), size
);
174 /* TE_SUBTLV_UNRSV_BW */
175 if (SUBTLV_TYPE(mtc
->unrsv_bw
) != 0)
177 size
= SUBTLV_SIZE (&(mtc
->unrsv_bw
.header
));
178 memcpy(tlvs
, &(mtc
->unrsv_bw
), size
);
182 /* TE_SUBTLV_TE_METRIC */
183 if (SUBTLV_TYPE(mtc
->te_metric
) != 0)
185 size
= SUBTLV_SIZE (&(mtc
->te_metric
.header
));
186 memcpy(tlvs
, &(mtc
->te_metric
), size
);
190 /* TE_SUBTLV_AV_DELAY */
191 if (SUBTLV_TYPE(mtc
->av_delay
) != 0)
193 size
= SUBTLV_SIZE (&(mtc
->av_delay
.header
));
194 memcpy(tlvs
, &(mtc
->av_delay
), size
);
198 /* TE_SUBTLV_MM_DELAY */
199 if (SUBTLV_TYPE(mtc
->mm_delay
) != 0)
201 size
= SUBTLV_SIZE (&(mtc
->mm_delay
.header
));
202 memcpy(tlvs
, &(mtc
->mm_delay
), size
);
206 /* TE_SUBTLV_DELAY_VAR */
207 if (SUBTLV_TYPE(mtc
->delay_var
) != 0)
209 size
= SUBTLV_SIZE (&(mtc
->delay_var
.header
));
210 memcpy(tlvs
, &(mtc
->delay_var
), size
);
214 /* TE_SUBTLV_PKT_LOSS */
215 if (SUBTLV_TYPE(mtc
->pkt_loss
) != 0)
217 size
= SUBTLV_SIZE (&(mtc
->pkt_loss
.header
));
218 memcpy(tlvs
, &(mtc
->pkt_loss
), size
);
222 /* TE_SUBTLV_RES_BW */
223 if (SUBTLV_TYPE(mtc
->res_bw
) != 0)
225 size
= SUBTLV_SIZE (&(mtc
->res_bw
.header
));
226 memcpy(tlvs
, &(mtc
->res_bw
), size
);
230 /* TE_SUBTLV_AVA_BW */
231 if (SUBTLV_TYPE(mtc
->ava_bw
) != 0)
233 size
= SUBTLV_SIZE (&(mtc
->ava_bw
.header
));
234 memcpy(tlvs
, &(mtc
->ava_bw
), size
);
238 /* TE_SUBTLV_USE_BW */
239 if (SUBTLV_TYPE(mtc
->use_bw
) != 0)
241 size
= SUBTLV_SIZE (&(mtc
->use_bw
.header
));
242 memcpy(tlvs
, &(mtc
->use_bw
), size
);
246 /* Update SubTLVs length */
247 mtc
->length
= subtlvs_len(mtc
);
249 zlog_debug("ISIS MPLS-TE: Add %d bytes length SubTLVs", mtc
->length
);
254 /* Compute total Sub-TLVs size */
256 subtlvs_len (struct mpls_te_circuit
*mtc
)
264 /* TE_SUBTLV_ADMIN_GRP */
265 if (SUBTLV_TYPE(mtc
->admin_grp
) != 0)
266 length
+= SUBTLV_SIZE (&(mtc
->admin_grp
.header
));
269 if (SUBTLV_TYPE(mtc
->llri
) != 0)
270 length
+= SUBTLV_SIZE (&mtc
->llri
.header
);
272 /* TE_SUBTLV_LCLIF_IPADDR */
273 if (SUBTLV_TYPE(mtc
->local_ipaddr
) != 0)
274 length
+= SUBTLV_SIZE (&mtc
->local_ipaddr
.header
);
276 /* TE_SUBTLV_RMTIF_IPADDR */
277 if (SUBTLV_TYPE(mtc
->rmt_ipaddr
) != 0)
278 length
+= SUBTLV_SIZE (&mtc
->rmt_ipaddr
.header
);
280 /* TE_SUBTLV_MAX_BW */
281 if (SUBTLV_TYPE(mtc
->max_bw
) != 0)
282 length
+= SUBTLV_SIZE (&mtc
->max_bw
.header
);
284 /* TE_SUBTLV_MAX_RSV_BW */
285 if (SUBTLV_TYPE(mtc
->max_rsv_bw
) != 0)
286 length
+= SUBTLV_SIZE (&mtc
->max_rsv_bw
.header
);
288 /* TE_SUBTLV_UNRSV_BW */
289 if (SUBTLV_TYPE(mtc
->unrsv_bw
) != 0)
290 length
+= SUBTLV_SIZE (&mtc
->unrsv_bw
.header
);
292 /* TE_SUBTLV_TE_METRIC */
293 if (SUBTLV_TYPE(mtc
->te_metric
) != 0)
294 length
+= SUBTLV_SIZE (&mtc
->te_metric
.header
);
296 /* TE_SUBTLV_AV_DELAY */
297 if (SUBTLV_TYPE(mtc
->av_delay
) != 0)
298 length
+= SUBTLV_SIZE (&mtc
->av_delay
.header
);
300 /* TE_SUBTLV_MM_DELAY */
301 if (SUBTLV_TYPE(mtc
->mm_delay
) != 0)
302 length
+= SUBTLV_SIZE (&mtc
->mm_delay
.header
);
304 /* TE_SUBTLV_DELAY_VAR */
305 if (SUBTLV_TYPE(mtc
->delay_var
) != 0)
306 length
+= SUBTLV_SIZE (&mtc
->delay_var
.header
);
308 /* TE_SUBTLV_PKT_LOSS */
309 if (SUBTLV_TYPE(mtc
->pkt_loss
) != 0)
310 length
+= SUBTLV_SIZE (&mtc
->pkt_loss
.header
);
312 /* TE_SUBTLV_RES_BW */
313 if (SUBTLV_TYPE(mtc
->res_bw
) != 0)
314 length
+= SUBTLV_SIZE (&mtc
->res_bw
.header
);
316 /* TE_SUBTLV_AVA_BW */
317 if (SUBTLV_TYPE(mtc
->ava_bw
) != 0)
318 length
+= SUBTLV_SIZE (&mtc
->ava_bw
.header
);
320 /* TE_SUBTLV_USE_BW */
321 if (SUBTLV_TYPE(mtc
->use_bw
) != 0)
322 length
+= SUBTLV_SIZE (&mtc
->use_bw
.header
);
324 /* Check that length is lower than the MAXIMUM SUBTLV size i.e. 256 */
325 if (length
> MAX_SUBTLV_SIZE
)
331 mtc
->length
= (u_char
)length
;
336 /* Following are various functions to set MPLS TE parameters */
338 set_circuitparams_admin_grp (struct mpls_te_circuit
*mtc
, u_int32_t admingrp
)
340 SUBTLV_TYPE(mtc
->admin_grp
) = TE_SUBTLV_ADMIN_GRP
;
341 SUBTLV_LEN(mtc
->admin_grp
) = SUBTLV_DEF_SIZE
;
342 mtc
->admin_grp
.value
= htonl(admingrp
);
346 static void __attribute__ ((unused
))
347 set_circuitparams_llri (struct mpls_te_circuit
*mtc
, u_int32_t local
, u_int32_t remote
)
349 SUBTLV_TYPE(mtc
->llri
) = TE_SUBTLV_LLRI
;
350 SUBTLV_LEN(mtc
->llri
) = TE_SUBTLV_LLRI_SIZE
;
351 mtc
->llri
.local
= htonl(local
);
352 mtc
->llri
.remote
= htonl(remote
);
356 set_circuitparams_local_ipaddr (struct mpls_te_circuit
*mtc
, struct in_addr addr
)
359 SUBTLV_TYPE(mtc
->local_ipaddr
) = TE_SUBTLV_LOCAL_IPADDR
;
360 SUBTLV_LEN(mtc
->local_ipaddr
) = SUBTLV_DEF_SIZE
;
361 mtc
->local_ipaddr
.value
.s_addr
= addr
.s_addr
;
366 set_circuitparams_rmt_ipaddr (struct mpls_te_circuit
*mtc
, struct in_addr addr
)
369 SUBTLV_TYPE(mtc
->rmt_ipaddr
) = TE_SUBTLV_RMT_IPADDR
;
370 SUBTLV_LEN(mtc
->rmt_ipaddr
) = SUBTLV_DEF_SIZE
;
371 mtc
->rmt_ipaddr
.value
.s_addr
= addr
.s_addr
;
376 set_circuitparams_max_bw (struct mpls_te_circuit
*mtc
, float fp
)
378 SUBTLV_TYPE(mtc
->max_bw
) = TE_SUBTLV_MAX_BW
;
379 SUBTLV_LEN(mtc
->max_bw
) = SUBTLV_DEF_SIZE
;
380 mtc
->max_bw
.value
= htonf(fp
);
385 set_circuitparams_max_rsv_bw (struct mpls_te_circuit
*mtc
, float fp
)
387 SUBTLV_TYPE(mtc
->max_rsv_bw
) = TE_SUBTLV_MAX_RSV_BW
;
388 SUBTLV_LEN(mtc
->max_rsv_bw
) = SUBTLV_DEF_SIZE
;
389 mtc
->max_rsv_bw
.value
= htonf(fp
);
394 set_circuitparams_unrsv_bw (struct mpls_te_circuit
*mtc
, int priority
, float fp
)
396 /* Note that TLV-length field is the size of array. */
397 SUBTLV_TYPE(mtc
->unrsv_bw
) = TE_SUBTLV_UNRSV_BW
;
398 SUBTLV_LEN(mtc
->unrsv_bw
) = TE_SUBTLV_UNRSV_SIZE
;
399 mtc
->unrsv_bw
.value
[priority
] = htonf(fp
);
404 set_circuitparams_te_metric (struct mpls_te_circuit
*mtc
, u_int32_t te_metric
)
406 SUBTLV_TYPE(mtc
->te_metric
) = TE_SUBTLV_TE_METRIC
;
407 SUBTLV_LEN(mtc
->te_metric
) = TE_SUBTLV_TE_METRIC_SIZE
;
408 mtc
->te_metric
.value
[0] = (te_metric
>> 16) & 0xFF;
409 mtc
->te_metric
.value
[1] = (te_metric
>> 8) & 0xFF;
410 mtc
->te_metric
.value
[2] = te_metric
& 0xFF;
415 set_circuitparams_inter_as (struct mpls_te_circuit
*mtc
, struct in_addr addr
, u_int32_t as
)
418 /* Set the Remote ASBR IP address and then the associated AS number */
419 SUBTLV_TYPE(mtc
->rip
) = TE_SUBTLV_RIP
;
420 SUBTLV_LEN(mtc
->rip
) = SUBTLV_DEF_SIZE
;
421 mtc
->rip
.value
.s_addr
= addr
.s_addr
;
423 SUBTLV_TYPE(mtc
->ras
) = TE_SUBTLV_RAS
;
424 SUBTLV_LEN(mtc
->ras
) = SUBTLV_DEF_SIZE
;
425 mtc
->ras
.value
= htonl(as
);
429 unset_circuitparams_inter_as (struct mpls_te_circuit
*mtc
)
432 /* Reset the Remote ASBR IP address and then the associated AS number */
433 SUBTLV_TYPE(mtc
->rip
) = 0;
434 SUBTLV_LEN(mtc
->rip
) = 0;
435 mtc
->rip
.value
.s_addr
= 0;
437 SUBTLV_TYPE(mtc
->ras
) = 0;
438 SUBTLV_LEN(mtc
->ras
) = 0;
443 set_circuitparams_av_delay (struct mpls_te_circuit
*mtc
, u_int32_t delay
, u_char anormal
)
446 /* Note that TLV-length field is the size of array. */
447 SUBTLV_TYPE(mtc
->av_delay
) = TE_SUBTLV_AV_DELAY
;
448 SUBTLV_LEN(mtc
->av_delay
) = SUBTLV_DEF_SIZE
;
449 tmp
= delay
& TE_EXT_MASK
;
451 tmp
|= TE_EXT_ANORMAL
;
452 mtc
->av_delay
.value
= htonl(tmp
);
457 set_circuitparams_mm_delay (struct mpls_te_circuit
*mtc
, u_int32_t low
, u_int32_t high
, u_char anormal
)
460 /* Note that TLV-length field is the size of array. */
461 SUBTLV_TYPE(mtc
->mm_delay
) = TE_SUBTLV_MM_DELAY
;
462 SUBTLV_LEN(mtc
->mm_delay
) = TE_SUBTLV_MM_DELAY_SIZE
;
463 tmp
= low
& TE_EXT_MASK
;
465 tmp
|= TE_EXT_ANORMAL
;
466 mtc
->mm_delay
.low
= htonl(tmp
);
467 mtc
->mm_delay
.high
= htonl(high
);
472 set_circuitparams_delay_var (struct mpls_te_circuit
*mtc
, u_int32_t jitter
)
474 /* Note that TLV-length field is the size of array. */
475 SUBTLV_TYPE(mtc
->delay_var
) = TE_SUBTLV_DELAY_VAR
;
476 SUBTLV_LEN(mtc
->delay_var
) = SUBTLV_DEF_SIZE
;
477 mtc
->delay_var
.value
= htonl(jitter
& TE_EXT_MASK
);
482 set_circuitparams_pkt_loss (struct mpls_te_circuit
*mtc
, u_int32_t loss
, u_char anormal
)
485 /* Note that TLV-length field is the size of array. */
486 SUBTLV_TYPE(mtc
->pkt_loss
) = TE_SUBTLV_PKT_LOSS
;
487 SUBTLV_LEN(mtc
->pkt_loss
) = SUBTLV_DEF_SIZE
;
488 tmp
= loss
& TE_EXT_MASK
;
490 tmp
|= TE_EXT_ANORMAL
;
491 mtc
->pkt_loss
.value
= htonl(tmp
);
496 set_circuitparams_res_bw (struct mpls_te_circuit
*mtc
, float fp
)
498 /* Note that TLV-length field is the size of array. */
499 SUBTLV_TYPE(mtc
->res_bw
) = TE_SUBTLV_RES_BW
;
500 SUBTLV_LEN(mtc
->res_bw
) = SUBTLV_DEF_SIZE
;
501 mtc
->res_bw
.value
= htonf(fp
);
506 set_circuitparams_ava_bw (struct mpls_te_circuit
*mtc
, float fp
)
508 /* Note that TLV-length field is the size of array. */
509 SUBTLV_TYPE(mtc
->ava_bw
) = TE_SUBTLV_AVA_BW
;
510 SUBTLV_LEN(mtc
->ava_bw
) = SUBTLV_DEF_SIZE
;
511 mtc
->ava_bw
.value
= htonf(fp
);
516 set_circuitparams_use_bw (struct mpls_te_circuit
*mtc
, float fp
)
518 /* Note that TLV-length field is the size of array. */
519 SUBTLV_TYPE(mtc
->use_bw
) = TE_SUBTLV_USE_BW
;
520 SUBTLV_LEN(mtc
->use_bw
) = SUBTLV_DEF_SIZE
;
521 mtc
->use_bw
.value
= htonf(fp
);
525 /* Main initialization / update function of the MPLS TE Circuit context */
526 /* Call when interface TE Link parameters are modified */
528 isis_link_params_update (struct isis_circuit
*circuit
, struct interface
*ifp
)
531 struct prefix_ipv4
*addr
;
532 struct mpls_te_circuit
*mtc
;
535 if ((circuit
== NULL
) || (ifp
== NULL
))
538 zlog_info ("MPLS-TE: Initialize circuit parameters for interface %s", ifp
->name
);
540 /* Check if MPLS TE Circuit context has not been already created */
541 if (circuit
->mtc
== NULL
)
542 circuit
->mtc
= mpls_te_circuit_new();
546 /* Fulfil MTC TLV from ifp TE Link parameters */
547 if (HAS_LINK_PARAMS(ifp
))
549 mtc
->status
= enable
;
551 if (IS_PARAM_SET(ifp
->link_params
, LP_ADM_GRP
))
552 set_circuitparams_admin_grp (mtc
, ifp
->link_params
->admin_grp
);
554 SUBTLV_TYPE(mtc
->admin_grp
) = 0;
556 /* If not already set, register local IP addr from ip_addr list if it exists */
557 if (SUBTLV_TYPE(mtc
->local_ipaddr
) == 0)
559 if (circuit
->ip_addrs
!= NULL
&& listcount(circuit
->ip_addrs
) != 0)
561 addr
= (struct prefix_ipv4
*)listgetdata ((struct listnode
*)listhead (circuit
->ip_addrs
));
562 set_circuitparams_local_ipaddr (mtc
, addr
->prefix
);
566 /* If not already set, try to determine Remote IP addr if circuit is P2P */
567 if ((SUBTLV_TYPE(mtc
->rmt_ipaddr
) == 0) && (circuit
->circ_type
== CIRCUIT_T_P2P
))
569 struct isis_adjacency
*adj
= circuit
->u
.p2p
.neighbor
;
570 if (adj
->ipv4_addrs
!= NULL
&& listcount(adj
->ipv4_addrs
) != 0)
572 struct in_addr
*ip_addr
;
573 ip_addr
= (struct in_addr
*)listgetdata ((struct listnode
*)listhead (adj
->ipv4_addrs
));
574 set_circuitparams_rmt_ipaddr (mtc
, *ip_addr
);
578 if (IS_PARAM_SET(ifp
->link_params
, LP_MAX_BW
))
579 set_circuitparams_max_bw (mtc
, ifp
->link_params
->max_bw
);
581 SUBTLV_TYPE(mtc
->max_bw
) = 0;
583 if (IS_PARAM_SET(ifp
->link_params
, LP_MAX_RSV_BW
))
584 set_circuitparams_max_rsv_bw (mtc
, ifp
->link_params
->max_rsv_bw
);
586 SUBTLV_TYPE(mtc
->max_rsv_bw
) = 0;
588 if (IS_PARAM_SET(ifp
->link_params
, LP_UNRSV_BW
))
589 for (i
= 0; i
< MAX_CLASS_TYPE
; i
++)
590 set_circuitparams_unrsv_bw (mtc
, i
, ifp
->link_params
->unrsv_bw
[i
]);
592 SUBTLV_TYPE(mtc
->unrsv_bw
) = 0;
594 if (IS_PARAM_SET(ifp
->link_params
, LP_TE
))
595 set_circuitparams_te_metric(mtc
, ifp
->link_params
->te_metric
);
597 SUBTLV_TYPE(mtc
->te_metric
) = 0;
599 /* TE metric Extensions */
600 if (IS_PARAM_SET(ifp
->link_params
, LP_DELAY
))
601 set_circuitparams_av_delay(mtc
, ifp
->link_params
->av_delay
, 0);
603 SUBTLV_TYPE(mtc
->av_delay
) = 0;
605 if (IS_PARAM_SET(ifp
->link_params
, LP_MM_DELAY
))
606 set_circuitparams_mm_delay(mtc
, ifp
->link_params
->min_delay
, ifp
->link_params
->max_delay
, 0);
608 SUBTLV_TYPE(mtc
->mm_delay
) = 0;
610 if (IS_PARAM_SET(ifp
->link_params
, LP_DELAY_VAR
))
611 set_circuitparams_delay_var(mtc
, ifp
->link_params
->delay_var
);
613 SUBTLV_TYPE(mtc
->delay_var
) = 0;
615 if (IS_PARAM_SET(ifp
->link_params
, LP_PKT_LOSS
))
616 set_circuitparams_pkt_loss(mtc
, ifp
->link_params
->pkt_loss
, 0);
618 SUBTLV_TYPE(mtc
->pkt_loss
) = 0;
620 if (IS_PARAM_SET(ifp
->link_params
, LP_RES_BW
))
621 set_circuitparams_res_bw(mtc
, ifp
->link_params
->res_bw
);
623 SUBTLV_TYPE(mtc
->res_bw
) = 0;
625 if (IS_PARAM_SET(ifp
->link_params
, LP_AVA_BW
))
626 set_circuitparams_ava_bw(mtc
, ifp
->link_params
->ava_bw
);
628 SUBTLV_TYPE(mtc
->ava_bw
) = 0;
630 if (IS_PARAM_SET(ifp
->link_params
, LP_USE_BW
))
631 set_circuitparams_use_bw(mtc
, ifp
->link_params
->use_bw
);
633 SUBTLV_TYPE(mtc
->use_bw
) = 0;
636 if (IS_PARAM_SET(ifp
->link_params
, LP_RMT_AS
))
637 set_circuitparams_inter_as(mtc
, ifp
->link_params
->rmt_ip
, ifp
->link_params
->rmt_as
);
639 /* reset inter-as TE params */
640 unset_circuitparams_inter_as (mtc
);
642 /* Compute total length of SUB TLVs */
643 mtc
->length
= subtlvs_len(mtc
);
647 mtc
->status
= disable
;
649 /* Finally Update LSP */
651 if (IS_MPLS_TE(isisMplsTE
) && circuit
->area
)
652 lsp_regenerate_schedule (circuit
->area
, circuit
->is_type
, 0);
658 isis_mpls_te_update (struct interface
*ifp
)
660 struct isis_circuit
*circuit
;
666 /* Get circuit context from interface */
667 if ((circuit
= circuit_scan_by_ifp(ifp
)) == NULL
)
670 /* Update TE TLVs ... */
671 isis_link_params_update(circuit
, ifp
);
674 if (IS_MPLS_TE(isisMplsTE
) && circuit
->area
)
675 lsp_regenerate_schedule (circuit
->area
, circuit
->is_type
, 0);
680 /*------------------------------------------------------------------------*
681 * Followings are vty session control functions.
682 *------------------------------------------------------------------------*/
685 show_vty_subtlv_admin_grp (struct vty
*vty
, struct te_subtlv_admin_grp
*tlv
)
689 vty_out (vty
, " Administrative Group: 0x%x%s",
690 (u_int32_t
) ntohl (tlv
->value
), VTY_NEWLINE
);
692 zlog_debug (" Administrative Group: 0x%x",
693 (u_int32_t
) ntohl (tlv
->value
));
695 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
699 show_vty_subtlv_llri (struct vty
*vty
, struct te_subtlv_llri
*tlv
)
703 vty_out (vty
, " Link Local ID: %d%s", (u_int32_t
) ntohl (tlv
->local
),
705 vty_out (vty
, " Link Remote ID: %d%s", (u_int32_t
) ntohl (tlv
->remote
),
710 zlog_debug (" Link Local ID: %d", (u_int32_t
) ntohl (tlv
->local
));
711 zlog_debug (" Link Remote ID: %d", (u_int32_t
) ntohl (tlv
->remote
));
714 return (SUBTLV_HDR_SIZE
+ TE_SUBTLV_LLRI_SIZE
);
718 show_vty_subtlv_local_ipaddr (struct vty
*vty
, struct te_subtlv_local_ipaddr
*tlv
)
721 vty_out (vty
, " Local Interface IP Address(es): %s%s", inet_ntoa (tlv
->value
), VTY_NEWLINE
);
723 zlog_debug (" Local Interface IP Address(es): %s", inet_ntoa (tlv
->value
));
725 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
729 show_vty_subtlv_rmt_ipaddr (struct vty
*vty
, struct te_subtlv_rmt_ipaddr
*tlv
)
732 vty_out (vty
, " Remote Interface IP Address(es): %s%s", inet_ntoa (tlv
->value
), VTY_NEWLINE
);
734 zlog_debug (" Remote Interface IP Address(es): %s", inet_ntoa (tlv
->value
));
736 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
740 show_vty_subtlv_max_bw (struct vty
*vty
, struct te_subtlv_max_bw
*tlv
)
744 fval
= ntohf (tlv
->value
);
747 vty_out (vty
, " Maximum Bandwidth: %g (Bytes/sec)%s", fval
, VTY_NEWLINE
);
749 zlog_debug (" Maximum Bandwidth: %g (Bytes/sec)", fval
);
751 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
755 show_vty_subtlv_max_rsv_bw (struct vty
*vty
, struct te_subtlv_max_rsv_bw
*tlv
)
759 fval
= ntohf (tlv
->value
);
762 vty_out (vty
, " Maximum Reservable Bandwidth: %g (Bytes/sec)%s", fval
,
765 zlog_debug (" Maximum Reservable Bandwidth: %g (Bytes/sec)", fval
);
767 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
771 show_vty_subtlv_unrsv_bw (struct vty
*vty
, struct te_subtlv_unrsv_bw
*tlv
)
777 vty_out (vty
, " Unreserved Bandwidth:%s",VTY_NEWLINE
);
779 zlog_debug (" Unreserved Bandwidth:");
781 for (i
= 0; i
< MAX_CLASS_TYPE
; i
+=2)
783 fval1
= ntohf (tlv
->value
[i
]);
784 fval2
= ntohf (tlv
->value
[i
+1]);
786 vty_out (vty
, " [%d]: %g (Bytes/sec),\t[%d]: %g (Bytes/sec)%s", i
, fval1
, i
+1, fval2
, VTY_NEWLINE
);
788 zlog_debug (" [%d]: %g (Bytes/sec),\t[%d]: %g (Bytes/sec)", i
, fval1
, i
+1, fval2
);
791 return (SUBTLV_HDR_SIZE
+ TE_SUBTLV_UNRSV_SIZE
);
795 show_vty_subtlv_te_metric (struct vty
*vty
, struct te_subtlv_te_metric
*tlv
)
799 te_metric
= tlv
->value
[2] | tlv
->value
[1] << 8 | tlv
->value
[0] << 16;
801 vty_out (vty
, " Traffic Engineering Metric: %u%s", te_metric
, VTY_NEWLINE
);
803 zlog_debug (" Traffic Engineering Metric: %u", te_metric
);
805 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
809 show_vty_subtlv_ras (struct vty
*vty
, struct te_subtlv_ras
*tlv
)
812 vty_out (vty
, " Inter-AS TE Remote AS number: %u%s", ntohl (tlv
->value
), VTY_NEWLINE
);
814 zlog_debug (" Inter-AS TE Remote AS number: %u", ntohl (tlv
->value
));
816 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
820 show_vty_subtlv_rip (struct vty
*vty
, struct te_subtlv_rip
*tlv
)
823 vty_out (vty
, " Inter-AS TE Remote ASBR IP address: %s%s", inet_ntoa (tlv
->value
), VTY_NEWLINE
);
825 zlog_debug (" Inter-AS TE Remote ASBR IP address: %s", inet_ntoa (tlv
->value
));
827 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
831 show_vty_subtlv_av_delay (struct vty
*vty
, struct te_subtlv_av_delay
*tlv
)
836 delay
= (u_int32_t
) ntohl (tlv
->value
) & TE_EXT_MASK
;
837 A
= (u_int32_t
) ntohl (tlv
->value
) & TE_EXT_ANORMAL
;
840 vty_out (vty
, " %s Average Link Delay: %d (micro-sec)%s", A
? "Anomalous" : "Normal", delay
, VTY_NEWLINE
);
842 zlog_debug (" %s Average Link Delay: %d (micro-sec)", A
? "Anomalous" : "Normal", delay
);
844 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
848 show_vty_subtlv_mm_delay (struct vty
*vty
, struct te_subtlv_mm_delay
*tlv
)
853 low
= (u_int32_t
) ntohl (tlv
->low
) & TE_EXT_MASK
;
854 A
= (u_int32_t
) ntohl (tlv
->low
) & TE_EXT_ANORMAL
;
855 high
= (u_int32_t
) ntohl (tlv
->high
) & TE_EXT_MASK
;
858 vty_out (vty
, " %s Min/Max Link Delay: %d / %d (micro-sec)%s", A
? "Anomalous" : "Normal", low
, high
, VTY_NEWLINE
);
860 zlog_debug (" %s Min/Max Link Delay: %d / %d (micro-sec)", A
? "Anomalous" : "Normal", low
, high
);
862 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
866 show_vty_subtlv_delay_var (struct vty
*vty
, struct te_subtlv_delay_var
*tlv
)
870 jitter
= (u_int32_t
) ntohl (tlv
->value
) & TE_EXT_MASK
;
873 vty_out (vty
, " Delay Variation: %d (micro-sec)%s", jitter
, VTY_NEWLINE
);
875 zlog_debug (" Delay Variation: %d (micro-sec)", jitter
);
877 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
881 show_vty_subtlv_pkt_loss (struct vty
*vty
, struct te_subtlv_pkt_loss
*tlv
)
887 loss
= (u_int32_t
) ntohl (tlv
->value
) & TE_EXT_MASK
;
888 fval
= (float) (loss
* LOSS_PRECISION
);
889 A
= (u_int32_t
) ntohl (tlv
->value
) & TE_EXT_ANORMAL
;
892 vty_out (vty
, " %s Link Packet Loss: %g (%%)%s", A
? "Anomalous" : "Normal", fval
, VTY_NEWLINE
);
894 zlog_debug (" %s Link Packet Loss: %g (%%)", A
? "Anomalous" : "Normal", fval
);
896 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
900 show_vty_subtlv_res_bw (struct vty
*vty
, struct te_subtlv_res_bw
*tlv
)
904 fval
= ntohf(tlv
->value
);
907 vty_out (vty
, " Unidirectional Residual Bandwidth: %g (Bytes/sec)%s", fval
, VTY_NEWLINE
);
909 zlog_debug (" Unidirectional Residual Bandwidth: %g (Bytes/sec)", fval
);
911 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
915 show_vty_subtlv_ava_bw (struct vty
*vty
, struct te_subtlv_ava_bw
*tlv
)
919 fval
= ntohf (tlv
->value
);
922 vty_out (vty
, " Unidirectional Available Bandwidth: %g (Bytes/sec)%s", fval
, VTY_NEWLINE
);
924 zlog_debug (" Unidirectional Available Bandwidth: %g (Bytes/sec)", fval
);
926 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
930 show_vty_subtlv_use_bw (struct vty
*vty
, struct te_subtlv_use_bw
*tlv
)
934 fval
= ntohf (tlv
->value
);
937 vty_out (vty
, " Unidirectional Utilized Bandwidth: %g (Bytes/sec)%s", fval
, VTY_NEWLINE
);
939 zlog_debug (" Unidirectional Utilized Bandwidth: %g (Bytes/sec)", fval
);
941 return (SUBTLV_HDR_SIZE
+ SUBTLV_DEF_SIZE
);
945 show_vty_unknown_tlv (struct vty
*vty
, struct subtlv_header
*tlvh
)
948 u_char
*v
= (u_char
*)tlvh
;
952 if (tlvh
->length
!= 0)
954 vty_out (vty
, " Unknown TLV: [type(%#.2x), length(%#.2x)]%s",
955 tlvh
->type
, tlvh
->length
, VTY_NEWLINE
);
956 vty_out(vty
, " Dump: [00]");
957 rtn
= 1; /* initialize end of line counter */
958 for (i
= 0; i
< tlvh
->length
; i
++)
960 vty_out (vty
, " %#.2x", v
[i
]);
963 vty_out (vty
, "%s [%.2x]", VTY_NEWLINE
, i
+ 1);
969 vty_out (vty
, "%s", VTY_NEWLINE
);
972 vty_out (vty
, " Unknown TLV: [type(%#.2x), length(%#.2x)]%s",
973 tlvh
->type
, tlvh
->length
, VTY_NEWLINE
);
977 zlog_debug (" Unknown TLV: [type(%#.2x), length(%#.2x)]",
978 tlvh
->type
, tlvh
->length
);
981 return SUBTLV_SIZE(tlvh
);
984 /* Main Show function */
986 mpls_te_print_detail(struct vty
*vty
, struct te_is_neigh
*te
)
988 struct subtlv_header
*tlvh
, *next
;
991 zlog_debug ("ISIS MPLS-TE: Show database TE detail");
993 tlvh
= (struct subtlv_header
*)te
->sub_tlvs
;
995 for (; sum
< te
->sub_tlvs_length
; tlvh
= (next
? next
: SUBTLV_HDR_NEXT (tlvh
)))
1001 case TE_SUBTLV_ADMIN_GRP
:
1002 sum
+= show_vty_subtlv_admin_grp (vty
, (struct te_subtlv_admin_grp
*)tlvh
);
1004 case TE_SUBTLV_LLRI
:
1005 sum
+= show_vty_subtlv_llri (vty
, (struct te_subtlv_llri
*)tlvh
);
1007 case TE_SUBTLV_LOCAL_IPADDR
:
1008 sum
+= show_vty_subtlv_local_ipaddr (vty
, (struct te_subtlv_local_ipaddr
*)tlvh
);
1010 case TE_SUBTLV_RMT_IPADDR
:
1011 sum
+= show_vty_subtlv_rmt_ipaddr (vty
, (struct te_subtlv_rmt_ipaddr
*)tlvh
);
1013 case TE_SUBTLV_MAX_BW
:
1014 sum
+= show_vty_subtlv_max_bw (vty
, (struct te_subtlv_max_bw
*)tlvh
);
1016 case TE_SUBTLV_MAX_RSV_BW
:
1017 sum
+= show_vty_subtlv_max_rsv_bw (vty
, (struct te_subtlv_max_rsv_bw
*)tlvh
);
1019 case TE_SUBTLV_UNRSV_BW
:
1020 sum
+= show_vty_subtlv_unrsv_bw (vty
, (struct te_subtlv_unrsv_bw
*)tlvh
);
1022 case TE_SUBTLV_TE_METRIC
:
1023 sum
+= show_vty_subtlv_te_metric (vty
, (struct te_subtlv_te_metric
*)tlvh
);
1026 sum
+= show_vty_subtlv_ras (vty
, (struct te_subtlv_ras
*)tlvh
);
1029 sum
+= show_vty_subtlv_rip (vty
, (struct te_subtlv_rip
*)tlvh
);
1031 case TE_SUBTLV_AV_DELAY
:
1032 sum
+= show_vty_subtlv_av_delay (vty
, (struct te_subtlv_av_delay
*)tlvh
);
1034 case TE_SUBTLV_MM_DELAY
:
1035 sum
+= show_vty_subtlv_mm_delay (vty
, (struct te_subtlv_mm_delay
*)tlvh
);
1037 case TE_SUBTLV_DELAY_VAR
:
1038 sum
+= show_vty_subtlv_delay_var (vty
, (struct te_subtlv_delay_var
*)tlvh
);
1040 case TE_SUBTLV_PKT_LOSS
:
1041 sum
+= show_vty_subtlv_pkt_loss (vty
, (struct te_subtlv_pkt_loss
*)tlvh
);
1043 case TE_SUBTLV_RES_BW
:
1044 sum
+= show_vty_subtlv_res_bw (vty
, (struct te_subtlv_res_bw
*)tlvh
);
1046 case TE_SUBTLV_AVA_BW
:
1047 sum
+= show_vty_subtlv_ava_bw (vty
, (struct te_subtlv_ava_bw
*)tlvh
);
1049 case TE_SUBTLV_USE_BW
:
1050 sum
+= show_vty_subtlv_use_bw (vty
, (struct te_subtlv_use_bw
*)tlvh
);
1053 sum
+= show_vty_unknown_tlv (vty
, tlvh
);
1060 /* Specific MPLS TE router parameters write function */
1062 isis_mpls_te_config_write_router (struct vty
*vty
)
1064 if (IS_MPLS_TE(isisMplsTE
))
1066 vty_out (vty
, " mpls-te on%s", VTY_NEWLINE
);
1067 vty_out (vty
, " mpls-te router-address %s%s",
1068 inet_ntoa (isisMplsTE
.router_id
), VTY_NEWLINE
);
1075 /*------------------------------------------------------------------------*
1076 * Followings are vty command functions.
1077 *------------------------------------------------------------------------*/
1079 DEFUN (isis_mpls_te_on
,
1080 isis_mpls_te_on_cmd
,
1083 "Enable MPLS-TE functionality\n")
1085 struct listnode
*node
;
1086 struct isis_circuit
*circuit
;
1088 if (IS_MPLS_TE(isisMplsTE
))
1091 if (IS_DEBUG_ISIS(DEBUG_TE
))
1092 zlog_debug ("ISIS MPLS-TE: OFF -> ON");
1094 isisMplsTE
.status
= enable
;
1097 * Following code is intended to handle two cases;
1099 * 1) MPLS-TE was disabled at startup time, but now become enabled.
1100 * In this case, we must enable MPLS-TE Circuit regarding interface MPLS_TE flag
1101 * 2) MPLS-TE was once enabled then disabled, and now enabled again.
1103 for (ALL_LIST_ELEMENTS_RO (isisMplsTE
.cir_list
, node
, circuit
))
1105 if (circuit
->mtc
== NULL
|| IS_FLOOD_AS (circuit
->mtc
->type
))
1108 if ((circuit
->mtc
->status
== disable
)
1109 && HAS_LINK_PARAMS(circuit
->interface
))
1110 circuit
->mtc
->status
= enable
;
1114 /* Reoriginate STD_TE & GMPLS circuits */
1116 lsp_regenerate_schedule (circuit
->area
, circuit
->is_type
, 0);
1122 DEFUN (no_isis_mpls_te_on
,
1123 no_isis_mpls_te_on_cmd
,
1126 "Disable the MPLS-TE functionality\n")
1128 struct listnode
*node
;
1129 struct isis_circuit
*circuit
;
1131 if (isisMplsTE
.status
== disable
)
1134 if (IS_DEBUG_ISIS(DEBUG_TE
))
1135 zlog_debug ("ISIS MPLS-TE: ON -> OFF");
1137 isisMplsTE
.status
= disable
;
1139 /* Flush LSP if circuit engage */
1140 for (ALL_LIST_ELEMENTS_RO (isisMplsTE
.cir_list
, node
, circuit
))
1142 if (circuit
->mtc
== NULL
|| (circuit
->mtc
->status
== disable
))
1145 /* disable MPLS_TE Circuit */
1146 circuit
->mtc
->status
= disable
;
1148 /* Re-originate circuit without STD_TE & GMPLS parameters */
1150 lsp_regenerate_schedule (circuit
->area
, circuit
->is_type
, 0);
1156 DEFUN (isis_mpls_te_router_addr
,
1157 isis_mpls_te_router_addr_cmd
,
1158 "mpls-te router-address A.B.C.D",
1160 "Stable IP address of the advertising router\n"
1161 "MPLS-TE router address in IPv4 address format\n")
1164 struct in_addr value
;
1165 struct listnode
*node
;
1166 struct isis_area
*area
;
1168 if (! inet_aton (argv
[idx_ipv4
]->arg
, &value
))
1170 vty_out (vty
, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE
);
1174 isisMplsTE
.router_id
.s_addr
= value
.s_addr
;
1176 if (isisMplsTE
.status
== disable
)
1179 /* Update main Router ID in isis global structure */
1180 isis
->router_id
= value
.s_addr
;
1181 /* And re-schedule LSP update */
1182 for (ALL_LIST_ELEMENTS_RO (isis
->area_list
, node
, area
))
1183 if (listcount (area
->area_addrs
) > 0)
1184 lsp_regenerate_schedule (area
, area
->is_type
, 0);
1189 DEFUN (isis_mpls_te_inter_as
,
1190 isis_mpls_te_inter_as_cmd
,
1191 "mpls-te inter-as <level-1|level-1-2|level-2-only>",
1193 "Configure MPLS-TE Inter-AS support\n"
1194 "AREA native mode self originate INTER-AS LSP with L1 only flooding scope)\n"
1195 "AREA native mode self originate INTER-AS LSP with L1 and L2 flooding scope)\n"
1196 "AS native mode self originate INTER-AS LSP with L2 only flooding scope\n")
1198 vty_out (vty
, "Not yet supported%s", VTY_NEWLINE
);
1202 DEFUN (no_isis_mpls_te_inter_as
,
1203 no_isis_mpls_te_inter_as_cmd
,
1204 "no mpls-te inter-as",
1206 "Disable the MPLS-TE functionality\n"
1207 "Disable MPLS-TE Inter-AS support\n")
1210 vty_out (vty
, "Not yet supported%s", VTY_NEWLINE
);
1214 DEFUN (show_isis_mpls_te_router
,
1215 show_isis_mpls_te_router_cmd
,
1216 "show isis mpls-te router",
1220 "Router information\n")
1222 if (IS_MPLS_TE(isisMplsTE
))
1224 vty_out (vty
, "--- MPLS-TE router parameters ---%s", VTY_NEWLINE
);
1228 if (ntohs (isisMplsTE
.router_id
.s_addr
) != 0)
1229 vty_out (vty
, " Router-Address: %s%s", inet_ntoa (isisMplsTE
.router_id
), VTY_NEWLINE
);
1231 vty_out (vty
, " N/A%s", VTY_NEWLINE
);
1235 vty_out (vty
, " MPLS-TE is disable on this router%s", VTY_NEWLINE
);
1241 show_mpls_te_sub (struct vty
*vty
, struct interface
*ifp
)
1243 struct mpls_te_circuit
*mtc
;
1245 if ((IS_MPLS_TE(isisMplsTE
))
1246 && ((mtc
= lookup_mpls_params_by_ifp (ifp
)) != NULL
))
1248 /* Continue only if interface is not passive or support Inter-AS TEv2 */
1249 if (mtc
->status
!= enable
)
1251 if (IS_INTER_AS(mtc
->type
))
1253 vty_out (vty
, "-- Inter-AS TEv2 link parameters for %s --%s",
1254 ifp
->name
, VTY_NEWLINE
);
1258 /* MPLS-TE is not activate on this interface */
1259 /* or this interface is passive and Inter-AS TEv2 is not activate */
1260 vty_out (vty
, " %s: MPLS-TE is disabled on this interface%s",
1261 ifp
->name
, VTY_NEWLINE
);
1267 vty_out (vty
, "-- MPLS-TE link parameters for %s --%s",
1268 ifp
->name
, VTY_NEWLINE
);
1271 show_vty_subtlv_admin_grp (vty
, &mtc
->admin_grp
);
1273 if (SUBTLV_TYPE(mtc
->local_ipaddr
) != 0)
1274 show_vty_subtlv_local_ipaddr (vty
, &mtc
->local_ipaddr
);
1275 if (SUBTLV_TYPE(mtc
->rmt_ipaddr
) != 0)
1276 show_vty_subtlv_rmt_ipaddr (vty
, &mtc
->rmt_ipaddr
);
1278 show_vty_subtlv_max_bw (vty
, &mtc
->max_bw
);
1279 show_vty_subtlv_max_rsv_bw (vty
, &mtc
->max_rsv_bw
);
1280 show_vty_subtlv_unrsv_bw (vty
, &mtc
->unrsv_bw
);
1281 show_vty_subtlv_te_metric (vty
, &mtc
->te_metric
);
1283 if (IS_INTER_AS(mtc
->type
))
1285 if (SUBTLV_TYPE(mtc
->ras
) != 0)
1286 show_vty_subtlv_ras (vty
, &mtc
->ras
);
1287 if (SUBTLV_TYPE(mtc
->rip
) != 0)
1288 show_vty_subtlv_rip (vty
, &mtc
->rip
);
1291 show_vty_subtlv_av_delay (vty
, &mtc
->av_delay
);
1292 show_vty_subtlv_mm_delay (vty
, &mtc
->mm_delay
);
1293 show_vty_subtlv_delay_var (vty
, &mtc
->delay_var
);
1294 show_vty_subtlv_pkt_loss (vty
, &mtc
->pkt_loss
);
1295 show_vty_subtlv_res_bw (vty
, &mtc
->res_bw
);
1296 show_vty_subtlv_ava_bw (vty
, &mtc
->ava_bw
);
1297 show_vty_subtlv_use_bw (vty
, &mtc
->use_bw
);
1298 vty_out (vty
, "---------------%s%s", VTY_NEWLINE
, VTY_NEWLINE
);
1302 vty_out (vty
, " %s: MPLS-TE is disabled on this interface%s",
1303 ifp
->name
, VTY_NEWLINE
);
1309 DEFUN (show_isis_mpls_te_interface
,
1310 show_isis_mpls_te_interface_cmd
,
1311 "show isis mpls-te interface [INTERFACE]",
1315 "Interface information\n"
1318 int idx_interface
= 4;
1319 struct interface
*ifp
;
1320 struct listnode
*node
;
1322 /* Show All Interfaces. */
1325 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
))
1326 show_mpls_te_sub (vty
, ifp
);
1328 /* Interface name is specified. */
1331 if ((ifp
= if_lookup_by_name (argv
[idx_interface
]->arg
)) == NULL
)
1332 vty_out (vty
, "No such interface name%s", VTY_NEWLINE
);
1334 show_mpls_te_sub (vty
, ifp
);
1340 /* Initialize MPLS_TE */
1342 isis_mpls_te_init (void)
1345 zlog_debug("ISIS MPLS-TE: Initialize");
1347 /* Initialize MPLS_TE structure */
1348 isisMplsTE
.status
= disable
;
1349 isisMplsTE
.level
= 0;
1350 isisMplsTE
.inter_as
= off
;
1351 isisMplsTE
.interas_areaid
.s_addr
= 0;
1352 isisMplsTE
.cir_list
= list_new();
1353 isisMplsTE
.router_id
.s_addr
= 0;
1355 /* Register new VTY commands */
1356 install_element (VIEW_NODE
, &show_isis_mpls_te_router_cmd
);
1357 install_element (VIEW_NODE
, &show_isis_mpls_te_interface_cmd
);
1359 install_element (ISIS_NODE
, &isis_mpls_te_on_cmd
);
1360 install_element (ISIS_NODE
, &no_isis_mpls_te_on_cmd
);
1361 install_element (ISIS_NODE
, &isis_mpls_te_router_addr_cmd
);
1362 install_element (ISIS_NODE
, &isis_mpls_te_inter_as_cmd
);
1363 install_element (ISIS_NODE
, &no_isis_mpls_te_inter_as_cmd
);