Skip to content

Commit 820eb74

Browse files
authored
Allow state db to take modified entries made to the tunnel decap table (sonic-net#3960)
What I did Allow state db to take modified entries made to the tunnel decap table Why I did it Prevent DB inconsistency between state, asic and appl db How I verified it redis-cli -n 6 HGETALL "TUNNEL_DECAP_TABLE|IPINIP_V6_TUNNEL" "tunnel_type" "IPINIP" "dscp_mode" "pipe" "ecn_mode" "standard" "ttl_mode" "pipe" /var/log/syslog.1:2025 Nov 10 19:18:32.730385 bjw-can-2700-2 NOTICE swss#orchagent: :- doDecapTunnelTask: Fields for TUNNEL_DECAP_TABLE entry 'IPINIP_TUNNEL' have been synchronised in STATE_DB /var/log/syslog.1:2025 Nov 10 19:18:32.740298 bjw-can-2700-2 NOTICE swss#orchagent: :- doDecapTunnelTask: Fields for TUNNEL_DECAP_TABLE entry 'IPINIP_V6_TUNNEL' have been synchronised in STATE_DB
1 parent 5685653 commit 820eb74

3 files changed

Lines changed: 533 additions & 0 deletions

File tree

orchagent/tunneldecaporch.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ void TunnelDecapOrch::doDecapTunnelTask(Consumer &consumer)
160160
}
161161
if (exists)
162162
{
163+
// Apply to SAI; only touch cache/flag on success
163164
setTunnelAttribute(fvField(i), dscp_mode, tunnel_id);
164165
tunnelTable[key].dscp_mode = dscp_mode;
165166
}
@@ -207,6 +208,7 @@ void TunnelDecapOrch::doDecapTunnelTask(Consumer &consumer)
207208
}
208209
if (exists)
209210
{
211+
// Apply to SAI; only touch cache/flag on success
210212
setTunnelAttribute(fvField(i), ttl_mode, tunnel_id);
211213
}
212214
}
@@ -221,6 +223,7 @@ void TunnelDecapOrch::doDecapTunnelTask(Consumer &consumer)
221223
}
222224
if (exists)
223225
{
226+
// Apply to SAI; only touch cache/flag on success
224227
setTunnelAttribute(fvField(i), dscp_to_tc_map_id, tunnel_id);
225228
}
226229
}
@@ -235,6 +238,7 @@ void TunnelDecapOrch::doDecapTunnelTask(Consumer &consumer)
235238
}
236239
if (exists)
237240
{
241+
// Apply to SAI; only touch cache/flag on success
238242
setTunnelAttribute(fvField(i), tc_to_pg_map_id, tunnel_id);
239243
}
240244
}
@@ -276,6 +280,13 @@ void TunnelDecapOrch::doDecapTunnelTask(Consumer &consumer)
276280
}
277281
}
278282

283+
if (exists)
284+
{
285+
// Publish to STATE_DB if any mirrored field changed
286+
setDecapTunnelStatus(key);
287+
SWSS_LOG_NOTICE("Fields for TUNNEL_DECAP_TABLE entry '%s' have been synchronised in STATE_DB", key.c_str());
288+
}
289+
279290
if (task_status == task_process_status::task_need_retry)
280291
{
281292
++it;

tests/mock_tests/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ tests_SOURCES = aclorch_ut.cpp \
4141
saispy_ut.cpp \
4242
consumer_ut.cpp \
4343
sfloworh_ut.cpp \
44+
tunneldecaporch_ut.cpp \
4445
ut_saihelper.cpp \
4546
mock_orchagent_main.cpp \
4647
mock_dbconnector.cpp \

0 commit comments

Comments
 (0)