OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ServiceChain< T > Class Template Reference

#include <service_chaining.h>

Inheritance diagram for ServiceChain< T >:
Collaboration diagram for ServiceChain< T >:

Public Types

typedef T::RouteT RouteT
 
typedef T::VpnRouteT VpnRouteT
 
typedef T::PrefixT PrefixT
 
typedef T::AddressT AddressT
 
typedef ServiceChainRequest< T > ServiceChainRequestT
 
typedef ServiceChainMgr< T > ServiceChainMgrT
 
typedef std::set< BgpRoute * > RouteList
 
typedef std::map< PrefixT,
RouteList
PrefixToRouteListMap
 
typedef std::set< BgpRoute * > ExtConnectRouteList
 
typedef std::set< uint32_t > ConnectedPathIdList
 

Public Member Functions

 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)
 
Address::Family GetFamily () const
 
Address::Family GetConnectedFamily () const
 
SCAddress::Family GetSCFamily () const
 
void ManagedDelete ()
 
bool CompareServiceChainConfig (const ServiceChainConfig &config)
 
void RemoveMatchState (BgpRoute *route, ServiceChainState *state)
 
void SetConnectedRoute (BgpRoute *connected)
 
bool IsConnectedRouteValid () const
 
const ConnectedPathIdListGetConnectedPathIds ()
 
BgpRouteconnected_route () const
 
RoutingInstancesrc_routing_instance () const
 
RoutingInstanceconnected_routing_instance () const
 
RoutingInstancedest_routing_instance () const
 
const AddressTservice_chain_addr () const
 
void UpdateServiceChainRoute (PrefixT prefix, const RouteT *orig_route, const ConnectedPathIdList &old_path_ids, bool aggregate)
 
void DeleteServiceChainRoute (PrefixT prefix, bool aggregate)
 
bool AddMoreSpecific (PrefixT aggregate, BgpRoute *more_specific)
 
bool DeleteMoreSpecific (PrefixT aggregate, BgpRoute *more_specific)
 
BgpTablesrc_table () const
 
BgpTableconnected_table () const
 
BgpTabledest_table () const
 
ServiceChainGroupgroup () const
 
void clear_group ()
 
PrefixToRouteListMapprefix_to_route_list_map ()
 
const PrefixToRouteListMapprefix_to_route_list_map () const
 
virtual bool Match (BgpServer *server, BgpTable *table, BgpRoute *route, bool deleted)
 
virtual std::string ToString () const
 
void FillServiceChainInfo (ShowServicechainInfo *info) const
 
void set_connected_table_unregistered ()
 
void set_dest_table_unregistered ()
 
bool dest_table_unregistered () const
 
bool connected_table_unregistered () const
 
bool unregistered () const
 
const ExtConnectRouteListext_connecting_routes () const
 
ExtConnectRouteListext_connecting_routes ()
 
bool aggregate_enable () const
 
bool is_sc_head () const
 
bool retain_as_path () const
 
void set_aggregate_enable ()
 
bool group_oper_state_up () const
 
void set_group_oper_state_up (bool up)
 
- Public Member Functions inherited from ConditionMatch
 ConditionMatch ()
 
virtual ~ConditionMatch ()
 
bool deleted () const
 
void IncrementNumMatchstate ()
 
void DecrementNumMatchstate ()
 
uint32_t num_matchstate () const
 

Private Member Functions

bool IsMoreSpecific (BgpRoute *route, PrefixT *aggregate_match) const
 
bool IsAggregate (BgpRoute *route) const
 
bool IsConnectedRoute (BgpRoute *route, bool is_conn_table=false) const
 
bool IsEvpnType5Route (BgpRoute *route) const
 
void GetReplicationFamilyInfo (DBTablePartition *&partition, BgpRoute *&route, BgpTable *&table, PrefixT prefix, bool create)
 
void ProcessServiceChainPath (uint32_t path_id, BgpPath *path, BgpAttrPtr attr, BgpRoute *&route, DBTablePartition *&partition, bool aggregate, BgpTable *bgptable)
 
