7 #include <boost/assign/list_of.hpp>
8 #include <boost/foreach.hpp>
41 #include "control-node/sandesh/control_node_types.h"
43 #include "schema/xmpp_multicast_types.h"
44 #include "schema/xmpp_enet_types.h"
45 #include "schema/xmpp_mvpn_types.h"
50 #include "xmpp/sandesh/xmpp_peer_info_types.h"
52 using autogen::EnetItemType;
53 using autogen::EnetNextHopListType;
54 using autogen::EnetSecurityGroupListType;
55 using autogen::EnetTunnelEncapsulationListType;
57 using autogen::McastItemType;
58 using autogen::McastNextHopsType;
59 using autogen::McastTunnelEncapsulationListType;
61 using autogen::MvpnItemType;
62 using autogen::MvpnNextHopType;
63 using autogen::MvpnTunnelEncapsulationListType;
65 using autogen::ItemType;
66 using autogen::NextHopListType;
67 using autogen::SecurityGroupListType;
68 using autogen::CommunityTagListType;
69 using autogen::TunnelEncapsulationListType;
70 using autogen::TagListType;
72 using boost::assign::list_of;
74 using boost::system::error_code;
79 using std::unique_ptr;
81 using std::numeric_limits;
82 using std::ostringstream;
96 if (local_pref == 100)
98 if (local_pref == 200)
100 return numeric_limits<uint32_t>::max() - local_pref;
108 ++inet6_rx_bad_prefix_count;
112 ++inet6_rx_bad_nexthop_count;
116 ++inet6_rx_bad_afi_safi_count;
120 return inet6_rx_bad_xml_token_count;
124 return inet6_rx_bad_prefix_count;
128 return inet6_rx_bad_nexthop_count;
132 return inet6_rx_bad_afi_safi_count;
273 XmppPeerInfoData peer_info;
275 peer_info.set_deleted(
true);
278 PeerStatsData peer_stats_data;
279 peer_stats_data.set_name(
ToUVEKey());
280 peer_stats_data.set_deleted(
true);
281 assert(!peer_stats_data.get_name().empty());
282 BGP_UVE_SEND2(PeerStatsUve, peer_stats_data,
"ObjectXmppPeerInfo");
296 const std::string *msg_str);
297 virtual bool SendUpdate(
const uint8_t *msg,
size_t msgsize) {
324 uint32_t path_flags)
const {
350 virtual void Close(
bool graceful);
366 if (remote.address().is_v4()) {
367 return remote.address().to_v4().to_ulong();
392 return std::vector<std::string>();
430 static char *skip_env_ = getenv(
"XMPP_SKIP_UPDATE_SEND");
445 const string *msg_str) {
448 parent_->stats_[
TX].rt_updates++;
449 if (parent_->SkipUpdateSend())
459 if (parent_->eor_send_timer_ && parent_->eor_send_timer_->running())
460 parent_->eor_send_timer_->Cancel();
470 parent_->set_peer_closed(
true);
480 parent_->ClearEndOfRibState();
482 parent_->peer_close_->Close(graceful);
509 TaskScheduler::GetInstance()->GetTaskId(
"xmpp::StateMachine"),
518 "EndOfRib receive timer",
523 "EndOfRib send timer",
557 assert(!peer_info.get_name().empty());
598 assert(instance_mgr);
614 rt_instance, &sub_state->
targets);
636 *addrp = IpAddress::from_string(address, error);
640 return (zero_ok ?
true : !addrp->is_unspecified());
647 int *instance_id, uint64_t *subscription_gen_id,
RequestType *req_type) {
649 *subscription_gen_id = 0;
660 instance_id, subscription_gen_id);
686 const string &table_name) {
687 TableMembershipRequestMap::iterator loc =
698 const string &table_name)
const {
699 TableMembershipRequestMap::const_iterator loc =
725 InstanceMembershipRequestMap::const_iterator loc =
741 int *instance_id, uint64_t *subscription_gen_id,
bool *subscribe_pending,
744 *subscribe_pending =
false;
749 *table = rt_instance->
GetTable(family);
750 if (rt_instance != NULL && !rt_instance->
deleted()) {
753 subscription_gen_id, &req_type)) {
758 "Received route after unsubscribe");
761 *subscribe_pending =
true;
764 if (*instance_id < 0) {
767 "Received route without subscribe");
779 *subscribe_pending =
true;
780 }
else if (add_change || !rt_instance) {
791 const pugi::xml_node &node,
bool add_change) {
795 if (!item.XmlParse(node)) {
803 "Unsupported address family " << item.entry.nlri.af <<
804 " for multicast route");
811 item.entry.nlri.safi <<
" for multicast route");
816 IpAddress grp_address = IpAddress::from_string(
"0.0.0.0", error);
817 if (!item.entry.nlri.group.empty()) {
819 item.entry.nlri.group, &grp_address,
false)) {
821 "Bad group address " << item.entry.nlri.group);
826 IpAddress src_address = IpAddress::from_string(
"0.0.0.0", error);
827 if (!item.entry.nlri.source.empty()) {
829 item.entry.nlri.source, &src_address,
true)) {
831 "Bad source address " << item.entry.nlri.source);
836 bool subscribe_pending;
838 uint64_t subscription_gen_id;
841 &subscription_gen_id, &subscribe_pending, add_change)) {
847 uint16_t cluster_seed =
858 grp_address.to_v4(), src_address.to_v4());
866 string label_range(
"none");
870 vector<uint32_t> labels;
871 const McastNextHopsType &inh_list = item.entry.next_hops;
873 if (inh_list.next_hop.empty()) {
881 if (inh_list.next_hop.size() != 1) {
883 "More than one nexthop received for multicast route " <<
888 McastNextHopsType::const_iterator nit = inh_list.begin();
891 label_range = nit->label;
893 labels.size() != 2) {
895 "Bad label range " << label_range <<
896 " for multicast route " << mc_prefix.
ToString());
900 if (!labels[0] || !labels[1] || labels[1] < labels[0]) {
903 " for multicast route " << mc_prefix.
ToString());
911 attrs.push_back(&attr_label);
918 " for multicast route " << mc_prefix.
ToString());
922 attrs.push_back(&nexthop);
925 bool no_tunnel_encap =
true;
926 bool no_valid_tunnel_encap =
true;
927 for (McastTunnelEncapsulationListType::const_iterator eit =
928 nit->tunnel_encapsulation_list.begin();
929 eit != nit->tunnel_encapsulation_list.end(); ++eit) {
930 no_tunnel_encap =
false;
934 no_valid_tunnel_encap =
false;
940 if (!no_tunnel_encap && no_valid_tunnel_encap) {
945 attrs.push_back(&ext);
949 attr, flags, 0, 0, subscription_gen_id));
957 if (subscribe_pending) {
959 request_entry->
Swap(&req);
963 make_pair(vrf_name, table_name), request_entry));
970 "Multicast group " << item.entry.nlri.group <<
971 " source " << item.entry.nlri.source <<
972 " and label range " << label_range <<
973 " enqueued for " << (add_change ?
"add/change" :
"delete"));
979 IpAddress src_address,
bool add_change, uint64_t subscription_gen_id,
980 int instance_id,
DBRequest& req,
const MvpnNextHopType &nexthop) {
983 grp_address.to_v4(), src_address.to_v4());
1001 attrs.push_back(&source_rd);
1004 attr, flags, 0, 0, subscription_gen_id));
1013 IpAddress src_address,
bool add_change, uint64_t subscription_gen_id,
1017 grp_address.to_v4(), src_address.to_v4());
1030 attrs.push_back(&nexthop);
1034 attr, flags, 0, 0, subscription_gen_id));
1043 const pugi::xml_node &node,
bool add_change) {
1047 if (!item.XmlParse(node)) {
1055 "Unsupported address family " << item.entry.nlri.af <<
1056 " for multicast route");
1063 item.entry.nlri.safi <<
" for multicast route");
1067 if (item.entry.nlri.group.empty()) {
1069 "Mandatory group address not specified");
1074 IpAddress grp_address = IpAddress::from_string(
"0.0.0.0", error);
1076 item.entry.nlri.group, &grp_address,
false)) {
1078 "Bad group address " << item.entry.nlri.group);
1082 if (item.entry.nlri.source.empty()) {
1084 "Mandatory source address not specified");
1088 IpAddress src_address = IpAddress::from_string(
"0.0.0.0", error);
1090 item.entry.nlri.source, &src_address,
true)) {
1092 "Bad source address " << item.entry.nlri.source);
1096 bool subscribe_pending;
1098 uint64_t subscription_gen_id;
1101 &subscription_gen_id, &subscribe_pending, add_change)) {
1106 int rt_type = item.entry.nlri.route_type;
1111 subscription_gen_id, req);
1114 subscription_gen_id, instance_id, req, item.entry.next_hop);
1117 "Unsupported route type " << item.entry.nlri.route_type);
1126 if (subscribe_pending) {
1128 request_entry->
Swap(&req);
1132 make_pair(vrf_name, table_name), request_entry));
1138 "Multicast group " << item.entry.nlri.group <<
1139 " source " << item.entry.nlri.source <<
1140 " enqueued for " << (add_change ?
"add/change" :
"delete"));
1146 const pugi::xml_node &node,
bool add_change,
int primary_instance_id) {
1150 if (!item.XmlParse(node)) {
1152 "Invalid inet route message received");
1158 "Unsupported address family " << item.entry.nlri.af <<
1159 " for inet route " << item.entry.nlri.address);
1166 "Unsupported subsequent address family " << item.entry.nlri.safi <<
1167 " for inet route " << item.entry.nlri.address);
1175 "Bad inet route " << item.entry.nlri.address);
1179 if (add_change && item.entry.next_hops.next_hop.empty()) {
1181 "Missing next-hops for inet route " << inet_prefix.
ToString());
1190 bool subscribe_pending;
1192 uint64_t subscription_gen_id;
1195 item.entry.nlri.safi);
1197 &subscription_gen_id, &subscribe_pending, add_change)) {
1216 const NextHopListType &inh_list = item.entry.next_hops;
1219 if (inh_list.next_hop.size() != 1) {
1222 "More than one nexthop received for inet route " <<
1227 NextHopListType::const_iterator nit = inh_list.begin();
1233 "Bad nexthop address " << nit->address <<
1234 " for inet route " << inet_prefix.
ToString());
1239 ((master && nit->label) &&
1243 "Bad label " << nit->label <<
1244 " for inet route " << inet_prefix.
ToString());
1251 "Bad label " << nit->label <<
1252 " for inet route in master instance(mpls)/non master instance" <<
1257 nh_address = nhop_address;
1261 bool no_tunnel_encap =
true;
1262 bool no_valid_tunnel_encap =
true;
1263 for (TunnelEncapsulationListType::const_iterator eit =
1264 nit->tunnel_encapsulation_list.begin();
1265 eit != nit->tunnel_encapsulation_list.end(); ++eit) {
1266 no_tunnel_encap =
false;
1270 no_valid_tunnel_encap =
false;
1276 if (!no_tunnel_encap && no_valid_tunnel_encap && !master) {
1281 if (!nit->mac.empty()) {
1287 "Bad next-hop mac address " << nit->mac);
1290 if (!mac_addr.
IsZero()) {
1297 uint16_t tag_index = 0;
1298 for (TagListType::const_iterator tit = nit->tag_list.begin();
1299 tit != nit->tag_list.end(); ++tit) {
1308 Tag tag(tag_index, *tit);
1320 if (nit->local_sequence_number) {
1327 attrs.push_back(&local_pref);
1331 uint32_t med_value = item.entry.med;
1336 attrs.push_back(&med);
1339 const CommunityTagListType &ict_list = item.entry.community_tag_list;
1340 for (CommunityTagListType::const_iterator cit = ict_list.begin();
1341 cit != ict_list.end(); ++cit) {
1343 uint32_t rt_community =
1350 uint32_t addr = nh_address.to_v4().to_ulong();
1352 attrs.push_back(&nexthop);
1353 uint16_t cluster_seed =
1356 if (!master || primary_instance_id) {
1358 instance_id = primary_instance_id;
1366 attrs.push_back(&source_rd);
1370 uint16_t sg_index = 0;
1371 const SecurityGroupListType &isg_list = item.entry.security_group_list;
1372 for (SecurityGroupListType::const_iterator sit = isg_list.begin();
1373 sit != isg_list.end(); ++sit) {
1386 if (item.entry.mobility.seqno) {
1388 item.entry.mobility.sticky);
1390 }
else if (item.entry.sequence_number) {
1396 LoadBalance load_balance(item.entry.load_balance);
1401 attrs.push_back(&comm);
1403 attrs.push_back(&ext);
1405 attrs.push_back(&largecomm);
1409 attrs.push_back(&sbp);
1413 attr, flags, label, 0, subscription_gen_id));
1419 if (subscribe_pending) {
1421 request_entry->
Swap(&req);
1425 make_pair(vrf_name, table_name), request_entry));
1432 "Inet route " << item.entry.nlri.address <<
1433 " with next-hop " << nh_address <<
" and label " << label <<
1434 " enqueued for " << (add_change ?
"add/change" :
"delete") <<
1435 " to table " << table->
name());
1448 const pugi::xml_node &node,
bool add_change) {
1452 if (!item.XmlParse(node)) {
1455 "Invalid inet6 route message received");
1462 "Unsupported address family " << item.entry.nlri.af <<
1463 " for inet6 route " << item.entry.nlri.address);
1470 "Unsupported subsequent address family " << item.entry.nlri.safi <<
1471 " for inet6 route " << item.entry.nlri.address);
1481 "Bad inet6 route " << item.entry.nlri.address);
1485 if (add_change && item.entry.next_hops.next_hop.empty()) {
1487 "Missing next-hops for inet6 route " << inet6_prefix.
ToString());
1500 bool subscribe_pending;
1502 uint64_t subscription_gen_id;
1505 &subscription_gen_id, &subscribe_pending, add_change)) {
1530 const NextHopListType &inh_list = item.entry.next_hops;
1533 if (inh_list.next_hop.size() != 1) {
1536 "More than one nexthop received for inet6 route " <<
1541 NextHopListType::const_iterator nit = inh_list.begin();
1548 "Bad nexthop address " << nit->address <<
1549 " for inet6 route " << inet6_prefix.
ToString());
1557 "Bad label " << nit->vni <<
1558 " for inet6 route " << inet6_prefix.
ToString());
1563 if (nit->mac.empty())
1571 "Bad next-hop mac address " << nit->mac);
1580 "Bad label " << nit->label <<
1581 " for inet6 route " << inet6_prefix.
ToString());
1584 if (!master && !nit->label)
1588 nh_address = nhop_address;
1596 bool no_tunnel_encap =
true;
1597 bool no_valid_tunnel_encap =
true;
1598 for (TunnelEncapsulationListType::const_iterator eit =
1599 nit->tunnel_encapsulation_list.begin();
1600 eit != nit->tunnel_encapsulation_list.end(); ++eit) {
1601 no_tunnel_encap =
false;
1605 no_valid_tunnel_encap =
false;
1611 if (!no_tunnel_encap && no_valid_tunnel_encap && !master) {
1616 if (!nit->mac.empty()) {
1622 "Bad next-hop mac address " << nit->mac);
1625 if (!mac_addr.
IsZero()) {
1632 uint16_t tag_index = 0;
1633 for (TagListType::const_iterator tit = nit->tag_list.begin();
1634 tit != nit->tag_list.end(); ++tit) {
1643 Tag tag(tag_index, *tit);
1656 if (nit->local_sequence_number) {
1663 attrs.push_back(&local_pref);
1667 uint32_t med_value = item.entry.med;
1672 attrs.push_back(&med);
1675 const CommunityTagListType &ict_list =
1676 item.entry.community_tag_list;
1677 for (CommunityTagListType::const_iterator cit = ict_list.begin();
1678 cit != ict_list.end(); ++cit) {
1680 uint32_t rt_community =
1688 attrs.push_back(&nexthop);
1692 uint32_t addr = nh_address.to_v4().to_ulong();
1693 uint16_t cluster_seed =
1702 attrs.push_back(&source_rd);
1706 const SecurityGroupListType &isg_list =
1707 item.entry.security_group_list;
1708 uint16_t sg_index = 0;
1709 for (SecurityGroupListType::const_iterator sit = isg_list.begin();
1710 sit != isg_list.end(); ++sit) {
1723 if (item.entry.mobility.seqno) {
1725 item.entry.mobility.sticky);
1727 }
else if (item.entry.sequence_number) {
1733 LoadBalance load_balance(item.entry.load_balance);
1739 attrs.push_back(&sbp);
1742 attrs.push_back(&comm);
1744 attrs.push_back(&ext);
1746 attrs.push_back(&largecomm);
1750 attr, flags, label, 0, subscription_gen_id));
1756 if (subscribe_pending) {
1758 request_entry->
Swap(&req);
1762 make_pair(vrf_name, table_name), request_entry));
1769 "Inet6 route " << item.entry.nlri.address <<
1770 " with next-hop " << nh_address <<
" and label " << label <<
1771 " enqueued for " << (add_change ?
"add/change" :
"delete") <<
1772 " to table " << table->
name());
1786 const pugi::xml_node &node,
bool add_change) {
1790 if (!item.XmlParse(node)) {
1792 "Invalid enet route message received");
1798 "Unsupported address family " << item.entry.nlri.af <<
1799 " for enet route " << item.entry.nlri.address);
1805 "Unsupported subsequent address family " << item.entry.nlri.safi <<
1806 " for enet route " << item.entry.nlri.mac);
1812 IpAddress group= IpAddress::from_string(
"0.0.0.0", error);
1813 if (!item.entry.nlri.group.empty()) {
1816 item.entry.nlri.group, &group,
false)) {
1818 "Bad group address " << item.entry.nlri.group);
1822 IpAddress source = IpAddress::from_string(
"0.0.0.0", error);
1824 item.entry.nlri.af, item.entry.nlri.source, &source,
true)) {
1826 "Bad source address " << item.entry.nlri.source);
1834 "Bad mac address " << item.entry.nlri.mac);
1838 bool type2 = type6 ? false : !mac_addr.
IsZero();
1843 if (!item.entry.nlri.address.empty()) {
1844 size_t pos = item.entry.nlri.address.find(
'/');
1845 if (pos == string::npos) {
1847 "Missing / in address " << item.entry.nlri.address);
1851 bool ipv6 = item.entry.nlri.address.find(
':') != string::npos;
1858 "Cannot parse inet prefix string " <<
1859 item.entry.nlri.address);
1863 if (type2 && inet_prefix.
prefixlen() != 32 &&
1864 item.entry.nlri.address !=
"0.0.0.0/0") {
1867 "Bad inet address " << item.entry.nlri.address);
1880 "Cannot parse inet6 prefix string " <<
1881 item.entry.nlri.address);
1885 if (type2 && inet6_prefix.
prefixlen() != 128 &&
1886 item.entry.nlri.address !=
"::/0") {
1889 "Bad inet6 address " << item.entry.nlri.address);
1897 bool subscribe_pending;
1899 uint64_t subscription_gen_id;
1902 &subscription_gen_id, &subscribe_pending, add_change)) {
1917 uint32_t ethernet_tag = item.entry.nlri.ethernet_tag;
1921 type2 ?
EvpnPrefix(rd, ethernet_tag, mac_addr, ip_addr) :
1931 uint32_t l3_label = 0;
1937 const EnetNextHopListType &inh_list = item.entry.next_hops;
1939 if (inh_list.next_hop.empty()) {
1947 if (inh_list.next_hop.size() != 1) {
1950 "More than one nexthop received for enet route " <<
1955 EnetNextHopListType::const_iterator nit = inh_list.begin();
1966 nh_address = nhop_address;
1968 l3_label = nit->l3_label;
1969 if (!nit->mac.empty()) {
1975 "Bad next-hop mac address " << nit->mac <<
1984 bool no_tunnel_encap =
true;
1985 bool no_valid_tunnel_encap =
true;
1986 for (EnetTunnelEncapsulationListType::const_iterator eit =
1987 nit->tunnel_encapsulation_list.begin();
1988 eit != nit->tunnel_encapsulation_list.end(); ++eit) {
1989 no_tunnel_encap =
false;
1993 no_valid_tunnel_encap =
false;
2003 if (!no_tunnel_encap && no_valid_tunnel_encap) {
2008 uint16_t tag_index = 0;
2009 for (TagListType::const_iterator tit = nit->tag_list.begin();
2010 tit != nit->tag_list.end(); ++tit) {
2019 Tag tag(tag_index, *tit);
2031 if (nit->local_sequence_number) {
2038 attrs.push_back(&local_pref);
2043 uint32_t med_value = item.entry.med;
2048 attrs.push_back(&med);
2053 if (item.entry.replicator_address.empty() &&
2054 item.entry.edge_replication_not_supported) {
2056 flags &= ~
BgpPath::CheckGlobalErmVpnRoute;
2057 attrs.push_back(&nexthop);
2060 attrs.push_back(&nexthop);
2067 nh_address.to_v4().to_ulong(), instance_id));
2070 nh_address.to_v4().to_ulong(), instance_id));
2072 attrs.push_back(&source_rd);
2075 const EnetSecurityGroupListType &isg_list =
2076 item.entry.security_group_list;
2077 uint16_t sg_index = 0;
2078 for (EnetSecurityGroupListType::const_iterator sit = isg_list.begin();
2079 sit != isg_list.end(); ++sit) {
2092 if (item.entry.mobility.seqno) {
2094 item.entry.mobility.sticky);
2096 }
else if (item.entry.sequence_number) {
2101 ETree etree(item.entry.etree_leaf);
2105 attrs.push_back(&ext);
2107 attrs.push_back(&largecomm);
2111 if (!item.entry.replicator_address.empty()) {
2114 item.entry.replicator_address, &replicator_address)) {
2117 "Bad replicator address " <<
2118 item.entry.replicator_address <<
2128 if (item.entry.assisted_replication_supported) {
2132 if (!item.entry.edge_replication_not_supported) {
2139 pmsi_spec.
SetLabel(label, &ext_comm);
2140 attrs.push_back(&pmsi_spec);
2146 attr, flags, label, l3_label, subscription_gen_id));
2154 if (subscribe_pending) {
2156 request_entry->
Swap(&req);
2160 make_pair(vrf_name, table_name), request_entry));
2168 " with next-hop " << nh_address <<
2169 " label " << label <<
" l3-label " << l3_label <<
2170 " enqueued for " << (add_change ?
"add/change" :
"delete"));
2177 unique_ptr<DBRequest> ptr(request);
2181 if (table == NULL || table->
IsDeleted()) {
2187 int instance_id = -1;
2188 uint64_t subscription_gen_id = 0;
2190 &instance_id, &subscription_gen_id);
2191 if (!is_registered) {
2194 "Not subscribed to table " << table->
name());
2199 ->set_subscription_gen_id(subscription_gen_id);
2224 "Subscribe to table " << table->
name() <<
2225 (tmr_state->
no_ribout ?
" (no ribout)" :
"") <<
2256 "Unsubscribe to table " << table->
name());
2261 #define RegisterTable(table, tmr_state) \
2262 RegisterTable(__LINE__, table, tmr_state)
2263 #define UnregisterTable(table) UnregisterTable(__LINE__, table)
2268 BOOST_FOREACH(TableMembershipRequestMap::value_type &entry,
2297 "Table not in subscribe/unsubscribe request queue");
2304 "Subscribe to table " << table_name <<
" completed");
2309 "Unsubscribe to table " << table_name <<
" completed");
2375 assert(
defer_q_.count(vrf_n_table) == 0);
2384 for (DeferQ::iterator it =
defer_q_.find(vrf_n_table);
2385 it !=
defer_q_.end() && it->first.second == table->
name(); ++it) {
2404 vector<BgpNeighborRoutingInstance> instance_list;
2405 BOOST_FOREACH(
const SubscribedRoutingInstanceList::value_type &entry,
2407 BgpNeighborRoutingInstance instance;
2408 instance.set_name(entry.first->name());
2409 if (entry.second.IsLlgrStale()) {
2410 instance.set_state(
"subscribed-llgr-stale");
2411 }
else if (entry.second.IsGrStale()) {
2412 instance.set_state(
"subscribed-gr-stale");
2414 instance.set_state(
"subscribed");
2416 instance.set_index(entry.second.index);
2418 instance_list.push_back(instance);
2420 BOOST_FOREACH(
const InstanceMembershipRequestMap::value_type &entry,
2423 BgpNeighborRoutingInstance instance;
2424 instance.set_name(entry.first);
2425 instance.set_state(
"pending");
2427 instance_list.push_back(instance);
2429 resp->set_routing_instances(instance_list);
2433 vector<BgpNeighborRoutingTable> old_table_list = resp->get_routing_tables();
2434 set<string> old_table_set;
2435 vector<BgpNeighborRoutingTable> new_table_list;
2437 BOOST_FOREACH(
const BgpNeighborRoutingTable &table, old_table_list) {
2438 old_table_set.insert(table.get_name());
2440 new_table_list.push_back(table);
2443 BOOST_FOREACH(
const TableMembershipRequestMap::value_type &entry,
2445 BgpNeighborRoutingTable table;
2446 table.set_name(entry.first);
2447 if (old_table_set.find(entry.first) != old_table_set.end())
2448 table.set_current_state(
"subscribed");
2451 table.set_current_request(
"subscribe");
2453 table.set_current_request(
"unsubscribe");
2456 table.set_pending_request(
"subscribe");
2458 table.set_pending_request(
"unsubscribe");
2460 new_table_list.push_back(table);
2462 resp->set_routing_tables(new_table_list);
2469 for (DeferQ::iterator it =
2470 defer_q_.find(make_pair(vrf_name, table_name)), itnext;
2471 (it !=
defer_q_.end() && it->first.second == table_name);
2484 for (DeferQ::iterator it =
2485 defer_q_.lower_bound(make_pair(vrf_name,
string())), itnext;
2486 (it !=
defer_q_.end() && it->first.first == vrf_name);
2499 BOOST_FOREACH(SubscribedRoutingInstanceList::value_type &entry,
2501 entry.second.SetGrStale();
2510 BOOST_FOREACH(SubscribedRoutingInstanceList::value_type &entry,
2512 assert(entry.second.IsGrStale());
2513 entry.second.SetLlgrStale();
2524 if (i->second.IsGrStale()) {
2525 string name = i->first->name();
2532 "Instance subscription " << name <<
2533 " is still stale and hence unsubscribed");
2549 "Instance subscription " << rt_instance->
name() <<
2550 " stale flag is cleared");
2558 pair<SubscribedRoutingInstanceList::iterator, bool> ret =
2560 rt_instance, state));
2577 SubscribedRoutingInstanceList::iterator loc =
2584 SubscribedRoutingInstanceList::const_iterator loc =
2595 for (RoutingInstance::RouteTableList::const_iterator it = rt_list.begin();
2596 it != rt_list.end(); ++it) {
2611 int instance_id = -1;
2612 bool no_ribout =
false;
2617 for (xml_node node =
options.first_child(); node;
2618 node = node.next_sibling()) {
2619 if (strcmp(node.name(),
"instance-id") == 0) {
2620 instance_id = node.text().as_int();
2622 if (strcmp(node.name(),
"no-ribout") == 0) {
2623 no_ribout = node.text().as_bool();
2629 assert(instance_mgr);
2631 if (rt_instance == NULL) {
2634 "Routing instance " << vrf_name <<
2635 " not found when processing " <<
2636 (add_change ?
"subscribe" :
"unsubscribe"));
2641 "Duplicate subscribe for routing instance " <<
2642 vrf_name <<
", triggering close");
2656 "Spurious unsubscribe for routing instance " <<
2657 vrf_name <<
", triggering close");
2662 }
else if (rt_instance->
deleted()) {
2665 "Routing instance " << vrf_name <<
2666 " is being deleted when processing " <<
2667 (add_change ?
"subscribe" :
"unsubscribe"));
2672 "Duplicate subscribe for routing instance " <<
2673 vrf_name <<
", triggering close");
2678 "Duplicate subscribe for routing instance " <<
2679 vrf_name <<
", triggering close");
2699 "Spurious unsubscribe for routing instance " <<
2700 vrf_name <<
", triggering close");
2714 "Duplicate subscribe for routing instance " <<
2715 vrf_name <<
", triggering close");
2722 "Duplicate subscribe for routing instance " <<
2723 vrf_name <<
" under GR, triggering close");
2733 "Spurious unsubscribe for routing instance " <<
2734 vrf_name <<
", triggering close");
2750 for (RoutingInstance::RouteTableList::const_iterator it = rt_list.begin();
2751 it != rt_list.end(); ++it) {
2770 if (
defer_q_.count(make_pair(vrf_name, table->
name()))) {
2773 "Flush deferred route requests for table " <<
2774 table->
name() <<
" on unsubscribe");
2808 string error_message) {
2810 "Timer error: " << error_name <<
" " << error_message);
2814 if (!
peer_->IsReady())
2832 "EndOfRib Receive timer rescheduled to fire after " <<
2851 if (!
peer_->IsReady())
2866 "EndOfRib Send timer rescheduled to fire after " <<
2885 timeout <<
" second(s)");
2896 if (!
peer_->send_ready())
2923 msg +=
"\n<message from=\"";
2926 msg +=
peer_->ToString();
2930 msg +=
"\n\t<event xmlns=\"http://jabber.org/protocol/pubsub\">";
2933 msg +=
"\n\t</event>\n</message>\n";
2945 bool expect_prefix_len)
const {
2948 char *str =
const_cast<char *
>(s.c_str());
2949 char *saveptr, *token;
2950 token = strtok_r(str,
"/", &saveptr);
2951 if (!token || !saveptr)
2953 token = strtok_r(NULL,
"/", &saveptr);
2954 if (!token || !saveptr)
2956 token = strtok_r(NULL,
"/", &saveptr);
2957 if (!token || !saveptr)
2959 token = strtok_r(NULL,
"/", &saveptr);
2960 if (!token || !saveptr)
2962 if (expect_prefix_len) {
2963 token = strtok_r(NULL,
"/", &saveptr);
2964 if (!token || !saveptr)
2967 token = strtok_r(NULL,
"/", &saveptr);
2970 return strtoul(token, NULL, 0);
2988 if (iq->
iq_type.compare(
"set") == 0) {
2989 if (iq->
action.compare(
"subscribe") == 0) {
2991 }
else if (iq->
action.compare(
"unsubscribe") == 0) {
2993 }
else if (iq->
action.compare(
"publish") == 0) {
2997 xml_node item =
pugi->FindNode(
"item");
3003 "EndOfRib marker received");
3008 for (; item; item = item.next_sibling()) {
3009 if (strcmp(item.name(),
"item") != 0)
continue;
3011 string id(iq->
as_node.c_str());
3012 char *str =
const_cast<char *
>(
id.c_str());
3014 char *af = strtok_r(str,
"/", &saveptr);
3015 char *safi = strtok_r(NULL,
"/", &saveptr);
3052 : xmpp_server_(xmpp_server),
3053 bgp_server_(server),
3054 queue_(
TaskScheduler::GetInstance()->GetTaskId(
"bgp::Config"), 0,
3057 asn_listener_id_(-1),
3058 identifier_listener_id_(-1),
3059 dscp_listener_id_(-1) {
3127 as_t old_local_asn) {
3129 BOOST_FOREACH(XmppChannelMap::value_type &i,
channel_map_) {
3130 i.second->rtarget_manager()->ASNUpdateCallback(old_asn, old_local_asn);
3145 BOOST_FOREACH(XmppChannelMap::value_type &i,
channel_map_) {
3146 i.second->RoutingInstanceCallback(vrf_name, op);
3151 tbb::mutex::scoped_lock lock(
mutex_);
3152 BOOST_FOREACH(XmppChannelMap::value_type &i,
channel_map_) {
3159 tbb::mutex::scoped_lock lock(
mutex_);
3160 BOOST_FOREACH(
const XmppChannelMap::value_type &i,
channel_map_) {
3166 BOOST_FOREACH(XmppChannelMap::value_type &i,
channel_map_) {
3167 if (i.second->ToString() == client) {
3199 tbb::mutex::scoped_lock lock(
mutex_);
3201 XmppChannelMap::iterator it =
channel_map_.find(channel);
3206 channel_map_.insert(make_pair(channel, bgp_xmpp_channel));
3208 make_pair(channel->
ToString(), bgp_xmpp_channel));
3212 "Received XmppChannel up event");
3217 "No BGP configuration for self - closing channel");
3218 if (!getenv(
"CONTRAIL_CAT_FRAMEWORK"))
3225 "BGP is administratively down - closing channel");
3229 bgp_xmpp_channel = (*it).second;
3241 "Graceful Closure in progress - Closing channel");
3254 bgp_xmpp_channel = (*it).second;
3258 "Received XmppChannel down event");
3261 bgp_xmpp_channel->
Close();
3264 os <<
"Peer not found for " << channel->
ToString() <<
3265 " on channel down event";
3272 PeerStatsInfo stats;
3275 XmppPeerInfoData peer_info;
3277 peer_info.set_peer_stats_info(stats);
3278 assert(!peer_info.get_name().empty());
3281 PeerStatsData peer_stats_data;
3283 peer_stats_data.set_encoding(
"XMPP");
3286 assert(!peer_stats_data.get_name().empty());
3287 BGP_UVE_SEND2(PeerStatsUve, peer_stats_data,
"ObjectXmppPeerInfo");
3295 bool change =
false;
3296 uint32_t num_xmpp =
count();
3297 if (first || num_xmpp != state->get_num_xmpp_peer()) {
3298 state->set_num_xmpp_peer(num_xmpp);
3303 if (first || num_up_xmpp != state->get_num_up_xmpp_peer()) {
3304 state->set_num_up_xmpp_peer(num_up_xmpp);
3309 if (first || num_deleting_xmpp != state->get_num_deleting_xmpp_peer()) {
3310 state->set_num_deleting_xmpp_peer(num_deleting_xmpp);
3366 peer_->SetPeerClosed(flag);
3373 return peer_->IsDeleted();
3380 return peer_->closed_at();
3384 SubscribedRoutingInstanceList::const_iterator it =
3387 return it->second.IsGrStale();
3391 SubscribedRoutingInstanceList::const_iterator it =
3394 return it->second.IsLlgrStale();
3403 SubscribedRoutingInstanceList::const_iterator it =
3406 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)
tbb::atomic< uint64_t > subscription_gen_id_
virtual void XmppHandleChannelEvent(XmppChannel *channel, xmps::PeerState state)
tbb::atomic< int32_t > deleting_count_
virtual bool DeleteChannel(BgpXmppChannel *channel)
void SetQueueDisable(bool disabled)
void VisitChannels(BgpXmppChannelManager::VisitorFn)
uint32_t NumUpPeer() const
void RemoveChannel(XmppChannel *channel)
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()
tbb::atomic< int > total_path_count_
virtual bool SendUpdate(const uint8_t *msg, size_t msgsize)
tbb::atomic< int > primary_path_count_
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()
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)
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)
tbb::atomic< uint64_t > table_subscribe
tbb::atomic< uint64_t > instance_unsubscribe
tbb::atomic< uint64_t > instance_subscribe
tbb::atomic< uint64_t > table_unsubscribe_complete
tbb::atomic< uint64_t > table_unsubscribe
tbb::atomic< uint64_t > table_subscribe_complete
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()
tbb::atomic< uint64_t > inet6_rx_bad_xml_token_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
void incr_inet6_rx_bad_nexthop_count()
uint64_t get_inet6_rx_bad_prefix_count() const
tbb::atomic< uint64_t > rt_updates
tbb::atomic< uint64_t > end_of_rib
tbb::atomic< uint64_t > unreach
tbb::atomic< uint64_t > reach
RoutingInstance::RouteTargetList targets
std::unique_ptr< DBRequestKey > key
void Swap(DBRequest *rhs)
std::unique_ptr< DBRequestData > data
tbb::atomic< uint64_t > open
tbb::atomic< uint64_t > update
tbb::atomic< uint64_t > keepalive
tbb::atomic< uint64_t > close
tbb::atomic< uint64_t > inet6_bad_prefix_count
tbb::atomic< uint64_t > inet6_bad_afi_safi_count
tbb::atomic< uint64_t > inet6_bad_nexthop_count
tbb::atomic< uint64_t > inet6_bad_xml_token_count
tbb::atomic< uint64_t > total_path_count
tbb::atomic< uint64_t > primary_path_count
tbb::atomic< uint64_t > calls
tbb::atomic< uint64_t > blocked_duration_usecs
tbb::atomic< uint64_t > blocked_count
tbb::atomic< uint64_t > bytes
tbb::atomic< uint64_t > reach
tbb::atomic< uint64_t > unreach
tbb::atomic< uint64_t > end_of_rib
tbb::atomic< uint64_t > total
@ EdgeReplicationSupported
@ AssistedReplicationContrail
void SetIdentifier(Ip4Address identifier)
void SetLabel(uint32_t label, const ExtCommunity *ext)
tbb::atomic< uint64_t > read_calls
tbb::atomic< uint64_t > write_calls
tbb::atomic< uint64_t > write_blocked
tbb::atomic< uint64_t > write_blocked_duration_usecs
tbb::atomic< uint64_t > write_bytes
tbb::atomic< uint64_t > read_bytes
#define CHECK_CONCURRENCY(...)
static time_t UTCTimestamp()
static uint64_t UTCTimestampUsec()
void STLDeleteElements(Container *container)