5 #include <boost/foreach.hpp>
6 #include <boost/uuid/uuid_io.hpp>
24 using namespace boost::asio;
27 const string &vrf_name,
28 const string &route_str,
31 path_(path), ecmp_path_(NULL), delete_(del),
32 alloc_label_(true), label_(
MplsTable::kInvalidLabel),
33 vrf_name_(vrf_name), route_str_(route_str),
34 vn_list_(path->dest_vn_list()),
35 sg_list_(path->sg_list()),
36 tag_list_(path->tag_list()),
37 community_list_(path->communities()),
38 path_preference_(path->path_preference()),
39 tunnel_bmap_(path->tunnel_bmap()),
40 ecmp_load_balance_(path->ecmp_load_balance()),
41 nh_req_(), agent_(agent) {
117 for(Route::PathList::const_iterator it = rt->
GetPathList().begin();
120 static_cast<const AgentPath *
>(it.operator->());
125 if (it_path->
peer() &&
129 if (it_path !=
path_)
130 vm_port_path = it_path;
153 }
else if (count > 2) {
187 std::unique_ptr<const NextHopKey> nh_akey1(nh_key1);
190 std::move(nh_akey1)));
193 if (!composite_nh_policy) {
198 std::unique_ptr<const NextHopKey> nh_akey2(nh_key2);
201 std::move(nh_akey2)));
204 component_nh_list.push_back(component_nh_data2);
205 component_nh_list.push_back(component_nh_data1);
211 composite_nh_policy, component_nh_list,
232 std::unique_ptr<const NextHopKey> nh_akey(nh_key);
241 bool composite_nh_policy =
false;
243 composite_nh_policy);
250 component_nh_key_list,
252 nh_req.
key = std::move(comp_nh_key);
283 for(Route::PathList::const_iterator it = rt->
GetPathList().begin();
286 static_cast<const AgentPath *
>(it.operator->());
288 if (it_path->
peer() &&
308 }
else if (count > 1) {
329 if (composite_nh_key) {
330 key =
static_cast<NextHopKey *
>(composite_nh_key);
334 FindActiveEntry(key));
435 bool composite_nh_policy =
false;
437 component_nh_key_list,
438 composite_nh_policy);
447 component_nh_key_list,
467 std::unique_ptr<const NextHopKey> nh_akey(nh_key);
472 bool comp_nh_policy =
false;
481 comp_nh_policy, component_nh_key_list,
511 for (Route::PathList::const_iterator it = rt->
GetPathList().begin();
void set_path_preference(const PathPreference &rp)
const VnListType & dest_vn_list() const
void set_communities(const CommunityList &communities)
#define OPER_TRACE_ROUTE_ENTRY(obj, table,...)
bool ChangeNH(Agent *agent, NextHop *nh)
void set_unresolved(bool unresolved)
const TagList & tag_list() const
const PathPreference & path_preference() const
static const NextHop * GetLocalNextHop(const AgentRoute *rt)
void set_local_ecmp_mpls_label(MplsLabel *mpls)
VrfEntry * FindVrfFromName(const string &name)
NextHopTable * nexthop_table() const
DBTableBase * get_table() const
TunnelType::Type tunnel_type() const
Agent supports multiple route tables - Inet-unicast (IPv4/IPv6), Inet-multicast, bridge, EVPN (Type2/Type5). This base class contains common code for all types of route tables.
void set_sg_list(const SecurityGroupList &sg)
const NextHop * nexthop() const
std::vector< int > SecurityGroupList
std::unique_ptr< DBRequestData > data
bool UpdateComponentNH(AgentRoute *rt, AgentPath *path)
#define AGENT_ROUTE_LOG(table, msg, route, vrf, peer_info)
const NextHop * GetLocalNextHop() const
const Peer * ecmp_peer() const
static TypeBmap MplsType()
bool EcmpDeletePath(AgentRoute *rt)
boost::shared_ptr< const ComponentNHKey > ComponentNHKeyPtr
bool NexthopToInterfacePolicy() const
const MplsLabel * local_ecmp_mpls_label() const
MplsTable * mpls_table() const
std::unique_ptr< DBRequestKey > KeyPtr
Base class for all Route entries in agent.
void Swap(DBRequest *rhs)
std::vector< ComponentNHKeyPtr > ComponentNHKeyList
TunnelType::TypeBmap tunnel_bmap_
bool UpdateWithParams(const SecurityGroupList &sg_list, const TagList &tag_list, const CommunityList &community_list, const PathPreference &path_preference, const TunnelType::TypeBmap bmap, const EcmpLoadBalance &ecmp_load_balance, const VnListType &vn_list, DBRequest &nh_req)
const Type GetType() const
void set_tunnel_bmap(TunnelType::TypeBmap bmap)
const AgentPath * GetActivePath() const
SecurityGroupList sg_list_
bool EcmpAddPath(AgentRoute *rt)
void FillTrace(RouteInfo &route, Trace event, const AgentPath *path) const
const NextHop * GetActiveNextHop() const
std::unique_ptr< DBRequestKey > key
void RemovePath(AgentPath *path)
const Peer * peer() const
void DeleteComponentNH(AgentRoute *rt, AgentPath *path)
ComponentNHKeyList DeleteComponentNHKey(ComponentNHKeyPtr component_nh_key, bool &comp_nh_new_policy) const
#define GETPEERNAME(peer)
bool UpdateComponentNHKey(uint32_t label, NextHopKey *nh_key, ComponentNHKeyList &component_nh_key_list, bool &comp_nh_policy) const
void InsertPath(const AgentPath *path)
std::vector< std::string > CommunityList
bool LocalVmPortPeerEcmp(AgentRoute *rt)
std::set< std::string > VnListType
virtual KeyPtr GetDBRequestKey() const =0
bool ModifyEcmpPath(CompositeNHKey *composite_nh_key=NULL)
static TypeBmap NativeType()
static Type ComputeType(TypeBmap bmap)
static const uint32_t kInvalidLabel
VrfTable * vrf_table() const
uint32_t CreateRouteLabel(uint32_t label, const NextHopKey *nh_key, const std::string &vrf_name, const std::string &route)
void set_tag_list(const TagList &tag)
virtual std::string ToString() const =0
CommunityList community_list_
bool Update(AgentRoute *rt)
void AppendEcmpPath(AgentRoute *rt, AgentPath *path)
void Process(DBRequest &req)
ComponentNHKeyList AddComponentNHKey(ComponentNHKeyPtr component_nh_key, bool &comp_nh_policy) const
EcmpLoadBalance ecmp_load_balance_
void set_label(uint32_t label)
void AllocateEcmpPath(AgentRoute *rt, const AgentPath *path2)
void set_dest_vn_list(const VnListType &dest_vn_list)
virtual const NextHop * ComputeNextHop(Agent *agent) const
void SetPolicy(bool policy)
EcmpData(Agent *agent, const string &vrf_name, const string &route_str, AgentPath *path, bool del)
uint32_t tunnel_bmap() const
virtual AgentPath * FindPath(const Peer *peer) const
void set_tunnel_type(TunnelType::Type type)
const CommunityList & communities() const
PathPreference path_preference_
const SecurityGroupList & sg_list() const
const EcmpLoadBalance & ecmp_load_balance() const
bool UpdateNh(CompositeNHKey *composite_nh_key=NULL)
void set_ecmp_load_balance(const EcmpLoadBalance &ecmp_load_balance)
void FreeLabel(uint32_t label)
void SyncRoute(bool sync)
const PathList & GetPathList() const
virtual KeyPtr GetDBRequestKey() const
std::vector< int > TagList