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