6 #include <boost/foreach.hpp>
7 #include <boost/uuid/uuid_io.hpp>
25 using namespace boost::asio;
28 const string &vrf_name,
29 const string &route_str,
32 path_(path), ecmp_path_(NULL), delete_(del),
33 alloc_label_(true), label_(
MplsTable::kInvalidLabel),
34 vrf_name_(vrf_name), route_str_(route_str),
35 vn_list_(path->dest_vn_list()),
36 sg_list_(path->sg_list()),
37 tag_list_(path->tag_list()),
38 community_list_(path->communities()),
39 path_preference_(path->path_preference()),
40 tunnel_bmap_(path->tunnel_bmap()),
41 ecmp_load_balance_(path->ecmp_load_balance()),
42 nh_req_(), agent_(agent) {
118 for(Route::PathList::const_iterator it = rt->
GetPathList().begin();
121 static_cast<const AgentPath *
>(it.operator->());
126 if (it_path->
peer() &&
130 if (it_path !=
path_)
131 vm_port_path = it_path;
154 }
else if (count > 2) {
188 std::unique_ptr<const NextHopKey> nh_akey1(nh_key1);
191 std::move(nh_akey1)));
194 if (!composite_nh_policy) {
199 std::unique_ptr<const NextHopKey> nh_akey2(nh_key2);
202 std::move(nh_akey2)));
205 component_nh_list.push_back(component_nh_data2);
206 component_nh_list.push_back(component_nh_data1);
212 composite_nh_policy, component_nh_list,
233 std::unique_ptr<const NextHopKey> nh_akey(nh_key);
242 bool composite_nh_policy =
false;
244 composite_nh_policy);
251 component_nh_key_list,
253 nh_req.
key = std::move(comp_nh_key);
284 for(Route::PathList::const_iterator it = rt->
GetPathList().begin();
287 static_cast<const AgentPath *
>(it.operator->());
289 if (it_path->
peer() &&
309 }
else if (count > 1) {
330 if (composite_nh_key) {
331 key =
static_cast<NextHopKey *
>(composite_nh_key);
335 FindActiveEntry(key));
436 bool composite_nh_policy =
false;
438 component_nh_key_list,
439 composite_nh_policy);
448 component_nh_key_list,
468 std::unique_ptr<const NextHopKey> nh_akey(nh_key);
473 bool comp_nh_policy =
false;
482 comp_nh_policy, component_nh_key_list,
512 for (Route::PathList::const_iterator it = rt->
GetPathList().begin();
std::vector< uint64_t > TagList
std::vector< int > SecurityGroupList
std::set< std::string > VnListType
#define AGENT_ROUTE_LOG(table, msg, route, vrf, peer_info)
#define OPER_TRACE_ROUTE_ENTRY(obj, table,...)
#define GETPEERNAME(peer)
std::vector< std::string > CommunityList
TunnelType::Type tunnel_type() const
void set_label(uint32_t label)
void set_path_preference(const PathPreference &rp)
void set_tunnel_bmap(TunnelType::TypeBmap bmap)
void set_dest_vn_list(const VnListType &dest_vn_list)
void set_communities(const CommunityList &communities)
const VnListType & dest_vn_list() const
void set_ecmp_load_balance(const EcmpLoadBalance &ecmp_load_balance)
void set_local_ecmp_mpls_label(MplsLabel *mpls)
void set_sg_list(const SecurityGroupList &sg)
const EcmpLoadBalance & ecmp_load_balance() const
void SyncRoute(bool sync)
const PathPreference & path_preference() const
const SecurityGroupList & sg_list() const
void set_tag_list(const TagList &tag)
const MplsLabel * local_ecmp_mpls_label() const
uint32_t tunnel_bmap() const
void set_unresolved(bool unresolved)
const Peer * peer() const
const TagList & tag_list() const
bool ChangeNH(Agent *agent, NextHop *nh)
const CommunityList & communities() const
void set_tunnel_type(TunnelType::Type type)
virtual const NextHop * ComputeNextHop(Agent *agent) const
Agent supports multiple route tables - Inet-unicast (IPv4/IPv6), Inet-multicast, bridge,...
Base class for all Route entries in agent.
void FillTrace(RouteInfo &route, Trace event, const AgentPath *path) const
void InsertPath(const AgentPath *path)
const AgentPath * GetActivePath() const
const NextHop * GetActiveNextHop() const
virtual std::string ToString() const =0
void RemovePath(AgentPath *path)
virtual AgentPath * FindPath(const Peer *peer) const
const Peer * ecmp_peer() const
VrfTable * vrf_table() const
NextHopTable * nexthop_table() const
MplsTable * mpls_table() const
ComponentNHKeyList AddComponentNHKey(ComponentNHKeyPtr component_nh_key, bool &comp_nh_policy) const
bool UpdateComponentNHKey(uint32_t label, NextHopKey *nh_key, ComponentNHKeyList &component_nh_key_list, bool &comp_nh_policy) const
virtual KeyPtr GetDBRequestKey() const
ComponentNHKeyList DeleteComponentNHKey(ComponentNHKeyPtr component_nh_key, bool &comp_nh_new_policy) const
const NextHop * GetLocalNextHop() const
std::unique_ptr< DBRequestKey > KeyPtr
DBTableBase * get_table() const
virtual KeyPtr GetDBRequestKey() const =0
EcmpData(Agent *agent, const string &vrf_name, const string &route_str, AgentPath *path, bool del)
bool UpdateComponentNH(AgentRoute *rt, AgentPath *path)
bool EcmpAddPath(AgentRoute *rt)
bool LocalVmPortPeerEcmp(AgentRoute *rt)
static const NextHop * GetLocalNextHop(const AgentRoute *rt)
void AllocateEcmpPath(AgentRoute *rt, const AgentPath *path2)
bool UpdateNh(CompositeNHKey *composite_nh_key=NULL)
void DeleteComponentNH(AgentRoute *rt, AgentPath *path)
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)
EcmpLoadBalance ecmp_load_balance_
SecurityGroupList sg_list_
bool ModifyEcmpPath(CompositeNHKey *composite_nh_key=NULL)
bool EcmpDeletePath(AgentRoute *rt)
bool Update(AgentRoute *rt)
TunnelType::TypeBmap tunnel_bmap_
void AppendEcmpPath(AgentRoute *rt, AgentPath *path)
PathPreference path_preference_
CommunityList community_list_
const NextHop * nexthop() const
void FreeLabel(uint32_t label)
static const uint32_t kInvalidLabel
uint32_t CreateRouteLabel(uint32_t label, const NextHopKey *nh_key, const std::string &vrf_name, const std::string &route)
void SetPolicy(bool policy)
void Process(DBRequest &req)
bool NexthopToInterfacePolicy() const
const Type GetType() const
const PathList & GetPathList() const
static TypeBmap NativeType()
static Type ComputeType(TypeBmap bmap)
static TypeBmap MplsType()
VrfEntry * FindVrfFromName(const string &name)
boost::shared_ptr< const ComponentNHKey > ComponentNHKeyPtr
std::vector< ComponentNHKeyPtr > ComponentNHKeyList
std::unique_ptr< DBRequestKey > key
void Swap(DBRequest *rhs)
std::unique_ptr< DBRequestData > data