void UpdateServiceChainRouteInternal (const RouteT *orig_route, const ConnectedPathIdList &old_path_ids, BgpRoute *sc_route, DBTablePartition *partition, BgpTable *bgptable, bool aggregate)
 
void DeleteServiceChainRouteInternal (BgpRoute *service_chain_route, DBTablePartition *partition, BgpTable *bgptable, bool aggregate)
 
 DISALLOW_COPY_AND_ASSIGN (ServiceChain)
 

Private Attributes

ServiceChainMgrTmanager_
 
ServiceChainGroupgroup_
 
RoutingInstancesrc_
 
RoutingInstancedest_
 
RoutingInstanceconnected_
 
ConnectedPathIdList connected_path_ids_
 
BgpRouteconnected_route_
 
AddressT service_chain_addr_
 
PrefixToRouteListMap prefix_to_routelist_map_
 
ExtConnectRouteList ext_connect_routes_
 
bool group_oper_state_up_
 
bool connected_table_unregistered_
 
bool dest_table_unregistered_
 
bool aggregate_
 
bool sc_head_
 
bool retain_as_path_
 
LifetimeRef< ServiceChainsrc_table_delete_ref_
 
LifetimeRef< ServiceChaindest_table_delete_ref_
 
LifetimeRef< ServiceChainconnected_table_delete_ref_
 

Detailed Description

template<typename T>
class ServiceChain< T >

Definition at line 123 of file service_chaining.h.

Member Typedef Documentation

template<typename T>
typedef T::AddressT ServiceChain< T >::AddressT

Definition at line 128 of file service_chaining.h.

template<typename T>
typedef std::set<uint32_t> ServiceChain< T >::ConnectedPathIdList

Definition at line 142 of file service_chaining.h.

template<typename T>
typedef std::set<BgpRoute *> ServiceChain< T >::ExtConnectRouteList

Definition at line 139 of file service_chaining.h.

template<typename T>
typedef T::PrefixT ServiceChain< T >::PrefixT

Definition at line 127 of file service_chaining.h.

template<typename T>
typedef std::map<PrefixT, RouteList> ServiceChain< T >::PrefixToRouteListMap

Definition at line 136 of file service_chaining.h.

template<typename T>
typedef std::set<BgpRoute *> ServiceChain< T >::RouteList

Definition at line 133 of file service_chaining.h.

template<typename T>
typedef T::RouteT ServiceChain< T >::RouteT

Definition at line 125 of file service_chaining.h.

template<typename T>
typedef ServiceChainMgr<T> ServiceChain< T >::ServiceChainMgrT

Definition at line 130 of file service_chaining.h.

template<typename T>
typedef ServiceChainRequest<T> ServiceChain< T >::ServiceChainRequestT

Definition at line 129 of file service_chaining.h.

template<typename T>
typedef T::VpnRouteT ServiceChain< T >::VpnRouteT

Definition at line 126 of file service_chaining.h.

Constructor & Destructor Documentation

template<typename T>
ServiceChain< T >::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 
)

For EVPN, need to construct EVPN prefix from IPv4 or IPv6 subnet. Make sure AF in prefix matches service_chain AF.

Definition at line 265 of file service_chaining.cc.

Here is the call graph for this function:

Member Function Documentation

template<typename T >
bool ServiceChain< T >::AddMoreSpecific ( PrefixT  aggregate,
BgpRoute more_specific 
)

Definition at line 1076 of file service_chaining.cc.

template<typename T>
bool ServiceChain< T >::aggregate_enable ( ) const
inline

Definition at line 221 of file service_chaining.h.

template<typename T>
void ServiceChain< T >::clear_group ( )
inline

Definition at line 183 of file service_chaining.h.

template<typename T >
bool ServiceChain< T >::CompareServiceChainConfig ( const ServiceChainConfig config)

Definition at line 333 of file service_chaining.cc.

Here is the call graph for this function:

template<typename T>
BgpRoute* ServiceChain< T >::connected_route ( ) const
inline

Definition at line 166 of file service_chaining.h.

template<typename T>
RoutingInstance* ServiceChain< T >::connected_routing_instance ( ) const
inline

Definition at line 168 of file service_chaining.h.

