From a3130c645b8ac95f1ba08b3feeed8792b21e20fe Mon Sep 17 00:00:00 2001 From: Prakash Bailkeri Date: Thu, 25 Feb 2016 12:04:08 +0530 Subject: [PATCH] Ecmp path should publish community In case of service scaling with service VMs launched in same compute node, agent publishes ecmp path. This path should contain the community set to individual VM path. Logic was missing to copy the community attribute. Fix the AllocateEcmpPath & ModifyEcmpPath to copy the individual path's community TODO: This only fixes the case of allocation of ecmp path. InetUnicastRouteEntry::EcmpAddPath is missing logic to update the attributes of ecmp path when individual path is updated Change-Id: I0ac37689e380bacef40b16a714ed11bba3565658 Partial-Bug: 1549541 (cherry picked from commit 4252716186cab1e3afacb13f89def9428a64a8f7) --- .../agent/controller/controller_route_path.cc | 1 + src/vnsw/agent/oper/inet_unicast_route.cc | 15 +++++++++++++-- src/vnsw/agent/oper/inet_unicast_route.h | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/vnsw/agent/controller/controller_route_path.cc b/src/vnsw/agent/controller/controller_route_path.cc index c253eda6922..a70fdfb52ad 100644 --- a/src/vnsw/agent/controller/controller_route_path.cc +++ b/src/vnsw/agent/controller/controller_route_path.cc @@ -72,6 +72,7 @@ bool ControllerEcmpRoute::AddChangePath(Agent *agent, AgentPath *path, return InetUnicastRouteEntry::ModifyEcmpPath(dest_addr_, plen_, vn_list_, label_, local_ecmp_nh_, vrf_name_, sg_list_, + CommunityList(), path_preference_, tunnel_bmap_, ecmp_load_balance_, diff --git a/src/vnsw/agent/oper/inet_unicast_route.cc b/src/vnsw/agent/oper/inet_unicast_route.cc index 7be5d67439f..2dc89385007 100644 --- a/src/vnsw/agent/oper/inet_unicast_route.cc +++ b/src/vnsw/agent/oper/inet_unicast_route.cc @@ -334,6 +334,7 @@ bool InetUnicastRouteEntry::ModifyEcmpPath(const IpAddress &dest_addr, uint32_t label, bool local_ecmp_nh, const string &vrf_name, SecurityGroupList sg_list, + const CommunityList &communities, const PathPreference &path_preference, TunnelType::TypeBmap tunnel_bmap, const EcmpLoadBalance &ecmp_load_balance, @@ -366,6 +367,13 @@ bool InetUnicastRouteEntry::ModifyEcmpPath(const IpAddress &dest_addr, ret = true; } + CommunityList path_communities; + path_communities = path->communities(); + if (path_communities != communities) { + path->set_communities(communities); + ret = true; + } + if (path_preference != path->path_preference()) { path->set_path_preference(path_preference); ret = true; @@ -428,6 +436,7 @@ AgentPath *InetUnicastRouteEntry::AllocateEcmpPath(Agent *agent, InetUnicastRouteEntry::ModifyEcmpPath(addr_, plen_, path2->dest_vn_list(), label, true, vrf()->GetName(), path2->sg_list(), + path2->communities(), path2->path_preference(), path2->tunnel_bmap(), path2->ecmp_load_balance(), @@ -651,7 +660,8 @@ void InetUnicastRouteEntry::AppendEcmpPath(Agent *agent, InetUnicastRouteEntry::ModifyEcmpPath(addr_, plen_, path->dest_vn_list(), ecmp_path->label(), true, vrf()->GetName(), - path->sg_list(), path->path_preference(), + path->sg_list(), path->communities(), + path->path_preference(), path->tunnel_bmap(), path->ecmp_load_balance(), nh_req, agent, ecmp_path); @@ -694,7 +704,8 @@ void InetUnicastRouteEntry::DeleteComponentNH(Agent *agent, AgentPath *path) { InetUnicastRouteEntry::ModifyEcmpPath(addr_, plen_, ecmp_path->dest_vn_list(), ecmp_path->label(), true, vrf()->GetName(), - ecmp_path->sg_list(), ecmp_path->path_preference(), + ecmp_path->sg_list(), ecmp_path->communities(), + ecmp_path->path_preference(), ecmp_path->tunnel_bmap(), ecmp_path->ecmp_load_balance(), nh_req, agent, ecmp_path); diff --git a/src/vnsw/agent/oper/inet_unicast_route.h b/src/vnsw/agent/oper/inet_unicast_route.h index bbfc3b9f18b..06af1c24003 100644 --- a/src/vnsw/agent/oper/inet_unicast_route.h +++ b/src/vnsw/agent/oper/inet_unicast_route.h @@ -81,6 +81,7 @@ class InetUnicastRouteEntry : public AgentRoute { uint32_t label, bool local_ecmp_nh, const string &vrf_name, SecurityGroupList sg_list, + const CommunityList &communities, const PathPreference &path_preference, TunnelType::TypeBmap tunnel_bmap, const EcmpLoadBalance &ecmp_ecmp_load_balance,