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 uint16_t tag_index = 0;
1299 for (TagListType::const_iterator tit = nit->tag_list.begin();
1300 tit != nit->tag_list.end(); ++tit) {
1309 Tag tag(tag_index, *tit);
1321 if (nit->local_sequence_number) {
1328 attrs.push_back(&local_pref);
1332 uint32_t med_value = item.entry.med;
1337 attrs.push_back(&med);
1340 const CommunityTagListType &ict_list = item.entry.community_tag_list;
1341 for (CommunityTagListType::const_iterator cit = ict_list.begin();
1342 cit != ict_list.end(); ++cit) {
1344 uint32_t rt_community =
1351 uint32_t addr = nh_address.to_v4().to_ulong();
1353 attrs.push_back(&nexthop);
1354 uint16_t cluster_seed =
1357 if (!master || primary_instance_id) {
1359 instance_id = primary_instance_id;
1367 attrs.push_back(&source_rd);
1371 uint16_t sg_index = 0;
1372 const SecurityGroupListType &isg_list = item.entry.security_group_list;
1373 for (SecurityGroupListType::const_iterator sit = isg_list.begin();
1374 sit != isg_list.end(); ++sit) {
1387 if (item.entry.mobility.seqno) {
1389 item.entry.mobility.sticky);
1391 }
else if (item.entry.sequence_number) {
1397 LoadBalance load_balance(item.entry.load_balance);
1402 attrs.push_back(&comm);
1404 attrs.push_back(&ext);
1406 attrs.push_back(&largecomm);
1410 attrs.push_back(&sbp);
1414 attr, flags, label, 0, subscription_gen_id));
1420 if (subscribe_pending) {
1422 request_entry->
Swap(&req);
1426 make_pair(vrf_name, table_name), request_entry));
1433 "Inet route " << item.entry.nlri.address <<
1434 " with next-hop " << nh_address <<
" and label " << label <<
1435 " enqueued for " << (add_change ?
"add/change" :
"delete") <<
1436 " to table " << table->
name());
1449 const pugi::xml_node &node,
bool add_change) {
1453 if (!item.XmlParse(node)) {
1456 "Invalid inet6 route message received");
1463 "Unsupported address family " << item.entry.nlri.af <<
1464 " for inet6 route " << item.entry.nlri.address);
1471 "Unsupported subsequent address family " << item.entry.nlri.safi <<
1472 " for inet6 route " << item.entry.nlri.address);
1482 "Bad inet6 route " << item.entry.nlri.address);
1486 if (add_change && item.entry.next_hops.next_hop.empty()) {
1488 "Missing next-hops for inet6 route " << inet6_prefix.
ToString());
1501 bool subscribe_pending;
1503 uint64_t subscription_gen_id;
1506 &subscription_gen_id, &subscribe_pending, add_change)) {
1531 const NextHopListType &inh_list = item.entry.next_hops;
1534 if (inh_list.next_hop.size() != 1) {
1537 "More than one nexthop received for inet6 route " <<
1542 NextHopListType::const_iterator nit = inh_list.begin();
1549 "Bad nexthop address " << nit->address <<
1550 " for inet6 route " << inet6_prefix.
ToString());
1558 "Bad label " << nit->vni <<
1559 " for inet6 route " << inet6_prefix.
ToString());
1564 if (nit->mac.empty())
1572 "Bad next-hop mac address " << nit->mac);
1581 "Bad label " << nit->label <<
1582 " for inet6 route " << inet6_prefix.
ToString());
1585 if (!master && !nit->label)
1589 nh_address = nhop_address;
1597 bool no_tunnel_encap =
true;
1598 bool no_valid_tunnel_encap =
true;
1599 for (TunnelEncapsulationListType::const_iterator eit =
1600 nit->tunnel_encapsulation_list.begin();
1601 eit != nit->tunnel_encapsulation_list.end(); ++eit) {
1602 no_tunnel_encap =
false;
1606 no_valid_tunnel_encap =
false;
1612 if (!no_tunnel_encap && no_valid_tunnel_encap && !master) {
1617 if (!nit->mac.empty()) {
1623 "Bad next-hop mac address " << nit->mac);
1626 if (!mac_addr.
IsZero()) {
1633 uint16_t tag_index = 0;
1634 for (TagListType::const_iterator tit = nit->tag_list.begin();
1635 tit != nit->tag_list.end(); ++tit) {
1644 Tag tag(tag_index, *tit);
1657 if (nit->local_sequence_number) {
1664 attrs.push_back(&local_pref);
1668 uint32_t med_value = item.entry.med;
1673 attrs.push_back(&med);
1676 const CommunityTagListType &ict_list =
1677 item.entry.community_tag_list;
1678 for (CommunityTagListType::const_iterator cit = ict_list.begin();
1679 cit != ict_list.end(); ++cit) {
1681 uint32_t rt_community =
1689 attrs.push_back(&nexthop);
1693 uint32_t addr = nh_address.to_v4().to_ulong();
1694 uint16_t cluster_seed =
1703 attrs.push_back(&source_rd);
1707 const SecurityGroupListType &isg_list =
1708 item.entry.security_group_list;
1709 uint16_t sg_index = 0;
1710 for (SecurityGroupListType::const_iterator sit = isg_list.begin();
1711 sit != isg_list.end(); ++sit) {
1724 if (item.entry.mobility.seqno) {
1726 item.entry.mobility.sticky);
1728 }
else if (item.entry.sequence_number) {
1734 LoadBalance load_balance(item.entry.load_balance);
1740 attrs.push_back(&sbp);
1743 attrs.push_back(&comm);
1745 attrs.push_back(&ext);
1747 attrs.push_back(&largecomm);
1751 attr, flags, label, 0, subscription_gen_id));
1757 if (subscribe_pending) {
1759 request_entry->
Swap(&req);
1763 make_pair(vrf_name, table_name), request_entry));
1770 "Inet6 route " << item.entry.nlri.address <<
1771 " with next-hop " << nh_address <<
" and label " << label <<
1772 " enqueued for " << (add_change ?
"add/change" :
"delete") <<
1773 " to table " << table->
name());
1787 const pugi::xml_node &node,
bool add_change) {
1791 if (!item.XmlParse(node)) {
1793 "Invalid enet route message received");
1799 "Unsupported address family " << item.entry.nlri.af <<
1800 " for enet route " << item.entry.nlri.address);
1806 "Unsupported subsequent address family " << item.entry.nlri.safi <<
1807 " for enet route " << item.entry.nlri.mac);
1813 IpAddress group= IpAddress::from_string(
"0.0.0.0", error);
1814 if (!item.entry.nlri.group.empty()) {
1817 item.entry.nlri.group, &group,
false)) {
1819 "Bad group address " << item.entry.nlri.group);
1823 IpAddress source = IpAddress::from_string(
"0.0.0.0", error);
1825 item.entry.nlri.af, item.entry.nlri.source, &source,
true)) {
1827 "Bad source address " << item.entry.nlri.source);
1835 "Bad mac address " << item.entry.nlri.mac);
1839 bool type2 = type6 ? false : !mac_addr.
IsZero();
1844 if (!item.entry.nlri.address.empty()) {
1845 size_t pos = item.entry.nlri.address.find(
'/');
1846 if (pos == string::npos) {
1848 "Missing / in address " << item.entry.nlri.address);
1852 bool ipv6 = item.entry.nlri.address.find(
':') != string::npos;
1859 "Cannot parse inet prefix string " <<
1860 item.entry.nlri.address);
1864 if (type2 && inet_prefix.
prefixlen() != 32 &&
1865 item.entry.nlri.address !=
"0.0.0.0/0") {
1868 "Bad inet address " << item.entry.nlri.address);
1881 "Cannot parse inet6 prefix string " <<
1882 item.entry.nlri.address);
1886 if (type2 && inet6_prefix.
prefixlen() != 128 &&
1887 item.entry.nlri.address !=
"::/0") {
1890 "Bad inet6 address " << item.entry.nlri.address);
1898 bool subscribe_pending;
1900 uint64_t subscription_gen_id;
1903 &subscription_gen_id, &subscribe_pending, add_change)) {
1918 uint32_t ethernet_tag = item.entry.nlri.ethernet_tag;
1922 type2 ?
EvpnPrefix(rd, ethernet_tag, mac_addr, ip_addr) :
1932 uint32_t l3_label = 0;
1938 const EnetNextHopListType &inh_list = item.entry.next_hops;
1940 if (inh_list.next_hop.empty()) {
1948 if (inh_list.next_hop.size() != 1) {
1951 "More than one nexthop received for enet route " <<
1956 EnetNextHopListType::const_iterator nit = inh_list.begin();
1967 nh_address = nhop_address;
1969 l3_label = nit->l3_label;
1970 if (!nit->mac.empty()) {
1976 "Bad next-hop mac address " << nit->mac <<
1985 bool no_tunnel_encap =
true;
1986 bool no_valid_tunnel_encap =
true;
1987 for (EnetTunnelEncapsulationListType::const_iterator eit =
1988 nit->tunnel_encapsulation_list.begin();
1989 eit != nit->tunnel_encapsulation_list.end(); ++eit) {
1990 no_tunnel_encap =
false;
1994 no_valid_tunnel_encap =
false;
2004 if (!no_tunnel_encap && no_valid_tunnel_encap) {
2009 uint16_t tag_index = 0;
2010 for (TagListType::const_iterator tit = nit->tag_list.begin();
2011 tit != nit->tag_list.end(); ++tit) {
2020 Tag tag(tag_index, *tit);
2032 if (nit->local_sequence_number) {
2039 attrs.push_back(&local_pref);
2044 uint32_t med_value = item.entry.med;
2049 attrs.push_back(&med);
2054 if (item.entry.replicator_address.empty() &&
2055 item.entry.edge_replication_not_supported) {
2057 flags &= ~
BgpPath::CheckGlobalErmVpnRoute;
2058 attrs.push_back(&nexthop);
2061 attrs.push_back(&nexthop);
2068 nh_address.to_v4().to_ulong(), instance_id));
2071 nh_address.to_v4().to_ulong(), instance_id));
2073 attrs.push_back(&source_rd);
2076 const EnetSecurityGroupListType &isg_list =
2077 item.entry.security_group_list;
2078 uint16_t sg_index = 0;
2079 for (EnetSecurityGroupListType::const_iterator sit = isg_list.begin();
2080 sit != isg_list.end(); ++sit) {
2093 if (item.entry.mobility.seqno) {
2095 item.entry.mobility.sticky);
2097 }
else if (item.entry.sequence_number) {
2102 ETree etree(item.entry.etree_leaf);
2106 attrs.push_back(&ext);
2108 attrs.push_back(&largecomm);
2112 if (!item.entry.replicator_address.empty()) {
2115 item.entry.replicator_address, &replicator_address)) {
2118 "Bad replicator address " <<
2119 item.entry.replicator_address <<
2129 if (item.entry.assisted_replication_supported) {
2133 if (!item.entry.edge_replication_not_supported) {
2140 pmsi_spec.
SetLabel(label, &ext_comm);
2141 attrs.push_back(&pmsi_spec);
2147 attr, flags, label, l3_label, subscription_gen_id));
2155 if (subscribe_pending) {
2157 request_entry->
Swap(&req);
2161 make_pair(vrf_name, table_name), request_entry));
2169 " with next-hop " << nh_address <<
2170 " label " << label <<
" l3-label " << l3_label <<
2171 " enqueued for " << (add_change ?
"add/change" :
"delete"));
2178 unique_ptr<DBRequest> ptr(request);
2182 if (table == NULL || table->
IsDeleted()) {
2188 int instance_id = -1;
2189 uint64_t subscription_gen_id = 0;
2191 &instance_id, &subscription_gen_id);
2192 if (!is_registered) {
2195 "Not subscribed to table " << table->
name());
2200 ->set_subscription_gen_id(subscription_gen_id);
2225 "Subscribe to table " << table->
name() <<
2226 (tmr_state->
no_ribout ?
" (no ribout)" :
"") <<
2257 "Unsubscribe to table " << table->
name());
2262 #define RegisterTable(table, tmr_state) \
2263 RegisterTable(__LINE__, table, tmr_state)
2264 #define UnregisterTable(table) UnregisterTable(__LINE__, table)
2269 BOOST_FOREACH(TableMembershipRequestMap::value_type &entry,
2298 "Table not in subscribe/unsubscribe request queue");
2305 "Subscribe to table " << table_name <<
" completed");
2310 "Unsubscribe to table " << table_name <<
" completed");
2376 assert(
defer_q_.count(vrf_n_table) == 0);
2385 for (DeferQ::iterator it =
defer_q_.find(vrf_n_table);
2386 it !=
defer_q_.end() && it->first.second == table->
name(); ++it) {
2405 vector<BgpNeighborRoutingInstance> instance_list;
2406 BOOST_FOREACH(
const SubscribedRoutingInstanceList::value_type &entry,
2408 BgpNeighborRoutingInstance instance;
2409 instance.set_name(entry.first->name());
2410 if (entry.second.IsLlgrStale()) {
2411 instance.set_state(
"subscribed-llgr-stale");
2412 }
else if (entry.second.IsGrStale()) {
2413 instance.set_state(
"subscribed-gr-stale");
2415 instance.set_state(
"subscribed");
2417 instance.set_index(entry.second.index);
2419 instance_list.push_back(instance);
2421 BOOST_FOREACH(
const InstanceMembershipRequestMap::value_type &entry,
2424 BgpNeighborRoutingInstance instance;
2425 instance.set_name(entry.first);
2426 instance.set_state(
"pending");
2428 instance_list.push_back(instance);
2430 resp->set_routing_instances(instance_list);
2434 vector<BgpNeighborRoutingTable> old_table_list = resp->get_routing_tables();
2435 set<string> old_table_set;
2436 vector<BgpNeighborRoutingTable> new_table_list;
2438 BOOST_FOREACH(
const BgpNeighborRoutingTable &table, old_table_list) {
2439 old_table_set.insert(table.get_name());
2441 new_table_list.push_back(table);
2444 BOOST_FOREACH(
const TableMembershipRequestMap::value_type &entry,
2446 BgpNeighborRoutingTable table;
2447 table.set_name(entry.first);
2448 if (old_table_set.find(entry.first) != old_table_set.end())
2449 table.set_current_state(
"subscribed");
2452 table.set_current_request(
"subscribe");
2454 table.set_current_request(
"unsubscribe");
2457 table.set_pending_request(
"subscribe");
2459 table.set_pending_request(
"unsubscribe");
2461 new_table_list.push_back(table);
2463 resp->set_routing_tables(new_table_list);
2470 for (DeferQ::iterator it =
2471 defer_q_.find(make_pair(vrf_name, table_name)), itnext;
2472 (it !=
defer_q_.end() && it->first.second == table_name);
2485 for (DeferQ::iterator it =
2486 defer_q_.lower_bound(make_pair(vrf_name,
string())), itnext;
2487 (it !=
defer_q_.end() && it->first.first == vrf_name);
2500 BOOST_FOREACH(SubscribedRoutingInstanceList::value_type &entry,
2502 entry.second.SetGrStale();
2511 BOOST_FOREACH(SubscribedRoutingInstanceList::value_type &entry,
2513 assert(entry.second.IsGrStale());
2514 entry.second.SetLlgrStale();
2525 if (i->second.IsGrStale()) {
2526 string name = i->first->name();
2533 "Instance subscription " << name <<
2534 " is still stale and hence unsubscribed");
2550 "Instance subscription " << rt_instance->
name() <<
2551 " stale flag is cleared");
2559 pair<SubscribedRoutingInstanceList::iterator, bool> ret =
2561 rt_instance, state));
2578 SubscribedRoutingInstanceList::iterator loc =
2585 SubscribedRoutingInstanceList::const_iterator loc =
2596 for (RoutingInstance::RouteTableList::const_iterator it = rt_list.begin();
2597 it != rt_list.end(); ++it) {
2612 int instance_id = -1;
2613 bool no_ribout =
false;
2618 for (xml_node node =
options.first_child(); node;
2619 node = node.next_sibling()) {
2620 if (strcmp(node.name(),
"instance-id") == 0) {
2621 instance_id = node.text().as_int();
2623 if (strcmp(node.name(),
"no-ribout") == 0) {
2624 no_ribout = node.text().as_bool();
2630 assert(instance_mgr);
2632 if (rt_instance == NULL) {
2635 "Routing instance " << vrf_name <<
2636 " not found when processing " <<
2637 (add_change ?
"subscribe" :
"unsubscribe"));
2642 "Duplicate subscribe for routing instance " <<
2643 vrf_name <<
", triggering close");
2657 "Spurious unsubscribe for routing instance " <<
2658 vrf_name <<
", triggering close");
2663 }
else if (rt_instance->
deleted()) {
2666 "Routing instance " << vrf_name <<
2667 " is being deleted when processing " <<
2668 (add_change ?
"subscribe" :
"unsubscribe"));
2673 "Duplicate subscribe for routing instance " <<
2674 vrf_name <<
", triggering close");
2679 "Duplicate subscribe for routing instance " <<
2680 vrf_name <<
", triggering close");
2700 "Spurious unsubscribe for routing instance " <<
2701 vrf_name <<
", triggering close");
2715 "Duplicate subscribe for routing instance " <<
2716 vrf_name <<
", triggering close");
2723 "Duplicate subscribe for routing instance " <<
2724 vrf_name <<
" under GR, triggering close");
2734 "Spurious unsubscribe for routing instance " <<
2735 vrf_name <<
", triggering close");
2751 for (RoutingInstance::RouteTableList::const_iterator it = rt_list.begin();
2752 it != rt_list.end(); ++it) {
2771 if (
defer_q_.count(make_pair(vrf_name, table->
name()))) {
2774 "Flush deferred route requests for table " <<
2775 table->
name() <<
" on unsubscribe");
2809 string error_message) {
2811 "Timer error: " << error_name <<
" " << error_message);
2815 if (!
peer_->IsReady())
2833 "EndOfRib Receive timer rescheduled to fire after " <<
2852 if (!
peer_->IsReady())
2867 "EndOfRib Send timer rescheduled to fire after " <<
2886 timeout <<
" second(s)");
2897 if (!
peer_->send_ready())
2924 msg +=
"\n<message from=\"";
2927 msg +=
peer_->ToString();
2931 msg +=
"\n\t<event xmlns=\"http://jabber.org/protocol/pubsub\">";
2934 msg +=
"\n\t</event>\n</message>\n";
2946 bool expect_prefix_len)
const {
2949 char *str =
const_cast<char *
>(s.c_str());
2950 char *saveptr, *token;
2951 token = strtok_r(str,
"/", &saveptr);
2952 if (!token || !saveptr)
2954 token = strtok_r(NULL,
"/", &saveptr);
2955 if (!token || !saveptr)
2957 token = strtok_r(NULL,
"/", &saveptr);
2958 if (!token || !saveptr)
2960 token = strtok_r(NULL,
"/", &saveptr);
2961 if (!token || !saveptr)
2963 if (expect_prefix_len) {
2964 token = strtok_r(NULL,
"/", &saveptr);
2965 if (!token || !saveptr)
2968 token = strtok_r(NULL,
"/", &saveptr);
2971 return strtoul(token, NULL, 0);
2989 if (iq->
iq_type.compare(
"set") == 0) {
2990 if (iq->
action.compare(
"subscribe") == 0) {
2992 }
else if (iq->
action.compare(
"unsubscribe") == 0) {
2994 }
else if (iq->
action.compare(
"publish") == 0) {
2998 xml_node item =
pugi->FindNode(
"item");
3004 "EndOfRib marker received");
3009 for (; item; item = item.next_sibling()) {
3010 if (strcmp(item.name(),
"item") != 0)
continue;
3012 string id(iq->
as_node.c_str());
3013 char *str =
const_cast<char *
>(
id.c_str());
3015 char *af = strtok_r(str,
"/", &saveptr);
3016 char *safi = strtok_r(NULL,
"/", &saveptr);
3053 : xmpp_server_(xmpp_server),
3054 bgp_server_(server),
3055 queue_(
TaskScheduler::GetInstance()->GetTaskId(
"bgp::Config"), 0,
3058 asn_listener_id_(-1),
3059 identifier_listener_id_(-1),
3060 dscp_listener_id_(-1) {
3128 as_t old_local_asn) {
3130 BOOST_FOREACH(XmppChannelMap::value_type &i,
channel_map_) {
3131 i.second->rtarget_manager()->ASNUpdateCallback(old_asn, old_local_asn);
3146 BOOST_FOREACH(XmppChannelMap::value_type &i,
channel_map_) {
3147 i.second->RoutingInstanceCallback(vrf_name, op);
3152 std::scoped_lock lock(
mutex_);
3153 BOOST_FOREACH(XmppChannelMap::value_type &i,
channel_map_) {
3160 std::scoped_lock lock(
mutex_);
3161 BOOST_FOREACH(
const XmppChannelMap::value_type &i,
channel_map_) {
3167 BOOST_FOREACH(XmppChannelMap::value_type &i,
channel_map_) {
3168 if (i.second->ToString() == client) {
3200 std::scoped_lock lock(
mutex_);
3202 XmppChannelMap::iterator it =
channel_map_.find(channel);
3207 channel_map_.insert(make_pair(channel, bgp_xmpp_channel));
3209 make_pair(channel->
ToString(), bgp_xmpp_channel));
3213 "Received XmppChannel up event");
3218 "No BGP configuration for self - closing channel");
3219 if (!getenv(
"CONTRAIL_CAT_FRAMEWORK"))
3226 "BGP is administratively down - closing channel");
3230 bgp_xmpp_channel = (*it).second;
3242 "Graceful Closure in progress - Closing channel");
3255 bgp_xmpp_channel = (*it).second;
3259 "Received XmppChannel down event");
3262 bgp_xmpp_channel->
Close();
3265 os <<
"Peer not found for " << channel->
ToString() <<
3266 " on channel down event";
3273 PeerStatsInfo stats;
3276 XmppPeerInfoData peer_info;
3278 peer_info.set_peer_stats_info(stats);
3279 assert(!peer_info.get_name().empty());
3282 PeerStatsData peer_stats_data;
3284 peer_stats_data.set_encoding(
"XMPP");
3287 assert(!peer_stats_data.get_name().empty());
3288 BGP_UVE_SEND2(PeerStatsUve, peer_stats_data,
"ObjectXmppPeerInfo");
3296 bool change =
false;
3297 uint32_t num_xmpp =
count();
3298 if (first || num_xmpp != state->get_num_xmpp_peer()) {
3299 state->set_num_xmpp_peer(num_xmpp);
3304 if (first || num_up_xmpp != state->get_num_up_xmpp_peer()) {
3305 state->set_num_up_xmpp_peer(num_up_xmpp);
3310 if (first || num_deleting_xmpp != state->get_num_deleting_xmpp_peer()) {
3311 state->set_num_deleting_xmpp_peer(num_deleting_xmpp);
3367 peer_->SetPeerClosed(flag);
3374 return peer_->IsDeleted();
3381 return peer_->closed_at();
3385 SubscribedRoutingInstanceList::const_iterator it =
3388 return it->second.IsGrStale();
3392 SubscribedRoutingInstanceList::const_iterator it =
3395 return it->second.IsLlgrStale();
3404 SubscribedRoutingInstanceList::const_iterator it =
3407 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
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.
const uint64_t GetExtCommunityValue() const
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)