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

Method UpdateDBeVPN

Server/src/bgp/parseBGP.cpp:570–619  ·  view source on GitHub ↗

* Updates for either advertised or withdrawn Evpn NLRI's * * \param [in] remove True if the records should be deleted, false if they are to be added/updated * \param [in] nlris Reference to the list * \param [in] attrs Reference to the parsed attributes map */

Source from the content-addressed store, hash-verified

568 * \param [in] attrs Reference to the parsed attributes map
569 */
570void parseBGP::UpdateDBeVPN(bool remove, std::list<bgp::evpn_tuple> &nlris,
571 bgp_msg::UpdateMsg::parsed_attrs_map &attrs) {
572
573 vector<MsgBusInterface::obj_evpn> rib_list;
574 MsgBusInterface::obj_evpn rib_entry;
575
576 /*
577 * Loop through all vpn and add/update them in the DB
578 */
579 for (std::list<bgp::evpn_tuple>::iterator it = nlris.begin();
580 it != nlris.end();
581 it++) {
582 bgp::evpn_tuple &tuple = (*it);
583
584 memcpy(rib_entry.path_attr_hash_id, path_hash_id, sizeof(rib_entry.path_attr_hash_id));
585 memcpy(rib_entry.peer_hash_id, p_entry->hash_id, sizeof(rib_entry.peer_hash_id));
586
587 rib_entry.rd_type = tuple.rd_type;
588 rib_entry.rd_assigned_number = tuple.rd_assigned_number;
589 rib_entry.rd_administrator_subfield = tuple.rd_administrator_subfield;
590
591 strcpy(rib_entry.ethernet_tag_id_hex, tuple.ethernet_tag_id_hex.c_str());
592 rib_entry.mpls_label_1 = tuple.mpls_label_1;
593 rib_entry.mac_len = tuple.mac_len;
594 strcpy(rib_entry.mac, tuple.mac.c_str());
595 rib_entry.ip_len = tuple.ip_len;
596 strcpy(rib_entry.ip, tuple.ip.c_str());
597 rib_entry.mpls_label_2 = tuple.mpls_label_2;
598 rib_entry.originating_router_ip_len = tuple.originating_router_ip_len;
599 strcpy(rib_entry.originating_router_ip, tuple.originating_router_ip.c_str());
600 strcpy(rib_entry.ethernet_segment_identifier, tuple.ethernet_segment_identifier.c_str());
601
602
603 rib_entry.path_id = tuple.path_id;
604
605 SELF_DEBUG("%s: %s evpn mac=%s ip=%s", p_entry->peer_addr,
606 remove ? "removing" : "adding", rib_entry.mac, rib_entry.ip);
607
608 // Add entry to the list
609 rib_list.insert(rib_list.end(), rib_entry);
610 }
611
612 // Update the DB
613 if (rib_list.size() > 0)
614 mbus_ptr->update_eVPN(*p_entry, rib_list, &base_attr,
615 remove ? mbus_ptr->VPN_ACTION_DEL : mbus_ptr->VPN_ACTION_ADD);
616
617 rib_list.clear();
618 nlris.clear();
619}
620
621
622/**

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.80
update_eVPNMethod · 0.80

Tested by

no test coverage detected