template<typename T >
BgpTable * ServiceChain< T >::connected_table ( ) const

Definition at line 319 of file service_chaining.cc.

template<typename T>
bool ServiceChain< T >::connected_table_unregistered ( ) const
inline

Definition at line 207 of file service_chaining.h.

template<typename T >
bool ServiceChain< T >::DeleteMoreSpecific ( PrefixT  aggregate,
BgpRoute more_specific 
)

Definition at line 1091 of file service_chaining.cc.

template<typename T >
void ServiceChain< T >::DeleteServiceChainRoute ( PrefixT  prefix,
bool  aggregate 
)

Definition at line 652 of file service_chaining.cc.

Here is the call graph for this function:

template<typename T >
void ServiceChain< T >::DeleteServiceChainRouteInternal ( BgpRoute service_chain_route,
DBTablePartition partition,
BgpTable bgptable,
bool  aggregate 
)
private

Definition at line 697 of file service_chaining.cc.

Here is the call graph for this function:

template<typename T>
RoutingInstance* ServiceChain< T >::dest_routing_instance ( ) const
inline

Definition at line 169 of file service_chaining.h.

template<typename T >
BgpTable * ServiceChain< T >::dest_table ( ) const

Definition at line 324 of file service_chaining.cc.

template<typename T>
bool ServiceChain< T >::dest_table_unregistered ( ) const
inline

Definition at line 204 of file service_chaining.h.

template<typename T>
ServiceChain< T >::DISALLOW_COPY_AND_ASSIGN ( ServiceChain< T >  )
private
template<typename T>
const ExtConnectRouteList& ServiceChain< T >::ext_connecting_routes ( ) const
inline

Definition at line 214 of file service_chaining.h.

template<typename T>
ExtConnectRouteList* ServiceChain< T >::ext_connecting_routes ( )
inline

Definition at line 217 of file service_chaining.h.

template<typename T >
void ServiceChain< T >::FillServiceChainInfo ( ShowServicechainInfo *  info) const

Definition at line 1101 of file service_chaining.cc.

Here is the call graph for this function:

template<typename T>
Address::Family ServiceChain< T >::GetConnectedFamily ( ) const
inline

Definition at line 149 of file service_chaining.h.

Here is the call graph for this function:

template<typename T>
const ConnectedPathIdList& ServiceChain< T >::GetConnectedPathIds ( )
inline

Definition at line 162 of file service_chaining.h.

template<typename T>
Address::Family ServiceChain< T >::GetFamily ( ) const
inline

Definition at line 148 of file service_chaining.h.

Here is the call graph for this function:

template<typename T >
void ServiceChain< T >::GetReplicationFamilyInfo ( DBTablePartition *&  partition,
BgpRoute *&  route,
BgpTable *&  table,
PrefixT  prefix,
bool  create 
)
private

Replicate prefix received at head-end of service chain to appropriate

table depending on address-family.

Family service-chain address-family Replication Table

EVPN INET InetTable EVPN INET6 Inet6Table INET INET EvpnTable

INET6 INET6 EvpnTable

Parameters
partition- Reference to DBTablePartition where the service-chain route is to be replicated
route- Reference to service-chain route
table- Reference to BgpTable where service-chain route is to be replicated
prefix- Prefix
create- when "true" indicates that route should be created if not found and

EVPN prefix received at head end of service-chain. Replicate route to <vrf>.inet[6] table depending on whether the EVPN prefix carries inet[6] traffic.

EVPN route carrying inet prefix

Create case. Create route if not found.

EVPN route carrying inet6 prefix

Create case. Create route if not found.

INET/INET6 prefix at head end of service-chain. Replicate route to <vrf>.evpn.0 table.

Create case. Create route if not found.

Definition at line 86 of file service_chaining.cc.

Here is the call graph for this function:

template<typename T>
SCAddress::Family ServiceChain< T >::GetSCFamily ( ) const
inline

Definition at line 152 of file service_chaining.h.

Here is the call graph for this function:

template<typename T>
ServiceChainGroup* ServiceChain< T >::group ( ) const
inline

Definition at line 182 of file service_chaining.h.

