Line data Source code
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 239 : 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 37 : bool LocalVmPortPeerEcmp(AgentRoute *rt); 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 54 : AgentPath *path_; 55 : AgentPath *ecmp_path_; 56 : bool delete_; 57 : bool alloc_label_; 58 : uint32_t label_; 59 : std::string vrf_name_; 60 : std::string route_str_; 61 : VnListType vn_list_; 62 : SecurityGroupList sg_list_; 63 : TagList tag_list_; 64 : CommunityList community_list_; 65 : PathPreference path_preference_; 66 : TunnelType::TypeBmap tunnel_bmap_; 67 : EcmpLoadBalance ecmp_load_balance_; 68 : DBRequest nh_req_; 69 : Agent *agent_; 70 : DISALLOW_COPY_AND_ASSIGN(EcmpData); 71 : }; 72 : 73 : #endif // vnsw_ecmp_hpp