diff --git a/orchagent/nexthopkey.h b/orchagent/nexthopkey.h index 1454d22618..69a94505ae 100644 --- a/orchagent/nexthopkey.h +++ b/orchagent/nexthopkey.h @@ -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"; @@ -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(); } diff --git a/orchagent/routeorch.cpp b/orchagent/routeorch.cpp index 1222dbb0af..03efd31543 100644 --- a/orchagent/routeorch.cpp +++ b/orchagent/routeorch.cpp @@ -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++) @@ -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++) { @@ -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()); } @@ -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()); } @@ -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; } @@ -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()); } @@ -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); } diff --git a/orchagent/vrforch.cpp b/orchagent/vrforch.cpp index a87a822ddc..ee0d9d4ac2 100644 --- a/orchagent/vrforch.cpp +++ b/orchagent/vrforch.cpp @@ -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()); @@ -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()); } @@ -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()); @@ -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; diff --git a/orchagent/vxlanorch.cpp b/orchagent/vxlanorch.cpp index aff3bbf454..4f20d7d60b 100644 --- a/orchagent/vxlanorch.cpp +++ b/orchagent/vxlanorch.cpp @@ -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; }