template<typename T>
bool ServiceChain< T >::group_oper_state_up ( ) const
inline

Definition at line 225 of file service_chaining.h.

template<typename T>
bool ServiceChain< T >::is_sc_head ( ) const
inline

Definition at line 222 of file service_chaining.h.

template<typename T >
bool ServiceChain< T >::IsAggregate ( BgpRoute route) const
private

Definition at line 553 of file service_chaining.cc.

template<typename T >
bool ServiceChain< T >::IsConnectedRoute ( BgpRoute route,
bool  is_conn_table = false 
) const
private

Check if route belongs to connected table. For EVPN, connected routes could belong to INET or INET6 AF. For routes in the destination table we can use template AF.

Non-EVPN and EVPN destination table case

Definition at line 570 of file service_chaining.cc.

Here is the call graph for this function:

template<typename T >
bool ServiceChain< T >::IsConnectedRouteValid ( ) const

Definition at line 532 of file service_chaining.cc.

template<typename T >
bool ServiceChain< T >::IsEvpnType5Route ( BgpRoute route) const
private

Check if EVPN route being re-originated is Type 5 Also make sure that the address-family of the prefix carried in the EVPN route matches the service-chain family. This will avoid the routes from being re-originated twice.

Definition at line 596 of file service_chaining.cc.

Here is the call graph for this function:

template<typename T >
bool ServiceChain< T >::IsMoreSpecific ( BgpRoute route,
PrefixT aggregate_match 
) const
private

Definition at line 537 of file service_chaining.cc.

template<typename T>
void ServiceChain< T >::ManagedDelete ( )
inline

Definition at line 155 of file service_chaining.h.

template<typename T >
bool ServiceChain< T >::Match ( BgpServer server,
BgpTable table,
BgpRoute route,
bool  deleted 
)
virtual

Implements ConditionMatch.

Definition at line 372 of file service_chaining.cc.

Here is the call graph for this function:

template<typename T>
PrefixToRouteListMap* ServiceChain< T >::prefix_to_route_list_map ( )
inline

Definition at line 185 of file service_chaining.h.

template<typename T>
const PrefixToRouteListMap* ServiceChain< T >::prefix_to_route_list_map ( ) const
inline

Definition at line 188 of file service_chaining.h.

template<typename T >
void ServiceChain< T >::ProcessServiceChainPath ( uint32_t  path_id,
BgpPath path,
BgpAttrPtr  attr,
BgpRoute *&  route,
DBTablePartition *&  partition,
bool  aggregate,
BgpTable bgptable 
)
private

Process service-chain path and add to service-chain route if needed.

Parameters
path_id- PathID
path- Path to be processed
attr- Path attribute
route- Reference to Service-Chain route
partition- Reference to DBTablePartition where the service-chain route is to be replicated
aggregate- "true" indicates aggregate route
bgptable- BgpTable the service-chain route belongs to

If inserting into EVPN table, the label should the vxlan_id of the connected RI if non-zero and if not, the VNI.

Check if there is an existing path that can be reused.

Remove existing path, new path will be added below.

No existing path or un-usable existing path Create new path and insert into service-chain route

Definition at line 179 of file service_chaining.cc.

Here is the call graph for this function:

template<typename T >
void ServiceChain< T >::RemoveMatchState ( BgpRoute route,
ServiceChainState state 
)

Definition at line 618 of file service_chaining.cc.

Here is the call graph for this function:

template<typename T>
bool ServiceChain< T >::retain_as_path ( ) const
inline

Definition at line 223 of file service_chaining.h.

template<typename T>
const AddressT& ServiceChain< T >::service_chain_addr ( ) const
inline

Definition at line 170 of file service_chaining.h.

template<typename T>
void ServiceChain< T >::set_aggregate_enable ( )
inline

Definition at line 224 of file service_chaining.h.

template<typename T>
void ServiceChain< T >::set_connected_table_unregistered ( )
inline

Definition at line 198 of file service_chaining.h.

template<typename T>
void ServiceChain< T >::set_dest_table_unregistered ( )
inline

Definition at line 201 of file service_chaining.h.

