Skip to content

Commit

Permalink
[vxlan orch]: Vxlan enhancements: add logs for successful events, cha…
Browse files Browse the repository at this point in the history
…nge retry logic. (sonic-net#605)

* Add log output when we add vxlan tunnel and vxlan tunnel map entry

* Don't retry when we have wrong format of an attribute, or already the vxlan objects are already exist
  • Loading branch information
pavel-shirshov authored Sep 5, 2018
1 parent e2e35e3 commit 29722e1
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions orchagent/vxlanorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ bool VxlanTunnelOrch::addOperation(const Request& request)
auto src_ip = request.getAttrIP("src_ip");
if (!src_ip.isV4())
{
SWSS_LOG_ERROR("Wrong attribute: 'src_ip'. Currently only IPv4 address is supported");
return false;
SWSS_LOG_ERROR("Wrong format of the attribute: 'src_ip'. Currently only IPv4 address is supported");
return true;
}

IpAddress dst_ip;
Expand All @@ -208,8 +208,8 @@ bool VxlanTunnelOrch::addOperation(const Request& request)
dst_ip = request.getAttrIP("dst_ip");
if (!dst_ip.isV4())
{
SWSS_LOG_ERROR("Wrong attribute: 'dst_ip'. Currently only IPv4 address is supported");
return false;
SWSS_LOG_ERROR("Wrong format of the attribute: 'dst_ip'. Currently only IPv4 address is supported");
return true;
}
}

Expand All @@ -218,7 +218,7 @@ bool VxlanTunnelOrch::addOperation(const Request& request)
if(isTunnelExists(tunnel_name))
{
SWSS_LOG_ERROR("Vxlan tunnel '%s' is already exists", tunnel_name.c_str());
return false;
return true;
}

tunnel_ids_t ids;
Expand All @@ -237,6 +237,8 @@ bool VxlanTunnelOrch::addOperation(const Request& request)

vxlan_tunnel_table_[tunnel_name] = ids;

SWSS_LOG_NOTICE("Vxlan tunnel '%s' was created", tunnel_name.c_str());

return true;
}

Expand Down Expand Up @@ -265,7 +267,7 @@ bool VxlanTunnelMapOrch::addOperation(const Request& request)
if (vni_id >= 1<<24)
{
SWSS_LOG_ERROR("Vxlan tunnel map vni id is too big: %d", vni_id);
return false;
return true;
}

auto tunnel_name = request.getKeyString(0);
Expand All @@ -280,10 +282,11 @@ bool VxlanTunnelMapOrch::addOperation(const Request& request)
if (isTunnelMapExists(full_tunnel_map_entry_name))
{
SWSS_LOG_ERROR("Vxlan tunnel map '%s' is already exist", full_tunnel_map_entry_name.c_str());
return false;
return true;
}

const auto tunnel_map_id = tunnel_orch->getTunnelMapId(tunnel_name);
const auto tunnel_map_entry_name = request.getKeyString(1);

try
{
Expand All @@ -292,12 +295,13 @@ bool VxlanTunnelMapOrch::addOperation(const Request& request)
}
catch(const std::runtime_error& error)
{
auto tunnel_map_entry_name = request.getKeyString(1);
SWSS_LOG_ERROR("Error adding tunnel map entry. Tunnel: %s. Entry: %s. Error: %s",
tunnel_name.c_str(), tunnel_map_entry_name.c_str(), error.what());
return false;
}

SWSS_LOG_NOTICE("Vxlan tunnel map entry '%s' for tunnel '%s' was created", tunnel_map_entry_name.c_str(), tunnel_name.c_str());

return true;
}

Expand Down

0 comments on commit 29722e1

Please sign in to comment.