Skip to content

Commit

Permalink
Apply context check if objectId is not NULL
Browse files Browse the repository at this point in the history
Extend the context check to all redis attrs
  • Loading branch information
byu343 committed Oct 8, 2024
1 parent 0ece9dc commit 2281261
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/RedisRemoteSaiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2056,7 +2056,7 @@ bool RedisRemoteSaiInterface::containsSwitch(

if (!m_switchContainer->contains(switchId))
{
SWSS_LOG_WARN("context %s failed to find switch %s",
SWSS_LOG_INFO("context %s failed to find switch %s",
m_contextConfig->m_name.c_str(), sai_serialize_object_id(switchId).c_str());
return false;
}
Expand Down
8 changes: 2 additions & 6 deletions lib/Sai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,12 @@ sai_status_t Sai::set(

// skip metadata if attribute is redis extension attribute

// TODO this is setting on all contexts, but maybe we want one specific?
// and do set on all if objectId == NULL

bool success = true;

// Setting on all contexts if objectType != SAI_OBJECT_TYPE_SWITCH or objectId == NULL
for (auto& kvp: m_contextMap)
{
if (objectType == SAI_OBJECT_TYPE_SWITCH && objectId != SAI_NULL_OBJECT_ID &&
(attr->id == SAI_REDIS_SWITCH_ATTR_FLEX_COUNTER ||
attr->id == SAI_REDIS_SWITCH_ATTR_FLEX_COUNTER_GROUP))
if (objectType == SAI_OBJECT_TYPE_SWITCH && objectId != SAI_NULL_OBJECT_ID)
{
if (!kvp.second->m_redisSai->containsSwitch(objectId))
{
Expand Down

0 comments on commit 2281261

Please sign in to comment.