8 #include <boost/assign/list_of.hpp>
9 #include <boost/foreach.hpp>
43 #include "control-node/sandesh/control_node_types.h"
45 #include "schema/xmpp_multicast_types.h"
46 #include "schema/xmpp_enet_types.h"
47 #include "schema/xmpp_mvpn_types.h"
52 #include "xmpp/sandesh/xmpp_peer_info_types.h"
54 using autogen::EnetItemType;
55 using autogen::EnetNextHopListType;
56 using autogen::EnetSecurityGroupListType;
57 using autogen::EnetTunnelEncapsulationListType;
59 using autogen::McastItemType;
60 using autogen::McastNextHopsType;
61 using autogen::McastTunnelEncapsulationListType;
63 using autogen::MvpnItemType;
64 using autogen::MvpnNextHopType;
65 using autogen::MvpnTunnelEncapsulationListType;
67 using autogen::ItemType;
68 using autogen::NextHopListType;
69 using autogen::SecurityGroupListType;
70 using autogen::CommunityTagListType;
71 using autogen::TunnelEncapsulationListType;
72 using autogen::TagListType;
74 using boost::assign::list_of;
76 using boost::system::error_code;
81 using std::unique_ptr;
83 using std::numeric_limits;
84 using std::ostringstream;
98 if (local_pref == 100)
100 if (local_pref == 200)
102 return numeric_limits<uint32_t>::max() - local_pref;
110 ++inet6_rx_bad_prefix_count;
114 ++inet6_rx_bad_nexthop_count;
118 ++inet6_rx_bad_afi_safi_count;
122 return inet6_rx_bad_xml_token_count;
126 return inet6_rx_bad_prefix_count;
130 return inet6_rx_bad_nexthop_count;
134 return inet6_rx_bad_afi_safi_count;
275 XmppPeerInfoData peer_info;
277 peer_info.set_deleted(
true);
280 PeerStatsData peer_stats_data;
281 peer_stats_data.set_name(
ToUVEKey());
282 peer_stats_data.set_deleted(
true);
283 assert(!peer_stats_data.get_name().empty());
284 BGP_UVE_SEND2(PeerStatsUve, peer_stats_data,
"ObjectXmppPeerInfo");
298 const std::string *msg_str);
299 virtual bool SendUpdate(
const uint8_t *msg,
size_t msgsize) {
326 uint32_t path_flags)
const {
352 virtual void Close(
bool graceful);
368 if (remote.address().is_v4()) {
369 return remote.address().to_v4().to_ulong();
394 return std::vector<std::string>();
432 static char *skip_env_ = getenv(
"XMPP_SKIP_UPDATE_SEND");
447 const string *msg_str) {
450 parent_->stats_[
TX].rt_updates++;
451 if (parent_->SkipUpdateSend())
461 if (parent_->eor_send_timer_ && parent_->eor_send_timer_->running())
462 parent_->eor_send_timer_->Cancel();
472 parent_->set_peer_closed(
true);
482 parent_->ClearEndOfRibState();
484 parent_->peer_close_->Close(graceful);
511 TaskScheduler::GetInstance()->GetTaskId(
"xmpp::StateMachine"),
520 "EndOfRib receive timer",
525 "EndOfRib send timer",
559 assert(!peer_info.get_name().empty());
600 assert(instance_mgr);
616 rt_instance, &sub_state->
targets);
638 *addrp = IpAddress::from_string(address, error);
642 return (zero_ok ?
true : !addrp->is_unspecified());
649 int *instance_id, uint64_t *subscription_gen_id,
RequestType *req_type) {
651 *subscription_gen_id = 0;
662 instance_id, subscription_gen_id);
688 const string &table_name) {
689 TableMembershipRequestMap::iterator loc =
700 const string &table_name)
const {
701 TableMembershipRequestMap::const_iterator loc =
727 InstanceMembershipRequestMap::const_iterator loc =
743 int *instance_id, uint64_t *subscription_gen_id,
bool *subscribe_pending,
746 *subscribe_pending =
false;
751 *table = rt_instance->
GetTable(family);
752 if (rt_instance != NULL && !rt_instance->
deleted()) {
755 subscription_gen_id, &req_type)) {
760 "Received route after unsubscribe");
763 *subscribe_pending =
true;
766 if (*instance_id < 0) {
769 "Received route without subscribe");
781 *subscribe_pending =
true;
782 }
else if (add_change || !rt_instance) {
793 const pugi::xml_node &node,
bool add_change) {
797 if (!item.XmlParse(node)) {
805 "Unsupported address family " << item.entry.nlri.af <<
806 " for multicast route");
813 item.entry.nlri.safi <<
" for multicast route");
818 IpAddress grp_address = IpAddress::from_string(
"0.0.0.0", error);
819 if (!item.entry.nlri.group.empty()) {
821 item.entry.nlri.group, &grp_address,
false)) {
823 "Bad group address " << item.entry.nlri.group);
828 IpAddress src_address = IpAddress::from_string(
"0.0.0.0", error);
829 if (!item.entry.nlri.source.empty()) {
831 item.entry.nlri.source, &src_address,
true)) {
833 "Bad source address " << item.entry.nlri.source);
838 bool subscribe_pending;
840 uint64_t subscription_gen_id;
843 &subscription_gen_id, &subscribe_pending, add_change)) {
849 uint16_t cluster_seed =
860 grp_address.to_v4(), src_address.to_v4());
868 string label_range(
"none");
872 vector<uint32_t> labels;
873 const McastNextHopsType &inh_list = item.entry.next_hops;
875 if (inh_list.next_hop.empty()) {
883 if (inh_list.next_hop.size() != 1) {
885 "More than one nexthop received for multicast route " <<
890 McastNextHopsType::const_iterator nit = inh_list.begin();
893 label_range = nit->label;
895 labels.size() != 2) {
897 "Bad label range " << label_range <<
898 " for multicast route " << mc_prefix.
ToString());
902 if (!labels[0] || !labels[1] || labels[1] < labels[0]) {
905 " for multicast route " << mc_prefix.
ToString());
913 attrs.push_back(&attr_label);
920 " for multicast route " << mc_prefix.
ToString());
924 attrs.push_back(&nexthop);
927 bool no_tunnel_encap =
true;
928 bool no_valid_tunnel_encap =
true;
929 for (McastTunnelEncapsulationListType::const_iterator eit =
930 nit->tunnel_encapsulation_list.begin();
931 eit != nit->tunnel_encapsulation_list.end(); ++eit) {
932 no_tunnel_encap =
false;
936 no_valid_tunnel_encap =
false;
942 if (!no_tunnel_encap && no_valid_tunnel_encap) {
947 attrs.push_back(&ext);
951 attr, flags, 0, 0, subscription_gen_id));
959 if (subscribe_pending) {
961 request_entry->
Swap(&req);
965 make_pair(vrf_name, table_name), request_entry));
972 "Multicast group " << item.entry.nlri.group <<
973 " source " << item.entry.nlri.source <<
974 " and label range " << label_range <<
975 " enqueued for " << (add_change ?
"add/change" :
"delete"));
981 IpAddress src_address,
bool add_change, uint64_t subscription_gen_id,
982 int instance_id,
DBRequest& req,
const MvpnNextHopType &nexthop) {
985 grp_address.to_v4(), src_address.to_v4());
1003 attrs.push_back(&source_rd);
1006 attr, flags, 0, 0, subscription_gen_id));
1015 IpAddress src_address,
bool add_change, uint64_t subscription_gen_id,
1019 grp_address.to_v4(), src_address.to_v4());
1032 attrs.push_back(&nexthop);
1036 attr, flags, 0, 0, subscription_gen_id));
1045 const pugi::xml_node &node,
bool add_change) {
1049 if (!item.XmlParse(node)) {
1057 "Unsupported address family " << item.entry.nlri.af <<
1058 " for multicast route");
1065 item.entry.nlri.safi <<
" for multicast route");
1069 if (item.entry.nlri.group.empty()) {
1071 "Mandatory group address not specified");
1076 IpAddress grp_address = IpAddress::from_string(
"0.0.0.0", error);
1078 item.entry.nlri.group, &grp_address,
false)) {
1080 "Bad group address " << item.entry.nlri.group);
1084 if (item.entry.nlri.source.empty()) {
1086 "Mandatory source address not specified");
1090 IpAddress src_address = IpAddress::from_string(
"0.0.0.0", error);
1092 item.entry.nlri.source, &src_address,
true)) {
1094 "Bad source address " << item.entry.nlri.source);
1098 bool subscribe_pending;
1100 uint64_t subscription_gen_id;
1103 &subscription_gen_id, &subscribe_pending, add_change)) {
1108 int rt_type = item.entry.nlri.route_type;
1113 subscription_gen_id, req);
1116 subscription_gen_id, instance_id, req, item.entry.next_hop);
1119 "Unsupported route type " << item.entry.nlri.route_type);
1128 if (subscribe_pending) {
1130 request_entry->
Swap(&req);
1134 make_pair(vrf_name, table_name), request_entry));
1140 "Multicast group " << item.entry.nlri.group <<
1141 " source " << item.entry.nlri.source <<
1142 " enqueued for " << (add_change ?
"add/change" :
"delete"));
1148 const pugi::xml_node &node,
bool add_change,
int primary_instance_id) {
1152 if (!item.XmlParse(node)) {
1154 "Invalid inet route message received");
1160 "Unsupported address family " << item.entry.nlri.af <<
1161 " for inet route " << item.entry.nlri.address);
1168 "Unsupported subsequent address family " << item.entry.nlri.safi <<
1169 " for inet route " << item.entry.nlri.address);
1177 "Bad inet route " << item.entry.nlri.address);
1181 if (add_change && item.entry.next_hops.next_hop.empty()) {
1183 "Missing next-hops for inet route " << inet_prefix.
ToString());
1192 bool subscribe_pending;
1194 uint64_t subscription_gen_id;
1197 item.entry.nlri.safi);
1199 &subscription_gen_id, &subscribe_pending, add_change)) {
1218 const NextHopListType &inh_list = item.entry.next_hops;
1221 if (inh_list.next_hop.size() != 1) {
1224 "More than one nexthop received for inet route " <<
1229 NextHopListType::const_iterator nit = inh_list.begin();
1235 "Bad nexthop address " << nit->address <<
1236 " for inet route " << inet_prefix.
ToString());
1241 ((master && nit->label) &&
1245 "Bad label " << nit->label <<
1246 " for inet route " << inet_prefix.
ToString());
1253 "Bad label " << nit->label <<
1254 " for inet route in master instance(mpls)/non master instance" <<
1259 nh_address = nhop_address;
1263 bool no_tunnel_encap =
true;
1264 bool no_valid_tunnel_encap =
true;
1265 for (TunnelEncapsulationListType::const_iterator eit =
1266 nit->tunnel_encapsulation_list.begin();
1267 eit != nit->tunnel_encapsulation_list.end(); ++eit) {
1268 no_tunnel_encap =
false;
1272 no_valid_tunnel_encap =
false;
1278 if (!no_tunnel_encap && no_valid_tunnel_encap && !master) {
1283 if (!nit->mac.empty()) {
1289 "Bad next-hop mac address " << nit->mac);
1292 if (!mac_addr.
IsZero()) {
1299 uint64_t tag_val = 0;
1300 for (TagListType::const_iterator tit = nit->tag_list.begin();
1301 tit != nit->tag_list.end(); ++tit) {
1302 tag_val = nit->is_new_tags_list ? *tit :
1303 ((0xFFFF0000 & *tit) << 16) | (0x0000FFFF & *tit);
1311 if (nit->local_sequence_number) {
1318 attrs.push_back(&local_pref);
1322 uint32_t med_value = item.entry.med;
1327 attrs.push_back(&med);
1330 const CommunityTagListType &ict_list = item.entry.community_tag_list;
1331 for (CommunityTagListType::const_iterator cit = ict_list.begin();
1332 cit != ict_list.end(); ++cit) {
1334 uint32_t rt_community =
1341 uint32_t addr = nh_address.to_v4().to_ulong();
1343 attrs.push_back(&nexthop);
1344 uint16_t cluster_seed =
1347 if (!master || primary_instance_id) {
1349 instance_id = primary_instance_id;
1357 attrs.push_back(&source_rd);
1361 uint16_t sg_index = 0;
1362 const SecurityGroupListType &isg_list = item.entry.security_group_list;
1363 for (SecurityGroupListType::const_iterator sit = isg_list.begin();
1364 sit != isg_list.end(); ++sit) {
1377 if (item.entry.mobility.seqno) {
1379 item.entry.mobility.sticky);
1381 }
else if (item.entry.sequence_number) {
1387 LoadBalance load_balance(item.entry.load_balance);
1392 attrs.push_back(&comm);
1394 attrs.push_back(&ext);
1396 attrs.push_back(&largecomm);
1400 attrs.push_back(&sbp);
1404 attr, flags, label, 0, subscription_gen_id));
1410 if (subscribe_pending) {
1412 request_entry->
Swap(&req);
1416 make_pair(vrf_name, table_name), request_entry));
1423 "Inet route " << item.entry.nlri.address <<
1424 " with next-hop " << nh_address <<
" and label " << label <<
1425 " enqueued for " << (add_change ?
"add/change" :
"delete") <<
1426 " to table " << table->
name());
1439 const pugi::xml_node &node,
bool add_change) {
1443 if (!item.XmlParse(node)) {
1446 "Invalid inet6 route message received");
1453 "Unsupported address family " << item.entry.nlri.af <<
1454 " for inet6 route " << item.entry.nlri.address);
1461 "Unsupported subsequent address family " << item.entry.nlri.safi <<
1462 " for inet6 route " << item.entry.nlri.address);
1472 "Bad inet6 route " << item.entry.nlri.address);
1476 if (add_change && item.entry.next_hops.next_hop.empty()) {
1478 "Missing next-hops for inet6 route " << inet6_prefix.
ToString());
1491 bool subscribe_pending;
1493 uint64_t subscription_gen_id;
1496 &subscription_gen_id, &subscribe_pending, add_change)) {
1521 const NextHopListType &inh_list = item.entry.next_hops;
1524 if (inh_list.next_hop.size() != 1) {
1527 "More than one nexthop received for inet6 route " <<
1532 NextHopListType::const_iterator nit = inh_list.begin();
1539 "Bad nexthop address " << nit->address <<
1540 " for inet6 route " << inet6_prefix.
ToString());
1548 "Bad label " << nit->vni <<
1549 " for inet6 route " << inet6_prefix.
ToString());
1554 if (nit->mac.empty())
1562 "Bad next-hop mac address " << nit->mac);
1571 "Bad label " << nit->label <<
1572 " for inet6 route " << inet6_prefix.
ToString());
1575 if (!master && !nit->label)
1579 nh_address = nhop_address;
1587 bool no_tunnel_encap =
true;
1588 bool no_valid_tunnel_encap =
true;
1589 for (TunnelEncapsulationListType::const_iterator eit =
1590 nit->tunnel_encapsulation_list.begin();
1591 eit != nit->tunnel_encapsulation_list.end(); ++eit) {
1592 no_tunnel_encap =
false;
1596 no_valid_tunnel_encap =
false;
1602 if (!no_tunnel_encap && no_valid_tunnel_encap && !master) {
1607 if (!nit->mac.empty()) {
1613 "Bad next-hop mac address " << nit->mac);
1616 if (!mac_addr.
IsZero()) {
1623 uint64_t tag_val = 0;
1624 for (TagListType::const_iterator tit = nit->tag_list.begin();
1625 tit != nit->tag_list.end(); ++tit) {
1626 tag_val = nit->is_new_tags_list ? *tit :
1627 ((0xFFFF0000 & *tit) << 16) | (0x0000FFFF & *tit);
1629 for (
const auto &value_data :
1636 if (nit->local_sequence_number) {
1643 attrs.push_back(&local_pref);
1647 uint32_t med_value = item.entry.med;
1652 attrs.push_back(&med);
1655 const CommunityTagListType &ict_list =
1656 item.entry.community_tag_list;
1657 for (CommunityTagListType::const_iterator cit = ict_list.begin();
1658 cit != ict_list.end(); ++cit) {
1660 uint32_t rt_community =
1668 attrs.push_back(&nexthop);
1672 uint32_t addr = nh_address.to_v4().to_ulong();
1673 uint16_t cluster_seed =
1682 attrs.push_back(&source_rd);
1686 const SecurityGroupListType &isg_list =
1687 item.entry.security_group_list;
1688 uint16_t sg_index = 0;
1689 for (SecurityGroupListType::const_iterator sit = isg_list.begin();
1690 sit != isg_list.end(); ++sit) {
1703 if (item.entry.mobility.seqno) {
1705 item.entry.mobility.sticky);
1707 }
else if (item.entry.sequence_number) {
1713 LoadBalance load_balance(item.entry.load_balance);
1719 attrs.push_back(&sbp);
1722 attrs.push_back(&comm);
1724 attrs.push_back(&ext);
1726 attrs.push_back(&largecomm);
1730 attr, flags, label, 0, subscription_gen_id));
1736 if (subscribe_pending) {
1738 request_entry->
Swap(&req);
1742 make_pair(vrf_name, table_name), request_entry));
1749 "Inet6 route " << item.entry.nlri.address <<
1750 " with next-hop " << nh_address <<
" and label " << label <<
1751 " enqueued for " << (add_change ?
"add/change" :
"delete") <<
1752 " to table " << table->
name());
1766 const pugi::xml_node &node,
bool add_change) {
1770 if (!item.XmlParse(node)) {
1772 "Invalid enet route message received");
1778 "Unsupported address family " << item.entry.nlri.af <<
1779 " for enet route " << item.entry.nlri.address);
1785 "Unsupported subsequent address family " << item.entry.nlri.safi <<
1786 " for enet route " << item.entry.nlri.mac);
1792 IpAddress group= IpAddress::from_string(
"0.0.0.0", error);
1793 if (!item.entry.nlri.group.empty()) {
1796 item.entry.nlri.group, &group,
false)) {
1798 "Bad group address " << item.entry.nlri.group);
1802 IpAddress source = IpAddress::from_string(
"0.0.0.0", error);
1804 item.entry.nlri.af, item.entry.nlri.source, &source,
true)) {
1806 "Bad source address " << item.entry.nlri.source);
1814 "Bad mac address " << item.entry.nlri.mac);
1818 bool type2 = type6 ? false : !mac_addr.
IsZero();
1823 if (!item.entry.nlri.address.empty()) {
1824 size_t pos = item.entry.nlri.address.find(
'/');
1825 if (pos == string::npos) {
1827 "Missing / in address " << item.entry.nlri.address);
1831 bool ipv6 = item.entry.nlri.address.find(
':') != string::npos;
1838 "Cannot parse inet prefix string " <<
1839 item.entry.nlri.address);
1843 if (type2 && inet_prefix.
prefixlen() != 32 &&
1844 item.entry.nlri.address !=
"0.0.0.0/0") {
1847 "Bad inet address " << item.entry.nlri.address);
1860 "Cannot parse inet6 prefix string " <<
1861 item.entry.nlri.address);
1865 if (type2 && inet6_prefix.
prefixlen() != 128 &&
1866 item.entry.nlri.address !=
"::/0") {
1869 "Bad inet6 address " << item.entry.nlri.address);
1877 bool subscribe_pending;
1879 uint64_t subscription_gen_id;
1882 &subscription_gen_id, &subscribe_pending, add_change)) {
1897 uint32_t ethernet_tag = item.entry.nlri.ethernet_tag;
1901 type2 ?
EvpnPrefix(rd, ethernet_tag, mac_addr, ip_addr) :
1911 uint32_t l3_label = 0;
1917 const EnetNextHopListType &inh_list = item.entry.next_hops;
1919 if (inh_list.next_hop.empty()) {
1927 if (inh_list.next_hop.size() != 1) {
1930 "More than one nexthop received for enet route " <<
1935 EnetNextHopListType::const_iterator nit = inh_list.begin();
1946 nh_address = nhop_address;
1948 l3_label = nit->l3_label;
1949 if (!nit->mac.empty()) {
1955 "Bad next-hop mac address " << nit->mac <<
1964 bool no_tunnel_encap =
true;
1965 bool no_valid_tunnel_encap =
true;
1966 for (EnetTunnelEncapsulationListType::const_iterator eit =
1967 nit->tunnel_encapsulation_list.begin();
1968 eit != nit->tunnel_encapsulation_list.end(); ++eit) {
1969 no_tunnel_encap =
false;
1973 no_valid_tunnel_encap =
false;
1983 if (!no_tunnel_encap && no_valid_tunnel_encap) {
1988 uint64_t tag_val = 0;
1989 for (TagListType::const_iterator tit = nit->tag_list.begin();
1990 tit != nit->tag_list.end(); ++tit) {
1991 tag_val = nit->is_new_tags_list ? *tit :
1992 ((0x0000FFFF0000 & *tit) << 16) |
1993 (0x00000000FFFF & *tit);
2001 if (nit->local_sequence_number) {
2008 attrs.push_back(&local_pref);
2013 uint32_t med_value = item.entry.med;
2018 attrs.push_back(&med);
2023 if (item.entry.replicator_address.empty() &&
2024 item.entry.edge_replication_not_supported) {
2026 flags &= ~
BgpPath::CheckGlobalErmVpnRoute;
2027 attrs.push_back(&nexthop);
2030 attrs.push_back(&nexthop);
2037 nh_address.to_v4().to_ulong(), instance_id));
2040 nh_address.to_v4().to_ulong(), instance_id));
2042 attrs.push_back(&source_rd);
2045 const EnetSecurityGroupListType &isg_list =
2046 item.entry.security_group_list;
2047 uint16_t sg_index = 0;
2048 for (EnetSecurityGroupListType::const_iterator sit = isg_list.begin();
2049 sit != isg_list.end(); ++sit) {
2062 if (item.entry.mobility.seqno) {
2064 item.entry.mobility.sticky);
2066 }
else if (item.entry.sequence_number) {
2071 ETree etree(item.entry.etree_leaf);
2075 attrs.push_back(&ext);
2077 attrs.push_back(&largecomm);
2081 if (!item.entry.replicator_address.empty()) {
2084 item.entry.replicator_address, &replicator_address)) {
2087 "Bad replicator address " <<
2088 item.entry.replicator_address <<
2098 if (item.entry.assisted_replication_supported) {
2102 if (!item.entry.edge_replication_not_supported) {
2109 pmsi_spec.
SetLabel(label, &ext_comm);
2110 attrs.push_back(&pmsi_spec);
2116 attr, flags, label, l3_label, subscription_gen_id));
2124 if (subscribe_pending) {
2126 request_entry->
Swap(&req);
2130 make_pair(vrf_name, table_name), request_entry));
2138 " with next-hop " << nh_address <<
2139 " label " << label <<
" l3-label " << l3_label <<
2140 " enqueued for " << (add_change ?
"add/change" :
"delete"));
2147 unique_ptr<DBRequest> ptr(request);
2151 if (table == NULL || table->
IsDeleted()) {
2157 int instance_id = -1;
2158 uint64_t subscription_gen_id = 0;
2160 &instance_id, &subscription_gen_id);
2161 if (!is_registered) {
2164 "Not subscribed to table " << table->
name());
2169 ->set_subscription_gen_id(subscription_gen_id);
2194 "Subscribe to table " << table->
name() <<
2195 (tmr_state->
no_ribout ?
" (no ribout)" :
"") <<
2226 "Unsubscribe to table " << table->
name());
2231 #define RegisterTable(table, tmr_state) \
2232 RegisterTable(__LINE__, table, tmr_state)
2233 #define UnregisterTable(table) UnregisterTable(__LINE__, table)
2238 BOOST_FOREACH(TableMembershipRequestMap::value_type &entry,
2267 "Table not in subscribe/unsubscribe request queue");
2274 "Subscribe to table " << table_name <<
" completed");
2279 "Unsubscribe to table " << table_name <<
" completed");
2345 assert(
defer_q_.count(vrf_n_table) == 0);
2354 for (DeferQ::iterator it =
defer_q_.find(vrf_n_table);
2355 it !=
defer_q_.end() && it->first.second == table->
name(); ++it) {
2374 vector<BgpNeighborRoutingInstance> instance_list;
2375 BOOST_FOREACH(
const SubscribedRoutingInstanceList::value_type &entry,
2377 BgpNeighborRoutingInstance instance;
2378 instance.set_name(entry.first->name());
2379 if (entry.second.IsLlgrStale()) {
2380 instance.set_state(
"subscribed-llgr-stale");
2381 }
else if (entry.second.IsGrStale()) {
2382 instance.set_state(
"subscribed-gr-stale");
2384 instance.set_state(
"subscribed");
2386 instance.set_index(entry.second.index);
2388 instance_list.push_back(instance);
2390 BOOST_FOREACH(
const InstanceMembershipRequestMap::value_type &entry,
2393 BgpNeighborRoutingInstance instance;
2394 instance.set_name(entry.first);
2395 instance.set_state(
"pending");
2397 instance_list.push_back(instance);
2399 resp->set_routing_instances(instance_list);
2403 vector<BgpNeighborRoutingTable> old_table_list = resp->get_routing_tables();
2404 set<string> old_table_set;
2405 vector<BgpNeighborRoutingTable> new_table_list;
2407 BOOST_FOREACH(
const BgpNeighborRoutingTable &table, old_table_list) {
2408 old_table_set.insert(table.get_name());
2410 new_table_list.push_back(table);
2413 BOOST_FOREACH(
const TableMembershipRequestMap::value_type &entry,
2415 BgpNeighborRoutingTable table;
2416 table.set_name(entry.first);
2417 if (old_table_set.find(entry.first) != old_table_set.end())
2418 table.set_current_state(
"subscribed");
2421 table.set_current_request(
"subscribe");
2423 table.set_current_request(
"unsubscribe");
2426 table.set_pending_request(
"subscribe");
2428 table.set_pending_request(
"unsubscribe");
2430 new_table_list.push_back(table);
2432 resp->set_routing_tables(new_table_list);
2439 for (DeferQ::iterator it =
2440 defer_q_.find(make_pair(vrf_name, table_name)), itnext;
2441 (it !=
defer_q_.end() && it->first.second == table_name);
2454 for (DeferQ::iterator it =
2455 defer_q_.lower_bound(make_pair(vrf_name,
string())), itnext;
2456 (it !=
defer_q_.end() && it->first.first == vrf_name);
2469 BOOST_FOREACH(SubscribedRoutingInstanceList::value_type &entry,
2471 entry.second.SetGrStale();
2480 BOOST_FOREACH(SubscribedRoutingInstanceList::value_type &entry,
2482 assert(entry.second.IsGrStale());
2483 entry.second.SetLlgrStale();
2494 if (i->second.IsGrStale()) {
2495 string name = i->first->name();
2502 "Instance subscription " << name <<
2503 " is still stale and hence unsubscribed");
2519 "Instance subscription " << rt_instance->
name() <<
2520 " stale flag is cleared");
2528 pair<SubscribedRoutingInstanceList::iterator, bool> ret =
2530 rt_instance, state));
2547 SubscribedRoutingInstanceList::iterator loc =
2554 SubscribedRoutingInstanceList::const_iterator loc =
2565 for (RoutingInstance::RouteTableList::const_iterator it = rt_list.begin();
2566 it != rt_list.end(); ++it) {
2581 int instance_id = -1;
2582 bool no_ribout =
false;
2587 for (xml_node node =
options.first_child(); node;
2588 node = node.next_sibling()) {
2589 if (strcmp(node.name(),
"instance-id") == 0) {
2590 instance_id = node.text().as_int();
2592 if (strcmp(node.name(),
"no-ribout") == 0) {
2593 no_ribout = node.text().as_bool();
2599 assert(instance_mgr);
2601 if (rt_instance == NULL) {
2604 "Routing instance " << vrf_name <<
2605 " not found when processing " <<
2606 (add_change ?
"subscribe" :
"unsubscribe"));
2611 "Duplicate subscribe for routing instance " <<
2612 vrf_name <<
", triggering close");
2626 "Spurious unsubscribe for routing instance " <<
2627 vrf_name <<
", triggering close");
2632 }
else if (rt_instance->
deleted()) {
2635 "Routing instance " << vrf_name <<
2636 " is being deleted when processing " <<
2637 (add_change ?
"subscribe" :
"unsubscribe"));
2642 "Duplicate subscribe for routing instance " <<
2643 vrf_name <<
", triggering close");
2648 "Duplicate subscribe for routing instance " <<
2649 vrf_name <<
", triggering close");
2669 "Spurious unsubscribe for routing instance " <<
2670 vrf_name <<
", triggering close");
2684 "Duplicate subscribe for routing instance " <<
2685 vrf_name <<
", triggering close");
2692 "Duplicate subscribe for routing instance " <<
2693 vrf_name <<
" under GR, triggering close");
2703 "Spurious unsubscribe for routing instance " <<
2704 vrf_name <<
", triggering close");
2720 for (RoutingInstance::RouteTableList::const_iterator it = rt_list.begin();
2721 it != rt_list.end(); ++it) {
2740 if (
defer_q_.count(make_pair(vrf_name, table->
name()))) {
2743 "Flush deferred route requests for table " <<
2744 table->
name() <<
" on unsubscribe");
2778 string error_message) {
2780 "Timer error: " << error_name <<
" " << error_message);
2784 if (!
peer_->IsReady())
2802 "EndOfRib Receive timer rescheduled to fire after " <<
2821 if (!
peer_->IsReady())
2836 "EndOfRib Send timer rescheduled to fire after " <<
2855 timeout <<
" second(s)");
2866 if (!
peer_->send_ready())
2893 msg +=
"\n<message from=\"";
2896 msg +=
peer_->ToString();
2900 msg +=
"\n\t<event xmlns=\"http://jabber.org/protocol/pubsub\">";
2903 msg +=
"\n\t</event>\n</message>\n";
2915 bool expect_prefix_len)
const {
2918 char *str =
const_cast<char *
>(s.c_str());
2919 char *saveptr, *token;
2920 token = strtok_r(str,
"/", &saveptr);
2921 if (!token || !saveptr)
2923 token = strtok_r(NULL,
"/", &saveptr);
2924 if (!token || !saveptr)
2926 token = strtok_r(NULL,
"/", &saveptr);
2927 if (!token || !saveptr)
2929 token = strtok_r(NULL,
"/", &saveptr);
2930 if (!token || !saveptr)
2932 if (expect_prefix_len) {
2933 token = strtok_r(NULL,
"/", &saveptr);
2934 if (!token || !saveptr)
2937 token = strtok_r(NULL,
"/", &saveptr);
2940 return strtoul(token, NULL, 0);
2958 if (iq->
iq_type.compare(
"set") == 0) {
2959 if (iq->
action.compare(
"subscribe") == 0) {
2961 }
else if (iq->
action.compare(
"unsubscribe") == 0) {
2963 }
else if (iq->
action.compare(
"publish") == 0) {
2967 xml_node item =
pugi->FindNode(
"item");
2973 "EndOfRib marker received");
2978 for (; item; item = item.next_sibling()) {
2979 if (strcmp(item.name(),
"item") != 0)
continue;
2981 string id(iq->
as_node.c_str());
2982 char *str =
const_cast<char *
>(
id.c_str());
2984 char *af = strtok_r(str,
"/", &saveptr);
2985 char *safi = strtok_r(NULL,
"/", &saveptr);
3022 : xmpp_server_(xmpp_server),
3023 bgp_server_(server),
3024 queue_(
TaskScheduler::GetInstance()->GetTaskId(
"bgp::Config"), 0,
3027 asn_listener_id_(-1),
3028 identifier_listener_id_(-1),
3029 dscp_listener_id_(-1) {
3097 as_t old_local_asn) {
3099 BOOST_FOREACH(XmppChannelMap::value_type &i,
channel_map_) {
3100 i.second->rtarget_manager()->ASNUpdateCallback(old_asn, old_local_asn);
3115 BOOST_FOREACH(XmppChannelMap::value_type &i,
channel_map_) {
3116 i.second->RoutingInstanceCallback(vrf_name, op);
3121 std::scoped_lock lock(
mutex_);
3122 BOOST_FOREACH(XmppChannelMap::value_type &i,
channel_map_) {
3129 std::scoped_lock lock(
mutex_);
3130 BOOST_FOREACH(
const XmppChannelMap::value_type &i,
channel_map_) {
3136 BOOST_FOREACH(XmppChannelMap::value_type &i,
channel_map_) {
3137 if (i.second->ToString() == client) {
3169 std::scoped_lock lock(
mutex_);
3171 XmppChannelMap::iterator it =
channel_map_.find(channel);
3176 channel_map_.insert(make_pair(channel, bgp_xmpp_channel));
3178 make_pair(channel->
ToString(), bgp_xmpp_channel));
3182 "Received XmppChannel up event");
3187 "No BGP configuration for self - closing channel");
3188 if (!getenv(
"CONTRAIL_CAT_FRAMEWORK"))
3195 "BGP is administratively down - closing channel");
3199 bgp_xmpp_channel = (*it).second;
3211 "Graceful Closure in progress - Closing channel");
3224 bgp_xmpp_channel = (*it).second;
3228 "Received XmppChannel down event");
3231 bgp_xmpp_channel->
Close();
3234 os <<
"Peer not found for " << channel->
ToString() <<
3235 " on channel down event";
3242 PeerStatsInfo stats;
3245 XmppPeerInfoData peer_info;
3247 peer_info.set_peer_stats_info(stats);
3248 assert(!peer_info.get_name().empty());
3251 PeerStatsData peer_stats_data;
3253 peer_stats_data.set_encoding(
"XMPP");
3256 assert(!peer_stats_data.get_name().empty());
3257 BGP_UVE_SEND2(PeerStatsUve, peer_stats_data,
"ObjectXmppPeerInfo");
3265 bool change =
false;
3266 uint32_t num_xmpp =
count();
3267 if (first || num_xmpp != state->get_num_xmpp_peer()) {
3268 state->set_num_xmpp_peer(num_xmpp);
3273 if (first || num_up_xmpp != state->get_num_up_xmpp_peer()) {
3274 state->set_num_up_xmpp_peer(num_up_xmpp);
3279 if (first || num_deleting_xmpp != state->get_num_deleting_xmpp_peer()) {
3280 state->set_num_deleting_xmpp_peer(num_deleting_xmpp);
3336 peer_->SetPeerClosed(flag);
3343 return peer_->IsDeleted();
3350 return peer_->closed_at();
3354 SubscribedRoutingInstanceList::const_iterator it =
3357 return it->second.IsGrStale();
3361 SubscribedRoutingInstanceList::const_iterator it =
3364 return it->second.IsLlgrStale();
3373 SubscribedRoutingInstanceList::const_iterator it =
3376 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)