OpenSDN source code
ecmp.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef vnsw_ecmp_hpp
6 #define vnsw_ecmp_hpp
7 
8 #include <cmn/agent_cmn.h>
9 #include <oper/route_common.h>
10 
11 class EcmpLoadBalance;
12 class PathPreference;
13 class TunnelType;
14 
15 class EcmpData {
16 public:
17  EcmpData(Agent *agent,
18  const string &vrf_name,
19  const string &route_str,
20  AgentPath *path,
21  bool del);
22  virtual ~EcmpData() { }
23 
24  bool Update(AgentRoute *rt);
25  bool UpdateWithParams(const SecurityGroupList &sg_list,
26  const TagList &tag_list,
27  const CommunityList &community_list,
28  const PathPreference &path_preference,
29  const TunnelType::TypeBmap bmap,
30  const EcmpLoadBalance &ecmp_load_balance,
31  const VnListType &vn_list,
32  DBRequest &nh_req);
33  static const NextHop* GetLocalNextHop(const AgentRoute *rt);
34 
35 private:
36  //Ecmp formed with local_vm_peer
38  //Ecmp formed by bgp peer(CN)
39  bool BgpPeerEcmp();
40  //Helper routines
41  bool EcmpAddPath(AgentRoute *rt);
42  bool EcmpDeletePath(AgentRoute *rt);
43  bool ModifyEcmpPath(CompositeNHKey *composite_nh_key = NULL);
44  bool UpdateNh(CompositeNHKey *composite_nh_key = NULL);
45  bool SyncParams();
46  //Allocate or append
47  void AllocateEcmpPath(AgentRoute *rt, const AgentPath *path2);
48  bool UpdateComponentNH(AgentRoute *rt, AgentPath *path);
49  void AppendEcmpPath(AgentRoute *rt, AgentPath *path);
50  //Delete
51  void DeleteComponentNH(AgentRoute *rt, AgentPath *path);
52 
53  //Variables
56  bool delete_;
58  uint32_t label_;
59  std::string vrf_name_;
60  std::string route_str_;
71 };
72 
73 #endif // vnsw_ecmp_hpp
std::vector< int > TagList
Definition: agent.h:202
std::vector< int > SecurityGroupList
Definition: agent.h:201
std::set< std::string > VnListType
Definition: agent.h:212
std::vector< std::string > CommunityList
Definition: bgp_config.h:347
Base class for all Route entries in agent.
Definition: agent_route.h:224
Definition: agent.h:360
Definition: ecmp.h:15
bool SyncParams()
Definition: ecmp.cc:353
VnListType vn_list_
Definition: ecmp.h:61
EcmpData(Agent *agent, const string &vrf_name, const string &route_str, AgentPath *path, bool del)
Definition: ecmp.cc:26
bool UpdateComponentNH(AgentRoute *rt, AgentPath *path)
Definition: ecmp.cc:422
AgentPath * ecmp_path_
Definition: ecmp.h:55
bool EcmpAddPath(AgentRoute *rt)
Definition: ecmp.cc:106
bool delete_
Definition: ecmp.h:56
bool LocalVmPortPeerEcmp(AgentRoute *rt)
Definition: ecmp.cc:81
DISALLOW_COPY_AND_ASSIGN(EcmpData)
static const NextHop * GetLocalNextHop(const AgentRoute *rt)
Definition: ecmp.cc:496
bool BgpPeerEcmp()
Definition: ecmp.cc:93
void AllocateEcmpPath(AgentRoute *rt, const AgentPath *path2)
Definition: ecmp.cc:176
bool UpdateNh(CompositeNHKey *composite_nh_key=NULL)
Definition: ecmp.cc:316
void DeleteComponentNH(AgentRoute *rt, AgentPath *path)
Definition: ecmp.cc:463
Agent * agent_
Definition: ecmp.h:69
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)
Definition: ecmp.cc:61
EcmpLoadBalance ecmp_load_balance_
Definition: ecmp.h:67
bool alloc_label_
Definition: ecmp.h:57
SecurityGroupList sg_list_
Definition: ecmp.h:62
bool ModifyEcmpPath(CompositeNHKey *composite_nh_key=NULL)
Definition: ecmp.cc:397
AgentPath * path_
Definition: ecmp.h:54
bool EcmpDeletePath(AgentRoute *rt)
Definition: ecmp.cc:271
std::string route_str_
Definition: ecmp.h:60
bool Update(AgentRoute *rt)
Definition: ecmp.cc:44
DBRequest nh_req_
Definition: ecmp.h:68
TunnelType::TypeBmap tunnel_bmap_
Definition: ecmp.h:66
uint32_t label_
Definition: ecmp.h:58
virtual ~EcmpData()
Definition: ecmp.h:22
void AppendEcmpPath(AgentRoute *rt, AgentPath *path)
Definition: ecmp.cc:227
TagList tag_list_
Definition: ecmp.h:63
std::string vrf_name_
Definition: ecmp.h:59
PathPreference path_preference_
Definition: ecmp.h:65
CommunityList community_list_
Definition: ecmp.h:64
uint32_t TypeBmap
Definition: nexthop.h:248