7 #include <boost/foreach.hpp>
19 using std::unique_ptr;
39 return unique_ptr<DBEntry>(
new InetRoute(prefix));
72 boost::scoped_ptr<Ip4Prefix> inet_prefix;
90 if (dest_route == NULL) {
110 uint32_t prev_flags = 0 , prev_label = 0;
111 const BgpAttr *prev_attr = NULL;
112 if (dest_path != NULL) {
116 if ((new_attr != prev_attr) ||
155 if (dest_path != NULL) {
157 (replicated_path->
GetFlags() == prev_flags) &&
158 (replicated_path->
GetLabel() == prev_label))
192 uinfo_slist->push_front(*uinfo);
206 ext_commp->communities()) {
218 roattr->
attr(), NULL);
225 if (ext_commp->communities().size() > 1) {
227 list.push_back(*origin_vnp);
232 roattr->
attr(), ext_commp);
246 if (inetvpn_attrp && inetvpn_attrp->ext_community()) {
248 inetvpn_attrp->ext_community()->communities()) {
251 inetvpn_rt_origin_vn = &comm;
257 if (inet_attrp && inet_attrp->ext_community()) {
259 inet_attrp->ext_community()->communities()) {
262 inet_rt_origin_vn = &comm;
268 if (inetvpn_rt_origin_vn == inet_rt_origin_vn)
273 if (!inetvpn_rt_origin_vn) {
275 inet_attrp->ext_community());
278 inet_attrp->ext_community(), *inetvpn_rt_origin_vn);
318 if (!inet_attrp || inet_attrp->source_rd().IsZero())
329 assert(inetvpn_table);
339 assert(inet_partition->
index() == inetvpn_partition->
index());
341 inetvpn_table->
TableFind(inetvpn_partition, &inetvpn_rt_key));
365 assert(inetvpn_table);
370 assert(inet_partition->
index() == inetvpn_partition->
index());
373 TableFind(inet_partition, &inet_rt_key));
389 if (new_inet_attrp == inet_attrp)
std::size_t hash_value(BgpAttr const &attr)
boost::intrusive_ptr< const BgpAttr > BgpAttrPtr
BgpAttrPtr ReplaceExtCommunityAndLocate(const BgpAttr *attr, ExtCommunityPtr extcomm)
BgpAttrPtr ReplaceSourceRdAndLocate(const BgpAttr *attr, const RouteDistinguisher &source_rd)
BgpAttrPtr ReplaceOriginVnPathAndLocate(const BgpAttr *attr, OriginVnPathPtr ovnpath)
const OriginVnPath * origin_vn_path() const
const ExtCommunity * ext_community() const
Address::Family nexthop_family() const
uint32_t GetLabel() const
void SetAttr(const BgpAttrPtr attr, const BgpAttrPtr original_attr)
uint32_t GetFlags() const
const uint32_t GetPathId() const
bool NeedsResolution() const
const BgpAttr * GetAttr() const
PathSource GetSource() const
const BgpAttr * GetOriginalAttr() const
const BgpPath * FindPath(BgpPath::PathSource src) const
bool RemoveSecondaryPath(const BgpRoute *src_rt, BgpPath::PathSource src, const IPeer *peer, uint32_t path_id)
BgpPath * FindSecondaryPath(BgpRoute *src_rt, BgpPath::PathSource src, const IPeer *peer, uint32_t path_id)
void InsertPath(BgpPath *path)
void SetReplicateInfo(const BgpTable *table, const BgpRoute *rt)
ExtCommunityDB * extcomm_db()
RoutingInstanceMgr * routing_instance_mgr()
uint32_t bgp_identifier() const
as_t autonomous_system() const
bool mvpn_ipv4_enable() const
bool IsNextHopCheckEnabled() const
RoutingInstance * routing_instance()
UpdateInfo * GetUpdateInfo(RibOut *ribout, BgpRoute *route, const RibPeerSet &peerset)
PathResolver * path_resolver()
const std::string & name() const
void Notify(DBEntryBase *entry)
virtual void Add(DBEntry *entry)
DBEntry * Find(const DBEntry *entry)
virtual DBTablePartBase * GetTablePartition(const DBRequestKey *key)
static void RegisterFactory(const std::string &prefix, CreateFunction create_fn)
static int PartitionCount()
const Ip4Prefix & GetPrefix() const
void UpdateExtendedCommunity(RibOutAttr *roattr)
virtual std::unique_ptr< DBEntry > AllocEntryStr(const std::string &key) const
static DBTableBase * CreateTable(DB *db, const std::string &name)
InetTable(DB *db, const std::string &name)
virtual size_t Hash(const DBEntry *entry) const
virtual PathResolver * CreatePathResolver()
virtual bool Export(RibOut *ribout, Route *route, const RibPeerSet &peerset, UpdateInfoSList &info_slist)
BgpAttrPtr UpdateAttributes(const BgpAttrPtr inetvpn_attrp, const BgpAttrPtr inet_attrp)
static size_t HashFunction(const Ip4Prefix &addr)
BgpAttrPtr GetMvpnAttributes(BgpAttrPtr attrp)
virtual BgpRoute * TableFind(DBTablePartition *rtp, const DBRequestKey *prefix)
virtual std::unique_ptr< DBEntry > AllocEntry(const DBRequestKey *key) const
virtual Address::Family family() const
void UpdateRoute(const InetVpnPrefix &inetvpn_prefix, const IPeer *peer, BgpAttrPtr inetvpn_attrp)
virtual BgpAttrPtr GetAttributes(BgpRoute *rt, BgpAttrPtr attrp, const IPeer *peer)
BgpAttrPtr GetFabricAttributes(BgpRoute *rt, BgpAttrPtr attrp, const IPeer *peer)
BgpRoute * RouteReplicate(BgpServer *server, BgpTable *src_tbl, BgpRoute *src_rt, const BgpPath *path, ExtCommunityPtr ptr)
const RouteDistinguisher & route_distinguisher() const
const InetVpnPrefix & GetPrefix() const
virtual BgpRoute * TableFind(DBTablePartition *rtp, const DBRequestKey *prefix)
Ip4Address ip4_addr() const
static Ip4Prefix FromString(const std::string &str, boost::system::error_code *errorp=NULL)
void StopPathResolution(int part_id, const BgpPath *path)
void StartPathResolution(BgpRoute *route, const BgpPath *path, BgpTable *nh_table=NULL)
const BgpAttr * attr() const
void set_attr(const BgpTable *table, const BgpAttrPtr &attrp)
const RibExportPolicy & ExportPolicy() const
RoutingInstance * GetDefaultRoutingInstance()
BgpTable * GetTable(Address::Family fmly)
const bytes_type & GetExtCommunity() const
const bytes_type & GetExtCommunity() const
MODULE_INITIALIZER(RegisterFactory)
static void RegisterFactory()
#define CHECK_CONCURRENCY(...)