Skip to content

Commit

Permalink
Merge "Ecmp hash parameters didnt get reflected."
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Feb 5, 2016
2 parents e9cb214 + fd05451 commit a68749f
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 25 deletions.
8 changes: 6 additions & 2 deletions src/vnsw/agent/controller/controller_peer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,8 @@ void AgentXmppChannel::AddEvpnRoute(const std::string &vrf_name,
vn_list,
item->entry.security_group_list.security_group,
path_preference,
(item->entry.next_hops.next_hop.size() > 1));
(item->entry.next_hops.next_hop.size() > 1),
EcmpLoadBalance());
rt_table->AddRemoteVmRouteReq(bgp_peer_id(), vrf_name, mac, ip_addr,
item->entry.nlri.ethernet_tag, data);
return;
Expand Down Expand Up @@ -1008,12 +1009,14 @@ void AgentXmppChannel::AddRemoteRoute(string vrf_name, IpAddress prefix_addr,
addr.to_v4().to_string(), label, vn_string);

if (agent_->router_id() != addr.to_v4()) {
EcmpLoadBalance ecmp_load_balance;
GetEcmpHashFieldsToUse(item, ecmp_load_balance);
ControllerVmRoute *data =
ControllerVmRoute::MakeControllerVmRoute(bgp_peer_id(),
agent_->fabric_vrf_name(), agent_->router_id(),
vrf_name, addr.to_v4(), encap, label, vn_list,
item->entry.security_group_list.security_group,
path_preference, false);
path_preference, false, ecmp_load_balance);
rt_table->AddRemoteVmRouteReq(bgp_peer_id(), vrf_name, prefix_addr,
prefix_len, data);
return;
Expand All @@ -1033,6 +1036,7 @@ void AgentXmppChannel::AddRemoteRoute(string vrf_name, IpAddress prefix_addr,
VmInterfaceKey intf_key(AgentKey::ADD_DEL_CHANGE,
intf_nh->GetIfUuid(), "");
EcmpLoadBalance ecmp_load_balance;
GetEcmpHashFieldsToUse(item, ecmp_load_balance);
BgpPeer *bgp_peer = bgp_peer_id();
if (interface->type() == Interface::VM_INTERFACE) {
ControllerLocalVmRoute *local_vm_route =
Expand Down
11 changes: 9 additions & 2 deletions src/vnsw/agent/controller/controller_route_path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ ControllerVmRoute *ControllerVmRoute::MakeControllerVmRoute(const Peer *peer,
const VnListType &dest_vn_list,
const SecurityGroupList &sg_list,
const PathPreference &path_preference,
bool ecmp_suppressed) {
bool ecmp_suppressed,
const EcmpLoadBalance &ecmp_load_balance) {
// Make Tunnel-NH request
DBRequest nh_req(DBRequest::DB_ENTRY_ADD_CHANGE);
nh_req.key.reset(new TunnelNHKey(default_vrf, router_id, tunnel_dest, false,
Expand All @@ -98,7 +99,8 @@ ControllerVmRoute *ControllerVmRoute::MakeControllerVmRoute(const Peer *peer,
ControllerVmRoute *data =
new ControllerVmRoute(peer, default_vrf, tunnel_dest, label,
dest_vn_list, bmap, sg_list, path_preference,
nh_req, ecmp_suppressed);
nh_req, ecmp_suppressed,
ecmp_load_balance);
return data;
}

Expand Down Expand Up @@ -239,6 +241,11 @@ bool ControllerVmRoute::AddChangePath(Agent *agent, AgentPath *path,
ret = true;
}

if (ecmp_load_balance_ != path->ecmp_load_balance()) {
path->set_ecmp_load_balance(ecmp_load_balance_);
ret = true;
}

return ret;
}

Expand Down
12 changes: 7 additions & 5 deletions src/vnsw/agent/controller/controller_route_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ class ControllerVmRoute : public ControllerPeerPath {
const VnListType &dest_vn_list, int bmap,
const SecurityGroupList &sg_list,
const PathPreference &path_preference,
DBRequest &req, bool ecmp_suppressed):
DBRequest &req, bool ecmp_suppressed,
const EcmpLoadBalance &ecmp_load_balance):
ControllerPeerPath(peer), server_vrf_(vrf_name), tunnel_dest_(addr),
tunnel_bmap_(bmap), label_(label), dest_vn_list_(dest_vn_list),
sg_list_(sg_list),path_preference_(path_preference),
ecmp_suppressed_(ecmp_suppressed)
ecmp_suppressed_(ecmp_suppressed), ecmp_load_balance_(ecmp_load_balance)
{nh_req_.Swap(&req);}
// Data passed in case of delete from BGP peer, to validate
// the request at time of processing.
Expand All @@ -103,9 +104,9 @@ class ControllerVmRoute : public ControllerPeerPath {
uint32_t label,
const VnListType &dest_vn_list,
const SecurityGroupList &sg_list,
const PathPreference
&path_preference,
bool ecmp_suppressed);
const PathPreference &path_preference,
bool ecmp_suppressed,
const EcmpLoadBalance &ecmp_load_balance);

private:
string server_vrf_;
Expand All @@ -117,6 +118,7 @@ class ControllerVmRoute : public ControllerPeerPath {
PathPreference path_preference_;
DBRequest nh_req_;
bool ecmp_suppressed_;
EcmpLoadBalance ecmp_load_balance_;
DISALLOW_COPY_AND_ASSIGN(ControllerVmRoute);
};

Expand Down
6 changes: 4 additions & 2 deletions src/vnsw/agent/openstack/instance_service_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@ InstanceServiceAsyncHandler::RouteEntryAdd(const std::string& ip_address,
TunnelType::AllType(),
mpls_label,
vn_list, SecurityGroupList(),
PathPreference(), false);
PathPreference(), false,
EcmpLoadBalance());
InetUnicastAgentRouteTable::AddRemoteVmRouteReq(agent_->local_peer(),
vrf, ipv4, 32, data);
return true;
Expand Down Expand Up @@ -465,7 +466,8 @@ InstanceServiceAsyncHandler::AddRemoteVmRoute(const std::string& ip_address,
agent_->fabric_vrf_name(),
agent_->router_id(), vrf, gw.to_v4(),
TunnelType::AllType(), mpls_label, vn_list,
SecurityGroupList(), PathPreference(), false);
SecurityGroupList(), PathPreference(), false,
EcmpLoadBalance());
agent_->fabric_inet4_unicast_table()->
AddRemoteVmRouteReq(novaPeer_.get(),
vrf, ip.to_v4(), 32, data);
Expand Down
6 changes: 5 additions & 1 deletion src/vnsw/agent/oper/ecmp_load_balance.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class EcmpLoadBalance {
return false;
}

