5 #include <boost/uuid/uuid_io.hpp>
21 #include <controller/controller_types.h>
24 DBState(), exported_(false), ingress_replication_exported_(false),
25 multicast_exported_(false),
26 force_chg_(false), label_(
MplsTable::kInvalidLabel), vn_(), sg_list_(),
28 destination_(), source_(), ecmp_load_balance_(), isid_(0), tunnel_bmap_(0) {
32 if (exported_ ==
false)
35 if (force_chg_ ==
true)
48 if (sg_list_ != path->
sg_list())
192 std::stringstream path_str;
193 if (path && path->
peer())
224 if (state->
Changed(route, path)) {
225 state->
Update(route, path);
227 vn_list.insert(state->
vn_);
228 uint32_t label = state->
label_;
235 static_cast<AgentRoute * >(route),
246 vn_list.insert(state->
vn_);
248 static_cast<AgentRoute *>(route), vn_list,
270 if (active_path == NULL) {
273 active_path = evpn_route ? evpn_route->
FindOvsPath() : NULL;
277 if (active_path == NULL)
280 if (active_path == NULL) {
291 bool can_dissociate = route->
IsDeleted();
301 return can_dissociate;
305 return can_dissociate;
309 if (active_path == NULL)
316 return can_dissociate;
384 if (route_can_be_dissociated || !associate) {
396 uint32_t label = state->
label_;
398 label = state->
isid_;
436 bool ingress_replication =
true;
440 ingress_replication =
false;
442 if (ingress_replication) {
456 bool bridging =
false;
463 uint32_t old_label = state->
label_;
472 bool withdraw =
false;
473 uint32_t withdraw_label = 0;
477 (old_label != new_label)) {
478 withdraw_label = old_label;
487 uint32_t old_isid = state->
isid_;
489 withdraw_label = old_isid;
496 if (bridging ==
false)
501 (bgp_xmpp_peer, route, state->
vn_, withdraw_label,
546 (bgp_xmpp_peer, route,
580 bool associate =
true;
582 rt_export, table->
agent(), bgp_xmpp_peer,
const std::string & GetName() const
AgentPath * FindLocalVmPortPath() const
void MulticastNotify(AgentXmppChannel *bgp_xmpp_peer, bool associate, DBTablePartBase *partition, DBEntryBase *e)
bool DeleteState(DBTablePartBase *partition, DBEntryBase *entry)
bool IsExportable(uint64_t sequence_number)
void WalkTable(DBTableWalkRef walk)
static const AgentPath * GetMulticastExportablePath(const Agent *agent, const AgentRoute *route)
const TagList & tag_list() const
const PathPreference & path_preference() const
DBState * GetState(DBTableBase *tbl_base, ListenerId listener) const
bool tor_agent_enabled() const
bool MulticastRouteCanDissociate(const AgentRoute *route)
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.
TunnelType::Type tunnel_type_
bool simulate_evpn_tor() const
void SetState(DBTableBase *tbl_base, ListenerId listener, DBState *state)
static bool ControllerSendRouteAdd(AgentXmppChannel *peer, AgentRoute *route, const Ip4Address *nexthop_ip, const VnListType &vn_list, uint32_t label, uint32_t tunnel_bmap, const SecurityGroupList *sg_list, const TagList *tag_list, const CommunityList *communities, Agent::RouteTableType type, const PathPreference &path_preference, const EcmpLoadBalance &ecmp_load_balance, uint32_t native_vrf_id)
uint32_t GetTunnelBmap() const
static void Walkdone(DBTable::DBTableWalkRef walk_ref, DBTableBase *table, RouteExport *rt)
std::vector< int > SecurityGroupList
bool is_multicast() const
const std::string & dest_vn_name() const
DBTableWalkRef AllocWalker(WalkFn walk_fn, WalkCompleteFn walk_complete)
const Ip4Address * GetDip() const
const string & GetName() const
const std::string & dest_vn_name() const
void Notify(const Agent *agent, AgentXmppChannel *bgp_xmpp_peer, bool associate, Agent::RouteTableType type, DBTablePartBase *partition, DBEntryBase *e)
Base class for all Route entries in agent.
static bool ControllerSendMcastRouteAdd(AgentXmppChannel *peer, AgentRoute *route)
DBTableBase::ListenerId GetListenerId() const
void Unregister(ListenerId listener)
PathPreference path_preference_
AgentRouteTable * rt_table_
void ReleaseWalker(DBTableWalkRef &walk)
ListenerId Register(ChangeCallback callback, const std::string &name="unspecified")
const AgentPath * FindOvsPath() const
const std::string & fabric_vrf_name() const
bool Changed(const AgentRoute *route, const AgentPath *path) const
const Type GetType() const
const AgentPath * GetActivePath() const
NextHop * nexthop() const
bool mvpn_ipv4_enable() const
virtual Agent::RouteTableType GetTableType() const =0
void SubscribeMulticastRouting(const Agent *agent, AgentXmppChannel *bgp_xmpp_peer, AgentRoute *route, RouteExport::State *state)
void UnicastNotify(AgentXmppChannel *bgp_xmpp_peer, DBTablePartBase *partition, DBEntryBase *e, Agent::RouteTableType type)
void Reset(LifetimeActor *actor)
bool ingress_replication_exported_
void SubscribeIngressReplication(Agent *agent, AgentXmppChannel *bgp_xmpp_peer, AgentRoute *route, RouteExport::State *state)
uint64_t sequence_number() const
Ip4Address router_id() const
uint32_t native_vrf_id() const
DBTableBase::ListenerId GetVrfExportListenerId()
static TypeBmap AllType()
const Peer * peer() const
const Peer * local_peer() const
void Update(const AgentRoute *route, const AgentPath *path)
static const MacAddress & BroadcastMac()
const Ip4Address * GetSip() const
AgentParam * params() const
std::set< std::string > VnListType
void ClearState(DBTableBase *tbl_base, ListenerId listener)
virtual const PrefixType & prefix_address() const
Returns the value of a stored prefix address (IPv4, IPv6 or MAC address)
uint32_t GetActiveLabel() const
static const uint32_t kInvalidLabel
static const uint32_t kImplicitNullLabel
LifetimeRef< RouteExport > table_delete_ref_
const Peer * multicast_tor_peer() const
DBTable::DBTableWalkRef walk_ref_
size_t ComponentNHCount() const
static bool ControllerSendRouteDelete(AgentXmppChannel *peer, AgentRoute *route, const VnListType &vn_list, uint32_t label, uint32_t tunnel_bmap, const SecurityGroupList *sg_list, const TagList *tag_list, const CommunityList *communities, Agent::RouteTableType type, const PathPreference &path_preference)
EcmpLoadBalance ecmp_load_balance_
RouteExport(AgentRouteTable *rt)
RouteExport * rt_export_[Agent::ROUTE_TABLE_MAX]
const Peer * local_vm_peer() const
const Ip4Address * NexthopIp(Agent *agent) const
static RouteExport * Init(AgentRouteTable *table, AgentXmppChannel *bgp_xmpp_peer)
static bool ControllerSendMcastRouteDelete(AgentXmppChannel *peer, AgentRoute *route)
virtual const NextHop * ComputeNextHop(Agent *agent) const
boost::intrusive_ptr< DBTableWalk > DBTableWalkRef
static TypeBmap GetTunnelBmap(TunnelType::Type type)
uint32_t tunnel_bmap() const
static bool ControllerSendEvpnRouteAdd(AgentXmppChannel *peer, AgentRoute *route, const Ip4Address *nexthop_ip, std::string vn, uint32_t mpls_label, uint32_t tunnel_bmap, const SecurityGroupList *sg_list, const TagList *tag_list, const CommunityList *communities, const std::string &destination, const std::string &source, const PathPreference &path_preference)
virtual AgentPath * FindPath(const Peer *peer) const
const CommunityList & communities() const
bool ShouldExportRoute() const
const SecurityGroupList & sg_list() const
uint32_t vxlan_id() const
const EcmpLoadBalance & ecmp_load_balance() const
virtual Agent::RouteTableType GetTableType() const =0
static bool ControllerSendEvpnRouteDelete(AgentXmppChannel *peer, AgentRoute *route, std::string vn, uint32_t mpls_label, const std::string &destination, const std::string &source, uint32_t tunnel_bmap)
static bool IsBgpPeerActive(const Agent *agent, AgentXmppChannel *peer)
DBTableBase::ListenerId id_
std::vector< int > TagList