Skip to content

Commit

Permalink
Updated review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
tapashdas committed Dec 18, 2020
1 parent f542d8f commit c9ccfe4
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 17 deletions.
4 changes: 2 additions & 2 deletions orchagent/nexthopkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct NextHopKey
}
}
NextHopKey(const std::string &str, bool overlay_nh)
{
{
if (str.find(NHG_DELIMITER) != string::npos)
{
std::string err = "Error converting " + str + " to NextHop";
Expand All @@ -74,7 +74,7 @@ struct NextHopKey
}

const std::string to_string(bool overlay_nh) const
{
{
std::string s_vni = std::to_string(vni);
return ip_address.to_string() + NH_DELIMITER + alias + NH_DELIMITER + s_vni + NH_DELIMITER + mac_address.to_string();
}
Expand Down
37 changes: 26 additions & 11 deletions orchagent/routeorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,8 @@ void RouteOrch::doTask(Consumer& consumer)
string nhg_str = "";
NextHopGroupKey& nhg = ctx.nhg;

if (overlay_nh == false) {
if (overlay_nh == false)
{
nhg_str = ipv[0] + NH_DELIMITER + alsv[0];

for (uint32_t i = 1; i < ipv.size(); i++)
Expand All @@ -589,7 +590,9 @@ void RouteOrch::doTask(Consumer& consumer)

nhg = NextHopGroupKey(nhg_str);

} else {
}
else
{
nhg_str = ipv[0] + NH_DELIMITER + "vni" + alsv[0] + NH_DELIMITER + vni_labelv[0] + NH_DELIMITER + rmacv[0];
for (uint32_t i = 1; i < ipv.size(); i++)
{
Expand Down Expand Up @@ -843,9 +846,12 @@ void RouteOrch::increaseNextHopRefCount(const NextHopGroupKey &nexthops)
{
NextHopKey nexthop;
bool overlay_nh = nexthops.is_overlay_nexthop();
if (overlay_nh) {
if (overlay_nh)
{
nexthop = NextHopKey (nexthops.to_string(), overlay_nh);
} else {
}
else
{
nexthop = NextHopKey (nexthops.to_string());
}

Expand All @@ -871,9 +877,12 @@ void RouteOrch::decreaseNextHopRefCount(const NextHopGroupKey &nexthops)
{
NextHopKey nexthop;
bool overlay_nh = nexthops.is_overlay_nexthop();
if (overlay_nh) {
if (overlay_nh)
{
nexthop = NextHopKey (nexthops.to_string(), overlay_nh);
} else {
}
else
{
nexthop = NextHopKey (nexthops.to_string());
}

Expand Down Expand Up @@ -1238,7 +1247,7 @@ bool RouteOrch::addRoute(RouteBulkContext& ctx, const NextHopGroupKey &nextHops)
m_vrfOrch->increaseVrfRefCount(vrf_id);
}

if(nextHops.is_overlay_nexthop())
if (nextHops.is_overlay_nexthop())
{
overlay_nh = true;
}
Expand All @@ -1249,9 +1258,12 @@ bool RouteOrch::addRoute(RouteBulkContext& ctx, const NextHopGroupKey &nextHops)
if (nextHops.getSize() == 1)
{
NextHopKey nexthop;
if (overlay_nh) {
if (overlay_nh)
{
nexthop = NextHopKey(nextHops.to_string(), overlay_nh);
} else {
}
else
{
nexthop = NextHopKey(nextHops.to_string());
}

Expand Down Expand Up @@ -1313,9 +1325,12 @@ bool RouteOrch::addRoute(RouteBulkContext& ctx, const NextHopGroupKey &nextHops)
for(auto it = nhops.begin(); it != nhops.end(); ++it)
{
NextHopKey nextHop;
if (overlay_nh) {
if (overlay_nh)
{
nextHop = NextHopKey(*it, overlay_nh);
} else {
}
else
{
nextHop = NextHopKey(*it);
}

Expand Down
17 changes: 14 additions & 3 deletions orchagent/vrforch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,14 @@ bool VRFOrch::addOperation(const Request& request)
vrf_table_[vrf_name].vrf_id = router_id;
vrf_table_[vrf_name].ref_count = 0;
vrf_id_table_[router_id] = vrf_name;
if (vni != 0) {
if (vni != 0)
{
SWSS_LOG_INFO("VRF '%s' vni %d add", vrf_name.c_str(), vni);
error = updateVrfVNIMap(vrf_name, vni);
if (error == false)
{
return false;
}
}
m_stateVrfObjectTable.hset(vrf_name, "state", "ok");
SWSS_LOG_NOTICE("VRF '%s' was added", vrf_name.c_str());
Expand All @@ -123,7 +126,9 @@ bool VRFOrch::addOperation(const Request& request)
SWSS_LOG_INFO("VRF '%s' vni %d modify", vrf_name.c_str(), vni);
error = updateVrfVNIMap(vrf_name, vni);
if (error == false)
{
return false;
}

SWSS_LOG_NOTICE("VRF '%s' was updated", vrf_name.c_str());
}
Expand Down Expand Up @@ -158,7 +163,9 @@ bool VRFOrch::delOperation(const Request& request)
vrf_id_table_.erase(router_id);
error = delVrfVNIMap(vrf_name, 0);
if (error == false)
{
return false;
}
m_stateVrfObjectTable.del(vrf_name);

SWSS_LOG_NOTICE("VRF '%s' was removed", vrf_name.c_str());
Expand All @@ -178,11 +185,15 @@ bool VRFOrch::updateVrfVNIMap(const std::string& vrf_name, uint32_t vni)
old_vni = getVRFmappedVNI(vrf_name);
SWSS_LOG_INFO("VRF '%s' vni %d old_vni %d", vrf_name.c_str(), vni, old_vni);

if (old_vni != vni) {
if (vni == 0) {
if (old_vni != vni)
{
if (vni == 0)
{
error = delVrfVNIMap(vrf_name, old_vni);
if (error == false)
{
return false;
}
} else {
//update l3vni table, if vlan/vni is received later will be able to update L3VniStatus.
l3vni_table_[vni].vlan_id = 0;
Expand Down
2 changes: 1 addition & 1 deletion orchagent/vxlanorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2134,7 +2134,7 @@ bool EvpnNvoOrch::addOperation(const Request& request)
source_vtep_ptr = tunnel_orch->getVxlanTunnel(vtep_name);

SWSS_LOG_INFO("evpnnvo: %s vtep : %s \n",nvo_name.c_str(), vtep_name.c_str());

return true;
}

Expand Down

0 comments on commit c9ccfe4

Please sign in to comment.