MCPcopy Create free account
hub / github.com/SNAS/openbmp / decodeType_EVPN

Method decodeType_EVPN

Server/src/bgp/ExtCommunity.cpp:303–350  ·  view source on GitHub ↗

* Decode EVPN subtypes * * \details * Converts to human readable form. * * \param [in] ec_hdr Reference to the extended community header * * \return Decoded string value */

Source from the content-addressed store, hash-verified

301 * \return Decoded string value
302 */
303 std::string ExtCommunity::decodeType_EVPN(const extcomm_hdr &ec_hdr) {
304 std::stringstream val_ss;
305 uint32_t val_32b;
306
307 switch(ec_hdr.low_type) {
308 case EXT_EVPN_MAC_MOBILITY: {
309 val_ss << "mac_mob_flags=";
310 u_char flags = ec_hdr.value[0];
311
312 val_ss << flags;
313
314 memcpy(&val_32b, ec_hdr.value + 2, 4);
315 bgp::SWAP_BYTES(&val_32b);
316
317 val_ss << " mac_mob_seq_num=";
318 val_ss << val_32b;
319 break;
320 }
321 case EXT_EVPN_MPLS_LABEL: {
322 val_ss << "esi_label_flags=";
323 u_char flags = ec_hdr.value[0];
324
325 val_ss << flags;
326
327 memcpy(&val_32b, ec_hdr.value + 3, 3);
328 bgp::SWAP_BYTES(&val_32b);
329 val_32b = val_32b >> 8;
330
331 val_ss << " esi_label=";
332 val_ss << val_32b;
333 break;
334 }
335 case EXT_EVPN_ES_IMPORT: {
336 val_ss << "es_import=" << bgp::parse_mac(ec_hdr.value);
337 break;
338 }
339 case EXT_EVPN_ROUTER_MAC: {
340 val_ss << "router_mac=" << bgp::parse_mac(ec_hdr.value);
341 break;
342 }
343 default: {
344 LOG_INFO("Extended community eVPN subtype is not implemented %d", ec_hdr.low_type);
345 break;
346 }
347 }
348
349 return val_ss.str();
350 }
351
352 /**
353 * Decode Opaque subtypes

Callers

nothing calls this directly

Calls 2

SWAP_BYTESFunction · 0.85
parse_macFunction · 0.85

Tested by

no test coverage detected