void Copy(const EcmpLoadBalance &rhs) {
virtual void Copy(const EcmpLoadBalance &rhs) {
for (uint8_t field_type = ((uint8_t) EcmpLoadBalance::SOURCE_MAC);
field_type < ((uint8_t) EcmpLoadBalance::NUM_HASH_FIELDS);
field_type++) {
Expand Down Expand Up @@ -249,6 +249,10 @@ class VmiEcmpLoadBalance : public EcmpLoadBalance {
void set_use_global_vrouter(bool use_global_vrouter) {
use_global_vrouter_ = use_global_vrouter;
}
virtual void Copy(const VmiEcmpLoadBalance &rhs) {
use_global_vrouter_ = rhs.use_global_vrouter_;
EcmpLoadBalance::Copy(rhs);
}

private:
bool use_global_vrouter_;
Expand Down
11 changes: 8 additions & 3 deletions src/vnsw/agent/oper/global_vrouter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,14 @@ void GlobalVrouter::GlobalVrouterConfig(DBTablePartBase *partition,
flow_export_rate_ = kDefaultFlowExportRate;
}
UpdateFlowAging(cfg);
EcmpLoadBalance ecmp_load_balance;
if (cfg->ecmp_hashing_include_fields().hashing_configured) {
resync_vn =
ecmp_load_balance_.UpdateFields(cfg->
ecmp_hashing_include_fields());
ecmp_load_balance.UpdateFields(cfg->
ecmp_hashing_include_fields());
}
if (ecmp_load_balance_ != ecmp_load_balance) {
ecmp_load_balance_ = ecmp_load_balance;
resync_vn = true;
}
} else {
DeleteLinkLocalServiceConfig();
Expand Down Expand Up @@ -559,6 +563,7 @@ void GlobalVrouter::GlobalVrouterConfig(DBTablePartBase *partition,
resync_vn = true;
}

//Rebakes VN and then all interfaces.
if (resync_vn)
oper_->agent()->vn_table()->GlobalVrouterConfigChanged();
}
Expand Down
3 changes: 2 additions & 1 deletion src/vnsw/agent/oper/interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ bool InterfaceTable::L2VmInterfaceWalk(DBTablePartBase *partition,
VmInterfaceGlobalVrouterData data(vn->bridging(),
vn->layer3_forwarding(),
vn->GetVxLanId());
return vm_intf->Resync(this, &data);
vm_intf->Resync(this, &data);
return true;
}

void InterfaceTable::VmInterfaceWalkDone(DBTableBase *partition) {
Expand Down
2 changes: 1 addition & 1 deletion src/vnsw/agent/pkt/test/test_ecmp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class EcmpTest : public ::testing::Test {
agent_->fabric_vrf_name(), agent_->router_id(),
vrf_name, addr, TunnelType::AllType(), 16,
vn_list, SecurityGroupList(),
PathPreference(), false);
PathPreference(), false, EcmpLoadBalance());
InetUnicastAgentRouteTable::AddRemoteVmRouteReq(bgp_peer,
vrf_name, addr, plen, data);
}
Expand Down
6 changes: 4 additions & 2 deletions src/vnsw/agent/test-xml/test_xml_oper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,8 @@ bool AgentUtXmlL2Route::Run() {
agent->router_id(), vrf_,
Ip4Address::from_string(tunnel_dest_),
bmap, label_, vn_list, sg_list,
PathPreference(), false);
PathPreference(), false,
EcmpLoadBalance());
rt_table->AddRemoteVmRouteReq(bgp_peer_, vrf_,
MacAddress::FromString(mac_),
Ip4Address::from_string(ip_),
Expand Down Expand Up @@ -1615,7 +1616,8 @@ bool AgentUtXmlL3Route::Run() {
agent->router_id(), vrf_,
Ip4Address::from_string(tunnel_dest_),
bmap, label_, vn_list, sg_list,
PathPreference(), false);
PathPreference(), false,
EcmpLoadBalance());
rt_table->AddRemoteVmRouteReq(bgp_peer_, vrf_,
Ip4Address::from_string(src_ip_), plen_,
data);
Expand Down
1 change: 1 addition & 0 deletions src/vnsw/agent/test/test_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include <oper/route_common.h>
#include <oper/vrf_assign.h>
#include <oper/sg.h>
#include <oper/ecmp_load_balance.h>
#include <uve/stats_collector.h>
#include <uve/agent_uve.h>
#include <vrouter/flow_stats/flow_stats_collector.h>
Expand Down
9 changes: 5 additions & 4 deletions src/vnsw/agent/test/test_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,7 @@ bool BridgeTunnelRouteAdd(const Peer *peer, const string &vm_vrf,
Agent::GetInstance()->router_id(),
vm_vrf, server_ip,
bmap, label, vn_list, SecurityGroupList(),
PathPreference(), false);
PathPreference(), false, EcmpLoadBalance());
EvpnAgentRouteTable::AddRemoteVmRouteReq(peer, vm_vrf, remote_vm_mac,
vm_addr, 0, data);
return true;
Expand Down Expand Up @@ -1470,7 +1470,7 @@ bool Inet6TunnelRouteAdd(const Peer *peer, const string &vm_vrf, const Ip6Addres
Agent::GetInstance()->router_id(),
vm_vrf, server_ip,
bmap, label, vn_list, sg,
path_preference, false);
path_preference, false, EcmpLoadBalance());
InetUnicastAgentRouteTable::AddRemoteVmRouteReq(peer, vm_vrf,
vm_addr, plen, data);
return true;
Expand Down Expand Up @@ -1518,7 +1518,7 @@ bool Inet4TunnelRouteAdd(const Peer *peer, const string &vm_vrf, const Ip4Addres
Agent::GetInstance()->router_id(),
vm_vrf, server_ip,
bmap, label, vn_list, sg,
path_preference, false);
path_preference, false, EcmpLoadBalance());
InetUnicastAgentRouteTable::AddRemoteVmRouteReq(peer, vm_vrf,
vm_addr, plen, data);
return true;
Expand Down Expand Up @@ -1546,7 +1546,8 @@ bool TunnelRouteAdd(const char *server, const char *vmip, const char *vm_vrf,
Agent::GetInstance()->router_id(),
vm_vrf, Ip4Address::from_string(server, ec),
TunnelType::AllType(), label, vn_list,
SecurityGroupList(), PathPreference(), false);
SecurityGroupList(), PathPreference(), false,
EcmpLoadBalance());
InetUnicastAgentRouteTable::AddRemoteVmRouteReq(bgp_peer_, vm_vrf,
Ip4Address::from_string(vmip, ec),
32, data);
Expand Down
4 changes: 2 additions & 2 deletions src/vnsw/agent/vrouter/ksync/test/test_ksync_route.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class TestKSyncRoute : public ::testing::Test {
data = ControllerVmRoute::MakeControllerVmRoute
(NULL, agent_->fabric_vrf_name(), agent_->router_id(),
"vrf1", Ip4Address::from_string("10.10.10.2"), TunnelType::GREType(),
100, vn, sg_list, path_pref, false);
100, vn, sg_list, path_pref, false, EcmpLoadBalance());
vrf1_uc_table_->AddRemoteVmRouteReq(peer, "vrf1", addr, plen, data);
client->WaitForIdle();
}
Expand All @@ -88,7 +88,7 @@ class TestKSyncRoute : public ::testing::Test {
data = ControllerVmRoute::MakeControllerVmRoute
(NULL, agent_->fabric_vrf_name(), agent_->router_id(),
"vrf1", Ip4Address::from_string("10.10.10.2"), TunnelType::GREType(),
100, vn, sg_list, path_pref, false);
100, vn, sg_list, path_pref, false, EcmpLoadBalance());
vrf1_evpn_table_->AddRemoteVmRouteReq(peer, "vrf1", mac, addr,
ethernet_tag, data);
client->WaitForIdle();
Expand Down

0 comments on commit a68749f

Please sign in to comment.