5 #ifndef SRC_BGP_ROUTING_INSTANCE_SERVICE_CHAINING_H_
6 #define SRC_BGP_ROUTING_INSTANCE_SERVICE_CHAINING_H_
8 #include <boost/ptr_container/ptr_map.hpp>
9 #include <boost/shared_ptr.hpp>
10 #include <tbb/mutex.h>
36 class ShowServicechainInfo;
40 template <
typename T1,
typename T2,
typename T3,
typename T4>
49 InetRoute, InetVpnRoute, Ip4Prefix, Ip4Address> {
53 Inet6Route, Inet6VpnRoute, Inet6Prefix, Ip6Address> {
57 EvpnRoute, InetVpnRoute, EvpnPrefix, Ip4Address> {
61 EvpnRoute, Inet6VpnRoute, EvpnPrefix, Ip6Address> {
122 template <
typename T>
146 const std::vector<std::string> &subnets,
AddressT addr,
bool head,
194 virtual std::string
ToString()
const;
258 bool aggregate,
BgpTable *bgptable);
264 BgpTable *bgptable,
bool aggregate);
318 template <
typename T>
344 bool group_oper_state_up);
352 std::string *reason = NULL)
const;
360 ShowServicechainInfo *info)
const;
375 : group(group), reason(reason) {
391 typedef boost::ptr_map<std::string, ServiceChainGroup>
GroupMap;
413 typename PendingChainList::const_iterator loc =
473 #endif // SRC_BGP_ROUTING_INSTANCE_SERVICE_CHAINING_H_
std::set< RoutingInstance * > ServiceChainSet
bool AddMoreSpecific(PrefixT aggregate, BgpRoute *more_specific)
boost::scoped_ptr< WorkQueue< ServiceChainRequestT * > > process_queue_
virtual size_t ResolvedQueueSize() const
virtual void EnableGroupTrigger()
ServiceChain(ServiceChainMgrT *manager, ServiceChainGroup *group, RoutingInstance *src, RoutingInstance *dest, RoutingInstance *connected, const std::vector< std::string > &subnets, AddressT addr, bool head, bool retain_as_path)
ServiceChainGroup(IServiceChainMgr *manager, const std::string &name)
ServiceChainT * FindServiceChain(const std::string &instance) const
void Enqueue(ServiceChainRequestT *req)
std::set< BgpRoute * > RouteList
void PeerRegistrationCallback(IPeer *peer, BgpTable *table, bool unregister)
bool dest_table_unregistered() const
DISALLOW_COPY_AND_ASSIGN(ServiceChain)
virtual void EnableQueue()
LifetimeRef< ServiceChain > dest_table_delete_ref_
bool aggregate_enable() const
void set_group_oper_state_up(bool up)
ServiceChainRequest< T > ServiceChainRequestT
virtual void StopServiceChain(RoutingInstance *rtinstance)
ServiceChainMgr< ServiceChainEvpn6 > ServiceChainMgrEvpn6
void GetReplicationFamilyInfo(DBTablePartition *&partition, BgpRoute *&route, BgpTable *&table, PrefixT prefix, bool create)
const ExtConnectRouteList & ext_connecting_routes() const
bool group_oper_state_up_
void UpdateServiceChainRoute(PrefixT prefix, const RouteT *orig_route, const ConnectedPathIdList &old_path_ids, bool aggregate)
LifetimeRef< ServiceChain > src_table_delete_ref_
boost::intrusive_ptr< ConditionMatch > ConditionMatchPtr
virtual std::string ToString() const
ExtConnectRouteList ext_connect_routes_
bool IsConnectedRouteValid() const
virtual bool ServiceChainIsPending(RoutingInstance *rtinstance, std::string *reason=NULL) const
const ConnectedPathIdList & GetConnectedPathIds()
BgpRoute * connected_route() const
BgpTable * connected_table() const
friend class ServiceChainTest
void FillServiceChainInfo(ShowServicechainInfo *info) const
ServiceChainMgr< ServiceChainInet > ServiceChainMgrInet
ServiceChainMgr< ServiceChainEvpn > ServiceChainMgrEvpn
bool dest_table_unregistered_
virtual void UpdateServiceChain(RoutingInstance *rtinstance, bool group_oper_state_up)
ServiceChainRequest< T > ServiceChainRequestT
PendingChainState GetPendingServiceChain(RoutingInstance *rtinstance)
ServiceChainGroup * group_
RoutingInstance * dest_routing_instance() const
virtual bool IsQueueEmpty() const
bool unregistered() const
RoutingInstance * connected_routing_instance() const
void RemoveMatchState(BgpRoute *route, ServiceChainState *state)
virtual void DisableGroupTrigger()
BgpTable * dest_table() const
RoutingInstance * src_routing_instance() const
DISALLOW_COPY_AND_ASSIGN(ServiceChainMgr)
ServiceChainSet chain_set_
virtual uint32_t GetDownServiceChainCount() const
std::set< BgpRoute * > ExtConnectRouteList
bool IsMoreSpecific(BgpRoute *route, PrefixT *aggregate_match) const
ConnectedPathIdList connected_path_ids_
ServiceChainGroup * group
bool oper_state_up() const
LifetimeRef< ServiceChain > connected_table_delete_ref_
virtual void DisableQueue()
static int service_chain_task_id_
ServiceChainGroup * LocateServiceChainGroup(const std::string &group_name)
ServiceChainMgr(BgpServer *server)
bool IsEvpnType5Route(BgpRoute *route) const
LifetimeRef< ServiceChainMgr > server_delete_ref_
DISALLOW_COPY_AND_ASSIGN(ServiceChainState)
ServiceChainGroup * FindServiceChainGroup(RoutingInstance *rtinstance)
void StopServiceChainDone(BgpTable *table, ConditionMatch *info)
ServiceChainMap chain_set_
boost::intrusive_ptr< const BgpAttr > BgpAttrPtr
PrefixToRouteListMap prefix_to_routelist_map_
void AddPendingServiceChain(RoutingInstance *rtinstance, ServiceChainGroup *group, std::string reason)
PendingChainList pending_chains_
bool IsAggregate(BgpRoute *route) const
void set_aggregate_enable()
void set_dest_table_unregistered()
BgpConditionListener * listener_
bool connected_table_unregistered() const
SCAddress::Family GetSCFamily() const
void DeleteRoutingInstance(RoutingInstance *rtinstance)
ServiceChainRequest(RequestType type, SandeshResponse *resp)
std::set< ServiceChainGroup * > GroupSet
virtual void set_aggregate_host_route(bool value)
virtual void DisableResolveTrigger()
ServiceChainMgr< ServiceChainInet6 > ServiceChainMgrInet6
friend class ServiceChainIntegrationTest
Address::Family GetConnectedFamily() const
virtual bool FillServiceChainInfo(RoutingInstance *rtinstance, ShowServicechainInfo *info) const
DISALLOW_COPY_AND_ASSIGN(ServiceChainRequest)
boost::scoped_ptr< TaskTrigger > group_trigger_
virtual BgpConditionListener * GetListener()
void UpdateServiceChainRouteInternal(const RouteT *orig_route, const ConnectedPathIdList &old_path_ids, BgpRoute *sc_route, DBTablePartition *partition, BgpTable *bgptable, bool aggregate)
void DeletePendingServiceChain(RoutingInstance *rtinstance)
PrefixToRouteListMap * prefix_to_route_list_map()
bool RequestHandler(ServiceChainRequestT *req)
PendingChainState(ServiceChainGroup *group, std::string reason)
BgpTable * src_table() const
virtual bool ServiceChainIsUp(RoutingInstance *rtinstance) const
ServiceChainGroup * group() const
RoutingInstance * connected_
void ProcessServiceChainPath(uint32_t path_id, BgpPath *path, BgpAttrPtr attr, BgpRoute *&route, DBTablePartition *&partition, bool aggregate, BgpTable *bgptable)
virtual bool LocateServiceChain(RoutingInstance *rtinstance, const ServiceChainConfig &config)
bool connected_table_unregistered_
void RoutingInstanceCallback(std::string name, int op)
void UpdateServiceChainGroup(ServiceChainGroup *group)
bool retain_as_path() const
void UpdateServiceChainRoutes(ServiceChainT *chain, const typename ServiceChainT::ConnectedPathIdList &old_path_ids)
ServiceChain< T > ServiceChainT
virtual void EnableResolveTrigger()
void DeleteServiceChainRoutes(ServiceChainT *chain)
const PrefixToRouteListMap * prefix_to_route_list_map() const
bool ResolvePendingServiceChain()
const AddressT & service_chain_addr() const
bool IsConnectedRoute(BgpRoute *route, bool is_conn_table=false) const
std::map< PrefixT, RouteList > PrefixToRouteListMap
bool aggregate_host_route() const
Address::Family GetFamily() const
bool CompareServiceChainConfig(const ServiceChainConfig &config)
ConditionMatchPtr ServiceChainPtr
void DeleteServiceChainRouteInternal(BgpRoute *service_chain_route, DBTablePartition *partition, BgpTable *bgptable, bool aggregate)
ExtConnectRouteList * ext_connecting_routes()
std::map< RoutingInstance *, PendingChainState > PendingChainList
SCAddress::Family GetSCFamily() const
AddressT service_chain_addr_
boost::ptr_map< std::string, ServiceChainGroup > GroupMap
IServiceChainMgr * manager_
bool group_oper_state_up() const
virtual bool Match(BgpServer *server, BgpTable *table, BgpRoute *route, bool deleted)
BgpRoute * connected_route_
boost::scoped_ptr< TaskTrigger > resolve_trigger_
ServiceChainMgr< T > ServiceChainMgrT
Address::Family GetFamily() const
ServiceChainMgrT * manager_
void AddRoutingInstance(RoutingInstance *rtinstance)
bool ProcessServiceChainGroups()
SandeshResponse * snh_resp_
ServiceChainRequest(RequestType type, BgpTable *table, BgpRoute *route, PrefixT aggregate_match, ServiceChainPtr info)
std::map< RoutingInstance *, ServiceChainPtr > ServiceChainMap
Address::Family GetConnectedFamily() const
ServiceChainState(ServiceChainPtr info)
std::set< uint32_t > ConnectedPathIdList
bool aggregate_host_route_
void SetConnectedRoute(BgpRoute *connected)
virtual size_t PendingQueueSize() const
void set_connected_table_unregistered()
boost::scoped_ptr< DeleteActor > deleter_
bool DeleteMoreSpecific(PrefixT aggregate, BgpRoute *more_specific)
void DeleteServiceChainRoute(PrefixT prefix, bool aggregate)
virtual ~ServiceChainMgr()