Skip to content

Commit 29722e1

Browse files
[vxlan orch]: Vxlan enhancements: add logs for successful events, change 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
1 parent e2e35e3 commit 29722e1

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

orchagent/vxlanorch.cpp

+12-8
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ bool VxlanTunnelOrch::addOperation(const Request& request)
193193
auto src_ip = request.getAttrIP("src_ip");
194194
if (!src_ip.isV4())
195195
{
196-
SWSS_LOG_ERROR("Wrong attribute: 'src_ip'. Currently only IPv4 address is supported");
197-
return false;
196+
SWSS_LOG_ERROR("Wrong format of the attribute: 'src_ip'. Currently only IPv4 address is supported");
197+
return true;
198198
}
199199

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

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

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

238238
vxlan_tunnel_table_[tunnel_name] = ids;
239239

240+
SWSS_LOG_NOTICE("Vxlan tunnel '%s' was created", tunnel_name.c_str());
241+
240242
return true;
241243
}
242244

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

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

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

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

303+
SWSS_LOG_NOTICE("Vxlan tunnel map entry '%s' for tunnel '%s' was created", tunnel_map_entry_name.c_str(), tunnel_name.c_str());
304+
301305
return true;
302306
}
303307

0 commit comments

Comments
 (0)