Skip to content

Commit bf4d890

Browse files
author
Myron Sosyak
authored
Fix key generation in removeDecapTunnel (#2322)
*After the latest changes in this PR #2190 an issue was introduced. When the tunnel was deleted the TunnelTermEntries were deleted from ASIC but not from the OA cache. Due to that then the same tunnel is created the TunnelTermEntries are not created as OA has it in local cache. Signed-off-by: Myron Sosyak <[email protected]>
1 parent b12af41 commit bf4d890

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

orchagent/tunneldecaporch.cpp

+16-7
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void TunnelDecapOrch::doTask(Consumer& consumer)
6767
{
6868
tunnel_id = tunnelTable[key].tunnel_id;
6969
}
70-
70+
7171
if (op == SET_COMMAND)
7272
{
7373

@@ -240,11 +240,11 @@ void TunnelDecapOrch::doTask(Consumer& consumer)
240240
++it;
241241
continue;
242242
}
243-
243+
244244
//create new tunnel if it doesn't exists already
245245
if (valid && !exists)
246246
{
247-
247+
248248
if (addDecapTunnel(key, tunnel_type, ip_addresses, p_src_ip, dscp_mode, ecn_mode, encap_ecn_mode, ttl_mode,
249249
dscp_to_tc_map_id, tc_to_pg_map_id))
250250
{
@@ -427,7 +427,7 @@ bool TunnelDecapOrch::addDecapTunnel(
427427
attr.value.oid = tc_to_pg_map_id;
428428
tunnel_attrs.push_back(attr);
429429
}
430-
430+
431431
// write attributes to ASIC_DB
432432
sai_object_id_t tunnel_id;
433433
status = sai_tunnel_api->create_tunnel(&tunnel_id, gSwitchId, (uint32_t)tunnel_attrs.size(), tunnel_attrs.data());
@@ -669,8 +669,8 @@ bool TunnelDecapOrch::setTunnelAttribute(string field, sai_object_id_t value, sa
669669
{
670670
// TC remapping.
671671
attr.id = SAI_TUNNEL_ATTR_DECAP_QOS_DSCP_TO_TC_MAP;
672-
attr.value.oid = value;
673-
672+
attr.value.oid = value;
673+
674674
}
675675
else if (field == decap_tc_to_pg_field_name)
676676
{
@@ -763,7 +763,16 @@ bool TunnelDecapOrch::removeDecapTunnel(string table_name, string key)
763763
for (auto it = tunnel_info->tunnel_term_info.begin(); it != tunnel_info->tunnel_term_info.end(); ++it)
764764
{
765765
TunnelTermEntry tunnel_entry_info = *it;
766-
string term_key = tunnel_entry_info.src_ip + '-' + tunnel_entry_info.dst_ip;
766+
string term_key;
767+
swss::IpAddress src_ip(tunnel_entry_info.src_ip);
768+
if (!src_ip.isZero())
769+
{
770+
term_key = src_ip.to_string() + '-' + tunnel_entry_info.dst_ip;
771+
}
772+
else
773+
{
774+
term_key = tunnel_entry_info.dst_ip;
775+
}
767776
if (!removeDecapTunnelTermEntry(tunnel_entry_info.tunnel_term_id, term_key))
768777
{
769778
return false;

0 commit comments

Comments
 (0)