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