template<typename T>
void ServiceChain< T >::set_group_oper_state_up ( bool  up)
inline

Definition at line 226 of file service_chaining.h.

template<typename T >
void ServiceChain< T >::SetConnectedRoute ( BgpRoute connected)

Definition at line 507 of file service_chaining.cc.

Here is the call graph for this function:

template<typename T>
RoutingInstance* ServiceChain< T >::src_routing_instance ( ) const
inline

Definition at line 167 of file service_chaining.h.

template<typename T >
BgpTable * ServiceChain< T >::src_table ( ) const

Definition at line 314 of file service_chaining.cc.

template<typename T >
string ServiceChain< T >::ToString ( ) const
virtual

Implements ConditionMatch.

Definition at line 502 of file service_chaining.cc.

template<typename T>
bool ServiceChain< T >::unregistered ( ) const
inline

Definition at line 210 of file service_chaining.h.

template<typename T >
void ServiceChain< T >::UpdateServiceChainRoute ( PrefixT  prefix,
const RouteT orig_route,
const ConnectedPathIdList old_path_ids,
bool  aggregate 
)

Definition at line 746 of file service_chaining.cc.

Here is the call graph for this function:

template<typename T >
void ServiceChain< T >::UpdateServiceChainRouteInternal ( const RouteT orig_route,
const ConnectedPathIdList old_path_ids,
BgpRoute sc_route,
DBTablePartition partition,
BgpTable bgptable,
bool  aggregate 
)
private

Definition at line 797 of file service_chaining.cc.

Member Data Documentation

template<typename T>
bool ServiceChain< T >::aggregate_
private

Definition at line 242 of file service_chaining.h.

template<typename T>
RoutingInstance* ServiceChain< T >::connected_
private

Definition at line 233 of file service_chaining.h.

template<typename T>
ConnectedPathIdList ServiceChain< T >::connected_path_ids_
private

Definition at line 234 of file service_chaining.h.

template<typename T>
BgpRoute* ServiceChain< T >::connected_route_
private

Definition at line 235 of file service_chaining.h.

template<typename T>
LifetimeRef<ServiceChain> ServiceChain< T >::connected_table_delete_ref_
private

Definition at line 247 of file service_chaining.h.

template<typename T>
bool ServiceChain< T >::connected_table_unregistered_
private

Definition at line 240 of file service_chaining.h.

template<typename T>
RoutingInstance* ServiceChain< T >::dest_
private

Definition at line 232 of file service_chaining.h.

template<typename T>
LifetimeRef<ServiceChain> ServiceChain< T >::dest_table_delete_ref_
private

Definition at line 246 of file service_chaining.h.

template<typename T>
bool ServiceChain< T >::dest_table_unregistered_
private

Definition at line 241 of file service_chaining.h.

template<typename T>
ExtConnectRouteList ServiceChain< T >::ext_connect_routes_
private

Definition at line 238 of file service_chaining.h.

template<typename T>
ServiceChainGroup* ServiceChain< T >::group_
private

Definition at line 230 of file service_chaining.h.

template<typename T>
bool ServiceChain< T >::group_oper_state_up_
private

Definition at line 239 of file service_chaining.h.

template<typename T>
ServiceChainMgrT* ServiceChain< T >::manager_
private

Definition at line 229 of file service_chaining.h.

template<typename T>
PrefixToRouteListMap ServiceChain< T >::prefix_to_routelist_map_
private

Definition at line 237 of file service_chaining.h.

template<typename T>
bool ServiceChain< T >::retain_as_path_
private

Definition at line 244 of file service_chaining.h.

template<typename T>
bool ServiceChain< T >::sc_head_
private

Definition at line 243 of file service_chaining.h.

template<typename T>
AddressT ServiceChain< T >::service_chain_addr_
private

Definition at line 236 of file service_chaining.h.

template<typename T>
RoutingInstance* ServiceChain< T >::src_
private

Definition at line 231 of file service_chaining.h.

template<typename T>
LifetimeRef<ServiceChain> ServiceChain< T >::src_table_delete_ref_
private

Definition at line 245 of file service_chaining.h.


The documentation for this class was generated from the following files: