7 #include <boost/assign/list_of.hpp>
8 #include <boost/foreach.hpp>
42 #include "control-node/sandesh/control_node_types.h"
44 #include "schema/xmpp_multicast_types.h"
45 #include "schema/xmpp_enet_types.h"
46 #include "schema/xmpp_mvpn_types.h"
51 #include "xmpp/sandesh/xmpp_peer_info_types.h"
53 using autogen::EnetItemType;
54 using autogen::EnetNextHopListType;
55 using autogen::EnetSecurityGroupListType;
56 using autogen::EnetTunnelEncapsulationListType;
58 using autogen::McastItemType;
59 using autogen::McastNextHopsType;
60 using autogen::McastTunnelEncapsulationListType;
62 using autogen::MvpnItemType;
63 using autogen::MvpnNextHopType;
64 using autogen::MvpnTunnelEncapsulationListType;
66 using autogen::ItemType;
67 using autogen::NextHopListType;
68 using autogen::SecurityGroupListType;
69 using autogen::CommunityTagListType;
70 using autogen::TunnelEncapsulationListType;
71 using autogen::TagListType;
73 using boost::assign::list_of;
75 using boost::system::error_code;
80 using std::unique_ptr;
82 using std::numeric_limits;
83 using std::ostringstream;
97 if (local_pref == 100)
99 if (local_pref == 200)
101 return numeric_limits<uint32_t>::max() - local_pref;
109 ++inet6_rx_bad_prefix_count;
113 ++inet6_rx_bad_nexthop_count;
117 ++inet6_rx_bad_afi_safi_count;
121 return inet6_rx_bad_xml_token_count;
125 return inet6_rx_bad_prefix_count;
129 return inet6_rx_bad_nexthop_count;
133 return inet6_rx_bad_afi_safi_count;
274 XmppPeerInfoData peer_info;
276 peer_info.set_deleted(
true);
279 PeerStatsData peer_stats_data;
280 peer_stats_data.set_name(
ToUVEKey());
281 peer_stats_data.set_deleted(
true);
282 assert(!peer_stats_data.get_name().empty());
283 BGP_UVE_SEND2(PeerStatsUve, peer_stats_data,
"ObjectXmppPeerInfo");
297 const std::string *msg_str);
298 virtual bool SendUpdate(
const uint8_t *msg,
size_t msgsize) {
325 uint32_t path_flags)
const {
351 virtual void Close(
bool graceful);
367 if (remote.address().is_v4()) {
368 return remote.address().to_v4().to_ulong();
393 return std::vector<std::string>();
431 static char *skip_env_ = getenv(
"XMPP_SKIP_UPDATE_SEND");
446 const string *msg_str) {
449 parent_->stats_[
TX].rt_updates++;
450 if (parent_->SkipUpdateSend())
460 if (parent_->eor_send_timer_ && parent_->eor_send_timer_->running())
461 parent_->eor_send_timer_->Cancel();
471 parent_->set_peer_closed(
true);
481 parent_->ClearEndOfRibState();
483 parent_->peer_close_->Close(graceful);
510 TaskScheduler::GetInstance()->GetTaskId(
"xmpp::StateMachine"),
519 "EndOfRib receive timer",
524 "EndOfRib send timer",
558 assert(!peer_info.get_name().empty());
599 assert(instance_mgr);
615 rt_instance, &sub_state->
targets);
637 *addrp = IpAddress::from_string(address, error);
641 return (zero_ok ?
true : !addrp->is_unspecified());
648 int *instance_id, uint64_t *subscription_gen_id,
RequestType *req_type) {
650 *subscription_gen_id = 0;
661 instance_id, subscription_gen_id);
687 const string &table_name) {
688 TableMembershipRequestMap::iterator loc =
699 const string &table_name)
const {
700 TableMembershipRequestMap::const_iterator loc =
726 InstanceMembershipRequestMap::const_iterator loc =
742 int *instance_id, uint64_t *subscription_gen_id,
bool *subscribe_pending,
745 *subscribe_pending =
false;
750 *table = rt_instance->
GetTable(family);
751 if (rt_instance != NULL && !rt_instance->
deleted()) {
754 subscription_gen_id, &req_type)) {
759 "Received route after unsubscribe");
762 *subscribe_pending =
true;
765 if (*instance_id < 0) {
768 "Received route without subscribe");
780 *subscribe_pending =
true;
781 }
else if (add_change || !rt_instance) {
792 const pugi::xml_node &node,
bool add_change) {
796 if (!item.XmlParse(node)) {
804 "Unsupported address family " << item.entry.nlri.af <<
805 " for multicast route");
812 item.entry.nlri.safi <<
" for multicast route");
817 IpAddress grp_address = IpAddress::from_string(
"0.0.0.0", error);
818 if (!item.entry.nlri.group.empty()) {
820 item.entry.nlri.group, &grp_address,
false)) {
822 "Bad group address " << item.entry.nlri.group);
827 IpAddress src_address = IpAddress::from_string(
"0.0.0.0", error);
828 if (!item.entry.nlri.source.empty()) {
830 item.entry.nlri.source, &src_address,
true)) {
832 "Bad source address " << item.entry.nlri.source);
837 bool subscribe_pending;
839 uint64_t subscription_gen_id;
842 &subscription_gen_id, &subscribe_pending, add_change)) {
848 uint16_t cluster_seed =
859 grp_address.to_v4(), src_address.to_v4());
867 string label_range(
"none");
871 vector<uint32_t> labels;
872 const McastNextHopsType &inh_list = item.entry.next_hops;
874 if (inh_list.next_hop.empty()) {
882 if (inh_list.next_hop.size() != 1) {
884 "More than one nexthop received for multicast route " <<
889 McastNextHopsType::const_iterator nit = inh_list.begin();
892 label_range = nit->label;
894 labels.size() != 2) {
896 "Bad label range " << label_range <<
897 " for multicast route " << mc_prefix.
ToString());
901 if (!labels[0] || !labels[1] || labels[1] < labels[0]) {
904 " for multicast route " << mc_prefix.
ToString());
912 attrs.push_back(&attr_label);
919 " for multicast route " << mc_prefix.
ToString());
923 attrs.push_back(&nexthop);
926 bool no_tunnel_encap =
true;
927 bool no_valid_tunnel_encap =
true;
928 for (McastTunnelEncapsulationListType::const_iterator eit =
929 nit->tunnel_encapsulation_list.begin();
930 eit != nit->tunnel_encapsulation_list.end(); ++eit) {
931 no_tunnel_encap =
false;
935 no_valid_tunnel_encap =
false;
941 if (!no_tunnel_encap && no_valid_tunnel_encap) {
946 attrs.push_back(&ext);
950 attr, flags, 0, 0, subscription_gen_id));
958 if (subscribe_pending) {
960 request_entry->
Swap(&req);
964 make_pair(vrf_name, table_name), request_entry));
971 "Multicast group " << item.entry.nlri.group <<
972 " source " << item.entry.nlri.source <<
973 " and label range " << label_range <<
974 " enqueued for " << (add_change ?
"add/change" :
"delete"));
980 IpAddress src_address,
bool add_change, uint64_t subscription_gen_id,
981 int instance_id,
DBRequest& req,
const MvpnNextHopType &nexthop) {
984 grp_address.to_v4(), src_address.to_v4());
1002 attrs.push_back(&source_rd);
1005 attr, flags, 0, 0, subscription_gen_id));
1014 IpAddress src_address,
bool add_change, uint64_t subscription_gen_id,
1018 grp_address.to_v4(), src_address.to_v4());
1031 attrs.push_back(&nexthop);
1035 attr, flags, 0, 0, subscription_gen_id));
1044 const pugi::xml_node &node,
bool add_change) {
1048 if (!item.XmlParse(node)) {
1056 "Unsupported address family " << item.entry.nlri.af <<
1057 " for multicast route");
1064 item.entry.nlri.safi <<
" for multicast route");
1068 if (item.entry.nlri.group.empty()) {
1070 "Mandatory group address not specified");
1075 IpAddress grp_address = IpAddress::from_string(
"0.0.0.0", error);
1077 item.entry.nlri.group, &grp_address,
false)) {
1079 "Bad group address " << item.entry.nlri.group);
1083 if (item.entry.nlri.source.empty()) {
1085 "Mandatory source address not specified");
1089 IpAddress src_address = IpAddress::from_string(
"0.0.0.0", error);
1091 item.entry.nlri.source, &src_address,
true)) {
1093 "Bad source address " << item.entry.nlri.source);
1097 bool subscribe_pending;
1099 uint64_t subscription_gen_id;
1102 &subscription_gen_id, &subscribe_pending, add_change)) {
1107 int rt_type = item.entry.nlri.route_type;
1112 subscription_gen_id, req);
1115 subscription_gen_id, instance_id, req, item.entry.next_hop);
1118 "Unsupported route type " << item.entry.nlri.route_type);
1127 if (subscribe_pending) {
1129 request_entry->
Swap(&req);
1133 make_pair(vrf_name, table_name), request_entry));
1139 "Multicast group " << item.entry.nlri.group <<
1140 " source " << item.entry.nlri.source <<
1141 " enqueued for " << (add_change ?
"add/change" :
"delete"));
1147 const pugi::xml_node &node,
bool add_change,
int primary_instance_id) {
1151 if (!item.XmlParse(node)) {
1153 "Invalid inet route message received");
1159 "Unsupported address family " << item.entry.nlri.af <<
1160 " for inet route " << item.entry.nlri.address);
1167 "Unsupported subsequent address family " << item.entry.nlri.safi <<
1168 " for inet route " << item.entry.nlri.address);
1176 "Bad inet route " << item.entry.nlri.address);
1180 if (add_change && item.entry.next_hops.next_hop.empty()) {
1182 "Missing next-hops for inet route " << inet_prefix.
ToString());
1191 bool subscribe_pending;
1193 uint64_t subscription_gen_id;
1196 item.entry.nlri.safi);
1198 &subscription_gen_id, &subscribe_pending, add_change)) {
1217 const NextHopListType &inh_list = item.entry.next_hops;
1220 if (inh_list.next_hop.size() != 1) {
1223 "More than one nexthop received for inet route " <<
1228 NextHopListType::const_iterator nit = inh_list.begin();
1234 "Bad nexthop address " << nit->address <<
1235 " for inet route " << inet_prefix.
ToString());
1240 ((master && nit->label) &&
1244 "Bad label " << nit->label <<
1245 " for inet route " << inet_prefix.
ToString());
1252 "Bad label " << nit->label <<
1253 " for inet route in master instance(mpls)/non master instance" <<
1258 nh_address = nhop_address;
1262 bool no_tunnel_encap =
true;
1263 bool no_valid_tunnel_encap =
true;
1264 for (TunnelEncapsulationListType::const_iterator eit =
1265 nit->tunnel_encapsulation_list.begin();
1266 eit != nit->tunnel_encapsulation_list.end(); ++eit) {
1267 no_tunnel_encap =
false;
1271 no_valid_tunnel_encap =
false;
1277 if (!no_tunnel_encap && no_valid_tunnel_encap && !master) {
1282 if (!nit->mac.empty()) {
1288 "Bad next-hop mac address " << nit->mac);
1291 if (!mac_addr.
IsZero()) {
1298 uint64_t tag_val = 0;
1299 for (TagListType::const_iterator tit = nit->tag_list.begin();
1300 tit != nit->tag_list.end(); ++tit) {
1301 tag_val = nit->is_new_tags_list ? *tit :
1302 ((0xFFFF0000 & *tit) << 16) | (0x0000FFFF & *tit);
1310 if (nit->local_sequence_number) {
1317 attrs.push_back(&local_pref);
1321 uint32_t med_value = item.entry.med;
1326 attrs.push_back(&med);
1329 const CommunityTagListType &ict_list = item.entry.community_tag_list;
1330 for (CommunityTagListType::const_iterator cit = ict_list.begin();
1331 cit != ict_list.end(); ++cit) {
1333 uint32_t rt_community =
1340 uint32_t addr = nh_address.to_v4().to_ulong();
1342 attrs.push_back(&nexthop);
1343 uint16_t cluster_seed =
1346 if (!master || primary_instance_id) {
1348 instance_id = primary_instance_id;
1356 attrs.push_back(&source_rd);
1360 uint16_t sg_index = 0;
1361 const SecurityGroupListType &isg_list = item.entry.security_group_list;
1362 for (SecurityGroupListType::const_iterator sit = isg_list.begin();
1363 sit != isg_list.end(); ++sit) {
1376 if (item.entry.mobility.seqno) {
1378 item.entry.mobility.sticky);
1380 }
else if (item.entry.sequence_number) {
1386 LoadBalance load_balance(item.entry.load_balance);
1391 attrs.push_back(&comm);
1393 attrs.push_back(&ext);
1395 attrs.push_back(&largecomm);
1399 attrs.push_back(&sbp);
1403 attr, flags, label, 0, subscription_gen_id));
1409 if (subscribe_pending) {
1411 request_entry->
Swap(&req);
1415 make_pair(vrf_name, table_name), request_entry));
1422 "Inet route " << item.entry.nlri.address <<
1423 " with next-hop " << nh_address <<
" and label " << label <<
1424 " enqueued for " << (add_change ?
"add/change" :
"delete") <<
1425 " to table " << table->
name());
1438 const pugi::xml_node &node,
bool add_change) {
1442 if (!item.XmlParse(node)) {
1445 "Invalid inet6 route message received");
1452 "Unsupported address family " << item.entry.nlri.af <<
1453 " for inet6 route " << item.entry.nlri.address);
1460 "Unsupported subsequent address family " << item.entry.nlri.safi <<
1461 " for inet6 route " << item.entry.nlri.address);
1471 "Bad inet6 route " << item.entry.nlri.address);
1475 if (add_change && item.entry.next_hops.next_hop.empty()) {
1477 "Missing next-hops for inet6 route " << inet6_prefix.
ToString());
1490 bool subscribe_pending;
1492 uint64_t subscription_gen_id;
1495 &subscription_gen_id, &subscribe_pending, add_change)) {
1520 const NextHopListType &inh_list = item.entry.next_hops;
1523 if (inh_list.next_hop.size() != 1) {
1526 "More than one nexthop received for inet6 route " <<
1531 NextHopListType::const_iterator nit = inh_list.begin();
1538 "Bad nexthop address " << nit->address <<
1539 " for inet6 route " << inet6_prefix.
ToString());
1547 "Bad label " << nit->vni <<
1548 " for inet6 route " << inet6_prefix.
ToString());
1553 if (nit->mac.empty())
1561 "Bad next-hop mac address " << nit->mac);
1570 "Bad label " << nit->label <<
1571 " for inet6 route " << inet6_prefix.
ToString());
1574 if (!master && !nit->label)
1578 nh_address = nhop_address;
1586 bool no_tunnel_encap =
true;
1587 bool no_valid_tunnel_encap =
true;
1588 for (TunnelEncapsulationListType::const_iterator eit =
1589 nit->tunnel_encapsulation_list.begin();
1590 eit != nit->tunnel_encapsulation_list.end(); ++eit) {
1591 no_tunnel_encap =
false;
1595 no_valid_tunnel_encap =
false;
1601 if (!no_tunnel_encap && no_valid_tunnel_encap && !master) {
1606 if (!nit->mac.empty()) {
1612 "Bad next-hop mac address " << nit->mac);
1615 if (!mac_addr.
IsZero()) {
1622 uint64_t tag_val = 0;
1623 for (TagListType::const_iterator tit = nit->tag_list.begin();
1624 tit != nit->tag_list.end(); ++tit) {
1625 tag_val = nit->is_new_tags_list ? *tit :
1626 ((0xFFFF0000 & *tit) << 16) | (0x0000FFFF & *tit);
1628 for (
const auto &value_data :
1635 if (nit->local_sequence_number) {
1642 attrs.push_back(&local_pref);
1646 uint32_t med_value = item.entry.med;
1651 attrs.push_back(&med);
1654 const CommunityTagListType &ict_list =
1655 item.entry.community_tag_list;
1656 for (CommunityTagListType::const_iterator cit = ict_list.begin();
1657 cit != ict_list.end(); ++cit) {
1659 uint32_t rt_community =
1667 attrs.push_back(&nexthop);
1671 uint32_t addr = nh_address.to_v4().to_ulong();
1672 uint16_t cluster_seed =
1681 attrs.push_back(&source_rd);
1685 const SecurityGroupListType &isg_list =
1686 item.entry.security_group_list;
1687 uint16_t sg_index = 0;
1688 for (SecurityGroupListType::const_iterator sit = isg_list.begin();
1689 sit != isg_list.end(); ++sit) {
1702 if (item.entry.mobility.seqno) {
1704 item.entry.mobility.sticky);
1706 }
else if (item.entry.sequence_number) {
1712 LoadBalance load_balance(item.entry.load_balance);
1718 attrs.push_back(&sbp);
1721 attrs.push_back(&comm);
1723 attrs.push_back(&ext);
1725 attrs.push_back(&largecomm);
1729 attr, flags, label, 0, subscription_gen_id));
1735 if (subscribe_pending) {
1737 request_entry->
Swap(&req);
1741 make_pair(vrf_name, table_name), request_entry));
1748 "Inet6 route " << item.entry.nlri.address <<
1749 " with next-hop " << nh_address <<
" and label " << label <<
1750 " enqueued for " << (add_change ?
"add/change" :
"delete") <<
1751 " to table " << table->
name());
1765 const pugi::xml_node &node,
bool add_change) {
1769 if (!item.XmlParse(node)) {
1771 "Invalid enet route message received");
1777 "Unsupported address family " << item.entry.nlri.af <<
1778 " for enet route " << item.entry.nlri.address);
1784 "Unsupported subsequent address family " << item.entry.nlri.safi <<
1785 " for enet route " << item.entry.nlri.mac);
1791 IpAddress group= IpAddress::from_string(
"0.0.0.0", error);
1792 if (!item.entry.nlri.group.empty()) {
1795 item.entry.nlri.group, &group,
false)) {
1797 "Bad group address " << item.entry.nlri.group);
1801 IpAddress source = IpAddress::from_string(
"0.0.0.0", error);
1803 item.entry.nlri.af, item.entry.nlri.source, &source,
true)) {
1805 "Bad source address " << item.entry.nlri.source);
1813 "Bad mac address " << item.entry.nlri.mac);
1817 bool type2 = type6 ? false : !mac_addr.
IsZero();
1822 if (!item.entry.nlri.address.empty()) {
1823 size_t pos = item.entry.nlri.address.find(
'/');
1824 if (pos == string::npos) {
1826 "Missing / in address " << item.entry.nlri.address);
1830 bool ipv6 = item.entry.nlri.address.find(
':') != string::npos;
1837 "Cannot parse inet prefix string " <<
1838 item.entry.nlri.address);
1842 if (type2 && inet_prefix.
prefixlen() != 32 &&
1843 item.entry.nlri.address !=
"0.0.0.0/0") {
1846 "Bad inet address " << item.entry.nlri.address);
1859 "Cannot parse inet6 prefix string " <<
1860 item.entry.nlri.address);
1864 if (type2 && inet6_prefix.
prefixlen() != 128 &&
1865 item.entry.nlri.address !=
"::/0") {
1868 "Bad inet6 address " << item.entry.nlri.address);
1876 bool subscribe_pending;
1878 uint64_t subscription_gen_id;
1881 &subscription_gen_id, &subscribe_pending, add_change)) {
1896 uint32_t ethernet_tag = item.entry.nlri.ethernet_tag;
1900 type2 ?
EvpnPrefix(rd, ethernet_tag, mac_addr, ip_addr) :
1910 uint32_t l3_label = 0;
1916 const EnetNextHopListType &inh_list = item.entry.next_hops;
1918 if (inh_list.next_hop.empty()) {
1926 if (inh_list.next_hop.size() != 1) {
1929 "More than one nexthop received for enet route " <<
1934 EnetNextHopListType::const_iterator nit = inh_list.begin();
1945 nh_address = nhop_address;
1947 l3_label = nit->l3_label;
1948 if (!nit->mac.empty()) {
1954 "Bad next-hop mac address " << nit->mac <<
1963 bool no_tunnel_encap =
true;
1964 bool no_valid_tunnel_encap =
true;
1965 for (EnetTunnelEncapsulationListType::const_iterator eit =
1966 nit->tunnel_encapsulation_list.begin();
1967 eit != nit->tunnel_encapsulation_list.end(); ++eit) {
1968 no_tunnel_encap =
false;
1972 no_valid_tunnel_encap =
false;
1982 if (!no_tunnel_encap && no_valid_tunnel_encap) {
1987 uint64_t tag_val = 0;
1988 for (TagListType::const_iterator tit = nit->tag_list.begin();
1989 tit != nit->tag_list.end(); ++tit) {
1990 tag_val = nit->is_new_tags_list ? *tit :
1991 ((0x0000FFFF0000 & *tit) << 16) |
1992 (0x00000000FFFF & *tit);
2000 if (nit->local_sequence_number) {
2007 attrs.push_back(&local_pref);
2012 uint32_t med_value = item.entry.med;
2017 attrs.push_back(&med);
2022 if (item.entry.replicator_address.empty() &&
2023 item.entry.edge_replication_not_supported) {
2025 flags &= ~
BgpPath::CheckGlobalErmVpnRoute;
2026 attrs.push_back(&nexthop);
2029 attrs.push_back(&nexthop);
2036 nh_address.to_v4().to_ulong(), instance_id));
2039 nh_address.to_v4().to_ulong(), instance_id));
2041 attrs.push_back(&source_rd);
2044 const EnetSecurityGroupListType &isg_list =
2045 item.entry.security_group_list;
2046 uint16_t sg_index = 0;
2047 for (EnetSecurityGroupListType::const_iterator sit = isg_list.begin();
2048 sit != isg_list.end(); ++sit) {
2061 if (item.entry.mobility.seqno) {
2063 item.entry.mobility.sticky);
2065 }
else if (item.entry.sequence_number) {
2070 ETree etree(item.entry.etree_leaf);
2074 attrs.push_back(&ext);
2076 attrs.push_back(&largecomm);
2080 if (!item.entry.replicator_address.empty()) {
2083 item.entry.replicator_address, &replicator_address)) {
2086 "Bad replicator address " <<
2087 item.entry.replicator_address <<
2097 if (item.entry.assisted_replication_supported) {
2101 if (!item.entry.edge_replication_not_supported) {
2108 pmsi_spec.
SetLabel(label, &ext_comm);
2109 attrs.push_back(&pmsi_spec);
2115 attr, flags, label, l3_label, subscription_gen_id));
2123 if (subscribe_pending) {
2125 request_entry->
Swap(&req);
2129 make_pair(vrf_name, table_name), request_entry));
2137 " with next-hop " << nh_address <<
2138 " label " << label <<
" l3-label " << l3_label <<
2139 " enqueued for " << (add_change ?
"add/change" :
"delete"));
2146 unique_ptr<DBRequest> ptr(request);
2150 if (table == NULL || table->
IsDeleted()) {
2156 int instance_id = -1;
2157 uint64_t subscription_gen_id = 0;
2159 &instance_id, &subscription_gen_id);
2160 if (!is_registered) {
2163 "Not subscribed to table " << table->
name());
2168 ->set_subscription_gen_id(subscription_gen_id);
2193 "Subscribe to table " << table->
name() <<
2194 (tmr_state->
no_ribout ?
" (no ribout)" :
"") <<
2225 "Unsubscribe to table " << table->
name());
2230 #define RegisterTable(table, tmr_state) \
2231 RegisterTable(__LINE__, table, tmr_state)
2232 #define UnregisterTable(table) UnregisterTable(__LINE__, table)
2237 BOOST_FOREACH(TableMembershipRequestMap::value_type &entry,
2266 "Table not in subscribe/unsubscribe request queue");
2273 "Subscribe to table " << table_name <<
" completed");
2278 "Unsubscribe to table " << table_name <<
" completed");
2344 assert(
defer_q_.count(vrf_n_table) == 0);
2353 for (DeferQ::iterator it =
defer_q_.find(vrf_n_table);
2354 it !=
defer_q_.end() && it->first.second == table->
name(); ++it) {
2373 vector<BgpNeighborRoutingInstance> instance_list;
2374 BOOST_FOREACH(
const SubscribedRoutingInstanceList::value_type &entry,
2376 BgpNeighborRoutingInstance instance;
2377 instance.set_name(entry.first->name());
2378 if (entry.second.IsLlgrStale()) {
2379 instance.set_state(
"subscribed-llgr-stale");
2380 }
else if (entry.second.IsGrStale()) {
2381 instance.set_state(
"subscribed-gr-stale");
2383 instance.set_state(
"subscribed");
2385 instance.set_index(entry.second.index);
2387 instance_list.push_back(instance);
2389 BOOST_FOREACH(
const InstanceMembershipRequestMap::value_type &entry,
2392 BgpNeighborRoutingInstance instance;
2393 instance.set_name(entry.first);
2394 instance.set_state(
"pending");
2396 instance_list.push_back(instance);
2398 resp->set_routing_instances(instance_list);
2402 vector<BgpNeighborRoutingTable> old_table_list = resp->get_routing_tables();
2403 set<string> old_table_set;
2404 vector<BgpNeighborRoutingTable> new_table_list;
2406 BOOST_FOREACH(
const BgpNeighborRoutingTable &table, old_table_list) {
2407 old_table_set.insert(table.get_name());
2409 new_table_list.push_back(table);
2412 BOOST_FOREACH(
const TableMembershipRequestMap::value_type &entry,
2414 BgpNeighborRoutingTable table;
2415 table.set_name(entry.first);
2416 if (old_table_set.find(entry.first) != old_table_set.end())
2417 table.set_current_state(
"subscribed");
2420 table.set_current_request(
"subscribe");
2422 table.set_current_request(
"unsubscribe");
2425 table.set_pending_request(
"subscribe");
2427 table.set_pending_request(
"unsubscribe");
2429 new_table_list.push_back(table);
2431 resp->set_routing_tables(new_table_list);
2438 for (DeferQ::iterator it =
2439 defer_q_.find(make_pair(vrf_name, table_name)), itnext;
2440 (it !=
defer_q_.end() && it->first.second == table_name);
2453 for (DeferQ::iterator it =
2454 defer_q_.lower_bound(make_pair(vrf_name,
string())), itnext;
2455 (it !=
defer_q_.end() && it->first.first == vrf_name);
2468 BOOST_FOREACH(SubscribedRoutingInstanceList::value_type &entry,
2470 entry.second.SetGrStale();
2479 BOOST_FOREACH(SubscribedRoutingInstanceList::value_type &entry,
2481 assert(entry.second.IsGrStale());
2482 entry.second.SetLlgrStale();
2493 if (i->second.IsGrStale()) {
2494 string name = i->first->name();
2501 "Instance subscription " << name <<
2502 " is still stale and hence unsubscribed");
2518 "Instance subscription " << rt_instance->
name() <<
2519 " stale flag is cleared");
2527 pair<SubscribedRoutingInstanceList::iterator, bool> ret =
2529 rt_instance, state));
2546 SubscribedRoutingInstanceList::iterator loc =
2553 SubscribedRoutingInstanceList::const_iterator loc =
2564 for (RoutingInstance::RouteTableList::const_iterator it = rt_list.begin();
2565 it != rt_list.end(); ++it) {
2580 int instance_id = -1;
2581 bool no_ribout =
false;
2586 for (xml_node node =
options.first_child(); node;
2587 node = node.next_sibling()) {
2588 if (strcmp(node.name(),
"instance-id") == 0) {
2589 instance_id = node.text().as_int();
2591 if (strcmp(node.name(),
"no-ribout") == 0) {
2592 no_ribout = node.text().as_bool();
2598 assert(instance_mgr);
2600 if (rt_instance == NULL) {
2603 "Routing instance " << vrf_name <<
2604 " not found when processing " <<
2605 (add_change ?
"subscribe" :
"unsubscribe"));
2610 "Duplicate subscribe for routing instance " <<
2611 vrf_name <<
", triggering close");
2625 "Spurious unsubscribe for routing instance " <<
2626 vrf_name <<
", triggering close");
2631 }
else if (rt_instance->
deleted()) {
2634 "Routing instance " << vrf_name <<
2635 " is being deleted when processing " <<
2636 (add_change ?
"subscribe" :
"unsubscribe"));
2641 "Duplicate subscribe for routing instance " <<
2642 vrf_name <<
", triggering close");
2647 "Duplicate subscribe for routing instance " <<
2648 vrf_name <<
", triggering close");
2668 "Spurious unsubscribe for routing instance " <<
2669 vrf_name <<
", triggering close");
2683 "Duplicate subscribe for routing instance " <<
2684 vrf_name <<
", triggering close");
2691 "Duplicate subscribe for routing instance " <<
2692 vrf_name <<
" under GR, triggering close");
2702 "Spurious unsubscribe for routing instance " <<
2703 vrf_name <<
", triggering close");
2719 for (RoutingInstance::RouteTableList::const_iterator it = rt_list.begin();
2720 it != rt_list.end(); ++it) {
2739 if (
defer_q_.count(make_pair(vrf_name, table->
name()))) {
2742 "Flush deferred route requests for table " <<
2743 table->
name() <<
" on unsubscribe");
2777 string error_message) {
2779 "Timer error: " << error_name <<
" " << error_message);
2783 if (!
peer_->IsReady())
2801 "EndOfRib Receive timer rescheduled to fire after " <<
2820 if (!
peer_->IsReady())
2835 "EndOfRib Send timer rescheduled to fire after " <<
2854 timeout <<
" second(s)");
2865 if (!
peer_->send_ready())
2892 msg +=
"\n<message from=\"";
2895 msg +=
peer_->ToString();
2899 msg +=
"\n\t<event xmlns=\"http://jabber.org/protocol/pubsub\">";
2902 msg +=
"\n\t</event>\n</message>\n";
2914 bool expect_prefix_len)
const {
2917 char *str =
const_cast<char *
>(s.c_str());
2918 char *saveptr, *token;
2919 token = strtok_r(str,
"/", &saveptr);
2920 if (!token || !saveptr)
2922 token = strtok_r(NULL,
"/", &saveptr);
2923 if (!token || !saveptr)
2925 token = strtok_r(NULL,
"/", &saveptr);
2926 if (!token || !saveptr)
2928 token = strtok_r(NULL,
"/", &saveptr);
2929 if (!token || !saveptr)
2931 if (expect_prefix_len) {
2932 token = strtok_r(NULL,
"/", &saveptr);
2933 if (!token || !saveptr)
2936 token = strtok_r(NULL,
"/", &saveptr);
2939 return strtoul(token, NULL, 0);
2957 if (iq->
iq_type.compare(
"set") == 0) {
2958 if (iq->
action.compare(
"subscribe") == 0) {
2960 }
else if (iq->
action.compare(
"unsubscribe") == 0) {
2962 }
else if (iq->
action.compare(
"publish") == 0) {
2966 xml_node item =
pugi->FindNode(
"item");
2972 "EndOfRib marker received");
2977 for (; item; item = item.next_sibling()) {
2978 if (strcmp(item.name(),
"item") != 0)
continue;
2980 string id(iq->
as_node.c_str());
2981 char *str =
const_cast<char *
>(
id.c_str());
2983 char *af = strtok_r(str,
"/", &saveptr);
2984 char *safi = strtok_r(NULL,
"/", &saveptr);
3021 : xmpp_server_(xmpp_server),
3022 bgp_server_(server),
3023 queue_(
TaskScheduler::GetInstance()->GetTaskId(
"bgp::Config"), 0,
3026 asn_listener_id_(-1),
3027 identifier_listener_id_(-1),
3028 dscp_listener_id_(-1) {
3096 as_t old_local_asn) {
3098 BOOST_FOREACH(XmppChannelMap::value_type &i,
channel_map_) {
3099 i.second->rtarget_manager()->ASNUpdateCallback(old_asn, old_local_asn);
3114 BOOST_FOREACH(XmppChannelMap::value_type &i,
channel_map_) {
3115 i.second->RoutingInstanceCallback(vrf_name, op);
3120 std::scoped_lock lock(
mutex_);
3121 BOOST_FOREACH(XmppChannelMap::value_type &i,
channel_map_) {
3128 std::scoped_lock lock(
mutex_);
3129 BOOST_FOREACH(
const XmppChannelMap::value_type &i,
channel_map_) {
3135 BOOST_FOREACH(XmppChannelMap::value_type &i,
channel_map_) {
3136 if (i.second->ToString() == client) {
3168 std::scoped_lock lock(
mutex_);
3170 XmppChannelMap::iterator it =
channel_map_.find(channel);
3175 channel_map_.insert(make_pair(channel, bgp_xmpp_channel));
3177 make_pair(channel->
ToString(), bgp_xmpp_channel));
3181 "Received XmppChannel up event");
3186 "No BGP configuration for self - closing channel");
3187 if (!getenv(
"CONTRAIL_CAT_FRAMEWORK"))
3194 "BGP is administratively down - closing channel");
3198 bgp_xmpp_channel = (*it).second;
3210 "Graceful Closure in progress - Closing channel");
3223 bgp_xmpp_channel = (*it).second;
3227 "Received XmppChannel down event");
3230 bgp_xmpp_channel->
Close();
3233 os <<
"Peer not found for " << channel->
ToString() <<
3234 " on channel down event";
3241 PeerStatsInfo stats;
3244 XmppPeerInfoData peer_info;
3246 peer_info.set_peer_stats_info(stats);
3247 assert(!peer_info.get_name().empty());
3250 PeerStatsData peer_stats_data;
3252 peer_stats_data.set_encoding(
"XMPP");
3255 assert(!peer_stats_data.get_name().empty());
3256 BGP_UVE_SEND2(PeerStatsUve, peer_stats_data,
"ObjectXmppPeerInfo");
3264 bool change =
false;
3265 uint32_t num_xmpp =
count();
3266 if (first || num_xmpp != state->get_num_xmpp_peer()) {
3267 state->set_num_xmpp_peer(num_xmpp);
3272 if (first || num_up_xmpp != state->get_num_up_xmpp_peer()) {
3273 state->set_num_up_xmpp_peer(num_up_xmpp);
3278 if (first || num_deleting_xmpp != state->get_num_deleting_xmpp_peer()) {
3279 state->set_num_deleting_xmpp_peer(num_deleting_xmpp);
3335 peer_->SetPeerClosed(flag);
3342 return peer_->IsDeleted();
3349 return peer_->closed_at();
3353 SubscribedRoutingInstanceList::const_iterator it =
3356 return it->second.IsGrStale();
3360 SubscribedRoutingInstanceList::const_iterator it =
3363 return it->second.IsLlgrStale();
3372 SubscribedRoutingInstanceList::const_iterator it =
3375 return it->second.targets;
boost::asio::ip::address IpAddress
boost::asio::ip::address_v4 Ip4Address
std::vector< BgpAttribute * > BgpAttrSpec
boost::intrusive_ptr< const BgpAttr > BgpAttrPtr
#define BGP_LOG_NOTICE(obj, flags,...)
#define BGP_LOG_FLAG_SYSLOG
#define BGP_LOG_PEER(type, peer, level, flags, dir, arg)
#define BGP_LOG_PEER_INSTANCE_WARNING(peer, instance, flags, arg)
#define BGP_LOG_PEER_INSTANCE(peer, instance, level, flags, arg)
#define BGP_LOG_PEER_WARNING(type, peer, flags, dir, arg)
#define BGP_LOG_PEER_TABLE(peer, level, flags, tbl, arg)
#define BGP_UVE_SEND2(type, object, arg)
#define BGP_LOG_FLAG_TRACE
#define BGP_UVE_SEND(type, object)
#define BGP_LOG_PEER_CRITICAL(type, peer, flags, dir, arg)
#define BGP_LOG_PEER_INSTANCE_CRITICAL(peer, instance, dir, flags, arg)
static uint32_t GetMedFromLocalPref(uint32_t local_pref)
static Address::Family AfiSafiToFamily(uint16_t afi, uint8_t safi)
static const char * kMasterInstance
uint16_t rd_cluster_seed() const
static const int kEndOfRibTime
void SetRegistrationInfo(const IPeer *peer, const BgpTable *table, int instance_id, uint64_t subscription_gen_id)
void RegisterRibIn(IPeer *peer, BgpTable *table)
virtual void Unregister(IPeer *peer, BgpTable *table)
virtual void Register(IPeer *peer, BgpTable *table, const RibExportPolicy &policy, int instance_id=-1)
bool GetRegistrationInfo(const IPeer *peer, const BgpTable *table, int *instance_id=NULL, uint64_t *subscription_gen_id=NULL) const
bool IsRibOutRegistered(const IPeer *peer, const BgpTable *table) const
TypePtr Locate(Type *attr)
ExtCommunityDB * extcomm_db()
boost::asio::io_context * ioservice()
void UnregisterAdminDownCallback(int listener)
RoutingInstanceMgr * routing_instance_mgr()
bool HasSelfConfiguration() const
int RegisterIdentifierUpdateCallback(IdentifierUpdateCb callback)
uint32_t bgp_identifier() const
BgpConfigManager * config_manager()
void UnregisterASNUpdateCallback(int listener)
int RegisterAdminDownCallback(AdminDownCb callback)
void UnregisterDSCPUpdateCallback(int listener)
as_t autonomous_system() const
BgpUpdateSender * update_sender()
int RegisterDSCPUpdateCallback(DSCPUpdateCb cb)
int RegisterASNUpdateCallback(ASNUpdateCb callback)
BgpMembershipManager * membership_mgr()
BgpGlobalSystemConfig * global_config()
bool IsReadyForDeletion()
bool DeletePath(DBTablePartBase *root, BgpRoute *rt, BgpPath *path)
void LocatePathResolver()
virtual bool IsVpnTable() const
RoutingInstance * routing_instance()
virtual Address::Family family() const =0
void PeerSendReady(IPeerUpdate *peer)
void IdentifierUpdateCallback(Ip4Address old_identifier)
virtual void XmppHandleChannelEvent(XmppChannel *channel, xmps::PeerState state)
virtual bool DeleteChannel(BgpXmppChannel *channel)
void SetQueueDisable(bool disabled)
std::atomic< int32_t > deleting_count_
void VisitChannels(BgpXmppChannelManager::VisitorFn)
uint32_t NumUpPeer() const
void RemoveChannel(XmppChannel *channel)
std::atomic< uint64_t > subscription_gen_id_
XmppServer * xmpp_server_
void FillPeerInfo(const BgpXmppChannel *channel) const
int admin_down_listener_id_
int32_t deleting_count() const
void ASNUpdateCallback(as_t old_asn, as_t old_local_asn)
BgpXmppChannel * FindChannel(const XmppChannel *channel)
void DSCPUpdateCallback(uint8_t value)
size_t GetQueueSize() const
XmppServer * xmpp_server()
WorkQueue< BgpXmppChannel * > queue_
BgpXmppChannelManager(XmppServer *, BgpServer *)
void RoutingInstanceCallback(std::string vrf_name, int op)
XmppChannelMap channel_map_
bool CollectStats(BgpRouterState *state, bool first) const
uint64_t get_subscription_gen_id()
XmppChannelNameMap channel_name_map_
int identifier_listener_id_
boost::function< void(BgpXmppChannel *)> VisitorFn
void decrement_deleting_count()
virtual ~BgpXmppChannelManager()
bool IsReadyForDeletion()
virtual BgpXmppChannel * CreateChannel(XmppChannel *channel)
virtual string ToString() const
PeerStats(BgpXmppChannel *peer)
virtual void GetRxRouteUpdateStats(UpdateStats *stats) const
virtual void GetRxErrorStats(RxErrorStats *stats) const
virtual void UpdateTxReachRoute(uint64_t count)
virtual string last_event() const
virtual void GetRxRouteStats(RxRouteStats *stats) const
virtual string last_state() const
virtual string last_error() const
virtual void GetTxProtoStats(ProtoStats *stats) const
virtual void GetTxSocketStats(IPeerDebugStats::SocketStats *stats) const
virtual uint64_t num_flaps() const
virtual void GetRxProtoStats(ProtoStats *stats) const
virtual void UpdateTxUnreachRoute(uint64_t count)
virtual string last_state_change_at() const
virtual void GetRxSocketStats(IPeerDebugStats::SocketStats *stats) const
virtual void GetTxRouteUpdateStats(UpdateStats *stats) const
virtual string last_flap() const
virtual bool IsReady() const
void MembershipRequestCallback(BgpTable *table)
virtual BgpServer * server()
virtual bool SendUpdate(const uint8_t *msg, size_t msgsize)
virtual IPeerClose * peer_close()
virtual const string & ToString() const
uint64_t closed_at() const
virtual bool send_ready() const
virtual const string GetStateName() const
virtual BgpServer * server() const
virtual int GetPrimaryPathCount() const
virtual const IPeerDebugStats * peer_stats() const
virtual const string & ToUVEKey() const
virtual BgpProto::BgpPeerType PeerType() const
virtual bool IsRegistrationRequired() const
virtual void ProcessPathTunnelEncapsulation(const BgpPath *path, BgpAttr *attr, ExtCommunityDB *extcomm_db, const BgpTable *table) const
virtual void UpdatePrimaryPathCount(int count, Address::Family family) const
virtual IPeerDebugStats * peer_stats()
std::atomic< int > total_path_count_
void SetPeerClosed(bool closed)
virtual const std::vector< std::string > GetDefaultTunnelEncap(Address::Family family) const
virtual void UpdateTotalPathCount(int count) const
virtual IPeerClose * peer_close() const
void UpdateCloseRouteStats(Address::Family family, const BgpPath *old_path, uint32_t path_flags) const
virtual bool CanUseMembershipManager() const
virtual bool SendUpdate(const uint8_t *msg, size_t msgsize, const std::string *msg_str)
void WriteReadyCb(const boost::system::error_code &ec)
virtual uint32_t bgp_identifier() const
const bool IsDeleted() const
virtual bool IsAs4Supported() const
virtual void Close(bool graceful)
XmppPeer(BgpServer *server, BgpXmppChannel *channel)
virtual int GetTotalPathCount() const
virtual bool IsXmppPeer() const
virtual bool MembershipPathCallback(DBTablePartBase *tpart, BgpRoute *rt, BgpPath *path)
std::atomic< int > primary_path_count_
bool IsRouterTypeBGPaaS() const
virtual bool IsInGRTimerWaitState() const
boost::scoped_ptr< BgpXmppPeerClose > peer_close_
RibExportPolicy bgp_policy_
Timer * eor_receive_timer_
void RoutingInstanceCallback(std::string vrf_name, int op)
virtual ~BgpXmppChannel()
bool ProcessInet6Item(std::string vrf_name, const pugi::xml_node &node, bool add_change)
BgpXmppChannel(XmppChannel *channel, BgpServer *bgp_server=NULL, BgpXmppChannelManager *manager=NULL)
void FillCloseInfo(BgpNeighborResp *resp) const
void set_deleted(bool deleted)
void XMPPPeerInfoSend(const XmppPeerInfoData &peer_info) const
size_t GetMembershipRequestQueueSize() const
void ClearStaledSubscription(RoutingInstance *rt_instance, SubscriptionState *sub_state)
virtual time_t GetEndOfRibSendTime() const
boost::scoped_ptr< BgpXmppRTargetManager > rtarget_manager_
void AddTableMembershipState(const std::string &table_name, TableMembershipRequestState tmr_state)
SubscribedRoutingInstanceList routing_instances_
TcpSession::Endpoint local_endpoint() const
TableMembershipRequestMap table_membership_request_map_
bool ProcessMvpnItem(std::string vrf_name, const pugi::xml_node &item, bool add_change)
virtual TcpSession::Endpoint endpoint() const
void UnregisterTable(int line, BgpTable *table)
PeerCloseManager * close_manager()
bool IsSubscriptionLlgrStale(RoutingInstance *instance) const
BgpXmppChannelManager * manager_
TableMembershipRequestState * GetTableMembershipState(const std::string &table_name)
void CreateType7MvpnRouteRequest(IpAddress grp_address, IpAddress src_address, bool add_change, uint64_t subscription_gen_id, DBRequest &req)
void AddSubscriptionState(RoutingInstance *rt_instance, int index)
virtual bool GetMembershipInfo(BgpTable *table, int *instance_id, uint64_t *subscribed_at, RequestType *req_type)
std::string transport_address_string() const
const XmppSession * GetSession() const
InstanceMembershipRequestMap instance_membership_request_map_
time_t eor_receive_timer_start_time_
void LlgrStaleCurrentSubscriptions()
WorkQueue< std::string > membership_response_worker_
const std::string & ToUVEKey() const
void set_peer_closed(bool flag)
void DeleteSubscriptionState(RoutingInstance *rt_instance)
uint64_t peer_closed_at() const
void AddInstanceMembershipState(const std::string &instance, InstanceMembershipRequestState imr_state)
bool ProcessItem(std::string vrf_name, const pugi::xml_node &node, bool add_change, int primary_instance_id=0)
void RegisterTable(int line, BgpTable *table, const TableMembershipRequestState *tmr_state)
bool IsSubscriptionGrStale(RoutingInstance *instance) const
ErrorStats & error_stats()
void ResetEndOfRibSendState()
void MembershipRequestCallback(BgpTable *table)
const std::string & ToString() const
bool IsSubscriptionEmpty() const
void ProcessDeferredSubscribeRequest(RoutingInstance *rt_instance, const InstanceMembershipRequestState &imr_state)
time_t eor_send_timer_start_time_
virtual const InstanceMembershipRequestState * GetInstanceMembershipState(const std::string &instance) const
const BgpXmppChannelManager * manager() const
int GetPrimaryInstanceID(const std::string &s, bool expect_prefix_len) const
void ClearEndOfRibState()
bool DeleteInstanceMembershipState(const std::string &instance)
std::pair< const std::string, const std::string > VrfTableName
bool EndOfRibReceiveTimerExpired()
TcpSession::Endpoint remote_endpoint() const
void StartEndOfRibReceiveTimer()
void SweepCurrentSubscriptions()
virtual void ReceiveUpdate(const XmppStanza::XmppMessage *msg)
size_t table_membership_requests() const
bool skip_update_send_cached_
void CreateType5MvpnRouteRequest(IpAddress grp_address, IpAddress src_address, bool add_change, uint64_t subscription_gen_id, int instance_id, DBRequest &req, const autogen::MvpnNextHopType &nh)
void ProcessPendingSubscriptions()
boost::scoped_ptr< PeerStats > peer_stats_
const RoutingInstance::RouteTargetList & GetSubscribedRTargets(RoutingInstance *instance) const
static const int kEndOfRibSendRetryTime
void FlushDeferQ(std::string vrf_name)
void ProcessSubscriptionRequest(std::string rt_instance, const XmppStanza::XmppMessageIq *iq, bool add_change)
void FillTableMembershipInfo(BgpNeighborResp *resp) const
ChannelStats channel_stats_
void EndOfRibTimerErrorHandler(std::string error_name, std::string error_message)
void ReceiveEndOfRIB(Address::Family family)
bool VerifyMembership(const std::string &vrf_name, Address::Family family, BgpTable **table, int *instance_id, uint64_t *subscribed_at, bool *subscribe_pending, bool add_change)
boost::scoped_ptr< PeerCloseManager > close_manager_
bool EndOfRibSendTimerExpired()
void FillInstanceMembershipInfo(BgpNeighborResp *resp) const
bool peer_deleted() const
bool ProcessEnetItem(std::string vrf_name, const pugi::xml_node &item, bool add_change)
bool ProcessMcastItem(std::string vrf_name, const pugi::xml_node &item, bool add_change)
const XmppChannel * channel() const
SubscriptionState * GetSubscriptionState(RoutingInstance *rt_instance)
std::string StateName() const
void StaleCurrentSubscriptions()
bool XmppDecodeAddress(int af, const std::string &address, IpAddress *addrp, bool zero_ok=false)
LabelBlockManagerPtr lb_mgr_
bool ProcessMembershipResponse(std::string table_name, TableMembershipRequestState *tmr_state)
bool MembershipResponseHandler(std::string table_name)
boost::scoped_ptr< XmppPeer > peer_
bool DeleteTableMembershipState(const std::string &table_name)
void DequeueRequest(const std::string &table_name, DBRequest *request)
bool Enqueue(DBRequest *req)
const std::string & name() const
DBTableBase * FindTable(const std::string &name)
const uint64_t GetExtCommunityValue() const
std::string ToString() const
std::string ToXmppIdString() const
static const int32_t kMaxVniSigned
virtual void UpdateRouteStats(Address::Family family, const BgpPath *old_path, uint32_t path_flags) const =0
virtual const std::string & ToUVEKey() const =0
virtual int GetTotalPathCount() const =0
virtual int GetPrimaryPathCount() const =0
virtual IPeerDebugStats * peer_stats()=0
static Inet6Prefix FromString(const std::string &str, boost::system::error_code *errorp=NULL)
std::string ToString() const
Ip6Address ip6_addr() const
Ip4Address ip4_addr() const
std::string ToString() const
static Ip4Prefix FromString(const std::string &str, boost::system::error_code *errorp=NULL)
const bool IsDefault() const
const uint64_t GetExtCommunityValue() const
const uint64_t GetExtCommunityValue() const
static MacAddress FromString(const std::string &str, boost::system::error_code *error=NULL)
const uint64_t GetExtCommunityValue() const
bool IsCloseInProgress() const
bool IsInGRTimerWaitState() const
static void FillPeerUpdateStats(const IPeerDebugStats *peer_stats, PeerStatsData *peer_stats_data)
static void FillPeerDebugStats(const IPeerDebugStats *peer_stats, PeerStatsInfo *stats)
static RouteDistinguisher kZeroRd
const uint64_t GetExtCommunityValue() const
RoutingInstance * GetRoutingInstance(const std::string &name)
void UnregisterInstanceOpCallback(int id)
int RegisterInstanceOpCallback(RoutingInstanceCb cb)
const std::string & name() const
static std::string GetTableName(std::string instance_name, Address::Family fmly)
std::map< std::string, BgpTable * > RouteTableList
RouteTableList & GetTables()
const RouteTargetList & GetImportList() const
std::set< RouteTarget > RouteTargetList
BgpTable * GetTable(Address::Family fmly)
static SandeshLevel::type LoggingUtLevel()
const uint64_t GetExtCommunityValue() const
const uint64_t GetExtCommunityValue() const
Represents a single BGP Large Community tag.
const std::vector< uint32_t > GetLargeCommunityValue() const
Returns the community value as a vector of 3 32-bit integers.
The TaskScheduler keeps track of what tasks are currently schedulable. When a task is enqueued it is ...
int GetTaskId(const std::string &name)
static TaskScheduler * GetInstance()
const io::SocketStats & GetSocketStats() const
boost::asio::ip::tcp::endpoint Endpoint
Endpoint remote_endpoint() const
Endpoint local_endpoint() const
static bool DeleteTimer(Timer *Timer)
static Timer * CreateTimer(boost::asio::io_context &service, const std::string &name, int task_id=Timer::GetTimerTaskId(), int task_instance=Timer::GetTimerInstanceId(), bool delete_on_completion=false)
bool Start(int time, Handler handler, ErrorHandler error_handler=NULL)
bool Reschedule(int time)
const uint64_t GetExtCommunityValue() const
TunnelEncapType::Encap tunnel_encap() const
bool Enqueue(QueueEntryT entry)
void set_disable(bool disabled)
void Shutdown(bool delete_entries=true)
void SetEntryCallback(TaskEntryCallback on_entry)
virtual void RegisterReceive(xmps::PeerId, ReceiveCb)=0
virtual std::string LastEvent() const =0
virtual void UnRegisterReceive(xmps::PeerId)=0
virtual const XmppConnection * connection() const =0
virtual uint32_t tx_close() const =0
virtual void RegisterReferer(xmps::PeerId)
virtual const std::string & ToString() const =0
virtual xmps::PeerState GetPeerState() const =0
virtual std::string LastFlap() const =0
virtual bool LastSent(time_t duration) const =0
virtual uint32_t tx_open() const =0
virtual uint32_t rx_update() const =0
virtual uint32_t rx_close() const =0
virtual void UnRegisterReferer(xmps::PeerId)
virtual uint32_t tx_update() const =0
virtual uint32_t tx_keepalive() const =0
virtual std::string LastStateName() const =0
virtual bool LastReceived(time_t duration) const =0
virtual std::string LastStateChangeAt() const =0
virtual uint32_t rx_keepalive() const =0
virtual uint32_t FlapCount() const =0
virtual void UnRegisterWriteReady(xmps::PeerId id)=0
virtual uint32_t rx_open() const =0
virtual int GetTaskInstance() const =0
virtual bool Send(const uint8_t *, size_t, xmps::PeerId, SendReadyCb)=0
virtual std::string StateName() const =0
bool Send(const uint8_t *data, size_t size, const std::string *msg_str=NULL)
const XmppSession * session() const
bool IsActiveChannel() const
virtual boost::asio::ip::tcp::endpoint endpoint() const
const std::string & ToUVEKey() const
static const char * kControlNodeJID
static const char * kBgpPeer
static const char * kEndOfRibMarker
void ClearAllConnections()
void SetDscpValue(uint8_t value)
void UnRegisterConnectionEvent(xmps::PeerId)
void CreateConfigUpdater(BgpConfigManager *config_manager)
void RegisterConnectionEvent(xmps::PeerId, ConnectionEventCb)
uint32_t GetEndOfRibSendTime() const
uint32_t GetEndOfRibReceiveTime() const
std::unique_ptr< XmlBase > dom
boost::intrusive_ptr< LabelBlock > LabelBlockPtr
static bool regex_search(const std::string &input, const regex ®ex)
static bool regex_match(const std::string &input, const regex ®ex)
static bool stringToIntegerList(std::string input, std::string seperator, std::vector< NumberType > &entries)
std::atomic< uint64_t > table_unsubscribe_complete
std::atomic< uint64_t > instance_subscribe
std::atomic< uint64_t > table_subscribe
std::atomic< uint64_t > instance_unsubscribe
std::atomic< uint64_t > table_subscribe_complete
std::atomic< uint64_t > table_unsubscribe
void incr_inet6_rx_bad_xml_token_count()
uint64_t get_inet6_rx_bad_xml_token_count() const
void incr_inet6_rx_bad_prefix_count()
uint64_t get_inet6_rx_bad_nexthop_count() const
void incr_inet6_rx_bad_afi_safi_count()
uint64_t get_inet6_rx_bad_afi_safi_count() const
std::atomic< uint64_t > inet6_rx_bad_xml_token_count
void incr_inet6_rx_bad_nexthop_count()
uint64_t get_inet6_rx_bad_prefix_count() const
std::atomic< uint64_t > reach
std::atomic< uint64_t > end_of_rib
std::atomic< uint64_t > rt_updates
std::atomic< uint64_t > unreach
RoutingInstance::RouteTargetList targets
std::unique_ptr< DBRequestKey > key
void Swap(DBRequest *rhs)
std::unique_ptr< DBRequestData > data
uint64_t inet6_bad_afi_safi_count
uint64_t inet6_bad_prefix_count
uint64_t inet6_bad_xml_token_count
uint64_t inet6_bad_nexthop_count
uint64_t primary_path_count
uint64_t total_path_count
uint64_t blocked_duration_usecs
@ EdgeReplicationSupported
@ AssistedReplicationContrail
void SetIdentifier(Ip4Address identifier)
void SetLabel(uint32_t label, const ExtCommunity *ext)
std::atomic< uint64_t > write_calls
std::atomic< uint64_t > write_blocked_duration_usecs
std::atomic< uint64_t > read_bytes
std::atomic< uint64_t > write_blocked
std::atomic< uint64_t > read_calls
std::atomic< uint64_t > write_bytes
#define CHECK_CONCURRENCY(...)
static time_t UTCTimestamp()
static uint64_t UTCTimestampUsec()
void STLDeleteElements(Container *container)