2 * IS-IS Rout(e)ing protocol - isis_te.c
4 * This is an implementation of RFC5305, RFC 5307 and 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
26 #ifndef _ZEBRA_ISIS_MPLS_TE_H
27 #define _ZEBRA_ISIS_MPLS_TE_H
30 * Traffic Engineering information are transport through LSP:
31 * - Extended IS Reachability TLV = 22
32 * - Traffic Engineering Router ID TLV = 134
33 * - Extended IP Reachability TLV = 135
34 * - Inter-AS Reachability Information TLV = 141
36 * and support following sub-TLV:
39 * _________________________________________________
40 * Administartive group (color) 3 RFC5305
41 * Link Local/Remote Identifiers 4 RFC5307
42 * IPv4 interface address 6 RFC5305
43 * IPv4 neighbor address 8 RFC5305
44 * Maximum link bandwidth 9 RFC5305
45 * Reservable link bandwidth 10 RFC5305
46 * Unreserved bandwidth 11 RFC5305
47 * TE Default metric 18 RFC5305
48 * Link Protection Type 20 RFC5307
49 * Interface Switching Capability 21 RFC5307
50 * Remote AS number 24 RFC5316
51 * IPv4 Remote ASBR identifier 25 RFC5316
55 /* NOTE: RFC5316 is not yet supported in this version */
57 /* Following define the type of TE link regarding the various RFC */
66 #define IS_STD_TE(x) (x & STD_TE)
67 #define IS_INTER_AS(x) (x & INTER_AS)
68 #define IS_EMULATED(x) (x & EMULATED)
69 #define IS_FLOOD_L1(x) (x & FLOOD_L1)
70 #define IS_FLOOD_L2(x) (x & FLOOD_L2)
71 #define IS_FLOOD_AS(x) (x & FLOOD_AS)
72 #define IS_INTER_AS_EMU(x) (x & INTER_AS & EMULATED)
73 #define IS_INTER_AS_AS(x) (x & INTER_AS & FLOOD_AS)
76 * Following section defines subTLV (tag, length, value) structures,
77 * used for Traffic Engineering.
81 u_char type
; /* sub_TLV_XXX type (see above) */
82 u_char length
; /* Value portion only, in byte */
85 #define SUBTLV_HDR_SIZE 2 /* (sizeof (struct sub_tlv_header)) */
87 #define SUBTLV_SIZE(stlvh) (SUBTLV_HDR_SIZE + (stlvh)->length)
89 #define SUBTLV_HDR_TOP(lsph) (struct subtlv_header *)((char *)(lsph) + ISIS_LSP_HEADER_SIZE)
91 #define SUBTLV_HDR_NEXT(stlvh) (struct subtlv_header *)((char *)(stlvh) + SUBTLV_SIZE(stlvh))
93 #define SUBTLV_TYPE(stlvh) stlvh.header.type
94 #define SUBTLV_LEN(stlvh) stlvh.header.length
95 #define SUBTLV_VAL(stlvh) stlvh.value
96 #define SUBTLV_DATA(stlvh) stlvh + SUBTLV_HDR_SIZE
98 #define SUBTLV_DEF_SIZE 4
100 /* Link Sub-TLV: Resource Class/Color - RFC 5305 */
101 #define TE_SUBTLV_ADMIN_GRP 3
102 struct te_subtlv_admin_grp
104 struct subtlv_header header
; /* Value length is 4 octets. */
105 u_int32_t value
; /* Admin. group membership. */
106 } __attribute__((__packed__
));
108 /* Link Local/Remote Identifiers - RFC 5307 */
109 #define TE_SUBTLV_LLRI 4
110 #define TE_SUBTLV_LLRI_SIZE 8
111 struct te_subtlv_llri
113 struct subtlv_header header
; /* Value length is 8 octets. */
114 u_int32_t local
; /* Link Local Identifier */
115 u_int32_t remote
; /* Link Remote Identifier */
116 } __attribute__((__packed__
));
118 /* Link Sub-TLV: Local Interface IP Address - RFC 5305 */
119 #define TE_SUBTLV_LOCAL_IPADDR 6
120 struct te_subtlv_local_ipaddr
122 struct subtlv_header header
; /* Value length is 4 x N octets. */
123 struct in_addr value
; /* Local IP address(es). */
124 } __attribute__((__packed__
));
126 /* Link Sub-TLV: Neighbor Interface IP Address - RFC 5305 */
127 #define TE_SUBTLV_RMT_IPADDR 8
128 struct te_subtlv_rmt_ipaddr
130 struct subtlv_header header
; /* Value length is 4 x N octets. */
131 struct in_addr value
; /* Neighbor's IP address(es). */
132 } __attribute__((__packed__
));
134 /* Link Sub-TLV: Maximum Bandwidth - RFC 5305 */
135 #define TE_SUBTLV_MAX_BW 9
136 struct te_subtlv_max_bw
138 struct subtlv_header header
; /* Value length is 4 octets. */
139 float value
; /* bytes/sec */
140 } __attribute__((__packed__
));
142 /* Link Sub-TLV: Maximum Reservable Bandwidth - RFC 5305 */
143 #define TE_SUBTLV_MAX_RSV_BW 10
144 struct te_subtlv_max_rsv_bw
146 struct subtlv_header header
; /* Value length is 4 octets. */
147 float value
; /* bytes/sec */
148 } __attribute__((__packed__
));
150 /* Link Sub-TLV: Unreserved Bandwidth - RFC 5305 */
151 #define TE_SUBTLV_UNRSV_BW 11
152 #define TE_SUBTLV_UNRSV_SIZE 32
153 struct te_subtlv_unrsv_bw
155 struct subtlv_header header
; /* Value length is 32 octets. */
156 float value
[8]; /* One for each priority level. */
157 } __attribute__((__packed__
));
159 /* Link Sub-TLV: Traffic Engineering Metric - RFC 5305 */
160 #define TE_SUBTLV_TE_METRIC 18
161 #define TE_SUBTLV_TE_METRIC_SIZE 3
162 struct te_subtlv_te_metric
164 struct subtlv_header header
; /* Value length is 4 octets. */
165 u_char value
[3]; /* Link metric for TE purpose. */
166 } __attribute__((__packed__
));
168 /* Remote AS Number sub-TLV - RFC5316 */
169 #define TE_SUBTLV_RAS 24
172 struct subtlv_header header
; /* Value length is 4 octets. */
173 u_int32_t value
; /* Remote AS number */
174 } __attribute__((__packed__
));
176 /* IPv4 Remote ASBR ID Sub-TLV - RFC5316 */
177 #define TE_SUBTLV_RIP 25
180 struct subtlv_header header
; /* Value length is 4 octets. */
181 struct in_addr value
; /* Remote ASBR IP address */
182 } __attribute__((__packed__
));
185 /* TE Metric Extensions - RFC 7810 */
186 /* Link Sub-TLV: Average Link Delay */
187 #define TE_SUBTLV_AV_DELAY 33
188 struct te_subtlv_av_delay
190 struct subtlv_header header
; /* Value length is 4 bytes. */
191 u_int32_t value
; /* Average delay in micro-seconds only 24 bits => 0 ... 16777215
192 with Anomalous Bit (A) as Upper most bit */
193 } __attribute__((__packed__
));
195 /* Link Sub-TLV: Low/High Link Delay */
196 #define TE_SUBTLV_MM_DELAY 34
197 #define TE_SUBTLV_MM_DELAY_SIZE 8
198 struct te_subtlv_mm_delay
200 struct subtlv_header header
; /* Value length is 8 bytes. */
201 u_int32_t low
; /* low delay in micro-seconds only 24 bits => 0 ... 16777215
202 with Anomalous Bit (A) as Upper most bit */
203 u_int32_t high
; /* high delay in micro-seconds only 24 bits => 0 ... 16777215 */
204 } __attribute__((__packed__
));
206 /* Link Sub-TLV: Link Delay Variation i.e. Jitter */
207 #define TE_SUBTLV_DELAY_VAR 35
208 struct te_subtlv_delay_var
210 struct subtlv_header header
; /* Value length is 4 bytes. */
211 u_int32_t value
; /* interval in micro-seconds only 24 bits => 0 ... 16777215 */
212 } __attribute__((__packed__
));
214 /* Link Sub-TLV: Routine Unidirectional Link Packet Loss */
215 #define TE_SUBTLV_PKT_LOSS 36
216 struct te_subtlv_pkt_loss
218 struct subtlv_header header
; /* Value length is 4 bytes. */
219 u_int32_t value
; /* in percentage of total traffic only 24 bits (2^24 - 2)
220 with Anomalous Bit (A) as Upper most bit */
221 } __attribute__((__packed__
));
223 /* Link Sub-TLV: Unidirectional Residual Bandwidth */ /* Optional */
224 #define TE_SUBTLV_RES_BW 37
225 struct te_subtlv_res_bw
227 struct subtlv_header header
; /* Value length is 4 bytes. */
228 float value
; /* bandwidth in IEEE floating point format with units in bytes per second */
229 } __attribute__((__packed__
));
231 /* Link Sub-TLV: Unidirectional Available Bandwidth */ /* Optional */
232 #define TE_SUBTLV_AVA_BW 38
233 struct te_subtlv_ava_bw
235 struct subtlv_header header
; /* Value length is 4 octets. */
236 float value
; /* bandwidth in IEEE floating point format with units in bytes per second */
237 } __attribute__((__packed__
));
239 /* Link Sub-TLV: Unidirectional Utilized Bandwidth */ /* Optional */
240 #define TE_SUBTLV_USE_BW 39
241 struct te_subtlv_use_bw
243 struct subtlv_header header
; /* Value length is 4 octets. */
244 float value
; /* bandwidth in IEEE floating point format with units in bytes per second */
245 } __attribute__((__packed__
));
247 #define TE_SUBTLV_MAX 40 /* Last SUBTLV + 1 */
249 /* Following declaration concerns the MPLS-TE and LINk-TE management */
250 typedef enum _status_t
{ disable
, enable
, learn
} status_t
;
252 /* Mode for Inter-AS LSP */ /* TODO: Check how if LSP is flooded in RFC5316 */
253 typedef enum _interas_mode_t
{ off
, region
, as
, emulate
} interas_mode_t
;
255 #define IS_MPLS_TE(m) (m.status == enable)
256 #define IS_CIRCUIT_TE(c) (c->status == enable)
258 /* Following structure are internal use only. */
261 /* Status of MPLS-TE: enable or disable */
264 /* L1, L1-L2, L2-Only */
268 interas_mode_t inter_as
;
269 struct in_addr interas_areaid
;
271 /* Circuit list on which TE are enable */
272 struct list
*cir_list
;
274 /* MPLS_TE router ID */
275 struct in_addr router_id
;
278 extern struct isis_mpls_te isisMplsTE
;
280 struct mpls_te_circuit
283 /* Status of MPLS-TE on this interface */
286 /* Type of MPLS-TE circuit: STD_TE(RFC5305), INTER_AS(RFC5316), INTER_AS_EMU(RFC5316 emulated) */
289 /* Total size of sub_tlvs */
292 /* Store subTLV in network byte order. */
294 struct te_subtlv_admin_grp admin_grp
;
296 struct te_subtlv_llri llri
;
298 struct te_subtlv_local_ipaddr local_ipaddr
;
299 struct te_subtlv_rmt_ipaddr rmt_ipaddr
;
300 struct te_subtlv_max_bw max_bw
;
301 struct te_subtlv_max_rsv_bw max_rsv_bw
;
302 struct te_subtlv_unrsv_bw unrsv_bw
;
303 struct te_subtlv_te_metric te_metric
;
305 struct te_subtlv_ras ras
;
306 struct te_subtlv_rip rip
;
308 struct te_subtlv_av_delay av_delay
;
309 struct te_subtlv_mm_delay mm_delay
;
310 struct te_subtlv_delay_var delay_var
;
311 struct te_subtlv_pkt_loss pkt_loss
;
312 struct te_subtlv_res_bw res_bw
;
313 struct te_subtlv_ava_bw ava_bw
;
314 struct te_subtlv_use_bw use_bw
;
318 void isis_mpls_te_init (void);
319 struct mpls_te_circuit
*mpls_te_circuit_new(void);
320 void mpls_te_print_detail(struct vty
*, struct te_is_neigh
*);
321 void set_circuitparams_local_ipaddr (struct mpls_te_circuit
*, struct in_addr
);
322 void set_circuitparams_rmt_ipaddr (struct mpls_te_circuit
*, struct in_addr
);
323 u_char
subtlvs_len (struct mpls_te_circuit
*);
324 u_char
add_te_subtlvs(u_char
*, struct mpls_te_circuit
*);
325 u_char
build_te_subtlvs(u_char
*, struct isis_circuit
*);
326 void isis_link_params_update(struct isis_circuit
*, struct interface
*);
327 void isis_mpls_te_update(struct interface
*);
328 void isis_mpls_te_config_write_router (struct vty
*);
330 #endif /* _ZEBRA_ISIS_MPLS_TE_H */