Skip to content

Commit

Permalink
Fix key generation in removeDecapTunnel (#2322)
Browse files Browse the repository at this point in the history
*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 <myronx.sosyak@intel.com>
  • Loading branch information
Myron Sosyak authored Jun 13, 2022
1 parent b12af41 commit bf4d890
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions orchagent/tunneldecaporch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void TunnelDecapOrch::doTask(Consumer& consumer)
{
tunnel_id = tunnelTable[key].tunnel_id;
}

if (op == SET_COMMAND)
{

Expand Down Expand Up @@ -240,11 +240,11 @@ void TunnelDecapOrch::doTask(Consumer& consumer)
++it;
continue;
}

//create new tunnel if it doesn't exists already
if (valid && !exists)
{

if (addDecapTunnel(key, tunnel_type, ip_addresses, p_src_ip, dscp_mode, ecn_mode, encap_ecn_mode, ttl_mode,
dscp_to_tc_map_id, tc_to_pg_map_id))
{
Expand Down Expand Up @@ -427,7 +427,7 @@ bool TunnelDecapOrch::addDecapTunnel(
attr.value.oid = tc_to_pg_map_id;
tunnel_attrs.push_back(attr);
}

// write attributes to ASIC_DB
sai_object_id_t tunnel_id;
status = sai_tunnel_api->create_tunnel(&tunnel_id, gSwitchId, (uint32_t)tunnel_attrs.size(), tunnel_attrs.data());
Expand Down Expand Up @@ -669,8 +669,8 @@ bool TunnelDecapOrch::setTunnelAttribute(string field, sai_object_id_t value, sa
{
// TC remapping.
attr.id = SAI_TUNNEL_ATTR_DECAP_QOS_DSCP_TO_TC_MAP;
attr.value.oid = value;
attr.value.oid = value;

}
else if (field == decap_tc_to_pg_field_name)
{
Expand Down Expand Up @@ -763,7 +763,16 @@ bool TunnelDecapOrch::removeDecapTunnel(string table_name, string key)
for (auto it = tunnel_info->tunnel_term_info.begin(); it != tunnel_info->tunnel_term_info.end(); ++it)
{
TunnelTermEntry tunnel_entry_info = *it;
string term_key = tunnel_entry_info.src_ip + '-' + tunnel_entry_info.dst_ip;
string term_key;
swss::IpAddress src_ip(tunnel_entry_info.src_ip);
if (!src_ip.isZero())
{
term_key = src_ip.to_string() + '-' + tunnel_entry_info.dst_ip;
}
else
{
term_key = tunnel_entry_info.dst_ip;
}
if (!removeDecapTunnelTermEntry(tunnel_entry_info.tunnel_term_id, term_key))
{
return false;
Expand Down

0 comments on commit bf4d890

Please sign in to comment.